Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
L
Lic
Project
Project
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
Graph
比较
统计图
议题
0
议题
0
列表
看板
标记
Milestones
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
刘旭
Lic
Commits
7b2464e4
提交
7b2464e4
authored
4月 17, 2025
作者:
Administrator
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
添加错误返回
上级
94d803d6
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
28 行增加
和
29 行删除
+28
-29
config.ts
src/services/api/config.ts
+26
-27
licInformation.vue
src/views/business/licInformation.vue
+2
-2
没有找到文件。
src/services/api/config.ts
浏览文件 @
7b2464e4
import
axios
,
{
AxiosInstance
}
from
'axios'
import
axios
,
{
AxiosInstance
}
from
"axios"
;
import
{
ElMessage
}
from
'element-plus'
import
{
ElMessage
}
from
"element-plus"
;
// api路径
// api路径
const
API_URL
:
string
=
import
.
meta
.
env
.
VITE_APP_BASE_URL
const
API_URL
:
string
=
import
.
meta
.
env
.
VITE_APP_BASE_URL
;
const
service
:
AxiosInstance
=
axios
.
create
({
const
service
:
AxiosInstance
=
axios
.
create
({
timeout
:
15000
timeout
:
15000
,
})
})
;
// 请求拦截
// 请求拦截
service
.
interceptors
.
request
.
use
(
service
.
interceptors
.
request
.
use
((
config
)
=>
{
config
=>
{
const
token
=
sessionStorage
.
getItem
(
"token"
);
const
token
=
sessionStorage
.
getItem
(
'token'
)
if
(
token
)
{
if
(
token
)
{
config
.
headers
=
{
'Authorization'
:
`
${
token
}
`
,
...
config
.
headers
}
config
.
headers
=
{
Authorization
:
`
${
token
}
`
,
...
config
.
headers
};
}
}
return
config
return
config
;
}
});
)
// 数据返回拦截
// 数据返回拦截
service
.
interceptors
.
response
.
use
(
service
.
interceptors
.
response
.
use
(
res
=>
{
(
res
)
=>
{
// 数据请求成功后 相应操作
// 数据请求成功后 相应操作
const
responseData
=
res
.
data
const
responseData
=
res
.
data
;
if
(
responseData
.
code
!==
200
)
{
if
(
responseData
.
code
!==
200
)
{
// ElMessage.error(responseData.message)
// ElMessage.error(responseData.message)
}
}
return
responseData
return
responseData
;
},
},
error
=>
{
(
error
)
=>
{
// 数据请求失败后的相应操作
// 数据请求失败后的相应操作
const
response
=
error
.
response
;
const
response
=
error
.
response
;
console
.
log
(
"🚀 ~ response:"
,
response
);
// 根据返回的code值来做不同的处理(和后端约定)
// 根据返回的code值来做不同的处理(和后端约定)
switch
(
response
.
status
)
{
switch
(
response
.
status
)
{
case
401
:
case
401
:
ElMessage
.
error
(
'错误请求'
)
ElMessage
.
error
(
"错误请求"
);
break
;
break
;
case
403
:
case
403
:
// 没有权限
// 没有权限
ElMessage
.
error
(
'没有权限'
)
ElMessage
.
error
(
"没有权限"
);
break
;
break
;
case
500
:
case
500
:
// 服务端错误
// 服务端错误
ElMessage
.
error
(
'服务端错误(500)'
)
ElMessage
.
error
(
"服务端错误(500)"
);
break
;
break
;
case
503
:
case
503
:
// 服务端错误
// 服务端错误
ElMessage
.
error
(
'服务端错误(503)'
)
ElMessage
.
error
(
"服务端错误(503)"
);
break
;
break
;
default
:
default
:
ElMessage
.
error
(
`服务端错误
${
response
.
status
}
`
)
ElMessage
.
error
(
`服务端错误
${
response
.
status
}
`
)
;
break
;
break
;
}
}
return
error
return
error
;
}
}
)
)
;
interface
ParamData
{
interface
ParamData
{
url
:
string
;
url
:
string
;
method
?:
'post'
|
'get'
|
'delete'
|
'put'
;
method
?:
"post"
|
"get"
|
"delete"
|
"put"
;
data
?:
any
;
data
?:
any
;
params
?:
any
;
params
?:
any
;
headers
?:
any
;
headers
?:
any
;
}
}
export
function
request
(
params
:
ParamData
)
{
export
function
request
(
params
:
ParamData
)
{
if
(
params
.
url
.
indexOf
(
'http'
)
===
-
1
)
{
if
(
params
.
url
.
indexOf
(
"http"
)
===
-
1
)
{
params
.
url
=
API_URL
+
params
.
url
params
.
url
=
API_URL
+
params
.
url
;
}
}
return
service
(
params
)
return
service
(
params
)
;
}
}
src/views/business/licInformation.vue
浏览文件 @
7b2464e4
...
@@ -303,7 +303,7 @@ const onConfirm = () => {
...
@@ -303,7 +303,7 @@ const onConfirm = () => {
licInfoRef
.
value
?.
resetFields
();
licInfoRef
.
value
?.
resetFields
();
ElMessage
({
type
:
"success"
,
message
:
"添加成功!"
});
ElMessage
({
type
:
"success"
,
message
:
"添加成功!"
});
licInfoForm
.
dialogVisible
=
false
;
licInfoForm
.
dialogVisible
=
false
;
}
}
else
ElMessage
({
type
:
"error"
,
message
:
res
.
message
});
});
});
}
else
{
}
else
{
licInfoUpdate
(
licInfoForm
.
formLicInfo
).
then
((
res
:
any
)
=>
{
licInfoUpdate
(
licInfoForm
.
formLicInfo
).
then
((
res
:
any
)
=>
{
...
@@ -316,7 +316,7 @@ const onConfirm = () => {
...
@@ -316,7 +316,7 @@ const onConfirm = () => {
licInfoRef
.
value
?.
resetFields
();
licInfoRef
.
value
?.
resetFields
();
ElMessage
({
type
:
"success"
,
message
:
"修改成功!"
});
ElMessage
({
type
:
"success"
,
message
:
"修改成功!"
});
licInfoForm
.
dialogVisible
=
false
;
licInfoForm
.
dialogVisible
=
false
;
}
}
else
ElMessage
({
type
:
"error"
,
message
:
res
.
message
});
});
});
}
}
}
else
{
}
else
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论