123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383 |
- <template>
- <div class="announcement">
- <div class="tap-part">
- <div class="tips-list">
- <div :class="[
- 'tip-item',
- search.activityType == item.value ? 'active' : '',
- ]" v-for="(item, index) in tipList" :key="index" @click="selectChange(item.value)">
- {{ item.label }}
- </div>
- </div>
- <div class="card-news-list">
- <div class="detail-card shadow-radius news-card" v-for="(item, index) in activityList" :key="index">
- <div class="image" v-if="item.annexArray">
- <img @click="getDetail(item)" style="height: 8rem" :src="item.annexArray[0]" alt="" />
- </div>
- <div class="info-part">
- <p class="tit" @click="getDetail(item)">{{ item.activityName }}</p>
- <div class="bottom">
- <div class="left">
- <span class="normal-tip by y-bg" v-if="item.registrationStatus === '1'">报名中</span>
- <span class="normal-tip by h-bg" v-else>报名已结束</span>
- <!-- <span
- class="normal-tip yd d-bg"
- @click.stop="noThing"
- v-if="item.registrationStatus === '1'"
- >活动风采</span
- > -->
- <span class="normal-tip yd z-bg" @click.stop="getStyle(item)" v-if="
- item.registrationStatus === '2' && item.styleStatus === '1'
- ">活动风采</span>
- </div>
- <div class="right">
- <div class="num">{{ item.partakeNumber ? item.partakeNumber : 0 }}人参与</div>
- <div class="icon-collect" @click.stop="changeCollectorsStatus(item)">
- <i class="iconfont icon-wujiaoxingxingxingshoucangdianji blue"
- v-if="item.collectorsStatus === '2'"></i>
- <i class="iconfont icon-wujiaoxingxingxingshoucangdianji" v-else></i>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- import { getUserLocalStorageInfo, getByCodes } from "@/js_sdk/http";
- // import { ImagePreview, Toast } from "vant";
- import { clickCollect, list, listRegisSignInfo } from "@/js_sdk/api_activity";
- // import auth from "../../service/auth";
- export default {
- name: "ParkActivities",
- // mixins: [Base],
- data() {
- return {
- dic_key: ["activityType"],
- active: 0,
- userId: "",
- tipList: [],
- search: {
- activityType: "产业",
- userId: "",
- publishStatus: "2",
- },
- activityList: [],
- regisSignList: [],
- };
- },
- onLoad() {
- // this.userId = getUserLocalStorageInfo().user.id;
- this.userId = "";
- this.getByCodes();
- },
- methods: {
- async getByCodes() {
- let data = await getByCodes(JSON.stringify(this.dic_key));
- let dic = this.$common.handleDicList(data);
- this.tipList = dic.activityType;
- console.log("this.tipList", this.tipList);
- this.getData();
- // this.getRegisSignInfo();
- },
- // showImg(imgs) {
- // ImagePreview(imgs);
- // },
- onTabsClick(val) {
- if (val == 0) {
- this.getData();
- } else {
- this.getRegisSignInfo();
- }
- },
- getData() {
- const _this = this;
- this.search.userId = this.userId;
- _this.activityList = [];
- list(this.search)
- .then((res) => {
- res.forEach((i) => {
- _this.activityList.push(i);
- });
- })
- .catch((e) => {
- console.log(e);
- });
- },
- getRegisSignInfo() {
- const _this = this;
- listRegisSignInfo({ userId: this.userId, referenceType: "1" })
- .then((res) => {
- _this.regisSignList = res;
- _this.regisSignList.forEach((item) => {
- if (item.annexArray && item.annexArray.length) {
- const obj = item.annexArray[0];
- item.codeUrl =
- this.$constant.BASE_URI +
- "/wx/fileController/download/" +
- obj.substring(obj.lastIndexOf("/"), obj.length);
- }
- item.activityStartTime = this.$common.transBaseDateTime(
- item.activityStartTime
- );
- });
- console.log(_this.regisSignList);
- })
- .catch(() => { });
- },
- selectChange(value) {
- let tel = true;
- this.tipList.forEach((i) => {
- if (i.value === value) {
- if (i.active) {
- tel = false;
- } else {
- i.active = true;
- }
- } else {
- i.active = false;
- }
- });
- if (tel) {
- this.search.activityType = value;
- this.getData();
- }
- },
- getDetail(val) {
- console.log(val.id);
- uni.navigateTo({
- url: "/pages/subPackages/parkActivities/detail?id=" + val.id,
- });
- // this.$router.push({
- // path: "/parkActivities/detail",
- // query: {
- // // 这里面是写需要传送的值
- // id: val.id,
- // },
- // });
- },
- getStyle(val) {
- console.log(val.id);
- uni.navigateTo({
- url: "/pages/subPackages/parkActivities/style?id=" + val.id,
- });
- },
- noThing() {
- // Toast('活动处于报名中')
- console.log("无效点击");
- },
- changeCollectorsStatus(val) {
- if (val.collectorsStatus === "2") {
- const _this = this;
- clickCollect({
- id: val.id,
- userId: auth.currUser().id,
- collectorsStatus: "1",
- }).then((res) => {
- _this.getData();
- _this.getRegisSignInfo();
- });
- } else {
- const _this = this;
- clickCollect({
- id: val.id,
- userId: auth.currUser().id,
- collectorsStatus: "2",
- }).then((res) => {
- _this.getData();
- _this.getRegisSignInfo();
- });
- }
- },
- },
- };
- </script>
- <style lang="scss" type="text/scss" scoped>
- .news-card {
- background: white;
- padding: 10rpx 30rpx;
- border-radius: 20px;
- .image {
- font-size: 0;
- img {
- width: 100%;
- }
- }
- .info-part {
- .tit {
- font-size: 24rpx;
- color: #666666;
- margin: 25rpx 0;
- }
- .top {
- @include flex;
- height: 75rpx;
- .text {
- font-size: 24rpx;
- color: #666666;
- }
- .tip-grid-bg {
- padding: 0 35rpx;
- font-size: 20rpx;
- line-height: 42rpx;
- }
- }
- .bottom {
- @include flex;
- .left {
- @include flex;
- span {
- margin-right: 10rpx;
- }
- i {
- font-size: 24rpx;
- color: rgba(102, 0, 255, 1);
- }
- }
- .right {
- @include flex;
- .num {
- font-size: 24rpx;
- color: #333333;
- margin-right: 15rpx;
- }
- }
- }
- }
- }
- .announcement {
- box-sizing: border-box;
- .tap-part {
- margin-top: 10rpx;
- height: calc(100vh - 10rpx);
- .van-tabs {
- height: 100%;
- }
- .info-list {
- height: calc(100vh - 92rpx);
- background-color: #fff;
- padding: 0 20rpx;
- overflow-y: auto;
- }
- }
- }
- //头部标签
- .tips-list {
- margin-top: 20rpx;
- @include flex;
- flex-wrap: wrap;
- .tip-item {
- width: 120rpx;
- margin: 0 15rpx 20rpx;
- text-align: center;
- line-height: 40rpx;
- font-size: 24rpx;
- color: #fff;
- border-radius: 4rpx;
- background-color: rgba(215, 215, 215, 1);
- }
- .active {
- background-color: rgba(102, 0, 255, 1);
- }
- }
- .card-news-list {
- padding: 20rpx 20rpx;
- .news-card {
- margin-bottom: 20rpx;
- }
- .record-card {
- margin-bottom: 10rpx;
- height: 346rpx;
- background-color: #fff;
- padding: 20rpx 30rpx;
- box-sizing: border-box;
- @include flex;
- .left {
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- height: 100%;
- img {
- width: 244rpx;
- }
- .text {
- margin-bottom: 10rpx;
- text-align: center;
- font-size: 16rpx;
- color: #666666;
- }
- }
- .right {
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- text-align: center;
- font-size: 24rpx;
- height: 100%;
- color: #666666;
- padding-left: 100rpx;
- .title {
- font-weight: 700;
- margin-top: 20rpx;
- }
- .time {}
- .add {
- p {
- word-break: break-word;
- }
- }
- .bottom {
- display: flex;
- justify-content: flex-end;
- p {
- width: 80rpx;
- text-align: center;
- }
- }
- }
- }
- }
- </style>
|