search.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. <template>
  2. <view>
  3. <view class="content">
  4. <view :style="{height:statusBarHeight + 'px'}"></view>
  5. <view class="navbar">
  6. <view class="left" @click="click_left()">
  7. <uni-icons type="arrowleft" color="#fff" size="18"></uni-icons>
  8. </view>
  9. <view class="right">
  10. <view class="input_box">
  11. <view class="input_icon"></view>
  12. <view class="input_text">
  13. <input type="text" v-model="search_text" placeholder="搜索" placeholder-style="color:#fff;" />
  14. </view>
  15. </view>
  16. </view>
  17. <view class="btn" @click="search()">搜索</view>
  18. </view>
  19. </view>
  20. <!-- 占位符 -->
  21. <view :style="{height: statusBarHeight + 'px'}"></view>
  22. <view style="height: 93rpx;"></view>
  23. <!-- 搜索列表 -->
  24. <view class="list">
  25. <view class="item" v-for="(item,index) in list" :key="index" @click="go_record(item.id)">
  26. <view class="title">{{item.title}}</view>
  27. <view class="icon">
  28. <uni-icons type="arrowright"></uni-icons>
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. </template>
  34. <script>
  35. export default {
  36. data() {
  37. return {
  38. mine_code: "",
  39. statusBarHeight: 25,
  40. // 搜索关键词
  41. search_text: "",
  42. // 搜索结果列表
  43. list: [],
  44. };
  45. },
  46. onLoad(option) {
  47. this.mine_code = option.mine_code
  48. // 获取手机系统信息
  49. const info = uni.getSystemInfoSync()
  50. // 设置状态栏高度
  51. this.statusBarHeight = info.statusBarHeight
  52. console.log(this.mine_code)
  53. // 根据矿编码切换首页接口不同的请求基础路径
  54. switch (this.mine_code) {
  55. case 'ningdongyunying':
  56. this.base_url = "http://ningdongyunying.nxjiewei.com:8011/api"
  57. break;
  58. case 'meihuajing':
  59. this.base_url = "http://meihuajing.nxjiewei.com:8011/api"
  60. break;
  61. case 'zaoquan':
  62. this.base_url = "http://zaoquan.nxjiewei.com:8011/api"
  63. break;
  64. default:
  65. this.base_url = ""
  66. }
  67. },
  68. methods: {
  69. click_left() {
  70. uni.navigateBack();
  71. },
  72. search() {
  73. uni.showLoading()
  74. uni.request({
  75. url: this.base_url + "/swagger/api/page/v1/getPageList",
  76. method: "GET",
  77. data: {
  78. title: this.search_text,
  79. departmentId: "",
  80. pageNumber: 0,
  81. pageSize: 0
  82. },
  83. success: (res) => {
  84. console.log(res)
  85. uni.hideLoading()
  86. this.list = res.data.data
  87. }
  88. })
  89. },
  90. // 打开二维码页面
  91. go_record(id) {
  92. uni.navigateTo({
  93. url:"../../index/record/record?pageId=" + id + "&mine_code=" + this.mine_code,
  94. })
  95. }
  96. }
  97. }
  98. </script>
  99. <style lang="scss">
  100. .content {
  101. position: fixed;
  102. top: 0;
  103. left: 0;
  104. background-color: #009FE8;
  105. z-index: 999;
  106. }
  107. .navbar {
  108. width: 750rpx;
  109. box-sizing: border-box;
  110. padding-left: 31rpx;
  111. padding-right: 26rpx;
  112. padding-top: 14rpx;
  113. padding-bottom: 14rpx;
  114. display: flex;
  115. // justify-content: space-between;
  116. .left {
  117. width: 42rpx;
  118. line-height: 65rpx;
  119. margin-right: 15rpx;
  120. }
  121. .right {
  122. width: 500rpx;
  123. height: 65rpx;
  124. background: rgba(255, 255, 255, 0.2);
  125. border-radius: 33rpx;
  126. .input_box {
  127. display: flex;
  128. .input_icon {
  129. margin-left: 43rpx;
  130. margin-top: 16rpx;
  131. width: 34rpx;
  132. height: 34rpx;
  133. background-image: url(icon/search.png);
  134. background-size: cover;
  135. background-repeat: no-repeat;
  136. }
  137. .input_text {
  138. margin-left: 19rpx;
  139. font-size: 24rpx;
  140. font-family: PingFangSC-Regular, PingFang SC;
  141. font-weight: 400;
  142. color: #FFFFFF;
  143. line-height: 65rpx;
  144. input {
  145. font-size: 24rpx;
  146. height: 65rpx;
  147. line-height: 65rpx;
  148. }
  149. }
  150. }
  151. }
  152. .btn {
  153. margin-left: 20rpx;
  154. width: 120rpx;
  155. text-align: center;
  156. height: 65rpx;
  157. line-height: 65rpx;
  158. background: rgba(255, 255, 255, 0.2);
  159. border-radius: 33rpx;
  160. font-size: 24rpx;
  161. font-family: PingFangSC-Regular, PingFang SC;
  162. font-weight: 400;
  163. color: #FFFFFF;
  164. }
  165. }
  166. .list {
  167. box-sizing: border-box;
  168. padding: 25rpx;
  169. .item {
  170. display: flex;
  171. justify-content: space-between;
  172. align-items: center;
  173. box-sizing: border-box;
  174. padding: 35rpx 0;
  175. border-bottom: 1rpx solid #F4F4F4;
  176. .title {
  177. font-size: 32rpx;
  178. }
  179. .icon {}
  180. }
  181. }
  182. </style>