factoryindex7.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. <template>
  2. <view class="page">
  3. <!-- 1. 顶部标题 -->
  4. <view class="header">
  5. <text class="title">{{title}}</text>
  6. <!-- 新增地图按钮 -->
  7. <!-- <image
  8. class="map-btn"
  9. src="/static/img/map.png"
  10. mode="aspectFit"
  11. @tap="goMap"
  12. /> -->
  13. </view>
  14. <!-- 2. 轮播图 -->
  15. <swiper
  16. class="swiper"
  17. circular
  18. :indicator-dots="true"
  19. :autoplay="true"
  20. :interval="3000"
  21. :duration="800"
  22. >
  23. <swiper-item v-for="(item, index) in picture" :key="index">
  24. <image :src="item" class="swiper-item" mode="aspectFill" />
  25. </swiper-item>
  26. </swiper>
  27. <view style="display: flex;width: 100%;flex-direction:row-reverse;background: white;">
  28. <text class="title2" @tap="goMap">地图</text>
  29. <text class="title2" @tap="goMap2">板块</text>
  30. </view>
  31. <!-- 3. 九宫格导航 -->
  32. <!-- <view class="grid-box">
  33. <view
  34. v-for="(item,index) in parkList2"
  35. :key="index"
  36. class="grid-card"
  37. @tap="goListByValue(item.label)"
  38. >
  39. <text class="grid-label">{{item.building_cnt}}</text>
  40. <text class="grid-num">{{item.label}}</text>
  41. </view>
  42. </view> -->
  43. <!-- 3. 九宫格导航 -->
  44. <view class="grid-box">
  45. <view
  46. v-for="(item,index) in parkList2"
  47. :key="index"
  48. class="grid-card"
  49. @tap="goListByValue(item.content)"
  50. >
  51. <!-- 右上角数字 -->
  52. <text class="grid-num">{{item.building_cnt}}</text>
  53. <!-- 中间图片 -->
  54. <image
  55. class="grid-icon"
  56. :src="`/static/img/bt${ (index) + 1 }.png`"
  57. mode="aspectFit"
  58. />
  59. <!-- 底部文字 -->
  60. <text class="grid-label">{{item.label}}</text>
  61. </view>
  62. </view>
  63. <!-- 地图已注释,如需恢复直接放开即可 -->
  64. <!--
  65. <view class="map-box">
  66. <view @touchend="onTouchEnd" class="map-wrap">
  67. <canvas canvas-id="ydChart" id="ydChart" class="map-canvas" />
  68. </view>
  69. </view>
  70. -->
  71. </view>
  72. </template>
  73. <script>
  74. // import * as echarts from 'echarts' // 如不用地图可注释
  75. import loginService from "@/api/auth/loginService";
  76. export default {
  77. data() {
  78. return {
  79. title: '盐都区可入驻厂房分布图',
  80. picture: [
  81. 'https://ydwqfw.com.cn/yd_qycpfbH5/bg1.jpg',
  82. 'https://ydwqfw.com.cn/yd_qycpfbH5/bg2.jpg',
  83. 'https://ydwqfw.com.cn/yd_qycpfbH5/bg3.jpg',
  84. 'https://ydwqfw.com.cn/yd_qycpfbH5/bg4.jpg'
  85. ],
  86. parkList2: []
  87. }
  88. },
  89. /* 地图相关生命周期,如不用可全部注释
  90. async onReady() {
  91. const json = await this.loadGeoJSON()
  92. echarts.registerMap('yanduqu', json)
  93. ...
  94. },
  95. methods: {
  96. loadGeoJSON() { ... },
  97. onTouchEnd(e) { ... },
  98. renderMap() { ... }
  99. }
  100. */
  101. onShow() {
  102. loginService.getIndustryList().then(({
  103. data
  104. }) => {
  105. let alls=0;
  106. for(var i = 0; i < data.length; i++){
  107. alls=alls+data[i].building_cnt;
  108. }
  109. this.allcount=alls;
  110. this.parkList2=data;
  111. // this.parkList2.unshift({total_area: 0, total_idle_area: 0, building_cnt: alls, label: "全部"})
  112. }).catch(e => {
  113. })
  114. },
  115. methods: {
  116. // 九宫格跳转
  117. goListByValue(val) {
  118. uni.navigateTo({
  119. url: `/pages/factoryBuildings/factoryBuildingsList?des1=${val}`
  120. })
  121. },
  122. goMap() {
  123. uni.navigateTo({
  124. url: `/pages/index/factoryindex4` // 换成你的地图页面路径
  125. })
  126. },
  127. goMap2() {
  128. uni.navigateTo({
  129. url: `/pages/index/factoryindex` // 换成你的地图页面路径
  130. })
  131. },
  132. }
  133. }
  134. </script>
  135. <style scoped>
  136. .page {
  137. display: flex;
  138. flex-direction: column;
  139. min-height: 100vh;
  140. background: #f5f5f5;
  141. }
  142. /* 顶部标题 */
  143. .header {
  144. position: relative; /* 让子元素绝对定位参照它 */
  145. padding: 20rpx 0;
  146. text-align: center;
  147. background: #fff;
  148. }
  149. .title {
  150. font-size: 36rpx;
  151. font-weight: bold;
  152. color: #333;
  153. }
  154. /* 右上角地图按钮 */
  155. .map-btn {
  156. position: absolute;
  157. right: 30rpx;
  158. top: 50%;
  159. transform: translateY(-50%);
  160. width: 48rpx;
  161. height: 48rpx;
  162. }
  163. /* 轮播图 */
  164. .swiper {
  165. width: 100%;
  166. height: 300rpx;
  167. }
  168. .swiper-item {
  169. width: 100%;
  170. height: 100%;
  171. }
  172. /* 九宫格区域 */
  173. .grid-box {
  174. width: 100%;
  175. padding: 30rpx;
  176. box-sizing: border-box;
  177. display: grid;
  178. grid-template-columns: repeat(3, 1fr);
  179. gap: 24rpx;
  180. background: #fff;
  181. }
  182. .grid-card {
  183. position: relative; /* 让右上角数字绝对定位 */
  184. display: flex;
  185. flex-direction: column;
  186. align-items: center;
  187. justify-content: center;
  188. height: 160rpx;
  189. border-radius: 16rpx;
  190. transition: transform 0.15s;
  191. }
  192. .grid-card:active {
  193. transform: scale(0.96);
  194. }
  195. /* 右上角数字 */
  196. .grid-num {
  197. position: absolute;
  198. right: 42rpx;
  199. top: 12rpx;
  200. font-size: 24rpx;
  201. font-weight: 600;
  202. color: #1296db;
  203. }
  204. /* 中间图片 */
  205. .grid-icon {
  206. width: 60rpx;
  207. height: 60rpx;
  208. margin-bottom: 8rpx;
  209. }
  210. /* 底部文字 */
  211. .grid-label {
  212. font-size: 26rpx;
  213. color: #333;
  214. }
  215. /* 九宫格区域 */
  216. /* .grid-box {
  217. width: 100%;
  218. padding: 30rpx;
  219. box-sizing: border-box;
  220. display: grid;
  221. grid-template-columns: repeat(3, 1fr);
  222. gap: 24rpx;
  223. background: #fff;
  224. }
  225. .grid-num {
  226. margin-top: 8rpx;
  227. font-size: 24rpx;
  228. height: 70rpx;
  229. display: flex;
  230. align-items: center;
  231. color: rgba(0, 0, 0, 0.8);
  232. }
  233. .grid-card {
  234. display: flex;
  235. align-items: center;
  236. justify-content: center;
  237. height: 160rpx;
  238. border-radius: 16rpx;
  239. transition: transform 0.15s;
  240. flex-direction: column;
  241. }
  242. .grid-card:active {
  243. transform: scale(0.96);
  244. }
  245. .grid-label {
  246. font-size: 30rpx;
  247. font-weight: 600;
  248. padding-left: 8rpx;
  249. padding-right: 8rpx;
  250. text-align: center;
  251. color: #00aaff;
  252. } */
  253. .title2{
  254. background: #1296db;
  255. border-radius: 15rpx;
  256. color: white;
  257. margin-top: 8rpx;
  258. margin-right: 30rpx;
  259. padding-top: 8rpx;
  260. padding-bottom: 8rpx;
  261. padding-right: 40rpx;
  262. padding-left: 40rpx;
  263. }
  264. </style>