wenliming 3 years ago
parent
commit
3c43eef301
1 changed files with 20 additions and 14 deletions
  1. 20 14
      pages/index.vue

+ 20 - 14
pages/index.vue

@@ -1,12 +1,13 @@
 <template>
-	<div class="content" :style="{ 'backgroundImage': `url(${this.back_img})` }" v-show="home_show">
+	<div class="content" :style="{ 'backgroundImage': `url(${this.back_img})` }" v-show="home_show" v-if="detail">
 		<div class="logo">
 			<img src="/svg/icon-logo.svg" alt />
 		</div>
 		<!-- 红包 -->
 		<div class="redPacket" :class="{ redPacket2: status != 'open', key_packet: status == 'open' }"
-			v-show="status != 'error'">
-			<div class="area" :class="{ key_area: status == 'open' }" v-show="status == 'open' || status == 'no-chrome'">
+				 v-show="status != 'error'">
+			<div class="area" :class="{ key_area: status == 'open' }"
+					 v-show="status == 'open' || status == 'no-chrome'">
 				<div class="title">
 					<img :src="detail.postBizData.postUserInfo.avatarUrl" alt />
 					<span>Giveaways from: {{ detail.postBizData.postUserInfo.nickName }}</span>
@@ -15,9 +16,9 @@
 			</div>
 
 			<img src="/svg/back-top.svg" alt class="top" v-show="status == 'open' || status == 'no-chrome'"
-				:class="{ key_top: status == 'open' }" />
+					 :class="{ key_top: status == 'open' }" />
 			<img src="/svg/back-down.svg" alt class="down" v-show="status == 'open' || status == 'no-chrome'"
-				:class="{ key_down: status == 'open' }" />
+					 :class="{ key_down: status == 'open' }" />
 			<img src="/svg/icon-usd.svg" alt class="start" v-show="status == 'no-chrome'" />
 			<img src="/git/icon-start.gif" alt class="start" v-show="status == 'open'" />
 
@@ -32,7 +33,7 @@
 				<div class="head-area" v-else-if="status == 'nothing'">Better luck next time!</div>
 				<div class="head-area" v-else-if="status == 'expire'">
 					<div>This Giveways</div>
-					<div>expired on 03-14</div>
+					<div>expired on {{ formatTime(detail.postBizData.endTimestamp,'MM-DD') }}</div>
 				</div>
 				<div class="head-money" v-if="status == 'open' || status == 'opened'">
 					<img src="/svg/icon-usd.svg" alt />
@@ -47,8 +48,8 @@
 				</div>
 				<div>Total ${{ detail.postBizData.amountValue / 100 || '' }} {{
 					detail.postBizData.amountCurrencyCode ||
-						''
-				}}</div>
+					''
+					}}</div>
 			</div>
 			<div class="luck-list" @scroll="handleScroll" ref="list">
 				<div class="luck-item" v-for="item, i in luck_list" v-bind:key="i">
@@ -126,9 +127,9 @@ import { isBrowser } from '../utils/help.js'
 var moment = require('moment');
 
 const api = {
-	prod: 'https://api.denet.me',
-	pre: 'https://preapi.denet.me',
-	test: 'https://testapi.denet.me',
+	prod: 'https://api.denetme.net',
+	pre: 'https://preapi.denetme.net',
+	test: 'https://testapi.denetme.net'
 }
 
 const baseURL = api[process.env.NUXT_ENV.MODE]
@@ -256,6 +257,9 @@ export default {
 					this.getValidity(data.data.endTimestamp)
 					this.receiveAmount = data.data.receiveAmount
 					break;
+				case '2003':
+					this.status = 'expire'
+					break
 				// 红包被领完了
 				case '2008':
 					this.status = 'nothing'
@@ -266,6 +270,7 @@ export default {
 					break
 				default:
 					console.log('getRedPacket', data)
+					this.home_show = false
 					break;
 			}
 			// 领取列表分页
@@ -314,8 +319,10 @@ export default {
 			}, 1000)
 		},
 		setPickupInfo() {
-			let  pickupInfo = {	srcContentId: this.detail.srcContentId,
-								postNickName: this.detail.postBizData.postUserInfo.nickName };
+			let pickupInfo = {
+				srcContentId: this.detail.srcContentId,
+				postNickName: this.detail.postBizData.postUserInfo.nickName
+			};
 			Cookies.set('pickup_info', JSON.stringify(pickupInfo), { expires: 100 });
 		}
 	},
@@ -497,7 +504,6 @@ body,
 
 			.head-area {
 				height: 10rem;
-				line-height: 10rem;
 				text-align: center;
 				letter-spacing: 0.3px;
 				font-size: 2rem;