Commit 75f7a73d authored by Edwise's avatar Edwise 🍷

sj

parent 743c55a1
...@@ -13,42 +13,42 @@ const { ...@@ -13,42 +13,42 @@ const {
getSystemInfo getSystemInfo
} = tbcc.tb; } = tbcc.tb;
Page({ Page({
changeStr:'***', changeStr: '***',
data: { data: {
rankList: [], rankList: [],
myRankInfo: {}, myRankInfo: {},
myRank: '', myRank: '',
activtyTime: '', activtyTime: '',
rankPrize: [{ rankPrize: [{
id:1, id: 1,
name:'2999元购物金', name: '2999元购物金',
w:63, w: 63,
left:55 left: 55
}, { }, {
id:2, id: 2,
name:'1111元购物金', name: '1111元购物金',
w:94, w: 94,
left:40 left: 40
}, { }, {
id:3, id: 3,
name:'蕉内热皮套装', name: '蕉内热皮套装',
w:102, w: 102,
left:32 left: 32
}, { }, {
id:4, id: 4,
name:'蕉内家居服', name: '蕉内家居服',
w:110, w: 110,
left:28 left: 28
}, { }, {
id:5, id: 5,
name:'蕉内袜子礼盒', name: '蕉内袜子礼盒',
w:125, w: 125,
left:24 left: 24
}, { }, {
id:6, id: 6,
name:'蕉内睡眠眼罩', name: '蕉内睡眠眼罩',
w:140, w: 140,
left:12 left: 12
}] }]
}, },
...@@ -72,33 +72,34 @@ Page({ ...@@ -72,33 +72,34 @@ Page({
}) || {}; }) || {};
if (success) { if (success) {
my.hideLoading(); my.hideLoading();
let myrank = data.myRankInfo.rank >= 500 ? '500+' : data.myRankInfo.rank; if (data.myRankInfo && data.myRankInfo.rank) {
for(let i=0;i<data.list.length;i++){ let myrank = data.myRankInfo.rank >= 500 ? '500+' : data.myRankInfo.rank;
let len = data.list[i].userNick.length; let str = data.myRankInfo.userNick;
let str = data.list[i].userNick; let len = str.length;
if(len<=4){ if (len <= 4) {
data.list[i].userNick = str.substr(0,0)+this.changeStr+str.substr(len-1,len-1); data.myRankInfo.userNick = str.substr(0, 0) + this.changeStr + str.substr(len - 1, len - 1);
}else{ } else {
data.list[i].userNick = str.substr(0,Math.floor((len-3)/2))+this.changeStr+str.substr(len-Math.floor((len-3)/2)-1,len-1) data.myRankInfo.userNick = str.substr(0, Math.floor((len - 3) / 2)) + this.changeStr + str.substr(len - Math.floor((len - 3) / 2) - 1, len - 1)
} }
this.setData({
// substr myRankInfo: data.myRankInfo,
myRank: myrank
})
} }
let str = data.myRankInfo.userNick; for (let i = 0; i < data.list.length; i++) {
let len = str.length; let len = data.list[i].userNick.length;
if(len<=4){ let str = data.list[i].userNick;
data.myRankInfo.userNick = str.substr(0,0)+this.changeStr+str.substr(len-1,len-1); if (len <= 4) {
}else{ data.list[i].userNick = str.substr(0, 0) + this.changeStr + str.substr(len - 1, len - 1);
data.myRankInfo.userNick = str.substr(0,Math.floor((len-3)/2))+this.changeStr+str.substr(len-Math.floor((len-3)/2)-1,len-1) } else {
data.list[i].userNick = str.substr(0, Math.floor((len - 3) / 2)) + this.changeStr + str.substr(len - Math.floor((len - 3) / 2) - 1, len - 1)
}
} }
this.setData({ this.setData({
rankList: data.list, rankList: data.list,
myRankInfo: data.myRankInfo,
myRank: myrank })
})
} }
}, },
...@@ -122,7 +123,11 @@ Page({ ...@@ -122,7 +123,11 @@ Page({
const dd = new Date(time).getDate() + ''; const dd = new Date(time).getDate() + '';
let m = mm.padStart(2, '0'); let m = mm.padStart(2, '0');
let d = dd.padStart(2, '0'); let d = dd.padStart(2, '0');
const t1 = `${yy}.${m}.${d} `; const t2 = new Date(time).getHours() + ''; //获取时
const t3 = new Date(time).getMinutes() + ''; //获取分
const t4 = new Date(time).getMilliseconds() + ''; //获取秒
console.log(time, new Date(time + 48 * 60 * 60 * 1000).toLocaleString(), 'time');
const t1 = `${yy}.${m}.${d} `+ t2.padStart(2, '0') + ":" + t3.padStart(2, '0');
let date = t1; let date = t1;
return date; return date;
}, },
......
This diff is collapsed.
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