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
shenshaokai
jinfa-platform
Commits
3df134d9
Commit
3df134d9
authored
Dec 01, 2021
by
前端-李俊鑫
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 内容能力-》资讯等国际化
parent
4a6906cb
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
407 additions
and
751 deletions
+407
-751
index.tsx
src/components/StatusSwitch/index.tsx
+7
-6
common.ts
src/locales/zh-CN/common.ts
+1
-0
content.ts
src/locales/zh-CN/content.ts
+23
-0
index.tsx
src/pages/content/category/index.tsx
+22
-19
schema.tsx
src/pages/content/category/schema.tsx
+88
-83
index.tsx
src/pages/content/columnManagement/index.tsx
+1
-8
index.tsx
src/pages/content/columnManagement/schema/index.tsx
+0
-119
index.tsx
src/pages/content/infomation/index.tsx
+0
-0
index.tsx
src/pages/content/infomation/schema/index.tsx
+73
-251
index.tsx
src/pages/content/tagsManagement/index.tsx
+135
-105
index.tsx
src/pages/content/tagsManagement/schema/index.tsx
+0
-105
tagsInfo.tsx
src/pages/content/tagsManagement/tagsInfo.tsx
+57
-55
No files found.
src/components/StatusSwitch/index.tsx
View file @
3df134d9
import
React
from
'react'
import
{
Popconfirm
,
Button
}
from
'antd'
import
{
PlayCircleOutlined
,
PauseCircleOutlined
}
from
'@ant-design/icons'
import
{
useIntl
}
from
'umi'
;
export
interface
StatusSwitchProps
{
record
:
any
,
...
...
@@ -11,14 +12,15 @@ export interface StatusSwitchProps {
}
const
StatusSwitch
:
React
.
FC
<
StatusSwitchProps
>
=
(
props
)
=>
{
const
intl
=
useIntl
()
const
{
record
,
fieldNames
=
'status'
,
expectTrueValue
=
1
}
=
props
return
(
<
Popconfirm
title=
"确定要执行这个操作?"
title=
{
intl
.
formatMessage
({
id
:
'common.tip.option.confirm'
})
}
onConfirm=
{
props
.
handleConfirm
}
onCancel=
{
props
.
handleCancel
}
okText=
"是"
cancelText=
"否"
okText=
{
intl
.
formatMessage
({
id
:
'common.button.yes'
})
}
cancelText=
{
intl
.
formatMessage
({
id
:
'common.button.no'
})
}
>
<
Button
type=
"link"
...
...
@@ -28,7 +30,7 @@ const StatusSwitch:React.FC<StatusSwitchProps> = (props) => {
:
{
color
:
'red'
}
}
>
{
record
[
fieldNames
]
===
expectTrueValue
?
'有效'
:
'无效'
}
{
record
[
fieldNames
]
===
expectTrueValue
?
intl
.
formatMessage
({
id
:
'common.status.effective'
})
:
intl
.
formatMessage
({
id
:
'common.status.invalid'
})
}
{
record
[
fieldNames
]
===
expectTrueValue
?
(
<
PlayCircleOutlined
/>
)
:
(
...
...
@@ -41,4 +43,4 @@ const StatusSwitch:React.FC<StatusSwitchProps> = (props) => {
StatusSwitch
.
defaultProps
=
{}
export
default
StatusSwitch
\ No newline at end of file
export
default
StatusSwitch
src/locales/zh-CN/common.ts
View file @
3df134d9
...
...
@@ -68,6 +68,7 @@
'common.form.endTime.placeholder'
:
'结束时间'
,
'common.form.activity.startTime.placeholder'
:
'活动开始时间'
,
'common.form.activity.endTime.placeholder'
:
'活动结束时间'
,
'common.form.input.placeholder'
:
'请输入'
,
}
src/locales/zh-CN/content.ts
View file @
3df134d9
...
...
@@ -2,6 +2,12 @@
* 内容能力
*/
export
default
{
'content.common.up'
:
'上架'
,
'content.common.down'
:
'下架'
,
'content.common.waitUp'
:
'待上架'
,
'content.common.hadUp'
:
'已上架'
,
'content.common.hadDown'
:
'已下架'
,
'content.columns.name'
:
'栏目名称'
,
'content.columns.category'
:
'栏目分类'
,
'content.columns.sort'
:
'栏目排序'
,
...
...
@@ -10,5 +16,22 @@
'content.columns.add'
:
'新建栏目'
,
'content.columns.edit'
:
'编辑栏目'
,
'content.category.name'
:
'分类名称'
,
'content.category.type'
:
'类型'
,
'content.category.recommend'
:
'推荐分类'
,
'content.category.selectEditProject'
:
'选择要编辑的项目'
,
'content.category.noCategoryTips'
:
'暂无分类, 开始新增'
,
'content.category.handleTips'
:
'只能同时对7个一级分类下的第三级分类设置推荐分类,且每个一级分类下最多只允许设置2个推荐分类'
,
'content.tag.name'
:
'标签名称'
,
'content.tag.explain'
:
'标签说明'
,
'content.tag.add'
:
'新建标签'
,
'content.tag.edit'
:
'编辑标签'
,
'content.info.title'
:
'标题'
,
'content.info.column'
:
'栏目'
,
'content.info.category'
:
'分类'
,
'content.info.time'
:
'发布时间'
,
'content.info.recommendTag'
:
'推荐标签'
,
'content.info.sort'
:
'排序'
,
}
src/pages/content/category/index.tsx
View file @
3df134d9
import
React
,
{
useState
,
useEffect
,
useMemo
}
from
'react'
import
{
Row
,
Col
,
Popconfirm
,
Button
,
Card
,
Tooltip
}
from
'antd'
;
import
Children
from
'@/components/NiceForm/components/Children'
;
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
;
import
TabTree
,
{
useTreeActions
,
createTreeActions
}
from
'@/components/TabTree'
;
import
SchemaForm
,
{
createFormActions
,
LifeCycleTypes
,
FormEffectHooks
,
FormButtonGroup
}
from
'@formily/antd'
;
import
{
Checkbox
}
from
'@formily/antd-components'
import
{
classSchema
}
from
'./schema'
import
React
,
{
useEffect
,
useMemo
}
from
'react'
import
{
Popconfirm
,
Button
,
Card
,
Tooltip
}
from
'antd'
;
import
TabTree
,
{
createTreeActions
}
from
'@/components/TabTree'
;
import
{
createFormActions
,
FormButtonGroup
}
from
'@formily/antd'
;
import
{
Checkbox
}
from
'@formily/antd-components'
;
import
{
useIntl
}
from
'umi'
;
import
{
classSchema
}
from
'./schema'
;
import
{
useTreeTabs
}
from
'@/hooks/useTreeTabs'
;
import
NiceForm
from
'@/components/NiceForm'
;
import
styles
from
'./index.less'
;
import
{
BorderOuterOutlined
,
QuestionCircleOutlined
}
from
'@ant-design/icons'
;
import
{
QuestionCircleOutlined
}
from
'@ant-design/icons'
;
import
{
getManageMemberCategoryAll
,
getManageMemberCategoryGet
,
postManageMemberCategoryAdd
,
postManageMemberCategoryDelete
,
postManageMemberCategoryUpdate
}
from
'@/services/ManageV2Api'
;
const
{
ON_FORM_INPUT_CHANGE
}
=
LifeCycleTypes
enum
FormState
{
FREE
,
// 空闲状态
EDIT
,
// 编辑状态
...
...
@@ -69,6 +66,7 @@ const fetchClassTreeData = async (params?) => {
const
ClassProperty
:
React
.
FC
<
{}
>
=
()
=>
{
const
intl
=
useIntl
()
const
{
treeStatus
,
setTreeStatus
,
...
...
@@ -164,7 +162,7 @@ const ClassProperty: React.FC<{}> = () => {
<
div
className=
{
styles
.
page
}
>
<
div
className=
{
styles
.
tree
}
>
<
Card
>
<
h3
className=
"mb-30"
>
选择要编辑的项目
</
h3
>
<
h3
className=
"mb-30"
>
{
intl
.
formatMessage
({
id
:
'content.category.selectEditProject'
})
}
</
h3
>
{
treeData
&&
treeData
.
length
>
0
?
<
TabTree
...
...
@@ -176,14 +174,14 @@ const ClassProperty: React.FC<{}> = () => {
customKey="id"
/
>
:
<
Button
block
type=
'primary'
onClick=
{
()
=>
handleSelect
()
}
>
暂无菜单, 开始新增
</
Button
>
<
Button
block
type=
'primary'
onClick=
{
()
=>
handleSelect
()
}
>
{
intl
.
formatMessage
({
id
:
'content.category.noCategoryTips'
})
}
</
Button
>
}
</
Card
>
</
div
>
<
div
className=
{
styles
.
editPanel
}
>
{
treeStatus
!==
FormState
.
FREE
&&
<>
<
h3
className=
"commonPanelTitle mb-30"
>
{
treeStatus
===
FormState
.
ADD
?
'新增'
:
'编辑'
}
</
h3
>
<
h3
className=
"commonPanelTitle mb-30"
>
{
intl
.
formatMessage
({
id
:
treeStatus
===
FormState
.
ADD
?
'common.button.add'
:
'common.button.edit'
})
}
</
h3
>
<
NiceForm
value=
{
formValue
}
components=
{
{
...
...
@@ -194,10 +192,10 @@ const ClassProperty: React.FC<{}> = () => {
onSubmit=
{
onFinish
}
actions=
{
formActions
}
effects=
{
(
$
,
action
)
=>
{}
}
schema=
{
classSchema
}
schema=
{
classSchema
()
}
expressionScope=
{
{
showWarn
:
(
<
Tooltip
placement=
"topLeft"
title=
{
"只能同时对7个一级分类下的第三级分类设置推荐分类,且每个一级分类下最多只允许设置2个推荐分类"
}
>
<
Tooltip
placement=
"topLeft"
title=
{
intl
.
formatMessage
({
id
:
'content.category.handleTips'
})
}
>
<
span
style=
{
{
marginTop
:
'-12px'
,
width
:
'50px'
}
}
>
<
QuestionCircleOutlined
/>
</
span
>
...
...
@@ -207,12 +205,17 @@ const ClassProperty: React.FC<{}> = () => {
>
<
FormButtonGroup
>
<
Button
htmlType=
'submit'
type=
"primary"
>
保存
{
intl
.
formatMessage
({
id
:
'common.button.save'
})
}
</
Button
>
<
Popconfirm
title=
"确定要删除吗?"
okText=
"是"
cancelText=
"否"
onConfirm=
{
handleDeleteMenu
}
>
<
Popconfirm
title=
{
intl
.
formatMessage
({
id
:
'common.tip.option.confirm'
})
}
okText=
{
intl
.
formatMessage
({
id
:
'common.button.yes'
})
}
cancelText=
{
intl
.
formatMessage
({
id
:
'common.button.no'
})
}
onConfirm=
{
handleDeleteMenu
}
>
{
treeStatus
!==
FormState
.
ADD
&&
<
Button
>
删除
{
intl
.
formatMessage
({
id
:
'common.button.delete'
})
}
</
Button
>
}
</
Popconfirm
>
...
...
src/pages/content/category/schema.tsx
View file @
3df134d9
import
{
ISchema
}
from
'@formily/antd'
;
import
{
useIntl
}
from
'umi'
;
export
const
classSchema
:
ISchema
=
{
type
:
'object'
,
properties
:
{
megaLayout
:
{
type
:
'object'
,
"x-component"
:
"mega-layout"
,
"x-component-props"
:
{
grid
:
true
,
columns
:
16
,
labelAlign
:
'top'
},
properties
:
{
noField1
:
{
type
:
'object'
,
"x-component"
:
'mega-layout'
,
"x-component-props"
:
{
full
:
true
,
"wrapperWidth"
:
507
,
},
"x-mega-props"
:
{
span
:
1
},
properties
:
{
name
:
{
type
:
'string'
,
title
:
'分类名称'
,
required
:
true
,
"x-component-props"
:
{
placeholder
:
'请输入分类名称'
},
"x-rules"
:
[
{
limitByte
:
true
,
maxByte
:
20
}
]
export
const
classSchema
=
():
ISchema
=>
{
const
intl
=
useIntl
()
return
{
type
:
'object'
,
properties
:
{
megaLayout
:
{
type
:
'object'
,
"x-component"
:
"mega-layout"
,
"x-component-props"
:
{
grid
:
true
,
columns
:
16
,
labelAlign
:
'top'
},
properties
:
{
noField1
:
{
type
:
'object'
,
"x-component"
:
'mega-layout'
,
"x-component-props"
:
{
full
:
true
,
"wrapperWidth"
:
507
,
},
describe
:
{
type
:
'textarea'
,
title
:
'类型'
,
"x-component-props"
:
{
placeholder
:
'最多100个字符,50个汉字'
},
"x-rules"
:
[
{
limitByte
:
true
,
maxByte
:
100
}
]
"x-mega-props"
:
{
span
:
1
},
level
:
{
type
:
'string'
,
visible
:
false
,
'x-linkages'
:
[
{
type
:
'value:visible'
,
target
:
'*(inlineLayout)'
,
condition
:
'{{$value === 3}}'
properties
:
{
name
:
{
type
:
'string'
,
title
:
intl
.
formatMessage
({
id
:
'content.category.name'
}),
required
:
true
,
"x-component-props"
:
{
placeholder
:
`
${
intl
.
formatMessage
({
id
:
'common.form.input.placeholder'
})}${
intl
.
formatMessage
({
id
:
'content.category.name'
})}
`
},
]
},
inlineLayout
:
{
type
:
'object'
,
"x-component"
:
"mega-layout"
,
"x-component-props"
:
{
inline
:
true
,
"x-rules"
:
[
{
limitByte
:
true
,
maxByte
:
20
}
]
},
properties
:
{
status
:
{
title
:
''
,
'x-component'
:
'CheckboxGroup'
,
enum
:
[
{
label
:
'推荐分类'
,
value
:
1
},
],
"x-mega-props"
:
{
"addonAfter"
:
"{{showWarn}}"
,
// wrapperWidth: 130
describe
:
{
type
:
'textarea'
,
title
:
intl
.
formatMessage
({
id
:
'content.category.type'
}),
"x-component-props"
:
{
placeholder
:
`100
${
intl
.
formatMessage
({
id
:
'common.unit.individual.character'
})}
,50
${
intl
.
formatMessage
({
id
:
'common.unit.individual.chinese'
})}
`
},
"x-rules"
:
[
{
limitByte
:
true
,
maxByte
:
100
}
]
},
level
:
{
type
:
'string'
,
visible
:
false
,
'x-linkages'
:
[
{
type
:
'value:visible'
,
target
:
'*(inlineLayout)'
,
condition
:
'{{$value === 3}}'
},
]
},
inlineLayout
:
{
type
:
'object'
,
"x-component"
:
"mega-layout"
,
"x-component-props"
:
{
inline
:
true
,
},
properties
:
{
status
:
{
title
:
''
,
'x-component'
:
'CheckboxGroup'
,
enum
:
[
{
label
:
intl
.
formatMessage
({
id
:
'content.category.recommend'
}),
value
:
1
},
],
"x-mega-props"
:
{
"addonAfter"
:
"{{showWarn}}"
,
// wrapperWidth: 130
},
},
}
}
}
// status1: {
// title: '',
// 'x-component': 'Children',
// "x-component-props": {
// "children": "{{renderCheckBox()}}"
// }
// }
}
},
// status1: {
// title: '',
// 'x-component': 'Children',
// "x-component-props": {
// "children": "{{renderCheckBox()}}"
// }
// }
}
},
}
}
}
}
...
...
src/pages/content/columnManagement/index.tsx
View file @
3df134d9
import
React
,
{
use
Effect
,
useState
,
use
Ref
}
from
'react'
;
import
React
,
{
useRef
}
from
'react'
;
import
{
Card
,
Button
,
Popconfirm
,
Row
,
Col
}
from
'antd'
;
import
{
createFormActions
,
ISchema
}
from
'@formily/antd'
;
import
{
history
,
useIntl
}
from
'umi'
;
...
...
@@ -6,7 +6,6 @@ import StatusSwitch from '@/components/StatusSwitch';
import
{
FORM_FILTER_PATH
}
from
'@/formSchema/const'
;
import
{
PlusOutlined
}
from
'@ant-design/icons'
import
{
ColumnType
}
from
'antd/lib/table/interface'
import
{
getTableDataSource
}
from
'../utils/utils'
;
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
import
NiceForm
from
'@/components/NiceForm'
;
import
EyePreview
from
'@/components/EyePreview'
...
...
@@ -15,12 +14,6 @@ import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilte
import
{
getManageMemberColumnPage
,
postManageMemberColumnDelete
,
postManageMemberColumnUpdateStatus
}
from
'@/services/ManageV2Api'
;
const
formActions
=
createFormActions
();
const
actions
=
createFormActions
();
const
getData
=
async
(
params
)
=>
{
const
res
=
await
getManageMemberColumnPage
(
params
)
return
res
.
data
}
const
columnList
:
React
.
FC
<
{}
>
=
()
=>
{
...
...
src/pages/content/columnManagement/schema/index.tsx
deleted
100644 → 0
View file @
4a6906cb
import
React
from
'react'
;
import
EyePreview
from
'@/components/EyePreview'
;
const
columns
=
[
{
title
:
'ID'
,
dataIndex
:
'id'
},
{
title
:
'栏目名称'
,
dataIndex
:
'name'
,
render
:
(
text
:
string
,
record
:
any
)
=>
(
<
EyePreview
url=
{
`/memberCenter/contentAbility/columnsManagement/detail?id=${record.id}&preview=1`
}
>
{
text
}
</
EyePreview
>
)
},
{
title
:
'栏目分类'
,
dataIndex
:
'type'
,
render
:
(
text
)
=>
text
===
1
?
'市场行情'
:
'资讯'
},
{
title
:
'栏目排序'
,
dataIndex
:
'sort'
},
{
title
:
'状态'
,
dataIndex
:
'status'
,
filters
:
[
{
text
:
'有效'
,
value
:
1
,
},
{
text
:
'无效'
,
value
:
0
,
},
],
onFilter
:
(
value
,
record
)
=>
record
.
status
===
value
,
render
:
"{{renderStatus}}"
},
{
title
:
'操作'
,
render
:
"{{renderOperation}}"
}
];
const
schema
=
{
type
:
'object'
,
properties
:
{
layout
:
{
type
:
'object'
,
// 'x-component': 'mega-layout',
'x-component'
:
'CustomFlexRowLayout'
,
'x-component-props'
:
{
justify
:
'space-between'
},
properties
:
{
createBtn
:
{
type
:
"object"
,
name
:
"createBtn"
,
"x-component"
:
"button"
,
"x-component-props"
:
{
"onClick"
:
"{{goToCreate}}"
,
"children"
:
"新建"
,
"type"
:
'primary'
}
},
'right-layout'
:
{
type
:
'object'
,
name
:
'rigth-layout'
,
"x-component"
:
'CustomFlexRowLayout'
,
"x-component-props"
:
{
justify
:
'center'
},
properties
:
{
search
:
{
type
:
'string'
,
name
:
'search'
,
'x-component'
:
'CustomSearch'
,
'x-component-props'
:
{
placeholder
:
"请填写栏目名称"
,
"onSearch"
:
"{{search}}"
,
}
},
searchBtn
:
{
type
:
'string'
,
name
:
'searchBtn'
,
"x-component"
:
"button"
,
"x-component-props"
:
{
"onClick"
:
"{{reset}}"
,
"children"
:
"重置"
,
style
:
{
marginLeft
:
'15px'
}
}
},
}
}
}
},
"table"
:
{
"key"
:
"table"
,
"type"
:
"object"
,
"name"
:
"table"
,
"x-component"
:
"SchemaTable"
,
"x-component-props"
:
{
"columns"
:
columns
,
"rowKey"
:
"id"
,
"pagination"
:
false
}
},
pagination
:
{
type
:
'object'
,
'x-component'
:
"TablePagination"
,
'x-style'
:
{
display
:
'flex'
,
flexDirection
:
'row'
,
justifyContent
:
'flex-end'
},
'x-component-props'
:
{
showQuickJumper
:
true
,
pageSize
:
10
,
size
:
'small'
}
}
}
}
export
default
schema
src/pages/content/infomation/index.tsx
View file @
3df134d9
This diff is collapsed.
Click to expand it.
src/pages/content/infomation/schema/index.tsx
View file @
3df134d9
This diff is collapsed.
Click to expand it.
src/pages/content/tagsManagement/index.tsx
View file @
3df134d9
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
Card
,
Input
,
Button
,
Table
,
Space
,
Popconfirm
}
from
'antd'
;
import
{
FilterTable
,
SchemaFlexRowLayout
}
from
'../components/FilterTable'
;
import
{
createVirtualBox
,
createFormActions
,
FormEffectHooks
,
createEffectHook
}
from
'@formily/antd'
;
import
{
history
,
Link
}
from
'umi'
;
import
React
,
{
useRef
}
from
'react'
;
import
{
Card
,
Button
,
Popconfirm
,
Row
,
Col
}
from
'antd'
;
import
EyePreview
from
'@/components/EyePreview'
;
import
NiceForm
from
'@/components/NiceForm'
;
import
{
ColumnType
}
from
'antd/lib/table/interface'
import
{
FORM_FILTER_PATH
}
from
'@/formSchema/const'
;
import
{
createFormActions
}
from
'@formily/antd'
;
import
{
history
,
useIntl
}
from
'umi'
;
import
StatusSwitch
from
'@/components/StatusSwitch'
;
import
tagsManagementSchema
from
'./schema'
;
import
TablePagination
from
'../components/TablePagination'
;
import
{
getTableDataSource
}
from
'../utils/utils'
;
import
CustomSearch
from
'../components/CustomSearch'
;
import
{
StandardTable
}
from
'god'
;
import
{
useStateFilterSearchLinkageEffect
}
from
'@/formSchema/effects/useFilterSearch'
;
import
{
getManageMemberLabelPage
,
postManageMemberLabelDelete
,
postManageMemberLabelUpdateStatus
}
from
'@/services/ManageV2Api'
;
const
{
onFieldValueChange$
}
=
FormEffectHooks
const
{
Search
}
=
Input
;
const
SchemaButton
=
createVirtualBox
(
'button'
,
Button
);
const
SchemaTable
=
createVirtualBox
(
'SchemaTable'
,
Table
);
const
actions
=
createFormActions
();
const
getData
=
async
(
params
)
=>
{
const
res
=
await
getManageMemberLabelPage
(
params
)
return
res
.
data
}
const
Tags
=
()
=>
{
const
tagEffects
=
()
=>
()
=>
{
onFieldValueChange$
(
'pagination'
).
subscribe
((
state
)
=>
{
handleSearch
({...
state
.
value
})
})
}
const
intl
=
useIntl
()
const
ref
=
useRef
<
any
>
({})
useEffect
(()
=>
{
const
params
=
{
current
:
1
,
pageSize
:
10
const
columns
:
ColumnType
<
any
>
[]
=
[
{
title
:
'ID'
,
dataIndex
:
'id'
},
{
title
:
intl
.
formatMessage
({
id
:
'content.tag.name'
}),
dataIndex
:
'name'
,
render
:
(
text
:
string
,
record
:
any
)
=>
(
<
EyePreview
url=
{
`/memberCenter/contentAbility/tagsManagement/detail?id=${record.id}&preview=1`
}
>
{
text
}
</
EyePreview
>
)
},
{
title
:
intl
.
formatMessage
({
id
:
'content.tag.explain'
}),
dataIndex
:
'explain'
},
{
title
:
intl
.
formatMessage
({
id
:
'common.table.status'
}),
align
:
'center'
,
dataIndex
:
'status'
,
key
:
'status'
,
render
:
(
text
:
any
,
record
:
any
)
=>
(
<
StatusSwitch
fieldNames=
"status"
handleConfirm=
{
()
=>
handleModify
(
record
)
}
record=
{
record
}
/>
)
},
{
title
:
intl
.
formatMessage
({
id
:
'common.table.action'
}),
align
:
'center'
,
key
:
'operate'
,
dataIndex
:
'operate'
,
render
:
(
_
,
record
)
=>
!
record
.
status
&&
(
<>
<
Button
type=
'link'
onClick=
{
()
=>
history
.
push
(
`/memberCenter/contentAbility/tagsManagement/detail?id=${record.id}`
)
}
>
{
intl
.
formatMessage
({
id
:
'common.button.modify'
})
}
</
Button
>
<
Popconfirm
title=
{
intl
.
formatMessage
({
id
:
'common.tip.option.confirm'
})
}
onConfirm=
{
()
=>
handleRemove
(
record
.
id
)
}
>
<
Button
type=
'link'
>
{
intl
.
formatMessage
({
id
:
'common.button.delete'
})
}
</
Button
>
</
Popconfirm
>
</>
)
}
getTableDataSource
(
actions
,
params
,
getData
);
},
[])
];
const
schema
=
{
type
:
'object'
,
properties
:
{
megalayout
:
{
type
:
'object'
,
"x-component"
:
'mega-layout'
,
"x-component-props"
:
{
grid
:
true
},
properties
:
{
ctl
:
{
type
:
'object'
,
"x-component"
:
"Children"
,
"x-component-props"
:
{
children
:
"{{controllerBtns}}"
}
},
name
:
{
type
:
'string'
,
"x-component"
:
"Search"
,
"x-mega-props"
:
{
},
"x-component-props"
:
{
placeholder
:
intl
.
formatMessage
({
id
:
'content.tag.name'
}),
advanced
:
false
}
}
}
}
}
}
// 获取列表
const
fetchData
=
(
params
:
any
)
=>
{
return
new
Promise
((
resolve
)
=>
{
getManageMemberLabelPage
(
params
).
then
(
res
=>
{
resolve
(
res
.
data
)
})
})
}
// 修改状态
const
handleModify
=
(
value
)
=>
{
...
...
@@ -44,94 +114,54 @@ const Tags = () => {
id
:
id
,
enableStatus
:
(
status
^
1
),
}
postManageMemberLabelUpdateStatus
(
postData
).
then
((
data
)
=>
{
const
paginationValue
=
actions
.
getFieldValue
(
'pagination'
);
handleSearch
({...
paginationValue
})
postManageMemberLabelUpdateStatus
(
postData
).
then
((
res
)
=>
{
if
(
res
.
code
===
1000
)
{
ref
.
current
.
reload
()
}
})
}
// 栏目删除
const
handleRemove
=
(
id
:
number
)
=>
{
///manage/contentColumn/delete
postManageMemberLabelDelete
({
id
:
id
})
.
then
(
async
(
data
)
=>
{
const
paginationValue
=
actions
.
getFieldValue
(
'pagination'
);
handleSearch
({...
paginationValue
})
postManageMemberLabelDelete
({
id
:
id
})
.
then
((
res
)
=>
{
if
(
res
.
code
===
1000
)
{
ref
.
current
.
reload
()
}
})
}
const
handleSearch
=
async
(
params
)
=>
{
const
title
=
actions
.
getFieldValue
(
'search'
);
const
postData
=
{
name
:
title
||
''
,
current
:
1
,
pageSize
:
10
,
...
params
,
}
getTableDataSource
(
actions
,
postData
,
getData
);
}
const
controllerBtns
=
<
Row
>
<
Col
span=
{
6
}
>
<
Button
onClick=
{
()
=>
history
.
push
(
'/memberCenter/contentAbility/tagsManagement/add'
)
}
type=
"primary"
>
{
intl
.
formatMessage
({
id
:
'common.button.add'
})
}
</
Button
>
</
Col
>
</
Row
>
// 重设页码
const
resetPagination
=
(
params
)
=>
{
const
paginationValue
=
actions
.
getFieldValue
(
'pagination'
);
actions
.
setFieldValue
(
'pagination'
,
{
...
paginationValue
,
...
params
})
}
return
(
<
div
>
<
Card
>
<
FilterTable
effects=
{
tagEffects
()
}
schema=
{
tagsManagementSchema
}
components=
{
{
CustomSearch
,
TablePagination
}
}
actions=
{
actions
}
expressionScope=
{
{
goToCreate
:
()
=>
{
history
.
push
(
`/memberCenter/contentAbility/tagsManagement/add`
)
},
search
:
(
value
)
=>
{
resetPagination
({
current
:
1
})
handleSearch
({
title
:
value
,
current
:
1
});
},
renderOperation
:
(
val
,
record
)
=>
{
return
(
<
Space
>
{
record
.
status
===
0
?
<>
<
Link
to=
{
`/memberCenter/contentAbility/tagsManagement/detail?id=${record.id}`
}
>
编辑
</
Link
>
<
Popconfirm
title=
"确定要执行这个操作?"
onConfirm=
{
()
=>
handleRemove
(
record
.
id
)
}
okText=
"是"
cancelText=
"否"
>
<
a
>
删除
</
a
>
</
Popconfirm
>
</>
:
null
}
</
Space
>
)
},
renderStatus
:
(
text
,
record
)
=>
{
return
(
<
StatusSwitch
handleConfirm=
{
()
=>
handleModify
(
record
)
}
record=
{
record
}
fieldNames=
"status"
/>
)
},
reset
:
()
=>
{
actions
.
setFieldValue
(
'search'
);
resetPagination
({
current
:
1
})
handleSearch
({
current
:
1
})
},
}
}
<
StandardTable
tableProps=
{
{
rowKey
:
'id'
}
}
columns=
{
columns
}
currentRef=
{
ref
}
fetchTableData=
{
(
params
:
any
)
=>
fetchData
(
params
)
}
controlRender=
{
<
NiceForm
actions=
{
actions
}
expressionScope=
{
{
controllerBtns
}
}
onSubmit=
{
values
=>
ref
.
current
.
reload
(
values
)
}
effects=
{
(
$
,
actions
)
=>
{
useStateFilterSearchLinkageEffect
(
$
,
actions
,
'title'
,
FORM_FILTER_PATH
)
}
}
schema=
{
schema
}
>
</
NiceForm
>
}
/>
</
Card
>
</
div
>
...
...
src/pages/content/tagsManagement/schema/index.tsx
deleted
100644 → 0
View file @
4a6906cb
import
React
from
'react'
;
import
EyePreview
from
'@/components/EyePreview'
;
const
columns
=
[
{
title
:
'ID'
,
dataIndex
:
'id'
},
{
title
:
'标签名称'
,
dataIndex
:
'name'
,
render
:
(
text
:
string
,
record
:
any
)
=>
(
<
EyePreview
url=
{
`/memberCenter/contentAbility/tagsManagement/detail?id=${record.id}&preview=1`
}
>
{
text
}
</
EyePreview
>
)
},
{
title
:
'标签说明'
,
dataIndex
:
'explain'
},
{
title
:
'状态'
,
dataIndex
:
'status'
,
render
:
"{{renderStatus}}"
,
width
:
120
},
{
title
:
'操作'
,
render
:
"{{renderOperation}}"
,
width
:
150
}
];
const
schema
=
{
type
:
'object'
,
properties
:
{
layout
:
{
type
:
'object'
,
// 'x-component': 'mega-layout',
'x-component'
:
'CustomFlexRowLayout'
,
'x-component-props'
:
{
justify
:
'space-between'
},
properties
:
{
createBtn
:
{
type
:
"object"
,
name
:
"createBtn"
,
"x-component"
:
"button"
,
"x-component-props"
:
{
"onClick"
:
"{{goToCreate}}"
,
"children"
:
"新建"
,
"type"
:
'primary'
}
},
'right-layout'
:
{
type
:
'object'
,
name
:
'rigth-layout'
,
"x-component"
:
'CustomFlexRowLayout'
,
"x-component-props"
:
{
justify
:
'center'
},
properties
:
{
search
:
{
type
:
'string'
,
name
:
'search'
,
'x-component'
:
'CustomSearch'
,
'x-component-props'
:
{
placeholder
:
"请填写标签名称"
,
"onSearch"
:
"{{search}}"
,
}
},
searchBtn
:
{
type
:
'string'
,
name
:
'searchBtn'
,
"x-component"
:
"button"
,
"x-component-props"
:
{
"onClick"
:
"{{reset}}"
,
"children"
:
"重置"
,
style
:
{
marginLeft
:
'15px'
}
}
},
}
}
}
},
"table"
:
{
"key"
:
"table"
,
"type"
:
"object"
,
"name"
:
"table"
,
"x-component"
:
"SchemaTable"
,
"x-component-props"
:
{
"dataSource"
:
[],
"columns"
:
columns
,
"rowKey"
:
"id"
,
"pagination"
:
false
}
},
pagination
:
{
type
:
'object'
,
'x-component'
:
"TablePagination"
,
'x-style'
:
{
display
:
'flex'
,
flexDirection
:
'row'
,
justifyContent
:
'flex-end'
},
'x-component-props'
:
{
showQuickJumper
:
true
,
pageSize
:
10
,
size
:
'small'
}
}
}
}
export
default
schema
;
src/pages/content/tagsManagement/tagsInfo.tsx
View file @
3df134d9
...
...
@@ -4,70 +4,71 @@ import { Card, Select, Input, Button } from 'antd';
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
;
import
ReutrnEle
from
'@/components/ReturnEle'
;
import
{
usePageStatus
}
from
'@/hooks/usePageStatus'
;
import
{
history
,
Prompt
}
from
'umi'
;
import
{
history
,
Prompt
,
useIntl
}
from
'umi'
;
import
{
useInitialValues
}
from
'../hooks/useInitialValues'
;
import
useCustomValidator
from
'../hooks/useValidator'
import
{
getManageMemberLabelGet
,
postManageMemberLabelAdd
,
postManageMemberLabelUpdate
}
from
'@/services/ManageV2Api'
;
const
{
TextArea
}
=
Input
;
const
schema
=
{
type
:
'object'
,
properties
:
{
layout
:
{
name
:
'layout'
,
type
:
'boject'
,
'x-component'
:
'mega-layout'
,
'x-component-props'
:
{
"labelCol"
:
3
,
"wrapperCol"
:
10
,
"labelAlign"
:
"left"
},
properties
:
{
name
:
{
name
:
'name'
,
title
:
'标签名称'
,
'x-component'
:
'Input'
,
"required"
:
true
,
"x-rules"
:
[
{
"required"
:
true
,
"message"
:
"请填写标签名称"
},
{
limitByte
:
true
,
// 自定义校验规则
maxByte
:
20
,
}
],
},
explain
:
{
name
:
'explain'
,
title
:
'标签说明'
,
'x-component'
:
'TextArea'
,
'x-component-props'
:
{
rows
:
5
},
"x-rules"
:
[
{
limitByte
:
true
,
// 自定义校验规则
maxByte
:
80
,
}
],
},
}
}
}
}
const
TagInfo
=
()
=>
{
useCustomValidator
();
const
intl
=
useIntl
()
const
{
id
,
preview
}
=
usePageStatus
();
const
[
submitLoading
,
setSubmitLoading
]
=
useState
(
false
);
const
initialValues
=
useInitialValues
({
id
:
id
},
getManageMemberLabelGet
);
const
isEdit
=
id
&&
!
preview
;
const
isAdd
=
!
id
&&
!
preview
;
const
[
unsaved
,
setUnsaved
]
=
useState
(
true
);
const
schema
=
{
type
:
'object'
,
properties
:
{
layout
:
{
name
:
'layout'
,
type
:
'boject'
,
'x-component'
:
'mega-layout'
,
'x-component-props'
:
{
"labelCol"
:
3
,
"wrapperCol"
:
10
,
"labelAlign"
:
"left"
},
properties
:
{
name
:
{
name
:
'name'
,
title
:
intl
.
formatMessage
({
id
:
'content.tag.name'
}),
'x-component'
:
'Input'
,
"required"
:
true
,
"x-rules"
:
[
{
"required"
:
true
,
"message"
:
`
${
intl
.
formatMessage
({
id
:
'common.form.input.placeholder'
})}${
intl
.
formatMessage
({
id
:
'content.tag.name'
})}
`
},
{
limitByte
:
true
,
// 自定义校验规则
maxByte
:
20
,
}
],
},
explain
:
{
name
:
'explain'
,
title
:
intl
.
formatMessage
({
id
:
'content.tag.explain'
}),
'x-component'
:
'TextArea'
,
'x-component-props'
:
{
rows
:
5
},
"x-rules"
:
[
{
limitByte
:
true
,
// 自定义校验规则
maxByte
:
80
,
}
],
},
}
}
}
}
const
handleSubmit
=
(
value
)
=>
{
console
.
log
(
value
)
const
{
id
,
name
,
explain
}
=
value
;
...
...
@@ -90,12 +91,13 @@ const TagInfo = () => {
const
handleCancel
=
()
=>
{
history
.
push
(
'/memberCenter/contentAbility/tagsManagement'
)
}
return
(
<
div
>
<
PageHeaderWrapper
onBack=
{
()
=>
history
.
goBack
()
}
backIcon=
{
<
ReutrnEle
description=
"返回"
/>
}
title=
{
!
id
?
'新建标签'
:
'编辑标签'
}
backIcon=
{
<
ReutrnEle
description=
{
intl
.
formatMessage
({
id
:
'common.button.back'
})
}
/>
}
title=
{
!
id
?
intl
.
formatMessage
({
id
:
'content.tag.add'
})
:
intl
.
formatMessage
({
id
:
'content.tag.edit'
})
}
>
<
Card
>
<
SchemaForm
...
...
@@ -109,15 +111,15 @@ const TagInfo = () => {
isAdd
||
isEdit
?
(
<
FormButtonGroup
offset=
{
3
}
>
<
Submit
loading=
{
submitLoading
}
>
提交
</
Submit
>
<
Button
onClick=
{
handleCancel
}
>
取消
</
Button
>
<
Submit
loading=
{
submitLoading
}
>
{
intl
.
formatMessage
({
id
:
'common.button.submit'
})
}
</
Submit
>
<
Button
onClick=
{
handleCancel
}
>
{
intl
.
formatMessage
({
id
:
'common.button.cancel'
})
}
</
Button
>
</
FormButtonGroup
>
)
:
<></>
}
</
SchemaForm
>
</
Card
>
<
Prompt
when=
{
unsaved
}
message=
"您还有未保存的内容,是否确定要离开?"
/>
<
Prompt
when=
{
unsaved
}
message=
{
intl
.
formatMessage
({
id
:
'common.tip.save.confirm'
})
}
/>
</
PageHeaderWrapper
>
</
div
>
)
...
...
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