Explorar o código

Merge branch 'test' of https://git.yishihui.com/DeNet/de-net into test

A\An %!s(int64=2) %!d(string=hai) anos
pai
achega
4f5e3239c9
Modificáronse 2 ficheiros con 33 adicións e 19 borrados
  1. 13 2
      src/logic/content/twitter.js
  2. 20 17
      src/view/iframe/red-packet/red-packet.vue

+ 13 - 2
src/logic/content/twitter.js

@@ -698,6 +698,9 @@ export function checkTwitterTaskState() {
     // 获取关注名字 获取推特Id    
     let confirm_btn = document.querySelector('div[data-testid=confirmationSheetConfirm]')
     let confirm_btn_status
+    let cancel_btn = document.querySelector('div[data-testid=confirmationSheetCancel]')
+    let cancel_btn_status
+    
     // let page_follow_btn = document.querySelector('div[aria-describedby]')
     // let page_follow_btn_status
 
@@ -705,11 +708,19 @@ export function checkTwitterTaskState() {
         if (confirm_btn && !confirm_btn_status) {
             confirm_btn_status = true
             confirm_btn.onclick = (e) => {
-                chrome.runtime.sendMessage({ actionType: "DO_TASK", tweet_Id, task_type, task_data }, () => { })
+                chrome.runtime.sendMessage({ actionType: "DO_TASK", tweet_Id, task_type, task_data ,task_done:true}, () => { })
             }
         } else {
             confirm_btn = document.querySelector('div[data-testid=confirmationSheetConfirm]')
         }
+        if(cancel_btn && !cancel_btn_status){
+            cancel_btn_status= true
+            cancel_btn.onclick = (e) => {
+                chrome.runtime.sendMessage({ actionType: "DO_TASK", tweet_Id, task_type, task_data ,task_done:false}, () => { })
+            }
+        }else{
+            cancel_btn = document.querySelector('div[data-testid=confirmationSheetCancel]')
+        }
         // if (page_follow_btn && page_follow_btn.dataset && page_follow_btn.dataset.testid && !page_follow_btn_status) {
         //     page_follow_btn_status = true
         //     if (page_follow_btn.dataset.testid.includes('unfollow')) {
@@ -720,7 +731,7 @@ export function checkTwitterTaskState() {
         //     page_follow_btn = document.querySelector('div[aria-describedby]')
         // }
 
-        if (confirm_btn_status) {
+        if (confirm_btn_status && cancel_btn_status) {
             observer.disconnect()
         }
     });

+ 20 - 17
src/view/iframe/red-packet/red-packet.vue

@@ -190,7 +190,7 @@
         <div class="txt">{{ state.detail.currencySymbol }} GIVEAWAY</div>
         <div class="coin">
           <img :src="state.detail.currencyIconPath" alt />
-          <font-amount :amount="state.detail.amountValue"></font-amount>
+          <font-amount :amount="state.detail.amountValue" style="color:#fff;margin-left:10px;"></font-amount>
         </div>
         <div class="people">{{ state.detail.totalCount }} WINNERS TO SHARE</div>
       </div>
@@ -350,7 +350,7 @@ import Report from "@/log-center/log"
 import { srcPublishSuccess } from '@/http/publishApi'
 import { discordAuthUrl, checkGuildJoined } from '@/http/discordApi'
 import { discordAuthRedirectUri } from '@/http/configAPI'
-import  GlobalTip  from '@/view/components/global-tip.vue'
+import GlobalTip from '@/view/components/global-tip.vue'
 
 var moment = require('moment');
 
@@ -540,6 +540,7 @@ function getValidity() {
 }
 
 const openFollowTabs = () => {
+  debugger
   let array_finish = state.detail.taskCondition[0].relatedUsers.filter((item) => { return item.finished == false })
   let url
   if (array_finish.length > 0) {
@@ -848,22 +849,22 @@ function initTaskDetail() {
 }
 
 let tab_index = 0
-const doTaskReport = (type, { follow_name = '' }, sender) => {
+const doTaskReport = (req, sender) => {
+  let follow_name = req.task_data.follow_name || ''
   // 1 Twitter follow Twitter ScreenName
   // 2 Tweet like
   // 3 Retweet
   let event_type = 0
-  switch (type) {
+  switch (req.task_type) {
     case 'retweet':
       event_type = 3
-      state.done.retweet = true
+      state.done.retweet = req.task_done
       chrome.tabs.remove(sender.tab.id)
       break;
     case 'like':
       event_type = 2
-      state.done.like = true
+      state.done.like = req.task_done
       chrome.tabs.remove(sender.tab.id)
-
       break
     case 'follow':
       event_type = 1
@@ -883,11 +884,11 @@ const doTaskReport = (type, { follow_name = '' }, sender) => {
         }
         chrome.tabs.highlight({ windowId: tab.windowId, tabs: tab_index })
       })
-
+      debugger
       let has_no_finished = false
       state.detail.taskCondition[0].relatedUsers.forEach((item) => {
         if (follow_name == item.name) {
-          item.finished = true
+          item.finished = req.task_done
         }
       })
       state.detail.taskCondition[0].relatedUsers.forEach((item) => {
@@ -901,13 +902,15 @@ const doTaskReport = (type, { follow_name = '' }, sender) => {
       }
       break
   }
-  addFinishEvent({
-    params: {
-      eventData: follow_name,
-      eventType: event_type,
-      luckdropId: state.detail.taskLuckdropId
-    }
-  })
+  if (req.task_done) {
+    addFinishEvent({
+      params: {
+        eventData: follow_name,
+        eventType: event_type,
+        luckdropId: state.detail.taskLuckdropId
+      }
+    })
+  }
 }
 
 onMounted(() => {
@@ -1260,7 +1263,7 @@ function onRuntimeMsg() {
           return
         }
         state.loading_show = false
-        doTaskReport(req.task_type, req.task_data, sender)
+        doTaskReport(req, sender)
     }
   })
 }