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