Commit 7278f663 authored by 邓晓峰's avatar 邓晓峰

fix: 修复首页路由匹配

parent 8c6dbdc6
Pipeline #42218 passed with stages
in 1 minute 36 seconds
......@@ -271,6 +271,7 @@ const BasicLayout = props => {
// 处理隐藏菜单
let currentRoutes = props.route.routes.filter(item => !item.hideInMenu)[props.currentMenuIndex];
console.log(props.route)
//props.currentMenuIndex
useEffect(() => {
const initSelectRoute = findPathByLeafId(
......@@ -330,7 +331,7 @@ const BasicLayout = props => {
useEffect(() => {
siteAction.setGlobalConfig(props.global);
if (!Cookies.get('token')) {
let client = props.global.get('client');
let client = props.global && props.global.client;
client = client !== 'undefined' || !_.isNull(client) || !_.isUndefined(client) ? client: 'city';
history.replace(`/user/login?client=${client}`);
props.logout();
......
......@@ -87,6 +87,7 @@ const generRotes = (widgets, parent, level = 0) => {
url = item.url
}
url = transformURL(url);
url = url.replace(/[(\\|)|(&)]widget=[0-9]*/, '')
const convertURL = item.icon && transformURL(item.icon.replace(/\s*/g, ''));
const icon = (item && item.icon && item.icon !== null &&
isAbsoluteURL(convertURL) ? convertURL: /(\\|\/)/.test(convertURL) ?
......
......@@ -87,6 +87,8 @@ export function findPathByLeafId(leafId, nodes, path, key, clear) {
}
export function transformURL(path) {
//civweb4/
path = path.replace(/[(\\|)|(&)]widget=[0-9]*/, '');
const el = document.createElement('input');
el.value = path;
String.fromCharCode(92);
......
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