Commit 7f7072bb authored by 前端-李俊鑫's avatar 前端-李俊鑫
parents a776c57b d1eeaa9c
......@@ -23,6 +23,7 @@ const config: any = {
},
nodeModulesTransform: {
type: 'none',
exclude: []
},
routes,
extraBabelPlugins: [
......
......@@ -102,7 +102,7 @@
"rgbaster": "^2.1.1",
"sortablejs": "^1.12.0",
"typescript": "^3.9.7",
"umi": "^3.2.28",
"umi": "~3.2.28",
"video-react": "^0.14.1",
"yorkie": "^2.0.0"
},
......
......@@ -64,7 +64,15 @@ export function patchRoutes({ routes }: IRoutes) {
if (isDev) {
return;
}
asyncRouter(getRouters(), routes)
const authInfo = getAuth()
if (authInfo) {
PublicApi.getMemberLoginReget({}, { useCache: true, ttl: 1000 }).then(res => {
const { data, code } = res
if (code === 1000) {
asyncRouter(data.urls, routes)
}
})
}
}
/**
......@@ -83,7 +91,7 @@ export function render(oldRender: Function) {
}
const authInfo = getAuth()
if (authInfo) {
PublicApi.getMemberLoginReget().then(res => {
PublicApi.getMemberLoginReget({}, { useCache: true, ttl: 1000 }).then(res => {
const { data, code } = res
if (code === 1000) {
setAuth(data as any)
......@@ -136,7 +144,6 @@ export function onRouteChange({ routes, matchedRoutes, location, action }) {
const authInfo = getAuth()
// 是否登录
if (authInfo) {
let routeAuthUrls = getRouters()
if (!routeAuthUrls || routeAuthUrls.length === 0) {
......
......@@ -313,7 +313,7 @@ const AddedFormLayout: React.FC<AddedFormLayoutProps> = (props: any) => {
>
<BasicInfoLatyout getMemberInfo={getMemberInfo} memb={memberInfo} isEdit={spam || two} />
<InquiryProductLayout isEdit={two} form={form} getInquiryProduct={getInquiryProduct} member={memberInfo} setInquiryProduct={inquiryProduct} />
<TradeTermsLayout isEdit={two} getFullAddress={getFullAddress} getContacts={getContacts} fullAddress={fullAddress} />
<TradeTermsLayout isEdit getFullAddress={getFullAddress} getContacts={getContacts} fullAddress={fullAddress} />
<AttachLayout enclosureUrls={enclosureUrls} getEnclosureUrls={getEnclosureUrls} removeEnclosureUrls={removeEnclosureUrls} />
</Form>
}
......
......@@ -102,6 +102,11 @@ export const removeAuth = () => {
removeRouters()
}
const HOME_URL = [
'/',
'/memberCenter/home'
]
export const asyncRouter = async (routeLists: string[], routes: any[]) => {
for (let i = 0; i < routes.length; i++) {
const item = routes[i]
......@@ -110,7 +115,7 @@ export const asyncRouter = async (routeLists: string[], routes: any[]) => {
} else {
// 参与权限校验的页面
// fix: 修复左侧菜单首页无法显示
if (item.path && !routeLists.includes(item.path) && item.path !== '/memberCenter/home') {
if (item.path && !routeLists.includes(item.path) && !HOME_URL.includes(item.path)) {
item.hideInMenu = true
item.noAuth = true
}
......
{
"compilerOptions": {
"experimentalDecorators": true,
"target": "esnext",
"module": "esnext",
"moduleResolution": "node",
"importHelpers": true,
"jsx": "react",
"esModuleInterop": true,
"noImplicitAny": false,
"sourceMap": true,
"baseUrl": "./",
"paths": {
"@/*": ["src/*"],
"@mock/*": ["mockStatic/*"],
"@@/*": ["src/.umi/*"]
},
"allowSyntheticDefaultImports": true
},
"include": [
"mock/**/*",
"src/**/*",
"config/**/*",
".umirc.ts",
"typings.d.ts"
],
"exclude": [
"node_modules/**/*"
]
}
{
"compilerOptions": {
"experimentalDecorators": true,
"target": "esnext",
"module": "esnext",
"moduleResolution": "node",
"importHelpers": true,
"jsx": "react-jsx",
"esModuleInterop": true,
"noImplicitAny": false,
"sourceMap": true,
"baseUrl": "./",
"paths": {
"@/*": ["src/*"],
"@mock/*": ["mockStatic/*"],
"@@/*": ["src/.umi/*"]
},
"allowSyntheticDefaultImports": true
},
"include": [
"mock/**/*",
"src/**/*",
"config/**/*",
".umirc.ts",
"typings.d.ts"
],
"exclude": [
"node_modules/**/*"
]
}
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