Bladeren bron

Merge branch 'test' of DeNet/de-net-official into master

zhangwei 3 jaren geleden
bovenliggende
commit
291856d969
4 gewijzigde bestanden met toevoegingen van 136 en 46 verwijderingen
  1. 86 38
      pages/index.vue
  2. 43 3
      pages/install.vue
  3. BIN
      static/img/icon-logo.png
  4. 7 5
      utils/help.js

+ 86 - 38
pages/index.vue

@@ -2,7 +2,7 @@
 	<div style="width: 100%; height: 100%;">
 		<div class="content" :style="{ 'background': `#F5FAFF` }" v-show="show_home" v-if="detail">
 			<div class="logo">
-				<img src="/svg/icon-logo.svg" alt />
+				<img src="/img/icon-logo.png" alt />
 			</div>
 			<!-- 未开始 -->
 			<div class="not-open" v-show="status == 'not-open'">
@@ -43,17 +43,17 @@
 					<div class="head-area head-money" v-if="status == 'open' || status == 'opened'">
 						<div class="txt">AWESOME! YOU Will GET</div>
 						<div class="head-money-area">
-							<img :src="currencyIconUrl" alt />
-							<span class="money-txt">{{ receiveAmount / 100 }}</span>
+							<img :src="currencyIconPath" alt />
+							<span class="money-txt">{{ receiveAmount }}</span>
 						</div>
 					</div>
 				</div>
 
 				<!-- 领取列表 -->
 				<div class="luck-list-title">
-					<div>{{ detail.postBizData.receiveCount || 0 }}/{{ detail.postBizData.totalCount || 0 }} Got</div>
-					<div> {{ detail.postBizData.receiveAmountValue / 100 }} / {{
-						detail.postBizData.amountValue / 100 || ''
+					<div>{{ detail.postBizData.receiveCount || 0 }}/{{ detail.postBizData.totalCount || 0 }} Winners</div>
+					<div> {{ detail.postBizData.receiveAmountValue }} / {{
+							detail.postBizData.amountValue || ''
 					}} {{ detail.postBizData.amountCurrencyCode || '' }}</div>
 				</div>
 				<div class="luck-list" @scroll="handleScroll($event)">
@@ -65,8 +65,8 @@
 							<div class="luck-time">{{ formatTime(item.receiveTimestamp) }}</div>
 						</div>
 						<div class="luck-money">
-							<img :src="item.currencyIconUrl" alt />
-							<div class="luck-money-txt">{{ item.amountValue / 100 || 0 }}</div>
+							<img :src="item.currencyIconPath" alt />
+							<div class="luck-money-txt">{{ item.amountValue || 0 }}</div>
 						</div>
 						<div class="luck-king" v-if="item.maxAmount">
 							<img src="/svg/icon-king-hat.svg" alt />
@@ -83,11 +83,11 @@
 				<div class="title">Withdraw to Wallet</div>
 				<div class="validity">
 					<template v-if="validity_state">
-						<span>Validity</span>
-						<span style="color: red;">{{ validity }}</span>
+						<span style="color:#FFA620;">Remaining valid time </span>
+						<span style="color: #FFA620;">{{ validity }}</span>
 					</template>
 					<template v-else>
-						<span style="color: red;">Giveaways Validity</span>
+						<span style="color: #FFA620;">Giveaways Validity</span>
 					</template>
 				</div>
 
@@ -98,7 +98,7 @@
 						<div class="num">1</div>
 						<span>Install DeNet</span>
 					</div>
-					<div class="tip">Used for Task Verification and Giveaways Withdrawal</div>
+					<div class="tip">Used to verify tasks and get rewards</div>
 					<div class="install_btn" @click="installExtension">Install</div>
 					<div class="area_num">
 						<div class="num">2</div>
@@ -112,7 +112,7 @@
 			<div class="install install-error" v-if="status == 'nothing' || status == 'expire'">
 				<div class="title">Install DeNet</div>
 				<div class="title">Don't miss the next Giveaway</div>
-				<div class="tip">Used for Task Verification and Giveaways Withdrawal</div>
+				<div class="tip">Used to verify tasks and get rewards</div>
 				<div class="install_btn" @click="installExtension">Install</div>
 			</div>
 
@@ -122,7 +122,7 @@
 				<div class="title">Open Giveaways</div>
 				<div class="title">with chrome</div>
 				<div class="tip">Only supports getting Giveaways through chrome</div>
-				<div class="install_chrome">
+				<div class="install_chrome" @click="clickOpenChrome()">
 					<img src="/svg/icon-chrome.svg" alt />
 					Install Chrome
 				</div>
@@ -135,9 +135,9 @@
 			</div>
 			<!-- 领取列表 -->
 			<div class="luck-list-title">
-				<div>{{ detail.postBizData.receiveCount || 0 }}/{{ detail.postBizData.totalCount || 0 }} Got</div>
-				<div> {{ detail.postBizData.receiveAmountValue / 100 }} / {{
-					detail.postBizData.amountValue / 100 || ''
+				<div>{{ detail.postBizData.receiveCount || 0 }}/{{ detail.postBizData.totalCount || 0 }} Winners</div>
+				<div> {{ detail.postBizData.receiveAmountValue }} / {{
+						detail.postBizData.amountValue || ''
 				}} {{ detail.postBizData.amountCurrencyCode || '' }}</div>
 			</div>
 			<div class="luck-list" @scroll="handleScroll($event)">
@@ -149,8 +149,8 @@
 						<div class="luck-time">{{ formatTime(item.receiveTimestamp) }}</div>
 					</div>
 					<div class="luck-money">
-						<img :src="item.currencyIconUrl" alt />
-						<div class="luck-money-txt">{{ item.amountValue / 100 || 0 }}</div>
+						<img :src="currencyIconPath" alt />
+						<div class="luck-money-txt">{{ item.amountValue || 0 }}</div>
 					</div>
 					<div class="luck-king" v-if="item.maxAmount">
 						<img src="/svg/icon-king-hat.svg" alt />
@@ -226,15 +226,19 @@ export default {
 					}
 				}
 			},
-			currencyIconUrl: '',
+			currencyIconPath: '',
 			title: '',
-			twitterTitle: 'deNet',
+			twitterTitle: 'DeNet: An Easy Web3 Tool For GIVEAWAY / AIRDROP',
 			jumpUrl: jumpUrl,
 			status: '',
 			page_index: 1,
 			page_size: 20,
 			luck_list: [],
-			luck_list_end: false
+			luck_list_end: false,
+			config: {
+				extensionsInstallChannel : 'officeDownload', // chromeAppStore
+				extensionsInstallUrl: ''
+			}
 		}
 	},
 
