Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
support
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
苏文标
support
Commits
39469e46
Commit
39469e46
authored
Nov 01, 2023
by
杨灿
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update:优化接口调用
parent
9b7bc9db
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
3 deletions
+31
-3
login.ts
src/api/login.ts
+10
-0
request.ts
src/api/request.ts
+10
-2
staff.ts
src/api/staff.ts
+10
-0
HomeView.vue
src/views/HomeView.vue
+1
-1
No files found.
src/api/login.ts
0 → 100644
View file @
39469e46
import
request
from
'./request'
;
// 请替换成你实际使用的请求库
// 定义一个登录请求的函数
export
const
login
=
async
(
email
:
string
,
password
:
string
)
=>
{
const
result
=
await
request
({
method
:
'POST'
,
url
:
`/auth/login?login=
${
email
}
&password=
${
password
}
`
,
});
return
result
.
data
;
// 返回请求成功时的数据
};
src/api/request.ts
View file @
39469e46
...
...
@@ -59,9 +59,17 @@ instance.interceptors.response.use(
);
// 封装请求函数
const
request
=
<
T
>
(
config
:
InternalAxiosRequestConfig
):
Promise
<
InternalAxiosRequestConfig
>
=>
{
return
instance
.
request
(
config
);
const
request
=
async
<
T
>
(
config
:
InternalAxiosRequestConfig
):
Promise
<
InternalAxiosRequestConfig
>
=>
{
try
{
const
response
=
await
instance
.
request
(
config
);
return
response
;
}
catch
(
error
)
{
// 在这里处理错误
console
.
error
(
'Request error:'
,
error
);
return
Promise
.
reject
(
error
);
}
};
export
default
request
;
src/api/staff.ts
0 → 100644
View file @
39469e46
import
request
from
'./request'
;
// 请替换成你实际使用的请求库
// 定义一个登录请求的函数
export
const
login
=
async
(
email
:
string
,
password
:
string
)
=>
{
const
result
=
await
request
({
method
:
'POST'
,
url
:
`/auth/login?login=
${
email
}
&password=
${
password
}
`
,
});
return
result
.
data
;
// 返回请求成功时的数据
};
src/views/HomeView.vue
View file @
39469e46
...
...
@@ -7,7 +7,7 @@
text-color=
"#fff"
style=
"width:220px;"
>
<div
style=
"height:50xp;line-height:50px;"
>
<div
style=
"height:50xp;line-height:50px;
text-align: center;
"
>
<img
style=
"width:32px;height:32px;vertical-align:middle;margin-right:10px;"
src=
"../assets/logo.ico"
alt=
""
>
<span
style=
"font-size: 18px;font-weight:bold;color:#fff;position: relative;top:3px;"
>
欧畅云技术支持
</span>
</div>
...
...
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