factoryindex3.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  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="panel">
  22. <view class="panel-title">选择园区</view>
  23. <scroll-view scroll-x class="card-scroll">
  24. <view
  25. v-for="(item,index) in parkList2"
  26. :key="index"
  27. class="card"
  28. @tap="goListByValue(item.label)"
  29. >
  30. <image
  31. class="card-bg"
  32. :src="item.bg||defaultBg"
  33. mode="aspectFill"
  34. />
  35. <view class="card-mask" />
  36. <view class="card-content">
  37. <text class="card-name">{{ item.label }}</text>
  38. <text class="card-count">闲置厂房 {{ item.building_cnt||0 }} 处</text>
  39. </view>
  40. </view>
  41. <!-- 末尾「全部」按钮 -->
  42. <view class="card all" @tap="goListByValue('')">
  43. <text class="all-txt">盐都区园区</text>
  44. <text class="all-txt2">总闲置 {{allcount}} 处</text>
  45. </view>
  46. </scroll-view>
  47. </view>
  48. <!-- 地图已注释 -->
  49. <!--
  50. <view class="map-box">
  51. <canvas canvas-id="ydChart" id="ydChart" class="map-canvas" />
  52. </view>
  53. -->
  54. </view>
  55. </template>
  56. <script>
  57. import loginService from "@/api/auth/loginService";
  58. export default {
  59. data() {
  60. return {
  61. title: '盐都区闲置厂房分布图',
  62. defaultBg: 'https://ydwqfw.com.cn/yd_qycpfbH5/bg2.jpg', // 默认封面
  63. picture: [
  64. 'https://ydwqfw.com.cn/yd_qycpfbH5/bg1.jpg',
  65. 'https://ydwqfw.com.cn/yd_qycpfbH5/bg2.jpg',
  66. 'https://ydwqfw.com.cn/yd_qycpfbH5/bg3.jpg',
  67. 'https://ydwqfw.com.cn/yd_qycpfbH5/bg4.jpg'
  68. ],
  69. parkList2: [],
  70. allcount:0,
  71. }
  72. },
  73. onShow() {
  74. loginService.getParkList().then(({
  75. data
  76. }) => {
  77. let alls=0;
  78. for(var i = 0; i < data.length; i++){
  79. alls=alls+data[i].building_cnt;
  80. }
  81. this.allcount=alls;
  82. this.parkList2=data;
  83. this.parkList2.unshift({total_area: 0, total_idle_area: 0, building_cnt: alls, label: "全部"})
  84. }).catch(e => {
  85. })
  86. },
  87. methods: {
  88. goListByValue(val) {
  89. uni.navigateTo({
  90. url: `/pages/factoryBuildings/factoryBuildingsList?parkid=${val}`
  91. })
  92. }
  93. }
  94. }
  95. </script>
  96. <style scoped>
  97. .page {
  98. display: flex;
  99. flex-direction: column;
  100. min-height: 100vh;
  101. background: #f5f5f5;
  102. }
  103. .header {
  104. padding: 20rpx 0;
  105. text-align: center;
  106. background: #fff;
  107. }
  108. .title {
  109. font-size: 36rpx;
  110. font-weight: bold;
  111. color: #333;
  112. }
  113. .swiper {
  114. width: 100%;
  115. height: 300rpx;
  116. }
  117. .swiper-item {
  118. width: 100%;
  119. height: 100%;
  120. }
  121. /* 横向卡片区域 */
  122. .panel {
  123. background: #fff;
  124. padding: 30rpx 0;
  125. }
  126. .panel-title {
  127. padding: 0 30rpx 20rpx;
  128. font-size: 32rpx;
  129. font-weight: 600;
  130. color: #333;
  131. }
  132. .card-scroll {
  133. white-space: nowrap;
  134. padding: 0 30rpx;
  135. }
  136. .card {
  137. position: relative;
  138. display: inline-flex;
  139. flex-direction: column;
  140. justify-content: flex-end;
  141. width: 240rpx;
  142. height: 300rpx;
  143. border-radius: 16rpx;
  144. overflow: hidden;
  145. margin-right: 20rpx;
  146. box-shadow: 0 8rpx 16rpx rgba(0,0,0,.08);
  147. }
  148. .card-bg {
  149. position: absolute;
  150. width: 100%;
  151. height: 100%;
  152. z-index: 1;
  153. }
  154. .card-mask {
  155. position: absolute;
  156. left: 0;
  157. right: 0;
  158. bottom: 0;
  159. height: 60%;
  160. background: linear-gradient(to bottom, transparent, rgba(0,0,0,.6));
  161. z-index: 2;
  162. }
  163. .card-content {
  164. position: relative;
  165. z-index: 3;
  166. padding: 20rpx;
  167. color: #fff;
  168. }
  169. .card-name {
  170. display: block;
  171. font-size: 30rpx;
  172. font-weight: 600;
  173. }
  174. .card-count {
  175. display: block;
  176. margin-top: 8rpx;
  177. font-size: 24rpx;
  178. opacity: .9;
  179. }
  180. /* 全部按钮 */
  181. .card.all {
  182. background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  183. justify-content: center;
  184. align-items: center;
  185. }
  186. .all-txt {
  187. font-size: 30rpx;
  188. font-weight: 600;
  189. color: #fff;
  190. }
  191. .all-txt2 {
  192. font-size: 25rpx;
  193. color: #fff;
  194. }
  195. </style>