|
@@ -1,6 +1,8 @@
|
|
|
<!-- 红包任务页面 -->
|
|
|
<template>
|
|
|
<div class="content">
|
|
|
+ <!-- global-tip -->
|
|
|
+ <global-tip :type="'1'"></global-tip>
|
|
|
<!-- open -->
|
|
|
<div v-show="state.status == 'opened'" class="opened">
|
|
|
<!-- <div class="header" :style="{ 'backgroundImage': `url(${require('@/assets/subject/001-back-head-top.svg')})` }">
|
|
@@ -155,9 +157,18 @@
|
|
|
</div>
|
|
|
<div class="luck-list-title">
|
|
|
<div>{{ state.detail.receiveCount || 0 }}/{{ state.detail.totalCount || 0 }} Winners</div>
|
|
|
- <div> {{ state.detail.receiveAmountValue }} / {{ state.detail.amountValue || '' }} {{
|
|
|
- state.detail.currencySymbol || ''
|
|
|
- }}</div>
|
|
|
+ <div class="right">
|
|
|
+ <span class="text">
|
|
|
+ <a-tooltip :title="state.detail.receiveAmountValue">
|
|
|
+ {{ getBit(state.detail.receiveAmountValue) }}
|
|
|
+ </a-tooltip>
|
|
|
+ /
|
|
|
+ <a-tooltip :title="state.detail.amountValue">
|
|
|
+ {{ getBit(state.detail.amountValue) || '' }}
|
|
|
+ </a-tooltip>
|
|
|
+ </span>
|
|
|
+ {{ state.detail.currencySymbol || '' }}
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<div class="luck-list max" @scroll="handleScroll($event)">
|
|
|
<div class="luck-item" v-for="item, i in state.detail.allReceived" v-bind:key="i">
|
|
@@ -172,7 +183,11 @@
|
|
|
</div>
|
|
|
<div class="luck-money">
|
|
|
<img :src="state.detail.currencyIconPath" alt />
|
|
|
- <div class="luck-money-txt">{{ showLastTwoPlace(item.amountValue) || 0 }}</div>
|
|
|
+ <div class="luck-money-txt">
|
|
|
+ <a-tooltip :title="item.amountValue">
|
|
|
+ {{ getBit(item.amountValue) }}
|
|
|
+ </a-tooltip>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<div class="luck-king" v-if="item.maxAmount">
|
|
|
<img :src="require('@/assets/svg/icon-king-hat.svg')" alt />
|
|
@@ -198,7 +213,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>
|
|
@@ -212,9 +227,19 @@
|
|
|
</div>
|
|
|
<div class="luck-list-title">
|
|
|
<div>{{ state.detail.receiveCount || 0 }}/{{ state.detail.totalCount || 0 }} Winners</div>
|
|
|
- <div> {{ state.detail.receiveAmountValue }} / {{ state.detail.amountValue || '' }} {{
|
|
|
- state.detail.currencySymbol || ''
|
|
|
- }}</div>
|
|
|
+ <div class="right">
|
|
|
+ <span class="text">
|
|
|
+ <a-tooltip :title="state.detail.receiveAmountValue">
|
|
|
+ {{ getBit(state.detail.receiveAmountValue) }}
|
|
|
+ </a-tooltip>
|
|
|
+ /
|
|
|
+ <a-tooltip :title="state.detail.amountValue">
|
|
|
+ {{ getBit(state.detail.amountValue) || '' }}
|
|
|
+ </a-tooltip>
|
|
|
+ </span> {{
|
|
|
+ state.detail.currencySymbol || ''
|
|
|
+ }}
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<div class="luck-list" @scroll="handleScroll">
|
|
|
<div class="luck-item" v-for="item, i in state.detail.allReceived" v-bind:key="i">
|
|
@@ -228,7 +253,11 @@
|
|
|
</div>
|
|
|
<div class="luck-money">
|
|
|
<img :src="state.detail.currencyIconPath" alt />
|
|
|
- <div class="luck-money-txt">{{ showLastTwoPlace(item.amountValue) }}</div>
|
|
|
+ <div class="luck-money-txt">
|
|
|
+ <a-tooltip :title="item.amountValue">
|
|
|
+ {{ getBit(item.amountValue) }}
|
|
|
+ </a-tooltip>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
|
|
|
<div class="luck-king" v-if="item.maxAmount">
|
|
@@ -258,9 +287,19 @@
|
|
|
|
|
|
<div class="luck-list-title">
|
|
|
<div>{{ state.detail.receiveCount || 0 }}/{{ state.detail.totalCount || 0 }} Winners</div>
|
|
|
- <div> {{ state.detail.receiveAmountValue }} / {{ state.detail.amountValue || '' }} {{
|
|
|
- state.detail.currencySymbol || ''
|
|
|
- }}</div>
|
|
|
+ <div class="right">
|
|
|
+ <span class="text">
|
|
|
+ <a-tooltip :title="state.detail.receiveAmountValue">
|
|
|
+ {{ getBit(state.detail.receiveAmountValue) }}
|
|
|
+ </a-tooltip>
|
|
|
+ /
|
|
|
+ <a-tooltip :title="state.detail.amountValue">
|
|
|
+ {{ getBit(state.detail.amountValue || '') }}
|
|
|
+ </a-tooltip>
|
|
|
+ </span> {{
|
|
|
+ state.detail.currencySymbol || ''
|
|
|
+ }}
|
|
|
+ </div>
|
|
|
</div>
|
|
|
|
|
|
<div class="luck-list max" @scroll="handleScroll">
|
|
@@ -275,7 +314,11 @@
|
|
|
</div>
|
|
|
<div class="luck-money">
|
|
|
<img :src="state.detail.currencyIconPath" alt />
|
|
|
- <div class="luck-money-txt">{{ showLastTwoPlace(item.amountValue) || 0 }}</div>
|
|
|
+ <div class="luck-money-txt">
|
|
|
+ <a-tooltip :title="item.amountValue">
|
|
|
+ {{ getBit(item.amountValue) }}
|
|
|
+ </a-tooltip>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<div class="luck-king" v-if="item.maxAmount">
|
|
|
<img :src="require('@/assets/svg/icon-king-hat.svg')" alt />
|
|
@@ -320,8 +363,8 @@ export default {
|
|
|
</script>
|
|
|
<script setup>
|
|
|
import { onMounted, reactive, ref } from "vue";
|
|
|
-import { getPostDetail, getRedPacket, finishRedPacket, oneKeyLike, oneKeyReTweet, oneKeyFollow, getTaskDetail, getReceivedList } from '@/http/redPacket.js'
|
|
|
-import { getQueryString, guid } from '@/uilts/help.js'
|
|
|
+import { getPostDetail, getRedPacket, finishRedPacket, oneKeyLike, oneKeyReTweet, oneKeyFollow, getTaskDetail, getReceivedList, addFinishEvent } from '@/http/redPacket.js'
|
|
|
+import { getQueryString, guid, getBit } from '@/uilts/help.js'
|
|
|
import { message } from 'ant-design-vue';
|
|
|
import FontAmount from '@/view/components/font-amount.vue'
|
|
|
import GetMore from '@/view/iframe/publish/components/get-more.vue'
|
|
@@ -331,6 +374,7 @@ import { srcPublishSuccess } from '@/http/publishApi'
|
|
|
import { discordAuthUrl, checkGuildJoined } from '@/http/discordApi'
|
|
|
import { discordAuthRedirectUri, faceShareRedirectUrl} from '@/http/configAPI'
|
|
|
import { getFrontConfig } from "@/http/account";
|
|
|
+import GlobalTip from '@/view/components/global-tip.vue'
|
|
|
|
|
|
var moment = require('moment');
|
|
|
|
|
@@ -367,11 +411,24 @@ let state = reactive({
|
|
|
function clickRetry() {
|
|
|
init()
|
|
|
}
|
|
|
+
|
|
|
+let follow_open_tabs = []
|
|
|
+
|
|
|
async function clickLikeBtn() {
|
|
|
let _userInfo = await checkIsLogin()
|
|
|
if (!_userInfo) {
|
|
|
return
|
|
|
}
|
|
|
+ // window.parent.postMessage({
|
|
|
+ // actionType: "IFRAME_DO_TASK", task_data: {
|
|
|
+ // tweet_Id: state.tweetId
|
|
|
+ // }, task_type: 'like'
|
|
|
+ // }, "*");
|
|
|
+
|
|
|
+ if (state.detail.finishTaskType && state.detail.finishTaskType == 2) {
|
|
|
+ window.open(`https://twitter.com/intent/like?tweet_id=${state.tweetId}`)
|
|
|
+ return
|
|
|
+ }
|
|
|
state.loading_show = true
|
|
|
oneKeyLike({
|
|
|
params: {
|
|
@@ -384,10 +441,11 @@ async function clickLikeBtn() {
|
|
|
state.done.like = true
|
|
|
} else {
|
|
|
state.done.like = false
|
|
|
+ window.open(`https://twitter.com/intent/like?tweet_id=${state.tweetId}`)
|
|
|
}
|
|
|
} else {
|
|
|
+ window.open(`https://twitter.com/intent/like?tweet_id=${state.tweetId}`)
|
|
|
state.done.like = false
|
|
|
- console.log(res)
|
|
|
}
|
|
|
})
|
|
|
// 埋点
|
|
@@ -449,7 +507,10 @@ async function clickRetweetBtn() {
|
|
|
if (!_userInfo) {
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
+ if (state.detail.finishTaskType && state.detail.finishTaskType == 2) {
|
|
|
+ window.open(`https://twitter.com/intent/retweet?tweet_id=${state.tweetId}`)
|
|
|
+ return
|
|
|
+ }
|
|
|
state.loading_show = true
|
|
|
oneKeyReTweet({
|
|
|
params: {
|
|
@@ -461,11 +522,12 @@ async function clickRetweetBtn() {
|
|
|
if (res.data.result) {
|
|
|
state.done.retweet = true
|
|
|
} else {
|
|
|
+ window.open(`https://twitter.com/intent/retweet?tweet_id=${state.tweetId}`)
|
|
|
state.done.retweet = false
|
|
|
}
|
|
|
} else {
|
|
|
+ window.open(`https://twitter.com/retweet/like?tweet_id=${state.tweetId}`)
|
|
|
state.done.retweet = false
|
|
|
- console.log(res)
|
|
|
}
|
|
|
})
|
|
|
// 埋点
|
|
@@ -584,16 +646,40 @@ function getValidity() {
|
|
|
}, 1000)
|
|
|
}
|
|
|
|
|
|
+const openFollowTabs = (arr_name) => {
|
|
|
+ let array_finish = arr_name.filter((item) => { return !item.finished })
|
|
|
+ // let array_finish = state.detail.taskCondition[0].relatedUsers.filter((item) => { return item.finished == false })
|
|
|
+ let url
|
|
|
+ if (array_finish.length > 0) {
|
|
|
+ state.done.follow = false
|
|
|
+ // 打开标签页的方法
|
|
|
+ array_finish.forEach((item) => {
|
|
|
+ url = `https://twitter.com/intent/follow?screen_name=${item}&tweet_id=${state.tweetId}`
|
|
|
+ chrome.tabs.create({ url }, (tab) => {
|
|
|
+ if (follow_open_tabs.filter((item) => { return item.url == tab.url }).length == 0) {
|
|
|
+ follow_open_tabs.push(tab)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
async function clickFollowAll(item, is_all) {
|
|
|
let _userInfo = await checkIsLogin()
|
|
|
if (!_userInfo) {
|
|
|
return
|
|
|
}
|
|
|
- state.loading_show = true
|
|
|
let arr_name = []
|
|
|
for (let i in item) {
|
|
|
- arr_name.push(item[i].name)
|
|
|
+ if (!item[i].finished) {
|
|
|
+ arr_name.push(item[i].name)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (state.detail.finishTaskType && state.detail.finishTaskType == 2) {
|
|
|
+ openFollowTabs(arr_name)
|
|
|
+ return
|
|
|
}
|
|
|
+ state.loading_show = true
|
|
|
oneKeyFollow({
|
|
|
params: {
|
|
|
names: arr_name
|
|
@@ -603,34 +689,25 @@ async function clickFollowAll(item, is_all) {
|
|
|
if (res.code == 0) {
|
|
|
res.data.forEach((item1) => {
|
|
|
state.detail.taskCondition[0].relatedUsers.forEach(item2 => {
|
|
|
- if (item1.name == item2.name) {
|
|
|
+ if (item1.name == item2.name && item1.finished) {
|
|
|
item2.finished = true
|
|
|
}
|
|
|
});
|
|
|
})
|
|
|
- let _len = state.detail.taskCondition[0].relatedUsers.filter((item) => { return item.finished == false }).length
|
|
|
- if (_len > 0) {
|
|
|
- state.done.follow = false
|
|
|
- } else {
|
|
|
- state.done.follow = true
|
|
|
- }
|
|
|
- } else {
|
|
|
- state.detail.taskCondition[0].relatedUsers.forEach(item => {
|
|
|
- item.finished = false
|
|
|
- });
|
|
|
+ openFollowTabs(arr_name)
|
|
|
}
|
|
|
})
|
|
|
+
|
|
|
+ // -------- 埋点 --------
|
|
|
let _log_obj = {
|
|
|
pageSource: Report.pageSource.task_page,
|
|
|
businessType: Report.businessType.buttonClick,
|
|
|
objectType: Report.objectType.follow
|
|
|
}
|
|
|
if (is_all) {
|
|
|
- // 埋点
|
|
|
_log_obj.objectType = Report.objectType.follow_button
|
|
|
}
|
|
|
Report.reportLog(_log_obj);
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|
|
@@ -860,40 +937,108 @@ function init() {
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
function initTaskDetail() {
|
|
|
- // 任务详情
|
|
|
- getTaskDetail({
|
|
|
- params: {
|
|
|
- postId: state.postId
|
|
|
- }
|
|
|
- }).then((res) => {
|
|
|
- if (res.code.toString()) {
|
|
|
- for (let i in res.data) {
|
|
|
- switch (res.data[i].type) {
|
|
|
- case 1:
|
|
|
- state.done.follow = res.data[i].finished
|
|
|
- state.detail.taskCondition[0].relatedUsers = res.data[i].detail
|
|
|
- break
|
|
|
- case 2:
|
|
|
- state.done.like = res.data[i].finished
|
|
|
- break
|
|
|
- case 3:
|
|
|
- state.done.retweet = res.data[i].finished
|
|
|
- break
|
|
|
- case 7:
|
|
|
- state.done.join_discord = res.data[i].finished
|
|
|
- discordAuthorizeRequired = res.data[i].discordAuthorizeRequired
|
|
|
- break
|
|
|
+ getChromeStorage('userInfo', (_userInfo) => {
|
|
|
+ if (_userInfo.uid) {
|
|
|
+ // 任务详情
|
|
|
+ getTaskDetail({
|
|
|
+ params: {
|
|
|
+ postId: state.postId
|
|
|
}
|
|
|
- }
|
|
|
- } else {
|
|
|
- handleErrorCode(res)
|
|
|
+ }).then((res) => {
|
|
|
+ if (res.code.toString()) {
|
|
|
+ for (let i in res.data) {
|
|
|
+ switch (res.data[i].type) {
|
|
|
+ case 1:
|
|
|
+ state.done.follow = res.data[i].finished
|
|
|
+ state.detail.taskCondition[0].relatedUsers = res.data[i].detail
|
|
|
+ break
|
|
|
+ case 2:
|
|
|
+ state.done.like = res.data[i].finished
|
|
|
+ break
|
|
|
+ case 3:
|
|
|
+ state.done.retweet = res.data[i].finished
|
|
|
+ break
|
|
|
+ case 7:
|
|
|
+ state.done.join_discord = res.data[i].finished
|
|
|
+ discordAuthorizeRequired = res.data[i].discordAuthorizeRequired
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ handleErrorCode(res)
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
+let tab_index = 0
|
|
|
+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 (req.task_type) {
|
|
|
+ case 'retweet':
|
|
|
+ event_type = 3
|
|
|
+ state.done.retweet = req.task_done
|
|
|
+ chrome.tabs.remove(sender.tab.id)
|
|
|
+ break;
|
|
|
+ case 'like':
|
|
|
+ event_type = 2
|
|
|
+ state.done.like = req.task_done
|
|
|
+ chrome.tabs.remove(sender.tab.id)
|
|
|
+ break
|
|
|
+ case 'follow':
|
|
|
+ event_type = 1
|
|
|
+ chrome.tabs.remove(sender.tab.id)
|
|
|
+ // for (let i = 0; i < follow_open_tabs.length; i++) {
|
|
|
+ // if (follow_open_tabs[i].id == sender.tab.id) {
|
|
|
+ // follow_open_tabs.splice(i, 1)
|
|
|
+ // break
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // chrome.tabs.getCurrent((tab) => {
|
|
|
+ // if (follow_open_tabs.length > 0) {
|
|
|
+ // tab_index = follow_open_tabs[follow_open_tabs.length - 1].index
|
|
|
+ // } else {
|
|
|
+ // tab_index = tab.index
|
|
|
+ // }
|
|
|
+ // chrome.tabs.highlight({ windowId: tab.windowId, tabs: tab_index })
|
|
|
+ // })
|
|
|
+ let has_no_finished = false
|
|
|
+ state.detail.taskCondition[0].relatedUsers.forEach((item) => {
|
|
|
+ if (follow_name == item.name) {
|
|
|
+ item.finished = req.task_done
|
|
|
+ }
|
|
|
+ })
|
|
|
+ state.detail.taskCondition[0].relatedUsers.forEach((item) => {
|
|
|
+ if (!item.finished) {
|
|
|
+ has_no_finished = true
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if (!has_no_finished) {
|
|
|
+ state.done.follow = true
|
|
|
+ state.done.follow_red = false
|
|
|
+ }
|
|
|
+ break
|
|
|
+ }
|
|
|
+ if (req.task_done) {
|
|
|
+ addFinishEvent({
|
|
|
+ params: {
|
|
|
+ eventData: follow_name,
|
|
|
+ eventType: event_type,
|
|
|
+ luckdropId: state.detail.taskLuckdropId
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
onMounted(() => {
|
|
|
state.process_mode = process.env.NODE_ENV
|
|
|
- console.log('state.process_mode',state.process_mode)
|
|
|
state.postId = getQueryString('postId')
|
|
|
state.tweetId = getQueryString('tweetId')
|
|
|
init()
|
|
@@ -902,6 +1047,7 @@ onMounted(() => {
|
|
|
// state.close_status = '没有领到钱'
|
|
|
})
|
|
|
|
|
|
+
|
|
|
// 点击领取
|
|
|
function clickOpenRedPacket() {
|
|
|
callEventPageMethod('CONTENT_GET_PINED', {})
|
|
@@ -909,11 +1055,13 @@ function clickOpenRedPacket() {
|
|
|
}
|
|
|
|
|
|
function handleRedPacket() {
|
|
|
+ state.loading_show = true
|
|
|
getRedPacket({
|
|
|
params: {
|
|
|
postId: state.postId
|
|
|
}
|
|
|
}).then((res) => {
|
|
|
+ state.loading_show = false
|
|
|
if (res.code == 0) {
|
|
|
showOpenedPage()
|
|
|
init()
|
|
@@ -1268,6 +1416,13 @@ function onRuntimeMsg() {
|
|
|
case 'BG_FACEBOOK_SHARE_SUCCESS':
|
|
|
facebookShareSuccess(req.data);
|
|
|
break;
|
|
|
+ case 'DO_TASK':
|
|
|
+ if (!req.task_type || state.tweetId != req.tweet_Id) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ state.loading_show = false
|
|
|
+ doTaskReport(req, sender);
|
|
|
+ break;
|
|
|
}
|
|
|
})
|
|
|
}
|
|
@@ -1336,7 +1491,7 @@ async function joinDiscord() {
|
|
|
state.done.join_discord = true;
|
|
|
} else {
|
|
|
state.done.join_discord = false;
|
|
|
- if(discordAuthorizeRequired) {
|
|
|
+ if (discordAuthorizeRequired) {
|
|
|
discordAuth('authAndJoinIng');
|
|
|
} else {
|
|
|
openInviteUrl();
|
|
@@ -1413,7 +1568,7 @@ function discordLoginSuccess() {
|
|
|
if (joinDiscordActionState == 'authAndJoinIng') {
|
|
|
openInviteUrl();
|
|
|
}
|
|
|
- if(discordAuthorizeRequired) {
|
|
|
+ if (discordAuthorizeRequired) {
|
|
|
discordAuthorizeRequired = false;
|
|
|
}
|
|
|
}
|
|
@@ -1446,10 +1601,9 @@ function openInviteUrl() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
</script>
|
|
|
|
|
|
-<style lang="scss">
|
|
|
+<style lang="scss" scoped>
|
|
|
html,
|
|
|
body {
|
|
|
margin: 0;
|
|
@@ -1460,6 +1614,7 @@ body {
|
|
|
}
|
|
|
|
|
|
.content {
|
|
|
+ position: relative;
|
|
|
width: 375px;
|
|
|
height: 500px;
|
|
|
background: #fafafa;
|
|
@@ -1590,6 +1745,7 @@ body {
|
|
|
}
|
|
|
|
|
|
p {
|
|
|
+ width: 100%;
|
|
|
margin: 0;
|
|
|
padding: 0;
|
|
|
color: #fff;
|
|
@@ -1696,6 +1852,10 @@ body {
|
|
|
div:last-child {
|
|
|
text-align: right;
|
|
|
}
|
|
|
+
|
|
|
+ .text {
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
.luck-list {
|
|
@@ -2100,7 +2260,7 @@ body {
|
|
|
}
|
|
|
|
|
|
span {
|
|
|
- margin-left: 15px;
|
|
|
+ margin-left: 12px;
|
|
|
font-weight: 800;
|
|
|
font-size: 60px;
|
|
|
line-height: 76px;
|