11import { computed , defineComponent , onMounted , PropType , ref , watch } from "vue" ;
22import { NButton , NCheckbox , NDivider , NFlex , NFormItem , NInput , NModal , NScrollbar , NSwitch , useDialog } from "naive-ui" ;
3- import { Config , GameModInfo } from "@/client/apiGen" ;
3+ import { Config , GameEdition , GameModInfo } from "@/client/apiGen" ;
44import comments from './modComments.yaml' ;
55import api from "@/client/api" ;
66import { capitalCase } from "change-case" ;
@@ -30,6 +30,7 @@ export default defineComponent({
3030 const installingMelonLoader = ref ( false )
3131 const installingAquaMai = ref ( false )
3232 const showAquaMaiInstallDone = ref ( false )
33+ const showVersionSelect = ref ( false ) ;
3334
3435 onMounted ( async ( ) => {
3536 config . value = ( await api . GetAquaMaiConfig ( ) ) . data ;
@@ -47,12 +48,17 @@ export default defineComponent({
4748 }
4849 }
4950
50- const installAquaMai = async ( ) => {
51+ const installAquaMai = async ( version ?: GameEdition ) => {
52+ showVersionSelect . value = false
5153 if ( showAquaMaiInstallDone . value ) return
54+ if ( ! version ) {
55+ showVersionSelect . value = true
56+ return
57+ }
5258 try {
5359 // 但是你根本看不到这个加载图标,因为太快了
5460 installingAquaMai . value = true
55- await api . InstallAquaMai ( )
61+ await api . InstallAquaMai ( { version } )
5662 await props . refresh ( )
5763 showAquaMaiInstallDone . value = true
5864 setTimeout ( ( ) => showAquaMaiInstallDone . value = false , 3000 ) ;
@@ -85,7 +91,7 @@ export default defineComponent({
8591 { props . info . aquaMaiInstalled ?
8692 props . info . aquaMaiVersion === props . info . bundledAquaMaiVersion ? < span class = "c-green-6" > 已安装</ span > : < span class = "c-orange" > 可更新</ span > :
8793 < span class = "c-red-6" > 未安装</ span > }
88- < NButton secondary loading = { installingAquaMai . value } onClick = { installAquaMai }
94+ < NButton secondary loading = { installingAquaMai . value } onClick = { ( ) => installAquaMai ( ) }
8995 type = { showAquaMaiInstallDone . value ? 'success' : 'default' } >
9096 { showAquaMaiInstallDone . value ? < span class = "i-material-symbols-done" /> : props . info . aquaMaiInstalled ? '重新安装 / 更新' : '安装' }
9197 </ NButton >
@@ -110,6 +116,17 @@ export default defineComponent({
110116 </ > ) }
111117 </ NScrollbar > }
112118 </ NFlex >
119+ < NModal
120+ preset = "card"
121+ class = "w-[min(50vw,50em)]"
122+ title = "请选择你的游戏类型"
123+ v-model :show = { showVersionSelect . value }
124+ >
125+ < NFlex vertical >
126+ < NButton secondary onClick = { ( ) => installAquaMai ( GameEdition . SDGA ) } > SDGA</ NButton >
127+ < NButton secondary onClick = { ( ) => installAquaMai ( GameEdition . SDEZ ) } > SDEZ</ NButton >
128+ </ NFlex >
129+ </ NModal >
113130 </ NModal > ;
114131 }
115132} )
0 commit comments