fix:修复审判导入问题
This commit is contained in:
@@ -41,9 +41,10 @@
|
||||
<script setup lang="ts" name="dnfhelper-list">
|
||||
import api from '@/api'
|
||||
import { useDialog } from '@/components/hooks/dialog'
|
||||
import CalcButton from '@/components/calc/button/index.vue'
|
||||
import router from '@/router'
|
||||
import { useDnfHelperStore } from '@/stores/dnfhelper'
|
||||
import { computed } from 'vue'
|
||||
import { computed, h } from 'vue'
|
||||
|
||||
const props = defineProps<{
|
||||
list: {
|
||||
@@ -75,21 +76,55 @@ const chooseRole = ({ roleId }: { roleId: string }) => {
|
||||
acitveRoleId.value = roleId
|
||||
}
|
||||
|
||||
const { alert } = useDialog()
|
||||
const { alert, show, close, randomId } = useDialog()
|
||||
|
||||
const currentRoleInfo = computed(() => {
|
||||
return list.value.find((item) => item.roleId === acitveRoleId.value)
|
||||
})
|
||||
|
||||
const importRole = async () => {
|
||||
if (!acitveRoleId.value) return
|
||||
const alter = await api.alterByName(currentRoleInfo.value?.roleJob || '')
|
||||
const role = currentRoleInfo.value
|
||||
if (!role) return
|
||||
const alter = await api.alterByName(role.roleJob)
|
||||
if (!alter) {
|
||||
return await alert({
|
||||
content: '当前职业尚在开发中,敬请期待。',
|
||||
})
|
||||
} else {
|
||||
return window.open(`/character/equipment/${alter.value}?roleId=${acitveRoleId.value}`, '_blank')
|
||||
}
|
||||
|
||||
const openRole = (value: string) => {
|
||||
return window.open(
|
||||
`/character/equipment/${value}?roleId=${encodeURIComponent(role.roleId)}`,
|
||||
'_blank',
|
||||
)
|
||||
}
|
||||
const options = alter.options ?? []
|
||||
if (options.length > 0) {
|
||||
const id = randomId()
|
||||
return await show({
|
||||
id,
|
||||
content: '请选择职业版本',
|
||||
action: () =>
|
||||
h(
|
||||
'div',
|
||||
{ class: 'flex items-center justify-around flex-wrap', style: 'width:200px' },
|
||||
options.map((option) =>
|
||||
h(
|
||||
CalcButton,
|
||||
{
|
||||
key: option.name,
|
||||
class: '!w-40% !mb-2',
|
||||
onClick: () => {
|
||||
openRole(option.value || option.name)
|
||||
close(id, 'ok')
|
||||
},
|
||||
},
|
||||
() => option.title,
|
||||
),
|
||||
),
|
||||
),
|
||||
})
|
||||
}
|
||||
return openRole(alter.value || alter.name)
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user