Commit 746ff097 authored by 皮倩雯's avatar 皮倩雯

fix: '开启网关地图接口路径拼上pandaCore'

parent 58c0bd9e
Pipeline #64107 passed with stages
import React, { useState } from 'react';
import React, { useState, useEffect } from 'react';
import check from '@/components/Authorized/CheckPermissions';
import { matchRoutes, renderRoutes } from 'react-router-config';
import { Link, Switch } from 'react-router-dom';
......@@ -40,6 +40,23 @@ const BasicLayout = props => {
: routeCopy;
})
.filter(Boolean);
useEffect(() => {
console.log(localStorage.getItem('panda-publish'));
if (localStorage.getItem('panda-publish') == 'getway') {
window.globalConfig = {
access_token: localStorage.getItem('token'),
hasGateWay: true,
apiGatewayDomain: `${window.location.origin}${'/PandaCore/GateWay'}`,
};
} else {
window.globalConfig = {
access_token: localStorage.getItem('token'),
hasGateWay: false,
apiGatewayDomain: `${window.location.origin}`,
};
}
}, []);
const handleMenuCollapse = () => {}; // get children authority
// 获取url地址参数
const getQueryVariable = name => {
......@@ -103,9 +120,7 @@ const BasicLayout = props => {
}}
{...props}
>
<Switch>
{renderRoutes(props.route.routes)}
</Switch>
<Switch>{renderRoutes(props.route.routes)}</Switch>
</ProLayout>
)}
</>
......
......@@ -63,6 +63,12 @@ const GateConfig = () => {
if (checked) {
UpdateGeteWay({ isUsed: checked }).then(res => {
if (res.code === 0) {
console.log(localStorage.getItem('token'));
window.globalConfig = {
access_token: localStorage.getItem('token'),
hasGateWay: true,
apiGatewayDomain: `${window.location.origin}${'/PandaCore/GateWay'}`,
};
setFlag(flag + 1);
message.success('设置成功');
} else {
......@@ -85,6 +91,12 @@ const GateConfig = () => {
} else {
UpdateGeteWay({ isUsed: checked }).then(res => {
if (res.code === 0) {
console.log(localStorage.getItem('token'));
window.globalConfig = {
access_token: localStorage.getItem('token'),
hasGateWay: false,
apiGatewayDomain: `${window.location.origin}`,
};
setFlag(flag + 1);
message.success('设置成功');
} else {
......
......@@ -84,8 +84,18 @@ const Login = props => {
.then(res => {
if (res.code === 0 && res.data) {
localStorage.setItem('panda-publish', 'getway');
window.globalConfig = {
access_token: localStorage.getItem('token'),
hasGateWay: true,
apiGatewayDomain: `${window.location.origin}${'/PandaCore/GateWay'}`,
};
} else {
localStorage.setItem('panda-publish', '');
window.globalConfig = {
access_token: localStorage.getItem('token'),
hasGateWay: false,
apiGatewayDomain: `${window.location.origin}`,
};
}
})
.catch(err => {
......
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