Commit f42cbb5c authored by wildfirecode13's avatar wildfirecode13

1

parent 5805a483
......@@ -6,8 +6,8 @@ cloud.init({
});
App({
// requestType: 'yapi', // yapi,cloud: 云函数
requestType: 'cloud', // yapi,cloud: 云函数
requestType: 'yapi', // yapi,cloud: 云函数
cloudName: 'floor', // 主云函数项目名 base clientTemplate2C
cloud,
tbcc,
......
......@@ -6,6 +6,7 @@ Page({
data: {},
onLoad(props) {
console.log('fuck',JSON.parse(props.prize))
this.setData({
resList: resList
});
......
......@@ -2,6 +2,8 @@
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';
const app = getApp();
const { tbcc } = app;
const { commonToast, getAuthUserInfo, navigateToOutside } = tbcc.tb;
......@@ -53,13 +55,17 @@ Page({
})
},
async init() {
const [activity, vipInfo] = await Promise.all([
const [{ data: { isUserJoin, endTime, openPrizeStatus,prize } }, vipInfo] = await Promise.all([
API.getActivityBaseInfoById(),
API.getVipInfo(),
]);
// vipInfo.isVip = true;
if (vipInfo.isVip && activity.data.isUserJoin) {
my.redirectTo({ url: '/pages/pagehuo_dong_ye/pagehuo_dong_ye' });
vipInfo.isVip = true;
if (vipInfo.isVip && isUserJoin) {
if (isEnd(endTime) && openPrizeStatus == OPEN_PRIZE_STATUS.SUCCESS) {//活动结束,开奖成功
my.redirectTo({ url: '/pages/pagejie_shu_ye/pagejie_shu_ye?prize='+JSON.stringify(prize) });
} else {
my.redirectTo({ url: '/pages/pagehuo_dong_ye/pagehuo_dong_ye' });
}
} else {
//设置状态
this.setData({
......@@ -68,7 +74,7 @@ Page({
ruleModalBtnVisible: true
})
};
API.getFloorPrize
API.getFloorPrize();
},
/**
* 登录接口
......
......@@ -68,7 +68,7 @@ const request = ({ cloud, cloudName, requestType = 'cloud' }) => {
dataType: 'json'
}).then(({ data: res }) => {
hideMyLoading();
console.log('mock res=>', JSON.stringify(res))
console.log(`mock res,${url}=>`, res)
if (res && res.success) {
resolve(res);
} else {
......
const isEnd = (endTime)=>{
const now = Date.now();
return now > endTime
}
export default isEnd
\ No newline at end of file
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