|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
|
<!-- 封面页 -->
|
|
|
- <div class="cover">
|
|
|
+ <div class="cover" v-show-log="state.log_show">
|
|
|
<v-head :left-data="state.detail.postUserInfo || null"></v-head>
|
|
|
<div class="waring" v-if="state.cover_status == '奖励已被领光'">
|
|
|
<div>All treasures</div>
|
|
@@ -16,14 +16,14 @@
|
|
|
<div class="treasure">
|
|
|
<component-zoom width="335" fontSize="34" style="margin:0 auto;">
|
|
|
<span>Treasure</span>
|
|
|
- <span>{{ state.detail.amountValue }}</span>
|
|
|
+ <span>${{ toLast(state.detail.amountUsdValue, 2) }}</span>
|
|
|
</component-zoom>
|
|
|
</div>
|
|
|
<div class="gain">
|
|
|
<component-zoom width="335" fontSize="34" style="margin:0 auto;">
|
|
|
<span>Your Gain Up to</span>
|
|
|
<span>$</span>
|
|
|
- <span>{{ state.detail.remainAmountValue }}</span>
|
|
|
+ <span>{{ toLast(state.detail.upGainAmountValue, 3) }}</span>
|
|
|
</component-zoom>
|
|
|
</div>
|
|
|
<div class="coin">
|
|
@@ -42,8 +42,8 @@
|
|
|
<img :src="require('@/assets/svg/icon-three-line.svg')" alt="" />
|
|
|
<span>to Hunt Treasure</span>
|
|
|
</div>
|
|
|
- <v-btn :txt="state.open_btn.txt" :font-size="'17px'" class="btn" :icon="true"
|
|
|
- :disabled="state.open_btn.disabled" @onClick="clickBtn" :loading="state.btn_loading"></v-btn>
|
|
|
+ <v-btn :txt="state.open_btn.txt" :font-size="'17px'" :icon="true" :disabled="false" @onClick="clickBtn"
|
|
|
+ :loading="state.btn_loading" v-click-log="state.log_click"></v-btn>
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
@@ -53,8 +53,26 @@ import VBtn from '@/view/iframe/treasure-hunt/components/btn.vue'
|
|
|
import VHead from '@/view/iframe/treasure-hunt/components/head.vue'
|
|
|
import ComponentZoom from "@/view/components/component-zoom.vue";
|
|
|
import { pageUrl } from "@/http/configAPI.js"
|
|
|
+import Report from "@/log-center/log"
|
|
|
import { prepareStart, treasureStart } from '@/http/treasure.js'
|
|
|
import { getChromeCookie, removeChromeCookie } from '@/uilts/chromeExtension.js'
|
|
|
+let state = inject('state')
|
|
|
+state.btn_loading = false
|
|
|
+
|
|
|
+state.log_show = {
|
|
|
+ pageSource: Report.pageSource.pending_page,
|
|
|
+ redPacketType: Report.redPacketType.treasure,
|
|
|
+ shareLinkId: state.invite_code,
|
|
|
+ postId: state.postId
|
|
|
+}
|
|
|
+
|
|
|
+state.log_click = {
|
|
|
+ objectType: Report.pageSource.open_button,
|
|
|
+ pageSource: Report.pageSource.pending_page,
|
|
|
+ redPacketType: Report.redPacketType.treasure,
|
|
|
+ shareLinkId: state.invite_code,
|
|
|
+ postId: state.postId
|
|
|
+}
|
|
|
|
|
|
chrome.storage.onChanged.addListener(changes => {
|
|
|
if (changes.userInfo) {
|
|
@@ -67,10 +85,17 @@ chrome.storage.onChanged.addListener(changes => {
|
|
|
chrome.runtime.onMessage.addListener((req, sender, sendResponse) => {
|
|
|
switch (req.actionType) {
|
|
|
case 'DO_TASK':
|
|
|
- if (!req.task_type || state.tweetId != req.tweet_Id || !req.task_done) {
|
|
|
+ if (!req.task_type || state.tweetId != req.tweet_Id) {
|
|
|
return
|
|
|
}
|
|
|
- if (req.task_type == 'createTweet') {
|
|
|
+ if (!req.task_done && req.task_type == 'createTweet') {
|
|
|
+ state.toast.txt = 'Seems something went wrong, please try again'
|
|
|
+ state.toast.show = true
|
|
|
+ state.toast.has_icon = false
|
|
|
+ setTimeout(() => {
|
|
|
+ state.toast.show = false
|
|
|
+ }, 2000)
|
|
|
+ } else if (req.task_type == 'createTweet' && req.task_done) {
|
|
|
treasureStart({
|
|
|
params: {
|
|
|
postId: state.postId || '',
|
|
@@ -81,6 +106,11 @@ chrome.runtime.onMessage.addListener((req, sender, sendResponse) => {
|
|
|
state.page = '开奖页'
|
|
|
state.start_task = res.data
|
|
|
state.btn_loading = false
|
|
|
+ } else {
|
|
|
+ state.init(() => {
|
|
|
+ state.inviteInit()
|
|
|
+ state.inviteList()
|
|
|
+ })
|
|
|
}
|
|
|
})
|
|
|
}
|
|
@@ -88,8 +118,15 @@ chrome.runtime.onMessage.addListener((req, sender, sendResponse) => {
|
|
|
}
|
|
|
})
|
|
|
|
|
|
-let state = inject('state')
|
|
|
-state.btn_loading = false
|
|
|
+const toLast = (num, bit) => {
|
|
|
+ let str = 1
|
|
|
+ for (let i = 0; i < bit; i++) {
|
|
|
+ str = str + '0'
|
|
|
+ }
|
|
|
+ let _num = Number(str)
|
|
|
+ return Math.floor(Number(num) * _num) / _num
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
const clickBtn = () => {
|
|
|
if (state.cover_status == '奖励已被领光') {
|
|
@@ -144,7 +181,10 @@ const startBtn = () => {
|
|
|
});
|
|
|
})
|
|
|
} else {
|
|
|
- console.log(res)
|
|
|
+ state.init(() => {
|
|
|
+ state.inviteInit()
|
|
|
+ state.inviteList()
|
|
|
+ })
|
|
|
}
|
|
|
})
|
|
|
}
|