相框获取字段修改
This commit is contained in:
34
src/store.js
34
src/store.js
@@ -23,15 +23,11 @@ const getLvlName = (score, rankList = []) => {
|
||||
return lvlName;
|
||||
};
|
||||
|
||||
const getLvlImage = (score, rankList = []) => {
|
||||
// 先保存到本地,分享只能用本地图片
|
||||
const getLvlImage = (rankLvl, rankList = []) => {
|
||||
let lvlImage = "";
|
||||
rankList.some((r, index) => {
|
||||
lvlImage = rankList[index].icoin;
|
||||
if (r.upgrade_scores > score) {
|
||||
if (rankList[index - 1]) {
|
||||
lvlImage = rankList[index - 1].icoin;
|
||||
}
|
||||
if (r.rank_id === rankLvl) {
|
||||
lvlImage = rankList[index].icoin;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -67,8 +63,8 @@ export default defineStore("store", {
|
||||
getLvlName(score) {
|
||||
return getLvlName(score, this.config.randInfos);
|
||||
},
|
||||
getLvlImage(score) {
|
||||
return getLvlImage(score, this.config.randInfos);
|
||||
getLvlImage(rankLvl) {
|
||||
return getLvlImage(rankLvl, this.config.randInfos);
|
||||
},
|
||||
updateRank(data = {}) {
|
||||
this.rankData = { rank: data.rank || [], ringRank: data.ringRank || [] };
|
||||
@@ -82,11 +78,11 @@ export default defineStore("store", {
|
||||
}
|
||||
if (this.user.scores !== undefined) {
|
||||
this.user.lvlName = getLvlName(this.user.scores, this.config.randInfos);
|
||||
const lvlImage = getLvlImage(this.user.scores, this.config.randInfos);
|
||||
if (lvlImage) {
|
||||
const imageInfo = await uni.getImageInfo({ src: lvlImage });
|
||||
this.user.lvlImage = imageInfo.path;
|
||||
}
|
||||
}
|
||||
const lvlImage = getLvlImage(this.user.rankLvl, this.config.randInfos);
|
||||
if (lvlImage) {
|
||||
const imageInfo = await uni.getImageInfo({ src: lvlImage });
|
||||
this.user.lvlImage = imageInfo.path;
|
||||
}
|
||||
},
|
||||
updateDevice(deviceId, deviceName) {
|
||||
@@ -97,11 +93,11 @@ export default defineStore("store", {
|
||||
this.config = config;
|
||||
if (this.user.scores !== undefined) {
|
||||
this.user.lvlName = getLvlName(this.user.scores, this.config.randInfos);
|
||||
const lvlImage = getLvlImage(this.user.scores, this.config.randInfos);
|
||||
if (lvlImage) {
|
||||
const imageInfo = await uni.getImageInfo({ src: lvlImage });
|
||||
this.user.lvlImage = imageInfo.path;
|
||||
}
|
||||
}
|
||||
const lvlImage = getLvlImage(this.user.rankLvl, this.config.randInfos);
|
||||
if (lvlImage) {
|
||||
const imageInfo = await uni.getImageInfo({ src: lvlImage });
|
||||
this.user.lvlImage = imageInfo.path;
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user