123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- <template>
- <view style="width: 100%;height: 100%;">
- <u-navbar leftIconSize="0" :placeholder="true" bgColor="#ffffff">
- <view class="u-nav-slot" slot="left">
- <u-tabs @change="changeTab" :scrollable="false" :list="statusArr" lineWidth="30" lineHeight="1"
- lineColor="#E96737" :activeStyle="{
- color: '#E96737',
- transform: 'scale(1)',
- width: '65px',
-
- }" :inactiveStyle="{
- color: '#333',
- transform: 'scale(1)',
- width: '65px'
- }" itemStyle="padding-left: 11px; padding-right: 11px; height: 44px;text-align: center;">
- </u-tabs>
- </view>
- </u-navbar>
- <view class="list" style="padding: 0 10rpx;">
- <view v-for="(item,index) in list" :key="index" style="text-align: center;">
- <view class="" style="background-color: #FFFFFF;margin-bottom: 20rpx;">
- <view style="">
- <image :src="item.picUrl" mode="" style="width: 730rpx;height: 350rpx;"></image>
- </view>
- <view class="" style="width: 730rpx;height: 100rpx; margin: 0 auto;">
- <view style="text-align: left; float: left;">
- <view>活动名称:{{item.title}}</view>
- <view>开始时间:{{item.startTime}}</view>
- </view>
- <view style="float: right;">
- <navigator :url="`/packageOperate/activity/index?id=${ item.id }`">
- <button v-if="item.status.value == 3"
- style="height: 65rpx;line-height: 65rpx;background-color:#901199;color: #fff;margin-top: 16rpx;">查看详情</button>
- <button v-else
- style="height: 65rpx;line-height: 65rpx;background-color:#901199;color: #fff;margin-top: 16rpx;">即将开始</button>
- </navigator>
- </view>
- </view>
- </view>
- </view>
- <view class="flex empty" v-if="!list.length && !loading">
- <u-empty text="活动为空" mode="order" />
- </view>
- </view>
- <custom-tab-bar :activeValue="'activity'" />
- </view>
- </template>
- <script>
- import env from '../../config/env.js'
- import $http from '@/utils/request.js'
- export default {
- data() {
- return {
- list: [],
- statusArr: [{
- name: '待开奖'
- }, {
- name: '已开奖',
- }],
- triggerStatus: 0,
- }
- },
- onShow() {
- this.pageList()
- },
- methods: {
- changeTab(e) {
- if (e.index == 0) {
- this.triggerStatus = 0
- } else if (e.index == 1) {
- this.triggerStatus = 1
- }
- this.pageList()
- },
- pageList() {
- this.pageNum = 1
- this.list = []
- this.getList()
- },
- getList() {
- uni.showLoading({
- title: '加载中'
- });
- this.loading = true
- $http.post(`/api/v1/mp/user/marketing/list?pageNum=${ this.pageNum }&pageSize=20`, {
- triggerStatus: this.triggerStatus,
- }).then(res => {
- console.log(res);
- uni.hideLoading();
- this.loading = false
- if (res.code == 0) {
- res.rows.forEach(item => {
- let picUrlArr = item.picUrl.split(',')
- item.picUrl = env.filePublic + picUrlArr[0] + '?imageView2/2/w/170'
- item.status = JSON.parse(item.status)
- })
- this.total = res.total
- this.list = this.list.concat(res.rows)
- }
- }).catch(() => {
- uni.hideLoading();
- this.loading = false
- })
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .list {}
- .empty {
- height: 60vh;
- }
- </style>
|