Commit c2a04e55 authored by 邓晓峰's avatar 邓晓峰

fix: 修复网关接口地址

parent dce83fea
......@@ -5,9 +5,9 @@
"requires": true,
"dependencies": {
"@ahooksjs/use-request": {
"version": "2.8.12",
"resolved": "https://g.civnet.cn:4873/@ahooksjs%2fuse-request/-/use-request-2.8.12.tgz",
"integrity": "sha1-UjTV14I9d1noe9hvbdvkA2gJCQM=",
"version": "2.8.13",
"resolved": "https://g.civnet.cn:4873/@ahooksjs%2fuse-request/-/use-request-2.8.13.tgz",
"integrity": "sha1-Ws5ThZ/ra0/p68vy5ymCu5t9s4M=",
"requires": {
"lodash.debounce": "^4.0.8",
"lodash.throttle": "^4.1.1"
......@@ -6315,9 +6315,9 @@
}
},
"@wisdom-utils/utils": {
"version": "0.0.52",
"resolved": "https://g.civnet.cn:4873/@wisdom-utils%2futils/-/utils-0.0.52.tgz",
"integrity": "sha512-kLR2Ic36e4xjZw39hDSMViSQKkCy5oFhlqGI0fRMsYn1knHE24uC5dZ5T+M+i5DbC6QqjslUmj6lnDsf1DzeNA==",
"version": "0.0.54",
"resolved": "https://g.civnet.cn:4873/@wisdom-utils%2futils/-/utils-0.0.54.tgz",
"integrity": "sha512-8VDN3nhybSq2MiC7glgmNm+v9kvYnHOzvTuAKEA15ZbRNejTDr3STdZMW6NukF8+/zRixovdAJj80WkbBrXc4Q==",
"requires": {
"@ahooksjs/use-request": "^2.0.0",
"axios": "^0.21.1",
......@@ -104,7 +104,7 @@
"@wisdom-map/util": "^1.0.27-0",
"@wisdom-utils/components": "0.0.14",
"@wisdom-utils/runtime": "0.0.15",
"@wisdom-utils/utils": "0.0.52",
"@wisdom-utils/utils": "0.0.54",
"animate.css": "^4.1.1",
"antd": "^4.11.2",
"compression": "1.7.4",
......
import { jsonp, request } from '@wisdom-utils/utils';
import * as constants from '../../constants';
/**
* 兼容老接口
*/
const transformGateWay = (url) => {
if(!/^(cityinterface|CityInterface|CityServer)/) {
return url.replace(/GeteWay/, '')
}
}
export const API = {
AUTHORIZATION_TOKEN: '/Publish/Identity/AuthorizationToken',
GET_GATEWAY_CONFIG: '/PandaOMS/OMS/GateWayConfig',
AUTHORIZATION_TOKEN: '/Identity/AuthorizationToken',
GET_GATEWAY_CONFIG: '/PandaCore/GCK/Basis/GateWayConfig',
GET_CONFIG: '/CityInterface/rest/services.svc/GetConfig',
GENERATE_TOKEN: '/cityinterface/rest/services.svc/generatetoken',
GENERATE_GATEWAT_TOKEN: '/GCK/Basis/GenerateToken',
GENERATE_IOT_TOKEN: 'cityinterface/rest/services.svc/generateGCKToken',
GENERATE_QRCODE: 'cityinterface/rest/services.svc/generatetokenByqrcode',
GENERATE_TOKEN_CHANGE: '/cityinterface/rest/services.svc/generatetokenquick',
GET_WEB_SITE_CONFIG: '/CityInterface/rest/services.svc/GetWebSiteConfig',
GET_WEB_SITE_CONFIG_GEWAY: '/Publish/OMS/PlatformCenter/GetWebSiteConfig',
GET_WEB_SITE_CONFIG_GEWAY: '/GCK/Basis/GetWebSiteConfig',
GET_USER_INFO: '/CityInterface/rest/services.svc/getUserInfo',
GET_GATEWAY_USER_INFO: '/GCK/Basis/GetUserInfo',
GET_OA: '/CityInterface/rest/services/OA.svc/getLoginInfo',
GET_LOGS: '/CityInterface/rest/services/portal.svc/OMMonitor/SaveLoginInfo',
GET_CITY:
process.env.NODE_ENV !== 'production'
? '/cityjson?ie=utf-8'
: 'https://pv.sohu.com',
GET_ALL_GROUPS_INFO_FORUSER:
'CityInterface/rest/Services/Portal.svc/AuthorityManage/GetAllGroupsInfoForUser',
GET_ALL_GROUPS_INFO_FORUSER: '/CityInterface/rest/Services/Portal.svc/AuthorityManage/GetAllGroupsInfoForUser',
GET_WEATHER: '/CityInterface/rest/services/CountyProduct.svc/GetWeather',
SEND_MESSAGE_CODE:
'CityInterface/rest/services/portal.svc/SendMessVerificationCode',
......@@ -79,7 +87,9 @@ const services = {
},
getUserInfo: {
url: API.GET_USER_INFO,
url: () => window.globalConfig &&
window.globalConfig &&
window.globalConfig.hasGateWay? API.GET_GATEWAY_USER_INFO: API.GET_USER_INFO,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
......@@ -217,4 +227,5 @@ export const savePagePartInfo = param =>
params: param.query,
});
export default services;
......@@ -104,20 +104,20 @@ const initGlobalConfig = () => {
updateTheme('#ff9600');
}
} else {
// appService.getWateWayConfig().then(res => {
// const hasGateWay =
// res && res.data && isString(res.data) ? JSON.parse(res.data) : res.data;
// if (res.code === 0) {
// store.dispatch(
// actionCreators.getConfig(
// Object.assign({}, window.globalConfig, {
// hasGateWay,
// apiGatewayDomain: `${window.location.origin}/PandaCore/GateWay`,
// }),
// ),
// );
// }
// });
appService.getWateWayConfig().then(res => {
const hasGateWay =
res && res.data && isString(res.data) ? JSON.parse(res.data) : res.data;
if (res.code === 0) {
store.dispatch(
actionCreators.getConfig(
Object.assign({}, window.globalConfig, {
hasGateWay,
apiGatewayDomain: `${window.location.origin}/PandaCore`,
}),
),
);
}
});
// eslint-disable-next-line react-hooks/rules-of-hooks
appService
.queryConfig({
......@@ -127,15 +127,15 @@ const initGlobalConfig = () => {
if (res) {
const data = res;
if (!data.client) {
data.client = 'city';
data.client = params.getParams('client') || 'city';
}
store.dispatch(
actionCreators.getConfig(
Object.assign({}, window.globalConfig, data),
),
);
Cookies.set('city', data.client)
Cookies.set('city', params.getParams('client'))
if (data.loginTemplate === '新春 - 智联.html') {
updateTheme('#ff9600');
......
......@@ -115,7 +115,7 @@ const appReducer = (state = initialState, action) => {
globalConfig: config,
menu: generMenu,
flatMenu,
currentMenu: generMenu[state.currentMenuIndex],
currentMenu: generMenu && generMenu[state.currentMenuIndex],
});
case GET_ERROR_CONFIG:
return state.merge({
......
......@@ -32,7 +32,7 @@ import { Router, Switch } from '@wisdom-utils/runtime';
import RightContent from '@/components/GlobalHeader/ExtendRightContent';
import Panel from '@/components/SliderPanel/MinPanel';
import { actionCreators } from '@/containers/App/store';
import CreateBaseMap from '@/pages/map';
// import CreateBaseMap from '@/pages/map';
// import Authorized from '@/utils/Authorized';
import {
findPathByLeafId,
......
......@@ -212,6 +212,14 @@ class Login {
style: self.globalConfig.style,
});
if(self.globalConfig.hasOwnProperty('webConfig')) {
self.globalConfig = {
...self.globalConfig,
...self.globalConfig.webConfig.basicConfig,
...self.globalConfig.webConfig.optionalConfig
}
}
self.updateConfig && self.updateConfig(self.globalConfig);
self.getProjectItems().then(() => {
......@@ -246,6 +254,7 @@ class Login {
)
// eslint-disable-next-line no-shadow
.then(response => {
debugger
const resultData =
response && response.code === SERVICE_INTERFACE_SUCCESS_CODE
? Array.isArray(response.data)
......@@ -679,6 +688,12 @@ class Login {
response,
self.globalConfig.userInfo,
);
if(response.hasOwnProperty('data')) {
self.globalConfig.userInfo = {
... self.globalConfig.userInfo,
...response.data
}
}
const date = new Date();
date.setTime(date.getTime() + 24 * 60 * 60 * 1000);
// date = date.toGMTString();
......@@ -739,6 +754,7 @@ class Login {
if(response.access_token!== "") {
self.globalConfig.access_token = response.access_token;
localStorage.setItem('access_token', response.access_token);
Cookies.set('city', self.globalConfig.client)
}
if (isRememberPWD) {
Cookies.set(self.globalConfig.client, token, {
......@@ -772,6 +788,7 @@ class Login {
password: pwd ? sha1(pwd).toUpperCase(): '',
type: mode
}).then(res => {
debugger
if(res.code === 0) {
const data = res.data;
self.updateConfig && self.updateConfig(Object.assign({}, self.globalConfig, {
......@@ -809,6 +826,7 @@ class Login {
self.transformLoginHander(response, isRememberPWD)
})
.catch(error => {
debugger
self.hasTry = true;
self.handleLoginError();
self.events.emit('loginError', error.message);
......
import LoadingComponent from '@ant-design/pro-layout/es/PageLoading';
import { dynamic } from '@wisdom-utils/runtime';
import BasicLayout from '../layouts/BasicLayout';
import BasicLayout from '../layouts/BasicLayout1';
import UserLayout from '../layouts/UserLayout';
import BootPage from '../pages/bootpage';
import Login from '../pages/user/login';
......
......@@ -37,7 +37,7 @@ const getURL = url => {
const generRotes = (widgets, parent, level = 0) => {
const ret = [];
if(!widgets) {
if(!widgets || widgets.length === 0){
return
}
(widgets).forEach((item, index) => {
......@@ -86,7 +86,7 @@ const generRotes = (widgets, parent, level = 0) => {
url = item.url
}
url = transformURL(url);
const convertURL = transformURL(item.icon.replace(/\s*/g, ''));
const convertURL = item.icon && transformURL(item.icon.replace(/\s*/g, ''));
const icon = (item && item.icon && item.icon !== null &&
isAbsoluteURL(convertURL) ? convertURL: /(\\|\/)/.test(convertURL) ?
window.globalConfig.transformDevAssetsBaseURL(transformURL(item.icon.replace(/\s*/g, ''))): item.icon
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment