Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CivManage
Project
Project
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
ReactWeb5
CivManage
Commits
57c4eeab
Commit
57c4eeab
authored
4 years ago
by
Maofei94
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf: 修改请求地址
parent
adb59167
Pipeline
#22194
skipped with stages
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
29 deletions
+14
-29
context.js
src/components/Upload/context.js
+2
-18
index.js
src/containers/App/store/index.js
+1
-0
index.js
src/pages/user/login/index.js
+2
-4
index.js
src/services/index.js
+2
-7
index.js
src/utils/request/index.js
+7
-0
No files found.
src/components/Upload/context.js
View file @
57c4eeab
import
{
getImageBases
,
gateWayConfig
}
from
'@/services/common/api'
;
import
{
getImageBases
}
from
'@/services/common/api'
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
const
UploadContext
=
React
.
createContext
();
...
...
@@ -25,27 +25,11 @@ const PictureWallProvider = props => {
.
catch
(
err
=>
{
// eslint-disable-next-line no-console
console
.
error
(
err
);
return
sleep
(
3
000
).
then
(
update
);
return
sleep
(
15
000
).
then
(
update
);
});
useEffect
(()
=>
{
update
();
},
[]);
// const updateDicName = () => {
// gateWayConfig()
// .then(res => {
// if (res.code === 0 && res.data) {
// window.DicNameSERVICE = 'GateWay';
// } else {
// window.DicNameSERVICE = '';
// }
// })
// .catch(err => {
// window.DicNameSERVICE = '';
// });
// };
// useEffect(() => {
// updateDicName();
// }, []);
return
(
<
UploadContext
.
Provider
value
=
{{
imgBed
,
update
}}
>
{
children
}
...
...
This diff is collapsed.
Click to expand it.
src/containers/App/store/index.js
View file @
57c4eeab
...
...
@@ -18,6 +18,7 @@ const mapDispatch = dispatch => ({
setAuth
:
auth
=>
dispatch
(
actionCreators
.
setAuth
(
auth
)),
logout
:
()
=>
{
localStorage
.
setItem
(
'token'
,
''
);
localStorage
.
setItem
(
'panda-publish'
,
''
);
dispatch
(
actionCreators
.
setAuth
([]));
},
setUserMode
:
userMode
=>
dispatch
(
actionCreators
.
setUserMode
(
userMode
)),
...
...
This diff is collapsed.
Click to expand it.
src/pages/user/login/index.js
View file @
57c4eeab
...
...
@@ -88,13 +88,11 @@ const Login = props => {
gateWayConfig
()
.
then
(
res
=>
{
if
(
res
.
code
===
0
&&
res
.
data
)
{
window
.
DicNameSERVICE
=
'GateWay'
;
}
else
{
window
.
DicNameSERVICE
=
''
;
localStorage
.
setItem
(
'panda-publish'
,
'getway'
);
}
})
.
catch
(
err
=>
{
window
.
DicNameSERVICE
=
''
;
console
.
error
(
err
)
;
});
};
useEffect
(()
=>
{
...
...
This diff is collapsed.
Click to expand it.
src/services/index.js
View file @
57c4eeab
import
{
request
}
from
'../utils/request'
;
let
isGateWay
=
false
;
console
.
log
(
window
,
'window'
,
isGateWay
);
const
CITY_SERVICE
=
isGateWay
?
'/Publish/GateWay/CityServer'
:
'/Cityinterface/rest/services'
;
const
CITY_SERVICE
=
'/Cityinterface/rest/services'
;
// export const CITY_SERVICE = '/Publish/GateWay/CityServer';
const
PUBLISH_SERVICE
=
isGateWay
?
'/Publish/GateWay/OMS'
:
'/Publish/OMS'
;
const
PUBLISH_SERVICE
=
'/Publish/OMS'
;
// export const PUBLISH_SERVICE = '/Publish/GateWay/OMS';
console
.
log
(
CITY_SERVICE
,
PUBLISH_SERVICE
);
const
get
=
async
(
url
,
params
,
options
=
{})
=>
request
({
url
,
...
...
This diff is collapsed.
Click to expand it.
src/utils/request/index.js
View file @
57c4eeab
...
...
@@ -29,9 +29,16 @@ const getMatchedConfig = requestConfig => {
axios
.
defaults
.
withCredentials
=
true
axios
.
interceptors
.
request
.
use
(
function
(
request
){
const
token
=
localStorage
.
getItem
(
'token'
)
const
pandaPublish
=
localStorage
.
getItem
(
'panda-publish'
)
const
getWay
=
'/Publish/GateWay'
if
(
token
){
request
.
headers
.
Authorization
=
'Bearer '
+
token
}
if
(
pandaPublish
){
if
(
request
.
url
!=
'/Publish/OMS/OMSLogin'
)
request
.
url
=
getWay
+
request
.
url
}
console
.
log
(
getWay
)
return
request
},
function
(
error
)
{
// Any status codes that falls outside the range of 2xx cause this function to trigger
...
...
This diff is collapsed.
Click to expand it.
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