index.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  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(items.id)">
  15. <view class="bases_list_bgi" >
  16. <image :src="items.base_img" mode=""></image>
  17. <view class="bgcolor">
  18. </view>
  19. </view>
  20. <view class="bases_list_text">
  21. <p><span style="margin-right: 30rpx;">{{items.base_name}}</span><span>{{items.base_area}}㎡</span></p>
  22. <p style="font-size: 24rpx;">联系人:{{items.base_charge}}</p>
  23. <p style="font-size: 24rpx;">联系电话:{{items.base_phone}}</p>
  24. <p style="font-size: 24rpx;">地址:{{items.base_name}}</p>
  25. </view>
  26. <u-icon name="more-dot-fill" class="bases_list_xiangqing" @click.native.stop="XQclick(items)"></u-icon>
  27. <view class="photoshow">
  28. <image src="../../static/image/fourMoodBase/测报灯.png" mode=""></image>
  29. <image src="../../static/image/fourMoodBase/杀虫灯.png" mode=""></image>
  30. <image src="../../static/image/fourMoodBase/环境监测.png" mode=""></image>
  31. <view class="photoshow_num">
  32. 6+
  33. </view>
  34. </view>
  35. </view>
  36. <u-action-sheet :list="actionSheetList" v-model="post_show" @click="message"></u-action-sheet>
  37. </view>
  38. </view>
  39. </template>
  40. <script>
  41. import {
  42. Debounce,
  43. Throttle
  44. } from "../../util/anitthro.js"
  45. export default {
  46. data() {
  47. return {
  48. data: {
  49. ret: 'list',
  50. search: '',
  51. page_size: 10,
  52. page: 1
  53. },
  54. baselist: [],
  55. actionSheetList:[{
  56. text:"编辑基地"
  57. },{
  58. text:"删除基地"
  59. }],
  60. post_show:false,
  61. delid:"",
  62. facilitynum:""
  63. }
  64. },
  65. methods: {
  66. async getFourbase() { //基地列表
  67. const res = await this.$myRequest({
  68. url: '/api/api_gateway?method=base.bases.base_list',
  69. data: this.data
  70. })
  71. this.baselist = this.baselist.concat(res.data)
  72. console.log(this.baselist)
  73. },
  74. async delbase() { //基地列表
  75. const res = await this.$myRequest({
  76. url: '/api/api_gateway?method=base.bases.base_list',
  77. data:{
  78. ret:"del",
  79. base_id:this.delid.id
  80. }
  81. })
  82. },
  83. clickLeft(){//返回主页
  84. uni.switchTab({
  85. url:"../index/index"
  86. })
  87. },
  88. clickRight(){//添加基地
  89. uni.navigateTo({
  90. url:"./addbase"
  91. })
  92. },
  93. searchinput() {//搜索
  94. this.data.page=1
  95. this.baselist = []
  96. Debounce(() => {
  97. this.getFourbase()
  98. }, 1000)()
  99. },
  100. search(){//搜索按钮
  101. this.data.page=1
  102. this.baselist = []
  103. this.getFourbase()
  104. this.$forceUpdate()
  105. },
  106. details(id){//详情页
  107. uni.navigateTo({
  108. url:"./basefacility?id="+id
  109. })
  110. },
  111. XQclick(item){//编辑
  112. this.post_show=!this.post_show
  113. this.delid = item
  114. },
  115. message(index){//编辑或者删除
  116. console.log(index)
  117. if(index==1){
  118. console.log(this.delid.id)
  119. uni.showModal({
  120. title: '提示',
  121. content: '确定要删除该基地吗?',
  122. success:(res)=>{
  123. if (res.confirm) {
  124. this.delbase()
  125. } else if (res.cancel) {
  126. console.log('用户点击取消');
  127. }
  128. }
  129. });
  130. }else{
  131. uni.navigateTo({
  132. url:"./modification?id="+JSON.stringify(this.delid)
  133. })
  134. }
  135. this.$forceUpdate()
  136. }
  137. },
  138. onLoad() {
  139. this.getFourbase()
  140. },
  141. onReachBottom() {//滑动到底部加载
  142. this.data.page++
  143. this.getFourbase()
  144. },
  145. onShow(){
  146. this.$forceUpdate()
  147. }
  148. }
  149. </script>
  150. <style lang="scss">
  151. .tianjia {
  152. position: absolute;
  153. top: 24rpx;
  154. right: 24rpx;
  155. font-size: 38rpx;
  156. }
  157. .bases_search{
  158. width: 100%;
  159. position: fixed;
  160. top: 44px;
  161. z-index: 100;
  162. background-color: #FFFFFF;
  163. .bases_search_text{
  164. width: 90%;
  165. margin: 0 auto;
  166. background-color: #F8F8F8;
  167. height: 60rpx;
  168. border-radius: 30rpx;
  169. display: flex;
  170. line-height: 60rpx;
  171. .search{
  172. padding:0 20rpx ;
  173. font-size: 34rpx;
  174. }
  175. input{
  176. width: 80%;
  177. margin-top: 10rpx;
  178. font-size: 28rpx;
  179. }
  180. }
  181. }
  182. .bases {
  183. width: 100%;
  184. position: relative;
  185. top: 170rpx;
  186. .bases_list {
  187. width: 90%;
  188. margin: 0 auto 20rpx;
  189. height: 276rpx;
  190. position: relative;
  191. .bases_list_bgi {
  192. .bgcolor{
  193. width: 100%;
  194. height: 276rpx;
  195. background-color: rgba(0,0,0,0.3);
  196. border-radius: 25rpx;
  197. }
  198. image {
  199. position: absolute;
  200. top: 0;
  201. left: 0;
  202. width: 100%;
  203. height: 276rpx;
  204. border-radius: 25rpx;
  205. z-index: -1;
  206. }
  207. }
  208. .bases_list_text {
  209. position: absolute;
  210. top: 0;
  211. left: 0;
  212. z-index: 10;
  213. padding: 40rpx;
  214. color: #FFFFFF;
  215. p{
  216. margin-bottom: 10rpx;
  217. }
  218. }
  219. .bases_list_xiangqing{
  220. position: absolute;
  221. top: 20rpx;
  222. right: 20rpx;
  223. transform: rotate(90deg);
  224. font-size: 26rpx;
  225. color: #FFFFFF;
  226. }
  227. .photoshow{
  228. width: 160rpx;
  229. height: 34rpx;
  230. display: flex;
  231. position: absolute;
  232. bottom: 26rpx;
  233. right: 36rpx;
  234. background-color: #a7a8a0;
  235. border-radius: 18rpx;
  236. padding: 4rpx;
  237. image{
  238. width: 32rpx;
  239. height: 32rpx;
  240. margin-right: 4rpx;
  241. }
  242. .photoshow_num{
  243. width: 50rpx;
  244. height: 30rpx;
  245. border: 1px solid #FFFFFF;
  246. border-radius: 17rpx;
  247. text-align: center;
  248. line-height: 28rpx;
  249. font-size: 24rpx;
  250. color: #FFFFFF;
  251. }
  252. }
  253. }
  254. }
  255. </style>