activity.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <template>
  2. <div class="activity">
  3. <div v-for="(item, index) in activityList" 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)">
  13. <img :src="item.isColl ? heartSel : heart" class="scImg" /> 收藏
  14. </div>
  15. <div
  16. :class="item.isSign ? 'baoming' : 'baoming2'"
  17. @click="baoming(item)"
  18. >
  19. {{ item.isSign ? "去报名" : "报名结束" }}
  20. </div>
  21. </div>
  22. </div>
  23. </div>
  24. </div>
  25. </template>
  26. <script>
  27. import { getUserPower, getUserLocalStorageInfo } from "@/js_sdk/http";
  28. export default {
  29. name: "activity",
  30. data() {
  31. return {
  32. heartSel: "https://www.idea-co-sf.com/gardenProduct/image/heartSel.png",
  33. heart: "https://www.idea-co-sf.com/gardenProduct/image/heart.png",
  34. activityList: [
  35. {
  36. name: "互联网私募如何入门?",
  37. type: "培训活动",
  38. img: "https://www.idea-co-sf.com/gardenProduct/image/img1.png",
  39. isColl: true,
  40. isSign: true,
  41. },
  42. {
  43. name: "公募基金中的大数据啊啊啊?",
  44. type: "活动",
  45. img: "https://www.idea-co-sf.com/gardenProduct/image/img2.png",
  46. isColl: false,
  47. isSign: true,
  48. },
  49. {
  50. name: "年度小艾杯篮球赛开...?",
  51. type: "体育",
  52. img: "https://www.idea-co-sf.com/gardenProduct/image/img3.png",
  53. isColl: false,
  54. isSign: false,
  55. },
  56. ],
  57. };
  58. },
  59. methods: {
  60. clickColl(index) {
  61. // console.log(index)
  62. this.activityList[index].isColl = !this.activityList[index].isColl;
  63. // item.isColl = !item.isColl
  64. },
  65. baoming(item) {
  66. if (item.isSign) {
  67. if (getUserLocalStorageInfo().userType == 3) {
  68. uni.showModal({
  69. title: "提示",
  70. cancelText: "暂不",
  71. confirmText: "去切换",
  72. content: "您还不是企业用户,请切换登录身份后再进行相关操作。",
  73. success: function (res) {
  74. if (res.confirm) {
  75. uni.navigateTo({
  76. url: "/pages/login2/login",
  77. success: function (e) {
  78. // uni.$emit('userType', 'OK')
  79. },
  80. });
  81. } else if (res.cancel) {
  82. console.log("用户点击取消");
  83. }
  84. },
  85. });
  86. }
  87. }
  88. },
  89. },
  90. };
  91. </script>
  92. <style lang="scss">
  93. .activity {
  94. .activityItem {
  95. width: 702rpx;
  96. height: 216rpx;
  97. background: #f5f7fa;
  98. padding: 0 24rpx;
  99. display: flex;
  100. align-items: center;
  101. box-sizing: border-box;
  102. border-radius: 16rpx;
  103. margin: 12rpx 0;
  104. .itemBg {
  105. width: 220rpx;
  106. height: 160rpx;
  107. }
  108. .activityItemRight {
  109. display: flex;
  110. flex-direction: column;
  111. margin-left: 24rpx;
  112. .activityItemRightTop {
  113. width: 420rpx;
  114. display: flex;
  115. justify-content: space-between;
  116. .activityItemRightName {
  117. width: 280rpx;
  118. white-space: nowrap;
  119. overflow: hidden;
  120. text-overflow: ellipsis;
  121. color: #18172a;
  122. font-size: 28rpx;
  123. }
  124. .activityItemRightType {
  125. padding: 2rpx 12rpx;
  126. background: rgba(3, 101, 249, 0.2);
  127. color: rgba(3, 101, 249, 1);
  128. border-radius: 4rpx;
  129. font-size: 24rpx;
  130. }
  131. }
  132. .canyu {
  133. font-size: 28rpx;
  134. color: rgba(102, 102, 102, 1);
  135. margin: 14rpx 0;
  136. }
  137. .activityItemRightBottom {
  138. display: flex;
  139. justify-content: space-between;
  140. align-items: center;
  141. .shoucang {
  142. display: flex;
  143. align-items: center;
  144. font-size: 28rpx;
  145. color: rgba(141, 146, 155, 1);
  146. .scImg {
  147. width: 32rpx;
  148. height: 28rpx;
  149. margin-right: 8rpx;
  150. }
  151. }
  152. .baoming {
  153. width: 160rpx;
  154. height: 60rpx;
  155. display: flex;
  156. align-items: center;
  157. justify-content: center;
  158. font-size: 28rpx;
  159. background: linear-gradient(316deg, #84aaff 0%, #0365f9 100%);
  160. border-radius: 32rpx;
  161. font-size: 28rpx;
  162. color: white;
  163. }
  164. .baoming2 {
  165. width: 160rpx;
  166. height: 60rpx;
  167. display: flex;
  168. align-items: center;
  169. justify-content: center;
  170. font-size: 28rpx;
  171. background: rgba(226, 232, 239, 1);
  172. border-radius: 32rpx;
  173. font-size: 28rpx;
  174. color: rgba(141, 146, 155, 1);
  175. }
  176. }
  177. }
  178. }
  179. }
  180. </style>