This commit is contained in:
西瓜°
2026-04-19 15:47:44 +08:00
parent 97da529e35
commit dbf33477d9
12 changed files with 182 additions and 109 deletions
@@ -18,7 +18,7 @@
<Suit v-show="equTab === 0"></Suit>
<Universal v-show="equTab === 1"></Universal>
</calc-collapse>
<calc-collapse title="融合石">
<calc-collapse title="誓约">
<calc-tabs v-model="stoneTab" class="!mb-2">
<calc-tab :value="0">套装</calc-tab>
<calc-tab :value="1">通宝</calc-tab>
@@ -15,10 +15,10 @@
<div class="w-auto text-18px flex items-center justify-center !font-normal">|</div>
<div
class="flex-1 text-15px flex items-center justify-center"
@click="chooseCategory('stone')"
:class="{ active: type === 'stone' }"
@click="chooseCategory('oath')"
:class="{ active: type === 'oath' }"
>
融合石
誓约
</div>
</div>
<div
@@ -126,11 +126,11 @@ import PartSelect from '@/components/dnf/Equipment/PartSelect/index.vue'
import EquipmentRaritySelect from '@/components/dnf/Equipment/RaritySelect/index.vue'
import { getImageURL } from '@/utils/images'
import { rarityClass } from '@/utils'
import type { IEquipment } from '@/api/info/type'
import type { IEquipment, IOathInfo } from '@/api/info/type'
import EquipmentIcon from '@/components/dnf/Equipment/Icon/index.vue'
import Info from '@/components/dnf/Equipment/Info/index.vue'
import SuitInfo from '@/components/dnf/Equipment/SuitInfo/index.vue'
import { formatEqu, formatStone } from './formatData'
import { formatEqu, formatOath } from './formatData'
import options from './components/options.vue'
// const props = defineProps<{
@@ -197,7 +197,7 @@ const curEquInfo = computed(() => {
if (type.value == 'equ') {
return infoStore.equips.find((a) => a.id == curEquId.value)
} else {
return infoStore.stones.find((a) => a.id == curEquId.value)
return infoStore.oaths.find((a) => a.id == curEquId.value)
}
})
@@ -215,7 +215,7 @@ const curSuitInfo = computed(() => {
const chooseCategory = (cat: string) => {
type.value = cat
if (type.value == 'stone' && curSuit.value == -1) {
if (type.value == 'oath' && curSuit.value == -1) {
curSuit.value = 16203
}
}
@@ -240,14 +240,14 @@ const suitList = computed(() => {
const equs = computed(() => {
// 筛选出装备
const total = (type.value == 'equ' ? infoStore.equips : infoStore.stones).filter(
const total = (type.value == 'equ' ? infoStore.equips : infoStore.oaths).filter(
(a) =>
(!curRarity.value || a.rarity === curRarity.value) &&
(choose_part.value.length === 0 ||
choose_part.value.includes(a.itemDetailType || a.itemType)) &&
(a.suit.length == 0 ||
(curSuit.value == -1 && a.suit.length > 1 && type.value == 'equ') ||
(a.suit.length > 1 && type.value == 'stone') ||
(a.suit.length > 1 && type.value == 'oath') ||
(a.suit.includes(curSuit.value.toString()) && a.suit.length === 1)),
)
@@ -258,7 +258,10 @@ const equs = computed(() => {
suitList.value.find((a) => a.value == curSuit.value)?.name,
)
} else {
return formatStone(total, suitList.value.find((a) => a.value == curSuit.value)?.name)
return formatOath(
total as unknown as IOathInfo[],
suitList.value.find((a) => a.value == curSuit.value),
)
}
})
@@ -272,7 +275,7 @@ const isActive = computed(() => {
return configStore.config.equips[item.itemDetailType].id == item.id
}
} else {
return configStore.config.equips[item.itemDetailType].fusion == item.id
// return configStore.config.equips[item.itemDetailType].fusion == item.id
}
}
})
@@ -1,4 +1,4 @@
import type { IEquipment } from '@/api/info/type'
import type { IEquipment, IOathInfo } from '@/api/info/type'
export const rowCount = 10
@@ -7,23 +7,25 @@ export const formatEqu = (total: IEquipment[], subweapons?: string[], curSuit?:
const item_weapon = total.filter((a) => a.itemType == '武器') ?? []
const weapons: (IEquipment | undefined)[] = []
if (item_weapon.length > 0) {
Array.from(new Set(item_weapon.map((item) => item.rarity))).filter(a=>!['稀有','神器'].includes(a)).forEach((rarity) => {
const weapon = item_weapon
.filter((item) => item.rarity === rarity)
.sort((a, b) => {
if (a.categorize == b.categorize) {
return a.itemDetailType.localeCompare(b.itemDetailType)
}
return b.categorize.localeCompare(a.categorize)
})
weapons.push(
...weapon.filter((a) => !['传世武器升级', '狄瑞吉传世武器'].includes(a.categorize)),
)
const remind = weapons.length % rowCount
if (remind > 0) {
weapons.push(...Array(rowCount - remind).fill(undefined))
}
})
Array.from(new Set(item_weapon.map((item) => item.rarity)))
.filter((a) => !['稀有', '神器'].includes(a))
.forEach((rarity) => {
const weapon = item_weapon
.filter((item) => item.rarity === rarity)
.sort((a, b) => {
if (a.categorize == b.categorize) {
return a.itemDetailType.localeCompare(b.itemDetailType)
}
return b.categorize.localeCompare(a.categorize)
})
weapons.push(
...weapon.filter((a) => !['传世武器升级', '狄瑞吉传世武器'].includes(a.categorize)),
)
const remind = weapons.length % rowCount
if (remind > 0) {
weapons.push(...Array(rowCount - remind).fill(undefined))
}
})
if (item_weapon.some((a) => a.categorize === '传世武器升级')) {
const length = item_weapon.filter((a) => a.categorize === '传世武器升级').length
weapons.push(...Array(length).fill(undefined))
@@ -88,9 +90,13 @@ export const formatEqu = (total: IEquipment[], subweapons?: string[], curSuit?:
(equip) => equip.categorize.includes('套装') || equip.categorize.includes('通宝'),
)
const suits: (IEquipment | undefined)[] = []
const raritiyList = Array.from(new Set(item_suits.map((item) => item.rarity))).filter(a=>!['稀有','神器'].includes(a))
const raritiyList = Array.from(new Set(item_suits.map((item) => item.rarity))).filter(
(a) => !['稀有', '神器'].includes(a),
)
raritiyList.forEach((rarity) => {
const armor = item_suits.filter((item) => item.rarity === rarity && item.itemType === '防具' && !item.name.includes("侵蚀"))
const armor = item_suits.filter(
(item) => item.rarity === rarity && item.itemType === '防具' && !item.name.includes('侵蚀'),
)
if (armor.length > 0) {
suits.push(...armor, undefined)
}
@@ -119,7 +125,9 @@ export const formatEqu = (total: IEquipment[], subweapons?: string[], curSuit?:
suits.push(...Array(rowCount - (suits.length % rowCount)).fill(undefined))
}
const armorUpgrade = item_suits.filter((item) => item.rarity === rarity && item.itemType === '防具' && item.name.includes("侵蚀"))
const armorUpgrade = item_suits.filter(
(item) => item.rarity === rarity && item.itemType === '防具' && item.name.includes('侵蚀'),
)
if (armorUpgrade.length > 0) {
suits.push(...armorUpgrade)
}
@@ -283,3 +291,32 @@ export const formatStone = (total: IEquipment[], curSuit?: string) => {
// },
]
}
export const formatOath = (
total: IOathInfo[],
curSuit?: { name: string; value: number; imageUrl: string },
) => {
// oath
const oath = total.filter((equip) => equip.itemDetailType == '誓约')
oath.push(...Array(rowCount - (oath.length % rowCount)).fill(undefined))
// primer
const primer = []
const primerItem = total.filter((equip) => equip.itemDetailType == '星蕴石')
for (let i = 0; i < 11; i++) {
const temp = primerItem.filter((a) => a.position.includes(i.toString()))
primer.push(
...temp,
...Array(temp.length == 0 ? rowCount : rowCount - (temp.length % rowCount)).fill(undefined),
)
}
return [
{
name: `${curSuit?.name} 誓约`,
equs: oath,
},
{
name: `${curSuit?.name} 星蕴石`,
equs: primer,
},
]
}