searchWin.html 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  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. .nav_title{
  107. padding: 0 5px;
  108. background: #f3f6fa;
  109. }
  110. .nav_title li{
  111. text-align: center;
  112. font-size: 14px;
  113. padding: 12px 0 ;
  114. }
  115. .nav_title li:nth-child(1){
  116. width: 20%;
  117. }
  118. .nav_title li:nth-child(2){
  119. width: 60%;
  120. }
  121. .nav_title li:nth-child(3){
  122. width: 20%;
  123. }
  124. </style>
  125. </head>
  126. <body>
  127. <div class="api_layout">
  128. <header class="header-login">
  129. <img class="backBtn" src="../../image/btn_back.png" alt="" onclick="backIndex()">
  130. <div class="aui-searchbar" id="search">
  131. <div class="aui-searchbar-input aui-border-radius">
  132. <i class="search_ico"></i>
  133. <form>
  134. <input type="search" placeholder="搜索" id="search-input">
  135. </form>
  136. </div>
  137. <span class="search_btn" onclick="seacrhWinFun(inputValue)">搜索</span>
  138. </div>
  139. </header>
  140. <nav>
  141. <ul class="nav_title flex-space">
  142. <li>序号</li>
  143. <li>安装地点</li>
  144. <li>数值/状态</li>
  145. </ul>
  146. </nav>
  147. </div>
  148. </body>
  149. </html>
  150. <script type="text/javascript" src="../../script/api.js"></script>
  151. <!-- <script src="../../script/fastclick.min.js" charset="utf-8"></script> -->
  152. <script type="text/javascript" src="../../script/config.js"></script>
  153. <script type="text/javascript">
  154. var inputValue = ''
  155. apiready = function () {
  156. $api.fixStatusBar($api.dom('header') );
  157. fnInitUIInput();
  158. openFrame();
  159. };
  160. var eHeaderLis,index = 0;
  161. function openFrame() {
  162. api.openFrame({
  163. name: 'searchFrame',
  164. url: 'searchFrame.html',
  165. rect: {
  166. x: 0,
  167. y: $api.dom('header').offsetHeight + $api.dom('nav').offsetHeight,
  168. w: 'auto',
  169. h: 'auto'
  170. },
  171. bounces: true,
  172. bgColor: '#fff',
  173. vScrollBarEnabled: true,
  174. hScrollBarEnabled: true
  175. });
  176. }
  177. function backIndex() {
  178. api.closeWin();
  179. }
  180. // input
  181. function fnInitUIInput() {
  182. var searchText = $api.byId('search-input');
  183. var rect = $api.offset(searchText);
  184. var UIInput = api.require('UIInput');
  185. UIInput.open({
  186. rect: {
  187. x: rect.l,
  188. y: rect.t+1,
  189. w: rect.w,
  190. h: rect.h-1
  191. },
  192. styles: {
  193. bgColor: '#fff',
  194. size: 14,
  195. color: '#000',
  196. placeholder: {
  197. color: '#ccc'
  198. }
  199. },
  200. autoFocus: false,
  201. maxRows: 1,
  202. placeholder: '搜索',
  203. keyboardType: 'default',
  204. fixedOn: api.frameName
  205. }, function(ret, err) {
  206. if (ret) {
  207. var uiInputId = ret.id;
  208. if (ret && ret.eventType == "show") {
  209. setTimeout(function() {
  210. UIInput.popupKeyboard({id: uiInputId});
  211. }, 300)
  212. } else if (ret.eventType == "change") {
  213. UIInput.value({
  214. id: uiInputId
  215. }, function(ret, err) {
  216. if (ret) {
  217. if (ret.status) {
  218. inputValue = ret.msg;
  219. seacrhWinFun(ret.msg);
  220. }
  221. }
  222. });
  223. }
  224. }
  225. });
  226. }
  227. // 查询
  228. function seacrhWinFun(text) {
  229. var pageNum = 1;
  230. api.execScript({
  231. name: 'searchWin',
  232. frameName: 'searchFrame',
  233. script: 'searchData("'+text+'","'+pageNum+'");'
  234. });
  235. }
  236. </script>