相框获取字段修改

This commit is contained in:
kron
2025-07-14 15:13:10 +08:00
parent e685383581
commit 1de8ba6d9d
7 changed files with 29 additions and 33 deletions

View File

@@ -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;
}
},
},