@@ -10,9 +10,13 @@ const input = reactive({
10
10
const err1 = ref ()
11
11
const err2 = ref ()
12
12
13
+ const loading1 = ref ()
14
+ const loading2 = ref ()
15
+
13
16
const token = ref ()
14
17
15
18
async function getVerifyCode() {
19
+ loading1 .value = true
16
20
const res = await fetch (' https://api.nn.ci/alist/wopan/login' , {
17
21
method: ' POST' ,
18
22
headers: {
@@ -21,12 +25,14 @@ async function getVerifyCode() {
21
25
body: JSON .stringify (input )
22
26
})
23
27
const data = await res .json ()
28
+ loading1 .value = false
24
29
if (data .error ) {
25
30
err1 .value = data .error
26
31
return
27
32
}
28
33
}
29
34
async function getToken() {
35
+ loading2 .value = true
30
36
const res = await fetch (' https://api.nn.ci/alist/wopan/verify_code' , {
31
37
method: ' POST' ,
32
38
headers: {
@@ -35,6 +41,7 @@ async function getToken() {
35
41
body: JSON .stringify (input )
36
42
})
37
43
const data = await res .json ()
44
+ loading2 .value = false
38
45
if (data .error ) {
39
46
err2 .value = data .error
40
47
return
@@ -50,12 +57,12 @@ async function getToken() {
50
57
51
58
<NInput size =" large" placeholder =" Phone number" v-model:value =" input.phone" ></NInput >
52
59
<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 >
54
61
<NAlert title =" Error" type =" error" v-if =" err1" >
55
62
{{ err1 }}
56
63
</NAlert >
57
64
<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 >
59
66
<NAlert title =" Error" type =" error" v-if =" err2" >
60
67
{{ err2 }}
61
68
</NAlert >
0 commit comments