index.vue 9.2 KB

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