duanshenglang hace 1 mes
padre
commit
4b98e8662e
Se han modificado 2 ficheros con 60 adiciones y 51 borrados
  1. BIN
      lottery/img/lottery-bg.png
  2. 60 51
      lottery/index.html

BIN
lottery/img/lottery-bg.png


+ 60 - 51
lottery/index.html

@@ -14,9 +14,9 @@
 	<script src="https://unpkg.com/element-ui/lib/index.js"></script>
 	<script src="https://unpkg.com/vconsole/dist/vconsole.min.js"></script>
 	<script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
-		<!-- <script>
-		  var vConsole = new window.VConsole();
-		</script> -->
+	<!-- <script>
+		var vConsole = new window.VConsole();
+	</script> -->
 </head>
 <style>
   body {
@@ -40,6 +40,7 @@
 		padding: 267px 61px 0 60px;
 		display: flex;
     flex-wrap: wrap;
+		justify-content: center;
     gap: 10px;
 	}
 	.prize_item {
@@ -355,61 +356,63 @@
 		padding-right: 4px;
 	}
 	.qrcode {
-		padding: 20rem;
-	}
-	.qrcode-img {
-		width: 100%;
-		height: 100%;
-		object-fit: cover;
-		margin-bottom: 20rem;
+		width: 100vw;
+    height: 100vh;
+    box-sizing: border-box;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    flex-direction: column;
 	}
 	.qrcode-msg {
 		text-align: center;
-		font-size: 18rem;
+    font-size: 18px;
 	}
 </style>
 
 <body>
 	<div id="box">
-		<div class="lotteryPage">
-			<div class="event_notice" @click="handleRule">
-				<span>活动须知</span>
-			</div>
-			<div class="prize_content">
-				<div :class="['prize_item', { actives: isSpinning && index === currentIndex }]" v-for="(item, index) in prizesList" :key="index">
-					<img class="prize_img" :src="item.img"></img>
-					<div>{{item.name}}</div>
-				</div>
-			</div>
-			<div class="lottery_btn">
-				<img class="btn_img" src="./img/btn.png" @click="handleLottery"></img>
-				<div class="lottery_tip">已抽奖{{useNum}}次,还剩{{remainNum}}次机会</div>
-			</div>
+		<!-- 二维码 -->
+		<div class="qrcode" v-if="qrCodeData.qrCode">
+			<img class="qrcode-img" :src="qrCodeData.qrCode" />
+			<div class="qrcode-msg">{{qrCodeData.msg}}</div>
 		</div>
-		<div class="rule">
-			<div class="rule_body">
-				<div class="tabs">
-					<Button class="tab_link" :class="{ 'active': activeName === 'tab1' }" @click="changeTab('tab1')">活动信息</Button>
-					<Button class="tab_link" :class="{ 'active': activeName === 'tab2' }" @click="changeTab('tab2')">抽奖记录</Button>
+		<div v-else>
+			<div class="lotteryPage">
+				<div class="event_notice" @click="handleRule">
+					<span>活动须知</span>
+				</div>
+				<div class="prize_content">
+					<div :class="['prize_item', { actives: isSpinning && index === currentIndex }]" v-for="(item, index) in prizesList" :key="index">
+						<img class="prize_img" :src="item.img"></img>
+						<div>{{item.name}}</div>
+					</div>
+				</div>
+				<div class="lottery_btn">
+					<img class="btn_img" src="./img/btn.png" @click="handleLottery"></img>
+					<div class="lottery_tip">已抽奖{{useNum}}次,还剩{{remainNum}}次机会</div>
 				</div>
