index.vue 6.8 KB

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