This commit is contained in:
2026-04-21 02:30:17 +08:00
parent c6c9f960da
commit 720a27cca3
13 changed files with 404 additions and 24 deletions
@@ -93,7 +93,7 @@
<div class="item-head" @click="hideSuit = !hideSuit">
套装信息{{ hideSuit ? ' (点击显示)' : '(点击隐藏)' }}
</div>
<div v-show="!hideSuit">
<template v-if="!hideSuit">
<div class="flex bg-#191918 items-center justify-center gap-2px p-5px">
<calc-button
:disabled="raritiyList.findIndex((rarity) => rarity === curSuitLv.rarity) <= 0"
@@ -135,40 +135,43 @@
<div class="flex-1 overflow-y-auto overflow-x-hidden bg-black w-240px">
<SuitInfo v-if="curSuitInfo" :suit="curSuitInfo" />
</div>
</div>
</template>
</div>
<div class="flex flex-col flex-1 overflow-hidden bg-black" v-if="curOathInfo">
<div class="item-head">誓约信息</div>
<div class="flex bg-#191918 items-center justify-center gap-2px p-5px">
<calc-button
:disabled="raritiyList.findIndex((rarity) => rarity === curSuitLv.rarity) <= 0"
:disabled="raritiyList.findIndex((rarity) => rarity === curOathSkillLv.rarity) <= 0"
icon="min-little"
@click="changeSuitLv('preRarity')"
@click="changeOathSkillLv('preRarity')"
></calc-button>
<calc-button
icon="reduce-little"
:disabled="
raritiyList.findIndex((rarity) => rarity === curSuitLv.rarity) <= 0 && curSuitLv.lv <= 1
raritiyList.findIndex((rarity) => rarity === curOathSkillLv.rarity) <= 0 &&
curOathSkillLv.lv <= 1
"
@click="changeSuitLv('preLv')"
@click="changeOathSkillLv('preLv')"
></calc-button>
<div class="flex px-20px gap-x-10px" :class="rarityClass(curSuitLv.rarity)">
<span>{{ curSuitLv.rarity }}</span>
<span>{{ formatLv(curSuitLv.lv, curSuitLv.rarity) }}</span>
<div class="flex px-20px gap-x-10px" :class="rarityClass(curOathSkillLv.rarity)">
<span>{{ curOathSkillLv.rarity }}</span>
<span>{{ formatLv(curOathSkillLv.lv, curOathSkillLv.rarity) }}</span>
</div>
<calc-button
:disabled="
raritiyList.findIndex((rarity) => rarity === curSuitLv.rarity) >= raritiyList.length - 1
raritiyList.findIndex((rarity) => rarity === curOathSkillLv.rarity) >=
raritiyList.length - 1
"
@click="changeSuitLv('nextLv')"
@click="changeOathSkillLv('nextLv')"
icon="increase-little"
></calc-button>
<calc-button
:disabled="
raritiyList.findIndex((rarity) => rarity === curSuitLv.rarity) >= raritiyList.length - 1
raritiyList.findIndex((rarity) => rarity === curOathSkillLv.rarity) >=
raritiyList.length - 1
"
@click="changeSuitLv('nextRarity')"
@click="changeOathSkillLv('nextRarity')"
icon="max-little"
></calc-button>
</div>
@@ -190,7 +193,7 @@
class="w-80% m-auto h-1px bg-gradient-to-r from-[rgba(52,43,27,0.05)] via-[rgba(52,43,27,1)] to-[rgba(52,43,27,0.05)]"
></div>
<div class="flex-1 overflow-y-auto overflow-x-hidden bg-black w-240px">
<SuitInfo v-if="curSuitInfo" :suit="curSuitInfo" />
<SuitInfo v-if="curOathSkillInfo" :suit="curOathSkillInfo" />
</div>
</div>
</div>
@@ -218,6 +221,10 @@ const curRarity = ref('')
const curSuit = ref(16203)
const curEquId = ref()
const curSuitLv = ref({
rarity: '太初',
lv: 1,
})
const curOathSkillLv = ref({
rarity: '史诗',
lv: 1,
})
@@ -270,6 +277,41 @@ const changeSuitLv = (
}
}
const changeOathSkillLv = (
type: 'preRarity' | 'nextRarity' | 'preLv' | 'nextLv',
resetLv: boolean = true,
) => {
if (type == 'preRarity') {
const index = raritiyList.findIndex((a) => a == curOathSkillLv.value.rarity)
if (index > 0) {
curOathSkillLv.value.rarity = raritiyList[index - 1]
curOathSkillLv.value.lv = resetLv ? 1 : 5
return
}
} else if (type == 'nextRarity') {
const index = raritiyList.findIndex((a) => a == curOathSkillLv.value.rarity)
if (index < raritiyList.length - 1) {
curOathSkillLv.value.rarity = raritiyList[index + 1]
curOathSkillLv.value.lv = 1
return
}
} else if (type == 'preLv') {
if (curOathSkillLv.value.lv > 1) {
curOathSkillLv.value.lv--
return
} else {
changeOathSkillLv('preRarity', false)
}
} else if (type == 'nextLv') {
if (curOathSkillLv.value.lv < 5) {
curOathSkillLv.value.lv++
return
} else {
changeOathSkillLv('nextRarity')
}
}
}
const choose_part = ref<string[]>([])
const curEquInfo = computed(() => {
@@ -299,6 +341,32 @@ const curOathInfo = computed(() => {
return infoStore.oathSkills?.[curEquInfo.value?.suit[0]]
})
const curOathSkillLvs = asyncComputed(async () => {
if (!curOathInfo.value || !curEquInfo.value?.suit[0]) {
return undefined
}
const res = await infoStore.getOathInfo(
curEquInfo.value?.suit[0],
oathSkillId.value,
curOathSkillLv.value.rarity,
)
return res
})
const curOathSkillInfo = computed(() => {
const res = curOathSkillLvs.value
if (!res) {
return undefined
}
console.log(curEquInfo.value?.suit[0])
return {
...res,
SkillAttack: parseFloat(res.SkillAttack.toString().split(',')[curOathSkillLv.value.lv - 1]),
Buffer: parseFloat(res.Buffer.toString().split(',')[curOathSkillLv.value.lv - 1]),
point: parseFloat(res.point.toString().split(',')[curOathSkillLv.value.lv - 1]),
}
})
const chooseCategory = (cat: string) => {
type.value = cat
if (type.value == 'oath' && curSuit.value == -1) {
@@ -1,9 +1,156 @@
<template>
<div class="h-180px flex justify-center items-center">
<EmblemList :withBg="true" />
<div class="h-179px flex justify-center items-center">
<EmblemList :withBg="true" v-model:part="part" :detail="configStore.config.emblems" />
</div>
<div class="flex flex-wrap equ-profile">
<div class="equ-profile-item">
<div class="mr-10px row-name">当前槽位</div>
<span>{{ part }}</span>
</div>
<div class="equ-profile-item" v-if="part != '白金'">
<div class="row-name">等级</div>
<calc-select v-model="lv" class="flex-1 !h-20px">
<template v-for="(i, index) in lvs" :key="index">
<calc-option :value="index">{{ i }}</calc-option>
</template>
</calc-select>
</div>
<div class="flex w-full">
<div class="flex-basis-50px text-center mr-10px">徽章</div>
<div class="flex-1 grid gap-4px" :style="emblemGridStyle">
<div
v-for="(emblem, index) in emblemMaxCount"
:style="emblemItemStyle(index)"
class="flex"
:key="index"
>
<calc-select v-model="emblems[index]" class="min-w-0 flex-1 !h-20px">
<template v-for="(i, index) in lvs" :key="index">
<calc-option :value="i">{{ i }}</calc-option>
</template>
</calc-select>
</div>
</div>
</div>
</div>
</template>
<script lang="ts" setup name="Emblems">
import EmblemList from '@/components/dnf/Emblem/List/index.vue'
import { useConfigStore } from '@/stores'
const part = ref('彩色')
const configStore = useConfigStore()
const lvs = [
'稀有Lv.1',
'稀有Lv.2',
'稀有Lv.3',
'稀有Lv.4',
'稀有Lv.5',
'神器Lv.1',
'神器Lv.2',
'神器Lv.3',
'神器Lv.4',
'神器Lv.5',
'传说Lv.1',
'传说Lv.2',
'传说Lv.3',
'传说Lv.4',
'传说Lv.5',
'史诗Lv.1',
]
const emblemMaxCount = computed(() => {
if (part.value == '彩色') {
return 6
}
if (part.value == '白金') {
return 2
}
return 4
})
const emblemGridStyle = computed(() => {
return {
gridTemplateColumns: 'repeat(2, minmax(0, 1fr))',
}
})
const emblemItemStyle = (index: number) => {
const count = emblemMaxCount.value
const remainder = count % 2
if (remainder === 1 && index === count - 1) {
return {
gridColumn: 'span 2 / span 2',
}
}
return {
gridColumn: 'span 1 / span 1',
}
}
const currentInfo = function <T>(name: string, defaultValue?: T) {
return computed<string | number>({
get() {
return (
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(configStore.config.emblems?.[part.value] as Record<string, any>)?.[name] ??
defaultValue ??
0
)
},
set(val) {
if (val == undefined) {
return
}
// if (name == 'emblem_1' && !has_emblem_1.value) {
// // configStore.setForge(part.value, name, 0)
// return
// }
if (!configStore.config.emblems[part.value]) {
configStore.config.emblems[part.value] = { ...configStore.defaultEmblemConfig }
}
if (configStore.config.emblems[part.value]) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
;(configStore.config.emblems[part.value] as Record<string, any>)[name] = val
}
if (part.value == '彩色' && name == 'lv') {
// 同步其他部位的等级
const lv = val as number
for (const p of ['红色', '蓝色', '黄色', '绿色']) {
if (!configStore.config.emblems[p]) {
configStore.config.emblems[p] = { ...configStore.defaultEmblemConfig }
}
if (configStore.config.emblems[p]) {
configStore.config.emblems[p]['lv'] = Math.max(
configStore.config.emblems[p]['lv'] || 0,
lv,
)
}
}
} else if (part.value != '彩色' && name == 'lv') {
// 同步彩色部位的等级
const lv = val as number
if (!configStore.config.emblems['彩色']) {
configStore.config.emblems['彩色'] = { ...configStore.defaultEmblemConfig }
}
if (configStore.config.emblems['彩色']) {
configStore.config.emblems['彩色']['lv'] = Math.min(
configStore.config.emblems['彩色']['lv'] || 0,
lv,
)
}
}
},
})
}
const lv = currentInfo('lv', 0)
const emblems = currentInfo<string[]>('items', ['', '', '', '', '', '']) as unknown as Ref<string[]>
</script>
@@ -81,9 +81,9 @@
alt=""
class="w-20px h-20px object-contain"
/>
<div class="flex items-center justify-center" v-if="adaptation(part) > 0">
<div class="flex items-center justify-center" v-if="oathAdaptation(part) > 0">
<img
:src="getImageURL(`/equipment/adaptation/${adaptation(part)}.png`)"
:src="getImageURL(`/equipment/adaptation/${oathAdaptation(part)}.png`)"
alt=""
class="w-11px h-10px object-contain"
/>
@@ -161,6 +161,13 @@ const adaptation = (part: string) => {
)
}
const oathAdaptation = (part: string) => {
return Math.min(
equ(props.oaths?.[part]?.id)?.max_adaptation ?? 0,
props.oaths[part]?.adaptation ?? 0,
)
}
const lvFormat = (lv: number, rarity: string) => {
if (rarity == '太初') return ''
switch (lv) {