Commit 4036324b authored by Edwise's avatar Edwise 🍷

两个列表用户id优化

parent 79bb51a8
...@@ -31,6 +31,7 @@ App({ ...@@ -31,6 +31,7 @@ App({
*/ */
handleQuery(query) { handleQuery(query) {
const { activityId } = query; const { activityId } = query;
console.log("query活动id",activityId)
// this.activityId = activityId || '5f8550a3964f97be3647a635'; // this.activityId = activityId || '5f8550a3964f97be3647a635';
// this.activityId = activityId || '5f8831e67389891bfd6bb35f'; //赵然1 // this.activityId = activityId || '5f8831e67389891bfd6bb35f'; //赵然1
// this.activityId = activityId || '5f895d0f0cb733e071b4082b'; //开发者测试 // this.activityId = activityId || '5f895d0f0cb733e071b4082b'; //开发者测试
......
...@@ -48,11 +48,11 @@ Component({ ...@@ -48,11 +48,11 @@ Component({
console.log(data.list[i].createTime) console.log(data.list[i].createTime)
let len = data.list[i].userNick.length; let len = data.list[i].userNick.length;
let str = data.list[i].userNick; let str = data.list[i].userNick;
if(len<=4){ // if(len<=4){
data.list[i].userNick = str.substr(0,0)+changeStr+str.substr(len-1,len-1); data.list[i].userNick = str.substr(0,1)+changeStr+str.substr(len-1,len-1);
}else{ // }else{
data.list[i].userNick = str.substr(0,Math.floor((len-3)/2))+changeStr+str.substr(len-Math.floor((len-3)/2)-1,len-1) // data.list[i].userNick = str.substr(0,Math.floor((len-3)/2))+changeStr+str.substr(len-Math.floor((len-3)/2)-1,len-1)
} // }
} }
console.log(data.list); console.log(data.list);
this.setData({ this.setData({
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
width: 400rpx; width: 400rpx;
height: 20rpx; height: 20rpx;
opacity: 0.61960784; opacity: 0.61960784;
left: 150rpx; left: 184rpx;
top: -13rpx; top: -13rpx;
position: absolute; position: absolute;
transform-origin: 0rpx 0rpx 0rpx; transform-origin: 0rpx 0rpx 0rpx;
...@@ -165,7 +165,7 @@ ...@@ -165,7 +165,7 @@
height: 40rpx; height: 40rpx;
opacity: 1; opacity: 1;
display: block; display: block;
left: 188rpx; left: 220rpx;
top: 8rpx; top: 8rpx;
position: absolute; position: absolute;
font-size: 26rpx; font-size: 26rpx;
......
...@@ -76,11 +76,11 @@ Page({ ...@@ -76,11 +76,11 @@ Page({
let myrank = data.myRankInfo.rank >= 500 ? '500+' : data.myRankInfo.rank; let myrank = data.myRankInfo.rank >= 500 ? '500+' : data.myRankInfo.rank;
let str = data.myRankInfo.userNick; let str = data.myRankInfo.userNick;
let len = str.length; let len = str.length;
if (len <= 4) { // if (len <= 4) {
data.myRankInfo.userNick = str.substr(0, 0) + this.changeStr + str.substr(len - 1, len - 1); data.myRankInfo.userNick = str.substr(0, 1) + this.changeStr + str.substr(len - 1, len - 1);
} else { // } else {
data.myRankInfo.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({ this.setData({
myRankInfo: data.myRankInfo, myRankInfo: data.myRankInfo,
myRank: myrank myRank: myrank
...@@ -90,11 +90,11 @@ Page({ ...@@ -90,11 +90,11 @@ Page({
for (let i = 0; i < data.list.length; i++) { for (let i = 0; i < data.list.length; i++) {
let len = data.list[i].userNick.length; let len = data.list[i].userNick.length;
let str = data.list[i].userNick; let str = data.list[i].userNick;
if (len <= 4) { // if (len <= 4) {
data.list[i].userNick = str.substr(0, 0) + this.changeStr + str.substr(len - 1, len - 1); data.list[i].userNick = str.substr(0, 1) + 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.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,
......
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