activity.vue 5.3 KB

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