Commit 8513b008 authored by wildfirecode13's avatar wildfirecode13

Merge branch 'master' of gitlab2.dui88.com:wanghongyuan/hello_taobao

parents dba6adba ba0dc3df
......@@ -7,7 +7,7 @@ cloud.init({
App({
requestType: 'cloud', // yapi,cloud: 云函数
requestType: 'yapi', // yapi,cloud: 云函数
// requestType: 'yapi', // yapi,cloud: 云函数
cloudName: 'floor', // 主云函数项目名 base clientTemplate2C
cloud,
tbcc,
......@@ -27,4 +27,5 @@ App({
// this.activityId = activityId || '5f505873738989c8b356e284';
this.activityId = activityId || '5f5759b2114fbb8f6d91245c';//商家创建的测试环境活
}
});
<view class="gong_xi_huo_jiang">
<image class="cha_cha000" src={{resList['b8bc26de-51ac-457f-bd3f-348e7df0af34'].url}} />
<image class="cha_cha000" onTap="handleClose" src={{resList['b8bc26de-51ac-457f-bd3f-348e7df0af34'].url}} />
<image class="zu139394" src={{resList['b0315ae3-2e86-4260-ae04-8e2cb2c70b99'].url}} />
<image class="zu8" src={{resList['44e9bb99-836b-4612-afd1-c2eb400d0eca'].url}} />
<label class="mai_dao_zhong_jiang_lou_ceng_huo_de_yi_xia_jiang_pin">买到中奖楼层 获得以下奖品</label>
<label class="ke_yi_zai_wo_de_jiang_pin_ye_mian_cha_kan_jiang_pin">可以在「我的奖品」页面查看奖品</label>
<image class="ju_xing88726" src={{resList['d9283186-3e0a-4875-bd28-e296e22d1139'].url}} />
<image class="an_niu_kao_bei3" src={{resList['38aa87d7-c85e-497c-85a2-f5a980bc742f'].url}} />
<image class="ju_xing88726" src={{myPrize.image}} />
<image class="an_niu_kao_bei3" onTap="gotoPrizePage" src={{resList['38aa87d7-c85e-497c-85a2-f5a980bc742f'].url}} />
</view>
\ No newline at end of file
......@@ -6,12 +6,32 @@ Component({
data: {
resList: resList
},
methods: {},
methods: {
handleClose() {
const { onPrizeModalClose } = this.props;
onPrizeModalClose && onPrizeModalClose();
},
gotoPrizePage() {
my.navigateTo({
url: '/pages/myprize/myprize',
success: () => {
},
fail: () => {
},
complete: () => {
}
});
}
},
onInit(props) {
// this.setData({
// resList: resList
// });
}
},
});
\ No newline at end of file
<view class="hen_yi_han23">
<image class="cha_cha0" onTap="" src={{resList['b8bc26de-51ac-457f-bd3f-348e7df0af34'].url}} />
<image class="zu142" src={{resList['d473d55e-e93b-4473-ae6f-065e3ba2e853'].url}} />
<image class="zu9" src={{resList['519cfe3c-5920-4f09-906e-53c44890ead3'].url}} />
<image class="ju_xing88724" src={{resList['7ec9f5ea-9e4e-4ba9-bd1d-4ad6a7e03a4e'].url}} />
<image class="wei_man100_ceng" src={{resList['ef34aaa7-7fd4-4d52-9ddc-c78432a86938'].url}} />
<image class="xia_ci_zai_lai" src={{resList['90ff7278-1912-4d62-a34d-1b84cb99bcee'].url}} />
<image class="wei_mai_dao_tu_ceng" src={{resList['79ecfd4f-f4dd-47cd-9f04-fac24d652c94'].url}} />
<view class="zu77127">
<image class="ca_jian_er_guo" src={{resList['bbeaaf95-4954-46ad-b1aa-e8ae55c9e2b1'].url}} />
</view>
<image class="an_niu30" src={{resList['92e51b4c-be5e-4459-8379-6a2bc1f2a3b2'].url}} />
<text a:if="{{openPrizeStatus==OPEN_PRIZE_STATUS.NOT_OPEN}}">不开奖</text>
<text a:if="{{openPrizeStatus!=OPEN_PRIZE_STATUS.NOT_OPEN}}">未中奖</text>
</view>
\ No newline at end of file
<image class="cha_cha0" onTap="handleNoprizeClose" src={{resList['b8bc26de-51ac-457f-bd3f-348e7df0af34'].url}} />
<image class="zu142" src={{resList['d473d55e-e93b-4473-ae6f-065e3ba2e853'].url}} />
<image class="zu9" src={{resList['519cfe3c-5920-4f09-906e-53c44890ead3'].url}} />
<image class="ju_xing88724" src={{resList['7ec9f5ea-9e4e-4ba9-bd1d-4ad6a7e03a4e'].url}} />
<!-- 未满100层 -->
<view a:if="{{openPrizeStatus==OPEN_PRIZE_STATUS.NOT_OPEN}}">
<image class="wei_man100_ceng" src={{resList['ef34aaa7-7fd4-4d52-9ddc-c78432a86938'].url}} />
<image class="xia_ci_zai_lai" src={{resList['90ff7278-1912-4d62-a34d-1b84cb99bcee'].url}} />
</view>
<!-- 未中奖 -->
<view a:if="{{openPrizeStatus!=OPEN_PRIZE_STATUS.NOT_OPEN}}">
<image class="wei_mai_dao_tu_ceng" src={{resList['79ecfd4f-f4dd-47cd-9f04-fac24d652c94'].url}} />
<view class="zu77127">
<image class="ca_jian_er_guo" src={{resList['bbeaaf95-4954-46ad-b1aa-e8ae55c9e2b1'].url}} />
</view>
</view>
<image class="an_niu30" onTap="handleNoprizeClose" src={{resList['92e51b4c-be5e-4459-8379-6a2bc1f2a3b2'].url}} />
<!--<text a:if="{{openPrizeStatus==OPEN_PRIZE_STATUS.NOT_OPEN}}">不开奖</text><text a:if="{{openPrizeStatus!=OPEN_PRIZE_STATUS.NOT_OPEN}}">未中奖</text> -->
</view>
\ No newline at end of file
......@@ -7,7 +7,12 @@ Component({
resList: resList,
OPEN_PRIZE_STATUS:OPEN_PRIZE_STATUS
},
methods: {},
methods: {
handleNoprizeClose(){
let {onHandleNoPrizeClose} = this.props;
onHandleNoPrizeClose && onHandleNoPrizeClose();
}
},
didMount(props) {
......
......@@ -5,6 +5,8 @@ import resList from '../../resconfig/resList';
import API from '../../api';
const { commonToast, getAuthUserInfo, navigateToOutside } = tbcc.tb;
Page({
data: {
title: '',
......@@ -38,8 +40,11 @@ Page({
my.redirectTo({ url: '/pages/pageshou_ye/pageshou_ye' });
}
},
onReady() {
async onReady() {
// 页面加载完成
//取图片链接
const result1 = await getApp().cloud.file.getTempFileURL({ fileId: 'cloud://2291129AC27E68610B8DFDA7F139E34A//D2B4599F-878D-402A-8101-5465AE571FB9.png' });
if (result1[0]) SHARE_CONFIG.imageUrl = result1[0].url
},
onShow() {
// 页面显示
......@@ -172,6 +177,8 @@ Page({
// imageUrl: '', // 分享图片URL
// path: 'pages/index/index'
// };
// my.alert({content:JSON.stringify(SHARE_CONFIG)})
// console.log(SHARE_CONFIG)
return SHARE_CONFIG;
},
});
......@@ -2,6 +2,7 @@
import resList from '../../resconfig/resList';
import API from '../../api';
import { SHARE_CONFIG } from '/tbcc-sdk/lib/constants';
const app = getApp();
const { tbcc } = app;
const { commonToast, getAuthUserInfo, navigateToOutside } = tbcc.tb;
......@@ -43,6 +44,7 @@ Page({
totalFloor: '',
// 单人最多购买楼层
eachBuyMostFloor: '',
userTotalFloor:'',
countDown: '',
ruleModalVisible: false,
......@@ -58,7 +60,7 @@ Page({
// });
this.getBaseInfo();
this.getRuleSource();
// this.getRuleSource();
this.getUserCredits();
this.getOrderList();
......@@ -129,7 +131,7 @@ Page({
async buyFloors() {
// 购买楼层数
let { canBuyFloor, end } = this.data;
let { canBuyFloor, end, userTotalFloor,eachBuyMostFloor } = this.data;
let { data: { isVip, grade, gradeName, gradeCredits } } = await API.getVipInfo() || {};
// 判断会员等级
......@@ -141,6 +143,29 @@ Page({
gradeName
}
})
// 判断活动时间
let currentTime = new Date().getTime();
// 当前时间 < 结束时间 显示弹窗
let reduced = eachBuyMostFloor - userTotalFloor;
if (currentTime < end) {
if(reduced <= 0){
commonToast('已购买的楼层达到最大值');
}
if(canBuyFloor <= reduced){
// 可以买
// 显示
this.setData({
orderNowModalVisible: true
})
} else{
commonToast('当前最多可购买'+ reduced +'层');
}
} else {
commonToast('无法购买')
}
// if(success){
// this.setData({
// vipCredits:{
......@@ -163,17 +188,6 @@ Page({
// })
// })
// 判断活动时间
let currentTime = new Date().getTime();
// 当前时间 < 结束时间 显示弹窗
if (currentTime < end) {
// 显示
this.setData({
orderNowModalVisible: true
})
} else {
commonToast('无法购买')
}
},
......@@ -229,6 +243,8 @@ Page({
let end = data.endTime;
let start = data.startTime;
let eachBuyMostFloor = data.eachBuyMostFloor;
let ruleData = data.rule;
let userTotalFloor = data.userTotalFloor;
for (let i = 0; i < list.length; i++) {
let listStyle = {
......@@ -247,7 +263,9 @@ Page({
start: start,
end: end,
totalFloor,
eachBuyMostFloor
eachBuyMostFloor,
ruleData,
userTotalFloor
})
console.log('zhixingcount');
this.countDowning(end);
......@@ -413,16 +431,28 @@ Page({
},
// 获取规则接口
async getRuleSource() {
API.getActivityBaseInfoById().then((res) => {
if (res.success) {
this.setData({
ruleData: res.data.rule
})
}
})
}
// async getRuleSource() {
// API.getActivityBaseInfoById().then((res) => {
// if (res.success) {
// this.setData({
// ruleData: res.data.rule
// })
// }
// })
// }
onShareAppMessage() {
// 返回自定义分享信息
// export const SHARE_CONFIG = {
// title: '分享测试标题',
// desc: '分享测试描述',
// imageUrl: '', // 分享图片URL
// path: 'pages/index/index'
// };
// my.alert({content:JSON.stringify(SHARE_CONFIG)})
// console.log(SHARE_CONFIG)
return SHARE_CONFIG;
},
});
\ No newline at end of file
......@@ -19,37 +19,6 @@
<view class="zhong_jiang_zhuang_tai">
<!-- 已中奖名单列表 -->
<view class="yi_zhong_jiang">
<!-- <label class="dixxx_ceng68">第XXX层</label>
<label class="dixxx_ceng67">第XXX层</label>
<label class="dixxx_ceng66">第XXX层</label>
<label class="ba_la65">巴***拉</label>
<label class="ba_la64">巴***拉</label>
<label class="ba_la63">巴***拉</label>
<image class="ju_xing728_kao_bei2" src={{resList['05f105eb-e5c5-4f5e-8d6a-fbc0ad0718c4'].url}} />
<image class="ju_xing728_kao_bei" src={{resList['05f105eb-e5c5-4f5e-8d6a-fbc0ad0718c4'].url}} />
<image class="ju_xing728_kao_bei3" src={{resList['05f105eb-e5c5-4f5e-8d6a-fbc0ad0718c4'].url}} />
<label class="tu_ceng62">?</label>
<label class="tu_ceng61">?</label>
<label class="tu_ceng60">?</label>
<image class="jiang_pin59" src={{resList['1a79bcc9-300c-4f4f-b2dd-fc93fd050188'].url}} />
<label class="dixxx_ceng58">第XXX层</label>
<label class="ba_la57">巴***拉</label>
<image class="ju_xing728_kao_bei4" src={{resList['05f105eb-e5c5-4f5e-8d6a-fbc0ad0718c4'].url}} />
<label class="kao_bei">?</label>
<label class="dixxx_ceng_kao_bei">第XXX层</label>
<label class="ba_la_kao_bei">巴***拉</label>
<image class="ju_xing728_kao_bei5" src={{resList['05f105eb-e5c5-4f5e-8d6a-fbc0ad0718c4'].url}} />
<label class="kao_bei2">?</label>
<label class="dixxx_ceng_kao_bei2">第XXX层</label>
<label class="ba_la_kao_bei2">巴***拉</label>
<image class="ju_xing728_kao_bei6" src={{resList['05f105eb-e5c5-4f5e-8d6a-fbc0ad0718c4'].url}} />
<label class="kao_bei3">?</label>
<label class="dixxx_ceng_kao_bei3">第XXX层</label>
<label class="ba_la_kao_bei3">巴***拉</label>
<image class="ju_xing728_kao_bei7" src={{resList['05f105eb-e5c5-4f5e-8d6a-fbc0ad0718c4'].url}} />
<label class="kao_bei4">?</label>
<label class="dixxx_ceng_kao_bei4">第XXX层</label>
<label class="ba_la_kao_bei4">巴***拉</label> -->
<!-- 有中奖用户 -->
<view style="position:absolute" a:if="{{prizeMenu != null}}" a:for="{{prizeMenu}}" a:key="idx" a:for-item="prizeItem" >
......@@ -60,7 +29,7 @@
</view>
</view>
<view class="no_prize">无中奖名单</view>
<!-- <view class="no_prize" a:else>无中奖名单</view> -->
</view>
<!-- <view class="wei_zhong_jiang">
......@@ -100,7 +69,7 @@
</view>
</view>
</view>
<prize-modal a:if="{{prizeVisible}}" ></prize-modal>
<noprize-modal a:if="{{noprizeVisible}}" openPrizeStatus="{{openPrizeStatus}}" ></noprize-modal>
<prize-modal a:if="{{prizeVisible}}" onPrizeModalClose="onPrizeModalClose" myPrize="{{myPrize}}" ></prize-modal>
<noprize-modal a:if="{{noprizeVisible}}" openPrizeStatus="{{openPrizeStatus}}" onHandleNoPrizeClose="onHandleNoPrizeClose" myPrize="{{myPrize}}" ></noprize-modal>
<rule-modal a:if="{{ruleModalVisible}}" onModalClose="ruleModalClose"><text>{{ruleData}}</text></rule-modal>
\ No newline at end of file
......@@ -17,20 +17,30 @@ Page({
ruleModalVisible: false,
// myPrizeBtnVisible: false,
ruleData:''
ruleData:'',
myPrize:''
},
onLoad(props) {
console.log('fuck', JSON.parse(props.data));
const { prize, openPrizeStatus, isShowPrize } = JSON.parse(props.data);
// isShowPrize只展示一次
if (isShowPrize) {
// 有奖品
if (prize) {
this.setData({ prizeVisible: true })
this.setData({
prizeVisible: true,
myPrize:prize
})
} else {
// 没有奖品 未中奖 楼层不足100层
this.setData({
noprizeVisible: true,
openPrizeStatus: openPrizeStatus
openPrizeStatus: openPrizeStatus,
myPrize:prize
})
}
}
......@@ -75,46 +85,54 @@ Page({
let { data } = await API.getBuyFloorList() || {};
console.log('buy', data);
// 购买时间
if (data.length !== 0) {
for (let item of data) {
let createTime = item.createTime;
console.log(createTime, 'create')
for (let item of data) {
let createTime = item.createTime;
console.log(createTime, 'create')
// let formatCreateTime = new Date(parseInt(createTime)).toLocaleDateString();
let month = new Date(parseInt(createTime)).getMonth() + 1;
let date = new Date(parseInt(createTime)).getDate();
item.monthDate = month + '月' + date + '日';
console.log(item.monthDate, 'time')
}
// let formatCreateTime = new Date(parseInt(createTime)).toLocaleDateString();
let month = new Date(parseInt(createTime)).getMonth() + 1;
let date = new Date(parseInt(createTime)).getDate();
item.monthDate = month + '月' + date + '日';
console.log(item.monthDate, 'time')
}
let lens = data.length;
for (let i = 0; i < lens; i++) {
let orderStyle = {
orderDay: {
left: 0,
top: 40 * i + 'rpx',
position: 'absolute',
color: 'white'
},
orderFloor: {
left: 200 + 'rpx',
top: 40 * i + 'rpx',
position: 'absolute',
color: 'white'
},
orderCredits: {
left: 400 + 'rpx',
top: 40 * i + 'rpx',
position: 'absolute',
color: 'white'
let lens = data.length;
for (let i = lens -1; i >= 0; i--) {
let orderStyle = {
orderDay: {
left: 0,
top: 40 * (lens-i) + 'rpx',
position: 'absolute',
color: 'white'
},
orderFloor: {
left: 200 + 'rpx',
top: 40 * (lens-i) + 'rpx',
position: 'absolute',
color: 'white'
},
orderCredits: {
left: 400 + 'rpx',
top: 40 * (lens-i) + 'rpx',
position: 'absolute',
color: 'white'
}
}
data[i].order = orderStyle;
}
data[i].order = orderStyle;
this.setData({
orderList: data,
// orderStyle:orderStyleArr
})
} else {
// 购买记录为空
console.log('购买记录为空');
this.setData({
orderList: null
})
}
this.setData({
orderList: data,
// orderStyle:orderStyleArr
})
},
async getPrizeMenu(){
......@@ -152,7 +170,8 @@ Page({
left: 200 + 'rpx',
top: 40 * i + 'rpx',
position: 'absolute',
color: 'white'
color: 'white',
width: 100 + 'rpx'
},
prizeimage: {
left: 400 + 'rpx',
......@@ -188,6 +207,17 @@ Page({
})
}
})
},
onPrizeModalClose(){
this.setData({
prizeVisible: true
})
},
onHandleNoPrizeClose(){
this.setData({
noprizeVisible: false
})
}
});
\ No newline at end of file
......@@ -14,10 +14,10 @@ Page({
startBtnVisible: false,
ruleModalBtnVisible: false,
ruleData:'',
joinCount:'',
endTime:'',
startTime:''
ruleData: '',
joinCount: '',
endTime: '',
startTime: ''
},
onLoad(query) {
......@@ -31,22 +31,26 @@ Page({
},
gotoVipPage() {
let {endTime,startTime} = this.data
let { endTime, startTime } = this.data
API.getVipInfo().then(res => {
// 判断活动时间
let currentTime = new Date().getTime();
if(currentTime < startTime){
if (currentTime < startTime) {
commonToast('活动未开始');
}
if(currentTime > endTime){
if (currentTime > endTime) {
commonToast('活动已结束');
}
if (!res.data.isVip)
navigateToOutside(res.data.url)
if (!res.data.isVip) {
commonToast('立即加入会员,即可开始盖楼')
setTimeout(() => {
navigateToOutside(res.data.url)
}, 1000);
}
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}) });
// my.redirectTo({ url: '/pages/pagehuo_dong_ye/pagehuo_dong_ye?data=' + JSON.stringify({endTime}) });
})
},
......@@ -73,7 +77,7 @@ Page({
})
},
async init() {
const [{ data: { isUserJoin,startTime, endTime, openPrizeStatus, prize, isShowPrize, rule, joinCount } }, vipInfo] = await Promise.all([
const [{ data: { isUserJoin, startTime, endTime, openPrizeStatus, prize, isShowPrize, rule, joinCount } }, vipInfo] = await Promise.all([
API.getActivityBaseInfoById(),
API.getVipInfo(),
]);
......@@ -85,29 +89,39 @@ Page({
console.log('fuck');
// vipInfo..data.isVip = true;
if (vipInfo.data.isVip && isUserJoin) {
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 }) });
let currentTime = new Date().getTime();
if (currentTime < startTime) {
commonToast('活动未开始');
}
if (currentTime > endTime) {
commonToast('活动已结束');
} else
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}) });
}
} 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}) });
}
} else {
//设置状态
this.setData({
myPrizeBtnVisible: true,
startBtnVisible: true,
ruleModalBtnVisible: true
})
};
//设置状态
this.setData({
myPrizeBtnVisible: true,
startBtnVisible: true,
ruleModalBtnVisible: true
})
};
this.setData({
ruleData:rule,
joinCount:joinCount
ruleData: rule,
joinCount: joinCount
})
},
/**
* 登录接口
......
// 分享配置
export const SHARE_CONFIG = {
title: '分享测试标题',
desc: '分享测试描述',
imageUrl: '', // 分享图片URL
title: '爱斐楼上请',
desc: '积分盖楼赢锦鲤 享一年新衣',
imageUrl: 'https://isv.alibabausercontent.com/00000000/imgextra/i2/676606897/O1CN01eNrwLl20osHoB4Y7d_!!676606897-2-isvtu-00000000.png', // 分享图片URL
path: 'pages/index/index'
};
......
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