|
@@ -66,6 +66,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">
|
|
@@ -306,7 +318,7 @@ import { 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'
|
|
|
|
|
|
var moment = require('moment');
|
|
var moment = require('moment');
|
|
|
|
|
|
@@ -314,6 +326,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: "1040829453198385",
|
|
|
|
+ faceShareRedirectUrl
|
|
|
|
+};
|
|
|
|
+
|
|
let state = reactive({
|
|
let state = reactive({
|
|
status: '',
|
|
status: '',
|
|
loading_show: false,
|
|
loading_show: false,
|
|
@@ -330,7 +347,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() {
|
|
@@ -445,6 +463,69 @@ async function clickRetweetBtn() {
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+/**
|
|
|
|
+ * 点击repost facebook
|
|
|
|
+ */
|
|
|
|
+async function clickRepostFacebook(params) {
|
|
|
|
+ let _userInfo = await checkIsLogin()
|
|
|
|
+ if (!_userInfo) {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ let shareUrlparams = {
|
|
|
|
+ href: state.postRedirectUrl,
|
|
|
|
+ type: params.type,
|
|
|
|
+ taskLuckdropId: state.detail.taskLuckdropId
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ let shareUrl = feacebookShareUrl(shareUrlparams);
|
|
|
|
+ openShareFacebookWindow({url: shareUrl});
|
|
|
|
+ callEventPageMethod('CONTENT_SET_PUBLISH_STRING', {
|
|
|
|
+ publishContentStr: state.srcContent
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * 分享到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
|
|
@@ -722,6 +803,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) {
|
|
@@ -782,11 +866,7 @@ onMounted(() => {
|
|
|
|
|
|
// 点击领取
|
|
// 点击领取
|
|
function clickOpenRedPacket() {
|
|
function clickOpenRedPacket() {
|
|
- chrome.runtime.sendMessage({
|
|
|
|
- actionType: 'CONTENT_GET_PINED'
|
|
|
|
- }, res => {
|
|
|
|
- console.log(res);
|
|
|
|
- })
|
|
|
|
|
|
+ callEventPageMethod('CONTENT_GET_PINED', {})
|
|
handleRedPacket()
|
|
handleRedPacket()
|
|
}
|
|
}
|
|
|
|
|
|
@@ -910,7 +990,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
|
|
@@ -1114,6 +1204,9 @@ 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;
|
|
}
|
|
}
|
|
})
|
|
})
|
|
}
|
|
}
|