factoryindex.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  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">3+3+N产业体系</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.label}}</text>
  40. </view>
  41. </view> -->
  42. <!-- 3. 九宫格导航 -->
  43. <view class="grid-box">
  44. <view
  45. v-for="(item,index) in parkList2"
  46. :key="index"
  47. class="grid-card"
  48. @tap="goListByValue(item.label)"
  49. >
  50. <!-- 上:名称 -->
  51. <text class="grid-label">{{item.label}}</text>
  52. <!-- 下:数量 -->
  53. <text class="grid-num">可入驻厂房{{item.building_cnt}} 处</text>
  54. </view>
  55. </view>
  56. <!-- <view style="display: flex;width: 100%;flex-direction:row-reverse;background: white;">
  57. <text class="title2" style="margin-bottom: 20rpx;" @tap="goMap3">四个平台公司</text>
  58. </view> -->
  59. <!-- 地图已注释,如需恢复直接放开即可 -->
  60. <!--
  61. <view class="map-box">
  62. <view @touchend="onTouchEnd" class="map-wrap">
  63. <canvas canvas-id="ydChart" id="ydChart" class="map-canvas" />
  64. </view>
  65. </view>
  66. -->
  67. </view>
  68. </template>
  69. <script>
  70. // import * as echarts from 'echarts' // 如不用地图可注释
  71. import loginService from "@/api/auth/loginService";
  72. export default {
  73. data() {
  74. return {
  75. title: '盐都区可入驻厂房分布图',
  76. picture: [
  77. 'https://ydwqfw.com.cn/yd_qycpfbH5/bg1.jpg',
  78. 'https://ydwqfw.com.cn/yd_qycpfbH5/bg2.jpg',
  79. 'https://ydwqfw.com.cn/yd_qycpfbH5/bg3.jpg',
  80. 'https://ydwqfw.com.cn/yd_qycpfbH5/bg4.jpg'
  81. ],
  82. parkList2: []
  83. }
  84. },
  85. /* 地图相关生命周期,如不用可全部注释
  86. async onReady() {
  87. const json = await this.loadGeoJSON()
  88. echarts.registerMap('yanduqu', json)
  89. ...
  90. },
  91. methods: {
  92. loadGeoJSON() { ... },
  93. onTouchEnd(e) { ... },
  94. renderMap() { ... }
  95. }
  96. */
  97. onShow() {
  98. loginService.getParkList().then(({
  99. data
  100. }) => {
  101. let alls=0;
  102. for(var i = 0; i < data.length; i++){
  103. if(data[i].label!='盐高新产控集团'&&data[i].label!='城镇化集团'&&data[i].label!='国控集团'&&data[i].label!='盛州集团'){
  104. alls=alls+data[i].building_cnt;
  105. }
  106. }
  107. this.allcount=alls;
  108. this.parkList2=data;
  109. this.parkList2.unshift({total_area: 0, total_idle_area: 0, building_cnt: alls, label: "全部"})
  110. }).catch(e => {
  111. })
  112. },
  113. methods: {
  114. // 九宫格跳转
  115. goListByValue(val) {
  116. uni.navigateTo({
  117. url: `/pages/factoryBuildings/factoryBuildingsList?parkid=${val}`
  118. })
  119. },
  120. goMap() {
  121. uni.navigateTo({
  122. url: `/pages/index/factoryindex4` // 换成你的地图页面路径
  123. })
  124. },
  125. goMap2() {
  126. uni.navigateTo({
  127. url: `/pages/index/factoryindex7` // 换成你的地图页面路径
  128. })
  129. },
  130. goMap3() {
  131. uni.navigateTo({
  132. url: `/pages/factoryBuildings/factoryBuildingsList?des7=1`
  133. })
  134. },
  135. }
  136. }
  137. </script>
  138. <style scoped>
  139. .page {
  140. display: flex;
  141. flex-direction: column;
  142. min-height: 100vh;
  143. background: #f5f5f5;
  144. }
  145. /* 顶部标题 */
  146. .header {
  147. position: relative; /* 让子元素绝对定位参照它 */
  148. padding: 20rpx 0;
  149. text-align: center;
  150. background: #fff;
  151. }
  152. .title {
  153. font-size: 36rpx;
  154. font-weight: bold;
  155. color: #333;
  156. }
  157. /* 右上角地图按钮 */
  158. .map-btn {
  159. position: absolute;
  160. right: 30rpx;
  161. top: 50%;
  162. transform: translateY(-50%);
  163. width: 48rpx;
  164. height: 48rpx;
  165. }
  166. /* 轮播图 */
  167. .swiper {
  168. width: 100%;
  169. height: 300rpx;
  170. }
  171. .swiper-item {
  172. width: 100%;
  173. height: 100%;
  174. }
  175. /* 九宫格区域 */
  176. .grid-box {
  177. width: 100%;
  178. padding: 30rpx;
  179. box-sizing: border-box;
  180. display: grid;
  181. grid-template-columns: repeat(3, 1fr);
  182. gap: 24rpx;
  183. background: #fff;
  184. }
  185. .grid-num {
  186. margin-top: 8rpx;
  187. font-size: 24rpx;
  188. color: rgba(255,255,255,.85);
  189. }
  190. .grid-card {
  191. display: flex;
  192. align-items: center;
  193. justify-content: center;
  194. height: 160rpx;
  195. background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  196. border-radius: 16rpx;
  197. box-shadow: 0 6rpx 16rpx rgba(0, 0, 0, 0.08);
  198. transition: transform 0.15s;
  199. flex-direction: column;
  200. }
  201. .grid-card:active {
  202. transform: scale(0.96);
  203. }
  204. .grid-label {
  205. font-size: 30rpx;
  206. font-weight: 600;
  207. padding-left: 8rpx;
  208. padding-right: 8rpx;
  209. text-align: center;
  210. color: #fff;
  211. }
  212. .title2{
  213. background: #1296db;
  214. border-radius: 15rpx;
  215. color: white;
  216. margin-top: 8rpx;
  217. margin-right: 30rpx;
  218. padding-top: 8rpx;
  219. padding-bottom: 8rpx;
  220. padding-right: 40rpx;
  221. padding-left: 40rpx;
  222. }
  223. </style>