new:新增技能代码导入
This commit is contained in:
@@ -22,6 +22,10 @@ export default defineRequest((request) => {
|
||||
async getConfigFromHelper(uid: string) {
|
||||
const res = await request.get(`/dnfhelper/${uid}/`)
|
||||
return res.data
|
||||
},
|
||||
async getSkillFromCode(code: string) {
|
||||
const res = await request.post(`/skillTree/`, { code })
|
||||
return res.data
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="tsx">
|
||||
import { useAsyncState } from '@vueuse/core'
|
||||
import { computed, defineComponent, ref, renderList } from 'vue'
|
||||
import { defineComponent, ref } from 'vue'
|
||||
import api from '@/api'
|
||||
import { useDialog } from '@/components/hooks/dialog'
|
||||
import { isShow, onShow } from '@/components/hooks/show'
|
||||
@@ -42,30 +42,6 @@ export default defineComponent({
|
||||
|
||||
const visible = isShow()
|
||||
|
||||
const configList = computed(() => {
|
||||
return Object.keys(state.value ?? {}).sort()
|
||||
})
|
||||
|
||||
async function importConfigs() {
|
||||
// if (window.pywebview) {
|
||||
// const configs = {}
|
||||
// cacheList.value.forEach(key => {
|
||||
// configs[key] = state.value?.[key]
|
||||
// })
|
||||
// await api.importConfigs(configs)
|
||||
// } else {
|
||||
// cacheList.value.forEach(key => {
|
||||
// localStorage.setItem(key, JSON.stringify(state.value?.[key]))
|
||||
// })
|
||||
// }
|
||||
// const { alert } = useDialog()
|
||||
// await alert({
|
||||
// content: "导入成功"
|
||||
// })
|
||||
// visible.value = false
|
||||
// await configStore.load()
|
||||
}
|
||||
|
||||
return () => {
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
<script lang="tsx">
|
||||
import { useAsyncState } from '@vueuse/core'
|
||||
import { defineComponent, ref } from 'vue'
|
||||
import api from '@/api'
|
||||
import { useDialog } from '@/components/hooks/dialog'
|
||||
import { isShow, onShow } from '@/components/hooks/show'
|
||||
import { useConfigStore } from '@/stores'
|
||||
|
||||
export default defineComponent({
|
||||
setup() {
|
||||
const configStore = useConfigStore()
|
||||
const skillCode = ref('')
|
||||
|
||||
const { state, execute, isLoading } = useAsyncState(
|
||||
async () => {
|
||||
const res = await api.getSkillFromCode(skillCode.value)
|
||||
console.log(res)
|
||||
configStore.config.skills = res.skills
|
||||
const { alert } = useDialog()
|
||||
visible.value = false
|
||||
await alert({
|
||||
content: '导入成功',
|
||||
})
|
||||
return res
|
||||
},
|
||||
undefined,
|
||||
{
|
||||
resetOnExecute: false,
|
||||
immediate: false,
|
||||
onError: Promise.reject,
|
||||
},
|
||||
)
|
||||
|
||||
onShow(
|
||||
() => {
|
||||
skillCode.value = ''
|
||||
state.value = undefined
|
||||
},
|
||||
{ immediate: true },
|
||||
)
|
||||
|
||||
const visible = isShow()
|
||||
|
||||
return () => {
|
||||
return (
|
||||
<>
|
||||
<div class="h-35 w-80 py-2 px-4 text-hex-e9c556">
|
||||
<div class="flex justify-around items-center">
|
||||
技能加点代码
|
||||
<calc-input class="!w-60" v-model={skillCode.value} />
|
||||
</div>
|
||||
<div>
|
||||
<p class="text-hex-e9c556/80">
|
||||
* 点击导入后会根据规则解析出技能加点、技能进化、技能强化
|
||||
</p>
|
||||
<p class="text-hex-e9c556/80">
|
||||
* 部分技能可能存在无法识别的情况,需要手动调整
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex justify-around items-center">
|
||||
<calc-button onClick={execute} disabled={!skillCode.value || isLoading.value}>导入</calc-button>
|
||||
<calc-button onClick={() => (visible.value = false)}>取消</calc-button>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
},
|
||||
})
|
||||
</script>
|
||||
@@ -22,18 +22,25 @@
|
||||
<calc-checkbox round v-model="configStore.config.DSB">系统奶</calc-checkbox>
|
||||
<calc-checkbox round v-model="configStore.config.BUFF">组队</calc-checkbox>
|
||||
<calc-button title="打造导入" @click="showImport" class="ml-1" icon="import"></calc-button>
|
||||
<calc-button title="技能导入" @click="showImportSkill" class="ml-1" icon="exchange"></calc-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<calc-dialog lazy header="存档导入" v-model:visible="importVisible">
|
||||
<calc-dialog lazy header="打造导入" v-model:visible="importVisible">
|
||||
<ImportVue></ImportVue>
|
||||
</calc-dialog>
|
||||
|
||||
|
||||
<calc-dialog lazy header="技能导入" v-model:visible="importSkillVisible">
|
||||
<ImportSkillVue></ImportSkillVue>
|
||||
</calc-dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup name="Index">
|
||||
import { useInfoStore } from '@/stores/info'
|
||||
import { useConfigStore } from '@/stores'
|
||||
import ImportVue from './Config/import.vue';
|
||||
import ImportSkillVue from './Config/importSkill.vue';
|
||||
import Result from './Result/Index.vue'
|
||||
const props = defineProps<{
|
||||
alter: string
|
||||
@@ -41,6 +48,7 @@ const props = defineProps<{
|
||||
const infoStore = useInfoStore()
|
||||
const configStore = useConfigStore()
|
||||
const importVisible = ref(false)
|
||||
const importSkillVisible = ref(false)
|
||||
|
||||
const stopWatch = watch(
|
||||
() => {
|
||||
@@ -55,6 +63,9 @@ const showImport = () => {
|
||||
importVisible.value = true
|
||||
}
|
||||
|
||||
const showImportSkill = () => {
|
||||
importSkillVisible.value = true
|
||||
}
|
||||
onMounted(async () => {
|
||||
await infoStore.createCharacter(props.alter, '0')
|
||||
window.addEventListener('beforeunload', () => {
|
||||
|
||||
Reference in New Issue
Block a user