factoryindex2.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <template>
  2. <view class="page">
  3. <!-- 1. 顶部标题 -->
  4. <view class="header">
  5. <text class="title">{{title}}</text>
  6. </view>
  7. <!-- 2. 轮播图 -->
  8. <swiper
  9. class="swiper"
  10. circular
  11. :indicator-dots="true"
  12. :autoplay="true"
  13. :interval="3000"
  14. :duration="800"
  15. >
  16. <swiper-item v-for="(item, index) in picture" :key="index">
  17. <image :src="item" class="swiper-item" mode="aspectFill" />
  18. </swiper-item>
  19. </swiper>
  20. <!-- 3. 九宫格 -->
  21. <view class="grid-box">
  22. <view
  23. v-for="(item, index) in parkList2"
  24. :key="index"
  25. class="grid-item"
  26. @tap="goList(item.value)"
  27. >
  28. <image class="grid-icon" :src="item.icon" mode="aspectFit" />
  29. <text class="grid-label">{{ item.label }}</text>
  30. </view>
  31. </view>
  32. </view>
  33. </template>
  34. <script>
  35. export default {
  36. data() {
  37. return {
  38. title: '盐都区闲置厂房分布图',
  39. picture: [
  40. 'https://ydwqfw.com.cn/yd_qycpfbH5/bg1.jpg',
  41. 'https://ydwqfw.com.cn/yd_qycpfbH5/bg2.jpg',
  42. 'https://ydwqfw.com.cn/yd_qycpfbH5/bg3.jpg',
  43. 'https://ydwqfw.com.cn/yd_qycpfbH5/bg4.jpg'
  44. ],
  45. // 九宫格数据
  46. parkList2: [
  47. { label: '全部', value: '', icon: '/static/icon/all.png' },
  48. { label: '台创园', value: '台创园', icon: '/static/icon/taichuang.png' },
  49. { label: '大冈', value: '大冈镇', icon: '/static/icon/dagang.png' },
  50. { label: '大纵湖', value: '大纵湖镇', icon: '/static/icon/dazonghu.png' },
  51. { label: '学富', value: '学富镇', icon: '/static/icon/xuefu.png' },
  52. { label: '尚庄', value: '尚庄镇', icon: '/static/icon/shangzhuang.png' },
  53. { label: '张庄', value: '张庄街道', icon: '/static/icon/zhangzhuang.png' },
  54. { label: '楼王', value: '楼王镇', icon: '/static/icon/louwang.png' },
  55. { label: '潘黄', value: '潘黄街道', icon: '/static/icon/panhuang.png' },
  56. { label: '盐渎', value: '盐渎街道', icon: '/static/icon/yandu.png' },
  57. { label: '秦南', value: '秦南镇', icon: '/static/icon/qinnan.png' },
  58. { label: '郭猛', value: '郭猛镇', icon: '/static/icon/guomeng.png' },
  59. { label: '高新区', value: '盐龙街道', icon: '/static/icon/gxq.png' },
  60. { label: '龙冈', value: '龙冈镇', icon: '/static/icon/longgang.png' }
  61. ]
  62. }
  63. },
  64. methods: {
  65. // 与之前保持一致
  66. goList(parkid) {
  67. uni.navigateTo({
  68. url: `/pages/factoryBuildings/factoryBuildingsList?parkid=${parkid}`
  69. })
  70. }
  71. }
  72. }
  73. </script>
  74. <style scoped>
  75. /* 原有样式不变,仅新增宫格 */
  76. .page {
  77. display: flex;
  78. flex-direction: column;
  79. height: 100vh;
  80. background: #f5f5f5;
  81. }
  82. .header {
  83. padding: 20rpx 0;
  84. text-align: center;
  85. background: #fff;
  86. }
  87. .title {
  88. font-size: 36rpx;
  89. font-weight: bold;
  90. color: #333;
  91. }
  92. .swiper {
  93. width: 100%;
  94. height: 300rpx;
  95. }
  96. .swiper-item {
  97. width: 100%;
  98. height: 100%;
  99. }
  100. /* 九宫格 */
  101. .grid-box {
  102. flex: 1;
  103. display: flex;
  104. flex-wrap: wrap;
  105. padding: 20rpx;
  106. box-sizing: border-box;
  107. background: #f5f5f5;
  108. }
  109. .grid-item {
  110. width: 33.33%;
  111. height: 180rpx;
  112. display: flex;
  113. flex-direction: column; /* 图标在上,文字在下 */
  114. align-items: center;
  115. justify-content: center;
  116. border: 1rpx solid #e0e0e0;
  117. border-radius: 15rpx;
  118. margin: 0 -1rpx -1rpx 0; /* 消除双边框 */
  119. box-sizing: border-box;
  120. background: #fff;
  121. }
  122. .grid-icon {
  123. width: 96rpx; /* 48px */
  124. height: 96rpx;
  125. margin-bottom: 10rpx;
  126. }
  127. .grid-label {
  128. font-size: 28rpx;
  129. color: #333;
  130. }
  131. </style>