Commit 755ccdf1 authored by 汪欢's avatar 汪欢
parents 678de40c f42cbb5c
......@@ -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,
......
......@@ -12,6 +12,7 @@ Page({
},
onLoad(props) {
console.log('fuck',JSON.parse(props.prize))
this.setData({
resList: resList
});
......
......@@ -4,7 +4,7 @@
<image class="tu" src={{resList['41567d28-d1c4-454f-8bb4-4bcb6a103be0'].url}} />
<image a:if="{{startBtnVisible}}" class="an_niu" onTap="handleStart" src={{resList['9720b3cc-2faa-4bac-8244-d5f0d018a6e7'].url}} />
<image class="wen_an" src={{resList['2a026ac4-0a9c-497b-9469-2da99f935821'].url}} />
<image a:if="{{myPrizeBtnVisible}}" class="jiang_pinicon" src={{resList['b7517eae-3bc2-4456-935a-e6e3e1fe995e'].url}} />
<image onTap="onPrizeBtnClick" a:if="{{myPrizeBtnVisible}}" class="jiang_pinicon" src={{resList['b7517eae-3bc2-4456-935a-e6e3e1fe995e'].url}} />
<image a:if="{{ruleModalBtnVisible}}" class="gui_zeicon" onTap="showRuleModal" src={{resList['d826a2f1-a3ec-4764-aad2-f6cacc43cfce'].url}} />
</view>
......
......@@ -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;
......@@ -31,9 +33,6 @@ Page({
},
handleStart() {
// API.submit({ grade: 1, floor: 10 });
console.log('change')
my.redirectTo({
url: '/pages/pagehuo_dong_ye/pagehuo_dong_ye'
......@@ -44,6 +43,11 @@ Page({
ruleModalVisible: true
})
},
onPrizeBtnClick() {
my.navigateTo({
url: '/pages/myprize/myprize'
});
},
ruleModalClose() {
this.setData({
......@@ -51,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' });
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({
......@@ -65,7 +73,8 @@ Page({
startBtnVisible: true,
ruleModalBtnVisible: true
})
}
};
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 OPEN_PRIZE_STATUS = {
// 待开奖
WAIT_AWARD: 1,
// 开奖中
PROCESSING: 2,
// 开奖成功
SUCCESS: 3,
// 开奖失败
FAIL: 4,
// 不开奖
NOT_OPEN: 5
}
export default OPEN_PRIZE_STATUS
\ No newline at end of file
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