activity.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. <template>
  2. <div class="activity">
  3. <div
  4. v-for="(item, index) in activityList"
  5. class="activityItem"
  6. @tap="toDetail(item)"
  7. >
  8. <img :src="item.annexArray[0]" class="itemBg" />
  9. <div class="activityItemRight">
  10. <div class="activityItemRightTop">
  11. <span class="activityItemRightName">{{ item.activityName }}</span>
  12. <!-- <span class="activityItemRightType">{{ item.releaseStatus==='1'?'已发布':item.releaseStatus==='2'?'已下架':'未发布' }}</span>-->
  13. </div>
  14. <div class="canyu">{{ item.registrationNumbers }}人参与</div>
  15. <div class="activityItemRightBottom">
  16. <div class="shoucang" @tap.stop="clickColl(index)">
  17. <img
  18. :src="item.collectorsStatus === '2' ? heartSel : heart"
  19. class="scImg"
  20. />
  21. 收藏
  22. </div>
  23. <div
  24. :class="item.statusName === '报名中' ? 'baoming' : 'baoming2'"
  25. @tap.stop="baoming(item)"
  26. >
  27. {{ item.statusName === "报名中" ? "去报名" : "报名结束" }}
  28. </div>
  29. </div>
  30. </div>
  31. </div>
  32. </div>
  33. </template>
  34. <script>
  35. import {
  36. getUserPower,
  37. getUserLocalStorageInfo,
  38. activityList,
  39. homeActivityClickCollect,
  40. getByCodes,
  41. } from "@/js_sdk/http";
  42. export default {
  43. name: "activity",
  44. props: {
  45. faMsg: {
  46. type: String,
  47. default: "",
  48. },
  49. },
  50. data() {
  51. return {
  52. heartSel: "https://www.idea-co-sf.com/gardenProduct/image/heartSel.png",
  53. heart: "https://www.idea-co-sf.com/gardenProduct/image/heart.png",
  54. activityList: [
  55. // {
  56. // name: "互联网私募如何入门?",
  57. // type: "培训活动",
  58. // img: "https://www.idea-co-sf.com/gardenProduct/image/img1.png",
  59. // isColl: true,
  60. // isSign: true,
  61. // },
  62. // {
  63. // name: "公募基金中的大数据啊啊啊?",
  64. // type: "活动",
  65. // img: "https://www.idea-co-sf.com/gardenProduct/image/img2.png",
  66. // isColl: false,
  67. // isSign: true,
  68. // },
  69. // {
  70. // name: "年度小艾杯篮球赛开...?",
  71. // type: "体育",
  72. // img: "https://www.idea-co-sf.com/gardenProduct/image/img3.png",
  73. // isColl: false,
  74. // isSign: false,
  75. // },
  76. ],
  77. search: {
  78. // createdBy: getUserLocalStorageInfo().userId,
  79. pageNum: 1,
  80. pageSize: 10,
  81. },
  82. };
  83. },
  84. onShow() {},
  85. mounted() {
  86. // this.getList()
  87. },
  88. methods: {
  89. clickColl(index) {
  90. if (this.activityList[index].collectorsStatus === "2") {
  91. this.activityList[index].collectorsStatus = "1";
  92. } else {
  93. this.activityList[index].collectorsStatus = "2";
  94. }
  95. homeActivityClickCollect({
  96. id: this.activityList[index].id,
  97. createdBy: getUserLocalStorageInfo().userId,
  98. collectorsStatus: this.activityList[index].collectorsStatus,
  99. }).then((res) => {});
  100. },
  101. getList() {
  102. this.activityList = [];
  103. activityList(this.search).then((res) => {
  104. if (res.errno == 0) {
  105. this.activityList = res.data.rows;
  106. }
  107. // console.log(res)
  108. });
  109. },
  110. baoming(item) {
  111. if (item.statusName === "报名中") {
  112. if (getUserLocalStorageInfo().userType == 3) {
  113. uni.showModal({
  114. title: "提示",
  115. cancelText: "暂不",
  116. confirmText: "去切换",
  117. content: "您还不是企业用户,请切换登录身份后再进行相关操作。",
  118. success: function (res) {
  119. if (res.confirm) {
  120. uni.navigateTo({
  121. url: "/pages/login2/login",
  122. success: function (e) {
  123. // uni.$emit('userType', 'OK')
  124. },
  125. });
  126. } else if (res.cancel) {
  127. console.log("用户点击取消");
  128. }
  129. },
  130. });
  131. } else {
  132. console.log(2222);
  133. uni.navigateTo({
  134. url:
  135. "/pages/subPackages/parkActivity/activeApplication?activityId=" +
  136. item.id +
  137. "&url=" +
  138. item.annexArray[0],
  139. });
  140. }
  141. }
  142. },
  143. toDetail(item) {
  144. console.log(this.faMsg);
  145. if (this.faMsg === "home") {
  146. uni.navigateTo({
  147. url: "/pages/subPackages/parkActivity/index",
  148. });
  149. }
  150. },
  151. },
  152. };
  153. </script>
  154. <style lang="scss">
  155. .activity {
  156. margin: 0 auto;
  157. .activityItem {
  158. width: 686rpx;
  159. height: 216rpx;
  160. background: #f5f7fa;
  161. padding: 0 24rpx;
  162. display: flex;
  163. align-items: center;
  164. box-sizing: border-box;
  165. border-radius: 16rpx;
  166. margin: 12rpx 0;
  167. .itemBg {
  168. width: 220rpx;
  169. height: 160rpx;
  170. }
  171. .activityItemRight {
  172. display: flex;
  173. flex-direction: column;
  174. margin-left: 24rpx;
  175. .activityItemRightTop {
  176. width: 420rpx;
  177. display: flex;
  178. justify-content: space-between;
  179. .activityItemRightName {
  180. width: 280rpx;
  181. white-space: nowrap;
  182. overflow: hidden;
  183. text-overflow: ellipsis;
  184. color: #18172a;
  185. font-size: 28rpx;
  186. }
  187. .activityItemRightType {
  188. padding: 2rpx 12rpx;
  189. background: rgba(3, 101, 249, 0.2);
  190. color: rgba(3, 101, 249, 1);
  191. border-radius: 4rpx;
  192. font-size: 24rpx;
  193. }
  194. }
  195. .canyu {
  196. font-size: 28rpx;
  197. color: rgba(102, 102, 102, 1);
  198. margin: 14rpx 0;
  199. }
  200. .activityItemRightBottom {
  201. display: flex;
  202. justify-content: space-between;
  203. align-items: center;
  204. .shoucang {
  205. display: flex;
  206. align-items: center;
  207. font-size: 28rpx;
  208. color: rgba(141, 146, 155, 1);
  209. .scImg {
  210. width: 32rpx;
  211. height: 28rpx;
  212. margin-right: 8rpx;
  213. }
  214. }
  215. .baoming {
  216. width: 160rpx;
  217. height: 60rpx;
  218. display: flex;
  219. align-items: center;
  220. justify-content: center;
  221. font-size: 28rpx;
  222. background: linear-gradient(316deg, #84aaff 0%, #0365f9 100%);
  223. border-radius: 32rpx;
  224. font-size: 28rpx;
  225. color: white;
  226. }
  227. .baoming2 {
  228. width: 160rpx;
  229. height: 60rpx;
  230. display: flex;
  231. align-items: center;
  232. justify-content: center;
  233. font-size: 28rpx;
  234. background: rgba(226, 232, 239, 1);
  235. border-radius: 32rpx;
  236. font-size: 28rpx;
  237. color: rgba(141, 146, 155, 1);
  238. }
  239. }
  240. }
  241. }
  242. }
  243. </style>