index.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  1. <template>
  2. <div class="announcement">
  3. <div class="tap-part">
  4. <div class="tips-list">
  5. <div :class="[
  6. 'tip-item',
  7. search.activityType == item.value ? 'active' : '',
  8. ]" v-for="(item, index) in tipList" :key="index" @click="selectChange(item.value)">
  9. {{ item.label }}
  10. </div>
  11. </div>
  12. <div class="card-news-list">
  13. <div class="detail-card shadow-radius news-card" v-for="(item, index) in activityList" :key="index">
  14. <div class="image" v-if="item.annexArray">
  15. <img @click="getDetail(item)" style="height: 8rem" :src="item.annexArray[0]" alt="" />
  16. </div>
  17. <div class="info-part">
  18. <p class="tit" @click="getDetail(item)">{{ item.activityName }}</p>
  19. <div class="bottom">
  20. <div class="left">
  21. <span class="normal-tip by y-bg" v-if="item.registrationStatus === '1'">报名中</span>
  22. <span class="normal-tip by h-bg" v-else>报名已结束</span>
  23. <!-- <span
  24. class="normal-tip yd d-bg"
  25. @click.stop="noThing"
  26. v-if="item.registrationStatus === '1'"
  27. >活动风采</span
  28. > -->
  29. <span class="normal-tip yd z-bg" @click.stop="getStyle(item)" v-if="
  30. item.registrationStatus === '2' && item.styleStatus === '1'
  31. ">活动风采</span>
  32. </div>
  33. <div class="right">
  34. <div class="num">{{ item.partakeNumber ? item.partakeNumber : 0 }}人参与</div>
  35. <div class="icon-collect" @click.stop="changeCollectorsStatus(item)">
  36. <i class="iconfont icon-wujiaoxingxingxingshoucangdianji blue"
  37. v-if="item.collectorsStatus === '2'"></i>
  38. <i class="iconfont icon-wujiaoxingxingxingshoucangdianji" v-else></i>
  39. </div>
  40. </div>
  41. </div>
  42. </div>
  43. </div>
  44. </div>
  45. </div>
  46. </div>
  47. </template>
  48. <script>
  49. import { getUserLocalStorageInfo, getByCodes } from "@/js_sdk/http";
  50. // import { ImagePreview, Toast } from "vant";
  51. import { clickCollect, list, listRegisSignInfo } from "@/js_sdk/api_activity";
  52. // import auth from "../../service/auth";
  53. export default {
  54. name: "ParkActivities",
  55. // mixins: [Base],
  56. data() {
  57. return {
  58. dic_key: ["activityType"],
  59. active: 0,
  60. userId: "",
  61. tipList: [],
  62. search: {
  63. activityType: "产业",
  64. userId: "",
  65. publishStatus: "2",
  66. },
  67. activityList: [],
  68. regisSignList: [],
  69. };
  70. },
  71. onLoad() {
  72. // this.userId = getUserLocalStorageInfo().user.id;
  73. this.userId = "";
  74. this.getByCodes();
  75. },
  76. methods: {
  77. async getByCodes() {
  78. let data = await getByCodes(JSON.stringify(this.dic_key));
  79. let dic = this.$common.handleDicList(data);
  80. this.tipList = dic.activityType;
  81. console.log("this.tipList", this.tipList);
  82. this.getData();
  83. // this.getRegisSignInfo();
  84. },
  85. // showImg(imgs) {
  86. // ImagePreview(imgs);
  87. // },
  88. onTabsClick(val) {
  89. if (val == 0) {
  90. this.getData();
  91. } else {
  92. this.getRegisSignInfo();
  93. }
  94. },
  95. getData() {
  96. const _this = this;
  97. this.search.userId = this.userId;
  98. _this.activityList = [];
  99. list(this.search)
  100. .then((res) => {
  101. res.forEach((i) => {
  102. _this.activityList.push(i);
  103. });
  104. })
  105. .catch((e) => {
  106. console.log(e);
  107. });
  108. },
  109. getRegisSignInfo() {
  110. const _this = this;
  111. listRegisSignInfo({ userId: this.userId, referenceType: "1" })
  112. .then((res) => {
  113. _this.regisSignList = res;
  114. _this.regisSignList.forEach((item) => {
  115. if (item.annexArray && item.annexArray.length) {
  116. const obj = item.annexArray[0];
  117. item.codeUrl =
  118. this.$constant.BASE_URI +
  119. "/wx/fileController/download/" +
  120. obj.substring(obj.lastIndexOf("/"), obj.length);
  121. }
  122. item.activityStartTime = this.$common.transBaseDateTime(
  123. item.activityStartTime
  124. );
  125. });
  126. console.log(_this.regisSignList);
  127. })
  128. .catch(() => { });
  129. },
  130. selectChange(value) {
  131. let tel = true;
  132. this.tipList.forEach((i) => {
  133. if (i.value === value) {
  134. if (i.active) {
  135. tel = false;
  136. } else {
  137. i.active = true;
  138. }
  139. } else {
  140. i.active = false;
  141. }
  142. });
  143. if (tel) {
  144. this.search.activityType = value;
  145. this.getData();
  146. }
  147. },
  148. getDetail(val) {
  149. console.log(val.id);
  150. uni.navigateTo({
  151. url: "/pages/subPackages/parkActivities/detail?id=" + val.id,
  152. });
  153. // this.$router.push({
  154. // path: "/parkActivities/detail",
  155. // query: {
  156. // // 这里面是写需要传送的值
  157. // id: val.id,
  158. // },
  159. // });
  160. },
  161. getStyle(val) {
  162. console.log(val.id);
  163. uni.navigateTo({
  164. url: "/pages/subPackages/parkActivities/style?id=" + val.id,
  165. });
  166. },
  167. noThing() {
  168. // Toast('活动处于报名中')
  169. console.log("无效点击");
  170. },
  171. changeCollectorsStatus(val) {
  172. if (val.collectorsStatus === "2") {
  173. const _this = this;
  174. clickCollect({
  175. id: val.id,
  176. userId: auth.currUser().id,
  177. collectorsStatus: "1",
  178. }).then((res) => {
  179. _this.getData();
  180. _this.getRegisSignInfo();
  181. });
  182. } else {
  183. const _this = this;
  184. clickCollect({
  185. id: val.id,
  186. userId: auth.currUser().id,
  187. collectorsStatus: "2",
  188. }).then((res) => {
  189. _this.getData();
  190. _this.getRegisSignInfo();
  191. });
  192. }
  193. },
  194. },
  195. };
  196. </script>
  197. <style lang="scss" type="text/scss" scoped>
  198. .news-card {
  199. background: white;
  200. padding: 10rpx 30rpx;
  201. border-radius: 20px;
  202. .image {
  203. font-size: 0;
  204. img {
  205. width: 100%;
  206. }
  207. }
  208. .info-part {
  209. .tit {
  210. font-size: 24rpx;
  211. color: #666666;
  212. margin: 25rpx 0;
  213. }
  214. .top {
  215. @include flex;
  216. height: 75rpx;
  217. .text {
  218. font-size: 24rpx;
  219. color: #666666;
  220. }
  221. .tip-grid-bg {
  222. padding: 0 35rpx;
  223. font-size: 20rpx;
  224. line-height: 42rpx;
  225. }
  226. }
  227. .bottom {
  228. @include flex;
  229. .left {
  230. @include flex;
  231. span {
  232. margin-right: 10rpx;
  233. }
  234. i {
  235. font-size: 24rpx;
  236. color: rgba(102, 0, 255, 1);
  237. }
  238. }
  239. .right {
  240. @include flex;
  241. .num {
  242. font-size: 24rpx;
  243. color: #333333;
  244. margin-right: 15rpx;
  245. }
  246. }
  247. }
  248. }
  249. }
  250. .announcement {
  251. box-sizing: border-box;
  252. .tap-part {
  253. margin-top: 10rpx;
  254. height: calc(100vh - 10rpx);
  255. .van-tabs {
  256. height: 100%;
  257. }
  258. .info-list {
  259. height: calc(100vh - 92rpx);
  260. background-color: #fff;
  261. padding: 0 20rpx;
  262. overflow-y: auto;
  263. }
  264. }
  265. }
  266. //头部标签
  267. .tips-list {
  268. margin-top: 20rpx;
  269. @include flex;
  270. flex-wrap: wrap;
  271. .tip-item {
  272. width: 120rpx;
  273. margin: 0 15rpx 20rpx;
  274. text-align: center;
  275. line-height: 40rpx;
  276. font-size: 24rpx;
  277. color: #fff;
  278. border-radius: 4rpx;
  279. background-color: rgba(215, 215, 215, 1);
  280. }
  281. .active {
  282. background-color: rgba(102, 0, 255, 1);
  283. }
  284. }
  285. .card-news-list {
  286. padding: 20rpx 20rpx;
  287. .news-card {
  288. margin-bottom: 20rpx;
  289. }
  290. .record-card {
  291. margin-bottom: 10rpx;
  292. height: 346rpx;
  293. background-color: #fff;
  294. padding: 20rpx 30rpx;
  295. box-sizing: border-box;
  296. @include flex;
  297. .left {
  298. display: flex;
  299. flex-direction: column;
  300. justify-content: space-between;
  301. height: 100%;
  302. img {
  303. width: 244rpx;
  304. }
  305. .text {
  306. margin-bottom: 10rpx;
  307. text-align: center;
  308. font-size: 16rpx;
  309. color: #666666;
  310. }
  311. }
  312. .right {
  313. display: flex;
  314. flex-direction: column;
  315. justify-content: space-between;
  316. text-align: center;
  317. font-size: 24rpx;
  318. height: 100%;
  319. color: #666666;
  320. padding-left: 100rpx;
  321. .title {
  322. font-weight: 700;
  323. margin-top: 20rpx;
  324. }
  325. .time {}
  326. .add {
  327. p {
  328. word-break: break-word;
  329. }
  330. }
  331. .bottom {
  332. display: flex;
  333. justify-content: flex-end;
  334. p {
  335. width: 80rpx;
  336. text-align: center;
  337. }
  338. }
  339. }
  340. }
  341. }
  342. </style>