activity.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <template>
  2. <div class="activity">
  3. <div v-for="(item,index) in activityList" :key="index+100" class="activityItem">
  4. <img :src="item.img" class="itemBg">
  5. <div class="activityItemRight">
  6. <div class="activityItemRightTop">
  7. <span class="activityItemRightName">{{item.name}}</span>
  8. <span class="activityItemRightType">{{item.type}}</span>
  9. </div>
  10. <div class="canyu">36人参与</div>
  11. <div class="activityItemRightBottom">
  12. <div class="shoucang" @click="clickColl(index)"><image :src="item.isColl?heartSel:heart" class="scImg"> 收藏</div>
  13. <div :class="item.isSign?'baoming':'baoming2'">{{ item.isSign ? '去报名' : '报名结束' }}</div>
  14. </div>
  15. </div>
  16. </div>
  17. </div>
  18. </template>
  19. <script>
  20. export default {
  21. name: "activity",
  22. data(){
  23. return{
  24. heartSel:require('../image/heartSel.png'),
  25. heart:require('../image/heart.png'),
  26. activityList:[
  27. {name:'互联网私募如何入门?',type:'培训活动',img:require('../image/img1.png'),isColl:true ,isSign:true},
  28. {name:'公募基金中的大数据啊啊啊?',type:'活动',img:require('../image/img2.png'),isColl:false,isSign:true},
  29. {name:'年度小艾杯篮球赛开...?',type:'体育',img:require('../image/img3.png'),isColl:false,isSign:false},
  30. ]
  31. }
  32. },
  33. methods:{
  34. clickColl(index){
  35. // console.log(index)
  36. this.activityList[index].isColl = !this.activityList[index].isColl
  37. // item.isColl = !item.isColl
  38. }
  39. }
  40. }
  41. </script>
  42. <style lang="scss">
  43. .activity{
  44. .activityItem{
  45. width: 702rpx;
  46. height: 216rpx;
  47. background: #F5F7FA;
  48. padding: 0 24rpx;
  49. display: flex;
  50. align-items: center;
  51. box-sizing: border-box;
  52. border-radius: 16rpx;
  53. margin: 12rpx 0;
  54. .itemBg{
  55. width: 220rpx;
  56. height: 160rpx;
  57. }
  58. .activityItemRight{
  59. display: flex;
  60. flex-direction: column;
  61. margin-left: 24rpx;
  62. .activityItemRightTop{
  63. width: 420rpx;
  64. display: flex;
  65. justify-content: space-between;
  66. .activityItemRightName{
  67. width: 280rpx;
  68. white-space: nowrap;
  69. overflow: hidden;
  70. text-overflow: ellipsis;
  71. color: #18172A;
  72. font-size: 28rpx;
  73. }
  74. .activityItemRightType{
  75. padding: 2rpx 12rpx;
  76. background: rgba(3, 101, 249, 0.20);
  77. color: rgba(3, 101, 249, 1);
  78. border-radius: 4rpx;
  79. font-size: 24rpx;
  80. }
  81. }
  82. .canyu{
  83. font-size: 28rpx;
  84. color: rgba(102, 102, 102, 1);
  85. margin: 14rpx 0;
  86. }
  87. .activityItemRightBottom{
  88. display: flex;
  89. justify-content: space-between;
  90. align-items: center;
  91. .shoucang{
  92. display: flex;
  93. align-items: center;
  94. font-size: 28rpx;
  95. color: rgba(141, 146, 155, 1);
  96. .scImg{
  97. width: 32rpx;
  98. height: 28rpx;
  99. margin-right: 8rpx;
  100. }
  101. }
  102. .baoming{
  103. width: 160rpx;
  104. height: 60rpx;
  105. display: flex;
  106. align-items: center;
  107. justify-content: center;
  108. font-size: 28rpx;
  109. background: linear-gradient( 316deg, #84AAFF 0%, #0365F9 100%);
  110. border-radius: 32rpx;
  111. font-size: 28rpx;
  112. color: white;
  113. }
  114. .baoming2{
  115. width: 160rpx;
  116. height: 60rpx;
  117. display: flex;
  118. align-items: center;
  119. justify-content: center;
  120. font-size: 28rpx;
  121. background: rgba(226, 232, 239, 1);
  122. border-radius: 32rpx;
  123. font-size: 28rpx;
  124. color: rgba(141, 146, 155, 1);
  125. }
  126. }
  127. }
  128. }
  129. }
  130. </style>