init
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
<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 uid = ref('')
|
||||
|
||||
const { state, execute, isLoading } = useAsyncState(
|
||||
async () => {
|
||||
const res = await api.getConfigFromHelper(uid.value)
|
||||
configStore.config.equips = res.equips
|
||||
configStore.config.avatar = res.avatars
|
||||
configStore.config.avatarLink = res.avatarLink
|
||||
configStore.config.emblems = res.emblems
|
||||
configStore.config.sundry.fog = res.fogOathLv
|
||||
configStore.config.oaths = res.oaths
|
||||
const { alert } = useDialog()
|
||||
visible.value = false
|
||||
await alert({
|
||||
content: '导入成功',
|
||||
})
|
||||
return res
|
||||
},
|
||||
undefined,
|
||||
{
|
||||
resetOnExecute: false,
|
||||
immediate: false,
|
||||
onError: Promise.reject,
|
||||
},
|
||||
)
|
||||
|
||||
onShow(
|
||||
() => {
|
||||
uid.value = ''
|
||||
state.value = undefined
|
||||
},
|
||||
{ immediate: true },
|
||||
)
|
||||
|
||||
const visible = isShow()
|
||||
|
||||
return () => {
|
||||
return (
|
||||
<>
|
||||
<div class="h-30 w-80 py-2 px-4 text-#e9c556">
|
||||
<div class="flex justify-around items-center">
|
||||
助手社区ID
|
||||
<calc-input class="!w-60" v-model={uid.value} />
|
||||
</div>
|
||||
<div>
|
||||
<p class="text-#e9c556/80">* 点击导入后会从助手通过文字识别获取打造</p>
|
||||
<p class="text-#e9c556/80">* 部分打造无法获取,此处仅做快捷导入</p>
|
||||
</div>
|
||||
<div class="flex justify-around items-center">
|
||||
<calc-button onClick={execute} disabled={isLoading.value}>
|
||||
导入
|
||||
</calc-button>
|
||||
<calc-button onClick={() => (visible.value = false)}>取消</calc-button>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
},
|
||||
})
|
||||
</script>
|
||||
@@ -0,0 +1,80 @@
|
||||
<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'
|
||||
import { type IHelperRoleInfo } from '@/api/info/type'
|
||||
|
||||
export default defineComponent({
|
||||
props: {
|
||||
alter: {
|
||||
type: Object as () => IHelperRoleInfo,
|
||||
},
|
||||
uid: {
|
||||
type: String,
|
||||
},
|
||||
},
|
||||
setup(props) {
|
||||
const configStore = useConfigStore()
|
||||
const { state, execute, isLoading } = useAsyncState(
|
||||
async () => {
|
||||
const res = await api.getConfigFromHelperAlter(props.uid || '', props.alter?.roleId || '')
|
||||
configStore.config.equips = res.equips
|
||||
configStore.config.avatar = res.avatars
|
||||
configStore.config.avatarLink = res.avatarLink
|
||||
configStore.config.emblems = res.emblems
|
||||
configStore.config.sundry.fog = res.fogOathLv
|
||||
configStore.config.oaths = res.oaths
|
||||
const { alert } = useDialog()
|
||||
visible.value = false
|
||||
await alert({
|
||||
content: '导入成功',
|
||||
})
|
||||
return res
|
||||
},
|
||||
undefined,
|
||||
{
|
||||
resetOnExecute: false,
|
||||
immediate: false,
|
||||
onError: Promise.reject,
|
||||
},
|
||||
)
|
||||
|
||||
onShow(
|
||||
() => {
|
||||
state.value = undefined
|
||||
},
|
||||
{ immediate: true },
|
||||
)
|
||||
|
||||
const visible = isShow()
|
||||
|
||||
return () => {
|
||||
return (
|
||||
<>
|
||||
<div class="h-45 w-80 py-2 px-4 text-#e9c556">
|
||||
<div class="flex justify-around items-center flex-col gap-1">
|
||||
<div>检测到以下信息,是否导入助手数据?</div>
|
||||
<div class="text-#DED29A">{props.alter?.roleName}</div>
|
||||
<div class="text-#908150">{props.alter?.roleJob}</div>
|
||||
<div class="text-#3ea74e">名望:{props.alter?.fame}</div>
|
||||
</div>
|
||||
<div>
|
||||
<p class="text-#e9c556/80">* 点击导入后会从助手通过文字识别获取打造</p>
|
||||
<p class="text-#e9c556/80">* 部分打造无法获取,此处仅做快捷导入</p>
|
||||
</div>
|
||||
<div class="flex justify-around items-center">
|
||||
<calc-button onClick={execute} disabled={isLoading.value}>
|
||||
导入
|
||||
</calc-button>
|
||||
<calc-button onClick={() => (visible.value = false)}>取消</calc-button>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
},
|
||||
})
|
||||
</script>
|
||||
@@ -0,0 +1,71 @@
|
||||
<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-#e9c556">
|
||||
<div class="flex justify-around items-center">
|
||||
技能加点代码
|
||||
<calc-input class="!w-60" v-model={skillCode.value} />
|
||||
</div>
|
||||
<div>
|
||||
<p class="text-#e9c556/80">
|
||||
*
|
||||
点击导入后会根据规则解析出技能加点、技能进化、技能强化
|
||||
</p>
|
||||
<p class="text-#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>
|
||||
Reference in New Issue
Block a user