@@ -10,9 +10,13 @@ const input = reactive({
1010const err1 = ref ()
1111const err2 = ref ()
1212
13+ const loading1 = ref ()
14+ const loading2 = ref ()
15+
1316const token = ref ()
1417
1518async function getVerifyCode() {
19+ loading1 .value = true
1620 const res = await fetch (' https://api.nn.ci/alist/wopan/login' , {
1721 method: ' POST' ,
1822 headers: {
@@ -21,12 +25,14 @@ async function getVerifyCode() {
2125 body: JSON .stringify (input )
2226 })
2327 const data = await res .json ()
28+ loading1 .value = false
2429 if (data .error ) {
2530 err1 .value = data .error
2631 return
2732 }
2833}
2934async function getToken() {
35+ loading2 .value = true
3036 const res = await fetch (' https://api.nn.ci/alist/wopan/verify_code' , {
3137 method: ' POST' ,
3238 headers: {
@@ -35,6 +41,7 @@ async function getToken() {
3541 body: JSON .stringify (input )
3642 })
3743 const data = await res .json ()
44+ loading2 .value = false
3845 if (data .error ) {
3946 err2 .value = data .error
4047 return
@@ -50,12 +57,12 @@ async function getToken() {
5057
5158 <NInput size =" large" placeholder =" Phone number" v-model:value =" input.phone" ></NInput >
5259 <NInput size =" large" placeholder =" Password" v-model:value =" input.password" type =" password" ></NInput >
53- <NButton type =" primary" size =" large" block @click =" getVerifyCode" >Get Verify Code</NButton >
60+ <NButton type =" primary" secondary size =" large" block @click =" getVerifyCode" :loading = " loading1 " >Get Verify Code</NButton >
5461 <NAlert title =" Error" type =" error" v-if =" err1" >
5562 {{ err1 }}
5663 </NAlert >
5764 <NInput size =" large" placeholder =" Verify code" v-model:value =" input.verify_code" ></NInput >
58- <NButton type =" primary" size =" large" block @click =" getToken" >Get Token</NButton >
65+ <NButton type =" primary" size =" large" block @click =" getToken" :loading = " loading2 " >Get Token</NButton >
5966 <NAlert title =" Error" type =" error" v-if =" err2" >
6067 {{ err2 }}
6168 </NAlert >
0 commit comments