search.vue 3.8 KB

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