Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-admin
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
linweijiong
jinfa-admin
Commits
51684410
Commit
51684410
authored
Jun 23, 2022
by
wuting
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'v2-220618' of…
Merge branch 'v2-220618' of
https://gitlab.shushangyun.com/linkseeks-design/pro-admin
into jinfa-0618
parents
f0102b20
b0af6ab1
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
73 additions
and
36 deletions
+73
-36
index.ts
config/routes/index.ts
+1
-1
MenuSlider.tsx
src/layouts/components/MenuSlider.tsx
+2
-3
OuterSide.tsx
src/layouts/components/OuterSide.tsx
+6
-8
index.tsx
src/layouts/index.tsx
+1
-1
index.tsx
src/pages/memberManage/components/ListWrap/index.tsx
+3
-2
index.tsx
...mberManage/memberMaintain/components/MemberForm/index.tsx
+58
-17
index.tsx
...age/memberMaintain/components/MemberForm/schema/index.tsx
+2
-4
No files found.
config/routes/index.ts
View file @
51684410
...
...
@@ -74,4 +74,4 @@ const mountRouter = [
const
router
=
isDev
?
localRouter
:
mountRouter
export
{
router
,
isDev
};
export
{
router
,
isDev
};
src/layouts/components/MenuSlider.tsx
View file @
51684410
...
...
@@ -10,7 +10,7 @@ import {
import
OuterSider
from
'./OuterSide'
import
styles
from
'../styles/MenuSlider.less'
import
{
getRouters
}
from
'@/utils/auth'
;
import
{
isDev
}
from
'@/constants'
;
// import { isDev } from '../../../config/routes'
import
menuIcon
from
'../../asserts/menuIcon/logo.png'
const
{
Sider
}
=
Layout
const
{
SubMenu
}
=
Menu
;
...
...
@@ -29,7 +29,6 @@ const MenuSlider: React.FC<MenuSliderProps> = (props) => {
const
{
menuData
,
pathname
,
currentSelectKey
=
[],
openKeys
=
[],
changeOpenKeys
}
=
props
const
[
innerCollapsed
,
setInnerCollapsed
]
=
useState
(
false
)
let
menuItemsCache
=
null
const
getMenuRouter
=
(
routes
:
any
,
pathname
:
any
)
=>
{
const
list
=
routes
.
filter
((
item
:
any
)
=>
pathname
.
indexOf
(
item
.
key
)
>
-
1
)
return
list
[
0
]
...
...
@@ -39,7 +38,7 @@ const MenuSlider: React.FC<MenuSliderProps> = (props) => {
if
(
!!
menuArray
&&
menuArray
.
length
>
0
)
{
return
menuArray
.
map
((
item
:
any
)
=>
{
// 不存在路由表内或者 需要隐藏
if
(
item
.
hideInMenu
||
(
!
getRouters
().
includes
(
item
.
path
)
&&
!
isDev
)
)
{
if
(
item
.
hideInMenu
)
{
return
null
}
...
...
src/layouts/components/OuterSide.tsx
View file @
51684410
...
...
@@ -3,7 +3,7 @@ import { Layout, Menu, Avatar, Image } from 'antd'
import
{
Link
}
from
'umi'
import
styles
from
'../styles/MenuSlider.less'
import
{
getRouters
}
from
'@/utils/auth'
import
{
isDev
}
from
'@/constant
s'
// import { isDev } from '../../../config/route
s'
import
{
observer
,
inject
}
from
'mobx-react'
;
import
CustomIcon
from
'./CustomIcon'
;
import
Icon
from
'@ant-design/icons'
;
...
...
@@ -22,25 +22,23 @@ const OuterSider: React.FC<OuterSiderProps> = observer((props) => {
const
{
menuData
,
pathname
=
"/"
,
currentRouter
}
=
props
const
authRouters
=
getRouters
()
let
defaultSelectedKeys
=
""
const
isAuthPath
=
(
path
)
=>
{
if
(
isDev
)
{
//
if (isDev) {
return
true
}
else
{
return
authRouters
.
includes
(
path
)
}
//
} else {
//
return authRouters.includes(path)
//
}
}
const
getSubMenu
=
()
=>
{
const
subHeadMenus
:
Array
<
any
>
=
[]
menuData
.
forEach
(
item
=>
{
// 为适配pass菜单自由组合变更, 使用code进行高亮显示
const
code
=
currentRouter
.
relationParentCode
const
code
=
currentRouter
?
.
relationParentCode
// console.log(code, item.relationParentCode)
if
(
code
&&
code
===
item
.
relationParentCode
)
{
defaultSelectedKeys
=
item
.
relationParentCode
}
!
item
.
hideInMenu
&&
isAuthPath
(
item
.
path
)
&&
subHeadMenus
.
push
({
path
:
item
.
path
,
title
:
item
.
name
,
...
...
src/layouts/index.tsx
View file @
51684410
...
...
@@ -143,7 +143,7 @@ const BasicLayout: React.FC<any> = (props) => {
minWidth
:
'1280px'
,
}
:
{}
return
currentRouter
.
noLayout
?
props
.
children
:
(
return
currentRouter
?
.
noLayout
?
props
.
children
:
(
<
ProLayout
pageTitleRender=
{
()
=>
currentRouter
?
currentRouter
.
name
:
window
.
location
.
href
}
// contentStyle={{minWidth: '1280px'}}
...
...
src/pages/memberManage/components/ListWrap/index.tsx
View file @
51684410
...
...
@@ -61,7 +61,8 @@ const ListWrap: React.FC<ListType> = (props) => {
currentListData
.
length
&&
currentListData
.
forEach
(
item
=>
{
let
obj
=
{}
item
.
map
(
val
=>
{
return
obj
[
val
.
fieldName
]
=
val
.
fieldValue
obj
[
val
.
fieldName
]
=
val
.
fieldValue
obj
.
key
=
val
.
fieldOrder
})
sumData
.
push
(
obj
)
})
...
...
@@ -71,7 +72,7 @@ const ListWrap: React.FC<ListType> = (props) => {
},
[
currentListData
])
return
(
<
Table
columns=
{
tableCoumns
}
pagination=
{
false
}
dataSource=
{
tableData
}
style=
{
{
width
:
'95%'
}
}
/>
<
Table
rowKey=
'key'
columns=
{
tableCoumns
}
pagination=
{
false
}
dataSource=
{
tableData
}
style=
{
{
width
:
'95%'
}
}
/>
)
}
...
...
src/pages/memberManage/memberMaintain/components/MemberForm/index.tsx
View file @
51684410
...
...
@@ -10,7 +10,7 @@ import { history, Prompt } from 'umi';
import
{
Button
,
Card
,
Spin
,
message
}
from
'antd'
;
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
;
import
{
SaveOutlined
}
from
'@ant-design/icons'
;
import
{
createFormActions
,
FormEffectHooks
,
FormPath
}
from
'@formily/antd'
;
import
{
createFormActions
,
FormEffectHooks
,
FormPath
,
IFormExtendsEffectSelector
,
ISchemaFormActions
,
ISchemaFormAsyncActions
}
from
'@formily/antd'
;
import
{
Radio
,
Checkbox
,
ArrayTable
}
from
'@formily/antd-components'
;
import
ReutrnEle
from
'@/components/ReturnEle'
;
import
NiceForm
from
'@/components/NiceForm'
;
...
...
@@ -85,9 +85,10 @@ const MemberForm: React.FC<MemberFormProps> = ({
...
rest
}:
any
=
infoRes
.
data
;
// 注册资料处理
const
detail
=
{}
,
list
=
[]
const
detail
=
{}
for
(
let
i
=
0
;
i
<
groups
.
length
;
i
++
)
{
const
item
=
groups
[
i
];
const
item
=
groups
[
i
]
if
(
item
.
elements
)
{
for
(
let
j
=
0
;
j
<
item
.
elements
.
length
;
j
++
)
{
const
ele
=
item
.
elements
[
j
];
...
...
@@ -95,14 +96,13 @@ const MemberForm: React.FC<MemberFormProps> = ({
detail
[
ele
.
fieldName
]
=
ele
.
fieldValue
;
}
if
(
ele
.
fieldType
===
'list'
)
{
ele
.
registers
&&
ele
.
registers
.
forEach
(
element
=>
{
let
obj
=
{}
element
.
map
(
val
=>
{
detail
[
ele
.
fieldName
]
=
ele
.
registers
?.
map
(
element
=>
{
let
obj
=
{}
;
element
.
forEach
(
val
=>
{
obj
[
val
.
fieldName
]
=
val
.
fieldValue
;
})
list
.
push
(
obj
)
})
detail
[
ele
.
fieldName
]
=
list
});
return
obj
;
});
}
}
}
...
...
@@ -211,21 +211,21 @@ const MemberForm: React.FC<MemberFormProps> = ({
const
res
=
await
getMemberMaintenanceAddpageitems
();
if
(
res
.
code
===
1000
)
{
const
{
data
=
{}
}:
any
=
res
;
const
{
data
}
=
res
;
const
{
memberTypes
=
[]
,
countryCodes
=
[]
,
memberTypes
,
countryCodes
,
}
=
data
;
return
{
memberTypeId
:
memberTypes
.
map
(
item
=>
({
label
:
item
.
memberTypeName
,
value
:
item
.
memberTypeId
})),
countryCodeId
:
countryCodes
.
map
(
item
=>
({
label
:
item
.
text
,
value
:
item
.
id
})),
memberTypeId
:
memberTypes
?
.
map
(
item
=>
({
label
:
item
.
memberTypeName
,
value
:
item
.
memberTypeId
})),
countryCodeId
:
countryCodes
?.
map
(
item
=>
({
label
:
item
.
text
,
value
:
item
.
id
,
phoneLength
:
item
.
phoneLength
})),
};
}
return
{};
};
const
useBusinessEffects
=
()
=>
{
const
useBusinessEffects
=
(
$
:
IFormExtendsEffectSelector
<
any
,
ISchemaFormActions
|
ISchemaFormAsyncActions
>
)
=>
{
const
linkage
=
useLinkageUtils
();
// 间接触发根据会员类型
...
...
@@ -316,6 +316,47 @@ const MemberForm: React.FC<MemberFormProps> = ({
},
0
);
});
// 国家区号改变,触发电话号码校验
onFieldInputChange$
(
'countryCodeId'
).
subscribe
(()
=>
{
const
phoneValue
=
formActions
.
getFieldValue
(
'phone'
);
if
(
phoneValue
)
{
formActions
.
setFieldState
(
'phone'
,
(
state
)
=>
{
state
.
value
=
''
;
});
}
});
// 国家区号改变,触发电话号码校验
onFieldValueChange$
(
'countryCodeId'
).
subscribe
((
fieldState
)
=>
{
const
current
=
fieldState
.
props
.
enum
?.
find
((
item
)
=>
item
.
value
===
fieldState
.
value
);
if
(
current
&&
current
.
phoneLength
)
{
formActions
.
setFieldState
(
'phone'
,
(
state
)
=>
{
state
.
rules
=
[
{
required
:
true
,
message
:
'请输入你的手机号码'
,
},
{
validator
:
(
value
)
=>
{
return
value
?.
length
>
current
.
phoneLength
?
`注册手机号超出
${
current
.
phoneLength
}
位数`
:
''
;
},
},
];
});
}
});
// 订阅 countryCodeId 选项初始化
$
(
'requestAsyncSelect'
).
subscribe
(({
name
:
names
,
payload
})
=>
{
const
countryCodeIdValue
=
formActions
.
getFieldValue
(
'countryCodeId'
);
if
(
names
.
includes
(
'countryCodeId'
)
&&
payload
.
countryCodeId
?.
length
&&
countryCodeIdValue
)
{
formActions
.
setFieldValue
(
'countryCodeId'
,
countryCodeIdValue
);
}
});
}
return
(
...
...
@@ -353,7 +394,7 @@ const MemberForm: React.FC<MemberFormProps> = ({
getPageitemsBasic
,
);
useBusinessEffects
();
useBusinessEffects
(
$
);
onFormInputChange$
().
subscribe
(()
=>
{
if
(
!
unsaved
)
{
...
...
src/pages/memberManage/memberMaintain/components/MemberForm/schema/index.tsx
View file @
51684410
...
...
@@ -82,18 +82,16 @@ export const initDetailSchema = (props: GroupItem[]) => {
},
phone
:
{
type
:
'string'
,
required
:
true
,
'x-mega-props'
:
{
span
:
2
,
},
'x-component-props'
:
{
placeholder
:
'请输入你的手机号码'
,
maxLength
:
11
,
},
'x-rules'
:
[
{
pattern
:
PATTERN_MAPS
.
phone
,
message
:
'请输入
正确格式的手机号'
,
required
:
true
,
message
:
'请输入
你的手机号码'
,
},
],
},
...
...
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