index.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <template>
  2. <view>
  3. <view style="position: fixed;z-index: 100;">
  4. <uni-nav-bar @clickLeft="clickLeft" left-icon="back" left-text="返回" title="四情基地"></uni-nav-bar>
  5. <u-icon name="plus-circle" class="tianjia" @click="clickRight"></u-icon>
  6. </view>
  7. <view class="bases_search">
  8. <view class="bases_search_text">
  9. <u-icon name="search" class="search" @click="search"></u-icon>
  10. <input type="text" v-model="data.search" placeholder="请输入基地名称" @input="searchinput"/>
  11. </view>
  12. </view>
  13. <view class="bases">
  14. <view class="bases_list" v-for="(items,index) in baselist" :key="index" @click="details">
  15. <view class="bases_list_bgi" >
  16. <image :src="items.base_img" mode=""></image>
  17. </view>
  18. <view class="bases_list_text">
  19. <p><span style="margin-right: 30rpx;">{{items.base_name}}</span><span>{{items.base_area}}㎡</span></p>
  20. <p style="font-size: 24rpx;">联系人:{{items.base_charge}}</p>
  21. <p style="font-size: 24rpx;">联系电话:{{items.base_phone}}</p>
  22. <p style="font-size: 24rpx;">地址:{{items.base_name}}</p>
  23. </view>
  24. <u-icon name="more-dot-fill" class="bases_list_xiangqing" @click.native.stop="XQclick"></u-icon>
  25. <view class="photoshow">
  26. <image src="../../static/image/fourMoodBase/测报灯.png" mode=""></image>
  27. <image src="../../static/image/fourMoodBase/杀虫灯.png" mode=""></image>
  28. <image src="../../static/image/fourMoodBase/环境监测.png" mode=""></image>
  29. <view class="photoshow_num">
  30. 6+
  31. </view>
  32. </view>
  33. </view>
  34. <u-action-sheet :list="actionSheetList" v-model="post_show" @click="message"></u-action-sheet>
  35. </view>
  36. </view>
  37. </template>
  38. <script>
  39. import {
  40. Debounce,
  41. Throttle
  42. } from "../../util/anitthro.js"
  43. export default {
  44. data() {
  45. return {
  46. data: {
  47. ret: 'list',
  48. search: '',
  49. page_size: 10,
  50. page: 1
  51. },
  52. baselist: [],
  53. actionSheetList:[{
  54. text:"编辑基地"
  55. },{
  56. text:"删除基地"
  57. }],
  58. post_show:false
  59. }
  60. },
  61. methods: {
  62. async getFourbase() { //基地列表
  63. const res = await this.$myRequest({
  64. url: '/api/api_gateway?method=base.bases.base_list',
  65. data: this.data
  66. })
  67. this.baselist = this.baselist.concat(res.data)
  68. console.log(this.baselist)
  69. },
  70. clickLeft(){//返回主页
  71. uni.switchTab({
  72. url:"../index/index"
  73. })
  74. },
  75. clickRight(){//添加基地
  76. uni.navigateTo({
  77. url:"./addbase"
  78. })
  79. },
  80. searchinput() {//搜索
  81. this.data.page=1
  82. Debounce(() => {
  83. this.getFourbase()
  84. }, 1000)()
  85. },
  86. search(){//搜索按钮
  87. this.data.page=1
  88. this.getFourbase()
  89. },
  90. details(){//详情页
  91. console.log(1)
  92. },
  93. XQclick(){//编辑
  94. this.post_show=!this.post_show
  95. },
  96. message(index){//编辑或者删除
  97. console.log(index)
  98. }
  99. },
  100. onLoad() {
  101. this.getFourbase()
  102. },
  103. onReachBottom() {//滑动到底部加载
  104. this.data.page++
  105. this.getFourbase()
  106. },
  107. }
  108. </script>
  109. <style lang="scss">
  110. .tianjia {
  111. position: absolute;
  112. top: 24rpx;
  113. right: 24rpx;
  114. font-size: 38rpx;
  115. }
  116. .bases_search{
  117. width: 100%;
  118. position: fixed;
  119. top: 44px;
  120. z-index: 100;
  121. background-color: #FFFFFF;
  122. .bases_search_text{
  123. width: 90%;
  124. margin: 0 auto;
  125. background-color: #F8F8F8;
  126. height: 60rpx;
  127. border-radius: 30rpx;
  128. display: flex;
  129. line-height: 60rpx;
  130. .search{
  131. padding:0 20rpx ;
  132. font-size: 34rpx;
  133. }
  134. input{
  135. width: 80%;
  136. margin-top: 10rpx;
  137. font-size: 28rpx;
  138. }
  139. }
  140. }
  141. .bases {
  142. width: 100%;
  143. position: relative;
  144. top: 170rpx;
  145. .bases_list {
  146. width: 90%;
  147. margin: 0 auto 20rpx;
  148. height: 276rpx;
  149. position: relative;
  150. .bases_list_bgi {
  151. image {
  152. position: absolute;
  153. top: 0;
  154. left: 0;
  155. width: 100%;
  156. height: 276rpx;
  157. border-radius: 25rpx;
  158. }
  159. }
  160. .bases_list_text {
  161. position: absolute;
  162. top: 0;
  163. left: 0;
  164. z-index: 10;
  165. padding: 40rpx;
  166. color: #FFFFFF;
  167. p{
  168. margin-bottom: 10rpx;
  169. }
  170. }
  171. .bases_list_xiangqing{
  172. position: absolute;
  173. top: 20rpx;
  174. right: 20rpx;
  175. transform: rotate(90deg);
  176. font-size: 26rpx;
  177. color: #FFFFFF;
  178. }
  179. .photoshow{
  180. width: 160rpx;
  181. height: 42rpx;
  182. display: flex;
  183. position: absolute;
  184. bottom: 26rpx;
  185. right: 36rpx;
  186. background-color: #a7a8a0;
  187. border-radius: 18rpx;
  188. padding: 4rpx;
  189. image{
  190. width: 32rpx;
  191. height: 32rpx;
  192. margin-right: 4rpx;
  193. }
  194. .photoshow_num{
  195. width: 50rpx;
  196. height: 34rpx;
  197. border: 1px solid #FFFFFF;
  198. border-radius: 17rpx;
  199. text-align: center;
  200. line-height: 28rpx;
  201. font-size: 24rpx;
  202. color: #FFFFFF;
  203. }
  204. }
  205. }
  206. }
  207. </style>