소스 검색

获奖名单弹框只跳一次

DELL 3 년 전
부모
커밋
0bc38e9910
2개의 변경된 파일40개의 추가작업 그리고 19개의 파일을 삭제
  1. 3 3
      packageOperate/activity/index.vue
  2. 37 16
      packageOperate/activity/record.vue

+ 3 - 3
packageOperate/activity/index.vue

@@ -6,9 +6,9 @@
 			<view style="height: 98rpx;background-color: #fff;margin: 0 30rpx;line-height: 98rpx;overflow: hidden;">
 				<view class="data-btn">距离开奖时间:
 					<text v-if="timeData.days != 0">{{timeData.days}}&nbsp;天</text>
-					<text>{{ timeData.hours>10?timeData.hours:'0'+timeData.hours }}&nbsp;:</text>
-					<text>{{ timeData.minutes>10?timeData.minutes:'0'+timeData.minutes }}&nbsp;:</text>
-					<text>{{ timeData.seconds>10?timeData.seconds:'0'+timeData.seconds }}</text>
+					<text>{{ timeData.hours>=10?timeData.hours:'0'+timeData.hours }}&nbsp;:</text>
+					<text>{{ timeData.minutes>=10?timeData.minutes:'0'+timeData.minutes }}&nbsp;:</text>
+					<text>{{ timeData.seconds>=10?timeData.seconds:'0'+timeData.seconds }}</text>
 				</view>
 				<view style="float: right;"><span style="font-weight: 600;">{{info.fakeNum}}</span>人已参与</view>
 			</view>

+ 37 - 16
packageOperate/activity/record.vue

@@ -10,17 +10,17 @@
 					<view class="award-nickNames">
 						<view class="nickName"><text>{{item.nickName}}</text>
 							<view v-if="item.awardName == '一等奖'" class="awardName">
-								<image src="../../static/activity/one.png" mode="">
+								<image src="../static/activity/one.png" mode="">
 								</image>
 								<text style="color: #FFD225;">{{item.awardName}}</text>
 							</view>
 							<view v-else-if="item.awardName == '二等奖'" class="awardName">
-								<image src="../../static/activity/two.png" mode="">
+								<image src="../static/activity/two.png" mode="">
 								</image>
 								<text style="color: #94CBEC;">{{item.awardName}}</text>
 							</view>
 							<view v-else-if="item.awardName == '三等奖'" class="awardName">
-								<image src="../../static/activity/three.png" mode=""></image>
+								<image src="../static/activity/three.png" mode=""></image>
 								<text style="color: #F2B47A;">{{item.awardName}}</text>
 							</view>
 						</view>
@@ -30,9 +30,10 @@
 				</view>
 			</view>
 		</view>
-		
+
 		<!-- 中奖 -->
-		<u-popup :show="activityShow" mode="center" round="17" @close="close" :closeable="true" overlayOpacity="0.5" @touchmove.prevent.stop>
+		<u-popup :show="activityShow" mode="center" round="17" @close="close" :closeable="true" overlayOpacity="0.5"
+			@touchmove.prevent.stop>
 			<view class="choiceShow-wrap">
 				<view style="width: 200rpx; height: 200rpx;margin: 100rpx; text-align: center;">
 					恭喜你获得一等奖
@@ -41,9 +42,10 @@
 				<button @click="close()">关闭</button>
 			</view>
 		</u-popup>
-		
+
 		<!-- 未中奖 -->
-		<u-popup :show="closeShow" mode="center" round="17" @close="close" :closeable="true" overlayOpacity="0.5" @touchmove.prevent.stop>
+		<u-popup :show="closeShow" mode="center" round="17" @close="close" :closeable="true" overlayOpacity="0.5"
+			@touchmove.prevent.stop>
 			<view class="choiceShow-wrap">
 				<view style="width: 200rpx; height: 200rpx;margin: 100rpx; text-align: center;">
 					很遗憾你未中奖,欢迎继续参与其他抽奖,好运就在你身边
@@ -101,25 +103,41 @@
 					uni.hideLoading();
 					this.loading = false
 				});
-				$http.post(`/api/v1/mp/user/marketing/hit/prize/isHit/${this.marketingId}`,{}).then(res => {
-					if(res.code == 0 && res.data && res.data.isHit == 1){
-						this.activityShow = true
+				
+				try {
+					const value = uni.getStorageSync(this.marketingId);
+					if (value) {
+						
+					}else {
+						this.successFail()
+						uni.setStorageSync(this.marketingId, this.marketingId);
 					}
-					if(res.code == 0 && res.data && res.data.isHit == 0){
-						this.closeShow = true
-					}
-				})
+				} catch (e) {
+					// error
+				}
+
 			},
 			close() {
 				this.closeShow = false
 				this.activityShow = false
 			},
-			
+
 			toPrize() {
 				uni.navigateTo({
-					url:'/packagePrize/prize/index'
+					url: '/packagePrize/prize/index'
 				})
 			},
+			successFail() {
+				$http.post(`/api/v1/mp/user/marketing/hit/prize/isHit/${this.marketingId}`, {}).then(
+					res => {
+						if (res.code == 0 && res.data && res.data.isHit == 1) {
+							this.activityShow = true
+						}
+						if (res.code == 0 && res.data && res.data.isHit == 0) {
+							this.closeShow = true
+						}
+					})
+			}
 		}
 	}
 </script>
@@ -158,12 +176,14 @@
 
 						.awardName {
 							display: inline-block;
+
 							image {
 								width: 40rpx;
 								height: 36rpx;
 								margin-left: 30rpx;
 								vertical-align: -10%;
 							}
+
 							text {
 								display: inline-block;
 								font-size: 26rpx;
@@ -175,6 +195,7 @@
 				}
 			}
 		}
+
 		// 设置ios刘海屏底部横线安全区域
 		padding-bottom: constant(safe-area-inset-bottom);
 		padding-bottom: env(safe-area-inset-bottom);