Browse Source

[bug][打开宝箱]

zhangwei 2 years ago
parent
commit
05cdbe3766

+ 1 - 0
src/view/iframe/treasure-hunt/components/btn.vue

@@ -59,6 +59,7 @@ const refresh = () => {
 
         state.init(() => {
             state.inviteInit()
+            state.inviteList()
         })
     }
 }

+ 15 - 4
src/view/iframe/treasure-hunt/components/invite-friends.vue

@@ -10,7 +10,9 @@
             </div>
         </div>
         <div class="share-list">
-            <img :src="item.iconPath" alt="" v-for="item in state.share_list" @click="clickShare(item)" />
+            <img :src="item.iconPath" alt="" v-for="item in state.share_list"
+                :data-clipboard-text="item.inviteContent + ' ' + item.redirectPath" @click="clickShare(item)"
+                class="share-item" />
         </div>
         <v-btn :txt="state.open_btn.txt" :font-size="'17px'" class="btn" :icon="false"
             :disabled="state.open_btn.disabled" @onClick="clickBtn" font-weight="600"></v-btn>
@@ -47,14 +49,23 @@ const clickBtn = () => {
     state.treasureOpen()
 }
 
-
-
 const clickShare = (item) => {
+    var clipboard = new ClipboardJS('.share-item');
+    clipboard.on('success', function (e) {
+        state.toast.txt = 'Copy Successfully'
+        state.toast.has_icon = true
+        state.toast.show = true
+        setTimeout(() => {
+            state.toast.show = false
+        }, 2000)
+        e.clearSelection();
+    })
     window.open(item.redirectPath)
 }
-var clipboard = new ClipboardJS('.copy-btn');
+
 
 const clickCopy = () => {
+    var clipboard = new ClipboardJS('.copy-btn');
     clipboard.on('success', function (e) {
         state.toast.txt = 'Copy Successfully'
         state.toast.has_icon = true

+ 4 - 0
src/view/iframe/treasure-hunt/components/invite-list.vue

@@ -49,6 +49,10 @@ function handleScroll(e) {
 }
 
 const list = () => {
+    state.inviteList()
+}
+
+state.inviteList = () => {
     inviteList({
         params: {
             inviteCode: state.invite_code,

+ 12 - 5
src/view/iframe/treasure-hunt/cover.vue

@@ -23,7 +23,7 @@
                 <component-zoom width="335" fontSize="34" style="margin:0 auto;">
                     <span>Your Gain Up to</span>
                     <span>$</span>
-                    <span>{{ state.detail.remainAmountValue }}</span>
+                    <span>{{ state.detail.upGainAmountValue }}</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'" :icon="true" :disabled="state.open_btn.disabled"
-            @onClick="clickBtn" :loading="state.btn_loading" v-click-log="state.log_click"></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>
@@ -89,7 +89,6 @@ chrome.runtime.onMessage.addListener((req, sender, sendResponse) => {
                 return
             }
             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
@@ -107,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()
+                        })
                     }
                 })
             }
@@ -169,7 +173,10 @@ const startBtn = () => {
                 });
             })
         } else {
-            console.log(res)
+            state.init(() => {
+                state.inviteInit()
+                state.inviteList()
+            })
         }
     })
 }

+ 5 - 3
src/view/iframe/treasure-hunt/index.vue

@@ -3,7 +3,7 @@
     <v-invite v-if="state.page == '邀请页'"></v-invite>
     <v-result v-if="state.page == '开奖页'"></v-result>
     <open-box v-show="state.open_box.show"></open-box>
-    <v-toast :show="state.toast.show" :txt="state.toast.txt"></v-toast>
+    <v-toast :show="state.toast.show" :txt="state.toast.txt" :has_icon="state.toast.has_icon"></v-toast>
 </template>
 <script setup>
 import { reactive, provide, onMounted } from 'vue'
@@ -105,7 +105,8 @@ state.treasureOpen = () => {
         }
     }).then((res) => {
         if (res.code == 0) {
-            for (let i in state.open_box) {
+            // icon
+            for (let i in state.boxs) {
                 if (state.boxs[i].id == state.treasureId) {
                     if (i > 0) {
                         state.open_box.icon = gold_open_box_big
@@ -118,9 +119,9 @@ state.treasureOpen = () => {
             state.open_box.show = true
             state.open_box.data = res.data
 
-            // icon
             state.init(() => {
                 state.inviteInit()
+                state.inviteList()
             })
         } else {
             switch (String(res.code)) {
@@ -147,6 +148,7 @@ state.treasureOpen = () => {
 
             state.init(() => {
                 state.inviteInit()
+                state.inviteList()
             })
         }
     })

+ 1 - 0
src/view/iframe/treasure-hunt/invite.vue

@@ -85,6 +85,7 @@ onMounted(() => {
     setInterval(() => {
         state.init(() => {
             state.inviteInit()
+            state.inviteList()
         })
     }, 30000)
 })

+ 2 - 2
src/view/iframe/treasure-hunt/result.vue

@@ -36,8 +36,8 @@
             </template>
         </div>
         <v-btn :txt="'Invite friends for more treasures'" :font-size="'16px'" class="btn"
-            v-if="Number(state.start_task.amountValue) > 0" @onClick="clickBtn"></v-btn>
-        <v-btn :txt="'Invite'" :font-size="'16px'" class="btn" v-else @onClick="clickBtn"></v-btn>
+            v-if="Number(state.start_task.amountValue) > 0" @onClick="clickBtn" :disabled="false"></v-btn>
+        <v-btn :txt="'Invite'" :font-size="'16px'" class="btn" v-else @onClick="clickBtn" :disabled="false"></v-btn>
     </div>
 </template>
 <script setup>