Commit 9eeacd60 authored by Bill's avatar Bill

fix: 修改内容管理

parent 4a7b3173
......@@ -35,6 +35,7 @@
"start:cross-dev": "cross-env SITE_ID=352 SOCKET_URL=ws://10.0.0.25:9400 yarn start:dev",
"start:10": "cross-env SITE_ID=1 BACK_GATEWAY=http://10.0.0.10:8100 SOCKET_URL=ws://10.0.0.10:9400 yarn start",
"start:25": "cross-env SITE_ID=1 BACK_GATEWAY=http://10.0.0.25:8100 SOCKET_URL=ws://10.0.0.25:9400 yarn start",
"start:v2": "cross-env SITE_ID=1 BACK_GATEWAY=http://10.0.0.17:8100 SOCKET_URL=ws://10.0.0.17:9400 yarn start",
"start:scm": "cross-env BACK_GATEWAY=http://lingxi-scm.wg.shushangyun.com SOCKET_URL=ws://lingxi-scm.wg.shushangyun.com SITE_ID=1 yarn start",
"start:study": "cross-env SITE_ID=1 BACK_GATEWAY=http://10.0.1.207:8100 SOCKET_URL=ws://10.0.1.207:9400 yarn start"
},
......
......@@ -3,12 +3,17 @@
flex-direction: row;
justify-content: space-between;
height: 100%;
overflow: hidden;
.tree {
width: 538px;
min-width: 488px;
height: 100%;
margin-right: 16px;
}
.editPanel {
flex: 1,
flex: 1;
background-color: #fff;
padding: 16px;
border-radius: 8px;
}
}
import React, { useState, useEffect, useMemo } from 'react'
import { Row, Col, Popconfirm, Button, Card } from 'antd';
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';
......@@ -12,6 +12,7 @@ import NiceForm from '@/components/NiceForm';
import { GetManageContentCategoryAllResponse } from '@/services/PlatformApi/id8545';
import styles from './index.less';
import Form from '@/pages/pageCustomized/configs/componentConfigs/Ant/Form';
import { BorderOuterOutlined, QuestionCircleOutlined } from '@ant-design/icons';
const { ON_FORM_INPUT_CHANGE } = LifeCycleTypes
......@@ -183,7 +184,6 @@ const ClassProperty: React.FC<{}> = () => {
</Card>
</div>
<div className={styles.editPanel}>
<Card>
{
treeStatus !== FormState.FREE && <>
<h3 className="commonPanelTitle mb-30">{treeStatus === FormState.ADD ? '新增' : '编辑'}</h3>
......@@ -198,6 +198,15 @@ const ClassProperty: React.FC<{}> = () => {
actions={formActions}
effects={($, action)=> {}}
schema={classSchema}
expressionScope={{
showWarn: (
<Tooltip placement="topLeft" title={"只能同时对7个一级分类下的第三级分类设置推荐分类,且每个一级分类下最多只允许设置2个推荐分类"}>
<span style={{marginTop: '-12px', width: '50px'}}>
<QuestionCircleOutlined />
</span>
</Tooltip>
)
}}
>
<FormButtonGroup>
<Button htmlType='submit' type="primary" >
......@@ -214,7 +223,6 @@ const ClassProperty: React.FC<{}> = () => {
</NiceForm>
</>
}
</Card>
</div>
</div>
......
......@@ -17,6 +17,7 @@ export const classSchema: ISchema = {
"x-component": 'mega-layout',
"x-component-props": {
full: true,
"wrapperWidth": 507,
},
"x-mega-props": {
span: 1
......@@ -50,18 +51,32 @@ export const classSchema: ISchema = {
'x-linkages': [
{
type: 'value:visible',
target: '*(status)',
target: '*(inlineLayout)',
condition: '{{$value === 3}}'
},
]
},
status: {
title: '',
'x-component': 'CheckboxGroup',
enum: [
{ label: '推荐分类', value: 1 },
]
},
inlineLayout: {
type: 'object',
"x-component": "mega-layout",
"x-component-props": {
inline: true,
},
properties: {
status: {
title: '',
'x-component': 'CheckboxGroup',
enum: [
{ label: '推荐分类', value: 1 },
],
"x-mega-props": {
"addonAfter": "{{showWarn}}",
// wrapperWidth: 130
},
},
}
}
// status1: {
// title: '',
// 'x-component': 'Children',
......
......@@ -54,6 +54,23 @@ const schema = {
}
]
},
type: {
title: '栏目分类',
'x-component': 'Select',
"x-component-props": {
options: [
{ label: '市场行情', value: 1 },
{ label: '资讯', value: 2 },
]
},
"required": true,
"x-rules": [
{
"required": true,
"message": "请选择栏目分类"
},
]
},
sort: {
name: 'sort',
title: '栏目排序',
......@@ -95,21 +112,25 @@ const ColumnInfo = () => {
const isEdit = id && !preview;
const isAdd = !id && !preview;
const handleSubmit = (value) => {
const { id, name, sort} = value;
const handleSubmit = async (value: { name: string, sort: number, type: number }) => {
const { name, sort, type} = value;
const serviceActions = isAdd
? PublicApi.postManageContentColumnAdd
: PublicApi.postManageContentColumnUpdate
const postData = {id, name, sort};
const postData = {id, name, sort, type};
setSubmitLoading(true)
setUnsaved(false)
serviceActions(postData).then((data) => {
setSubmitLoading(false);
if(data.code === 1000) {
try {
const { data, code } = await serviceActions(postData);
if(code === 1000) {
history.push('/content/columnsManagement')
}
})
} finally {
setSubmitLoading(false);
}
}
const handleCancel = () => {
......
......@@ -4,7 +4,7 @@ import EyePreview from '@/components/EyePreview';
const columns = [
{title: 'ID', dataIndex: 'id'},
{
title: '栏目名称', dataIndex: 'name',
title: '栏目名称', dataIndex: 'name',
render: (text: string, record: any) => (
<EyePreview
url={`/content/columnsManagement/detail?id=${record.id}&preview=1`}
......@@ -13,9 +13,21 @@ const columns = [
</EyePreview>
)
},
{title: '栏目分类', dataIndex: 'type', render: (text) => text === 1 ? '市场行情' : '资讯'},
{title: '栏目排序', dataIndex: 'sort'},
{
title: '状态', dataIndex: 'status',
title: '状态', dataIndex: 'status',
filters: [
{
text: '有效',
value: 1,
},
{
text: '无效',
value: 0,
},
],
onFilter: (value, record) => record.status === value,
render: "{{renderStatus}}"
},
{title: '操作', render: "{{renderOperation}}"}
......@@ -73,7 +85,7 @@ const schema = {
},
}
}
}
},
"table": {
......@@ -104,4 +116,4 @@ const schema = {
}
}
export default schema
\ No newline at end of file
export default schema
import React, { useEffect, useState } from 'react';
import { SchemaForm,Submit, FormButtonGroup, Reset, createFormActions, registerValidationRules } from '@formily/antd';
import { SchemaForm,Submit, FormButtonGroup, Reset, createFormActions, registerValidationRules, FormEffectHooks } from '@formily/antd';
import { Card, Select, Input, Checkbox, Button} from 'antd';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import ReutrnEle from '@/components/ReturnEle';
......@@ -16,6 +16,7 @@ import CustomUpload from '../components/WrapCustomUpload';
import useCustomValidator from '../hooks/useValidator'
const actions = createFormActions();
const { onFieldValueChange$ } = FormEffectHooks
const { TextArea } = Input;
......@@ -42,10 +43,10 @@ const InfomationInfo = () => {
useEffect(() => {
async function getColumn() {
const res = await PublicApi.getManageContentColumnAll();
const columns = res.data.map((item) => ({label: item.name, value: item.id}));
const columns = res.data.map((item) => ({label: item.name, value: item.id, type: item.type}));
setFormStatus("layout.columnId", "options", columns)
}
getColumn()
getColumn()
}, [])
useEffect(() => {
......@@ -70,7 +71,7 @@ const InfomationInfo = () => {
setLabelIds(data.labelIds)
setFormStatus('layout.labelIds', 'seletedTag', data.labelIds)
}, [initialValues])
const handleSubmit = (value) => {
const content = value.content.toHTML();
const tempPostData = {
......@@ -82,7 +83,7 @@ const InfomationInfo = () => {
const serviceActions = isAdd
? PublicApi.postManageContentInformationAdd
: PublicApi.postManageContentInformationUpdate
const postData = isAdd ? tempPostData : {...tempPostData, id: id};
console.log("postData", postData);
setSubmitLoading(true)
......@@ -107,21 +108,29 @@ const InfomationInfo = () => {
title={isAdd ? '新建资讯' : isEdit ? '编辑资讯' : '查看资讯'}
>
<Card>
<SchemaForm
<SchemaForm
initialValues={initialValues?.data}
onSubmit={handleSubmit}
schema={infomationInfoSchema}
editable={isAdd || isEdit}
actions={actions}
components={{
Input, Select, Submit,
TextArea, Checkbox,
CustomUpload, CustomTags, CustomEditor,
}}
components={{
Input, Select, Submit,
TextArea, Checkbox,
CustomUpload, CustomTags, CustomEditor,
}}
effects={() => {
onFieldValueChange$('layout.columnId').subscribe(({ value }) => {
actions.setFieldState('layout.columnId', state => {
const currentType = state.props["x-component-props"]!.options.filter((_row) => _row.value === value)[0];
state["props"]["description"] = `栏目分类:${currentType && (currentType.type === 1 ? '市场行情': '资讯') || ''}`
})
})
}}
expressionScope={{
isTop: (
<Checkbox
checked={!!isTop}
<Checkbox
checked={!!isTop}
onChange={(e) => setIsTop(e.target.checked ? 1 : 0)}
disabled={false}
>
......@@ -134,7 +143,7 @@ const InfomationInfo = () => {
label: (
<div>
{
isAdd || isEdit
isAdd || isEdit
? <span style={{color: '#ff4d4f'}}>* </span>
: null
}
......@@ -144,12 +153,12 @@ const InfomationInfo = () => {
}}
>
{
isAdd || isEdit
isAdd || isEdit
? (
<FormButtonGroup offset={3}>
<Submit loading={submitLoading}>提交</Submit>
<Button onClick={handleCancel}>取消</Button>
</FormButtonGroup>
</FormButtonGroup>
)
: <></>
}
......@@ -161,4 +170,4 @@ const InfomationInfo = () => {
)
}
export default InfomationInfo
\ No newline at end of file
export default InfomationInfo
......@@ -50,55 +50,93 @@ const schema = {
name: 'columnId',
title: '栏目',
'x-component': 'Select',
"x-component-props": {},
"x-component-props": {
style: {
marginBottom: '8px'
},
},
description: "栏目分类",
"x-rules": {
"required": true,
"message": "请选择咨询说明"
},
},
// columnLayout: {
// type: 'object',
// 'x-component': 'mega-layout',
// 'x-component-props': {
// "label": '栏目',
// // full: true,
// "layoutProps": {
// "wrapperCol": 10
// }
// },
// properties: {
// }
// },
recommendLabel: {
name: 'recommendLabel',
title: '推荐标签',
type: 'string',
'x-component': 'Select',
"x-component-props": {
style: {
marginTop: '12px'
},
allowClear: true,
options: [
{label: '头条文章', value: 1},
{label: '轮播新闻', value: 2},
{label: '图片新闻', value: 3},
{label: '推荐阅读', value: 4}
{label: '推荐阅读', value: 4},
{label: '行情推荐', value: 5},
{label: '本栏推荐', 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: '98%'
},
options: sortedList,
allowClear: true,
// 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: {
name: 'sort',
type: 'string',
title: '推荐标签',
'x-component': 'Select',
'x-component-props': {
// style: {
// width: '100%'
// },
options: sortedList,
allowClear: true,
}
},
}
},
readCount: {
......@@ -117,6 +155,38 @@ const schema = {
}
]
},
categoryLayout: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
grid: true,
full: true,
label: "行情资讯分类:",
"wrapperCol": 24,
},
properties: {
category: {
type: 'string',
"x-component": "Select",
wrapperCol: 24,
'x-component-props': {
// layoutProps: {
// },
style: {
width: '100%',
}
}
},
category2: {
type: 'string',
"x-component": "Select",
},
category3: {
type: 'string',
"x-component": "Select",
}
}
},
labelIds: {
name: 'labelIds',
title: '咨询标签',
......
......@@ -59,15 +59,22 @@ const sortedList = (start, end) => {
const ADVERTISE_WEB_COLUMN_TYPE = {
"1": "会员首页-活动广告1",
"2": "会员首页-活动广告2",
"3": "会员首页-活动广告3"
"3": "会员首页-活动广告3",
"4": "企业采购首页--轮播广告",
"5": "企业采购首页--顶部广告栏",
"6": "企业门户首页--轮播广告",
"7": "采购商机页--右侧广告栏",
"8": "渠道服务首页--轮播广告",
"9": "物流服务首页--轮播广告",
"10": "加工服务首页--轮播广告"
}
const ADVERTISE_APP_COLUMN_TYPE = {
"4": '找店铺广告图',
"5": "人气店铺广告图",
"6": "商品询价广告",
"7": "未开通电子签章推广页广告",
"12": "授信申请推广页广告"
"51": "找店铺--广告",
"52": "人气店铺--广告",
"53": "商品询价--广告",
"54": "未开通电子签章推广页--广告",
"55": "授信申请推广页广告"
}
// 内容管理 - 公告栏目
......
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