nili
6 months ago
24 changed files with 1245 additions and 561 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,217 @@ |
|||||
|
import { InboxOutlined, InfoCircleOutlined } from '@ant-design/icons'; |
||||
|
import { Button, Form, Input, Modal, Tooltip } from 'antd'; |
||||
|
import Upload, { UploadChangeParam } from 'antd/es/upload'; |
||||
|
import { UploadFile } from 'antd/es/upload/interface'; |
||||
|
import { RcFile } from 'antd/lib/upload'; |
||||
|
import React, { useEffect } from 'react'; |
||||
|
|
||||
|
import { getAliPayConfig, saveAliPayConfig } from '../../services/matrix/matrixAppConfigController'; |
||||
|
|
||||
|
export type AliPayConfigFormProps = { |
||||
|
onCancel: () => void; |
||||
|
onSubmit: () => void; |
||||
|
updateModalOpen: boolean; |
||||
|
appCode: string; |
||||
|
}; |
||||
|
|
||||
|
interface UploadInfo extends UploadChangeParam<UploadFile<any>> { |
||||
|
file: UploadFile<any>; |
||||
|
} |
||||
|
|
||||
|
const { TextArea } = Input; |
||||
|
|
||||
|
const AliPayConfigForm: React.FC<AliPayConfigFormProps> = (props) => { |
||||
|
const [form] = Form.useForm(); |
||||
|
|
||||
|
const handleOk = () => { |
||||
|
form.submit(); |
||||
|
}; |
||||
|
|
||||
|
const handleCancel = () => { |
||||
|
props.onCancel(); |
||||
|
}; |
||||
|
|
||||
|
const fetchConfig = async (appCode: string) => { |
||||
|
const data = await getAliPayConfig({ appCode }); |
||||
|
|
||||
|
form.setFieldsValue(data.data); |
||||
|
}; |
||||
|
|
||||
|
useEffect(() => { |
||||
|
fetchConfig(props.appCode); |
||||
|
}, [props.appCode]); |
||||
|
|
||||
|
const handleSaveApp = async (values: API.AliPayConfigBo) => { |
||||
|
try { |
||||
|
await saveAliPayConfig({ appCode: props.appCode }, values); |
||||
|
} catch (e) { |
||||
|
return; |
||||
|
} |
||||
|
props.onSubmit(); |
||||
|
}; |
||||
|
|
||||
|
return ( |
||||
|
<Modal title="编辑" visible={props.updateModalOpen} onOk={handleOk} onCancel={handleCancel}> |
||||
|
<Form labelCol={{ span: 8 }} wrapperCol={{ span: 18 }} form={form} onFinish={handleSaveApp}> |
||||
|
<Form.Item |
||||
|
name="aliPayAppId" |
||||
|
label={ |
||||
|
<> |
||||
|
AppId |
||||
|
<span style={{ marginLeft: 4 }}> |
||||
|
<Tooltip title="阿里云开放平台获取"> |
||||
|
<InfoCircleOutlined /> |
||||
|
</Tooltip> |
||||
|
</span> |
||||
|
</> |
||||
|
} |
||||
|
> |
||||
|
<Input /> |
||||
|
</Form.Item> |
||||
|
<Form.Item |
||||
|
name="aliPayPrivateKey" |
||||
|
label={ |
||||
|
<> |
||||
|
PrivateKey |
||||
|
<span style={{ marginLeft: 4 }}> |
||||
|
<Tooltip title="阿里云开放平台获取"> |
||||
|
<InfoCircleOutlined /> |
||||
|
</Tooltip> |
||||
|
</span> |
||||
|
</> |
||||
|
} |
||||
|
> |
||||
|
<Input /> |
||||
|
</Form.Item> |
||||
|
<Form.Item |
||||
|
name="aliPayAppCert" |
||||
|
label={ |
||||
|
<> |
||||
|
appCertPublicKey |
||||
|
<span style={{ marginLeft: 4 }}> |
||||
|
<Tooltip title="密钥工具生成"> |
||||
|
<InfoCircleOutlined /> |
||||
|
</Tooltip> |
||||
|
</span> |
||||
|
</> |
||||
|
} |
||||
|
> |
||||
|
<Input.Group compact> |
||||
|
<Form.Item |
||||
|
name="aliPayAppCert" |
||||
|
noStyle |
||||
|
rules={[{ required: true, message: '请输入或选择appCertPublicKey!' }]} |
||||
|
> |
||||
|
<TextArea autoSize={{ maxRows: 6 }} /> |
||||
|
</Form.Item> |
||||
|
<Upload |
||||
|
name="file" |
||||
|
multiple={false} |
||||
|
onChange={(info: UploadInfo) => { |
||||
|
if (info.file.status !== 'uploading') { |
||||
|
const reader = new FileReader(); |
||||
|
reader.onload = () => { |
||||
|
form.setFieldsValue({ aliPayAppCert: reader.result as string }); |
||||
|
}; |
||||
|
reader.readAsText(info.file.originFileObj as RcFile); |
||||
|
} |
||||
|
}} |
||||
|
showUploadList={false} |
||||
|
style={{ width: '100px' }} |
||||
|
> |
||||
|
<Button style={{ marginTop: 10 }} type="primary" icon={<InboxOutlined />}> |
||||
|
选择文件 |
||||
|
</Button> |
||||
|
</Upload> |
||||
|
</Input.Group> |
||||
|
</Form.Item> |
||||
|
<Form.Item |
||||
|
name="aliPayRootCert" |
||||
|
label={ |
||||
|
<> |
||||
|
alipayRootCert |
||||
|
<span style={{ marginLeft: 4 }}> |
||||
|
<Tooltip title="密钥工具生成"> |
||||
|
<InfoCircleOutlined /> |
||||
|
</Tooltip> |
||||
|
</span> |
||||
|
</> |
||||
|
} |
||||
|
> |
||||
|
<Input.Group compact> |
||||
|
<Form.Item |
||||
|
name="aliPayRootCert" |
||||
|
noStyle |
||||
|
rules={[{ required: true, message: '请输入或选择alipayRootCert!' }]} |
||||
|
> |
||||
|
<TextArea autoSize={{ maxRows: 6 }} /> |
||||
|
</Form.Item> |
||||
|
<Upload |
||||
|
name="file" |
||||
|
multiple={false} |
||||
|
onChange={(info: UploadInfo) => { |
||||
|
if (info.file.status !== 'uploading') { |
||||
|
const reader = new FileReader(); |
||||
|
reader.onload = () => { |
||||
|
form.setFieldsValue({ aliPayRootCert: reader.result as string }); |
||||
|
}; |
||||
|
reader.readAsText(info.file.originFileObj as RcFile); |
||||
|
} |
||||
|
}} |
||||
|
showUploadList={false} |
||||
|
style={{ width: '100px' }} |
||||
|
> |
||||
|
<Button style={{ marginTop: 10 }} type="primary" icon={<InboxOutlined />}> |
||||
|
选择文件 |
||||
|
</Button> |
||||
|
</Upload> |
||||
|
</Input.Group> |
||||
|
</Form.Item> |
||||
|
<Form.Item |
||||
|
name="aliPayPublicCert" |
||||
|
label={ |
||||
|
<> |
||||
|
alipayCertPublicKey |
||||
|
<span style={{ marginLeft: 4 }}> |
||||
|
<Tooltip title="密钥工具生成"> |
||||
|
<InfoCircleOutlined /> |
||||
|
</Tooltip> |
||||
|
</span> |
||||
|
</> |
||||
|
} |
||||
|
> |
||||
|
<Input.Group compact> |
||||
|
<Form.Item |
||||
|
name="aliPayPublicCert" |
||||
|
noStyle |
||||
|
rules={[{ required: true, message: '请输入或选择alipayCertPublicKey!' }]} |
||||
|
> |
||||
|
<TextArea autoSize={{ maxRows: 6 }} /> |
||||
|
</Form.Item> |
||||
|
<Upload |
||||
|
name="file" |
||||
|
multiple={false} |
||||
|
onChange={(info: UploadInfo) => { |
||||
|
if (info.file.status !== 'uploading') { |
||||
|
const reader = new FileReader(); |
||||
|
reader.onload = () => { |
||||
|
form.setFieldsValue({ aliPayPublicCert: reader.result as string }); |
||||
|
}; |
||||
|
reader.readAsText(info.file.originFileObj as RcFile); |
||||
|
} |
||||
|
}} |
||||
|
showUploadList={false} |
||||
|
style={{ width: '100px' }} |
||||
|
> |
||||
|
<Button style={{ marginTop: 10 }} type="primary" icon={<InboxOutlined />}> |
||||
|
选择文件 |
||||
|
</Button> |
||||
|
</Upload> |
||||
|
</Input.Group> |
||||
|
</Form.Item> |
||||
|
</Form> |
||||
|
</Modal> |
||||
|
); |
||||
|
}; |
||||
|
|
||||
|
export default AliPayConfigForm; |
@ -0,0 +1,96 @@ |
|||||
|
import { Form, Input, Modal, Select } from 'antd'; |
||||
|
import React, { useEffect, useState } from 'react'; |
||||
|
import { getBasicConfig, saveBasicConfig } from '../../services/matrix/matrixAppConfigController'; |
||||
|
|
||||
|
export type AppBasicConfigFormProps = { |
||||
|
onCancel: () => void; |
||||
|
onSubmit: () => void; |
||||
|
updateModalOpen: boolean; |
||||
|
appCode: string | undefined; |
||||
|
}; |
||||
|
|
||||
|
const AppBasicConfigForm: React.FC<AppBasicConfigFormProps> = (props) => { |
||||
|
const [form] = Form.useForm(); |
||||
|
const [editing, setEditing] = useState(false); |
||||
|
|
||||
|
const handleOk = () => { |
||||
|
form.submit(); |
||||
|
}; |
||||
|
|
||||
|
const handleCancel = () => { |
||||
|
props.onCancel(); |
||||
|
}; |
||||
|
|
||||
|
const fetchConfig = async (appCode: string | undefined) => { |
||||
|
if (!appCode) { |
||||
|
form.resetFields(); |
||||
|
return; |
||||
|
} |
||||
|
const data = await getBasicConfig({ appCode }); |
||||
|
form.setFieldsValue(data.data); |
||||
|
}; |
||||
|
|
||||
|
useEffect(() => { |
||||
|
fetchConfig(props.appCode); |
||||
|
setEditing(props.appCode !== undefined); |
||||
|
if (!props.appCode) { |
||||
|
form.resetFields(); |
||||
|
} |
||||
|
}, [props.appCode]); |
||||
|
|
||||
|
const handleSaveApp = async (values: API.AppBasicConfig) => { |
||||
|
try { |
||||
|
await saveBasicConfig(values); |
||||
|
} catch (e) { |
||||
|
return; |
||||
|
} |
||||
|
props.onSubmit(); |
||||
|
}; |
||||
|
|
||||
|
return ( |
||||
|
<Modal title="编辑" visible={props.updateModalOpen} onOk={handleOk} onCancel={handleCancel}> |
||||
|
<Form form={form} onFinish={handleSaveApp}> |
||||
|
<Form.Item name="id" style={{ display: 'none' }}> |
||||
|
<Input type="hidden" /> |
||||
|
</Form.Item> |
||||
|
<Form.Item name="code" style={{ display: 'none' }}> |
||||
|
<Input type="hidden" /> |
||||
|
</Form.Item> |
||||
|
<Form.Item label="应用名" name="name"> |
||||
|
<Input /> |
||||
|
</Form.Item> |
||||
|
<Form.Item label="应用图片" name="img"> |
||||
|
<Input /> |
||||
|
</Form.Item> |
||||
|
<Form.Item label="下载地址" name="url"> |
||||
|
<Input /> |
||||
|
</Form.Item> |
||||
|
<Form.Item label="app版本" name="version"> |
||||
|
<Input /> |
||||
|
</Form.Item> |
||||
|
<Form.Item label="菜单栏中" name="hide"> |
||||
|
<Select> |
||||
|
<Select.Option key="0" value={0}> |
||||
|
展示 |
||||
|
</Select.Option> |
||||
|
<Select.Option key="1" value={1}> |
||||
|
隐藏 |
||||
|
</Select.Option> |
||||
|
</Select> |
||||
|
</Form.Item> |
||||
|
<Form.Item label="渠道" name="channel"> |
||||
|
<Select disabled={editing}> |
||||
|
<Select.Option key="fanmiyou" value="fanmiyou"> |
||||
|
凡米游 |
||||
|
</Select.Option> |
||||
|
<Select.Option key="qiji" value="qiji"> |
||||
|
奇迹 |
||||
|
</Select.Option> |
||||
|
</Select> |
||||
|
</Form.Item> |
||||
|
</Form> |
||||
|
</Modal> |
||||
|
); |
||||
|
}; |
||||
|
|
||||
|
export default AppBasicConfigForm; |
@ -0,0 +1,235 @@ |
|||||
|
import { appList } from '@/services/matrix/admin'; |
||||
|
import { PageContainer, ProColumns, ProTable } from '@ant-design/pro-components'; |
||||
|
import { Button, Flex, Input, Popover, QRCode, Tag } from 'antd'; |
||||
|
import { useEffect, useState } from 'react'; |
||||
|
|
||||
|
import AliPayConfigForm from './AliPayConfigForm'; |
||||
|
import AppBasicConfigForm from './AppBasicConfigForm'; |
||||
|
import UMengConfigForm from './UMengConfigForm'; |
||||
|
import WxConfigForm from './WxConfigForm'; |
||||
|
|
||||
|
const SuperAdminAppManagement = () => { |
||||
|
const [visible, setVisible] = useState(false); |
||||
|
const [appArr, setAppArr] = useState<API.MatrixApp[]>([]); |
||||
|
const [filteredAppArr, setFilteredAppArr] = useState<API.MatrixApp[]>([]); |
||||
|
|
||||
|
const [aliPayVisible, setAliPayVisible] = useState(false); |
||||
|
const [uMengVisible, setUMengVisible] = useState(false); |
||||
|
const [wxVisible, setWxVisible] = useState(false); |
||||
|
|
||||
|
const [appCode, setAppCode] = useState<string>(); |
||||
|
|
||||
|
const superAdminColumns: ProColumns<API.MatrixAppBo>[] = [ |
||||
|
{ |
||||
|
title: '应用名', |
||||
|
dataIndex: 'name', |
||||
|
copyable: true, |
||||
|
hideInSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
title: '图片', |
||||
|
dataIndex: 'img', |
||||
|
hideInSearch: true, |
||||
|
renderText: (img: string) => <img style={{ width: '40px' }} src={img} />, |
||||
|
}, |
||||
|
{ |
||||
|
title: 'code', |
||||
|
dataIndex: 'code', |
||||
|
copyable: true, |
||||
|
hideInSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
title: '下载地址', |
||||
|
dataIndex: 'url', |
||||
|
width: 200, |
||||
|
hideInSearch: true, |
||||
|
renderText: (url: string) => ( |
||||
|
<Popover |
||||
|
overlayInnerStyle={{ padding: 0 }} |
||||
|
content={<QRCode value={url || ''} bordered={false} />} |
||||
|
> |
||||
|
<a style={{ wordBreak: 'break-word' }}>{url}</a> |
||||
|
</Popover> |
||||
|
), |
||||
|
}, |
||||
|
{ |
||||
|
title: 'secret', |
||||
|
dataIndex: 'secret', |
||||
|
ellipsis: true, |
||||
|
copyable: true, |
||||
|
hideInSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
title: '菜单栏中', |
||||
|
dataIndex: 'hide', |
||||
|
hideInSearch: true, |
||||
|
renderText: (r: number) => { |
||||
|
if (r === 0) { |
||||
|
return <Tag color="blue">展示</Tag>; |
||||
|
} else { |
||||
|
return <Tag color="purple">隐藏</Tag>; |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
title: '渠道', |
||||
|
dataIndex: 'channel', |
||||
|
hideInSearch: true, |
||||
|
renderText: (r: string) => { |
||||
|
switch (r) { |
||||
|
case 'fanmiyou': |
||||
|
return '凡米游'; |
||||
|
case 'qiji': |
||||
|
return '奇迹'; |
||||
|
} |
||||
|
return r; |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
title: '操作', |
||||
|
width: 100, |
||||
|
hideInSearch: true, |
||||
|
renderText: (record: API.MatrixAppBo) => ( |
||||
|
<Flex gap="small" wrap> |
||||
|
<Tag |
||||
|
color="magenta" |
||||
|
key="edit" |
||||
|
onClick={() => { |
||||
|
setAppCode(record.code); |
||||
|
setVisible(true); |
||||
|
}} |
||||
|
> |
||||
|
编辑 |
||||
|
</Tag> |
||||
|
{record.enableCash && ( |
||||
|
<Tag |
||||
|
key="ediyUMeng" |
||||
|
color="orange" |
||||
|
onClick={() => { |
||||
|
setAppCode(record.code); |
||||
|
setUMengVisible(true); |
||||
|
}} |
||||
|
> |
||||
|
友盟配置 |
||||
|
</Tag> |
||||
|
)} |
||||
|
{record.enableCash && ( |
||||
|
<Tag |
||||
|
key="ediyWx" |
||||
|
color="#87d068" |
||||
|
onClick={() => { |
||||
|
setAppCode(record.code); |
||||
|
setWxVisible(true); |
||||
|
}} |
||||
|
> |
||||
|
微信配置 |
||||
|
</Tag> |
||||
|
)} |
||||
|
<Tag |
||||
|
key="ediyAliPay" |
||||
|
color="#2db7f5" |
||||
|
onClick={() => { |
||||
|
setAppCode(record.code); |
||||
|
setAliPayVisible(true); |
||||
|
}} |
||||
|
> |
||||
|
支付宝配置 |
||||
|
</Tag> |
||||
|
</Flex> |
||||
|
), |
||||
|
}, |
||||
|
]; |
||||
|
|
||||
|
const fetchApp = async () => { |
||||
|
const res = await appList(); |
||||
|
if (res.data) { |
||||
|
setAppArr(res.data); |
||||
|
setFilteredAppArr(res.data); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
useEffect(() => { |
||||
|
fetchApp(); |
||||
|
}, []); |
||||
|
|
||||
|
const handleSearch = (value: string) => { |
||||
|
const filtered = appArr.filter((item) => item?.name?.includes(value)); |
||||
|
setFilteredAppArr(filtered); |
||||
|
}; |
||||
|
|
||||
|
return ( |
||||
|
<PageContainer> |
||||
|
<Button |
||||
|
style={{ marginBottom: '20px' }} |
||||
|
onClick={() => { |
||||
|
setVisible(true); |
||||
|
setAppCode(undefined); |
||||
|
}} |
||||
|
> |
||||
|
新建应用 |
||||
|
</Button> |
||||
|
|
||||
|
<ProTable |
||||
|
search={{ |
||||
|
defaultCollapsed: false, // 默认展开搜索框
|
||||
|
optionRender: () => [ |
||||
|
// 自定义搜索框
|
||||
|
<Input |
||||
|
key="name" |
||||
|
placeholder="请输入应用名" |
||||
|
onChange={(e) => handleSearch(e.target.value)} |
||||
|
/>, |
||||
|
], |
||||
|
}} |
||||
|
onReset={() => { |
||||
|
setFilteredAppArr(appArr); |
||||
|
}} |
||||
|
columns={superAdminColumns} |
||||
|
dataSource={filteredAppArr} |
||||
|
/> |
||||
|
|
||||
|
{appCode && aliPayVisible && ( |
||||
|
<AliPayConfigForm |
||||
|
updateModalOpen={aliPayVisible} |
||||
|
appCode={appCode || ''} |
||||
|
onCancel={() => setAliPayVisible(false)} |
||||
|
onSubmit={() => { |
||||
|
setAliPayVisible(false); |
||||
|
fetchApp(); |
||||
|
}} |
||||
|
/> |
||||
|
)} |
||||
|
{appCode && uMengVisible && ( |
||||
|
<UMengConfigForm |
||||
|
updateModalOpen={uMengVisible} |
||||
|
appCode={appCode || ''} |
||||
|
onCancel={() => setUMengVisible(false)} |
||||
|
onSubmit={() => { |
||||
|
setUMengVisible(false); |
||||
|
}} |
||||
|
/> |
||||
|
)} |
||||
|
{appCode && wxVisible && ( |
||||
|
<WxConfigForm |
||||
|
updateModalOpen={wxVisible} |
||||
|
appCode={appCode || ''} |
||||
|
onCancel={() => setWxVisible(false)} |
||||
|
onSubmit={() => { |
||||
|
setWxVisible(false); |
||||
|
}} |
||||
|
/> |
||||
|
)} |
||||
|
<AppBasicConfigForm |
||||
|
updateModalOpen={visible} |
||||
|
appCode={appCode} |
||||
|
onCancel={() => setVisible(false)} |
||||
|
onSubmit={() => { |
||||
|
setVisible(false); |
||||
|
fetchApp(); |
||||
|
}} |
||||
|
/> |
||||
|
</PageContainer> |
||||
|
); |
||||
|
}; |
||||
|
|
||||
|
export default SuperAdminAppManagement; |
@ -0,0 +1,62 @@ |
|||||
|
import { Form, Input, Modal } from 'antd'; |
||||
|
import React, { useEffect } from 'react'; |
||||
|
import { getUMengConfig, saveUMengConfig } from '../../services/matrix/matrixAppConfigController'; |
||||
|
|
||||
|
export type UMengConfigFormProps = { |
||||
|
onCancel: () => void; |
||||
|
onSubmit: () => void; |
||||
|
updateModalOpen: boolean; |
||||
|
appCode: string; |
||||
|
}; |
||||
|
|
||||
|
const UMengConfigForm: React.FC<UMengConfigFormProps> = (props) => { |
||||
|
const [form] = Form.useForm(); |
||||
|
|
||||
|
const handleOk = () => { |
||||
|
form.submit(); |
||||
|
}; |
||||
|
|
||||
|
const handleCancel = () => { |
||||
|
props.onCancel(); |
||||
|
}; |
||||
|
|
||||
|
const fetchConfig = async (appCode: string) => { |
||||
|
const data = await getUMengConfig({ appCode }); |
||||
|
|
||||
|
form.setFieldsValue(data.data); |
||||
|
}; |
||||
|
|
||||
|
useEffect(() => { |
||||
|
fetchConfig(props.appCode); |
||||
|
}, [props.appCode]); |
||||
|
|
||||
|
const handleSaveApp = async (values: API.UmengConfigBo) => { |
||||
|
try { |
||||
|
await saveUMengConfig({ appCode: props.appCode }, values); |
||||
|
} catch (e) { |
||||
|
return; |
||||
|
} |
||||
|
props.onSubmit(); |
||||
|
}; |
||||
|
|
||||
|
return ( |
||||
|
<Modal title="编辑" visible={props.updateModalOpen} onOk={handleOk} onCancel={handleCancel}> |
||||
|
<Form labelCol={{ span: 8 }} wrapperCol={{ span: 16 }} form={form} onFinish={handleSaveApp}> |
||||
|
<Form.Item name="umengAppKeyAli" label="AppKey(阿里云)"> |
||||
|
<Input /> |
||||
|
</Form.Item> |
||||
|
<Form.Item name="umengAppSecret" label="AppSecret(阿里云)"> |
||||
|
<Input /> |
||||
|
</Form.Item> |
||||
|
<Form.Item name="umengAppCode" label="AppCode(阿里云)"> |
||||
|
<Input /> |
||||
|
</Form.Item> |
||||
|
<Form.Item name="umengAppKey" label="AppKey(友盟)"> |
||||
|
<Input /> |
||||
|
</Form.Item> |
||||
|
</Form> |
||||
|
</Modal> |
||||
|
); |
||||
|
}; |
||||
|
|
||||
|
export default UMengConfigForm; |
@ -0,0 +1,57 @@ |
|||||
|
import { saveWxConfig } from '@/services/matrix/matrixAppConfigController'; |
||||
|
import { Form, Input, Modal } from 'antd'; |
||||
|
import React, { useEffect } from 'react'; |
||||
|
import { getWxConfig } from '../../services/matrix/matrixAppConfigController'; |
||||
|
|
||||
|
export type WxConfigFormProps = { |
||||
|
onCancel: () => void; |
||||
|
onSubmit: () => void; |
||||
|
updateModalOpen: boolean; |
||||
|
appCode: string; |
||||
|
}; |
||||
|
|
||||
|
const WxConfigForm: React.FC<WxConfigFormProps> = (props) => { |
||||
|
const [form] = Form.useForm(); |
||||
|
|
||||
|
const handleOk = () => { |
||||
|
form.submit(); |
||||
|
}; |
||||
|
|
||||
|
const handleCancel = () => { |
||||
|
props.onCancel(); |
||||
|
}; |
||||
|
|
||||
|
const fetchConfig = async (appCode: string) => { |
||||
|
const data = await getWxConfig({ appCode }); |
||||
|
|
||||
|
form.setFieldsValue(data.data); |
||||
|
}; |
||||
|
|
||||
|
useEffect(() => { |
||||
|
fetchConfig(props.appCode); |
||||
|
}, [props.appCode]); |
||||
|
|
||||
|
const handleSaveApp = async (values: API.WxConfig) => { |
||||
|
try { |
||||
|
await saveWxConfig({ appCode: props.appCode }, values); |
||||
|
} catch (e) { |
||||
|
return; |
||||
|
} |
||||
|
props.onSubmit(); |
||||
|
}; |
||||
|
|
||||
|
return ( |
||||
|
<Modal title="编辑" visible={props.updateModalOpen} onOk={handleOk} onCancel={handleCancel}> |
||||
|
<Form labelCol={{ span: 4 }} wrapperCol={{ span: 18 }} form={form} onFinish={handleSaveApp}> |
||||
|
<Form.Item name="appId" label="AppId"> |
||||
|
<Input /> |
||||
|
</Form.Item> |
||||
|
<Form.Item name="appSecret" label="AppSecret"> |
||||
|
<Input /> |
||||
|
</Form.Item> |
||||
|
</Form> |
||||
|
</Modal> |
||||
|
); |
||||
|
}; |
||||
|
|
||||
|
export default WxConfigForm; |
@ -0,0 +1,170 @@ |
|||||
|
// @ts-ignore
|
||||
|
/* eslint-disable */ |
||||
|
import { request } from '@umijs/max'; |
||||
|
|
||||
|
/** 此处后端没有提供注释 GET /api/matrix/app/aliPayConfig */ |
||||
|
export async function getAliPayConfig( |
||||
|
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
|
params: API.getAliPayConfigParams, |
||||
|
options?: { [key: string]: any }, |
||||
|
) { |
||||
|
return request<API.RAliPayConfigBo>('/api/matrix/app/aliPayConfig', { |
||||
|
method: 'GET', |
||||
|
params: { |
||||
|
...params, |
||||
|
}, |
||||
|
...(options || {}), |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
/** 此处后端没有提供注释 POST /api/matrix/app/aliPayConfig */ |
||||
|
export async function saveAliPayConfig( |
||||
|
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
|
params: API.saveAliPayConfigParams, |
||||
|
body: API.AliPayConfigBo, |
||||
|
options?: { [key: string]: any }, |
||||
|
) { |
||||
|
return request<API.RVoid>('/api/matrix/app/aliPayConfig', { |
||||
|
method: 'POST', |
||||
|
headers: { |
||||
|
'Content-Type': 'application/json', |
||||
|
}, |
||||
|
params: { |
||||
|
...params, |
||||
|
}, |
||||
|
data: body, |
||||
|
...(options || {}), |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
/** 此处后端没有提供注释 GET /api/matrix/app/basicConfig */ |
||||
|
export async function getBasicConfig( |
||||
|
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
|
params: API.getBasicConfigParams, |
||||
|
options?: { [key: string]: any }, |
||||
|
) { |
||||
|
return request<API.RAppBasicConfig>('/api/matrix/app/basicConfig', { |
||||
|
method: 'GET', |
||||
|
params: { |
||||
|
...params, |
||||
|
}, |
||||
|
...(options || {}), |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
/** 此处后端没有提供注释 POST /api/matrix/app/basicConfig */ |
||||
|
export async function saveBasicConfig(body: API.AppBasicConfig, options?: { [key: string]: any }) { |
||||
|
return request<API.RVoid>('/api/matrix/app/basicConfig', { |
||||
|
method: 'POST', |
||||
|
headers: { |
||||
|
'Content-Type': 'application/json', |
||||
|
}, |
||||
|
data: body, |
||||
|
...(options || {}), |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
/** 此处后端没有提供注释 GET /api/matrix/app/normalConfig */ |
||||
|
export async function getAppNormalConfig( |
||||
|
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
|
params: API.getAppNormalConfigParams, |
||||
|
options?: { [key: string]: any }, |
||||
|
) { |
||||
|
return request<API.RAppNormalConfig>('/api/matrix/app/normalConfig', { |
||||
|
method: 'GET', |
||||
|
params: { |
||||
|
...params, |
||||
|
}, |
||||
|
...(options || {}), |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
/** 此处后端没有提供注释 POST /api/matrix/app/normalConfig */ |
||||
|
export async function saveNormalConfig( |
||||
|
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
|
params: API.saveNormalConfigParams, |
||||
|
body: API.AppNormalConfig, |
||||
|
options?: { [key: string]: any }, |
||||
|
) { |
||||
|
return request<API.RVoid>('/api/matrix/app/normalConfig', { |
||||
|
method: 'POST', |
||||
|
headers: { |
||||
|
'Content-Type': 'application/json', |
||||
|
}, |
||||
|
params: { |
||||
|
...params, |
||||
|
}, |
||||
|
data: body, |
||||
|
...(options || {}), |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
/** 此处后端没有提供注释 GET /api/matrix/app/uMengConfig */ |
||||
|
export async function getUMengConfig( |
||||
|
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
|
params: API.getUMengConfigParams, |
||||
|
options?: { [key: string]: any }, |
||||
|
) { |
||||
|
return request<API.RUmengConfigBo>('/api/matrix/app/uMengConfig', { |
||||
|
method: 'GET', |
||||
|
params: { |
||||
|
...params, |
||||
|
}, |
||||
|
...(options || {}), |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
/** 此处后端没有提供注释 POST /api/matrix/app/uMengConfig */ |
||||
|
export async function saveUMengConfig( |
||||
|
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
|
params: API.saveUMengConfigParams, |
||||
|
body: API.UmengConfigBo, |
||||
|
options?: { [key: string]: any }, |
||||
|
) { |
||||
|
return request<API.RVoid>('/api/matrix/app/uMengConfig', { |
||||
|
method: 'POST', |
||||
|
headers: { |
||||
|
'Content-Type': 'application/json', |
||||
|
}, |
||||
|
params: { |
||||
|
...params, |
||||
|
}, |
||||
|
data: body, |
||||
|
...(options || {}), |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
/** 此处后端没有提供注释 GET /api/matrix/app/wxConfig */ |
||||
|
export async function getWxConfig( |
||||
|
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
|
params: API.getWxConfigParams, |
||||
|
options?: { [key: string]: any }, |
||||
|
) { |
||||
|
return request<API.RWxConfig>('/api/matrix/app/wxConfig', { |
||||
|
method: 'GET', |
||||
|
params: { |
||||
|
...params, |
||||
|
}, |
||||
|
...(options || {}), |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
/** 此处后端没有提供注释 POST /api/matrix/app/wxConfig */ |
||||
|
export async function saveWxConfig( |
||||
|
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
|
params: API.saveWxConfigParams, |
||||
|
body: API.WxConfig, |
||||
|
options?: { [key: string]: any }, |
||||
|
) { |
||||
|
return request<API.RVoid>('/api/matrix/app/wxConfig', { |
||||
|
method: 'POST', |
||||
|
headers: { |
||||
|
'Content-Type': 'application/json', |
||||
|
}, |
||||
|
params: { |
||||
|
...params, |
||||
|
}, |
||||
|
data: body, |
||||
|
...(options || {}), |
||||
|
}); |
||||
|
} |
@ -1,38 +0,0 @@ |
|||||
// @ts-ignore
|
|
||||
/* eslint-disable */ |
|
||||
import { request } from '@umijs/max'; |
|
||||
|
|
||||
/** 此处后端没有提供注释 GET /api/matrix/app/normalConfig */ |
|
||||
export async function getAppNormalConfig( |
|
||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
|
||||
params: API.getAppNormalConfigParams, |
|
||||
options?: { [key: string]: any }, |
|
||||
) { |
|
||||
return request<API.RAppNormalConfig>('/api/matrix/app/normalConfig', { |
|
||||
method: 'GET', |
|
||||
params: { |
|
||||
...params, |
|
||||
}, |
|
||||
...(options || {}), |
|
||||
}); |
|
||||
} |
|
||||
|
|
||||
/** 此处后端没有提供注释 POST /api/matrix/app/normalConfig */ |
|
||||
export async function saveNormalConfig( |
|
||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
|
||||
params: API.saveNormalConfigParams, |
|
||||
body: API.AppNormalConfig, |
|
||||
options?: { [key: string]: any }, |
|
||||
) { |
|
||||
return request<API.RVoid>('/api/matrix/app/normalConfig', { |
|
||||
method: 'POST', |
|
||||
headers: { |
|
||||
'Content-Type': 'application/json', |
|
||||
}, |
|
||||
params: { |
|
||||
...params, |
|
||||
}, |
|
||||
data: body, |
|
||||
...(options || {}), |
|
||||
}); |
|
||||
} |
|
Loading…
Reference in new issue