修复练习不能分享的问题
This commit is contained in:
28
src/store.js
28
src/store.js
@@ -71,22 +71,16 @@ export default defineStore("store", {
|
||||
},
|
||||
async updateUser(user = {}) {
|
||||
this.user = { ...defaultUser, ...user };
|
||||
if (user.avatar) {
|
||||
// 先保存到本地,分享只能用本地图片
|
||||
const imageInfo = await uni.getImageInfo({ src: user.avatar });
|
||||
this.user.avatar = imageInfo.path;
|
||||
}
|
||||
if (this.user.rankLvl !== undefined) {
|
||||
this.user.lvlName = getLvlName(
|
||||
this.user.rankLvl,
|
||||
this.config.randInfos
|
||||
);
|
||||
}
|
||||
const lvlImage = getLvlImage(this.user.rankLvl, this.config.randInfos);
|
||||
if (lvlImage) {
|
||||
const imageInfo = await uni.getImageInfo({ src: lvlImage });
|
||||
this.user.lvlImage = imageInfo.path;
|
||||
}
|
||||
this.user.lvlImage = getLvlImage(
|
||||
this.user.rankLvl,
|
||||
this.config.randInfos
|
||||
);
|
||||
},
|
||||
updateDevice(deviceId, deviceName) {
|
||||
this.device.deviceId = deviceId;
|
||||
@@ -95,13 +89,15 @@ export default defineStore("store", {
|
||||
async updateConfig(config) {
|
||||
this.config = config;
|
||||
if (this.user.scores !== undefined) {
|
||||
this.user.lvlName = getLvlName(this.user.scores, this.config.randInfos);
|
||||
}
|
||||
const lvlImage = getLvlImage(this.user.rankLvl, this.config.randInfos);
|
||||
if (lvlImage) {
|
||||
const imageInfo = await uni.getImageInfo({ src: lvlImage });
|
||||
this.user.lvlImage = imageInfo.path;
|
||||
this.user.lvlName = getLvlName(
|
||||
this.user.rankLvl,
|
||||
this.config.randInfos
|
||||
);
|
||||
}
|
||||
this.user.lvlImage = getLvlImage(
|
||||
this.user.rankLvl,
|
||||
this.config.randInfos
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user