fix:修复浅拷贝数组问题

This commit is contained in:
2026-06-10 12:11:55 +08:00
parent 97af0505b2
commit ea05b8ff43
5 changed files with 70 additions and 49 deletions
@@ -232,7 +232,9 @@ const setOathAdaptation = (part: string, value: string) => {
configStore.config.oaths[item].adaptation = Math.max(0, parsed);
});
setNotice(oathBatchApply.value ? "已批量更新全部誓约槽位适配值。" : `已更新誓约槽位 ${part} 的适配值。`);
setNotice(
oathBatchApply.value ? "已批量更新全部誓约槽位适配值。" : `已更新誓约槽位 ${part} 的适配值。`,
);
trackSource(oathBatchApply.value ? "誓约适配已批量更新" : `誓约槽位 ${part} 适配已更新`);
};
@@ -348,7 +350,8 @@ const setEquipNumberField = (
const normalized =
field === "precision" ? Math.max(0, Math.min(parsed, 100)) : Math.max(0, parsed);
const canBatch = equipBatchApply.value && ["reinforceType", "reinforce", "adaptation"].includes(field);
const canBatch =
equipBatchApply.value && ["reinforceType", "reinforce", "adaptation"].includes(field);
const partsToApply = canBatch ? infoStore.parts.filter(canUpgradeEquip) : [part];
partsToApply.forEach((item) => {
@@ -379,9 +382,15 @@ const setEquipEnchant = (part: string, value: string) => {
configStore.config.equips[item].enchant = value;
});
setNotice(equipBatchApply.value && partsToApply.length > 1 ? "已批量更新装备附魔。" : `已更新 ${part} 的附魔。`);
setNotice(
equipBatchApply.value && partsToApply.length > 1
? "已批量更新装备附魔。"
: `已更新 ${part} 的附魔。`,
);
trackSource(
equipBatchApply.value && partsToApply.length > 1 ? "装备附魔已批量更新" : `装备 ${part} 附魔已更新`,
equipBatchApply.value && partsToApply.length > 1
? "装备附魔已批量更新"
: `装备 ${part} 附魔已更新`,
);
};
@@ -421,7 +430,7 @@ const resetAvatarPart = () => {
const ensureEmblemPart = (part: string) => {
if (!configStore.config.emblems[part]) {
configStore.config.emblems[part] = { ...configStore.defaultEmblemConfig };
configStore.config.emblems[part] = configStore.createDefaultEmblemConfig();
}
return configStore.config.emblems[part];
};
@@ -463,7 +472,7 @@ const setEmblemItem = (index: number, value: string) => {
};
const resetEmblemPart = () => {
configStore.config.emblems[emblemPart.value] = { ...configStore.defaultEmblemConfig };
configStore.config.emblems[emblemPart.value] = configStore.createDefaultEmblemConfig();
setNotice(`已重置 ${emblemPart.value} 徽章配置。`);
trackSource(`徽章 ${emblemPart.value} 已重置`);
};
@@ -503,7 +512,7 @@ const resetAllForge = () => {
configStore.config.avatar[part] = { ...configStore.defaultAvatarConfig };
});
infoStore.emblemParts.forEach((part) => {
configStore.config.emblems[part] = { ...configStore.defaultEmblemConfig };
configStore.config.emblems[part] = configStore.createDefaultEmblemConfig();
});
jadeKeys.forEach((key) => {
configStore.config.jades[key] = { id: -1, value: 0 };
@@ -688,11 +697,7 @@ const resetAllForge = () => {
<span>批量应用到同类部位</span>
<input v-model="equipBatchApply" type="checkbox" class="size-4" />
</label>
<div
v-for="part in parts"
:key="part"
class="space-y-3 rounded-md border p-2 md:p-3"
>
<div v-for="part in parts" :key="part" class="space-y-3 rounded-md border p-2 md:p-3">
<div class="grid grid-cols-[5rem_minmax(0,1fr)_auto] items-center gap-2">
<div class="font-medium">{{ part }}</div>
<div class="truncate text-muted-foreground">
@@ -1108,10 +1113,7 @@ const resetAllForge = () => {
</Card>
</div>
<div
v-if="forgeViewTab === 'config' && moduleMode === 'jade'"
class="grid grid-cols-1 gap-4"
>
<div v-if="forgeViewTab === 'config' && moduleMode === 'jade'" class="grid grid-cols-1 gap-4">
<Card class="border-border/60 bg-card/90">
<CardHeader>
<CardTitle class="flex items-center gap-2">
+5 -2
View File
@@ -109,10 +109,12 @@ const defaultOathConfig = {
adaptation: 0,
};
const defaultEmblemConfig = {
const createDefaultEmblemConfig = (): IConfigEmblem => ({
lv: 0,
items: ["", "", "", "", "", ""],
};
});
const defaultEmblemConfig = createDefaultEmblemConfig();
export const useConfigStore = defineStore("configStore", () => {
const config = ref<IConfig>({
@@ -309,6 +311,7 @@ export const useConfigStore = defineStore("configStore", () => {
defaultAvatarConfig,
defaultOathConfig,
defaultEmblemConfig,
createDefaultEmblemConfig,
changeSourceLogs,
pushChangeSource,
clearChangeSource,