Compare commits

..

No commits in common. "8ba778a1eb691c9a4d0c6074a74376b9f133724a" and "7bc8469fc8b5432bae99b78ea8cc3995df8d2c70" have entirely different histories.

5 changed files with 80 additions and 311 deletions

View File

@ -6,10 +6,7 @@
gap: 8px !important; gap: 8px !important;
align-items: flex-start !important; align-items: flex-start !important;
} }
.ant-upload-list-item-name {
width: 300px;
overflow: hidden;
}
.ant-upload-list-item { .ant-upload-list-item {
margin: 0 !important; margin: 0 !important;
margin-bottom: 0 !important; margin-bottom: 0 !important;

View File

@ -1,70 +0,0 @@
import { MyBetaModalFormProps } from '@/common';
import { PlayCircleFilled } from '@ant-design/icons';
import { ProCard } from '@ant-design/pro-components';
import './style.scss';
export default function infoPreview(props: MyBetaModalFormProps) {
return (
<>
{props?.item?.type === 'Image' ? (
<div className="card_info_preview">
<div className="title">/</div>
<ProCard>
<div className="preview_header">
<div className="avatar"></div>
<div className="info">
<div className="name"></div>
<div className="desc"></div>
</div>
</div>
<div className="preview_content">
<div className="item"></div>
<div className="item"></div>
<div className="item"></div>
<div className="item"></div>
</div>
</ProCard>
</div>
) : props?.item?.type === 'Video' ? (
<div className="card_info_preview">
<div className="title">/</div>
<ProCard>
<div className="preview_header">
<div className="avatar"></div>
<div className="info">
<div className="name"></div>
<div className="desc"></div>
</div>
</div>
<div className="preview_content">
<div className="video_preview">
<PlayCircleFilled style={{ fontSize: 40 }} />
</div>
</div>
</ProCard>
</div>
) : props?.item?.type === 'Link' ||
props?.item?.type === 'MiniProgram' ? (
<div className="card_info_preview">
<div className="title">/</div>
<ProCard>
<div className="preview_header">
<div className="avatar"></div>
<div className="info">
<div className="name"></div>
<div className="desc"></div>
</div>
</div>
<div className="preview_content cover_image_preview">
<div className="cover_image"></div>
<div className="cover_info">
</div>
</div>
</ProCard>
</div>
) : (
<></>
)}
</>
);
}

View File

@ -1,76 +0,0 @@
.card_info_preview {
background-color: #f8f8f8;
width: 400px;
padding: 15px;
margin-left: 10px;
border-radius: 10px;
.title {
border-left: 3px solid #1890ff;
padding-left: 15px;
margin-bottom: 12px;
}
.preview_header {
display: flex;
align-items: center;
padding-bottom: 15px;
.avatar {
width: 60px;
height: 60px;
background-color: #f8f8f8;
font-size: 17px;
font-weight: 500;
padding: 8px;
text-align: center;
line-height: 20px;
}
.info {
padding-left: 15px;
.name {
font-size: 16px;
font-weight: 500;
}
.desc {
font-size: 12px;
color: #666;
}
}
}
.preview_content {
display: flex;
align-items: center;
justify-content: space-between;
.item {
width: 70px;
height: 70px;
background-color: #f8f8f8;
}
.video_preview {
width: 150px;
height: 150px;
background-color: #f8f8f8;
display: flex;
align-items: center;
justify-content: center;
}
}
.cover_image_preview {
background-color: #f8f8f8;
padding: 10px;
border-radius: 10px;
.cover_image {
width: 70px;
height: 70px;
background-color: #eee;
text-align: center;
line-height: 70px;
font-size: 17px;
font-weight: 500;
}
.cover_info {
flex: 1;
padding-left: 10px;
font-size: 12px;
height: 70px;
}
}
}

View File

@ -6,15 +6,10 @@ import {
usePageTabs, usePageTabs,
} from '@/common'; } from '@/common';
import { Apis } from '@/gen/Apis'; import { Apis } from '@/gen/Apis';
import {
CustomerMomentsChannelEnum,
CustomerMomentsContentTypeEnum,
CustomerMomentsPushTypeEnum,
CustomerMomentsTaskEndTypeEnum,
} from '@/gen/Enums';
import { ProTable } from '@ant-design/pro-components'; import { ProTable } from '@ant-design/pro-components';
import { Card, Space } from 'antd'; import { Space } from 'antd';
import Create from './modals/Create'; import Create from './modals/Create';
import Update from './modals/Update';
export default function Index({ title = '推送任务' }) { export default function Index({ title = '推送任务' }) {
// 注册当前页面为标签页 // 注册当前页面为标签页
@ -49,83 +44,21 @@ export default function Index({ title = '推送任务' }) {
MyColumns.ID(), MyColumns.ID(),
{ {
title: '名称', title: '名称',
dataIndex: 'title', dataIndex: 'name',
render: (_, i: any) => {
return (
<Card size="small">
<Space align="start">
<img src={i?.cover_image[0]?.url} width={45} height={45} />
<div>{i?.title}</div>
</Space>
</Card>
);
},
},
MyColumns.EnumTag({
title: '发送渠道',
dataIndex: 'channel',
valueEnum: CustomerMomentsChannelEnum,
}),
MyColumns.EnumTag({
title: '内容类型',
dataIndex: 'content_type',
valueEnum: CustomerMomentsContentTypeEnum,
}),
MyColumns.EnumTag({
title: '推送类型',
dataIndex: 'push_type',
valueEnum: CustomerMomentsPushTypeEnum,
}),
{
title: '定时发送时间',
dataIndex: 'scheduled_time',
search: false,
},
MyColumns.EnumTag({
title: '任务结束类型',
dataIndex: 'task_end_type',
valueEnum: CustomerMomentsTaskEndTypeEnum,
search: false,
}),
{
title: '任务结束天数',
dataIndex: 'task_days',
search: false,
},
{
title: '定时结束',
dataIndex: 'task_end_time',
search: false,
}, },
MyColumns.UpdatedAt(), MyColumns.UpdatedAt(),
MyColumns.CreatedAt(), MyColumns.CreatedAt(),
MyColumns.Option({ MyColumns.Option({
render: (_, item: any, index, action) => ( render: (_, item: any, index, action) => (
<Space key={index}> <Space key={index}>
{/* <Update item={item} reload={action?.reload} title={title} /> */} <Update item={item} reload={action?.reload} title={title} />
<MyButtons.Default <MyButtons.Delete
isConfirm
title="发送"
type="primary"
disabled={
item?.push_type === 'ScheduledPush' ||
item?.push_status === 'Pushed'
}
description="确定发送?"
onConfirm={() => {
Apis.Customer.CustomerMoments.Send({
id: item.id,
}).then(() => action?.reload());
}}
/>
{/* <MyButtons.Delete
onConfirm={() => onConfirm={() =>
Apis.Customer.CustomerMoments.Delete({ Apis.Customer.CustomerMomentCategories.Delete({
id: item.id, id: item.id,
}).then(() => action?.reload()) }).then(() => action?.reload())
} }
/> */} />
</Space> </Space>
), ),
}), }),

View File

@ -18,16 +18,11 @@ import {
CustomerMomentsTaskEndTypeEnum, CustomerMomentsTaskEndTypeEnum,
} from '@/gen/Enums'; } from '@/gen/Enums';
import { BetaSchemaForm } from '@ant-design/pro-components'; import { BetaSchemaForm } from '@ant-design/pro-components';
import { Button, Form, message, Space, Steps } from 'antd'; import { Button, message, Space, Steps } from 'antd';
import { useRef, useState } from 'react'; import { useState } from 'react';
import MyinfoPreview from '../components/infoPreview';
export default function Create(props: MyBetaModalFormProps) { export default function Create(props: MyBetaModalFormProps) {
const [current, setCurrent] = useState(0); const [current, setCurrent] = useState(0);
const [getContentType, setContentType] = useState('');
const [formData, setFormData] = useState<any>({}); const [formData, setFormData] = useState<any>({});
const [form] = Form.useForm();
const modalRef: any = useRef(null);
const steps = [ const steps = [
{ {
title: '创建任务', title: '创建任务',
@ -57,7 +52,7 @@ export default function Create(props: MyBetaModalFormProps) {
title: '推送类型', title: '推送类型',
valueEnum: CustomerMomentsPushTypeEnum, valueEnum: CustomerMomentsPushTypeEnum,
required: true, required: true,
colProps: { span: 9 }, colProps: { span: 8 },
}), }),
{ {
name: ['push_type'], name: ['push_type'],
@ -86,7 +81,7 @@ export default function Create(props: MyBetaModalFormProps) {
title: '任务结束类型', title: '任务结束类型',
valueEnum: CustomerMomentsTaskEndTypeEnum, valueEnum: CustomerMomentsTaskEndTypeEnum,
required: true, required: true,
colProps: { span: 9 }, colProps: { span: 8 },
}), }),
{ {
name: ['task_end_type'], name: ['task_end_type'],
@ -98,11 +93,10 @@ export default function Create(props: MyBetaModalFormProps) {
key: 'task_days', key: 'task_days',
title: '任务结束天数', title: '任务结束天数',
colProps: { span: 10 }, colProps: { span: 10 },
valueType: 'digit', valueType: 'number',
formItemProps: { ...rulesHelper.number }, formItemProps: { ...rulesHelper.number },
fieldProps: { fieldProps: {
suffix: '天结束', suffix: '天结束',
style: { width: '200px' },
}, },
}, },
] ]
@ -174,7 +168,6 @@ export default function Create(props: MyBetaModalFormProps) {
name: ['content_type'], name: ['content_type'],
valueType: 'dependency', valueType: 'dependency',
columns: ({ content_type }: any) => { columns: ({ content_type }: any) => {
setContentType(content_type);
return content_type === 'MiniProgram' return content_type === 'MiniProgram'
? [ ? [
{ {
@ -235,54 +228,49 @@ export default function Create(props: MyBetaModalFormProps) {
title={`创建${props.title}`} title={`创建${props.title}`}
type="primary" type="primary"
size={'middle'} size={'middle'}
myRef={modalRef} width="800px"
width="1200px"
node={ node={
<Space direction="vertical"> <Space direction="vertical">
<div style={{ width: '1160px' }}> <Steps current={current} items={steps} />
<Steps
style={{ padding: '50px 150px 30px 150px' }}
current={current}
items={steps}
/>
</div>
<Space align="start">
<div style={{ width: '700px' }}>
<BetaSchemaForm<ApiTypes.Customer.CustomerMomentCategories.Store> <BetaSchemaForm<ApiTypes.Customer.CustomerMomentCategories.Store>
{...MyModalFormProps.props} {...MyModalFormProps.props}
title={`添加${props.title}`} title={`添加${props.title}`}
wrapperCol={{ span: 24 }} wrapperCol={{ span: 24 }}
width="800px" width="800px"
form={form}
layoutType="Form" layoutType="Form"
trigger={<MyButtons.Create title={`添加${props.title}`} />} trigger={<MyButtons.Create title={`添加${props.title}`} />}
onFinish={async (values) => { onFinish={async (values) => {
setFormData(values); setFormData(values);
console.log('提交的数据2:', values);
if (current < steps.length - 1) { if (current < steps.length - 1) {
handleNext(); handleNext();
} else { } else {
let data = { ...formData, ...values }; let data = { ...formData, ...values };
Apis.Customer.CustomerMoments.Store({ Apis.Customer.CustomerMoments.Store({
...data, ...data,
one_moment_categories_id: one_moment_categories_id: formData?.moment_categories_ids[0],
formData?.moment_categories_ids[0], two_moment_categories_id: formData?.moment_categories_ids[1],
two_moment_categories_id:
formData?.moment_categories_ids[1],
}) })
.then(() => { .then(() => {
props.reload?.(); props.reload?.();
message.success('提交成功!'); message.success(props.title + '成功');
form.setFieldsValue({});
modalRef.current?.close();
setCurrent(0);
return true; return true;
}) })
.catch(() => false); .catch(() => false);
} }
}} }}
// onFinish={async (values) =>
// Apis.Customer.CustomerMomentCategories.Store(values)
// .then(() => {
// props.reload?.();
// message.success(props.title + '成功');
// return true;
// })
// .catch(() => false)
// }
columns={steps[current].columns} columns={steps[current].columns}
submitter={{ submitter={{
render: (props) => { render: (props, dom) => {
return ( return (
<Space <Space
style={{ display: 'flex', justifyContent: 'flex-end' }} style={{ display: 'flex', justifyContent: 'flex-end' }}
@ -310,9 +298,6 @@ export default function Create(props: MyBetaModalFormProps) {
}, },
}} }}
/> />
</div>
{current ? <MyinfoPreview item={{ type: getContentType }} /> : ''}
</Space>
</Space> </Space>
} }
/> />