Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
micro-customization-system
/
e-shield-h5
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 265d71e7
authored
Jul 22, 2022
by
zhangxw
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
请求域名配置,登录超时处理
1 parent
afdc0e33
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
2 deletions
src/utils/http.js
vue.config.js
src/utils/http.js
View file @
265d71e
import
axios
from
"axios"
;
import
{
Dialog
}
from
"vant"
;
import
store
from
"@/store"
;
import
wx
from
"wx"
;
// 测试 https://eshield.test.glsx.com.cn
// 开发 https://eshield.dev.glsx.com.cn
// 线上
const
BASE_URL
=
"https://eshield.dev.glsx.com.cn"
;
/* eslint-disable */
const
BASE_URL
=
process
.
env
.
NODE_ENV
==
"development"
?
"/miniappserve"
:
location
.
origin
;
const
instance
=
axios
.
create
({
// 创建axios实例,在这里可以设置请求的默认配置
timeout
:
10
*
60
*
1000
,
// 设置超时时间60s
...
...
@@ -51,7 +53,16 @@ instance.interceptors.response.use(
}
return
Promise
.
resolve
(
response
.
data
);
}
else
{
Dialog
({
message
:
response
.
data
.
message
});
Dialog
.
confirm
({
message
:
response
.
data
.
message
,
showCancelButton
:
false
}).
then
(()
=>
{
if
(
serverCode
==
603
||
serverCode
==
604
)
{
// 登录失效
wx
.
miniProgram
.
navigateTo
({
url
:
`../../pages/login/index?isLoginOut=true`
,
});
}
});
return
Promise
.
reject
(
response
.
data
.
message
);
}
},
...
...
vue.config.js
View file @
265d71e
...
...
@@ -15,6 +15,14 @@ module.exports = defineConfig({
transpileDependencies
:
true
,
devServer
:
{
port
:
9527
,
proxy
:
{
'/miniappserve'
:
{
target
:
'https://eshield.dev.glsx.com.cn/'
,
changeOrigin
:
true
,
secure
:
false
,
pathRewrite
:
{
"^/miniappserve"
:
""
},
}
}
},
chainWebpack
:
(
config
)
=>
{
config
.
plugin
(
"webpack-spritesmith"
).
use
(
Spritesmith
,
[
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment