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';
import API from '../../api';
import isEnd from '/utils/isEnd';
import OPEN_PRIZE_STATUS from '/utils/OPEN_PRIZE_STATUS';
let isAuth = 0;
const app = getApp();
const { tbcc } = app;
const { commonToast, getAuthUserInfo, navigateToOutside } = tbcc.tb;
......@@ -27,10 +28,13 @@ Page({
// 页面加载
this.getAuth();
console.info(`Page onLoad with query: ${JSON.stringify(query)}`);
},
gotoVipPage() {
console.log('isAuth', isAuth);
if (isAuth === 0) {
this.getAuth();
return;
}
let { endTime, startTime } = this.data;
// 判断活动时间
let currentTime = new Date().getTime();
......@@ -101,8 +105,8 @@ Page({
}
} else {
if (isEnd(endTime) &&
(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 }) });
(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 }) });
} else {
//设置状态
this.setData({
......@@ -140,13 +144,20 @@ Page({
async getAuth() {
const userInfo = await getAuthUserInfo().catch(err => {
console.log('未授权成功', err);
this.setData({
startBtnVisible: true,
})
});
if (userInfo) {
isAuth = true;
console.log('授权成功,userInfo=>', userInfo);
const { nickName, avatar } = userInfo;
app.nickName = nickName;
app.avatar = avatar;
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