|
@@ -50,8 +50,17 @@ import { inject } from 'vue'
|
|
|
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 { prepareStart, treasureStart } from '@/http/treasure.js'
|
|
|
+import { getChromeCookie, removeChromeCookie } from '@/uilts/chromeExtension.js'
|
|
|
+
|
|
|
+chrome.storage.onChanged.addListener(changes => {
|
|
|
+ if (changes.userInfo) {
|
|
|
+ // let item = JSON.parse(changes.userInfo.newValue)
|
|
|
+ state.loading_show = false
|
|
|
+ state.init()
|
|
|
+ }
|
|
|
+})
|
|
|
|
|
|
chrome.runtime.onMessage.addListener((req, sender, sendResponse) => {
|
|
|
switch (req.actionType) {
|
|
@@ -93,8 +102,20 @@ const clickBtn = () => {
|
|
|
}
|
|
|
}, 10000)
|
|
|
|
|
|
- // four_task
|
|
|
- // 获取文章
|
|
|
+ // 获取邀请码
|
|
|
+ getChromeCookie({
|
|
|
+ name: state.postId,
|
|
|
+ url: pageUrl,
|
|
|
+ }, (res) => {
|
|
|
+ if (res && res.inviteCode) {
|
|
|
+ state.invite_code = res.inviteCode
|
|
|
+ }
|
|
|
+ startBtn()
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+const startBtn = () => {
|
|
|
+ // 获取文本
|
|
|
prepareStart({
|
|
|
params: {
|
|
|
postId: state.postId || '',
|
|
@@ -102,8 +123,13 @@ const clickBtn = () => {
|
|
|
}
|
|
|
}).then((res) => {
|
|
|
if (res.code == 0) {
|
|
|
+ removeChromeCookie({
|
|
|
+ name: state.postId,
|
|
|
+ url: pageUrl,
|
|
|
+ })
|
|
|
+
|
|
|
let text = res.data.rePostTweetContent
|
|
|
- // 发送推文
|
|
|
+ // 一键三连
|
|
|
chrome.tabs.getCurrent((tab) => {
|
|
|
chrome.tabs.sendMessage(tab.id, {
|
|
|
actionType: "IFRAME_TWITTER_API_DO_TASK",
|
|
@@ -113,7 +139,7 @@ const clickBtn = () => {
|
|
|
},
|
|
|
task_type: 'tasks',
|
|
|
tasks: state.tasks,
|
|
|
- }, (res) => { console.log(res) });
|
|
|
+ });
|
|
|
})
|
|
|
} else {
|
|
|
console.log(res)
|