Commit dfe20ef7 authored by 叶飞's avatar 叶飞

Merge branch 'master' of https://g.civnet.cn:8443/test/CivWeb

parents c984c9d3 b9e40121
This diff was suppressed by a .gitattributes entry.
...@@ -3,10 +3,12 @@ ...@@ -3,10 +3,12 @@
module.exports = { module.exports = {
dev: { dev: {
'/CityInterface': { '/CityInterface': {
target: 'http://192.168.10.151:8055', // target: 'http://192.168.10.151:8055',
// target: 'https://panda-water.cn', // target: 'https://panda-water.cn',
// target: 'https://panda-water.com',
// target: 'http://192.168.19.103:8112', // target: 'http://192.168.19.103:8112',
// target: 'http://192.168.12.8:8098', // target: 'http://192.168.12.8:8098',
target: 'http://192.168.10.20:8888',
changeOrigin: true, changeOrigin: true,
headers: { headers: {
'Access-Control-Allow-Origin': '*' 'Access-Control-Allow-Origin': '*'
...@@ -16,9 +18,11 @@ module.exports = { ...@@ -16,9 +18,11 @@ module.exports = {
} }
}, },
'/cityinterface': { '/cityinterface': {
target: 'http://192.168.10.151:8055', // target: 'http://192.168.10.151:8055',
// target: 'https://panda-water.cn', // target: 'https://panda-water.cn',
// target: 'https://panda-water.com',
// target: 'http://192.168.12.8:8098', // target: 'http://192.168.12.8:8098',
target: 'http://192.168.10.20:8888',
changeOrigin: true, changeOrigin: true,
headers: { headers: {
'Access-Control-Allow-Origin': '*' 'Access-Control-Allow-Origin': '*'
...@@ -26,6 +30,20 @@ module.exports = { ...@@ -26,6 +30,20 @@ module.exports = {
pathRewrite: { pathRewrite: {
'/cityinterface': '/cityinterface' '/cityinterface': '/cityinterface'
} }
},
'/Publish': {
// target: 'http://192.168.12.8:8098',
target: 'http://192.168.10.20:8888',
// target: 'http://192.168.10.151:8055',
// target: 'https://panda-water.cn',
// target: 'https://panda-water.com',
changeOrigin: true,
headers: {
'Access-Control-Allow-Origin': '*'
},
pathRewrite: {
'/Publish': '/Publish'
}
} }
} }
}; };
\ No newline at end of file
...@@ -2,9 +2,11 @@ module.exports = { ...@@ -2,9 +2,11 @@ module.exports = {
dev: { dev: {
'/CityInterface': { '/CityInterface': {
// target: 'http://192.168.10.151:8055', // target: 'http://192.168.10.151:8055',
target: 'https://panda-water.cn', // target: 'https://panda-water.cn',
// target: 'https://panda-water.com',
// target: 'http://192.168.19.103:8112', // target: 'http://192.168.19.103:8112',
// target: 'http://192.168.12.8:8098', // target: 'http://192.168.12.8:8098',
target: 'http://192.168.10.20:8888',
changeOrigin: true, changeOrigin: true,
headers: { headers: {
'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Origin': '*',
...@@ -15,8 +17,10 @@ module.exports = { ...@@ -15,8 +17,10 @@ module.exports = {
}, },
'/cityinterface': { '/cityinterface': {
// target: 'http://192.168.10.151:8055', // target: 'http://192.168.10.151:8055',
target: 'https://panda-water.cn', // target: 'https://panda-water.cn',
// target: 'https://panda-water.com',
// target: 'http://192.168.12.8:8098', // target: 'http://192.168.12.8:8098',
target: 'http://192.168.10.20:8888',
changeOrigin: true, changeOrigin: true,
headers: { headers: {
'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Origin': '*',
...@@ -25,5 +29,19 @@ module.exports = { ...@@ -25,5 +29,19 @@ module.exports = {
'/cityinterface': '/cityinterface', '/cityinterface': '/cityinterface',
}, },
}, },
'/Publish': {
// target: 'http://192.168.12.8:8098',
target: 'http://192.168.10.20:8888',
// target: 'http://192.168.10.151:8055',
// target: 'https://panda-water.cn',
// target: 'https://panda-water.com',
changeOrigin: true,
headers: {
'Access-Control-Allow-Origin': '*',
},
pathRewrite: {
'/Publish': '/Publish',
},
}
}, },
}; };
This diff is collapsed.
...@@ -101,14 +101,18 @@ ...@@ -101,14 +101,18 @@
"kit_utils": "^1.3.6", "kit_utils": "^1.3.6",
"lodash": "4.17.11", "lodash": "4.17.11",
"minimist": "1.2.0", "minimist": "1.2.0",
"mqtt-client": "^1.0.11",
"pinyin-match": "^1.1.1",
"prop-types": "15.7.2", "prop-types": "15.7.2",
"qrcode.react": "^1.0.0", "qrcode.react": "^1.0.0",
"react": "16.12.0", "react": "16.12.0",
"react-dom": "16.12.0", "react-dom": "16.12.0",
"react-draggable": "^4.4.3",
"react-helmet": "6.0.0-beta", "react-helmet": "6.0.0-beta",
"react-intl": "2.8.0", "react-intl": "2.8.0",
"react-redux": "7.0.2", "react-redux": "7.0.2",
"react-router-dom": "5.1.0", "react-router-dom": "5.1.0",
"react-use": "^15.3.4",
"redux": "4.0.1", "redux": "4.0.1",
"redux-saga": "1.0.2", "redux-saga": "1.0.2",
"reselect": "4.0.0", "reselect": "4.0.0",
...@@ -189,6 +193,7 @@ ...@@ -189,6 +193,7 @@
"lodash": "^4.17.11", "lodash": "^4.17.11",
"mockjs": "^1.0.1-beta3", "mockjs": "^1.0.1-beta3",
"moment": "^2.25.3", "moment": "^2.25.3",
"mousetrap": "^1.6.5",
"nanoid": "^3.1.16", "nanoid": "^3.1.16",
"ngrok": "3.1.1", "ngrok": "3.1.1",
"node-plop": "0.18.0", "node-plop": "0.18.0",
...@@ -203,7 +208,7 @@ ...@@ -203,7 +208,7 @@
"postcss-safe-parser": "4.0.2", "postcss-safe-parser": "4.0.2",
"pre-commit": "1.2.2", "pre-commit": "1.2.2",
"prettier": "1.17.0", "prettier": "1.17.0",
"qiankun": "^2.2.3-1", "qiankun": "^2.2.4-1",
"qs": "^6.9.0", "qs": "^6.9.0",
"react": "^16.8.6", "react": "^16.8.6",
"react-app-polyfill": "0.2.2", "react-app-polyfill": "0.2.2",
......
...@@ -2,7 +2,7 @@ import axios from 'axios'; ...@@ -2,7 +2,7 @@ import axios from 'axios';
import uuid from 'uuid'; import uuid from 'uuid';
const baseURL = const baseURL =
process.env.NODE_ENV === 'development' ? window.location.origin : ''; process.env.NODE_ENV === 'development' ? window.location.origin : window.location.origin;
axios.defaults.withCredentials = true; axios.defaults.withCredentials = true;
let pending = []; //声明一个数组用于存储每个ajax请求的取消函数和ajax标识 let pending = []; //声明一个数组用于存储每个ajax请求的取消函数和ajax标识
...@@ -21,9 +21,11 @@ class HttpRequest { ...@@ -21,9 +21,11 @@ class HttpRequest {
// if(config.params&&config.params.cancelAllRequest){ // if(config.params&&config.params.cancelAllRequest){
// removeAllPending() // removeAllPending()
// } // }
// ------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------
if (!config.ignoreSite && this.getSite()) { if ( (!config.ignoreSite && this.getSite(config)) && (Array.isArray(window.globalConfig.userInfo.Groups) && (Array.isArray(window.globalConfig.userInfo.Industries) && window.globalConfig.userInfo.Industries.length > 0)) ) {
config.headers['civ-site'] = this.getSite(); config.headers['civ-site'] = this.getSite(config);
// config.headers['civ-site'] = "192_168_19_105_site_c8de50fc";
} }
this.removePending(config); //在一个ajax发送前执行一下取消操作 this.removePending(config); //在一个ajax发送前执行一下取消操作
config.cancelToken = new cancelToken(c => { config.cancelToken = new cancelToken(c => {
...@@ -35,6 +37,7 @@ class HttpRequest { ...@@ -35,6 +37,7 @@ class HttpRequest {
return config; return config;
}, },
function(error) { function(error) {
console.log("request error", error)
return Promise.reject(error); return Promise.reject(error);
}, },
); );
...@@ -52,6 +55,7 @@ class HttpRequest { ...@@ -52,6 +55,7 @@ class HttpRequest {
function(error) { function(error) {
console.log(error); console.log(error);
if (error && error.response) { if (error && error.response) {
switch (error.response.status) { switch (error.response.status) {
case 400: case 400:
error.message = '错误请求'; error.message = '错误请求';
...@@ -114,47 +118,22 @@ class HttpRequest { ...@@ -114,47 +118,22 @@ class HttpRequest {
pending.splice(p, 1); //把这条记录从数组中移除 pending.splice(p, 1); //把这条记录从数组中移除
} }
}; };
getSite() { getSite(config) {
return ( return window.globalConfig && window.globalConfig.userInfo && window.globalConfig.userInfo.site && !config.ignoreSite ? window.globalConfig.userInfo.site: ""
(window.globalConfig &&
window.globalConfig.userInfo &&
window.globalConfig.userInfo.site) ||
''
);
} }
get(url, params, config = {}) { get(url, params, config = {}) {
params = this.getSite()
? Object.assign({}, params, {
site: this.getSite(),
})
: params;
return this.requestApi.get(url, { ...config, params }); return this.requestApi.get(url, { ...config, params });
} }
post(url, data, config = {}) { post(url, data, config = {}) {
data = this.getSite()
? Object.assign({}, data, {
site: this.getSite(),
})
: data;
return this.requestApi.post(url, { ...data, ...config }); return this.requestApi.post(url, { ...data, ...config });
} }
delete(url, params, config = {}) { delete(url, params, config = {}) {
params = this.getSite()
? Object.assign({}, params, {
site: this.getSite(),
})
: params;
return this.requestApi.delete(url, { ...config, params }); return this.requestApi.delete(url, { ...config, params });
} }
put(url, params, config = {}) { put(url, params, config = {}) {
params = this.getSite()
? Object.assign({}, params, {
site: this.getSite(),
})
: params;
return this.requestApi.delete(url, params, config); return this.requestApi.delete(url, params, config);
} }
} }
......
...@@ -16,16 +16,17 @@ const API = { ...@@ -16,16 +16,17 @@ const API = {
export default vm => { export default vm => {
vm.getConfig = ( vm.getConfig = (
data = { client: params.getParams('client') || 'city', ts: Date.now() }, data = { client: params.getParams('client') || 'city', ts: Date.now() },
) => vm.get(API.GET_CONFIG, data).then(res => Promise.resolve(res)); config = {}
) => vm.get(API.GET_CONFIG, data, config).then(res => Promise.resolve(res));
vm.generateToken = (data = {}) => vm.generateToken = (data = {}, config = {}) =>
vm.get(API.GENERATE_TOKEN, data).then(res => Promise.resolve(res)); vm.get(API.GENERATE_TOKEN, data, config).then(res => Promise.resolve(res));
vm.getWebSiteConfig = (data = {}) => vm.getWebSiteConfig = (data = {}, config = {}) =>
vm.get(API.GET_WEB_SITE_CONFIG, data).then(res => Promise.resolve(res)); vm.get(API.GET_WEB_SITE_CONFIG, data, config).then(res => Promise.resolve(res));
vm.getUserInfo = (data = {}) => vm.getUserInfo = (data = {}, config = {}) =>
vm.get(API.GET_USER_INFO, data).then(res => Promise.resolve(res)); vm.get(API.GET_USER_INFO, data, config).then(res => Promise.resolve(res));
vm.getOA = (data = {}) => vm.getOA = (data = {}) =>
vm.get(API.GET_OA, data).then(res => Promise.resolve(res)); vm.get(API.GET_OA, data).then(res => Promise.resolve(res));
...@@ -43,6 +44,6 @@ export default vm => { ...@@ -43,6 +44,6 @@ export default vm => {
.get(API.GET_ALL_GROUPS_INFO_FORUSER, data, config) .get(API.GET_ALL_GROUPS_INFO_FORUSER, data, config)
.then(res => Promise.resolve(res)); .then(res => Promise.resolve(res));
vm.getWeather = (data = {}) => vm.getWeather = (data = {}, config) =>
vm.get(API.GET_WEATHER, data).then(res => Promise.resolve(res)); vm.get(API.GET_WEATHER, data, config).then(res => Promise.resolve(res));
}; };
...@@ -15,7 +15,6 @@ var API = { ...@@ -15,7 +15,6 @@ var API = {
GET_USER_INFO: '/CityInterface/rest/services.svc/getUserInfo', GET_USER_INFO: '/CityInterface/rest/services.svc/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_INFORMATION: '/CityInterface/rest/services/CountyProduct.svc/SCADAOper/GetInformationInfo',
GET_CITY: 'https://pv.sohu.com/cityjson?ie=utf-8', GET_CITY: 'https://pv.sohu.com/cityjson?ie=utf-8',
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' GET_WEATHER: '/CityInterface/rest/services/CountyProduct.svc/GetWeather'
...@@ -27,28 +26,32 @@ var _default = function _default(vm) { ...@@ -27,28 +26,32 @@ var _default = function _default(vm) {
client: _kit_utils.params.getParams('client') || 'city', client: _kit_utils.params.getParams('client') || 'city',
ts: Date.now() ts: Date.now()
}; };
return vm.get(API.GET_CONFIG, data).then(function (res) { var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
return vm.get(API.GET_CONFIG, data, config).then(function (res) {
return Promise.resolve(res); return Promise.resolve(res);
}); });
}; };
vm.generateToken = function () { vm.generateToken = function () {
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
return vm.get(API.GENERATE_TOKEN, data).then(function (res) { var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
return vm.get(API.GENERATE_TOKEN, data, config).then(function (res) {
return Promise.resolve(res); return Promise.resolve(res);
}); });
}; };
vm.getWebSiteConfig = function () { vm.getWebSiteConfig = function () {
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
return vm.get(API.GET_WEB_SITE_CONFIG, data).then(function (res) { var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
return vm.get(API.GET_WEB_SITE_CONFIG, data, config).then(function (res) {
return Promise.resolve(res); return Promise.resolve(res);
}); });
}; };
vm.getUserInfo = function () { vm.getUserInfo = function () {
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
return vm.get(API.GET_USER_INFO, data).then(function (res) { var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
return vm.get(API.GET_USER_INFO, data, config).then(function (res) {
return Promise.resolve(res); return Promise.resolve(res);
}); });
}; };
...@@ -68,13 +71,6 @@ var _default = function _default(vm) { ...@@ -68,13 +71,6 @@ var _default = function _default(vm) {
}); });
}; };
vm.getInformationInfo = function () {
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
return vm.get(API.GET_INFORMATION, data).then(function (res) {
return Promise.resolve(res);
});
};
vm.getCity = function () { vm.getCity = function () {
return vm.get(API.GET_CITY).then(function (res) { return vm.get(API.GET_CITY).then(function (res) {
return Promise.resolve(res); return Promise.resolve(res);
...@@ -98,7 +94,8 @@ var _default = function _default(vm) { ...@@ -98,7 +94,8 @@ var _default = function _default(vm) {
vm.getWeather = function () { vm.getWeather = function () {
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
return vm.get(API.GET_WEATHER, data).then(function (res) { var config = arguments.length > 1 ? arguments[1] : undefined;
return vm.get(API.GET_WEATHER, data, config).then(function (res) {
return Promise.resolve(res); return Promise.resolve(res);
}); });
}; };
......
...@@ -12,17 +12,22 @@ import ReactDOM from 'react-dom'; ...@@ -12,17 +12,22 @@ import ReactDOM from 'react-dom';
import { ConnectedRouter } from 'connected-react-router/immutable'; import { ConnectedRouter } from 'connected-react-router/immutable';
import Immutable from 'immutable'; import Immutable from 'immutable';
import { params, Storeage } from 'kit_utils'; import {
params,
Storeage,
} from 'kit_utils';
import { Provider } from 'react-redux'; import { Provider } from 'react-redux';
import Http from './api'; import Http from './api';
import Container from './components/Container';
import configureStore from './configureStore'; import configureStore from './configureStore';
import App from './containers/App'; import App from './containers/App';
import { actionCreators } from './containers/App/store'; import { actionCreators } from './containers/App/store';
import { initMicroApps } from './micro'; import { initMicroApps } from './micro';
import history from './utils/history'; import history from './utils/history';
window.createStoreage = new Storeage('PANDA_STORE'); const namespace = `__PANDA_STORE__${location.hostname}`
window.createStoreage = new Storeage(namespace);
window.Http = Http; window.Http = Http;
const initialState = Immutable.Map(); const initialState = Immutable.Map();
const store = configureStore(initialState, history); const store = configureStore(initialState, history);
...@@ -31,7 +36,9 @@ const render = () => { ...@@ -31,7 +36,9 @@ const render = () => {
ReactDOM.render( ReactDOM.render(
<Provider store={store}> <Provider store={store}>
<ConnectedRouter history={history}> <ConnectedRouter history={history}>
<Container>
<App /> <App />
</Container>
</ConnectedRouter> </ConnectedRouter>
</Provider>, </Provider>,
MOUNT_NODE, MOUNT_NODE,
...@@ -46,14 +53,14 @@ const initLocale = () => { ...@@ -46,14 +53,14 @@ const initLocale = () => {
const initGlobalConfig = () => { const initGlobalConfig = () => {
const config = createStoreage.get('globalConfig') || {}; const config = createStoreage.get('globalConfig') || {};
if (config.title == null) { if (config.title == null) {
createStoreage.remove('PANDA_STORE'); createStoreage.remove(namespace);
} }
if (!params.getParams('client') && config) { if (!params.getParams('client') && config) {
createStoreage.remove('PANDA_STORE'); createStoreage.remove(namespace);
} }
if (!createStoreage.get('globalConfig')) { if (!createStoreage.get('globalConfig')) {
window.createStoreage = new Storeage('PANDA_STORE'); window.createStoreage = new Storeage(namespace);
} }
if (config.title !== null && Object.keys(config).length > 0) { if (config.title !== null && Object.keys(config).length > 0) {
......
...@@ -7,6 +7,7 @@ import check from './CheckPermissions'; ...@@ -7,6 +7,7 @@ import check from './CheckPermissions';
const Authorized = ({ const Authorized = ({
children, children,
authority, authority,
flatMenu,
noMatch = ( noMatch = (
<Result <Result
status="403" status="403"
...@@ -15,8 +16,9 @@ const Authorized = ({ ...@@ -15,8 +16,9 @@ const Authorized = ({
/> />
), ),
}) => { }) => {
debugger
const childrenRender = typeof children === 'undefined' ? null : children; const childrenRender = typeof children === 'undefined' ? null : children;
const dom = check(authority, childrenRender, noMatch); const dom = check(authority, flatMenu, childrenRender, noMatch);
return <>{dom}</>; return <>{dom}</>;
}; };
......
import React from 'react'; import React from 'react';
import PromiseRender from './PromiseRender';
import { CURRENT } from './renderAuthorize'; import { CURRENT } from './renderAuthorize';
const checkPermissions = (authority, currentAuthority, target, Exception) => { const checkPermissions = (
authority,
flatMenu,
currentAuthority,
target,
Exception,
) => {
debugger;
const filterPath = [
{ name: '/', path: '/' },
{ name: 'civbase', path:`/civbase/?client=${window.globalConfig.client}` },
{ name: 'industry', path: '/industry' },
{ name: 'civweb4', path: `/civweb4/` },
{ name: 'civweb4', path: `/civweb4/?client=${window.globalConfig.client}` },
{ name: '404', path: '/404' },
{ name: '403', path: '/403' },
{ name: '500', path: '/500' },
];
if (!authority) { if (!authority) {
return target; return target;
} }
if (Array.isArray(authority)) { if (Array.isArray(flatMenu)) {
if (Array.isArray(currentAuthority)) { const data = flatMenu.concat(filterPath);
if (currentAuthority.some(item => authority.includes(item))) { const findIndex = data.findIndex(item => item.path === authority);
return target; if (findIndex > -1) {
}
} else if (authority.includes(currentAuthority)) {
return target; return target;
} }
return Exception; return Exception;
} }
throw new Error('unsupported parameters');
// string 处理
if (typeof authority === 'string') {
if (Array.isArray(currentAuthority)) {
if (currentAuthority.some(item => authority === item)) {
return target;
}
} else if (authority === currentAuthority) {
return target;
}
return Exception;
}
// Promise 处理
if (authority instanceof Promise) {
return <PromiseRender ok={target} error={Exception} promise={authority} />;
}
// Function 处理
if (typeof authority === 'function') {
const bool = authority(currentAuthority);
// 函数执行后返回值是 Promise
if (bool instanceof Promise) {
return <PromiseRender ok={target} error={Exception} promise={bool} />;
}
if (bool) {
return target;
}
return Exception;
}
return target;
// throw new Error('unsupported parameters');
}; };
function check(authority, target, Exception) { function check(authority, flatMenu, target, Exception) {
return checkPermissions(authority, CURRENT, target, Exception); debugger;
return checkPermissions(
authority,
flatMenu,
CURRENT,
<div id="micro-container" className="subapp-container" />,
Exception,
);
} }
export default check; export default check;
import React from 'react'; import React from 'react';
import { Spin } from 'antd'; import { Spin } from 'antd';
import isEqual from 'lodash/isEqual'; import isEqual from 'lodash/isEqual';
import { isComponentClass } from './Secured'; import { isComponentClass } from './Secured';
export default class PromiseRender extends React.Component { export default class PromiseRender extends React.Component {
...@@ -24,7 +26,7 @@ export default class PromiseRender extends React.Component { ...@@ -24,7 +26,7 @@ export default class PromiseRender extends React.Component {
} }
setRenderComponent(props) { setRenderComponent(props) {
const on = this.checkIsInstantiation(props.ok); const ok = this.checkIsInstantiation(props.ok);
const error = this.checkIsInstantiation(props.error); const error = this.checkIsInstantiation(props.error);
props.promise props.promise
.then(() => { .then(() => {
...@@ -54,10 +56,11 @@ export default class PromiseRender extends React.Component { ...@@ -54,10 +56,11 @@ export default class PromiseRender extends React.Component {
} }
render() { render() {
const { component: Component } = this.state; debugger
const { } = this.state;
const { ok, error, promise, ...rest } = this.props; const { ok, error, promise, ...rest } = this.props;
return Component ? ( return component ? (
<Component {...rest} /> <component {...rest} />
) : ( ) : (
<div <div
style={{ style={{
......
...@@ -38,3 +38,5 @@ const authorize = (authority, error) => { ...@@ -38,3 +38,5 @@ const authorize = (authority, error) => {
return checkIsInstantiation(component); return checkIsInstantiation(component);
}; };
} }
export default authorize;
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _renderAuthorize = require("./renderAuthorize");
var filterPath = [{
name: '404',
path: '/404'
}, {
name: '403',
path: '/403'
}, {
name: '500',
path: '/500'
}];
var checkPermissions = function checkPermissions(authority, flatMenu, currentAuthority, target, Exception) {
if (!authority) {
return target;
}
if (Array.isArray(flatMenu)) {
var data = flatMenu.concat(filterPath);
var findIndex = data.findIndex(function (item) {
return item.path === authority;
});
if (findIndex > -1) {
return target;
}
return Exception;
}
throw new Error('unsupported parameters');
};
function check(authority, flatMenu, target, Exception) {
debugger;
return checkPermissions(authority, flatMenu, _renderAuthorize.CURRENT, target, Exception);
}
var _default = check;
exports["default"] = _default;
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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