Commit 1a91bb75 authored by 前端-李俊鑫's avatar 前端-李俊鑫

feat: 内容能力-公告管理国际化

parent c7d2dc6d
...@@ -61,6 +61,9 @@ ...@@ -61,6 +61,9 @@
'common.text.unit.strip': '条', 'common.text.unit.strip': '条',
'common.text.pleaseSelect': '请选择', 'common.text.pleaseSelect': '请选择',
'common.text.notEmpty': '不可为空', 'common.text.notEmpty': '不可为空',
'common.text.image': '图片',
'common.text.title': '标题',
'common.text.all': '全部',
/** form */ /** form */
'common.form.name.placeholder': '请输入姓名', 'common.form.name.placeholder': '请输入姓名',
...@@ -69,6 +72,7 @@ ...@@ -69,6 +72,7 @@
'common.form.activity.startTime.placeholder': '活动开始时间', 'common.form.activity.startTime.placeholder': '活动开始时间',
'common.form.activity.endTime.placeholder': '活动结束时间', 'common.form.activity.endTime.placeholder': '活动结束时间',
'common.form.input.placeholder': '请输入', 'common.form.input.placeholder': '请输入',
'common.form.upload.placeholder': '请上传',
} }
...@@ -34,4 +34,24 @@ ...@@ -34,4 +34,24 @@
'content.info.time': '发布时间', 'content.info.time': '发布时间',
'content.info.recommendTag': '推荐标签', 'content.info.recommendTag': '推荐标签',
'content.info.sort': '排序', 'content.info.sort': '排序',
'content.info.add': '新建资讯',
'content.info.edit': '编辑资讯',
'content.info.see': '查看资讯',
'content.info.label1': '头条文章',
'content.info.label2': '轮播新闻',
'content.info.label3': '图片新闻',
'content.info.label4': '推荐阅读',
'content.info.label5': '行情推荐',
'content.info.label6': '本栏推荐',
'content.info.recommendSort': '排序',
'content.info.views': '浏览数',
'content.info.tag': '资讯标签',
'content.info.abstract': '摘要',
'content.info.content': '内容',
'content.notice.add': '新建公告',
'content.notice.edit': '编辑公告',
'content.notice.see': '查看公告',
'content.notice.topping': '置顶',
} }
...@@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react'; ...@@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react';
import { PageHeaderWrapper } from "@ant-design/pro-layout"; import { PageHeaderWrapper } from "@ant-design/pro-layout";
import ReutrnEle from '@/components/ReturnEle'; import ReutrnEle from '@/components/ReturnEle';
import { usePageStatus } from '@/hooks/usePageStatus'; import { usePageStatus } from '@/hooks/usePageStatus';
import { history, Prompt } from 'umi'; import { history, Prompt, useIntl } from 'umi';
import { Card, Button } from 'antd'; import { Card, Button } from 'antd';
import { SchemaForm, createFormActions, FormButtonGroup, Submit } from '@formily/antd' import { SchemaForm, createFormActions, FormButtonGroup, Submit } from '@formily/antd'
import announceInfoSchema from './schema/announceInfoSchema'; import announceInfoSchema from './schema/announceInfoSchema';
...@@ -20,6 +20,7 @@ import { getManageMemberNoticeGet, postManageMemberNoticeAdd, postManageMemberNo ...@@ -20,6 +20,7 @@ import { getManageMemberNoticeGet, postManageMemberNoticeAdd, postManageMemberNo
const actions = createFormActions(); const actions = createFormActions();
const AdvertisementInfo = () => { const AdvertisementInfo = () => {
const intl = useIntl()
useCustomValidator(); useCustomValidator();
const { id, preview } = usePageStatus(); const { id, preview } = usePageStatus();
const initialValues: any = useInitialValues({id:id}, getManageMemberNoticeGet); const initialValues: any = useInitialValues({id:id}, getManageMemberNoticeGet);
...@@ -43,7 +44,6 @@ const AdvertisementInfo = () => { ...@@ -43,7 +44,6 @@ const AdvertisementInfo = () => {
console.log(value) console.log(value)
const {content, top, ...rest} = value; const {content, top, ...rest} = value;
const editorContent = content.toHTML(); const editorContent = content.toHTML();
// const { title, columnType, sort, link, imageUrl} = value;
const serviceActions = isAdd const serviceActions = isAdd
? postManageMemberNoticeAdd ? postManageMemberNoticeAdd
: postManageMemberNoticeUpdate : postManageMemberNoticeUpdate
...@@ -67,8 +67,8 @@ const AdvertisementInfo = () => { ...@@ -67,8 +67,8 @@ const AdvertisementInfo = () => {
return ( return (
<PageHeaderWrapper <PageHeaderWrapper
onBack={() => history.goBack()} onBack={() => history.goBack()}
backIcon={<ReutrnEle description="返回" />} backIcon={<ReutrnEle description={intl.formatMessage({ id: 'common.button.back' })} />}
title={isAdd ? '新建公告' : isEdit ? '编辑公告' : '查看公告'} title={isAdd ? intl.formatMessage({ id: 'content.notice.add' }) : isEdit ? intl.formatMessage({ id: 'content.notice.edit' }) : intl.formatMessage({ id: 'content.notice.see' })}
> >
<Card> <Card>
<SchemaForm <SchemaForm
...@@ -82,7 +82,7 @@ const AdvertisementInfo = () => { ...@@ -82,7 +82,7 @@ const AdvertisementInfo = () => {
editable={isAdd || isEdit} editable={isAdd || isEdit}
expressionScope={{ expressionScope={{
label: ( label: (
<div className={styles.custom_label}>栏目</div> <div className={styles.custom_label}>{intl.formatMessage({ id: 'content.info.column' })}</div>
) )
}} }}
> >
...@@ -90,14 +90,14 @@ const AdvertisementInfo = () => { ...@@ -90,14 +90,14 @@ const AdvertisementInfo = () => {
isAdd || isEdit isAdd || isEdit
? ( ? (
<FormButtonGroup offset={3}> <FormButtonGroup offset={3}>
<Submit loading={submitLoading}>提交</Submit> <Submit loading={submitLoading}>{intl.formatMessage({ id: 'common.button.submit' })}</Submit>
<Button onClick={handleCancel}>取消</Button> <Button onClick={handleCancel}>{intl.formatMessage({ id: 'common.button.cancel' })}</Button>
</FormButtonGroup> </FormButtonGroup>
) )
: <></> : <></>
} }
</SchemaForm> </SchemaForm>
<Prompt when={unsaved && (isAdd || isEdit)} message="您还有未保存的内容,是否确定要离开?"></Prompt> <Prompt when={unsaved && (isAdd || isEdit)} message={intl.formatMessage({ id: 'common.tip.save.confirm' })}></Prompt>
</Card> </Card>
</PageHeaderWrapper> </PageHeaderWrapper>
) )
......
This diff is collapsed.
import { ANNOUNCE_COLUMN_TYPE, transfer2Options } from '../../utils/utils'; import { ANNOUNCE_COLUMN_TYPE, transfer2Options } from '../../utils/utils';
import { getIntl } from 'umi';
const columnsList = transfer2Options(ANNOUNCE_COLUMN_TYPE); const columnsList = transfer2Options(ANNOUNCE_COLUMN_TYPE);
const schema = { const schema = {
...@@ -15,15 +17,15 @@ const schema = { ...@@ -15,15 +17,15 @@ const schema = {
properties: { properties: {
title: { title: {
type: 'string', type: 'string',
title: '标题', title: getIntl().formatMessage({ id: 'common.text.title' }),
'x-component': 'Input', 'x-component': 'Input',
'x-component-props': { 'x-component-props': {
placeholder: '最长60个字符,30个汉字' placeholder: `30${getIntl().formatMessage({ id: 'common.unit.individual.chinese' })}, 60${getIntl().formatMessage({ id: 'common.unit.individual.character' })}`,
}, },
"x-rules": [ "x-rules": [
{ {
"required": true, "required": true,
"message": "最长60个字符,30个汉字" "message": `30${getIntl().formatMessage({ id: 'common.unit.individual.chinese' })}, 60${getIntl().formatMessage({ id: 'common.unit.individual.character' })}`,
}, },
{ {
limitByte: true, // 自定义校验规则 limitByte: true, // 自定义校验规则
...@@ -63,7 +65,7 @@ const schema = { ...@@ -63,7 +65,7 @@ const schema = {
}, },
"x-rules": [{ "x-rules": [{
"required": true, "required": true,
"message": "请选择栏目" "message": `${getIntl().formatMessage({ id: 'common.text.pleaseSelect' })}${getIntl().formatMessage({ id: 'content.info.column' })}`,
}], }],
}, },
top: { top: {
...@@ -74,7 +76,7 @@ const schema = { ...@@ -74,7 +76,7 @@ const schema = {
span: 1 span: 1
}, },
'x-component-props': { 'x-component-props': {
children: '置顶', children: getIntl().formatMessage({ id: 'content.notice.topping' }),
} }
} }
} }
...@@ -91,7 +93,7 @@ const schema = { ...@@ -91,7 +93,7 @@ const schema = {
content: { content: {
type: "string", type: "string",
name: 'content', name: 'content',
title: '内容', title: getIntl().formatMessage({ id: 'content.info.content' }),
"x-component": 'CustomEditor', "x-component": 'CustomEditor',
"x-component-parent-props": { "x-component-parent-props": {
style: { style: {
...@@ -100,7 +102,7 @@ const schema = { ...@@ -100,7 +102,7 @@ const schema = {
}, },
"x-rules": { "x-rules": {
"required": true, "required": true,
"message": "请输入内容" "message": `${getIntl().formatMessage({ id: 'common.form.input.placeholder' })}${getIntl().formatMessage({ id: 'content.info.content' })}`,
}, },
"x-component-props": { "x-component-props": {
contentStyle: { contentStyle: {
......
import EyePreview from '@/components/EyePreview'; import { ISchema } from '@formily/antd';
import { DownOutlined } from '@ant-design/icons';
import { TimeList } from '../../statusList'; import { TimeList } from '../../statusList';
import moment from 'moment'; import { getIntl } from 'umi';
import React from 'react';
import { ANNOUNCE_COLUMN_TYPE, transfer2Options } from '../../utils/utils'; import { ANNOUNCE_COLUMN_TYPE, transfer2Options } from '../../utils/utils';
import { FORM_FILTER_PATH } from '@/formSchema/const';
const ALL = [{label: '栏目(全部)', value: 0}] // const ALL = [{ label: getIntl().formatMessage({ id: 'common.text.all' }), value: 0 }]
const COLUMNSOPTIONS = ALL.concat(transfer2Options(ANNOUNCE_COLUMN_TYPE)); // const COLUMNS_OPTIONS = ALL.concat(transfer2Options(ANNOUNCE_COLUMN_TYPE))
const columns = [ export const schema: ISchema = {
{title: 'ID', dataIndex: 'id'}, type: 'object',
{ properties: {
title: '栏目', dataIndex: 'columnType', mageLayout: {
render: (text, record) => { type: 'object',
return ( 'x-component': 'mega-layout',
<div>{ANNOUNCE_COLUMN_TYPE[text]}</div> properties: {
) topLayout: {
}
},
{ title: '标题',
dataIndex: 'title',
render: (text: string, record: any) => (
<EyePreview
url={`/memberCenter/contentAbility/announcements/detail?id=${record.id}&preview=1`}
>
{text}
</EyePreview>
)
},
{
title: '发布时间',
dataIndex: 'createTime',
render: (text) => (
moment(text).format('YYYY-MM-DD HH:mm:ss')
)
},
{title: '状态', dataIndex: 'status', render: "{{renderStatus}}"},
{title: '操作', render: "{{renderOperation}}"}
];
/**
* 公告管理列表也 schemat
*/
const announcementSchema = {
type: 'object',
properties: {
layout: {
type: 'object',
// 'x-component': 'mega-layout',
'x-component': 'CustomFlexRowLayout',
'x-component-props': {
justify: 'space-between',
align: 'center'
},
properties: {
'left-layout': {
type: 'object', type: 'object',
name: 'left-layout', 'x-component': 'mega-layout',
'x-component': 'CustomFlexRowLayout',
'x-component-props': { 'x-component-props': {
justify: 'start', grid: true,
align: 'center'
}, },
properties: { properties: {
createBtn: { ctl: {
type: "object", type: 'object',
name: "createBtn", 'x-component': 'Children',
"x-component": "button", 'x-component-props': {
"x-component-props": { children: '{{controllerBtns}}',
"onClick": "{{goToCreate}}", },
"children": "新建", },
"type": 'primary', title: {
style: { type: 'string',
width: '112px', 'x-component': 'Search',
margin: '0 0 15px 0' 'x-component-props': {
} placeholder: getIntl().formatMessage({id: 'content.info.title'}),
} },
}, },
} },
}, },
'right-layout': { [FORM_FILTER_PATH]: {
type: 'object', type: 'object',
name: 'rigth-layout', 'x-component': 'flex-layout',
"x-component": 'CustomFlexColumnLayout', 'x-component-props': {
properties: { rowStyle: {
controllers: { flexWrap: 'nowrap',
type: 'object', },
name: 'controllers', colStyle: {
'x-component': 'CustomFlexRowLayout', marginLeft: 20,
},
},
properties: {
columnType: {
type: 'string',
enum: transfer2Options(ANNOUNCE_COLUMN_TYPE),
'x-component-props': { 'x-component-props': {
justify: 'end', placeholder: `${getIntl().formatMessage({id: 'common.text.pleaseSelect'})}${getIntl().formatMessage({id: 'content.info.column'})}`,
style: { width: '174px' },
}, },
properties: {
search: {
type: 'string',
name: 'name',
'x-component': 'CustomSearch',
'x-component-props': {
placeholder: "请填写标题名称",
"onSearch": "{{search}}",
}
},
'HIGHT_FILTER_BTN': {
type: 'string',
name: 'HIGHT_FILTER_BTN',
'x-component': 'button',
'x-component-props': {
"children": (
<div>高级搜索 <DownOutlined /></div>
),
"onClick": "{{toggleFilters}}",
style: {
margin: '0 15px'
}
}
},
reset: {
type: 'string',
name: 'reset',
"x-component": "button",
"x-component-props": {
"onClick": "{{reset}}",
"children": "重置",
}
},
}
}, },
'FILTERS': { status: {
type: 'object', type: 'string',
name: 'FILTERS', enum: [
'x-component': 'CustomFlexRowLayout', { label: getIntl().formatMessage({ id: 'common.text.all' }), value: '0' },
{ label: getIntl().formatMessage({ id: 'content.common.waitUp' }), value: '1' },
{ label: getIntl().formatMessage({ id: 'content.common.hadUp' }), value: '2' },
{ label: getIntl().formatMessage({ id: 'content.common.hadDown' }), value: '3' },
],
'x-component-props': { 'x-component-props': {
justify: 'end' placeholder: `${getIntl().formatMessage({id: 'common.text.pleaseSelect'})}${getIntl().formatMessage({id: 'common.table.status'})}`,
style: { width: '174px' },
}, },
properties: { },
columnType: { // time: {
type: 'string', // type: 'string',
'x-component': 'Select', // enum: TimeList,
'x-component-props': { // 'x-component-props': {
style: { // placeholder: getIntl().formatMessage({id: 'content.info.time'}),
width: '160px' // style: { width: '174px' },
}, // },
options: COLUMNSOPTIONS, // },
defaultValue: 0, submit: {
} 'x-component': 'Submit',
}, 'x-mega-props': {
status: { span: 1,
name: 'status', },
type: 'string', 'x-component-props': {
'x-component': 'Select', children: getIntl().formatMessage({id: 'common.button.submit'}),
'x-component-props': { },
options: [ },
{label: '状态(全部)', value: '0'}, },
{label: '待上架', value: '1'}, },
{label: '已上架',value: '2'},
{label: '已下架',value: '3'},
],
defaultValue: '0',
placeholder: '请选择状态',
style: {
width: '160px',
margin: '0 15px'
}
}
},
time: {
name: 'time',
type: 'string',
'x-component': 'Select',
'x-component-props': {
placeholder: '发布时间(全部)',
options: TimeList,
style: {
width: '160px',
}
}
}
}
}
}
}
}
},
"table": {
"key": "table",
"type": "object",
"name": "table",
"x-component": "Table",
"x-component-props": {
"columns": columns,
"rowKey": "id",
pagination: false,
// "pagination": {
// showQuickJumper: true,
// size: "small",
// "onChange": "{{paginationChange}}",
// },
// "rowSelection": "{{rowSelection}}"
}
},
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 announcementSchema
...@@ -190,7 +190,7 @@ const Infomation = () => { ...@@ -190,7 +190,7 @@ const Infomation = () => {
return ( return (
<PageHeaderWrapper> <PageHeaderWrapper>
<Card> <Card>
<StandardTable <StandardTable
columns={columns} columns={columns}
currentRef={ref} currentRef={ref}
tableProps={{ rowKey: 'id' }} tableProps={{ rowKey: 'id' }}
......
...@@ -4,7 +4,7 @@ import { Card, Select, Input, Checkbox, Button} from 'antd'; ...@@ -4,7 +4,7 @@ import { Card, Select, Input, Checkbox, Button} from 'antd';
import { PageHeaderWrapper } from '@ant-design/pro-layout'; import { PageHeaderWrapper } from '@ant-design/pro-layout';
import ReutrnEle from '@/components/ReturnEle'; import ReutrnEle from '@/components/ReturnEle';
import { usePageStatus } from '@/hooks/usePageStatus'; import { usePageStatus } from '@/hooks/usePageStatus';
import { history, Prompt } from 'umi'; import { history, Prompt, useIntl } from 'umi';
// import CustomUpload from '@/components/NiceForm/components/CustomUpload'; // import CustomUpload from '@/components/NiceForm/components/CustomUpload';
import { CustomTags } from '../components/Tags'; import { CustomTags } from '../components/Tags';
import CustomEditor from '../components/CustomEditor'; import CustomEditor from '../components/CustomEditor';
...@@ -36,6 +36,7 @@ type ColumnListType = { ...@@ -36,6 +36,7 @@ type ColumnListType = {
} }
const InfomationInfo = () => { const InfomationInfo = () => {
const intl = useIntl()
useCustomValidator(); useCustomValidator();
const { id, preview } = usePageStatus(); const { id, preview } = usePageStatus();
// const [isTop, setIsTop] = useState(1); // const [isTop, setIsTop] = useState(1);
...@@ -122,7 +123,7 @@ const InfomationInfo = () => { ...@@ -122,7 +123,7 @@ const InfomationInfo = () => {
const targetColumn = column.filter((_item) => _item.value === data.columnId)[0]; const targetColumn = column.filter((_item) => _item.value === data.columnId)[0];
if(targetColumn) { if(targetColumn) {
actions.setFieldState('layout.columnId', state => { actions.setFieldState('layout.columnId', state => {
state.props['description'] = `栏目分类${COLUMN_CATEGORY[targetColumn?.type] || ''}` state.props['description'] = `${intl.formatMessage({ id: 'content.columns.category' })}${COLUMN_CATEGORY[targetColumn?.type] || ''}`
}) })
setType(targetColumn?.type) setType(targetColumn?.type)
} }
...@@ -168,8 +169,8 @@ const InfomationInfo = () => { ...@@ -168,8 +169,8 @@ const InfomationInfo = () => {
<div> <div>
<PageHeaderWrapper <PageHeaderWrapper
onBack={() => history.goBack()} onBack={() => history.goBack()}
backIcon={<ReutrnEle description="返回" />} backIcon={<ReutrnEle description={intl.formatMessage({ id: 'common.button.back' })} />}
title={isAdd ? '新建资讯' : isEdit ? '编辑资讯' : '查看资讯'} title={isAdd ? intl.formatMessage({ id: 'content.info.add' }) : isEdit ? intl.formatMessage({ id: 'content.info.edit' }) : intl.formatMessage({ id: 'content.info.see' })}
> >
<Card> <Card>
<SchemaForm <SchemaForm
...@@ -187,7 +188,7 @@ const InfomationInfo = () => { ...@@ -187,7 +188,7 @@ const InfomationInfo = () => {
onFieldValueChange$('layout.columnId').subscribe(({ value }) => { onFieldValueChange$('layout.columnId').subscribe(({ value }) => {
actions.setFieldState('layout.columnId', state => { actions.setFieldState('layout.columnId', state => {
const currentType = state.props["x-component-props"]!.options?.filter((_row) => _row.value === value)[0]; const currentType = state.props["x-component-props"]!.options?.filter((_row) => _row.value === value)[0];
state["props"]["description"] = `栏目分类${currentType && (COLUMN_CATEGORY[currentType.type])}`; state["props"]["description"] = `${intl.formatMessage({ id: 'content.columns.category' })}${currentType && (COLUMN_CATEGORY[currentType.type])}`;
setType(currentType ? currentType.type : 0) setType(currentType ? currentType.type : 0)
}) })
}) })
...@@ -213,7 +214,7 @@ const InfomationInfo = () => { ...@@ -213,7 +214,7 @@ const InfomationInfo = () => {
actions.setFieldState('imageUrl', state => { actions.setFieldState('imageUrl', state => {
state.props["x-rules"] = [1, 2, 3, 4, 6].includes(value) ? { state.props["x-rules"] = [1, 2, 3, 4, 6].includes(value) ? {
"required": true, "required": true,
"message": "请上传图片" "message": `${intl.formatMessage({ id: 'common.form.upload.placeholder' })}${intl.formatMessage({ id: 'common.text.image' })}`
} : {} } : {}
}) })
}) })
...@@ -224,7 +225,7 @@ const InfomationInfo = () => { ...@@ -224,7 +225,7 @@ const InfomationInfo = () => {
}, },
label: ( label: (
<div className={cx((isAdd || isEdit) && [1, 2, 3, 4, 6].includes(recommendLabelValue) && styles.custom_label)}> <div className={cx((isAdd || isEdit) && [1, 2, 3, 4, 6].includes(recommendLabelValue) && styles.custom_label)}>
图片 {intl.formatMessage({ id: 'common.text.image' })}
</div> </div>
) )
}} }}
...@@ -233,15 +234,15 @@ const InfomationInfo = () => { ...@@ -233,15 +234,15 @@ const InfomationInfo = () => {
isAdd || isEdit isAdd || isEdit
? ( ? (
<FormButtonGroup offset={3}> <FormButtonGroup offset={3}>
<Submit loading={submitLoading}>提交</Submit> <Submit loading={submitLoading}>{intl.formatMessage({ id: 'common.button.submit' })}</Submit>
<Button onClick={handleCancel}>取消</Button> <Button onClick={handleCancel}>{intl.formatMessage({ id: 'common.button.cancel' })}</Button>
</FormButtonGroup> </FormButtonGroup>
) )
: <></> : <></>
} }
</SchemaForm> </SchemaForm>
</Card> </Card>
<Prompt when={(isAdd || isEdit) && unsaved} message="您还有未保存的内容,是否确定要离开?" /> <Prompt when={(isAdd || isEdit) && unsaved} message={intl.formatMessage({ id: 'common.tip.save.confirm' })} />
</PageHeaderWrapper> </PageHeaderWrapper>
</div> </div>
) )
......
...@@ -3,7 +3,7 @@ import { TimeList } from '../../statusList'; ...@@ -3,7 +3,7 @@ import { TimeList } from '../../statusList';
import { getIntl } from 'umi'; import { getIntl } from 'umi';
import { FORM_FILTER_PATH } from '@/formSchema/const'; import { FORM_FILTER_PATH } from '@/formSchema/const';
const CustomTimeList = [{label: '全部', value: 0}].concat(TimeList.slice(1)); const CustomTimeList = [{label: getIntl().formatMessage({ id: 'common.text.all' }), value: 0}].concat(TimeList.slice(1));
export const schema: ISchema = { export const schema: ISchema = {
type: 'object', type: 'object',
...@@ -58,10 +58,10 @@ export const schema: ISchema = { ...@@ -58,10 +58,10 @@ export const schema: ISchema = {
status: { status: {
type: 'string', type: 'string',
enum: [ enum: [
{ label: '全部', value: '0' }, { label: getIntl().formatMessage({ id: 'common.text.all' }), value: '0' },
{ label: '待上架', value: '1' }, { label: getIntl().formatMessage({ id: 'content.common.waitUp' }), value: '1' },
{ label: '已上架', value: '2' }, { label: getIntl().formatMessage({ id: 'content.common.hadUp' }), value: '2' },
{ label: '已下架', value: '3' }, { label: getIntl().formatMessage({ id: 'content.common.hadDown' }), value: '3' },
], ],
'x-component-props': { 'x-component-props': {
placeholder: `${getIntl().formatMessage({id: 'common.text.pleaseSelect'})}${getIntl().formatMessage({id: 'common.table.status'})}`, placeholder: `${getIntl().formatMessage({id: 'common.text.pleaseSelect'})}${getIntl().formatMessage({id: 'common.table.status'})}`,
......
import { getIntl } from 'umi';
interface IOption { interface IOption {
value: number|string, value: number|string,
label: number|string label: number|string
...@@ -30,15 +32,15 @@ const schema = { ...@@ -30,15 +32,15 @@ const schema = {
properties: { properties: {
title : { title : {
name: 'title', name: 'title',
title: '标题', title: getIntl().formatMessage({ id: 'common.text.title' }),
'x-component': 'Input', 'x-component': 'Input',
'x-component-props': { 'x-component-props': {
placeholder: '最长30个汉字,60个字符', placeholder: `30${getIntl().formatMessage({ id: 'common.unit.individual.chinese' })}, 60${getIntl().formatMessage({ id: 'common.unit.individual.character' })}`,
}, },
"x-rules": [ "x-rules": [
{ {
"required": true, "required": true,
"message": "请填写标题" "message": `${getIntl().formatMessage({ id: 'common.form.input.placeholder' })}${getIntl().formatMessage({ id: 'common.text.title' })}`,
}, },
{ {
limitByte: true, limitByte: true,
...@@ -48,22 +50,22 @@ const schema = { ...@@ -48,22 +50,22 @@ const schema = {
}, },
columnId: { columnId: {
name: 'columnId', name: 'columnId',
title: '栏目', title: getIntl().formatMessage({ id: 'content.info.column' }),
'x-component': 'Select', 'x-component': 'Select',
"x-component-props": { "x-component-props": {
style: { style: {
marginBottom: '8px' marginBottom: '8px'
}, },
}, },
description: "栏目分类", description: getIntl().formatMessage({ id: 'content.columns.category' }),
"x-rules": { "x-rules": {
"required": true, "required": true,
"message": "请选择咨询说明" "message": `${getIntl().formatMessage({ id: 'common.text.pleaseSelect' })}${getIntl().formatMessage({ id: 'content.columns.category' })}`,
}, },
}, },
recommendLabel: { recommendLabel: {
name: 'recommendLabel', name: 'recommendLabel',
title: '推荐标签', title: getIntl().formatMessage({ id: 'content.info.recommendTag' }),
type: 'string', type: 'string',
'x-component': 'Select', 'x-component': 'Select',
"x-component-props": { "x-component-props": {
...@@ -72,49 +74,19 @@ const schema = { ...@@ -72,49 +74,19 @@ const schema = {
}, },
allowClear: true, allowClear: true,
options: [ options: [
{label: '头条文章', value: 1}, {label: getIntl().formatMessage({ id: 'content.info.label1' }), value: 1},
{label: '轮播新闻', value: 2}, {label: getIntl().formatMessage({ id: 'content.info.label2' }), value: 2},
{label: '图片新闻', value: 3}, {label: getIntl().formatMessage({ id: 'content.info.label3' }), value: 3},
{label: '推荐阅读', value: 4}, {label: getIntl().formatMessage({ id: 'content.info.label4' }), value: 4},
{label: '行情推荐', value: 5}, {label: getIntl().formatMessage({ id: 'content.info.label5' }), value: 5},
{label: '本栏推荐', value: 6} {label: getIntl().formatMessage({ id: 'content.info.label6' }), value: 6}
], ],
}, },
}, },
// sortLayout: {
// type: 'object',
// 'x-component': 'mega-layout',
// "x-component-props": {
// "label": "推荐排序",
// // wrapperCol: 23,
// // layoutProps: {
// // "wrapperCol": 12,
// // },
// style: {
// marginBottom: 0
// },
// // addonAfter: "{{isTop}}"
// },
// properties: {
// sort: {
// name: 'sort',
// type: 'string',
// 'x-component': 'Select',
// 'x-component-props': {
// // style: {
// // width: '100%'
// // },
// options: sortedList,
// allowClear: true,
// }
// },
// }
// },
sort: { sort: {
name: 'sort', name: 'sort',
type: 'string', type: 'string',
title: '推荐排序', title: getIntl().formatMessage({ id: 'content.info.recommendSort' }),
'x-component': 'Select', 'x-component': 'Select',
'x-component-props': { 'x-component-props': {
options: sortedList, options: sortedList,
...@@ -124,7 +96,7 @@ const schema = { ...@@ -124,7 +96,7 @@ const schema = {
}, },
readCount: { readCount: {
name: 'readCount', name: 'readCount',
title: '浏览数', title: getIntl().formatMessage({ id: 'content.info.views' }),
type: 'string', type: 'string',
'x-component': 'Input', 'x-component': 'Input',
'x-component-props': { 'x-component-props': {
...@@ -144,7 +116,7 @@ const schema = { ...@@ -144,7 +116,7 @@ const schema = {
'x-component-props': { 'x-component-props': {
grid: true, grid: true,
full: true, full: true,
label: "行情资讯分类:", label: getIntl().formatMessage({ id: 'content.info.category' }),
"wrapperCol": 24, "wrapperCol": 24,
}, },
properties: { properties: {
...@@ -200,7 +172,7 @@ const schema = { ...@@ -200,7 +172,7 @@ const schema = {
}, },
labelIds: { labelIds: {
name: 'labelIds', name: 'labelIds',
title: '咨询标签', title: getIntl().formatMessage({ id: 'content.info.tag' }),
"x-component": 'CustomTags', "x-component": 'CustomTags',
"x-component-props": { "x-component-props": {
layoutProps: { layoutProps: {
...@@ -223,16 +195,16 @@ const schema = { ...@@ -223,16 +195,16 @@ const schema = {
digest: { digest: {
type: 'string', type: 'string',
name: 'digest', name: 'digest',
title: '摘要', title: getIntl().formatMessage({ id: 'content.info.abstract' }),
"x-component": 'TextArea', "x-component": 'TextArea',
"x-component-props": { "x-component-props": {
placeholder: "最长400个字符,200个汉字", placeholder: `200${getIntl().formatMessage({ id: 'common.unit.individual.chinese' })}, 400${getIntl().formatMessage({ id: 'common.unit.individual.character' })}`,
rows: 5, rows: 5,
}, },
"x-rules": [ "x-rules": [
{ {
"required": true, "required": true,
"message": "最长400个字符,200个汉字" "message": `200${getIntl().formatMessage({ id: 'common.unit.individual.chinese' })}, 400${getIntl().formatMessage({ id: 'common.unit.individual.character' })}`,
}, },
{ {
limitByte: true, limitByte: true,
...@@ -252,7 +224,7 @@ const schema = { ...@@ -252,7 +224,7 @@ const schema = {
content: { content: {
type: "string", type: "string",
name: 'content', name: 'content',
title: '内容', title: getIntl().formatMessage({ id: 'content.info.content' }),
"x-component": 'CustomEditor', "x-component": 'CustomEditor',
"x-component-parent-props": { "x-component-parent-props": {
style: { style: {
...@@ -261,7 +233,7 @@ const schema = { ...@@ -261,7 +233,7 @@ const schema = {
}, },
"x-rules": { "x-rules": {
"required": true, "required": true,
"message": "请输入内容" "message": `${getIntl().formatMessage({ id: 'common.form.input.placeholder' })}${getIntl().formatMessage({ id: 'content.info.content' })}`,
}, },
"x-component-props": { "x-component-props": {
contentStyle: { contentStyle: {
......
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