import React from 'react'; import { Tabs, Row, Col, Card, Divider, Input, Form, Space } from 'antd'; import Styles from './web.module.less'; function TencentAccount(props) { const { accounts, setValue, removeItem, addItem } = props; return ( 腾讯云配置 0)} onEdit={(targetKey, action) => { if (action === 'add') { addItem('', accounts.length); } else { removeItem('', parseInt(targetKey, 10)); } }} items={accounts.length > 0 ? accounts.map((ele, idx) => ({ key: `${idx}`, label: `帐号${idx + 1}`, children: (
<> setValue(`${idx}.secretId`, e.target.value)}/> <> setValue(`${idx}.secretKey`, e.target.value)}/> <> setValue(`${idx}.region`, e.target.value)}/> <> setValue(`${idx}.endpoint`, e.target.value)}/> <> setValue(`${idx}.smsEndpoint`, e.target.value)}/>
), })) : [ { label: '新建帐号', key: '0', children: (
<> setValue(`0.secretId`, e.target.value)}/> <> setValue(`0.secretKey`, e.target.value)}/> <> setValue(`0.region`, e.target.value)}/> <> setValue(`0.smsEndpoint`, e.target.value)}/>
), }, ]}>
); } function QiniuAccount(props) { const { accounts, setValue, removeItem, addItem } = props; return ( 七牛云配置 0)} onEdit={(targetKey, action) => { if (action === 'add') { addItem('', accounts.length); } else { removeItem('', parseInt(targetKey, 10)); } }} items={accounts.length > 0 ? accounts.map((ele, idx) => ({ key: `${idx}`, label: `帐号${idx + 1}`, children: (
<> setValue(`${idx}.accessKey`, e.target.value)}/> <> setValue(`${idx}.secretKey`, e.target.value)}/>
), })) : [ { label: '新建帐号', key: '0', children: (
<> setValue(`0.accessKey`, e.target.value)}/> <> setValue(`0.secretKey`, e.target.value)}/>
), }, ]}>
); } function CTYunAccount(props) { const { accounts, setValue, removeItem, addItem } = props; return ( 天翼云配置 0)} onEdit={(targetKey, action) => { if (action === 'add') { addItem('', accounts.length); } else { removeItem('', parseInt(targetKey, 10)); } }} items={accounts.length > 0 ? accounts.map((ele, idx) => ({ key: `${idx}`, label: `帐号${idx + 1}`, children: (
<> setValue(`${idx}.accessKey`, e.target.value)}/> <> setValue(`${idx}.securityKey`, e.target.value)}/>
), })) : [ { label: '新建帐号', key: '0', children: (
<> setValue(`0.accessKey`, e.target.value)}/> <> setValue(`0.securityKey`, e.target.value)}/>
), }, ]}>
); } function AliAccount(props) { const { accounts, setValue, removeItem, addItem } = props; return ( 阿里云配置 0)} onEdit={(targetKey, action) => { if (action === 'add') { addItem('', accounts.length); } else { removeItem('', parseInt(targetKey, 10)); } }} items={accounts.length > 0 ? accounts.map((ele, idx) => ({ key: `${idx}`, label: `帐号${idx + 1}`, children: (
<> setValue(`${idx}.accessKeyId`, e.target.value)}/> <> setValue(`${idx}.accessKeySecret`, e.target.value)}/> <> setValue(`${idx}.regionId`, e.target.value)}/> <> setValue(`${idx}.endpoint`, e.target.value)}/> <> setValue(`${idx}.apiVersion`, e.target.value)}/> <> setValue(`${idx}.smsEndpoint`, e.target.value)}/>
), })) : [ { label: '新建帐号', key: '0', children: (
<> setValue(`0.accessKeyId`, e.target.value)}/> <> setValue(`0.accessKeySecret`, e.target.value)}/> <> setValue(`0.regionId`, e.target.value)}/> <> setValue(`0.endpoint`, e.target.value)}/> <> setValue(`0.apiVersion`, e.target.value)}/> <> setValue(`0.smsEndpoint`, e.target.value)}/>
), }, ]}>
); } function AmapAccount(props) { const { accounts, setValue, removeItem, addItem } = props; return ( 高德云配置 0)} onEdit={(targetKey, action) => { if (action === 'add') { addItem('', accounts.length); } else { removeItem('', parseInt(targetKey, 10)); } }} items={accounts.length > 0 ? accounts.map((ele, idx) => ({ key: `${idx}`, label: `帐号${idx + 1}`, children: (
<> setValue(`${idx}.webApiKey`, e.target.value)}/>
), })) : [ { label: '新建帐号', key: '0', children: (
<> setValue(`0.webApiKey`, e.target.value)}/>
), }, ]}>
); } export default function Account(props) { const { account, setValue, removeItem } = props; const { tencent, qiniu, ali, amap, ctyun } = account; return ( 每种云厂商均可配置多个帐号,相应的服务所使用的帐号请准确对应 setValue(`tencent.${path}`, value)} removeItem={(path, index) => removeItem(`tencent`, index)} addItem={(path, index) => setValue(`tencent.${index}`, {})}/> setValue(`qiniu.${path}`, value)} removeItem={(path, index) => removeItem(`qiniu`, index)} addItem={(path, index) => setValue(`qiniu.${index}`, {})}/> setValue(`ctyun.${path}`, value)} removeItem={(path, index) => removeItem(`ctyun`, index)} addItem={(path, index) => setValue(`ctyun.${index}`, {})}/> setValue(`ali.${path}`, value)} removeItem={(path, index) => removeItem(`ali`, index)} addItem={(path, index) => setValue(`ali.${index}`, {})}/> setValue(`amap.${path}`, value)} removeItem={(path, index) => removeItem(`amap`, index)} addItem={(path, index) => setValue(`amap.${index}`, {})}/> ); }