|
@@ -1,5 +1,5 @@
|
|
|
<template>
|
|
|
- <div class="page-wrapper" ref="pageWrapper" @scroll="pageScroll">
|
|
|
+ <div class="page-wrapper" ref="pageWrapperDom" @scroll="pageScroll">
|
|
|
<template v-if="isLogin && homeVisibility">
|
|
|
<div class="nav-bar">
|
|
|
<div class="item left">
|
|
@@ -18,7 +18,7 @@
|
|
|
/>
|
|
|
<div class="amount">${{ canWithdrawBalance / 100 }}</div>
|
|
|
<div class="withdraw-btn" @click="clickWithdraw">Withdraw</div>
|
|
|
- <div class="msg">(Paypal charges fee: 4.4% + $0.3)</div>
|
|
|
+ <div class="msg">({{walletWithdrawConfig.withdrawUSDPaypalFeeDesc}})</div>
|
|
|
</div>
|
|
|
<div class="tab-bar">
|
|
|
<div
|
|
@@ -32,7 +32,7 @@
|
|
|
{{ item.label }}
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="list-wrapper" ref="pageGiveList">
|
|
|
+ <div class="list-wrapper" ref="pageGiveListDom">
|
|
|
<div class="give-list" v-if="currentTabIndex == 0">
|
|
|
<template v-if="giveList.length">
|
|
|
<div
|
|
@@ -145,7 +145,7 @@
|
|
|
</template>
|
|
|
<!-- 红包未发出显示 -->
|
|
|
<div
|
|
|
- v-if="item.status == 0"
|
|
|
+ v-if="!item.postTaskLuckdrop.srcPublishStatus"
|
|
|
class="send-btn"
|
|
|
@click.stop="sendTwitter(item)"
|
|
|
>
|
|
@@ -158,7 +158,7 @@
|
|
|
v-if="
|
|
|
!(
|
|
|
item.type == 2 &&
|
|
|
- item.status == 0
|
|
|
+ !item.postTaskLuckdrop.srcPublishStatus
|
|
|
)
|
|
|
"
|
|
|
class="icon"
|
|
@@ -202,18 +202,21 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<!-- login -->
|
|
|
- <option-login v-if="!isLogin" @loginSuccess="loginSuccess" />
|
|
|
- <!-- 交易列表 -->
|
|
|
- <option-transactions
|
|
|
- v-if="isLogin && !homeVisibility && transactionsVisibility"
|
|
|
- @showHome="onShowHome"
|
|
|
- />
|
|
|
- <!-- 提现页 -->
|
|
|
- <option-withdraw
|
|
|
- :amountValue="canWithdrawBalance"
|
|
|
- v-if="isLogin && !homeVisibility && withdrawVisibility"
|
|
|
- @back="withdrawBack"
|
|
|
- />
|
|
|
+ <option-login v-if="!isLogin" @loginAction="loginAction" />
|
|
|
+ <template v-if="isLogin && !homeVisibility">
|
|
|
+ <!-- 交易列表 -->
|
|
|
+ <option-transactions
|
|
|
+ v-if="transactionsVisibility"
|
|
|
+ @back="transactionsBack"
|
|
|
+ />
|
|
|
+ <!-- 提现页 -->
|
|
|
+ <option-withdraw
|
|
|
+ :amountValue="canWithdrawBalance"
|
|
|
+ :walletWithdrawConfig="walletWithdrawConfig"
|
|
|
+ v-if="withdrawVisibility"
|
|
|
+ @back="withdrawBack"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -225,14 +228,16 @@ import optionLogin from "./components/option-login.vue";
|
|
|
import optionWithdraw from "./components/option-withdraw.vue";
|
|
|
import {
|
|
|
getChromeStorage,
|
|
|
+} from "../uilts/chromeExtension";
|
|
|
+import {
|
|
|
setStorage,
|
|
|
getStorage,
|
|
|
-} from "../uilts/chromeExtension";
|
|
|
-import { getBalance, getMineLuckdropRecords } from "../http/account";
|
|
|
+} from "../uilts/help";
|
|
|
+import { getBalance, getMineLuckdropRecords, getWithdrawConfig } from "../http/account";
|
|
|
var moment = require("moment");
|
|
|
|
|
|
-let pageWrapper = ref(null);
|
|
|
-let pageGiveList = ref(null);
|
|
|
+let pageWrapperDom = ref(null);
|
|
|
+let pageGiveListDom = ref(null);
|
|
|
|
|
|
let isLogin = ref(false);
|
|
|
let homeVisibility = ref(false);
|
|
@@ -253,6 +258,14 @@ let giveReqParams = {
|
|
|
loadMore: false,
|
|
|
};
|
|
|
|
|
|
+
|
|
|
+let walletWithdrawConfig = ref({
|
|
|
+ withdrawUSDPaypalFee: 0,
|
|
|
+ withdrawUSDPreMinAmount: 100,
|
|
|
+ withdrawUSDSwitch: "",
|
|
|
+ withdrawUSDPaypalFeeDesc: ''
|
|
|
+ });
|
|
|
+
|
|
|
let moreTabList = ref([
|
|
|
{
|
|
|
icon: require("../assets/svg/icon-twitter.svg"),
|
|
@@ -275,21 +288,33 @@ let tabList = ref([
|
|
|
},
|
|
|
]);
|
|
|
|
|
|
-const login = () => {
|
|
|
- callEventPageMethod("POPUP_LOGIN", "", function (response) {
|
|
|
- console.log("res", response);
|
|
|
+onMounted(() => {
|
|
|
+ checkLoginState(() => {
|
|
|
+ if (isLogin.value) {
|
|
|
+ getAccountBalance();
|
|
|
+ getLuckdropRecordsList();
|
|
|
+ queryWithdrawConfig();
|
|
|
+ }
|
|
|
});
|
|
|
-};
|
|
|
+});
|
|
|
|
|
|
-const callEventPageMethod = (method, data, callback) => {
|
|
|
- chrome.runtime.sendMessage(
|
|
|
- { method: method, data: data },
|
|
|
- function (response) {
|
|
|
- if (typeof callback === "function") callback(response);
|
|
|
+/**
|
|
|
+ * 获取提现配置
|
|
|
+ */
|
|
|
+const queryWithdrawConfig = () => {
|
|
|
+ getWithdrawConfig({
|
|
|
+ params: {},
|
|
|
+ }).then((res) => {
|
|
|
+ console.log(res);
|
|
|
+ if (res.code == 0) {
|
|
|
+ walletWithdrawConfig.value = res.data;
|
|
|
}
|
|
|
- );
|
|
|
+ });
|
|
|
};
|
|
|
|
|
|
+/**
|
|
|
+ * 获取账户余额
|
|
|
+ */
|
|
|
const getAccountBalance = () => {
|
|
|
getBalance({
|
|
|
params: {
|
|
@@ -304,6 +329,50 @@ const getAccountBalance = () => {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
+const getUserInfo = (cb) => {
|
|
|
+ getChromeStorage("userInfo", (res) => {
|
|
|
+ cb && cb(res);
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+/**
|
|
|
+ * 检查登录状态
|
|
|
+ */
|
|
|
+const checkLoginState = (cb) => {
|
|
|
+ getUserInfo((res) => {
|
|
|
+ if (res && res.accessToken) {
|
|
|
+ userInfo.value = res;
|
|
|
+ setStorage("de-userInfo", res);
|
|
|
+ isLogin.value = true;
|
|
|
+ homeVisibility.value = true;
|
|
|
+ } else {
|
|
|
+ userInfo.value = {};
|
|
|
+ isLogin.value = false;
|
|
|
+ }
|
|
|
+ cb && cb();
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+const pageScroll = (e) => {
|
|
|
+ let wrapperHeight = pageWrapperDom.value.offsetHeight;
|
|
|
+ let pageGiveListHeight = pageGiveListDom.value.offsetHeight;
|
|
|
+ let scrollTop = e.target.scrollTop || 0;
|
|
|
+ if (currentTabIndex.value != 0) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (
|
|
|
+ giveReqParams.loadMore === false &&
|
|
|
+ wrapperHeight + scrollTop >= pageGiveListHeight
|
|
|
+ ) {
|
|
|
+ giveReqParams.loadMore = true;
|
|
|
+ giveReqParams.params.pageNum++;
|
|
|
+ getLuckdropRecordsList();
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+/**
|
|
|
+ * 获取红包列表
|
|
|
+ */
|
|
|
const getLuckdropRecordsList = () => {
|
|
|
getMineLuckdropRecords({
|
|
|
params: giveReqParams.params,
|
|
@@ -321,7 +390,18 @@ const getLuckdropRecordsList = () => {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
+const clickTab = (params, index) => {
|
|
|
+ currentTabIndex.value = index;
|
|
|
+ console.log(params, index);
|
|
|
+};
|
|
|
+
|
|
|
+/**
|
|
|
+ * 点击列表跳转到推文
|
|
|
+ */
|
|
|
const clickListItem = (params, index) => {
|
|
|
+ if(!params.srcContentId) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
let url = "";
|
|
|
let twitterUrl = "https://twitter.com/";
|
|
|
let nickName = "";
|
|
@@ -335,63 +415,12 @@ const clickListItem = (params, index) => {
|
|
|
chrome.tabs.create({
|
|
|
url,
|
|
|
});
|
|
|
- console.log(url);
|
|
|
};
|
|
|
|
|
|
-const pageScroll = (e) => {
|
|
|
- let wrapperHeight = pageWrapper.value.offsetHeight;
|
|
|
- let pageGiveListHeight = pageGiveList.value.offsetHeight;
|
|
|
- let scrollTop = e.target.scrollTop || 0;
|
|
|
- if (currentTabIndex.value != 0) {
|
|
|
- return;
|
|
|
- }
|
|
|
- if (
|
|
|
- giveReqParams.loadMore === false &&
|
|
|
- wrapperHeight + scrollTop >= pageGiveListHeight
|
|
|
- ) {
|
|
|
- giveReqParams.loadMore = true;
|
|
|
- giveReqParams.params.pageNum++;
|
|
|
- getLuckdropRecordsList();
|
|
|
- }
|
|
|
-};
|
|
|
-
|
|
|
-const getUserInfo = (cb) => {
|
|
|
- getChromeStorage("userInfo", (res) => {
|
|
|
- cb && cb(res);
|
|
|
- });
|
|
|
-};
|
|
|
-
|
|
|
-const checkLoginState = (cb) => {
|
|
|
- let res = getStorage("de-userInfo");
|
|
|
- getUserInfo((res) => {
|
|
|
- if (res && res.accessToken) {
|
|
|
- userInfo.value = res;
|
|
|
- setStorage("de-userInfo", res);
|
|
|
- isLogin.value = true;
|
|
|
- homeVisibility.value = true;
|
|
|
- } else {
|
|
|
- userInfo.value = {};
|
|
|
- isLogin.value = false;
|
|
|
- }
|
|
|
- cb && cb();
|
|
|
- });
|
|
|
-};
|
|
|
-
|
|
|
-onMounted(() => {
|
|
|
- checkLoginState(() => {
|
|
|
- if (isLogin.value) {
|
|
|
- getAccountBalance();
|
|
|
- getLuckdropRecordsList();
|
|
|
- }
|
|
|
- });
|
|
|
-});
|
|
|
-
|
|
|
-const clickTab = (params, index) => {
|
|
|
- currentTabIndex.value = index;
|
|
|
- console.log(params, index);
|
|
|
-};
|
|
|
-
|
|
|
-const onShowHome = () => {
|
|
|
+/**
|
|
|
+ * 交易列表返回
|
|
|
+ */
|
|
|
+const transactionsBack = () => {
|
|
|
if (!homeVisibility.value) {
|
|
|
if (transactionsVisibility.value) {
|
|
|
transactionsVisibility.value = false;
|
|
@@ -400,6 +429,9 @@ const onShowHome = () => {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+/**
|
|
|
+ * 提现返回
|
|
|
+ */
|
|
|
const withdrawBack = () => {
|
|
|
if (!homeVisibility.value) {
|
|
|
if (withdrawVisibility.value) {
|
|
@@ -411,12 +443,6 @@ const withdrawBack = () => {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-const loginSuccess = () => {
|
|
|
- login()
|
|
|
- // isLogin.value = true;
|
|
|
- // onShowHome();
|
|
|
-};
|
|
|
-
|
|
|
const showTransactions = () => {
|
|
|
homeVisibility.value = false;
|
|
|
transactionsVisibility.value = true;
|
|
@@ -427,6 +453,31 @@ const clickWithdraw = () => {
|
|
|
withdrawVisibility.value = true;
|
|
|
};
|
|
|
|
|
|
+const loginAction = () => {
|
|
|
+ login();
|
|
|
+};
|
|
|
+
|
|
|
+const login = () => {
|
|
|
+ callEventPageMethod("POPUP_LOGIN", "", function (response) {
|
|
|
+ console.log("res", response);
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+/**
|
|
|
+ * sendMessage
|
|
|
+ */
|
|
|
+const callEventPageMethod = (method, data, callback) => {
|
|
|
+ chrome.runtime.sendMessage(
|
|
|
+ { method: method, data: data },
|
|
|
+ function (response) {
|
|
|
+ if (typeof callback === "function") callback(response);
|
|
|
+ }
|
|
|
+ );
|
|
|
+};
|
|
|
+
|
|
|
+/**
|
|
|
+ * 点击发送,去发推
|
|
|
+ */
|
|
|
const sendTwitter = (params) => {
|
|
|
callEventPageMethod(
|
|
|
"POPUP_PUBLISH_TWITTER_RED_PACK",
|