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

fix: 修复网关接口地址

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