@@ -259,26 +263,29 @@ export default {
 				{
 					name: 'twitter:image',
 					content: this.detail.postBizData.imagePath || ''
-				},
-				{
-					name: 'twitter:image:width',
-					content: '1280'
-				},
-				{
-					name: 'twitter:image:height',
-					content: '720'
-				},
+				}
 			]
 		}
 	},
 	methods: {
+		clickOpenChrome(){
+			window.open('https://www.google.com/chrome')
+		},
 		isMobile() {
 			let flag = navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i);
 			return flag;
 		},
 		installExtension() {
-			let url = 'https://d3d9wvhy948gxx.cloudfront.net/extensions/chrome/denet.zip'
-			location.href = url;
+			let {extensionsInstallChannel, extensionsInstallUrl} = this.config;
+			let url = extensionsInstallUrl || "https://d1mcov78iir8kk.cloudfront.net/extensions/chrome/denet1_0_1.zip"
+			switch (extensionsInstallChannel) {
+				case "officeDownload":
+					location.href = url;
+					break;
+				case "chromeAppStore":
+					window.open(extensionsInstallUrl)
+					break;
+			}
 			this.$router.push({
 				path: '/install'
 			})
@@ -313,6 +320,7 @@ export default {
 			}
 		},
 		async getRedPacket() {
+			this.currencyIconPath = this.detail.postBizData.currencyIconPath
 			let { data } = await axios.post(`${baseURL}/denet/post/luckdrop/receiveLuckdrop`, {
 				baseInfo: {
 					appVersionCode: this.appVersionCode,
@@ -325,6 +333,7 @@ export default {
 			this.show_home = true
 			switch (data.code.toString()) {
 				case '0':
+					this.getDetail()
 					if (data.data.newReceived) {
 						this.status = 'not-open'
 						setTimeout(() => {
@@ -392,6 +401,15 @@ export default {
 					_h = moment.duration(_d1.diff(_d2)).hours()
 					_m = moment.duration(_d1.diff(_d2)).minutes()
 					_s = moment.duration(_d1.diff(_d2)).seconds()
+					if (_h < 10) {
+						_h = '0' + _h
+					}
+					if (_m < 10) {
+						_m = '0' + _m
+					}
+					if (_s < 10) {
+						_s = '0' + _s
+					}
 					this.validity = `${_h}:${_m}:${_s}`
 				} else {
 					clearInterval(timer)
@@ -404,7 +422,34 @@ export default {
 				postNickName: this.detail.postBizData.postUserInfo.nickName
 			};
 			Cookies.set('pickup_info', JSON.stringify(pickupInfo), { expires: 100 });
-		}
+		},
+		async getDetail() {
+			let { data } = await axios.post(`${baseURL}/denet/post/getDetail`, {
+				baseInfo: {
+					appVersionCode: this.appVersionCode,
+					mid: this.mid
+				},
+				params: {
+					postId: this.detail.postId
+				}
+			})
+			if (data.code == 0) {
+				this.detail.postBizData = JSON.parse(data.data.postBizData)
+			}
+		},
+		async getConfig() {
+			let {data} = await axios.post(`${baseURL}/denet/base/config/getFrontConfig`, {
+				baseInfo: {
+					appVersionCode: this.appVersionCode,
+					mid: this.mid
+				},
+				params: {
+				}
+			})
+			if (data.code == 0) {
+				this.config = data.data;
+			}
+		},
 	},
 
 	async asyncData(params) {
@@ -432,7 +477,9 @@ export default {
 		}
 	},
 
+
 	mounted() {
+		this.getConfig()
 		if (!this.detail.postId) {
 			return
 		}
@@ -451,7 +498,7 @@ export default {
 		// 	win.addEventListener(resizeEvt, recalc, false);
 		// 	doc.addEventListener('DOMContentLoaded', recalc, false);
 		// })(document, window);
-		
+
 		document.documentElement.style.fontSize = '62.5%'
 		if (this.isMobile()) {
 			this.show_moblie = true
@@ -499,10 +546,11 @@ body,
 
 .moblie {
 	display: flex;
-    flex-wrap: wrap;
-    height: 100%;
+	flex-wrap: wrap;
+	height: 100%;
 	align-content: flex-start;
 	flex-direction: column;
+
 	.layer {
 		position: fixed;
 		width: 100%;
@@ -767,7 +815,7 @@ body,
 
 		img {
 			width: 10.7rem;
-			height: 4rem;
+			height: 3.4rem;
 		}
 	}
 

+ 43 - 3
pages/install.vue

@@ -11,14 +11,54 @@
 </template>
 
 <script>
+import axios from 'axios';
+const api = {
+	prod: 'https://api.denetme.net',
+	pre: 'https://preapi.denetme.net',
+	test: 'https://testapi.denetme.net'
+}
+const baseURL = api[process.env.NUXT_ENV.MODE]
+
 export default {
 	name: "install",
+  data() {
+		return {
+			config: {
+				extensionsInstallChannel : 'officeDownload', // chromeAppStore
+				extensionsInstallUrl: ''
+      }
+    }
+  },
   methods: {
 		installExtension() {
-			let url = 'https://d3d9wvhy948gxx.cloudfront.net/extensions/chrome/denet.zip'
-			location.href= url;
+			let {extensionsInstallChannel, extensionsInstallUrl} = this.config;
+			let url = extensionsInstallUrl || "https://d1mcov78iir8kk.cloudfront.net/extensions/chrome/denet1_0_1.zip"
+			switch (extensionsInstallChannel) {
+				case "officeDownload":
+					location.href = url;
+					break;
+				case "chromeAppStore":
+					window.open(extensionsInstallUrl)
+					break;
+			}
 		},
-  }
+		async getConfig() {
+			let {data} = await axios.post(`${baseURL}/denet/base/config/getFrontConfig`, {
+				baseInfo: {
+					appVersionCode: this.appVersionCode,
+					mid: this.mid
+				},
+				params: {
+				}
+			})
+			if (data.code == 0) {
+				this.config = data.data;
+			}
+		},
+  },
+  mounted () {
+		this.getConfig();
+	}
 }
 </script>
 

BIN
static/img/icon-logo.png


+ 7 - 5
utils/help.js

@@ -28,13 +28,9 @@ export function isBrowser() {
             }
             return false;
         }
-        if (agent.indexOf("chrome") > 0) {
-            return 'chrome'
-        }
-
     }
     let s = System()
-    if(s){
+    if (s) {
         return s
     }
     if (agent.indexOf('firefox') > 0) {
@@ -43,7 +39,13 @@ export function isBrowser() {
     if (agent.indexOf('trident') > 0) {
         return "IE浏览器"
     }
+    if (agent.indexOf('edg') > 0) {
+        return "IE浏览器"
+    }
     if (agent.indexOf("safari") > 0 && agent.indexOf("chrome") < 0) {
         return 'Safari'
     }
+    if (agent.indexOf("chrome") > 0) {
+        return 'chrome'
+    }
 }