feat(mini-user): add configurable home banner and footer
CI / verify (pull_request) Has been cancelled
CI / verify (pull_request) Has been cancelled
HQ system settings WeChat mini config with OSS swiper/footer uploads; client-config exposes miniHome. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -31,10 +31,8 @@ import {
|
||||
} from 'antd';
|
||||
|
||||
import type { MockSmsCodeItem, SystemConfigFieldMeta, SystemConfigFormResponse } from '@dukang/shared-types';
|
||||
|
||||
import { request } from '../lib/api';
|
||||
|
||||
|
||||
import { ConfigImageField, ConfigImageListField } from '../components/ConfigMediaFields';
|
||||
|
||||
const { TextArea } = Input;
|
||||
|
||||
@@ -131,123 +129,89 @@ function renderField(
|
||||
const isConfiguredSecret = field.secret && configuredSecrets.includes(field.key);
|
||||
|
||||
if (field.type === 'boolean') {
|
||||
|
||||
return (
|
||||
|
||||
<div key={field.key}>
|
||||
|
||||
<Form.Item
|
||||
|
||||
name={field.key}
|
||||
|
||||
label={
|
||||
|
||||
<Space size={4}>
|
||||
|
||||
<span>{field.label}</span>
|
||||
|
||||
<Typography.Text type="secondary" code style={{ fontSize: 11 }}>
|
||||
|
||||
{field.key}
|
||||
|
||||
</Typography.Text>
|
||||
|
||||
{field.requiresRestart ? <Tag color="orange">需重启</Tag> : <Tag color="green">即时</Tag>}
|
||||
|
||||
</Space>
|
||||
|
||||
}
|
||||
|
||||
tooltip={field.description}
|
||||
|
||||
valuePropName="checked"
|
||||
|
||||
getValueFromEvent={(checked: boolean) => (checked ? 'true' : 'false')}
|
||||
|
||||
getValueProps={(v: string) => ({ checked: v === 'true' || v === '1' })}
|
||||
|
||||
>
|
||||
|
||||
<Switch />
|
||||
|
||||
</Form.Item>
|
||||
|
||||
{extra}
|
||||
|
||||
</div>
|
||||
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (field.type === 'image' || field.type === 'imageList') {
|
||||
return (
|
||||
<Form.Item
|
||||
key={field.key}
|
||||
name={field.key}
|
||||
label={
|
||||
<Space size={4} wrap>
|
||||
<span>{field.label}</span>
|
||||
<Typography.Text type="secondary" code style={{ fontSize: 11 }}>
|
||||
{field.key}
|
||||
</Typography.Text>
|
||||
{field.requiresRestart ? <Tag color="orange">需重启</Tag> : <Tag color="green">即时</Tag>}
|
||||
</Space>
|
||||
}
|
||||
tooltip={field.description}
|
||||
>
|
||||
{field.type === 'image' ? (
|
||||
<ConfigImageField bizType="footer" />
|
||||
) : (
|
||||
<ConfigImageListField bizType="swiper" />
|
||||
)}
|
||||
</Form.Item>
|
||||
);
|
||||
}
|
||||
|
||||
const input =
|
||||
|
||||
field.type === 'textarea' ? (
|
||||
|
||||
<TextArea rows={3} placeholder={field.placeholder} />
|
||||
|
||||
) : field.type === 'number' ? (
|
||||
|
||||
<InputNumber style={{ width: '100%' }} placeholder={field.placeholder} />
|
||||
|
||||
) : field.secret ? (
|
||||
|
||||
<Input.Password
|
||||
|
||||
placeholder={isConfiguredSecret ? '已配置,留空则不修改' : field.placeholder}
|
||||
|
||||
autoComplete="new-password"
|
||||
|
||||
/>
|
||||
|
||||
) : (
|
||||
|
||||
<Input placeholder={field.placeholder} />
|
||||
|
||||
);
|
||||
|
||||
|
||||
|
||||
return (
|
||||
|
||||
<Form.Item
|
||||
|
||||
key={field.key}
|
||||
|
||||
name={field.key}
|
||||
|
||||
label={
|
||||
|
||||
<Space size={4} wrap>
|
||||
|
||||
<span>{field.label}</span>
|
||||
|
||||
<Typography.Text type="secondary" code style={{ fontSize: 11 }}>
|
||||
|
||||
{field.key}
|
||||
|
||||
</Typography.Text>
|
||||
|
||||
{field.requiresRestart ? <Tag color="orange">需重启</Tag> : <Tag color="green">即时</Tag>}
|
||||
|
||||
{isConfiguredSecret ? <Tag>已配置</Tag> : null}
|
||||
|
||||
</Space>
|
||||
|
||||
}
|
||||
|
||||
tooltip={field.description}
|
||||
|
||||
>
|
||||
|
||||
{input}
|
||||
|
||||
</Form.Item>
|
||||
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user