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,20 +28,23 @@ 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();
let currentTime = new Date().getTime();
if (currentTime < startTime) {
commonToast('活动未开始');
return;
};
commonToast('活动未开始');
return;
};
API.getVipInfo().then(res => {
if (!res.data.isVip) {
commonToast('立即加入会员,即可开始盖楼')
......@@ -90,28 +94,28 @@ Page({
console.log('fuck');
let currentTime = new Date().getTime();
if (vipInfo.data.isVip && isUserJoin) {
// vipInfo..data.isVip = true;
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({ prize, openPrizeStatus, isShowPrize }) });
} else {
my.redirectTo({ url: '/pages/pagehuo_dong_ye/pagehuo_dong_ye' });
// my.redirectTo({ url: '/pages/pagehuo_dong_ye/pagehuo_dong_ye?data=' + JSON.stringify({endTime}) });
}
if (vipInfo.data.isVip && isUserJoin) {
// vipInfo..data.isVip = true;
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({ prize, openPrizeStatus, isShowPrize }) });
} 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 }) });
} else {
//设置状态
this.setData({
myPrizeBtnVisible: true,
startBtnVisible: true,
ruleModalBtnVisible: true
})
}
};
my.redirectTo({ url: '/pages/pagehuo_dong_ye/pagehuo_dong_ye' });
// my.redirectTo({ url: '/pages/pagehuo_dong_ye/pagehuo_dong_ye?data=' + JSON.stringify({endTime}) });
}
} 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 }) });
} else {
//设置状态
this.setData({
myPrizeBtnVisible: true,
startBtnVisible: true,
ruleModalBtnVisible: true
})
}
};
this.setData({
ruleData: rule,
......@@ -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