|
@@ -57,7 +57,8 @@ chrome.runtime.onMessage.addListener((req, sender, sendResponse) => {
|
|
|
if (req.task_type == 'createTweet') {
|
|
|
treasureStart({
|
|
|
params: {
|
|
|
- postId: state.postId
|
|
|
+ postId: state.postId || '',
|
|
|
+ inviteCode: state.invite_code || ''
|
|
|
}
|
|
|
}).then((res) => {
|
|
|
if (res.code == 0) {
|
|
@@ -81,39 +82,34 @@ const clickBtn = () => {
|
|
|
}
|
|
|
|
|
|
state.btn_loading = true
|
|
|
+ setTimeout(() => {
|
|
|
+ if (state.btn_loading == true) {
|
|
|
+ state.btn_loading = false
|
|
|
+ }
|
|
|
+ }, 10000)
|
|
|
+
|
|
|
// four_task
|
|
|
// 获取文章
|
|
|
prepareStart({
|
|
|
params: {
|
|
|
- postId: state.postId
|
|
|
+ postId: state.postId || '',
|
|
|
+ inviteCode: state.invite_code || ''
|
|
|
}
|
|
|
}).then((res) => {
|
|
|
if (res.code == 0) {
|
|
|
let text = res.data.rePostTweetContent
|
|
|
// 发送推文
|
|
|
- // chrome.tabs.getCurrent((tab) => {
|
|
|
- // chrome.tabs.sendMessage(tab.id, {
|
|
|
- // actionType: "IFRAME_TWITTER_API_DO_TASK",
|
|
|
- // task_data: {
|
|
|
- // tweet_Id: state.tweetId,
|
|
|
- // tweet_text: text
|
|
|
- // },
|
|
|
- // task_type: 'tasks',
|
|
|
- // tasks: JSON.parse(state.detail.startCondition),
|
|
|
- // }, (res) => { console.log(res) });
|
|
|
- // })
|
|
|
- treasureStart({
|
|
|
- params: {
|
|
|
- postId: state.postId
|
|
|
- }
|
|
|
- }).then((res) => {
|
|
|
- if (res.code == 0) {
|
|
|
- state.page = '开奖页'
|
|
|
- state.start_task = res.data
|
|
|
- state.btn_loading = false
|
|
|
- }
|
|
|
+ chrome.tabs.getCurrent((tab) => {
|
|
|
+ chrome.tabs.sendMessage(tab.id, {
|
|
|
+ actionType: "IFRAME_TWITTER_API_DO_TASK",
|
|
|
+ task_data: {
|
|
|
+ tweet_Id: state.tweetId,
|
|
|
+ tweet_text: text
|
|
|
+ },
|
|
|
+ task_type: 'tasks',
|
|
|
+ tasks: JSON.parse(state.detail.startCondition),
|
|
|
+ }, (res) => { console.log(res) });
|
|
|
})
|
|
|
-
|
|
|
} else {
|
|
|
console.log(res)
|
|
|
}
|