Commit 05b57933 authored by 汪欢's avatar 汪欢

chujiang

parent 44ddbff7
......@@ -4,12 +4,14 @@
<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}}">
<!-- <view a:if="{{openPrizeStatus==OPEN_PRIZE_STATUS.NOT_OPEN}}"> -->
<view a:if="{{openPrizeStatus== 'noprize'}}">
<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}}">
<!-- <view a:if="{{openPrizeStatus!=OPEN_PRIZE_STATUS.NOT_OPEN}}"> -->
<view a:if="{{openPrizeStatus == 'miss'}}">
<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}} />
......
......@@ -157,6 +157,7 @@
opacity: 1;
position: absolute;
text-align: center;
color: white;
}
/*
......
......@@ -21,14 +21,14 @@
<!-- 已中奖名单列表 -->
<view class="yi_zhong_jiang">
<!-- 有中奖用户 -->
<view style="position:absolute" a:if="{{prizeMenu != null}}" a:for="{{prizeMenu}}" a:key="idx" a:for-item="prizeItem">
<view style="position:absolute" a:if="{{prizeMenu.length != 0}}" a:for="{{prizeMenu}}" a:key="idx" a:for-item="prizeItem">
<view style="height:40rpx;position:absolute">
<label style="{{prizeItem.prizestyle.prizefloor}}">第{{prizeItem.floor}}层</label>
<label style="{{prizeItem.prizestyle.prizeuser}}">{{prizeItem.username}}</label>
<image style="{{prizeItem.prizestyle.prizeimage}}" src={{prizeItem.image}}></image>
</view>
</view>
<view class="no_prize" a:if="{{prizeMenu == null}}">总楼层不足,无人中奖</view>
<view class="no_prize" a:if="{{prizeMenu.length == 0}}">总楼层不足,无人中奖</view>
</view>
<!--<view class="wei_zhong_jiang"><label class="zong_lou_ceng_bu_zu_wu_ren_zhong_jiang">总楼层不足,无人中奖</label></view> -->
</view>
......
......@@ -12,45 +12,57 @@ Page({
// 购买记录列表
orderList: [],
// 中奖名单
prizeMenu:'',
prizeMenu: '',
// 购买列表渲染
orderStyle:[],
orderStyle: [],
ruleModalVisible: false,
// myPrizeBtnVisible: false,
ruleData:'',
myPrize:'',
maskVisible:false,
list:'',
totalFloor:'',
listlength:''
ruleData: '',
myPrize: '',
maskVisible: false,
list: '',
totalFloor: '',
listlength: ''
},
onLoad(props) {
// console.log('fuck', JSON.parse(props.data));
const datstr = decodeURIComponent( props.data);
const datstr = decodeURIComponent(props.data);
const dat = JSON.parse(datstr);
const { prize, openPrizeStatus, isShowPrize } = dat;
const { prize, openPrizeStatus, isShowPrize, openPrizeLimit, totalFloor } = dat;
// isShowPrize只展示一次
if (isShowPrize) {
// 有奖品 中奖
if (prize) {
if (Object.keys(prize).length != 0) {
this.setData({
prizeVisible: true,
myPrize:prize,
maskVisible:true,
myPrize: prize,
maskVisible: true,
})
} else {
// 没有奖品 未中奖 楼层不足100层
// 没有奖品 未中奖
if (totalFloor >= openPrizeLimit) {
this.setData({
noprizeVisible: true,
openPrizeStatus: 'miss',
myPrize: prize,
maskVisible: true
})
} else {
// 楼层不足100层
this.setData({
noprizeVisible: true,
openPrizeStatus: openPrizeStatus,
myPrize:prize,
maskVisible:true
openPrizeStatus: 'noprize',
myPrize: prize,
maskVisible: true
})
}
}
}
this.getRuleSource();
this.setData({
......@@ -83,13 +95,13 @@ Page({
showRuleModal() {
this.setData({
ruleModalVisible: true,
maskVisible:true
maskVisible: true
})
},
ruleModalClose() {
this.setData({
ruleModalVisible: false,
maskVisible:false
maskVisible: false
})
},
......@@ -113,30 +125,30 @@ Page({
}
let lens = data.length;
for (let i = lens -1; i >= 0; i--) {
for (let i = lens - 1; i >= 0; i--) {
let orderStyle = {
orderDay: {
left: 0,
top: 40 * (lens-i) + 'rpx',
top: 40 * (lens - i) + 'rpx',
position: 'absolute',
color: 'white'
},
orderFloor: {
left: 180 + 'rpx',
top: 40 * (lens-i) + 'rpx',
top: 40 * (lens - i) + 'rpx',
position: 'absolute',
color: 'white',
width:150+'rpx',
textAlign:'center'
width: 150 + 'rpx',
textAlign: 'center'
},
orderCredits: {
left: 380 + 'rpx',
top: 40 * (lens-i) + 'rpx',
top: 40 * (lens - i) + 'rpx',
position: 'absolute',
color: 'white',
width:100+'rpx',
textAlign:'center',
overflow:'hidden'
width: 100 + 'rpx',
textAlign: 'center',
overflow: 'hidden'
}
}
data[i].order = orderStyle;
......@@ -155,26 +167,95 @@ Page({
},
async getPrizeMenu(){
let {data} = await API.getFloorPrize() || {};
console.log(data,'prizemenu')
async getPrizeMenu() {
// await API.getFloorPrize().then((res) => {
// if (res.success && res.data.legnth != 0) {
// let data = res.data;
// // if (data != null) {
// // 用户名单处理
// let floorPrize = data;
// var personMenuArr = [];
// for (let i = 0; i < floorPrize.length; i++) {
// let userName = floorPrize[i].userNick;
// console.log(userName, 'userName');
// if (userName.length == 1) {
// userName = '***';
// }
// if (userName.length >= 2) {
// console.log(userName.length);
// let length = userName.length;
// let f = userName.toString().substr(0, 1);
// // console.log('f',f);
// let last = userName.toString().substr(length - 1, 1)
// // console.log('last',last)
// userName = f + "***" + last;
// // console.log('22222',userName)
// }
// floorPrize[i].username = userName;
// let prizeStyle = {
// prizefloor: {
// left: 0,
// top: 40 * i + 'rpx',
// position: 'absolute',
// color: 'white',
// },
// prizeuser: {
// left: 180 + 'rpx',
// top: 40 * i + 'rpx',
// position: 'absolute',
// color: 'white',
// width: 120 + 'rpx',
// textAlign: 'center'
// },
// prizeimage: {
// left: 400 + 'rpx',
// position: 'absolute',
// verticalAlign: 'middle',
// top: 40 * i + 10 + 'rpx',
// color: 'white',
// width: 40 + 'rpx',
// height: 30 + 'rpx'
// }
// }
// floorPrize[i].prizestyle = prizeStyle;
// }
// console.log(floorPrize, 'arr')
// this.setData({
// prizeMenu: floorPrize
// })
// // } else {
// // 无中奖
// // }
// }else{
// this.setData({
// // prizeMenu: null
// prizeMenu: []
// })
// }
// })
let { data } = await API.getFloorPrize() || {};
console.log(data, 'prizemenu')
if(data != null){
if (data != null) {
// 用户名单处理
let floorPrize = data;
var personMenuArr = [];
for(let i=0; i<floorPrize.length;i++){
let userName = floorPrize[i].userNick ;
console.log(userName,'userName');
if(userName.length == 1){
for (let i = 0; i < floorPrize.length; i++) {
let userName = floorPrize[i].userNick;
console.log(userName, 'userName');
if (userName.length == 1) {
userName = '***';
}
if(userName.length >=2){
if (userName.length >= 2) {
console.log(userName.length);
let length = userName.length;
let f = userName.toString().substr(0,1);
let f = userName.toString().substr(0, 1);
// console.log('f',f);
let last = userName.toString().substr(length -1,1)
let last = userName.toString().substr(length - 1, 1)
// console.log('last',last)
userName = f + "***" + last;
// console.log('22222',userName)
......@@ -195,43 +276,43 @@ Page({
position: 'absolute',
color: 'white',
width: 120 + 'rpx',
textAlign:'center'
textAlign: 'center'
},
prizeimage: {
left: 400 + 'rpx',
position: 'absolute',
verticalAlign:'middle',
verticalAlign: 'middle',
top: 40 * i + 10 + 'rpx',
color: 'white',
width:40 + 'rpx',
width: 40 + 'rpx',
height: 30 + 'rpx'
}
}
floorPrize[i].prizestyle = prizeStyle;
}
console.log(floorPrize,'arr')
console.log(floorPrize, 'arr')
this.setData({
prizeMenu: floorPrize
})
} else {
// 无中奖
this.setData({
prizeMenu:null
prizeMenu: []
})
}
},
// 获取规则接口
async getRuleSource(){
API.getActivityBaseInfoById().then((res)=>{
if(res.success && res.data){
async getRuleSource() {
API.getActivityBaseInfoById().then((res) => {
if (res.success && res.data) {
let data = res.data;
let list = data.list;
let listlength = list.length;
let totalFloor = res.totalFloor;
this.setData({
ruleData:res.data.rule,
ruleData: res.data.rule,
list,
totalFloor,
listlength
......@@ -240,16 +321,16 @@ Page({
})
},
onPrizeModalClose(){
onPrizeModalClose() {
this.setData({
prizeVisible: false,
maskVisible:false
maskVisible: false
})
},
onHandleNoPrizeClose(){
onHandleNoPrizeClose() {
this.setData({
noprizeVisible: false,
maskVisible:false
maskVisible: false
})
}
......
......@@ -88,7 +88,7 @@ Page({
})
},
async init() {
const [{ data: { isUserJoin, startTime, endTime, openPrizeStatus, prize, isShowPrize, rule, joinCount } }, vipInfo] = await Promise.all([
const [{ data: { isUserJoin, startTime, endTime, openPrizeStatus, openPrizeLimit, totalFloor, prize, isShowPrize, rule, joinCount } }, vipInfo] = await Promise.all([
API.getActivityBaseInfoById(),
API.getVipInfo(),
]);
......@@ -104,13 +104,14 @@ Page({
if (vipInfo.data.isVip && isUserJoin) {
// vipInfo..data.isVip = true;
if (isEnd(endTime) &&
(openPrizeStatus == OPEN_PRIZE_STATUS.SUCCESS || openPrizeStatus == OPEN_PRIZE_STATUS.NOT_OPEN)) {//活动结束,开奖成功or不开奖
let datstr = JSON.stringify({ prize:prize, openPrizeStatus:prize, isShowPrize:isShowPrize });
(openPrizeStatus == OPEN_PRIZE_STATUS.SUCCESS || openPrizeStatus == OPEN_PRIZE_STATUS.NOT_OPEN)) {//活动结束,开奖成功or不开奖(楼层不足,楼层有但没中奖)
// let datstr = JSON.stringify({ prize:prize, openPrizeStatus:prize, isShowPrize:isShowPrize });
let datstr = JSON.stringify({ prize:prize, openPrizeStatus:openPrizeStatus, isShowPrize:isShowPrize, openPrizeLimit:openPrizeLimit,totalFloor });
datstr = encodeURIComponent(datstr);
my.redirectTo({ url: '/pages/pagejie_shu_ye/pagejie_shu_ye?data=' + datstr});
} 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,openPrizeStatus}) });
}
} else {
if (isEnd(endTime) &&
......@@ -132,6 +133,8 @@ Page({
})
},
/**
* 登录接口
*/
......
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