Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
ems3.3
Project
Project
Details
Activity
Releases
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
wuhao
ems3.3
Commits
b3a18d30
Commit
b3a18d30
authored
Nov 08, 2022
by
wuhao
🎯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
asder
parent
befe29c0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
12 deletions
+25
-12
proxy.js
config/proxy.js
+6
-4
global.less
src/global.less
+5
-0
doFetch.js
src/utils/doFetch.js
+12
-4
request.js
src/utils/request.js
+2
-4
No files found.
config/proxy.js
View file @
b3a18d30
...
@@ -13,11 +13,13 @@ export default {
...
@@ -13,11 +13,13 @@ export default {
dev
:
{
dev
:
{
[
defaultSetting
.
proxypath
]:
{
[
defaultSetting
.
proxypath
]:
{
// 要代理的地址
// 要代理的地址
target
:
'http://192.168.40.117:8000'
+
defaultSetting
.
proxypath
,
target
:
'http://192.168.40.117:8000'
,
changeOrigin
:
true
,
},
'/token'
:
{
// 要代理的地址
target
:
'http://192.168.40.117:8000'
,
changeOrigin
:
true
,
changeOrigin
:
true
,
pathRewrite
:
{
[
rewrite
]:
''
,
},
},
},
'/staticfile/'
:
{
'/staticfile/'
:
{
target
:
'http://192.168.40.2/'
,
target
:
'http://192.168.40.2/'
,
...
...
src/global.less
View file @
b3a18d30
...
@@ -382,3 +382,8 @@ ol {
...
@@ -382,3 +382,8 @@ ol {
.diycard {
.diycard {
height: 100% !important;
height: 100% !important;
}
}
.runtime-keep-alive-layout {
> div {
height: 100% !important;
}
}
src/utils/doFetch.js
View file @
b3a18d30
import
request
from
'./request'
;
import
request
from
'./request'
;
import
defaultSetting
from
'../../config/defaultSettings'
;
export
async
function
doFetch
({
url
,
params
})
{
export
async
function
doFetch
({
url
,
params
})
{
if
(
!
url
)
{
if
(
!
url
)
{
return
;
return
;
}
}
return
request
(
url
,
{
if
(
url
.
indexOf
(
'token'
)
!=
-
1
)
{
method
:
'post'
,
return
request
(
url
,
{
data
:
params
,
method
:
'post'
,
});
data
:
params
,
});
}
else
{
return
request
(
defaultSetting
.
proxypath
+
url
,
{
method
:
'post'
,
data
:
params
,
});
}
}
}
export
async
function
postFetch
({
url
,
params
})
{
export
async
function
postFetch
({
url
,
params
})
{
...
...
src/utils/request.js
View file @
b3a18d30
...
@@ -6,7 +6,6 @@ import { extend } from 'umi-request';
...
@@ -6,7 +6,6 @@ import { extend } from 'umi-request';
import
{
message
,
notification
,
Modal
}
from
'antd'
;
import
{
message
,
notification
,
Modal
}
from
'antd'
;
import
{
history
}
from
'@umijs/max'
;
import
{
history
}
from
'@umijs/max'
;
import
qs
from
'query-string'
;
import
qs
from
'query-string'
;
import
defaultSetting
from
'../../config/defaultSettings'
;
const
codeMessage
=
{
const
codeMessage
=
{
200
:
'服务器成功返回请求的数据。'
,
200
:
'服务器成功返回请求的数据。'
,
...
@@ -49,7 +48,6 @@ const errorHandler = (error) => {
...
@@ -49,7 +48,6 @@ const errorHandler = (error) => {
*/
*/
const
request
=
extend
({
const
request
=
extend
({
prefix
:
defaultSetting
.
proxypath
,
//前缀代理
errorHandler
,
errorHandler
,
// 默认错误处理
// 默认错误处理
credentials
:
'include'
,
// 默认请求是否带上cookie
credentials
:
'include'
,
// 默认请求是否带上cookie
...
@@ -62,12 +60,12 @@ request.interceptors.request.use(async (url, options) => {
...
@@ -62,12 +60,12 @@ request.interceptors.request.use(async (url, options) => {
const
headers
=
const
headers
=
options
.
type
==
'form'
options
.
type
==
'form'
?
{
?
{
toke
n
:
'Bearer '
+
token
,
Authorizatio
n
:
'Bearer '
+
token
,
}
}
:
{
:
{
'Content-Type'
:
'application/json'
,
'Content-Type'
:
'application/json'
,
Accept
:
'application/json'
,
Accept
:
'application/json'
,
toke
n
:
'Bearer '
+
token
,
Authorizatio
n
:
'Bearer '
+
token
,
};
};
return
{
return
{
url
:
url
,
url
:
url
,
...
...
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