Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
standalone-anyremote
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
qlintonger xeno
standalone-anyremote
Commits
2c001a80
Commit
2c001a80
authored
May 06, 2024
by
pangchong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 优化alova
parent
ef68a0e3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
7 deletions
+17
-7
src/api/alova-instance.ts
+2
-2
src/views/login/index.vue
+15
-5
No files found.
src/api/alova-instance.ts
View file @
2c001a80
...
...
@@ -66,11 +66,11 @@ export const alova = createAlova({
// 响应拦截器
responded
:
{
// 当使用GlobalFetch请求适配器时,第一个参数接收Response对象
onSuccess
:
async
(
response
)
=>
{
onSuccess
:
async
(
response
,
method
)
=>
{
if
(
response
.
status
>=
400
)
{
throw
new
Error
(
response
.
statusText
)
}
if
(
response
.
url
.
endsWith
(
'/admin/getCaptcha'
)
)
{
if
(
method
.
meta
.
blob
)
{
return
await
response
.
blob
()
}
const
json
=
await
response
.
json
()
...
...
src/views/login/index.vue
View file @
2c001a80
...
...
@@ -87,11 +87,21 @@ loginSuccess(({ data: res }) => {
//获取验证码
const
loginCode
=
ref
(
''
)
const
getCaptcha
=
async
()
=>
{
alova
.
Post
(
'/admin/getCaptcha'
,
{
username
:
loginForm
.
username
}).
then
((
blob
:
any
)
=>
{
if
(
blob
)
{
loginCode
.
value
=
URL
.
createObjectURL
(
blob
)
}
})
alova
.
Post
(
'/admin/getCaptcha'
,
{
username
:
loginForm
.
username
},
{
meta
:
{
blob
:
true
}
}
)
.
then
((
blob
:
any
)
=>
{
if
(
blob
)
{
loginCode
.
value
=
URL
.
createObjectURL
(
blob
)
}
})
}
watch
(
()
=>
loginForm
.
username
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment