Commit a538d8b1 authored by wildfirecode13's avatar wildfirecode13

1

parent f46234af
'use strict'; 'use strict';
import resList from '../../resconfig/resList'; import resList from '../../resconfig/resList';
import API from '../../api'; import API from '../../api';
Page({ Page({
data: { data: {
prizeVisible:false, prizeVisible: false,
noprizeVisible:false, noprizeVisible: false,
openPrizeStatus:0, openPrizeStatus: 0,
// 购买记录列表 // 购买记录列表
orderList:[], orderList: [],
// 中奖名单 // 中奖名单
prizeMenu:[], prizeMenu: [],
// 购买列表渲染 // 购买列表渲染
orderStyle:[] orderStyle: []
}, },
onLoad(props) { onLoad(props) {
// console.log('fuck',JSON.parse(props.prize)) console.log('fuck', JSON.parse(props.data));
const { prize, openPrizeStatus, isShowPrize } = JSON.parse(props.data);
if (isShowPrize) {
if (prize) {
this.setData({ prizeVisible: true })
} else {
this.setData({
noprizeVisible: true,
openPrizeStatus: openPrizeStatus
})
}
}
this.setData({ this.setData({
resList: resList resList: resList
}); });
this.getOrderList(); this.getOrderList();
// this.getPrizeMenu(); // this.getPrizeMenu();
}, },
// 获取购买记录 // 获取购买记录
async getOrderList(){ async getOrderList() {
let {data} = await API.getBuyFloorList() || {}; let { data } = await API.getBuyFloorList() || {};
let orderStyleArr = []; let orderStyleArr = [];
let lens = data.length; let lens = data.length;
for(let i=0;i<lens;i++){ for (let i = 0; i < lens; i++) {
let orderStyle = { let orderStyle = {
orderDay:{ orderDay: {
left: 0, left: 0,
top: 40*i+'rpx', top: 40 * i + 'rpx',
position:'absolute', position: 'absolute',
color:'white' color: 'white'
}, },
orderFloor:{ orderFloor: {
left: 200+'rpx', left: 200 + 'rpx',
top: 40*i + 'rpx', top: 40 * i + 'rpx',
position:'absolute', position: 'absolute',
color:'white' color: 'white'
}, },
orderCredits:{ orderCredits: {
left:400 + 'rpx', left: 400 + 'rpx',
top: 40 * i + 'rpx', top: 40 * i + 'rpx',
position:'absolute', position: 'absolute',
color:'white' color: 'white'
} }
} }
// orderStyleArr.push(orderStyle); // orderStyleArr.push(orderStyle);
...@@ -60,36 +73,36 @@ Page({ ...@@ -60,36 +73,36 @@ Page({
// data[i].order = orderStyleArr[i]; // data[i].order = orderStyleArr[i];
// } // }
this.setData({ this.setData({
orderList:data, orderList: data,
// orderStyle:orderStyleArr // orderStyle:orderStyleArr
}) })
}, },
async getPrizeMenu(){ async getPrizeMenu() {
let {data} = await API.getFloorPrize() || {}; let { data } = await API.getFloorPrize() || {};
// 用户名单处理 // 用户名单处理
let floorPrize = data; let floorPrize = data;
var personMenuArr = []; var personMenuArr = [];
for(let i=0; i<floorPrize.length;i++){ for (let i = 0; i < floorPrize.length; i++) {
let userName = floorPrize[i].uerNick; let userName = floorPrize[i].uerNick;
if(userName.length >= 2){ if (userName.length >= 2) {
let firstLetter = userName.subStr(0,1); let firstLetter = userName.subStr(0, 1);
let lastLetter = userName.reverse().subStr(0,1); let lastLetter = userName.reverse().subStr(0, 1);
userName = firstLetter + '***' + lastLetter; userName = firstLetter + '***' + lastLetter;
} }
personMenuArr.push(userName); personMenuArr.push(userName);
} }
console.log(floorPrize,'arr') console.log(floorPrize, 'arr')
// 处理好的姓名合并到floorPrize // 处理好的姓名合并到floorPrize
if(floorPrize != null){ if (floorPrize != null) {
for(var floorprize of floorPrize){ for (var floorprize of floorPrize) {
for(var usernames of personMenuArr){ for (var usernames of personMenuArr) {
floorprize.username = usernames; floorprize.username = usernames;
} }
} }
} }
this.setData({ this.setData({
prizeMenu:floorPrize prizeMenu: floorPrize
}) })
} }
......
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