index.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. <template>
  2. <view class="content">
  3. <view class="home-top">
  4. <image src="../../static/img/home-top-bg.png" class="home-top-bg" mode="widthFix"></image>
  5. <view class="home-top-til">“碳汇+”生态产品价值实现</view>
  6. <view class="home-top-subtil">The value of ecological environment is realized</view>
  7. </view>
  8. <view class="swiper-wrap">
  9. <swiper class="swiper"
  10. :indicator-dots="swiper.indicatorDots"
  11. :indicator-color="swiper.indicatorColor"
  12. :indicator-active-color="swiper.indicatorActiveColor"
  13. :autoplay="swiper.autoplay"
  14. @change="swiperChange"
  15. :interval="swiper.interval" :duration="swiper.duration">
  16. <!-- <swiper-item>
  17. <view class="adv-item"><image :src="$getimg +'banner01.png'" class="pic" mode="scaleToFill"></image></view>
  18. </swiper-item>
  19. <swiper-item>
  20. <view class="adv-item" @click="goIndex"><image :src="$getimg +'guide02.png'" class="pic" mode="scaleToFill"></image></view>
  21. </swiper-item> -->
  22. <swiper-item v-for="(item, index) in swiperList" :key="index">
  23. <view class="adv-item" @click="swiperClick"><image :src="$getimg +item.src" class="pic" mode="scaleToFill"></image></view>
  24. </swiper-item>
  25. </swiper>
  26. <view class="dots-container">
  27. <view v-for="(item, index) in swiperList" :key="index">
  28. <view :class="['dot', index === swiperCurrent ? 'active' : '']"></view>
  29. </view>
  30. </view>
  31. </view>
  32. <view class="wrap40">
  33. <view class="title">推荐生态产品</view>
  34. <view class="buy-now">
  35. <view class="buy-now-imgwrap">
  36. <image src="../../static/img/home-buy-now-img.png" class="buy-now-img" mode="aspectFit"></image>
  37. </view>
  38. <view class="buy-now-text">
  39. <view class="buy-now-text-big">立即购碳</view>
  40. <view class="buy-now-text-small">点击去购碳哟</view>
  41. </view>
  42. <view class="buy-now-icon">
  43. <text class="iconfont icon-down-s"></text>
  44. </view>
  45. </view>
  46. <!-- buy-now end -->
  47. <view class="type-nav">
  48. <view class="type-nav-item active">
  49. <view class="type-nav-item-til">林业碳汇</view>
  50. <view class="type-nav-item-subtil">为您推荐</view>
  51. <image src="../../static/img/type-nav-active.png" class="active-bg" mode="aspectFit"></image>
  52. </view>
  53. <view class="type-nav-item">
  54. <!-- <view class="type-nav-item-til">新能源汽车</view>
  55. <view class="type-nav-item-subtil">绿色出行</view> -->
  56. </view>
  57. <view class="type-nav-item">
  58. <!-- <view class="type-nav-item-til">分布式光伏</view>
  59. <view class="type-nav-item-subtil">新能源</view> -->
  60. </view>
  61. </view>
  62. <view class="common-content">
  63. <view class="common-content-title">
  64. <view class="common-content-icon">
  65. <image src="../../static/img/icon-tanpuhui.png" class="icon" mode="aspectFit"></image>
  66. </view>
  67. <view class="common-content-til">
  68. 碳汇产品展示
  69. </view>
  70. <view class="common-content-right" @click="refreshProductList">
  71. <image src="../../static/img/icon-refresh.png" class="icon" mode="aspectFit"></image>
  72. 换一批
  73. </view>
  74. </view>
  75. <view class="product-list">
  76. <view class="product-list-item" v-for="(item, index) in productList" :key="index" @click="productClick(item)">
  77. <image :src="item.img" class="product-img" mode="heightFix"></image>
  78. <view class="product-text">{{item.name}}</view>
  79. </view>
  80. </view>
  81. <view class="common-content-blink">查看更多 ></view>
  82. </view>
  83. <!-- 碳汇产品展示 结束 -->
  84. <view class="title">购买排行榜</view>
  85. <view class="rank-wrap">
  86. <view class="rank-tab">
  87. <view class="rank-tab-item" :class="{active: rankType == 1 }" @click="rankTab(1)">
  88. 企业排行榜
  89. </view>
  90. <view class="rank-tab-item" :class="{active: rankType == 2 }" @click="rankTab(2)">
  91. 个人排行榜
  92. </view>
  93. </view>
  94. <view class="rank-top">
  95. <view class="rank-top-item" v-for="(item, index) in rankTop" :key="index">
  96. <view class="rank-top-imgwrap">
  97. <image src="../../static/img/rank-top01.png" class="rank-top-bg" mode="aspectFit"></image>
  98. <image :src="item.img" class="rank-top-photo" mode="scaleToFill"></image>
  99. </view>
  100. <view class="rank-top-name f-ellipsis">{{item.name}}</view>
  101. <view class="rank-top-carbon f-ellipsis">共购买{{item.carbon}}kg碳汇</view>
  102. </view>
  103. <view class="my-rank-wrap">
  104. <view class="my-rank-photo">
  105. <image :src="myRank.img" class="photo" mode="scaleToFill"></image>
  106. </view>
  107. <view class="my-rank-text">
  108. <view class="my-rank">{{myRank.rank}}</view>
  109. <view class="my-rank-num">共购买{{myRank.carbon}}kg碳汇</view>
  110. </view>
  111. </view>
  112. </view>
  113. <!-- rank-top end -->
  114. <view class="rank-list-header">
  115. <view class="rank-list-header-rank">排名</view>
  116. <view class="rank-list-header-user">用户</view>
  117. <view class="rank-list-header-carbon">购买碳汇</view>
  118. </view>
  119. <view class="rank-list">
  120. <view class="rank-list-item" v-for="(item, index) in rankList" :key="index">
  121. <view class="rank-list-rank">{{item.rank}}</view>
  122. <view class="rank-list-user">
  123. <image :src="item.img" class="photo" mode="scaleToFill"></image>
  124. <view class="name f-ellipsis">{{item.name}}</view>
  125. </view>
  126. <view class="rank-list-carbon">共购买{{item.carbon}}kg<br />碳汇</view>
  127. </view>
  128. </view>
  129. </view>
  130. <!-- 购买排行榜 结束 -->
  131. </view>
  132. <!-- wrap end -->
  133. </view>
  134. </template>
  135. <script>
  136. export default {
  137. data() {
  138. return {
  139. $getimg:this.$getimg,
  140. swiper: {
  141. indicatorDots: false,
  142. autoplay: true,
  143. interval: 9000,
  144. duration: 500,
  145. indicatorColor:"rgba(255, 255, 255, 0.7)",
  146. indicatorActiveColor:"rgba(255, 255, 255, 1)",
  147. },
  148. swiperList:[
  149. {src:'banner01.png'},
  150. {src:'banner01.png'}
  151. ],
  152. current: 0,
  153. swiperCurrent: 0,
  154. productList:[
  155. {name:'酉阳土家族苗',img:'http://qny.gzsdtfp.com/gzth005/imgupload/39b6b37e61e240c98e4c8ca392c5f3a5.jpg'},
  156. {name:'酉阳土家族苗',img:'http://qny.gzsdtfp.com/gzth005/imgupload/39b6b37e61e240c98e4c8ca392c5f3a5.jpg'},
  157. {name:'酉阳土家族苗',img:'http://qny.gzsdtfp.com/gzth005/imgupload/39b6b37e61e240c98e4c8ca392c5f3a5.jpg'},
  158. {name:'酉阳土家族苗',img:'http://qny.gzsdtfp.com/gzth005/imgupload/39b6b37e61e240c98e4c8ca392c5f3a5.jpg'},
  159. {name:'酉阳土家族苗',img:'http://qny.gzsdtfp.com/gzth005/imgupload/39b6b37e61e240c98e4c8ca392c5f3a5.jpg'},
  160. {name:'酉阳土家族苗',img:'http://qny.gzsdtfp.com/gzth005/imgupload/39b6b37e61e240c98e4c8ca392c5f3a5.jpg'},
  161. ],
  162. rankType:1,
  163. rankTop:[
  164. {name:'酉阳土家族苗',carbon:1000,img:'http://qny.gzsdtfp.com/gzth005/imgupload/39b6b37e61e240c98e4c8ca392c5f3a5.jpg'},
  165. {name:'酉阳土家族苗',carbon:1000,img:'http://qny.gzsdtfp.com/gzth005/imgupload/39b6b37e61e240c98e4c8ca392c5f3a5.jpg'},
  166. {name:'酉阳土家族苗',carbon:1000,img:'http://qny.gzsdtfp.com/gzth005/imgupload/39b6b37e61e240c98e4c8ca392c5f3a5.jpg'},
  167. ],
  168. myRank:{name:'家族苗',carbon:1000,rank:11,img:'http://qny.gzsdtfp.com/gzth005/imgupload/39b6b37e61e240c98e4c8ca392c5f3a5.jpg'},
  169. rankList:[
  170. {name:'家族苗',carbon:1000,rank:'04',img:'http://qny.gzsdtfp.com/gzth005/imgupload/39b6b37e61e240c98e4c8ca392c5f3a5.jpg'},
  171. {name:'家族苗',carbon:1000,rank:'05',img:'http://qny.gzsdtfp.com/gzth005/imgupload/39b6b37e61e240c98e4c8ca392c5f3a5.jpg'},
  172. {name:'家族苗',carbon:1000,rank:'06',img:'http://qny.gzsdtfp.com/gzth005/imgupload/39b6b37e61e240c98e4c8ca392c5f3a5.jpg'},
  173. {name:'家族苗',carbon:1000,rank:'07',img:'http://qny.gzsdtfp.com/gzth005/imgupload/39b6b37e61e240c98e4c8ca392c5f3a5.jpg'},
  174. ],
  175. }
  176. },
  177. onLoad() {
  178. // this.getProductList();
  179. },
  180. methods: {
  181. swiperChange (e) {
  182. this.swiperCurrent = e.detail.current
  183. },
  184. swiperClick(){
  185. console.log(this.swiperCurrent);
  186. },
  187. getProductList(){
  188. this.$api.http.post(this.config.apiBaseurl + '/goods/searchForIndex',{},{
  189. header: {
  190. Accept:'application/json',
  191. // Authorization: 'Bearer '+ this.token, //注意Bearer后面有一空格
  192. },
  193. }).then(res => {
  194. console.log('res',res)
  195. }).catch(err =>{
  196. console.log('err',err)
  197. });
  198. },
  199. refreshProductList(){
  200. this.getProductList();
  201. },
  202. productClick(){
  203. },
  204. rankTab(type){
  205. this.rankType = type;
  206. console.log(type);
  207. }
  208. }
  209. }
  210. </script>
  211. <style>
  212. @import url("./index.css");
  213. </style>