Commit 2cc2b8f4 authored by Edwise's avatar Edwise 🍷

111

parent 0b78ea6b
......@@ -30,8 +30,8 @@ Component({
},
didMount(){
const {unLockStep,warms}= this.props.gameOverData;
let str = unLockStep==2?'恭喜您解锁5系赛段,获得30温暖值':'恭喜您解锁7系赛段,,获得50温暖值';
let str1 = unLockStep==2?'进入三人场':'进入四人场';
let str = unLockStep==2?'恭喜您解锁5系赛段':'恭喜您解锁7系赛段';
let str1 = unLockStep==2?'进入三人场,获得30温暖值':'进入四人场,获得50温暖值';
this.setData({
unLockStep:unLockStep,
title1:str,
......
'use strict';
import API from "/api";
import { SHARE_CONFIG } from '/tbcc-sdk/lib/constants';
import {
SHARE_CONFIG
} from '/tbcc-sdk/lib/constants';
const app = getApp();
const { tbcc } = app;
const { commonToast, navigateToOutside, getUserAddress, setClipboard } = tbcc.tb;
const { PRIZE_TYPE_MAP, PRIZE_DRAW_STATUS_MAP } = tbcc.constants;
const {
tbcc
} = app;
const {
commonToast,
navigateToOutside,
getUserAddress,
setClipboard
} = tbcc.tb;
const {
PRIZE_TYPE_MAP,
PRIZE_DRAW_STATUS_MAP
} = tbcc.constants;
let flag = false;
......@@ -13,7 +25,7 @@ Page({
PRIZE_TYPE_MAP,
PRIZE_DRAW_STATUS_MAP,
myPrizeList: null, //我的奖品
endTime: null,//到期时间
endTime: null, //到期时间
task: {
image: {
bg: '//yun.duiba.com.cn/spark/assets/myprizeBg.1f636c459b0a7e272f3cc65c80c7bc2a88bc2833.jpg', //背景图
......@@ -56,9 +68,9 @@ Page({
const t1 = `${yy}${mm}${dd}日`;
// console.log(new Date(endTime).toLocaleDateString())
// const t1 = new Date(endTime).toLocaleDateString() + '';//获取年月日
const t2 = new Date(endTime).getHours() + '';//获取时
const t3 = new Date(endTime).getMinutes() + '';//获取分
const t4 = new Date(endTime).getMilliseconds() + '';//获取秒
const t2 = new Date(endTime).getHours() + ''; //获取时
const t3 = new Date(endTime).getMinutes() + ''; //获取分
const t4 = new Date(endTime).getMilliseconds() + ''; //获取秒
console.log(endTime, new Date(endTime + 48 * 60 * 60 * 1000).toLocaleString(), 'endTime');
this.setData({
endTime: t1 + "" + t2.padStart(2, '0') + ":" + t3.padStart(2, '0') + ":" + t4.padStart(2, '0')
......@@ -70,11 +82,19 @@ Page({
* @param {string} type 是否展示loading
*/
async getMyPrize(type) {
const { activityId } = app;
const {
activityId
} = app;
if (type != 'noLoading') {
my.showLoading();
}
const { success, data, message } = await API.getMyPrizeList({ activityId }).catch(res => {
const {
success,
data,
message
} = await API.getMyPrizeList({
activityId
}).catch(res => {
this.setData({
myPrizeList: []
})
......@@ -92,8 +112,10 @@ Page({
//领取奖品
async handleClick(e) {
console.log("领取奖品",e)
const { item } = e.target.dataset;
console.log("领取奖品", e)
const {
item
} = e.target.dataset;
// 领取权益
if (item.type === PRIZE_TYPE_MAP.EQUITY) return this.handleGetEquity(e)
// 领取实物
......@@ -107,10 +129,20 @@ Page({
return
}
flag = true;
const { activityId } = app;
const { item } = e.target.dataset;
const {
activityId
} = app;
const {
item
} = e.target.dataset;
console.log(item, '领取权益')
const { success, data, message } = await API.receiveEnamePrize({ _id: item._id }).catch(res => {
const {
success,
data,
message
} = await API.receiveEnamePrize({
id: item._id
}).catch(res => {
this.getMyPrize('noLoading')
commonToast(res && res.message)
}) || {};
......@@ -129,31 +161,46 @@ Page({
}
// my.showLoading();
flag = true;
setTimeout(()=>{
setTimeout(() => {
flag = false
},500)
}, 500)
console.log('领取实物')
const { activityId } = app;
const { item } = e.target.dataset;
const userAddress = await getUserAddress({ joinTag: " " }).catch((data)=>{
const {
activityId
} = app;
const {
item
} = e.target.dataset;
const userAddress = await getUserAddress({
joinTag: " "
}).catch((data) => {
flag = false
console.log('getUserAddress出错了,错误信息是',data);
console.log('getUserAddress出错了,错误信息是', data);
})
// my.hideLoading();
if (!userAddress) return
// commonToast(' getUserAddress =>'+JSON.stringify( userAddress))
const { name, telNumber, provinceName, cityName, cityCode, countyName, detailInfo, streetName } = userAddress || {};
const {
name,
telNumber,
provinceName,
cityName,
cityCode,
countyName,
detailInfo,
streetName
} = userAddress || {};
const params = {
activityId,
area:countyName,
addressDetail:detailInfo,
area: countyName,
addressDetail: detailInfo,
name,
phone: telNumber,
detailInfo,
cityCode,
cityName,
city:cityName,
province:provinceName,
city: cityName,
province: provinceName,
provinceName,
countyName,
streetName,
......@@ -167,7 +214,9 @@ Page({
cancelButtonText: '取消',
success: (result) => {
console.log(result)
const { confirm } = result;
const {
confirm
} = result;
if (confirm) {
this.receiveObjectPrize(params);
......@@ -184,14 +233,18 @@ Page({
// commonToast(JSON.stringify(res))
// }, 5000);
const { success, data, message } = res;
const {
success,
data,
message
} = res;
if (success && data) {
commonToast('领取成功')
} else {
commonToast(message)
}
this.getMyPrize()
},(rej)=>{
}, (rej) => {
commonToast(rej.message)
});
},
......@@ -204,7 +257,10 @@ Page({
console.log(item, '领取积分')
// 判断是否为会员
await this.getUserInfo()
const { isVip, vipLink } = app;
const {
isVip,
vipLink
} = app;
if (!isVip) {
commonToast('立即加入会员,即可领取奖品', 2000);
setTimeout(() => {
......@@ -213,10 +269,20 @@ Page({
flag = false
return
}
const { activityId } = app;
const { item } = e.target.dataset;
const {
activityId
} = app;
const {
item
} = e.target.dataset;
console.log(item, '领取积分')
const { success, data, message } = await API.receiveEnamePrize({ activityId, _id: item._id }) || {};
const {
success,
data,
message
} = await API.receiveEnamePrize({
id: item._id
}) || {};
if (success && data) {
commonToast('领取成功')
} else {
......@@ -228,8 +294,16 @@ Page({
//获取用户vip信息
async getUserInfo() {
const { activityId } = app;
const { success, data, message } = await API.getVipInfo({ activityId }) || {};
const {
activityId
} = app;
const {
success,
data,
message
} = await API.getVipInfo({
activityId
}) || {};
console.log(data, '用户vip信息');
if (success && data) {
app.isVip = (data && data.isVip) || false;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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