activity.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <template>
  2. <div class="activity">
  3. <div v-for="(item, index) in activityList" class="activityItem" @tap="toDetail(item)">
  4. <img :src="item.annexArray[0]" class="itemBg" />
  5. <div class="activityItemRight">
  6. <div class="activityItemRightTop">
  7. <span class="activityItemRightName">{{ item.activityName }}</span>
  8. <!-- <span class="activityItemRightType">{{ item.releaseStatus==='1'?'已发布':item.releaseStatus==='2'?'已下架':'未发布' }}</span>-->
  9. </div>
  10. <div class="canyu">{{item.registrationNumbers}}人参与</div>
  11. <div class="activityItemRightBottom">
  12. <div class="shoucang" @tap.stop="clickColl(index)">
  13. <img :src="item.collectorsStatus==='2' ? heartSel : heart" class="scImg" /> 收藏
  14. </div>
  15. <div
  16. :class="item.statusName === '报名中' ? 'baoming' : 'baoming2'"
  17. @tap.stop="baoming(item)"
  18. >
  19. {{ item.statusName === '报名中'? "去报名" : "报名结束" }}
  20. </div>
  21. </div>
  22. </div>
  23. </div>
  24. </div>
  25. </template>
  26. <script>
  27. import { getUserPower, getUserLocalStorageInfo, activityList, homeActivityClickCollect,getByCodes} 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. search: {
  64. // createdBy: getUserLocalStorageInfo().userId,
  65. pageNum: 1,
  66. pageSize: 10
  67. },
  68. };
  69. },
  70. onShow(){
  71. },
  72. mounted(){
  73. this.getList()
  74. },
  75. methods: {
  76. clickColl(index) {
  77. if (this.activityList[index].collectorsStatus==='2'){
  78. this.activityList[index].collectorsStatus='1'
  79. }else{
  80. this.activityList[index].collectorsStatus='2'
  81. }
  82. homeActivityClickCollect({
  83. id: this.activityList[index].id,
  84. createdBy: getUserLocalStorageInfo().userId,
  85. collectorsStatus: this.activityList[index].collectorsStatus
  86. }).then(res => {
  87. });
  88. },
  89. getList(){
  90. this.activityList = []
  91. activityList(this.search).then(res=>{
  92. if (res.errno == 0){
  93. this.activityList = res.data.rows
  94. }
  95. // console.log(res)
  96. })
  97. },
  98. baoming(item) {
  99. if (item.statusName === '报名中') {
  100. if (getUserLocalStorageInfo().userType == 3) {
  101. uni.showModal({
  102. title: "提示",
  103. cancelText: "暂不",
  104. confirmText: "去切换",
  105. content: "您还不是企业用户,请切换登录身份后再进行相关操作。",
  106. success: function (res) {
  107. if (res.confirm) {
  108. uni.navigateTo({
  109. url: "/pages/login2/login",
  110. success: function (e) {
  111. // uni.$emit('userType', 'OK')
  112. },
  113. });
  114. } else if (res.cancel) {
  115. console.log("用户点击取消");
  116. }
  117. },
  118. });
  119. }else{
  120. console.log(2222)
  121. uni.navigateTo({
  122. url:'/pages/subPackages/parkActivity/activeApplication?activityId=' + item.id + '&url=' + item.annexArray[0]
  123. })
  124. }
  125. }
  126. },
  127. toDetail(item){
  128. console.log(this.faMsg)
  129. if (this.faMsg === 'home'){
  130. uni.navigateTo({
  131. url:'/pages/subPackages/parkActivity/index'
  132. })
  133. }
  134. }
  135. },
  136. };
  137. </script>
  138. <style lang="scss">
  139. .activity {
  140. margin: 0 auto;
  141. .activityItem {
  142. width: 686rpx;
  143. height: 216rpx;
  144. background: #f5f7fa;
  145. padding: 0 24rpx;
  146. display: flex;
  147. align-items: center;
  148. box-sizing: border-box;
  149. border-radius: 16rpx;
  150. margin: 12rpx 0;
  151. .itemBg {
  152. width: 220rpx;
  153. height: 160rpx;
  154. }
  155. .activityItemRight {
  156. display: flex;
  157. flex-direction: column;
  158. margin-left: 24rpx;
  159. .activityItemRightTop {
  160. width: 420rpx;
  161. display: flex;
  162. justify-content: space-between;
  163. .activityItemRightName {
  164. width: 280rpx;
  165. white-space: nowrap;
  166. overflow: hidden;
  167. text-overflow: ellipsis;
  168. color: #18172a;
  169. font-size: 28rpx;
  170. }
  171. .activityItemRightType {
  172. padding: 2rpx 12rpx;
  173. background: rgba(3, 101, 249, 0.2);
  174. color: rgba(3, 101, 249, 1);
  175. border-radius: 4rpx;
  176. font-size: 24rpx;
  177. }
  178. }
  179. .canyu {
  180. font-size: 28rpx;
  181. color: rgba(102, 102, 102, 1);
  182. margin: 14rpx 0;
  183. }
  184. .activityItemRightBottom {
  185. display: flex;
  186. justify-content: space-between;
  187. align-items: center;
  188. .shoucang {
  189. display: flex;
  190. align-items: center;
  191. font-size: 28rpx;
  192. color: rgba(141, 146, 155, 1);
  193. .scImg {
  194. width: 32rpx;
  195. height: 28rpx;
  196. margin-right: 8rpx;
  197. }
  198. }
  199. .baoming {
  200. width: 160rpx;
  201. height: 60rpx;
  202. display: flex;
  203. align-items: center;
  204. justify-content: center;
  205. font-size: 28rpx;
  206. background: linear-gradient(316deg, #84aaff 0%, #0365f9 100%);
  207. border-radius: 32rpx;
  208. font-size: 28rpx;
  209. color: white;
  210. }
  211. .baoming2 {
  212. width: 160rpx;
  213. height: 60rpx;
  214. display: flex;
  215. align-items: center;
  216. justify-content: center;
  217. font-size: 28rpx;
  218. background: rgba(226, 232, 239, 1);
  219. border-radius: 32rpx;
  220. font-size: 28rpx;
  221. color: rgba(141, 146, 155, 1);
  222. }
  223. }
  224. }
  225. }
  226. }
  227. </style>