activity.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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. @tap.stop="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. }else{
  93. console.log(2222)
  94. uni.navigateTo({
  95. url:'/pages/subPackages/parkActivity/activeApplication'
  96. })
  97. }
  98. }
  99. },
  100. toDetail(item){
  101. console.log(this.faMsg)
  102. if (this.faMsg === 'home'){
  103. uni.navigateTo({
  104. url:'/pages/subPackages/parkActivity/index'
  105. })
  106. }
  107. }
  108. },
  109. };
  110. </script>
  111. <style lang="scss">
  112. .activity {
  113. margin: 0 auto;
  114. .activityItem {
  115. width: 686rpx;
  116. height: 216rpx;
  117. background: #f5f7fa;
  118. padding: 0 24rpx;
  119. display: flex;
  120. align-items: center;
  121. box-sizing: border-box;
  122. border-radius: 16rpx;
  123. margin: 12rpx 0;
  124. .itemBg {
  125. width: 220rpx;
  126. height: 160rpx;
  127. }
  128. .activityItemRight {
  129. display: flex;
  130. flex-direction: column;
  131. margin-left: 24rpx;
  132. .activityItemRightTop {
  133. width: 420rpx;
  134. display: flex;
  135. justify-content: space-between;
  136. .activityItemRightName {
  137. width: 280rpx;
  138. white-space: nowrap;
  139. overflow: hidden;
  140. text-overflow: ellipsis;
  141. color: #18172a;
  142. font-size: 28rpx;
  143. }
  144. .activityItemRightType {
  145. padding: 2rpx 12rpx;
  146. background: rgba(3, 101, 249, 0.2);
  147. color: rgba(3, 101, 249, 1);
  148. border-radius: 4rpx;
  149. font-size: 24rpx;
  150. }
  151. }
  152. .canyu {
  153. font-size: 28rpx;
  154. color: rgba(102, 102, 102, 1);
  155. margin: 14rpx 0;
  156. }
  157. .activityItemRightBottom {
  158. display: flex;
  159. justify-content: space-between;
  160. align-items: center;
  161. .shoucang {
  162. display: flex;
  163. align-items: center;
  164. font-size: 28rpx;
  165. color: rgba(141, 146, 155, 1);
  166. .scImg {
  167. width: 32rpx;
  168. height: 28rpx;
  169. margin-right: 8rpx;
  170. }
  171. }
  172. .baoming {
  173. width: 160rpx;
  174. height: 60rpx;
  175. display: flex;
  176. align-items: center;
  177. justify-content: center;
  178. font-size: 28rpx;
  179. background: linear-gradient(316deg, #84aaff 0%, #0365f9 100%);
  180. border-radius: 32rpx;
  181. font-size: 28rpx;
  182. color: white;
  183. }
  184. .baoming2 {
  185. width: 160rpx;
  186. height: 60rpx;
  187. display: flex;
  188. align-items: center;
  189. justify-content: center;
  190. font-size: 28rpx;
  191. background: rgba(226, 232, 239, 1);
  192. border-radius: 32rpx;
  193. font-size: 28rpx;
  194. color: rgba(141, 146, 155, 1);
  195. }
  196. }
  197. }
  198. }
  199. }
  200. </style>