Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
前端-黄佳鑫
jinfa-platform
Commits
7d91a387
Commit
7d91a387
authored
Aug 11, 2020
by
前端-许佳敏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增本地环境无需鉴权功能
parent
719120aa
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
45 additions
and
504 deletions
+45
-504
base.config.json
config/base.config.json
+0
-466
index.ts
config/routes/index.ts
+2
-0
app.tsx
src/app.tsx
+11
-4
index.ts
src/constants/index.ts
+3
-0
global.d.ts
src/global/config/global.d.ts
+1
-18
OuterSide.tsx
src/layouts/components/OuterSide.tsx
+12
-1
asyncRouter.ts
src/utils/asyncRouter.ts
+0
-15
auth.ts
src/utils/auth.ts
+16
-0
No files found.
config/base.config.json
deleted
100644 → 0
View file @
719120aa
{
"userRegister"
:
{
"useType"
:
{
"memberType"
:
[
{
"id"
:
5
,
"typeName"
:
"企业会员"
},
{
"id"
:
6
,
"typeName"
:
"企业个人会员"
},
{
"id"
:
7
,
"typeName"
:
"渠道企业会员"
},
{
"id"
:
8
,
"typeName"
:
"渠道个人会员"
}
],
"businessType"
:
[
{
"id"
:
1
,
"typeName"
:
"采购"
},
{
"id"
:
2
,
"typeName"
:
"商品销售"
},
{
"id"
:
3
,
"typeName"
:
"加工服务"
},
{
"id"
:
4
,
"typeName"
:
"物流服务"
},
{
"id"
:
5
,
"typeName"
:
"金融服务"
},
{
"id"
:
6
,
"typeName"
:
"保险服务"
}
]
},
"useDetail"
:
[
{
"groupName"
:
"联系信息"
,
"elements"
:
[
{
"id"
:
26
,
"fieldName"
:
"contact"
,
"fieldCNName"
:
"联系人"
,
"fieldType"
:
"String"
,
"fieldLength"
:
100
,
"fieldEmpty"
:
0
,
"fieldOrder"
:
1
,
"fieldRemark"
:
"test"
,
"checkRules"
:
[]
},
{
"id"
:
27
,
"fieldName"
:
"fixed_contact_number"
,
"fieldCNName"
:
"固定联系电话"
,
"fieldType"
:
"String"
,
"fieldLength"
:
100
,
"fieldEmpty"
:
0
,
"fieldOrder"
:
1
,
"fieldRemark"
:
"test"
,
"checkRules"
:
[]
},
{
"id"
:
28
,
"fieldName"
:
"phone_number"
,
"fieldCNName"
:
"手机号码"
,
"fieldType"
:
"String"
,
"fieldLength"
:
100
,
"fieldEmpty"
:
0
,
"fieldOrder"
:
1
,
"fieldRemark"
:
"test"
,
"checkRules"
:
[]
},
{
"id"
:
29
,
"fieldName"
:
"fax_number"
,
"fieldCNName"
:
"传真号码"
,
"fieldType"
:
"String"
,
"fieldLength"
:
100
,
"fieldEmpty"
:
0
,
"fieldOrder"
:
1
,
"fieldRemark"
:
"test"
,
"checkRules"
:
[]
},
{
"id"
:
30
,
"fieldName"
:
"address"
,
"fieldCNName"
:
"地址"
,
"fieldType"
:
"String"
,
"fieldLength"
:
100
,
"fieldEmpty"
:
0
,
"fieldOrder"
:
1
,
"fieldRemark"
:
"test"
,
"checkRules"
:
[]
},
{
"id"
:
31
,
"fieldName"
:
"zip_code"
,
"fieldCNName"
:
"邮编"
,
"fieldType"
:
"String"
,
"fieldLength"
:
100
,
"fieldEmpty"
:
0
,
"fieldOrder"
:
1
,
"fieldRemark"
:
"test"
,
"checkRules"
:
[]
},
{
"id"
:
32
,
"fieldName"
:
"url"
,
"fieldCNName"
:
"网址"
,
"fieldType"
:
"String"
,
"fieldLength"
:
100
,
"fieldEmpty"
:
0
,
"fieldOrder"
:
1
,
"fieldRemark"
:
"test"
,
"checkRules"
:
[]
},
{
"id"
:
33
,
"fieldName"
:
"email"
,
"fieldCNName"
:
"邮箱"
,
"fieldType"
:
"String"
,
"fieldLength"
:
100
,
"fieldEmpty"
:
0
,
"fieldOrder"
:
1
,
"fieldRemark"
:
"test"
,
"checkRules"
:
[]
}
]
},
{
"groupName"
:
"营业执照信息"
,
"elements"
:
[
{
"id"
:
10
,
"fieldName"
:
"company_name"
,
"fieldCNName"
:
"公司名称"
,
"fieldType"
:
"String"
,
"fieldLength"
:
100
,
"fieldEmpty"
:
0
,
"fieldOrder"
:
1
,
"fieldRemark"
:
"test"
,
"checkRules"
:
[]
},
{
"id"
:
11
,
"fieldName"
:
"enterprise_type"
,
"fieldCNName"
:
"企业类型"
,
"fieldType"
:
"String"
,
"fieldLength"
:
100
,
"fieldEmpty"
:
0
,
"fieldOrder"
:
1
,
"fieldRemark"
:
"test"
,
"checkRules"
:
[]
},
{
"id"
:
12
,
"fieldName"
:
"residence"
,
"fieldCNName"
:
"住所"
,
"fieldType"
:
"String"
,
"fieldLength"
:
100
,
"fieldEmpty"
:
0
,
"fieldOrder"
:
1
,
"fieldRemark"
:
"test"
,
"checkRules"
:
[]
},
{
"id"
:
13
,
"fieldName"
:
"legal_representative"
,
"fieldCNName"
:
"法定代表人"
,
"fieldType"
:
"String"
,
"fieldLength"
:
100
,
"fieldEmpty"
:
0
,
"fieldOrder"
:
1
,
"fieldRemark"
:
"test"
,
"checkRules"
:
[]
},
{
"id"
:
14
,
"fieldName"
:
"register_capital"
,
"fieldCNName"
:
"注册资本"
,
"fieldType"
:
"String"
,
"fieldLength"
:
100
,
"fieldEmpty"
:
0
,
"fieldOrder"
:
1
,
"fieldRemark"
:
"test"
,
"checkRules"
:
[]
},
{
"id"
:
15
,
"fieldName"
:
"establish_date"
,
"fieldCNName"
:
"成立日期"
,
"fieldType"
:
"String"
,
"fieldLength"
:
100
,
"fieldEmpty"
:
0
,
"fieldOrder"
:
1
,
"fieldRemark"
:
"test"
,
"checkRules"
:
[]
},
{
"id"
:
16
,
"fieldName"
:
"business_term"
,
"fieldCNName"
:
"营业期限"
,
"fieldType"
:
"String"
,
"fieldLength"
:
100
,
"fieldEmpty"
:
0
,
"fieldOrder"
:
1
,
"fieldRemark"
:
"test"
,
"checkRules"
:
[]
},
{
"id"
:
17
,
"fieldName"
:
"business_scope"
,
"fieldCNName"
:
"经营范围"
,
"fieldType"
:
"String"
,
"fieldLength"
:
100
,
"fieldEmpty"
:
0
,
"fieldOrder"
:
1
,
"fieldRemark"
:
"test"
,
"checkRules"
:
[]
},
{
"id"
:
18
,
"fieldName"
:
"registration_authority"
,
"fieldCNName"
:
"登记机关"
,
"fieldType"
:
"String"
,
"fieldLength"
:
100
,
"fieldEmpty"
:
0
,
"fieldOrder"
:
1
,
"fieldRemark"
:
"test"
,
"checkRules"
:
[]
},
{
"id"
:
19
,
"fieldName"
:
"registration_time"
,
"fieldCNName"
:
"登记时间"
,
"fieldType"
:
"String"
,
"fieldLength"
:
100
,
"fieldEmpty"
:
0
,
"fieldOrder"
:
1
,
"fieldRemark"
:
"test"
,
"checkRules"
:
[]
},
{
"id"
:
20
,
"fieldName"
:
"unified_social_credit_code"
,
"fieldCNName"
:
"统一社会信用代码"
,
"fieldType"
:
"String"
,
"fieldLength"
:
100
,
"fieldEmpty"
:
0
,
"fieldOrder"
:
1
,
"fieldRemark"
:
"test"
,
"checkRules"
:
[]
},
{
"id"
:
21
,
"fieldName"
:
"business_license"
,
"fieldCNName"
:
"营业执照"
,
"fieldType"
:
"file"
,
"fieldLength"
:
100
,
"fieldEmpty"
:
0
,
"fieldOrder"
:
1
,
"fieldRemark"
:
"test"
,
"checkRules"
:
[]
}
]
},
{
"groupName"
:
"填写会员基本信息"
,
"elements"
:
[
{
"id"
:
1
,
"fieldName"
:
"member_type"
,
"fieldCNName"
:
"会员类型"
,
"fieldType"
:
"String"
,
"fieldLength"
:
100
,
"fieldEmpty"
:
0
,
"fieldOrder"
:
1
,
"fieldRemark"
:
"test"
,
"checkRules"
:
[]
},
{
"id"
:
2
,
"fieldName"
:
"MEMBER_ROLE"
,
"fieldCNName"
:
"会员角色"
,
"fieldType"
:
"String"
,
"fieldLength"
:
100
,
"fieldEmpty"
:
0
,
"fieldOrder"
:
1
,
"fieldRemark"
:
"test"
,
"checkRules"
:
[]
},
{
"id"
:
3
,
"fieldName"
:
"member_level"
,
"fieldCNName"
:
"会员等级"
,
"fieldType"
:
"String"
,
"fieldLength"
:
100
,
"fieldEmpty"
:
0
,
"fieldOrder"
:
1
,
"fieldRemark"
:
"test"
,
"checkRules"
:
[]
},
{
"id"
:
4
,
"fieldName"
:
"REGISTER_PHONE"
,
"fieldCNName"
:
"注册手机号"
,
"fieldType"
:
"String"
,
"fieldLength"
:
100
,
"fieldEmpty"
:
0
,
"fieldOrder"
:
1
,
"fieldRemark"
:
"test"
,
"checkRules"
:
[]
},
{
"id"
:
5
,
"fieldName"
:
"register_email"
,
"fieldCNName"
:
"注册邮箱"
,
"fieldType"
:
"String"
,
"fieldLength"
:
100
,
"fieldEmpty"
:
0
,
"fieldOrder"
:
1
,
"fieldRemark"
:
"test"
,
"checkRules"
:
[]
}
]
},
{
"groupName"
:
"法定代表人信息"
,
"elements"
:
[
{
"id"
:
22
,
"fieldName"
:
"legal_name"
,
"fieldCNName"
:
"法人姓名"
,
"fieldType"
:
"String"
,
"fieldLength"
:
100
,
"fieldEmpty"
:
0
,
"fieldOrder"
:
1
,
"fieldRemark"
:
"test"
,
"checkRules"
:
[]
},
{
"id"
:
23
,
"fieldName"
:
"legal_phone"
,
"fieldCNName"
:
"法人手机号"
,
"fieldType"
:
"String"
,
"fieldLength"
:
100
,
"fieldEmpty"
:
0
,
"fieldOrder"
:
1
,
"fieldRemark"
:
"test"
,
"checkRules"
:
[]
},
{
"id"
:
24
,
"fieldName"
:
"legal_id_card"
,
"fieldCNName"
:
"法人身份证号"
,
"fieldType"
:
"String"
,
"fieldLength"
:
100
,
"fieldEmpty"
:
0
,
"fieldOrder"
:
1
,
"fieldRemark"
:
"test"
,
"checkRules"
:
[]
},
{
"id"
:
25
,
"fieldName"
:
"legal_id_card_information"
,
"fieldCNName"
:
"法人身份证信息"
,
"fieldType"
:
"file"
,
"fieldLength"
:
100
,
"fieldEmpty"
:
0
,
"fieldOrder"
:
1
,
"fieldRemark"
:
"test"
,
"checkRules"
:
[]
}
]
},
{
"groupName"
:
"填写渠道信息"
,
"elements"
:
[
{
"id"
:
6
,
"fieldName"
:
"channel_level"
,
"fieldCNName"
:
"渠道级别"
,
"fieldType"
:
"String"
,
"fieldLength"
:
100
,
"fieldEmpty"
:
0
,
"fieldOrder"
:
1
,
"fieldRemark"
:
"test"
,
"checkRules"
:
[]
},
{
"id"
:
7
,
"fieldName"
:
"channel_type"
,
"fieldCNName"
:
"渠道类型"
,
"fieldType"
:
"String"
,
"fieldLength"
:
100
,
"fieldEmpty"
:
0
,
"fieldOrder"
:
1
,
"fieldRemark"
:
"test"
,
"checkRules"
:
[]
},
{
"id"
:
8
,
"fieldName"
:
"agent_city"
,
"fieldCNName"
:
"代理地市"
,
"fieldType"
:
"String"
,
"fieldLength"
:
100
,
"fieldEmpty"
:
0
,
"fieldOrder"
:
1
,
"fieldRemark"
:
"test"
,
"checkRules"
:
[]
},
{
"id"
:
9
,
"fieldName"
:
"channel_describe"
,
"fieldCNName"
:
"渠道描述"
,
"fieldType"
:
"String"
,
"fieldLength"
:
100
,
"fieldEmpty"
:
0
,
"fieldOrder"
:
1
,
"fieldRemark"
:
"test"
,
"checkRules"
:
[]
}
]
}
]
},
"global"
:
{
"logo"
:
"http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/logo.png"
,
"countryList"
:
[
{
"name"
:
"简体中文-ZH"
,
"key"
:
"zh-CN"
,
"icon"
:
"http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/china.png"
},
{
"name"
:
"English-EN"
,
"key"
:
"en-US"
,
"icon"
:
"http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/us.png"
},
{
"name"
:
"日本語-JP"
,
"key"
:
"jp"
,
"icon"
:
"http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/japen.png"
},
{
"name"
:
"한국어-KO"
,
"key"
:
"ko"
,
"icon"
:
"http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/koren.png"
}
]
}
}
\ No newline at end of file
config/routes/index.ts
View file @
7d91a387
...
...
@@ -34,10 +34,12 @@ const memberCenterRoute = {
...
routes
,
{
path
:
'/noAuth'
,
auth
:
false
,
component
:
'@/pages/403'
,
},
// 能力中心的404页
{
auth
:
false
,
component
:
'@/pages/404'
,
},
],
...
...
src/app.tsx
View file @
7d91a387
...
...
@@ -7,13 +7,13 @@ import '@/global/styles/global.less'; // 导入全局样式
// 默认引入所有的ant样式, 不引入css因为无法做到变量覆盖
import
'antd/dist/antd.less'
import
{
isDev
}
from
'@/constants'
import
{
setup
}
from
'@formily/antd-components'
;
import
{
GlobalConfig
}
from
'./global/config'
;
import
{
asyncRouter
}
from
'./utils/asyncRouter'
;
import
{
getRouters
,
getAuth
}
from
'./utils/auth'
;
import
{
getRouters
,
getAuth
,
asyncRouter
}
from
'./utils/auth'
;
setup
()
// let routeAuthUrls: any[] = []
// 路由白名单
const
whiteLists
=
[
...
...
@@ -40,6 +40,9 @@ const whiteLists = [
*
*/
export
function
patchRoutes
({
routes
}:
IRoutes
)
{
if
(
isDev
)
{
return
;
}
asyncRouter
(
getRouters
(),
routes
)
}
...
...
@@ -62,10 +65,14 @@ export function render(oldRender:Function) {
*/
export
function
onRouteChange
({
routes
,
matchedRoutes
,
location
,
action
})
{
console
.
log
(
`当前可访问的路由为`
)
console
.
log
(
routes
)
console
.
log
(
routes
,
matchedRoutes
,
location
)
if
(
isDev
)
{
return
;
}
if
(
whiteLists
.
includes
(
location
.
pathname
))
return
;
const
routeAuthUrls
=
getRouters
()
// 是否登录
if
(
getAuth
())
{
if
(
routeAuthUrls
.
includes
(
location
.
pathname
))
{
...
...
src/constants/index.ts
View file @
7d91a387
...
...
@@ -8,6 +8,9 @@ export const MALL_TYPE = {
5
:
'渠道积分商城'
}
// 本地环境跳过权限校验
export
const
isDev
=
true
export
const
Environment_Status
=
{
0
:
"所有"
,
1
:
"PC"
,
...
...
src/global/config/global.d.ts
View file @
7d91a387
...
...
@@ -13,26 +13,9 @@ export interface UseType {
businessType
:
BusinessType
[];
}
export
interface
Element
{
id
:
number
;
fieldName
:
string
;
fieldCNName
:
string
;
fieldType
:
string
;
fieldLength
:
number
;
fieldEmpty
:
number
;
fieldOrder
:
number
;
fieldRemark
:
string
;
checkRules
:
any
[];
}
export
interface
UseDetail
{
groupName
:
string
;
elements
:
Element
[];
}
export
interface
UserRegister
{
useType
:
UseType
;
useDetail
:
UseDetail
[];
useDetail
:
any
[];
}
export
interface
CountryList
{
...
...
src/layouts/components/OuterSide.tsx
View file @
7d91a387
...
...
@@ -4,6 +4,7 @@ import { AppstoreOutlined } from '@ant-design/icons'
import
{
Link
}
from
'umi'
import
styles
from
'../styles/MenuSlider.less'
import
{
getRouters
}
from
'@/utils/auth'
import
{
isDev
}
from
'@/constants'
const
{
Sider
}
=
Layout
...
...
@@ -12,17 +13,27 @@ export interface OuterSiderProps {
pathname
:
string
|
undefined
;
}
const
OuterSider
:
React
.
FC
<
OuterSiderProps
>
=
(
props
)
=>
{
const
{
menuData
,
pathname
=
"/"
}
=
props
const
authRouters
=
getRouters
()
let
defaultSelectedKeys
:
string
=
""
const
isAuthPath
=
(
path
)
=>
{
if
(
isDev
)
{
return
true
}
else
{
return
authRouters
.
includes
(
path
)
}
}
const
getSubMenu
=
()
=>
{
const
subHeadMenus
:
Array
<
any
>
=
[]
menuData
.
forEach
(
item
=>
{
if
(
pathname
.
indexOf
(
item
.
key
)
>
-
1
)
{
defaultSelectedKeys
=
item
.
key
}
!
item
.
hideInMenu
&&
authRouters
.
includes
(
item
.
path
)
&&
subHeadMenus
.
push
({
!
item
.
hideInMenu
&&
isAuthPath
(
item
.
path
)
&&
subHeadMenus
.
push
({
path
:
item
.
path
,
title
:
item
.
name
,
icon
:
item
.
icon
,
...
...
src/utils/asyncRouter.ts
deleted
100644 → 0
View file @
719120aa
export
const
asyncRouter
=
async
(
routeLists
:
string
[],
routes
:
any
[])
=>
{
for
(
let
i
=
0
;
i
<
routes
.
length
;
i
++
)
{
const
item
=
routes
[
i
]
if
(
item
.
routes
)
{
asyncRouter
(
routeLists
,
item
.
routes
)
}
else
{
// 参与权限校验的页面
if
(
item
.
path
&&
!
routeLists
.
includes
(
item
.
path
))
{
item
.
hideInMenu
=
true
item
.
noAuth
=
true
}
}
}
}
src/utils/auth.ts
View file @
7d91a387
...
...
@@ -35,3 +35,18 @@ export const removeRouters = () => {
export
const
removeAuth
=
()
=>
{
window
.
localStorage
.
removeItem
(
'auth'
)
}
export
const
asyncRouter
=
async
(
routeLists
:
string
[],
routes
:
any
[])
=>
{
for
(
let
i
=
0
;
i
<
routes
.
length
;
i
++
)
{
const
item
=
routes
[
i
]
if
(
item
.
routes
)
{
asyncRouter
(
routeLists
,
item
.
routes
)
}
else
{
// 参与权限校验的页面
if
(
item
.
path
&&
!
routeLists
.
includes
(
item
.
path
))
{
item
.
hideInMenu
=
true
item
.
noAuth
=
true
}
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment