Commit ec67e9bd authored by krysent's avatar krysent

nihao

parent bb9822fb
...@@ -11,6 +11,7 @@ export default { ...@@ -11,6 +11,7 @@ export default {
// localhost:8000/api/** -> https://preview.pro.ant.design/api/** // localhost:8000/api/** -> https://preview.pro.ant.design/api/**
"/wmspro/": { "/wmspro/": {
// 要代理的地址 // 要代理的地址
// target: "http://wms-demo.nangaoyun.com", //39:28040 18/wms/
target: "http://192.168.40.203:8000", //39:28040 18/wms/ target: "http://192.168.40.203:8000", //39:28040 18/wms/
// target: "http://192.168.40.18/wms/", //39:28040 18/wms/ // target: "http://192.168.40.18/wms/", //39:28040 18/wms/
// target: "http://192.168.40.18/wms/", //39:28040 18/wms/ // target: "http://192.168.40.18/wms/", //39:28040 18/wms/
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
"description": "An out-of-box UI solution for enterprise applications", "description": "An out-of-box UI solution for enterprise applications",
"scripts": { "scripts": {
"analyze": "cross-env ANALYZE=1 umi build", "analyze": "cross-env ANALYZE=1 umi build",
"build": "umi build", "build": "set NODE_OPTIONS=--openssl-legacy-provider && umi build",
"deploy": "npm run build && npm run gh-pages", "deploy": "npm run build && npm run gh-pages",
"dev": "npm run start:dev", "dev": "npm run start:dev",
"gh-pages": "gh-pages -d dist", "gh-pages": "gh-pages -d dist",
......
...@@ -142,6 +142,7 @@ export const layout = async (props) => { ...@@ -142,6 +142,7 @@ export const layout = async (props) => {
}, },
menuRender: (props, defaultDom) => { menuRender: (props, defaultDom) => {
console.log(props);
if (props.isMobile) { if (props.isMobile) {
return defaultDom; return defaultDom;
} else { } else {
...@@ -153,11 +154,40 @@ export const layout = async (props) => { ...@@ -153,11 +154,40 @@ export const layout = async (props) => {
// unAccessible: <div>unAccessible</div>, // unAccessible: <div>unAccessible</div>,
// 增加一个 loading 的状态 // 增加一个 loading 的状态
childrenRender: (children, props) => { childrenRender: (children, props) => {
// if (initialState?.loading) return <PageLoading />; if (initialState?.loading) return <PageLoading />;
let items = [...(initialState?.newMenu?.userHavePermList ?? [])];
items?.unshift({
path: "/welcome",
name: "首页",
icon: "smile",
component: "./Welcome",
haveChildren: false,
key: "000000",
parentKey: "0",
routes: [],
children: null,
title: null,
});
let home;
if (
history.location.pathname != "/welcome" &&
history.location.pathname != "/"
) {
home = history.location.pathname;
} else {
home =
items?.length > 0
? items[0].path.indexOf("/") > -1
? items[0].path
: items[0]?.routes?.length > 0
? items[0]?.routes[0]?.path
: ""
: "";
}
return ( return (
<> <>
{initialState?.currentUser && location.pathname !== loginPath ? ( {initialState?.currentUser && location.pathname !== loginPath ? (
<TagView home="/welcome">{children}</TagView> <TagView home={home}>{children}</TagView>
) : ( ) : (
children children
)} )}
......
...@@ -72,6 +72,7 @@ function Diymenu({ ...@@ -72,6 +72,7 @@ function Diymenu({
const getMenuData = newMenu?.userHavePermList ?? [], const getMenuData = newMenu?.userHavePermList ?? [],
collectPerm = newMenu?.collectPerm ?? [], collectPerm = newMenu?.collectPerm ?? [],
recentUsePermList = newMenu?.recentUsePermList ?? []; recentUsePermList = newMenu?.recentUsePermList ?? [];
console.log(getMenuData)
let scrollToAnchor = (anchorName) => { let scrollToAnchor = (anchorName) => {
if (anchorName) { if (anchorName) {
setanchor(anchorName); setanchor(anchorName);
...@@ -196,6 +197,17 @@ function Diymenu({ ...@@ -196,6 +197,17 @@ function Diymenu({
<Icon type={alive ? "fullscreen" : "fullscreen-exit"} /> <Icon type={alive ? "fullscreen" : "fullscreen-exit"} />
<span>产品与服务</span> <span>产品与服务</span>
</Menu.Item> </Menu.Item>
<Menu.Item
key="/welcome"
style={{
userSelect: "none",
backgroundColor: "#000",
marginTop: 8,
}}
>
<Icon type="home" />
<span>首页</span>
</Menu.Item>
{collectPerm && {collectPerm &&
collectPerm.map((item, i) => { collectPerm.map((item, i) => {
return ( return (
......
...@@ -23,20 +23,20 @@ const TagView = ({ children, home }) => { ...@@ -23,20 +23,20 @@ const TagView = ({ children, home }) => {
const initTags = (routeContext) => { const initTags = (routeContext) => {
const { menuData } = routeContext; const { menuData } = routeContext;
if (tagList.length === 0 && menuData) { if (tagList.length === 0 && menuData) {
const firstTag = menuData.filter((el) => el.path === home)[0]; const firstTag = getHome(menuData);;
if (firstTag) { if (firstTag) {
const title = ( // const title = (
<FormattedMessage // <FormattedMessage
key={firstTag.name} // key={firstTag.name}
id={`menu.${firstTag.name}`} // id={`menu.${firstTag.name}`}
defaultMessage="首页" // defaultMessage="首页"
/> // />
); // );
const path = firstTag.path; const path = firstTag.path;
history.push({ pathname: firstTag.path, query: firstTag.query }); history.push({ pathname: firstTag.path, query: firstTag.query });
setTagList([ setTagList([
{ {
title, title:firstTag.name,
path, path,
children: firstTag.children, children: firstTag.children,
refresh: 0, refresh: 0,
...@@ -127,6 +127,21 @@ const TagView = ({ children, home }) => { ...@@ -127,6 +127,21 @@ const TagView = ({ children, home }) => {
}); });
setTagList(tagsCopy); setTagList(tagsCopy);
}; };
function getHome(data) {
let obj;
function loop(data) {
data.map(it => {
if (it.path == home) {
obj = it;
}
if (it.children?.length > 0) {
loop(it.children);
}
});
}
loop(data);
return obj;
}
return ( return (
<> <>
......
...@@ -149,7 +149,7 @@ request.interceptors.response.use(async (response, options) => { ...@@ -149,7 +149,7 @@ request.interceptors.response.use(async (response, options) => {
if (data?.code != "0000") { if (data?.code != "0000") {
message.destroy(); message.destroy();
if (data?.code == "9999") { if (data?.code == "9999" || data?.code == "0003") {
message.warn(data?.msg); message.warn(data?.msg);
} }
if (data?.code == "0001" && window.location.href.indexOf("login") == -1) { if (data?.code == "0001" && window.location.href.indexOf("login") == -1) {
......
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