Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
E
exhibition_backstage
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
龙菲
exhibition_backstage
Commits
588793f0
提交
588793f0
authored
7月 18, 2022
作者:
龙菲
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改环境变量
上级
981db5ed
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
6 行增加
和
13 行删除
+6
-13
.env.development
.env.development
+1
-1
.env.production
.env.production
+1
-1
.env.staging
.env.staging
+1
-3
request.js
src/utils/request.js
+3
-8
没有找到文件。
.env.development
浏览文件 @
588793f0
...
@@ -2,4 +2,4 @@
...
@@ -2,4 +2,4 @@
ENV = 'development'
ENV = 'development'
# base api
# base api
VUE_APP_BASE_API = '
http://172.24.100.189:8080
'
VUE_APP_BASE_API = '
/api
'
.env.production
浏览文件 @
588793f0
...
@@ -2,5 +2,5 @@
...
@@ -2,5 +2,5 @@
ENV = 'production'
ENV = 'production'
# base api
# base api
VUE_APP_BASE_API = '
/prod-
api'
VUE_APP_BASE_API = '
http://222.85.214.245:9066/
api'
.env.staging
浏览文件 @
588793f0
NODE_ENV = production
# just a flag
# just a flag
ENV = 'staging'
ENV = 'staging'
# base api
# base api
VUE_APP_BASE_API = '
/stage-
api'
VUE_APP_BASE_API = '
http://222.85.214.245:9066/
api'
src/utils/request.js
浏览文件 @
588793f0
...
@@ -7,23 +7,18 @@ import store from '@/store'
...
@@ -7,23 +7,18 @@ import store from '@/store'
import
{
import
{
getToken
getToken
}
from
'@/utils/auth'
}
from
'@/utils/auth'
console
.
log
(
'back-process.env'
,
process
.
env
);
// create an axios instance
// create an axios instance
const
service
=
axios
.
create
({
const
service
=
axios
.
create
({
// baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url
// baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url
// withCredentials: true, // send cookies when cross-domain requests
// withCredentials: true, // send cookies when cross-domain requests
baseURL
:
'/api'
,
baseURL
:
process
.
env
.
VUE_APP_BASE_API
,
timeout
:
5000
,
timeout
:
5000
,
// headers: {
// 'Accept': 'image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;',
// 'Content-Type': 'image/gif'
// }
})
})
// request interceptor
// request interceptor
service
.
interceptors
.
request
.
use
(
service
.
interceptors
.
request
.
use
(
config
=>
{
config
=>
{
// do something before request is sent
// do something before request is sent
if
(
getToken
())
{
if
(
getToken
())
{
// let each request carry token
// let each request carry token
// ['X-Token'] is a custom headers key
// ['X-Token'] is a custom headers key
...
@@ -55,7 +50,7 @@ service.interceptors.response.use(
...
@@ -55,7 +50,7 @@ service.interceptors.response.use(
response
=>
{
response
=>
{
const
res
=
response
.
data
const
res
=
response
.
data
// console.log('响应拦截res--------',response);
// console.log('响应拦截res--------',response);
if
(
response
.
config
.
url
===
'/api/sys/getVerify'
)
{
if
(
response
.
config
.
url
.
indexOf
(
'sys/getVerify'
)
!=
-
1
)
{
// debugger
// debugger
return
res
return
res
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论