index.vue 9.0 KB

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