Commit 755ccdf1 authored by 汪欢's avatar 汪欢
parents 678de40c f42cbb5c
...@@ -6,8 +6,8 @@ cloud.init({ ...@@ -6,8 +6,8 @@ cloud.init({
}); });
App({ App({
// requestType: 'yapi', // yapi,cloud: 云函数
requestType: 'cloud', // yapi,cloud: 云函数 requestType: 'cloud', // yapi,cloud: 云函数
requestType: 'yapi', // yapi,cloud: 云函数
cloudName: 'floor', // 主云函数项目名 base clientTemplate2C cloudName: 'floor', // 主云函数项目名 base clientTemplate2C
cloud, cloud,
tbcc, tbcc,
......
...@@ -12,6 +12,7 @@ Page({ ...@@ -12,6 +12,7 @@ Page({
}, },
onLoad(props) { onLoad(props) {
console.log('fuck',JSON.parse(props.prize))
this.setData({ this.setData({
resList: resList resList: resList
}); });
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<image class="tu" src={{resList['41567d28-d1c4-454f-8bb4-4bcb6a103be0'].url}} /> <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 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 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}} /> <image a:if="{{ruleModalBtnVisible}}" class="gui_zeicon" onTap="showRuleModal" src={{resList['d826a2f1-a3ec-4764-aad2-f6cacc43cfce'].url}} />
</view> </view>
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
import resList from '../../resconfig/resList'; //import API from '../../api'; import resList from '../../resconfig/resList'; //import API from '../../api';
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 app = getApp();
const { tbcc } = app; const { tbcc } = app;
const { commonToast, getAuthUserInfo, navigateToOutside } = tbcc.tb; const { commonToast, getAuthUserInfo, navigateToOutside } = tbcc.tb;
...@@ -31,9 +33,6 @@ Page({ ...@@ -31,9 +33,6 @@ Page({
}, },
handleStart() { handleStart() {
// API.submit({ grade: 1, floor: 10 });
console.log('change') console.log('change')
my.redirectTo({ my.redirectTo({
url: '/pages/pagehuo_dong_ye/pagehuo_dong_ye' url: '/pages/pagehuo_dong_ye/pagehuo_dong_ye'
...@@ -44,6 +43,11 @@ Page({ ...@@ -44,6 +43,11 @@ Page({
ruleModalVisible: true ruleModalVisible: true
}) })
}, },
onPrizeBtnClick() {
my.navigateTo({
url: '/pages/myprize/myprize'
});
},
ruleModalClose() { ruleModalClose() {
this.setData({ this.setData({
...@@ -51,13 +55,17 @@ Page({ ...@@ -51,13 +55,17 @@ Page({
}) })
}, },
async init() { async init() {
const [activity, vipInfo] = await Promise.all([ const [{ data: { isUserJoin, endTime, openPrizeStatus,prize } }, vipInfo] = await Promise.all([
API.getActivityBaseInfoById(), API.getActivityBaseInfoById(),
API.getVipInfo(), API.getVipInfo(),
]); ]);
vipInfo.isVip = true; vipInfo.isVip = true;
if (vipInfo.isVip && activity.data.isUserJoin) { if (vipInfo.isVip && isUserJoin) {
my.redirectTo({ url: '/pages/pagehuo_dong_ye/pagehuo_dong_ye' }); 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 { } else {
//设置状态 //设置状态
this.setData({ this.setData({
...@@ -65,7 +73,8 @@ Page({ ...@@ -65,7 +73,8 @@ Page({
startBtnVisible: true, startBtnVisible: true,
ruleModalBtnVisible: true ruleModalBtnVisible: true
}) })
} };
API.getFloorPrize();
}, },
/** /**
* 登录接口 * 登录接口
......
...@@ -68,7 +68,7 @@ const request = ({ cloud, cloudName, requestType = 'cloud' }) => { ...@@ -68,7 +68,7 @@ const request = ({ cloud, cloudName, requestType = 'cloud' }) => {
dataType: 'json' dataType: 'json'
}).then(({ data: res }) => { }).then(({ data: res }) => {
hideMyLoading(); hideMyLoading();
console.log('mock res=>', JSON.stringify(res)) console.log(`mock res,${url}=>`, res)
if (res && res.success) { if (res && res.success) {
resolve(res); resolve(res);
} else { } 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