|
@@ -68,6 +68,18 @@
|
|
<img v-if="state.done.retweet" :src="require('@/assets/svg/icon-true.svg')" alt />
|
|
<img v-if="state.done.retweet" :src="require('@/assets/svg/icon-true.svg')" alt />
|
|
<div v-else class="btn" @click="clickRetweetBtn">Retweet</div>
|
|
<div v-else class="btn" @click="clickRetweetBtn">Retweet</div>
|
|
</template>
|
|
</template>
|
|
|
|
+ <!-- repost feacebook -->
|
|
|
|
+ <template v-if="item.type == 8">
|
|
|
|
+ <img :src="require('@/assets/svg/icon-task-facebook.svg')" alt />
|
|
|
|
+ <div class="item-content">
|
|
|
|
+ <div class="item-title">Repost to Facebook</div>
|
|
|
|
+ </div>
|
|
|
|
+ <img :src="require('@/assets/gif/red-right.gif')" alt class="red-right"
|
|
|
|
+ v-show="!state.done.repost_facebook && state.done.repost_facebook_red" />
|
|
|
|
+ <img v-if="state.done.repost_facebook" :src="require('@/assets/svg/icon-true.svg')" alt />
|
|
|
|
+ <div v-else class="btn" @click="clickRepostFacebook(item)">Repost</div>
|
|
|
|
+ </template>
|
|
|
|
+ <!-- join discord -->
|
|
<template v-if="item.type == 7">
|
|
<template v-if="item.type == 7">
|
|
<img :src="require('@/assets/svg/icon-discord-mini.svg')" alt />
|
|
<img :src="require('@/assets/svg/icon-discord-mini.svg')" alt />
|
|
<div class="item-content">
|
|
<div class="item-content">
|
|
@@ -344,11 +356,12 @@ import { getQueryString, guid, getBit } from '@/uilts/help.js'
|
|
import { message } from 'ant-design-vue';
|
|
import { message } from 'ant-design-vue';
|
|
import FontAmount from '@/view/components/font-amount.vue'
|
|
import FontAmount from '@/view/components/font-amount.vue'
|
|
import GetMore from '@/view/iframe/publish/components/get-more.vue'
|
|
import GetMore from '@/view/iframe/publish/components/get-more.vue'
|
|
-import { getChromeStorage } from '@/uilts/chromeExtension.js'
|
|
|
|
|
|
+import { setChromeStorage, getChromeStorage } from '@/uilts/chromeExtension.js'
|
|
import Report from "@/log-center/log"
|
|
import Report from "@/log-center/log"
|
|
import { srcPublishSuccess } from '@/http/publishApi'
|
|
import { srcPublishSuccess } from '@/http/publishApi'
|
|
import { discordAuthUrl, checkGuildJoined } from '@/http/discordApi'
|
|
import { discordAuthUrl, checkGuildJoined } from '@/http/discordApi'
|
|
-import { discordAuthRedirectUri } from '@/http/configAPI'
|
|
|
|
|
|
+import { discordAuthRedirectUri, faceShareRedirectUrl} from '@/http/configAPI'
|
|
|
|
+import { getFrontConfig } from "@/http/account";
|
|
import GlobalTip from '@/view/components/global-tip.vue'
|
|
import GlobalTip from '@/view/components/global-tip.vue'
|
|
|
|
|
|
var moment = require('moment');
|
|
var moment = require('moment');
|
|
@@ -357,6 +370,11 @@ let discordAuthorizeRequired = false;
|
|
let joinDiscordActionState = 'default'; //authAndJoinIng joinIng reAuth
|
|
let joinDiscordActionState = 'default'; //authAndJoinIng joinIng reAuth
|
|
let joinDiscordIng = ref(false);
|
|
let joinDiscordIng = ref(false);
|
|
|
|
|
|
|
|
+let facebookAppConfig = {
|
|
|
|
+ facebookAppId: "",
|
|
|
|
+ faceShareRedirectUrl
|
|
|
|
+};
|
|
|
|
+
|
|
let state = reactive({
|
|
let state = reactive({
|
|
status: '',
|
|
status: '',
|
|
loading_show: false,
|
|
loading_show: false,
|
|
@@ -373,7 +391,8 @@ let state = reactive({
|
|
follow: false,
|
|
follow: false,
|
|
like: false,
|
|
like: false,
|
|
retweet: false,
|
|
retweet: false,
|
|
- join_discord: false
|
|
|
|
|
|
+ join_discord: false,
|
|
|
|
+ repost_facebook: false,
|
|
}
|
|
}
|
|
})
|
|
})
|
|
function clickRetry() {
|
|
function clickRetry() {
|
|
@@ -506,6 +525,69 @@ async function clickRetweetBtn() {
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+/**
|
|
|
|
+ * 点击repost facebook
|
|
|
|
+ */
|
|
|
|
+async function clickRepostFacebook(params) {
|
|
|
|
+ let _userInfo = await checkIsLogin()
|
|
|
|
+ if (!_userInfo) {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ let shareUrlparams = {
|
|
|
|
+ href: state.postRedirectUrl + '?tweetId=' + state.tweetId,
|
|
|
|
+ type: params.type,
|
|
|
|
+ taskLuckdropId: state.detail.taskLuckdropId
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ setChromeStorage({shareFacebookData : JSON.stringify({
|
|
|
|
+ contentStr: state.srcContent
|
|
|
|
+ })})
|
|
|
|
+
|
|
|
|
+ let shareUrl = feacebookShareUrl(shareUrlparams);
|
|
|
|
+ openShareFacebookWindow({url: shareUrl});
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * 分享到facebook
|
|
|
|
+ */
|
|
|
|
+function openShareFacebookWindow({url}) {
|
|
|
|
+ const width = 800;
|
|
|
|
+ chrome.windows.create({
|
|
|
|
+ width,
|
|
|
|
+ type: 'normal',
|
|
|
|
+ url
|
|
|
|
+ }, function (window) {
|
|
|
|
+
|
|
|
|
+ })
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * 分享fecebook 地址
|
|
|
|
+ */
|
|
|
|
+function feacebookShareUrl(params = {}) {
|
|
|
|
+ let { href = '', type = '', taskLuckdropId } = params;
|
|
|
|
+ let cbParams = JSON.stringify({
|
|
|
|
+ type,
|
|
|
|
+ taskLuckdropId
|
|
|
|
+ })
|
|
|
|
+ let shareUrl = `https://www.facebook.com/dialog/share?app_id=${facebookAppConfig.facebookAppId}&display=popup&href=${href}&redirect_uri=${facebookAppConfig.faceShareRedirectUrl}?params=${cbParams}`;
|
|
|
|
+
|
|
|
|
+ return shareUrl;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * 分享成功
|
|
|
|
+ */
|
|
|
|
+function facebookShareSuccess(params) {
|
|
|
|
+ let {taskLuckdropId} = params;
|
|
|
|
+
|
|
|
|
+ if(taskLuckdropId == state.detail.taskLuckdropId) {
|
|
|
|
+ state.done.repost_facebook = true;
|
|
|
|
+ state.done.repost_facebook_red = false;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
|
|
function getValidity() {
|
|
function getValidity() {
|
|
let _d1, _d2, _d3, _h, _m, _s
|
|
let _d1, _d2, _d3, _h, _m, _s
|
|
@@ -784,9 +866,20 @@ const handleStatusPage = () => {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+function setFrontConfig() {
|
|
|
|
+ getFrontConfig({
|
|
|
|
+ params: {},
|
|
|
|
+ }).then((res) => {
|
|
|
|
+ if (res.code == 0) {
|
|
|
|
+ facebookAppConfig.facebookAppId = res.data.fbClientId;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+};
|
|
|
|
+
|
|
function init() {
|
|
function init() {
|
|
onRuntimeMsg();
|
|
onRuntimeMsg();
|
|
onPageVisbile();
|
|
onPageVisbile();
|
|
|
|
+ setFrontConfig();
|
|
getPostDetail({
|
|
getPostDetail({
|
|
params: {
|
|
params: {
|
|
postId: state.postId
|
|
postId: state.postId
|
|
@@ -798,6 +891,9 @@ function init() {
|
|
// 如果金额是0
|
|
// 如果金额是0
|
|
// 显示没有领到钱
|
|
// 显示没有领到钱
|
|
if (res.code == 0) {
|
|
if (res.code == 0) {
|
|
|
|
+ state.srcContent = res.data.srcContent;
|
|
|
|
+ state.postRedirectUrl = res.data.postRedirectUrl;
|
|
|
|
+
|
|
// 判断推特id,绑定逻辑
|
|
// 判断推特id,绑定逻辑
|
|
state.srcContentId = res.data.srcContentId
|
|
state.srcContentId = res.data.srcContentId
|
|
if (!state.srcContentId) {
|
|
if (!state.srcContentId) {
|
|
@@ -927,11 +1023,7 @@ onMounted(() => {
|
|
|
|
|
|
// 点击领取
|
|
// 点击领取
|
|
function clickOpenRedPacket() {
|
|
function clickOpenRedPacket() {
|
|
- chrome.runtime.sendMessage({
|
|
|
|
- actionType: 'CONTENT_GET_PINED'
|
|
|
|
- }, res => {
|
|
|
|
- console.log(res);
|
|
|
|
- })
|
|
|
|
|
|
+ callEventPageMethod('CONTENT_GET_PINED', {})
|
|
handleRedPacket()
|
|
handleRedPacket()
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1057,7 +1149,17 @@ function handleFinishRedPacket() {
|
|
state.done.retweet = false
|
|
state.done.retweet = false
|
|
}
|
|
}
|
|
break
|
|
break
|
|
|
|
+ case '8':
|
|
|
|
+ //repost feacebook
|
|
|
|
+ if (_data[i].finished) {
|
|
|
|
+ state.done.repost_facebook = true
|
|
|
|
+ state.done.repost_facebook_red = false
|
|
|
|
+ } else {
|
|
|
|
+ state.done.repost_facebook = false;
|
|
|
|
+ state.done.repost_facebook_red = true
|
|
|
|
+ }
|
|
case '7':
|
|
case '7':
|
|
|
|
+ //join discord
|
|
discordAuthorizeRequired = _data[i].discordAuthorizeRequired;
|
|
discordAuthorizeRequired = _data[i].discordAuthorizeRequired;
|
|
if (_data[i].finished) {
|
|
if (_data[i].finished) {
|
|
state.done.join_discord = true
|
|
state.done.join_discord = true
|
|
@@ -1261,12 +1363,16 @@ function onRuntimeMsg() {
|
|
case 'BACK_DISCORD_LOGIN_SUCCESS':
|
|
case 'BACK_DISCORD_LOGIN_SUCCESS':
|
|
discordLoginSuccess();
|
|
discordLoginSuccess();
|
|
break;
|
|
break;
|
|
|
|
+ case 'BG_FACEBOOK_SHARE_SUCCESS':
|
|
|
|
+ facebookShareSuccess(req.data);
|
|
|
|
+ break;
|
|
case 'DO_TASK':
|
|
case 'DO_TASK':
|
|
if (!req.task_type || state.tweetId != req.tweet_Id) {
|
|
if (!req.task_type || state.tweetId != req.tweet_Id) {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
state.loading_show = false
|
|
state.loading_show = false
|
|
- doTaskReport(req, sender)
|
|
|
|
|
|
+ doTaskReport(req, sender);
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
})
|
|
})
|
|
}
|
|
}
|