search_win.html 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
  6. <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
  7. <meta name="format-detection"content="telephone=no">
  8. <title>index</title>
  9. <link rel="stylesheet" type="text/css" href="../../css/api.css"/>
  10. <link rel="stylesheet" href="../../css/projeck.css">
  11. <style media="screen">
  12. body,html{
  13. margin: 0;
  14. background: #fff;
  15. }
  16. .aui-searchbar{
  17. width: 86%;
  18. height: 50px;
  19. margin-left: 40px;
  20. background-color: transparent;
  21. }
  22. .aui-searchbar .aui-searchbar-btn{
  23. color: #fff;
  24. }
  25. .aui-searchbar-input{
  26. background: #fff;
  27. }
  28. .aui-searchbar-input input{
  29. color: #000;
  30. }
  31. #search-input::placeholder{
  32. color: #ccc;
  33. font-size: 14px;
  34. }
  35. .search_ico{
  36. width: 16px;
  37. height: 16px;
  38. display: block;
  39. position: absolute;
  40. background: url("../../image/search.png") no-repeat;
  41. background-size: cover;
  42. top: 8px;
  43. left: 17px;
  44. }
  45. .backBtn{
  46. margin-left: 5px;
  47. }
  48. #search-input{
  49. font-size: 14px;
  50. height: 28px;
  51. }
  52. .aui-searchbar-input{
  53. margin-right: 60px;
  54. }
  55. .search_btn{
  56. position: absolute;
  57. bottom: 9px;
  58. right: 10px;
  59. width: 54px;
  60. height: 31px;
  61. line-height: 31px;
  62. -webkit-border-radius: 50px;
  63. -moz-border-radius: 50px;
  64. border-radius: 50px;
  65. color: #000;
  66. background: #fff;
  67. font-size: 13px;
  68. }
  69. nav{
  70. background: #009fe8;
  71. position: relative;
  72. }
  73. .row{
  74. padding: 0 30px 24px 30px;
  75. }
  76. .row li{
  77. padding: 5px;
  78. color: #72e5ff;
  79. font-size: 16px;
  80. position: relative;
  81. }
  82. .row li.selectIndex{
  83. color: #fff;
  84. }
  85. .row li.selectIndex:after{
  86. content: '';
  87. position: absolute;
  88. bottom: 0;
  89. left: 0;
  90. width: 100%;
  91. height: 2px;
  92. background: #fff;
  93. }
  94. .radius_top{
  95. width: 100%;
  96. height: 10px;
  97. background: #fff;
  98. border-top-left-radius: 10px;
  99. border-top-right-radius: 10px;
  100. -webkit-border-top-left-radius: 10px;
  101. -webkit-border-top-right-radius: 10px;
  102. position: absolute;
  103. bottom: 0;
  104. left: 0;
  105. }
  106. </style>
  107. </head>
  108. <body>
  109. <div class="api_layout">
  110. <header class="header-login">
  111. <img class="backBtn" src="../../image/btn_back.png" alt="" onclick="backIndex()">
  112. <div class="aui-searchbar" id="search">
  113. <div class="aui-searchbar-input aui-border-radius">
  114. <i class="search_ico"></i>
  115. <form>
  116. <input type="search" placeholder="搜索" id="search-input">
  117. </form>
  118. </div>
  119. <span class="search_btn" onclick="seacrhWinFun(inputValue)">搜索</span>
  120. </div>
  121. </header>
  122. <nav>
  123. <ul class="row flex-space">
  124. <li class="selectIndex" onclick="randomSwitchBtn(this)">二维码</li>
  125. <!-- <li onclick="randomSwitchBtn(this)">设备物资</li> -->
  126. <!-- <li onclick="randomSwitchBtn(this)">固定电缆</li> -->
  127. <!-- <li onclick="randomSwitchBtn(this)">添加人</li> -->
  128. </ul>
  129. <div class="radius_top"></div>
  130. </nav>
  131. </div>
  132. </body>
  133. </html>
  134. <script type="text/javascript" src="../../script/api.js"></script>
  135. <!-- <script src="../../script/fastclick.min.js" charset="utf-8"></script> -->
  136. <script type="text/javascript" src="../../script/config.js"></script>
  137. <script type="text/javascript">
  138. var inputValue = ''
  139. apiready = function () {
  140. $api.fixStatusBar($api.dom('header') );
  141. // api.parseTapmode();
  142. // var info = $api.getStorage('data'),
  143. // token = JSON.parse(info).data.access_token;
  144. fnInitUIInput();
  145. funIniGroup();
  146. };
  147. var eHeaderLis,index = 0;
  148. function funIniGroup(){
  149. eHeaderLis = $api.domAll('.row li'),
  150. frames = [];
  151. for (var i = 0,len = eHeaderLis.length; i < len; i++) {
  152. frames.push( {
  153. name: 'search_frame'+i,
  154. url: 'search_frame'+i+'.html',
  155. bgColor : '#fff',
  156. bounces:true
  157. } )
  158. }
  159. api.openFrameGroup({
  160. name: 'group',
  161. scrollEnabled: true,
  162. rect: {
  163. x: 0,
  164. y: $api.dom('header').offsetHeight+$api.dom('nav').offsetHeight-2,
  165. w: api.winWidth,
  166. h: $api.winHeight
  167. },
  168. index: 0,
  169. frames: frames
  170. }, function (ret, err) {
  171. index = ret.index;
  172. menuSelected(ret.index);
  173. });
  174. };
  175. function menuSelected(index) {
  176. for (var i = 0; i < eHeaderLis.length; i++) {
  177. if(index == i ){
  178. $api.addCls(eHeaderLis[i], 'selectIndex');
  179. }else {
  180. $api.removeCls(eHeaderLis[i], 'selectIndex');
  181. }
  182. }
  183. }
  184. function randomSwitchBtn( tag ) {
  185. if( tag == $api.dom('.row li.selectIndex') )return;
  186. var eFootLis = $api.domAll('.row li');
  187. index = 0;
  188. for (var i = 0,len = eFootLis.length; i < len; i++) {
  189. if( tag == eFootLis[i] ){
  190. index = i;
  191. }else{
  192. $api.removeCls(eFootLis[i], 'selectIndex');
  193. }
  194. }
  195. $api.addCls( eFootLis[index], 'selectIndex');
  196. api.setFrameGroupIndex({
  197. name: 'group',
  198. index: index
  199. });
  200. }
  201. function backIndex() {
  202. api.sendEvent({
  203. name: 'userInfo',
  204. extra: {
  205. key1: 'value1',
  206. key2: 'value2'
  207. }
  208. });
  209. api.closeWin();
  210. }
  211. // input
  212. function fnInitUIInput() {
  213. var searchText = $api.byId('search-input');
  214. var rect = $api.offset(searchText);
  215. var UIInput = api.require('UIInput');
  216. UIInput.open({
  217. rect: {
  218. x: rect.l,
  219. y: rect.t+1,
  220. w: rect.w,
  221. h: rect.h-1
  222. },
  223. styles: {
  224. bgColor: '#fff',
  225. size: 14,
  226. color: '#000',
  227. placeholder: {
  228. color: '#ccc'
  229. }
  230. },
  231. autoFocus: false,
  232. maxRows: 1,
  233. placeholder: '搜索',
  234. keyboardType: 'search',
  235. fixedOn: api.frameName
  236. }, function(ret, err) {
  237. if (ret) {
  238. var uiInputId = ret.id;
  239. if (ret && ret.eventType == "show") {
  240. setTimeout(function() {
  241. UIInput.popupKeyboard({id: uiInputId});
  242. }, 300)
  243. } else if (ret.eventType == "search") {
  244. UIInput.value({
  245. id: uiInputId
  246. }, function(ret, err) {
  247. if (ret) {
  248. if (ret.status) {
  249. inputValue = ret.msg;
  250. seacrhWinFun(ret.msg);
  251. }
  252. }
  253. });
  254. }
  255. }
  256. });
  257. }
  258. // 查询
  259. function seacrhWinFun(text) {
  260. api.execScript({
  261. name: 'search_win',
  262. frameName: 'search_frame'+index,
  263. script: 'seachQrcodeFun'+index+'("'+text+'");'
  264. });
  265. }
  266. </script>