-				<div v-if="activeName === 'tab1'" class="tab_content record_list" v-html="activeMsg"></div>
-				<div v-if="activeName === 'tab2'" class="record_list">
-					<div class="record_item" v-for="(item, index) in lotteryRecords" :key="index">
-						<img class="record_img" :src="item.img" mode="widthFix" />
-						<div>
-							<div class="prize_name">{{item.name}}</div>
-							<div class="prize_time">{{timeFormat(item.raffleTime)}}</div>
+			</div>
+			<div class="rule">
+				<div class="rule_body">
+					<div class="tabs">
+						<Button class="tab_link" :class="{ 'active': activeName === 'tab1' }" @click="changeTab('tab1')">活动信息</Button>
+						<Button class="tab_link" :class="{ 'active': activeName === 'tab2' }" @click="changeTab('tab2')">抽奖记录</Button>
+					</div>
+					<div v-if="activeName === 'tab1'" class="tab_content record_list" v-html="activeMsg"></div>
+					<div v-if="activeName === 'tab2'" class="record_list">
+						<div class="record_item" v-for="(item, index) in lotteryRecords" :key="index">
+							<img class="record_img" :src="item.img" mode="widthFix" />
+							<div>
+								<div class="prize_name">{{item.name}}</div>
+								<div class="prize_time">{{timeFormat(item.raffleTime)}}</div>
+							</div>
+							<el-button :disabled="item.status == -1 || item.status == 1" class="get_btn" onclick="handleOpenForm(item.id)">{{item.status == 1 ? '已领取' : (item.status == -1 ? '审核中' : '领取')}}</el-button>
 						</div>
-						<el-button :disabled="item.status == -1 || item.status == 1" class="get_btn" onclick="handleOpenForm(item.id)">{{item.status == 1 ? '已领取' : (item.status == -1 ? '审核中' : '领取')}}</el-button>
 					</div>
 				</div>
 			</div>
 		</div>
-		<!-- 二维码 -->
-		<div class="qrcode" v-if="qrCode.qrCode">
-			<img class="qrcode-img" :src="qrCode.qrCode" />
-			<div class="qrcode-msg">{{qrCode.msg}}</div>
-		</div>
 		<!-- 奖励弹窗 -->
 		<div class="prize_dialog" v-if="showPrizeDialog">
 			<div class="dialog-body">
@@ -515,7 +518,7 @@
           return {
 						httpUrl: true,
 						h5Type: null,
-						qrCode: {
+						qrCodeData: {
 							qrCode: '',
 							msg: '',
 						},
@@ -568,6 +571,7 @@
 						this.httpUrl = 'http://test.wefanbot.com:18993'
 					}
 					this.bId = this.getQueryParam('bId')
+					
 					if (this.getQueryParam('openId') || localStorage.getItem('openId')) {
 						if (!this.getQueryParam('externalUserid')) {
 							this.gerQwAuth(this.bId);
@@ -607,10 +611,15 @@
 								let { data, code, msg } = result
 								if (code === 1) {
 									this.h5Type = data.h5Type
-									localStorage.setItem('openId', res.data.openId)
+									localStorage.setItem('openId', data.openId)
 									this.gerQwAuth(this.bId);
 								}
               })
+						} else {
+							let redirect_uri = window.location.href
+							// code 不存在,走微信网页授权逻辑 
+							let url = `https://open.weixin.qq.com/connect/oauth2/authorize?appId=wx99ec0d0828a4d2d3&redirect_uri=${redirect_uri}&scope=snsapi_userinfo&state=STATE#wechat_redirect`
+							window.location.replace(url)
 						}
 					},
 					// 企微授权
@@ -623,7 +632,7 @@
               }).then(result => {
 								let { data, code, msg } = result
 								if (code === 1) {
-									window.location.replace(res.data)
+									window.location.replace(data)
 								} else {
 									this.$message({
 										message: msg,
@@ -640,7 +649,7 @@
               }).then(result => {
 								let { data, code, msg } = result
 								if (code === 1) {
-									this.qrCode = data
+									this.qrCodeData = data
 								} else {
 									this.$message({
 										message: msg,
@@ -685,10 +694,10 @@
 										})
 									})
 								} else {
-									this.$message({
-										message: msg,
-										type: 'warning'
-									})
+									// this.$message({
+									// 	message: msg,
+									// 	type: 'warning'
+									// })
 								}
               })
 					},