diff --git a/src/components/BowData.vue b/src/components/BowData.vue
index 256caa9..92d6793 100644
--- a/src/components/BowData.vue
+++ b/src/components/BowData.vue
@@ -32,7 +32,7 @@ const props = defineProps({
{{ user.nickName }}
- 砖石1级
+ {{ user.lvlName }}
diff --git a/src/components/ImageShare.vue b/src/components/ImageShare.vue
index 32350f2..39d13f3 100644
--- a/src/components/ImageShare.vue
+++ b/src/components/ImageShare.vue
@@ -70,7 +70,7 @@ const saveImage = () => {
{{ user.nickName }}
- 砖石1级
+ {{ user.lvlName }}
diff --git a/src/components/UserHeader.vue b/src/components/UserHeader.vue
index 4184592..92e318f 100644
--- a/src/components/UserHeader.vue
+++ b/src/components/UserHeader.vue
@@ -11,7 +11,6 @@ const props = defineProps({
default: false,
},
});
-const lvlName = ref("");
const nextLvlPoints = ref("");
const containerWidth = computed(() => (props.showRank ? "72vw" : "100vw"));
const toUserPage = () => {
@@ -29,12 +28,8 @@ const toUserPage = () => {
onMounted(() => {
const rankInfos = config.value.randInfos || [];
rankInfos.some((r, index) => {
- lvlName.value = rankInfos[index].name;
if (r.upgrade_scores > user.value.scores) {
nextLvlPoints.value = r.upgrade_scores;
- if (rankInfos[index - 1]) {
- lvlName.value = rankInfos[index - 1].name;
- }
return true;
}
return false;
@@ -55,7 +50,7 @@ onMounted(() => {
/>
- {{ lvlName }}
+ {{ user.lvlName }}
L{{ user.lvl }}
diff --git a/src/pages/my-growth.vue b/src/pages/my-growth.vue
index 91cc8ef..d5c579e 100644
--- a/src/pages/my-growth.vue
+++ b/src/pages/my-growth.vue
@@ -21,6 +21,7 @@ const showBowData = ref(false);
const arrows = ref([]);
const handleSelect = async (index) => {
+ selectedIndex.value = index;
if (index === 0 && matchList.value.length === 0) {
const result = await getBattleListAPI(matchPage.value, 2);
matchList.value = result;
@@ -35,7 +36,6 @@ const handleSelect = async (index) => {
const result = await getPractiseResultListAPI();
practiseList.value = result.list;
}
- selectedIndex.value = index;
};
const toMatchDetail = (id) => {
diff --git a/src/store.js b/src/store.js
index cf3d2ca..bbdc8fc 100644
--- a/src/store.js
+++ b/src/store.js
@@ -29,7 +29,22 @@ export default defineStore("store", {
// 方法
actions: {
updateUser(user) {
- this.user = user || defaultUser;
+ this.user = { ...defaultUser, ...user };
+ const rankInfos = this.config.randInfos || [];
+ let lvlName = "";
+ if (this.user.scores) {
+ rankInfos.some((r, index) => {
+ lvlName = rankInfos[index].name;
+ if (r.upgrade_scores > this.user.scores) {
+ if (rankInfos[index - 1]) {
+ lvlName = rankInfos[index - 1].name;
+ }
+ return true;
+ }
+ return false;
+ });
+ }
+ this.user.lvlName = lvlName;
},
updateDevice(deviceId, deviceName) {
this.device.deviceId = deviceId;
@@ -37,6 +52,21 @@ export default defineStore("store", {
},
updateConfig(config) {
this.config = config;
+ const rankInfos = config.randInfos || [];
+ let lvlName = "";
+ if (this.user.scores) {
+ rankInfos.some((r, index) => {
+ lvlName = rankInfos[index].name;
+ if (r.upgrade_scores > this.user.scores) {
+ if (rankInfos[index - 1]) {
+ lvlName = rankInfos[index - 1].name;
+ }
+ return true;
+ }
+ return false;
+ });
+ }
+ this.user.lvlName = lvlName;
},
},