Explorar o código

首页活动时间

hwb0 %!s(int64=3) %!d(string=hai) anos
pai
achega
5085c08f6b
Modificáronse 1 ficheiros con 26 adicións e 4 borrados
  1. 26 4
      pages/index/index.vue

+ 26 - 4
pages/index/index.vue

@@ -38,10 +38,10 @@
 				
 				<!-- 投诉建议 -->
 				<view class="proposal flex">
-					<view class="proposal-time flex">
+					<view class="proposal-time flex" v-show="filterActivityList.length" @click="toActivity">
 						<image src="../../static/index/index_time_top.png" mode="scaleToFill"></image>
 						<view class="time">
-							<u-count-down :time="30 * 60 * 60 * 1000" format="HH:mm:ss:SSS" autoStart millisecond></u-count-down>
+							<u-count-down :time="activityTime" format="HH:mm:ss:SSS" autoStart millisecond></u-count-down>
 						</view>
 					</view>
 					<view class="proposal-progress">
@@ -167,7 +167,8 @@
 				inviteCode: '',//助力邀请码
 				marketingId: '',//活动id
 				activityShow: false,//助力邀请弹框
-
+				filterActivityList: [],
+				activityTime: null,
 			};
 		},
 		onLoad(opthios) {
@@ -207,7 +208,7 @@
 		onShow(opthios) {
 			this.loginState = uni.getStorageSync('token') ? true : false
 			this.getPrizeNews()
-
+			this.getActivityList()
 		},
 		methods: {
 			// 切换盲票
@@ -249,6 +250,21 @@
 				// #endif
 			},
 			
+			// 活动
+			getActivityList() {
+				$http.post(`/api/v1/mp/user/marketing/list?pageNum=${ this.pageNum }&pageSize=20`, {
+					triggerStatus: 0,
+				}).then(res => {
+					let data = res.rows
+					this.filterActivityList = data.filter(item=> {
+						return JSON.parse(item.status).value == 3
+					})
+					let activityInfo = this.filterActivityList.length ? this.filterActivityList[0] : {}
+					let timestamp = parseInt(new Date().getTime())
+					this.activityTime = activityInfo.endTime - timestamp
+				})
+			},
+			
 			// 获取盲票列表
 			getList() {
 				uni.showLoading({
@@ -449,6 +465,12 @@
 					})
 				}
 			},
+			
+			toActivity() {
+				uni.switchTab({
+					url: '/pages/activity/index'
+				})
+			},
 
 			// 点击所有盲票
 			toTicket() {