123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263 |
- <template>
- <view class="content">
- <view class="navBarBox">
- <view class="statusBar" :style="{ paddingTop: statusBarHeight + 'px' }"></view>
- <view class="navBar">
- <view>活动</view>
- <image class="logo" mode="scaleToFill"></image>
- </view>
- </view>
- <!-- <view class="nvBarBox">
- <view @click="onClickStatus(item)" v-for="item in status" :class="[query.state === item.value ? 'active' : '']">{{
- item.name }}</view>
- </view> -->
- <zs-list mt="0" @load="loadMore" :status="listStatus">
- <uni-card v-for="item in list" :key="item.activityCover" padding="0" spacing="0">
- <view @click.stop="onClick(item)">
- <view class='img-veiew'>
- <!-- <view class="badge">{{ item.status }}</view> -->
- <image slot="cover" class="cover" :src="item.activityCover">
- </image>
- </view>
- <view class="content-box">
- <view class="title">{{ item.activityName }}</view>
- <view class="sub-title">
- 活动时间: {{ item.activityStartTime }} 至 {{ item.activityEndTime }}
- </view>
- <!-- <view class="sub-title">
- 活动地点:{{ item.address }}
- </view> -->
- </view>
- </view>
- </uni-card>
- </zs-list>
- <zs-tab-bar :value="1"></zs-tab-bar>
- </view>
- </template>
- <script>
- import uniCard from "@/uni_modules/uni-card/components/uni-card/uni-card.vue";
- import { getActivityList } from "../../api/activity";
- export default {
- components: {
- uniCard,
- },
- data() {
- return {
- navBarHeight: 0,
- statusBarHeight: 0,
- list: [],
- triggered: false,
- loading: false,
- status: [
- // wait 未开始 doing 进行中 over 已结束
- { name: "全部", value: null },
- { name: "未开始", value: 'wait' },
- { name: "进行中", value: 'doing' },
- { name: "已结束", value: 'over' },
- ],
- shopId: uni.getStorageSync("gdShopId"),
- query: {
- currentPage: 1,
- pageSize: 3,
- activityEnable: 1,
- state: null,
- },
- listStatus: "more", // more noMore loading
- };
- },
- onShow() {
- this.getList();
- this.query.state = null;
- },
- created() {
- this.navBarHeight = this.$navHight(1);
- this.statusBarHeight = uni.getSystemInfoSync()["statusBarHeight"];
- this.navBarHeight = this.navBarHeight + 10 + "px";
- },
- methods: {
- getList() {
- this.listStatus="loading"
- getActivityList({
- shopId: this.shopId,
- ...this.query,
- }).then(res => {
- this.list = this.list.concat(res.content.records);
- this.loading = false;
- // this.list = res.content.records;
- let total = this.list.length
- if (total >= res.content.total) {
- this.listStatus = "noMore";
- } else {
- this.listStatus = "more";
- this.query.currentPage++;
- }
- })
- },
- onClickStatus(item) {
- this.query.state = item.value;
- this.getList();
- },
- onClick(row) {
- // options.scene
- if (uni.getStorageSync("token")) {
- uni.navigateTo({
- url: "/signUp/index?scene=" + row.id,
- });
- } else {
- uni.showModal({
- title: "请登录",
- confirmText: "去登录",
- success(res) {
- console.log(res);
- if (res.confirm) {
- uni.navigateTo({
- url: "../../login/login/login?redirect=/pages/activity/index",
- });
- }
- },
- });
- }
- },
- onRefresh() {
- console.log("下拉刷新了", this.triggered);
- this.triggered = true
- setTimeout(() => {
- this.triggered = false;
- }, 1000)
- },
- loadMore() {
- this.getList();
- },
- },
- };
- </script>
- <style>
- page {
- background-color: #fafafa;
- }
- </style>
- <style lang="scss" scoped>
- ::v-deep .zs-list {
- height: 80vh;
- overflow-y: scroll;
- }
- .navBarBox .navBar .logo {
- width: 0rpx;
- height: 82rpx;
- // margin-right: 10rpx;
- }
- .navBarBox .navBar {
- font-size: 35rpx;
- font-weight: bold;
- padding: 3rpx 50rpx;
- padding-bottom: 8rpx;
- display: flex;
- flex-direction: row;
- justify-content: center;
- align-items: center;
- }
- .content {
- // padding-top: 24%;
- }
- // .view-content {
- // height: 600px;
- // background-color: red;
- // }
- .nvBarBox {
- display: flex;
- flex-direction: row;
- justify-content: space-around;
- align-items: center;
- // background-color: #fff;
- padding: 10rpx 0;
- font-size: 30rpx;
- color: #999999;
- .active {
- color: #333333;
- font-weight: bold;
- }
- }
- .img-veiew {
- position: relative;
- overflow: hidden;
- .badge {
- position: absolute;
- top: 0;
- right: 0;
- width: 120rpx;
- text-align: center;
- background-color: #DBDBDB;
- color: #7A7A7A;
- font-size: 24rpx;
- padding: 5rpx 10rpx;
- }
- }
- .cover {
- width: 100%;
- height: 320rpx;
- }
- .content-box {
- padding: 10rpx 20rpx;
- // height: 150rpx;
- .title {
- font-weight: bold;
- color: black;
- font-size: 32rpx;
- // 超出文本使用...
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .sub-title {
- font-size: 30rpx;
- margin: 15rpx 0 30rpx 0;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .actionBox {
- display: flex;
- flex-direction: row;
- justify-content: space-around;
- margin-top: 10rpx;
- .actionItem {
- width: 100%;
- height: 100%;
- display: flex;
- justify-content: center;
- font-size: 24rpx;
- color: #212222;
- }
- // 前2个后面加线
- .actionItem:nth-child(1),
- .actionItem:nth-child(2) {
- border-right: 1px solid #ccc;
- }
- }
- }
- </style>
|