- 移除旧的 MaterialList 组件相关配置和引用 - 删除 formatParam 工具函数的不必要导入 - 新增 MaterialLibraryModal 和 CategoryTree 组件 - 将 UploadMaterial 组件重构为使用新的素材库选择方式 - 实现素材分类树的菜单展示和选择功能 - 添加素材库弹窗的图片和列表两种视图模式 - 集成素材选择、预览和确认功能 - 移除各组件中对旧 MaterialList 的依赖配置
130 lines
2.7 KiB
TypeScript
130 lines
2.7 KiB
TypeScript
import { ProFormUploadMaterial } from '@/components';
|
|
import { business } from '@/services';
|
|
import { formLayout } from '@/utils/formLayout';
|
|
import {
|
|
ProForm,
|
|
ProFormText,
|
|
ProFormUploadDragger,
|
|
} from '@ant-design/pro-components';
|
|
import { Col, message, Row, Space } from 'antd';
|
|
|
|
export default function WxMaConfig() {
|
|
return (
|
|
<ProForm<BusinessAPI.WxMaConfigValue>
|
|
{...formLayout()}
|
|
request={async () => {
|
|
const { data } = await business.setting.showSetting({
|
|
settingShowQry: {
|
|
settingKey: 'WX_MA_CONFIG',
|
|
},
|
|
});
|
|
|
|
const wxMaConfigValue =
|
|
data?.settingValue as BusinessAPI.WxMaConfigValue;
|
|
return {
|
|
...wxMaConfigValue,
|
|
wxMaLogoList: [wxMaConfigValue?.wxMaLogo],
|
|
} as BusinessAPI.WxMaConfigValue;
|
|
}}
|
|
onFinish={async (values) => {
|
|
await business.setting.updateSetting({
|
|
settingKey: 'WX_MA_CONFIG',
|
|
settingValue: {
|
|
...values,
|
|
settingKey: 'WX_MA_CONFIG',
|
|
},
|
|
});
|
|
|
|
message.success('更新小程序配置成功');
|
|
}}
|
|
submitter={{
|
|
render: (_, dom) => {
|
|
return (
|
|
<Row>
|
|
<Col span={14} offset={4}>
|
|
<Space>{dom}</Space>
|
|
</Col>
|
|
</Row>
|
|
);
|
|
},
|
|
}}
|
|
>
|
|
<ProFormText hidden={true} name={'settingId'} />
|
|
<ProFormText
|
|
name="wxMaName"
|
|
label="小程序名称"
|
|
placeholder={'请输入小程序名称'}
|
|
required={true}
|
|
rules={[
|
|
{
|
|
required: true,
|
|
message: '小程序名称为必填项',
|
|
},
|
|
]}
|
|
/>
|
|
<ProFormText
|
|
name="appId"
|
|
label="AppID(小程序ID)"
|
|
placeholder={'请输入小程序AppID'}
|
|
required={true}
|
|
rules={[
|
|
{
|
|
required: true,
|
|
message: '小程序AppID为必填项',
|
|
},
|
|
]}
|
|
/>
|
|
<ProFormText.Password
|
|
name="appSecret"
|
|
label="AppSecret(小程序密钥)"
|
|
placeholder={'请输入小程序AppSecret'}
|
|
required={true}
|
|
rules={[
|
|
{
|
|
required: true,
|
|
message: '小程序AppSecret为必填项',
|
|
},
|
|
]}
|
|
/>
|
|
<ProFormText
|
|
name="wxMaOriginalId"
|
|
label="小程序原始ID"
|
|
placeholder={'请输入小程序原始ID'}
|
|
required={true}
|
|
rules={[
|
|
{
|
|
required: true,
|
|
message: '小程序原始ID为必填项',
|
|
},
|
|
]}
|
|
/>
|
|
<ProFormUploadMaterial
|
|
key={'wxMaLogo'}
|
|
label={'小程序Logo'}
|
|
name={'wxMaLogoList'}
|
|
transform={(value) => {
|
|
return {
|
|
wxMaLogo: value[0],
|
|
};
|
|
}}
|
|
fieldProps={{
|
|
maxCount: 1,
|
|
}}
|
|
/>
|
|
<ProFormUploadDragger
|
|
key={'wxMaCheckFile'}
|
|
label={'校验文件上传'}
|
|
tooltip={'添加业务域名的时候需要上传校验文件'}
|
|
name={'wxMaCheckFileList'}
|
|
accept={'.txt'}
|
|
max={1}
|
|
transform={(file) => {
|
|
return {
|
|
wxMaCheckFile: file[0],
|
|
};
|
|
}}
|
|
/>
|
|
</ProForm>
|
|
);
|
|
}
|