提交 6597bb93 作者: ZhangLingKun

Merge branch 'develop'

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