hotRanking.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. <template>
  2. <view v-if="(rankingData && rankingData.length>0) && (rankingData[0]['list'].length || rankingData[1]['list'].length || rankingData[2]['list'].length)" class="rank_card bg-white">
  3. <view class="cross">
  4. <view class="cross_rank_header acea-row row-between row-middle">
  5. <view class="rank_logo">
  6. <image class="title-img" :src="`${domain}/static/images/rank_title.png`" alt=""></image>
  7. </view>
  8. <navigator url="/pages/activity/rank/index" hover-class="none" class="session">更多 <text class="iconfont icon-jiantou" hover-class="none"></text></navigator>
  9. </view>
  10. <view class="scroll_box">
  11. <scroll-view scroll-x="true" style="white-space: nowrap; vertical-align: middle;"
  12. show-scrollbar="false">
  13. <view class="scroll_item" v-for="(item,idx) in rankingData" :key="idx" v-if="item.list.length > 0" :style="'border-radius:'+bgStyle+'rpx'">
  14. <view>
  15. <block v-if="item.list.length == 1">
  16. <navigator :url="'/pages/activity/rank/index?cate_id='+item.cate_id" hover-class="none" class="acea-row row-between">
  17. <view class="left_count" :style="'border-radius:'+conStyle+'rpx'">
  18. <view class="left_pic">
  19. <view class="picture" :class="'border'+conStyle">
  20. <easy-loadimage mode="widthFix" :image-src="item.list[0]['image']"></easy-loadimage>
  21. </view>
  22. <view class="rank acea-row row-center row-middle">01</view>
  23. </view>
  24. <view class="cate_name">
  25. <text class="rank_tit line1">{{item.cate_name}}</text>
  26. </view>
  27. </view>
  28. <view class="acea-row row-column row-between">
  29. <view class="right_pic">
  30. <view class="picture" :class="'border'+conStyle">
  31. <easy-loadimage mode="widthFix" :image-src="item.list[0]['image']"></easy-loadimage>
  32. </view>
  33. <view class="rank acea-row row-center row-middle">02</view>
  34. </view>
  35. <view class="right_pic">
  36. <view class="picture" :class="'border'+conStyle">
  37. <easy-loadimage mode="widthFix" :image-src="item.list[0]['image']"></easy-loadimage>
  38. </view>
  39. <view class="rank acea-row row-center row-middle">03</view>
  40. </view>
  41. </view>
  42. </navigator>
  43. </block>
  44. <block v-if="item.list.length == 2">
  45. <navigator :url="'/pages/activity/rank/index?cate_id='+item.cate_id" hover-class="none" class="acea-row row-between">
  46. <view class="left_count" :style="'border-radius:'+conStyle+'rpx'">
  47. <view class="left_pic">
  48. <view class="picture" :class="'border'+conStyle">
  49. <easy-loadimage mode="widthFix" :image-src="item.list[0]['image']"></easy-loadimage>
  50. </view>
  51. <view class="rank acea-row row-center row-middle">01</view>
  52. </view>
  53. <view class="cate_name">
  54. <text class="rank_tit line1">{{item.cate_name}}</text>
  55. </view>
  56. </view>
  57. <view class="acea-row row-column row-between">
  58. <view class="right_pic">
  59. <view class="picture" :class="'border'+conStyle">
  60. <easy-loadimage mode="widthFix" :image-src="item.list[1]['image']"></easy-loadimage>
  61. </view>
  62. <view class="rank acea-row row-center row-middle">02</view>
  63. </view>
  64. <view class="right_pic">
  65. <view class="picture" :class="'border'+conStyle">
  66. <easy-loadimage mode="widthFix" :image-src="item.list[1]['image']"></easy-loadimage>
  67. </view>
  68. <view class="rank acea-row row-center row-middle">03</view>
  69. </view>
  70. </view>
  71. </navigator>
  72. </block>
  73. <block v-if="item.list.length >= 3">
  74. <navigator :url="'/pages/activity/rank/index?cate_id='+item.cate_id" hover-class="none" class="acea-row row-between">
  75. <view class="left_count" :style="'border-radius:'+conStyle+'rpx'">
  76. <view class="left_pic">
  77. <view class="picture" :class="'border'+conStyle">
  78. <easy-loadimage mode="widthFix" :image-src="item.list[0]['image']"></easy-loadimage>
  79. </view>
  80. <view class="rank acea-row row-center row-middle">01</view>
  81. </view>
  82. <view class="cate_name">
  83. <text class="rank_tit line1">{{item.cate_name}}</text>
  84. </view>
  85. </view>
  86. <view class="acea-row row-column row-between">
  87. <view class="right_pic">
  88. <view class="picture" :class="'border'+conStyle">
  89. <easy-loadimage mode="widthFix" :image-src="item.list[1]['image']"></easy-loadimage>
  90. </view>
  91. <view class="rank acea-row row-center row-middle">02</view>
  92. </view>
  93. <view class="right_pic">
  94. <view class="picture" :class="'border'+conStyle">
  95. <easy-loadimage mode="widthFix" :image-src="item.list[2]['image']"></easy-loadimage>
  96. </view>
  97. <view class="rank acea-row row-center row-middle">03</view>
  98. </view>
  99. </view>
  100. </navigator>
  101. </block>
  102. </view>
  103. </view>
  104. </scroll-view>
  105. </view>
  106. </view>
  107. </view>
  108. </template>
  109. <script>
  110. // +----------------------------------------------------------------------
  111. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  112. // +----------------------------------------------------------------------
  113. // | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
  114. // +----------------------------------------------------------------------
  115. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  116. // +----------------------------------------------------------------------
  117. // | Author: CRMEB Team <admin@crmeb.com>
  118. // +----------------------------------------------------------------------
  119. import { HTTP_REQUEST_URL } from '@/config/app';
  120. import { hotRankingList } from '@/api/api.js'
  121. import easyLoadimage from '@/components/easy-loadimage/easy-loadimage.vue'
  122. export default {
  123. name: 'hotRanking',
  124. components:{easyLoadimage},
  125. props:{
  126. dataConfig: {
  127. type: Object,
  128. default: () => {}
  129. },
  130. },
  131. data(){
  132. return {
  133. domain: HTTP_REQUEST_URL,
  134. mbConfig: this.dataConfig.mbConfig.val*2,
  135. list: this.dataConfig.cateConfig.list,
  136. bgStyle: this.dataConfig.bgStyle.type ? 16 : 0,
  137. conStyle: this.dataConfig.conStyle.type ? 10 : 0,
  138. unique: this.dataConfig.timestamp,
  139. rankingData: [],
  140. diy_id: this.dataConfig.did,
  141. unique: this.dataConfig.timestamp,
  142. }
  143. },
  144. mounted() {
  145. this.getData();
  146. },
  147. methods: {
  148. getData: function() {
  149. let that = this;
  150. let data = {
  151. diy_id: that.diy_id,
  152. unique: that.unique,
  153. unique: that.unique,
  154. cate_pid: that.getCateId(),
  155. };
  156. hotRankingList(data).then(res => {
  157. that.rankingData = res.data
  158. }).catch(err => {
  159. return that.$util.Tips({
  160. title: err
  161. });
  162. });
  163. },
  164. //获取分类id
  165. getCateId(){
  166. let arr = []
  167. this.list.forEach((item, i) => {
  168. arr.push(item.cate)
  169. });
  170. return arr.toString()
  171. },
  172. }
  173. }
  174. </script>
  175. <style lang="scss" scoped>
  176. .cross_rank_header{
  177. padding: 30rpx 20rpx 0 40rpx;
  178. .icon-jiantou{
  179. font-size: 24rpx;
  180. }
  181. }
  182. .rank_logo{
  183. position: relative;
  184. .title-img{
  185. width: 136rpx;
  186. height: 36rpx;
  187. }
  188. }
  189. .session{
  190. font-size: 26rpx;
  191. color: #323232;
  192. text-align: right;
  193. }
  194. .scroll_box {
  195. width: 100%;
  196. box-sizing: border-box;
  197. margin-top: 24rpx;
  198. padding-left: 18rpx;
  199. }
  200. .scroll_item {
  201. display: inline-block;
  202. background-color: #FFFFFF;
  203. width: 414rpx;
  204. padding: 20rpx;
  205. border-radius: 16rpx;
  206. }
  207. .scroll_item~.scroll_item {
  208. margin-left: 20rpx;
  209. }
  210. .left_count{
  211. width: 230rpx;
  212. background: #FFF6F5;
  213. border-radius: 10rpx;;
  214. .cate_name{
  215. margin-top: 10rpx;
  216. text-align: center;
  217. .rank_tit{
  218. padding: 0 35rpx;
  219. color: #E93323;
  220. font-size: 26rpx;
  221. font-weight: bold;
  222. position: relative;
  223. max-width: 230rpx;
  224. display: inline-block;
  225. &::before,&::after{
  226. content: '';
  227. display: inline-block;
  228. width: 22rpx;
  229. height: 30rpx;
  230. background-image: url('../../activity/static/images/rank_cate.png');
  231. background-repeat: no-repeat;
  232. background-size: 100% 100%;
  233. position: absolute;
  234. }
  235. &::before{
  236. left: 0;
  237. }
  238. &::after{
  239. right: 0;
  240. transform: rotateY(180deg);
  241. }
  242. }
  243. }
  244. }
  245. .left_pic{
  246. width: 230rpx;
  247. height: 230rpx;
  248. border-radius: 10rpx;
  249. position: relative;
  250. display: flex;
  251. align-items: center;
  252. justify-content: center;
  253. .picture,/deep/image,/deep/.easy-loadimage,/deep/uni-image {
  254. width: 200rpx!important;
  255. height: 200rpx!important;
  256. border-radius: 10rpx;
  257. }
  258. .border0{
  259. border-radius: 0;
  260. /deep/image,/deep/.easy-loadimage,/deep/uni-image{
  261. border-radius: 0;
  262. }
  263. }
  264. .border10{
  265. border-radius: 10rpx;
  266. /deep/image,/deep/.easy-loadimage,/deep/uni-image{
  267. border-radius: 10rpx;
  268. }
  269. }
  270. .rank {
  271. position: absolute;
  272. top: 0;
  273. left: 10rpx;
  274. width: 50rpx;
  275. height: 61rpx;
  276. font-weight: bold;
  277. font-size: 32rpx;
  278. color: #CE8F21;;
  279. background-image: url('../../activity/static/images/rank.png');
  280. background-size: cover;
  281. font-family: '黑体';
  282. }
  283. }
  284. .right_pic{
  285. width: 124rpx;
  286. height: 124rpx;
  287. position: relative;
  288. border-radius: 8rpx;
  289. &:first-child{
  290. margin-bottom: 20rpx;
  291. }
  292. .picture,/deep/image,/deep/.easy-loadimage,/deep/uni-image {
  293. width: 124rpx!important;
  294. height: 124rpx!important;
  295. border-radius: 8rpx;
  296. }
  297. .rank {
  298. position: absolute;
  299. top: 0;
  300. left: 6rpx;
  301. width: 30rpx;
  302. height: 36rpx;
  303. font-size: 16rpx;
  304. font-weight: bold;
  305. color: #CE8F21;;
  306. background-image: url('../../activity/static/images/rank.png');
  307. background-size: cover;
  308. font-family: '黑体';
  309. }
  310. }
  311. </style>