Commit b3cfab8b authored by wildfirecode13's avatar wildfirecode13

1

parent 0bc61209
No preview for this file type
...@@ -4,6 +4,7 @@ import resList from '../../resconfig/resList'; //import API from '../../api'; ...@@ -4,6 +4,7 @@ import resList from '../../resconfig/resList'; //import API from '../../api';
import API from '../../api'; import API from '../../api';
import isEnd from '/utils/isEnd'; import isEnd from '/utils/isEnd';
import OPEN_PRIZE_STATUS from '/utils/OPEN_PRIZE_STATUS'; import OPEN_PRIZE_STATUS from '/utils/OPEN_PRIZE_STATUS';
let isAuth = 0;
const app = getApp(); const app = getApp();
const { tbcc } = app; const { tbcc } = app;
const { commonToast, getAuthUserInfo, navigateToOutside } = tbcc.tb; const { commonToast, getAuthUserInfo, navigateToOutside } = tbcc.tb;
...@@ -27,10 +28,13 @@ Page({ ...@@ -27,10 +28,13 @@ Page({
// 页面加载 // 页面加载
this.getAuth(); this.getAuth();
console.info(`Page onLoad with query: ${JSON.stringify(query)}`); console.info(`Page onLoad with query: ${JSON.stringify(query)}`);
}, },
gotoVipPage() { gotoVipPage() {
console.log('isAuth', isAuth);
if (isAuth === 0) {
this.getAuth();
return;
}
let { endTime, startTime } = this.data; let { endTime, startTime } = this.data;
// 判断活动时间 // 判断活动时间
let currentTime = new Date().getTime(); let currentTime = new Date().getTime();
...@@ -101,8 +105,8 @@ Page({ ...@@ -101,8 +105,8 @@ Page({
} }
} else { } else {
if (isEnd(endTime) && if (isEnd(endTime) &&
(openPrizeStatus == OPEN_PRIZE_STATUS.SUCCESS || openPrizeStatus == OPEN_PRIZE_STATUS.NOT_OPEN) ) {//活动结束,开奖成功or不开奖 (openPrizeStatus == OPEN_PRIZE_STATUS.SUCCESS || openPrizeStatus == OPEN_PRIZE_STATUS.NOT_OPEN)) {//活动结束,开奖成功or不开奖
my.redirectTo({ url: '/pages/pagejie_shu_ye/pagejie_shu_ye?data=' + JSON.stringify({ isShowPrize:false }) }); my.redirectTo({ url: '/pages/pagejie_shu_ye/pagejie_shu_ye?data=' + JSON.stringify({ isShowPrize: false }) });
} else { } else {
//设置状态 //设置状态
this.setData({ this.setData({
...@@ -140,13 +144,20 @@ Page({ ...@@ -140,13 +144,20 @@ Page({
async getAuth() { async getAuth() {
const userInfo = await getAuthUserInfo().catch(err => { const userInfo = await getAuthUserInfo().catch(err => {
console.log('未授权成功', err); console.log('未授权成功', err);
this.setData({
startBtnVisible: true,
})
}); });
if (userInfo) { if (userInfo) {
isAuth = true;
console.log('授权成功,userInfo=>', userInfo); console.log('授权成功,userInfo=>', userInfo);
const { nickName, avatar } = userInfo; const { nickName, avatar } = userInfo;
app.nickName = nickName; app.nickName = nickName;
app.avatar = avatar; app.avatar = avatar;
this.login(); this.login();
this.setData({
startBtnVisible: false,
})
} }
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment