提交 6597bb93 作者: ZhangLingKun

Merge branch 'develop'

...@@ -14,4 +14,4 @@ patches: ...@@ -14,4 +14,4 @@ patches:
images: images:
- name: REGISTRY/NAMESPACE/IMAGE:TAG - name: REGISTRY/NAMESPACE/IMAGE:TAG
newName: mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly-dev/admin newName: mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly-dev/admin
newTag: 40f342151f040d006728e6d14285447c62855c55 newTag: 01d77ad63c0e5a29390b7748dd9d32cbf85d15d5
...@@ -60,9 +60,9 @@ export type insertModuleInfo = InterFunction< ...@@ -60,9 +60,9 @@ export type insertModuleInfo = InterFunction<
export type updateModuleInfo = InterFunction< export type updateModuleInfo = InterFunction<
{ {
id: number; id: number;
moduleCode: string; moduleCode?: string;
moduleName: string; moduleName?: string;
moduleType: number; moduleType?: number;
remark?: string; remark?: string;
}, },
NonNullable<unknown> NonNullable<unknown>
......
...@@ -31,7 +31,7 @@ const bannerType = [ ...@@ -31,7 +31,7 @@ const bannerType = [
{ label: '纯文本', value: 5 }, { label: '纯文本', value: 5 },
// { label: '服务SKU', value: 6 }, // { label: '服务SKU', value: 6 },
// { label: '红包', value: 7 }, // { label: '红包', value: 7 },
// { label: '推文', value: 8 }, { label: '链接', value: 8 },
{ label: '富文本', value: 11 }, { label: '富文本', value: 11 },
]; ];
...@@ -203,6 +203,15 @@ const AddEditModal: React.FC<propType> = (props) => { ...@@ -203,6 +203,15 @@ const AddEditModal: React.FC<propType> = (props) => {
</Uploader> </Uploader>
</Form.Item> </Form.Item>
)} )}
{[8].includes(bannerTypeValue) && (
<Form.Item
label='链接地址'
name='bannerUrl'
rules={[{ required: true, message: '请输入链接地址' }]}
>
<Input placeholder={'请输入链接地址'} maxLength={100} allowClear />
</Form.Item>
)}
</Form> </Form>
</Modal> </Modal>
); );
......
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { Button, Form, Input, Select, Table, Image, Modal, message } from 'antd'; import { Button, Form, Input, Select, Table, Image, Modal, message } from 'antd';
import { listBannerInfoPage } from '~/api/interface/commonType'; import { listBannerInfoPage, updateModuleInfo } from '~/api/interface/commonType';
import { InterListType, InterReqListType } from '~/api/interface'; import { InterListType, InterReqListType, InterReqType } from '~/api/interface';
import { useLocation, useNavigate } from 'react-router-dom'; import { useLocation, useNavigate } from 'react-router-dom';
import qs from 'query-string'; import qs from 'query-string';
import { ArrowDownOutlined, ArrowUpOutlined, PlusOutlined } from '@ant-design/icons'; import { ArrowDownOutlined, ArrowUpOutlined, PlusOutlined } from '@ant-design/icons';
...@@ -34,14 +34,14 @@ const bannerType = [ ...@@ -34,14 +34,14 @@ const bannerType = [
{ label: '纯文本', value: 5 }, { label: '纯文本', value: 5 },
// { label: '服务SKU', value: 6 }, // { label: '服务SKU', value: 6 },
// { label: '红包', value: 7 }, // { label: '红包', value: 7 },
// { label: '推文', value: 8 }, { label: '链接', value: 8 },
{ label: '富文本', value: 11 }, { label: '富文本', value: 11 },
]; ];
const MaterielManageDetail = () => { const MaterielManageDetail = () => {
const { confirm } = Modal; const { confirm } = Modal;
// 表单钩子 // 表单钩子
const [form] = Form.useForm<ReqType>(); const [form] = Form.useForm<InterReqType<updateModuleInfo>>();
// 路由钩子 // 路由钩子
const location = useLocation(); const location = useLocation();
const navigate = useNavigate(); const navigate = useNavigate();
...@@ -101,8 +101,11 @@ const MaterielManageDetail = () => { ...@@ -101,8 +101,11 @@ const MaterielManageDetail = () => {
onOk: async () => { onOk: async () => {
const res = await CommonAPI.removeBannerInfo({ id: record.id }); const res = await CommonAPI.removeBannerInfo({ id: record.id });
if (res && res.code === '200') { if (res && res.code === '200') {
paginationChange(pagination.current, pagination.pageSize); message.success('删除成功');
await message.success('删除成功'); paginationChange(
tableData.length === 1 ? pagination.current - 1 : pagination.current,
pagination.pageSize,
);
} }
}, },
}); });
...@@ -164,6 +167,31 @@ const MaterielManageDetail = () => { ...@@ -164,6 +167,31 @@ const MaterielManageDetail = () => {
getAllData().then(); getAllData().then();
} }
}; };
// 修改提交数据
const handleEdit = () => {
form
.validateFields()
.then(async (values) => {
const res = await CommonAPI.updateModuleInfo({
...values,
id: Number(qs.parse(location.search).id),
});
if (res && res.code === '200') {
message.success('修改成功');
getTableList().then();
getAllData().then();
} else {
window.location.reload();
}
})
.catch((err) => {
message
.warning({
content: err.errorFields[0].errors[0],
})
.then();
});
};
// componentDidMount // componentDidMount
useEffect(() => { useEffect(() => {
query = {}; query = {};
...@@ -199,7 +227,7 @@ const MaterielManageDetail = () => { ...@@ -199,7 +227,7 @@ const MaterielManageDetail = () => {
), ),
}, },
{ {
title: '点击详情', title: '详情类型',
dataIndex: 'bannerType', dataIndex: 'bannerType',
align: 'center', align: 'center',
width: '100px', width: '100px',
...@@ -268,7 +296,9 @@ const MaterielManageDetail = () => { ...@@ -268,7 +296,9 @@ const MaterielManageDetail = () => {
justifyContent: 'space-around', justifyContent: 'space-around',
}} }}
> >
<Button type={'primary'}>修改</Button> <Button type={'primary'} onClick={handleEdit}>
修改
</Button>
<Button type={'primary'} onClick={handleBack}> <Button type={'primary'} onClick={handleBack}>
返回 返回
</Button> </Button>
......
...@@ -99,8 +99,11 @@ const MaterielManageView = () => { ...@@ -99,8 +99,11 @@ const MaterielManageView = () => {
onOk: async () => { onOk: async () => {
const res = await CommonAPI.removeModuleInfo({ id: record.id }); const res = await CommonAPI.removeModuleInfo({ id: record.id });
if (res && res.code === '200') { if (res && res.code === '200') {
paginationChange(pagination.current, pagination.pageSize); message.success('删除成功');
await message.success('删除成功'); paginationChange(
tableData.length === 1 ? pagination.current - 1 : pagination.current,
pagination.pageSize,
);
} }
}, },
}); });
......
...@@ -695,7 +695,7 @@ export const routerList: Array<RouteObjectType> = [ ...@@ -695,7 +695,7 @@ export const routerList: Array<RouteObjectType> = [
element: withLoadingComponent(<MaterielManageView />), element: withLoadingComponent(<MaterielManageView />),
meta: { meta: {
id: 30100, id: 30100,
title: '物料管理', title: '宣传管理',
icon: <SketchOutlined />, icon: <SketchOutlined />,
}, },
}, },
...@@ -704,7 +704,7 @@ export const routerList: Array<RouteObjectType> = [ ...@@ -704,7 +704,7 @@ export const routerList: Array<RouteObjectType> = [
element: withLoadingComponent(<MaterielManageDetail />), element: withLoadingComponent(<MaterielManageDetail />),
meta: { meta: {
id: 30100, id: 30100,
title: '物料详情', title: '宣传管理详情',
icon: <SketchOutlined />, icon: <SketchOutlined />,
hidden: true, hidden: true,
}, },
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论