|
@@ -183,6 +183,10 @@
|
|
|
{{ data.error_txt }}
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <!-- loading -->
|
|
|
+ <div v-show="data.loading_show" class="loading">
|
|
|
+ <img :src="require('../assets/svg/icon-loading.svg')" alt />
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -201,6 +205,7 @@ var moment = require('moment');
|
|
|
|
|
|
let data = reactive({
|
|
|
status: '',
|
|
|
+ loading_show: false,
|
|
|
detail: {},
|
|
|
luck_list_end: false,
|
|
|
page_index: 1,
|
|
@@ -217,7 +222,11 @@ let data = reactive({
|
|
|
retweet: false
|
|
|
}
|
|
|
})
|
|
|
-function clickLickBtn() {
|
|
|
+async function clickLickBtn() {
|
|
|
+ let _userInfo = await checkIsLogin()
|
|
|
+ if (!_userInfo) {
|
|
|
+ return
|
|
|
+ }
|
|
|
data.done.like = true
|
|
|
// 跳转到推文详情
|
|
|
oneKeyLike({
|
|
@@ -268,7 +277,12 @@ function handleScroll(e) {
|
|
|
}
|
|
|
|
|
|
|
|
|
-function clickRetweetBtn() {
|
|
|
+async function clickRetweetBtn() {
|
|
|
+ let _userInfo = await checkIsLogin()
|
|
|
+ if (!_userInfo) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
data.done.retweet = true
|
|
|
oneKeyReTweet({
|
|
|
params: {
|
|
@@ -290,17 +304,25 @@ function clickRetweetBtn() {
|
|
|
|
|
|
|
|
|
function getValidity() {
|
|
|
+ let _d1,_d2
|
|
|
let timer = setInterval(() => {
|
|
|
let _time = new Date().getTime()
|
|
|
if (data.detail.endTimestamp - _time > 0) {
|
|
|
- data.detail.validity = moment(data.detail.endTimestamp - _time).format('HH:mm:ss')
|
|
|
+ _d1= moment(data.detail.endTimestamp)
|
|
|
+ _d2 = moment(_time)
|
|
|
+ data.detail.validity = moment(_d1.diff(_d2)).format('HH:mm:ss')
|
|
|
} else {
|
|
|
clearInterval(timer)
|
|
|
}
|
|
|
}, 1000)
|
|
|
}
|
|
|
|
|
|
-function clickFollowAll(item) {
|
|
|
+async function clickFollowAll(item) {
|
|
|
+ let _userInfo = await checkIsLogin()
|
|
|
+ if (!_userInfo) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
let arr_name = []
|
|
|
for (let i in item) {
|
|
|
arr_name.push(item[i].name)
|
|
@@ -359,7 +381,7 @@ function init() {
|
|
|
switch (res.code.toString()) {
|
|
|
case "0":
|
|
|
data.srcContentId = res.data.srcContentId
|
|
|
- if(data.tweetId != data.srcContentId){
|
|
|
+ if (data.tweetId != data.srcContentId) {
|
|
|
data.error_txt = 'Giveways link Error'
|
|
|
data.status = 'error'
|
|
|
return
|
|
@@ -414,7 +436,6 @@ function init() {
|
|
|
data.status = 'close'
|
|
|
}
|
|
|
break
|
|
|
-
|
|
|
}
|
|
|
})
|
|
|
|
|
@@ -448,6 +469,7 @@ onMounted(() => {
|
|
|
data.postId = getQueryString('postId')
|
|
|
data.tweetId = getQueryString('tweetId')
|
|
|
init()
|
|
|
+ // data.loading_show = true
|
|
|
})
|
|
|
|
|
|
// 点击领取
|
|
@@ -496,24 +518,41 @@ function handleRedPacket() {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+chrome.storage.onChanged.addListener(changes => {
|
|
|
+ if (changes.userInfo) {
|
|
|
+ // let item = JSON.parse(changes.userInfo.newValue)
|
|
|
+ data.loading_show = false
|
|
|
+ }
|
|
|
+})
|
|
|
|
|
|
-function clickGetGiveways() {
|
|
|
- //
|
|
|
- getChromeStorage('userInfo', (res) => {
|
|
|
- //
|
|
|
- if (!res) {
|
|
|
- chrome.runtime.sendMessage(
|
|
|
- { method: "POPUP_LOGIN", data: "" },
|
|
|
- (response) => {
|
|
|
- console.log("res", response);
|
|
|
- }
|
|
|
- );
|
|
|
- } else {
|
|
|
- handleFinishRedPacket()
|
|
|
- }
|
|
|
+// 校验是否封路
|
|
|
+function checkIsLogin() {
|
|
|
+
|
|
|
+ return new Promise((resolve) => {
|
|
|
+ getChromeStorage('userInfo', (_userInfo) => {
|
|
|
+ if (!_userInfo) {
|
|
|
+ data.loading_show = true
|
|
|
+ chrome.runtime.sendMessage(
|
|
|
+ { method: "POPUP_LOGIN", data: "" },
|
|
|
+ (response) => {
|
|
|
+ console.log("res", response);
|
|
|
+ }
|
|
|
+ )
|
|
|
+ resolve(_userInfo)
|
|
|
+ }else{
|
|
|
+ resolve(_userInfo)
|
|
|
+ }
|
|
|
+ })
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+async function clickGetGiveways() {
|
|
|
+ let _userInfo = await checkIsLogin()
|
|
|
+ if (_userInfo) {
|
|
|
+ handleFinishRedPacket()
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
function handleFinishRedPacket() {
|
|
|
finishRedPacket({
|
|
|
params: {
|
|
@@ -590,6 +629,24 @@ body {
|
|
|
font-family: "SF Pro Display";
|
|
|
font-style: normal;
|
|
|
|
|
|
+ .loading {
|
|
|
+ background: #FFFFFF;
|
|
|
+ opacity: 0.8;
|
|
|
+ z-index: 222;
|
|
|
+ text-align: center;
|
|
|
+ width: 375px;
|
|
|
+ height: 500px;
|
|
|
+ position: fixed;
|
|
|
+ top: 0;
|
|
|
+ left: 0;
|
|
|
+
|
|
|
+ img {
|
|
|
+ margin-top: 216px;
|
|
|
+ width: 70px;
|
|
|
+ height: 70px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
.error {
|
|
|
text-align: center;
|
|
|
|