Config配置项调整

This commit is contained in:
Wang Kejun 2023-01-18 13:44:21 +08:00
parent 28f65840b8
commit 0789cee0f2
6 changed files with 237 additions and 14 deletions

View File

@ -23,6 +23,10 @@ function TencentAccount(props) {
return setValue("".concat(idx, ".secretKey"), e.target.value);
} }) }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "region", name: "region" }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { placeholder: "\u8BF7\u8F93\u5165region", type: "text", value: ele.region, onChange: function (e) {
return setValue("".concat(idx, ".region"), e.target.value);
} }) }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "endpoint", name: "endpoint", tooltip: "\u8BBF\u95EE\u7684\u57DF\u540D\uFF0C\u5982\uFF1Atencentcloudapi.com" }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { placeholder: "\u8BF7\u8F93\u5165endpoint", type: "text", value: ele.endpoint, onChange: function (e) {
return setValue("".concat(idx, ".endpoint"), e.target.value);
} }) }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "\u77ED\u4FE1endpoint", name: "smsEndpoint", tooltip: "\u8BBF\u95EE\u7684\u57DF\u540D\uFF0C\u5982\uFF1Asms.tencentcloudapi.com" }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { placeholder: "\u8BF7\u8F93\u5165endpoint", type: "text", value: ele.smsEndpoint, onChange: function (e) {
return setValue("".concat(idx, ".smsEndpoint"), e.target.value);
} }) }) }))] }))),
}); })
: [
@ -33,8 +37,10 @@ function TencentAccount(props) {
return setValue("0.secretId", e.target.value);
} }) }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "secretKey", name: "secretKey" }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { placeholder: "\u8BF7\u8F93\u5165secretKey", type: "text", value: "", onChange: function (e) {
return setValue("0.secretKey", e.target.value);
} }) }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "region", name: "region" }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { placeholder: "\u8BF7\u8F93\u5165region", type: "text", value: "", onChange: function (e) {
} }) }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "region", name: "region", tooltip: "\u5730\u57DF, \u534E\u5317\u5730\u533A(\u5317\u4EAC): ap-beijing\u3001 \u534E\u5357\u5730\u533A(\u5E7F\u5DDE): ap-guangzhou\u3001\u534E\u4E1C\u5730\u533A(\u5357\u4EAC): ap-nanjing" }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { placeholder: "\u8BF7\u8F93\u5165region", type: "text", value: "", onChange: function (e) {
return setValue("0.region", e.target.value);
} }) }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "\u77ED\u4FE1endpoint", name: "smsEndpoint", tooltip: "\u8BBF\u95EE\u7684\u57DF\u540D\uFF0C\u5982\uFF1Asms.tencentcloudapi.com" }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { placeholder: "\u8BF7\u8F93\u5165endpoint", type: "text", value: "", onChange: function (e) {
return setValue("0.smsEndpoint", e.target.value);
} }) }) }))] }))),
},
] })] })));
@ -89,6 +95,12 @@ function AliAccount(props) {
return setValue("".concat(idx, ".accessKeySecret"), e.target.value);
} }) }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "regionId", name: "regionId" }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { placeholder: "\u8BF7\u8F93\u5165regionId", type: "text", value: ele.regionId, onChange: function (e) {
return setValue("".concat(idx, ".regionId"), e.target.value);
} }) }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "endpoint", name: "endpoint", tooltip: "\u8BBF\u95EE\u7684\u57DF\u540D\uFF0C\u5982\uFF1Adysmsapi.aliyuncs.com" }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { placeholder: "\u8BF7\u8F93\u5165endpoint", type: "text", value: ele.endpoint, onChange: function (e) {
return setValue("".concat(idx, ".endpoint"), e.target.value);
} }) }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "apiVersion", name: "apiVersion" }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { placeholder: "\u8BF7\u8F93\u5165apiVersion", type: "text", value: ele.apiVersion, onChange: function (e) {
return setValue("".concat(idx, ".apiVersion"), e.target.value);
} }) }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "\u77ED\u4FE1endpoint", name: "smsEndpoint", tooltip: "\u8BBF\u95EE\u7684\u57DF\u540D\uFF0C\u5982\uFF1Adysmsapi.aliyuncs.com" }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { placeholder: "\u8BF7\u8F93\u5165endpoint", type: "text", value: ele.smsEndpoint, onChange: function (e) {
return setValue("".concat(idx, ".smsEndpoint"), e.target.value);
} }) }) }))] }))),
}); })
: [
@ -101,6 +113,12 @@ function AliAccount(props) {
return setValue("0.accessKeySecret", e.target.value);
} }) }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "regionId", name: "regionId" }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { placeholder: "\u8BF7\u8F93\u5165regionId", type: "text", value: "", onChange: function (e) {
return setValue("0.regionId", e.target.value);
} }) }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "endpoint", name: "endpoint", tooltip: "\u8BBF\u95EE\u7684\u57DF\u540D\uFF0C\u5982\uFF1Adysmsapi.aliyuncs.com" }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { placeholder: "\u8BF7\u8F93\u5165endpoint", type: "text", value: "", onChange: function (e) {
return setValue("0.endpoint", e.target.value);
} }) }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "apiVersion", name: "apiVersion" }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { placeholder: "\u8BF7\u8F93\u5165apiVersion", type: "text", value: "", onChange: function (e) {
return setValue("0.apiVersion", e.target.value);
} }) }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "\u77ED\u4FE1endpoint", name: "smsEndpoint", tooltip: "\u8BBF\u95EE\u7684\u57DF\u540D\uFF0C\u5982\uFF1Adysmsapi.aliyuncs.com" }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { placeholder: "\u8BF7\u8F93\u5165endpoint", type: "text", value: "", onChange: function (e) {
return setValue("0.smsEndpoint", e.target.value);
} }) }) }))] }))),
},
] })] })));

View File

@ -104,6 +104,8 @@ function Tencent(props) {
label: "\u77ED\u4FE1".concat(idx + 1),
children: ((0, jsx_runtime_1.jsxs)(antd_1.Form, tslib_1.__assign({ colon: false, labelAlign: "left", layout: "vertical", style: { marginTop: 10 } }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "secretId", name: "secretId" }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { placeholder: "\u8BF7\u8F93\u5165secretId", type: "text", value: ele.secretId, onChange: function (e) {
return setValue("".concat(idx, ".secretId"), e.target.value);
} }) }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "smsSdkAppId", name: "smsSdkAppId" }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { placeholder: "\u8BF7\u8F93\u5165smsSdkAppId", type: "text", value: ele.smsSdkAppId, onChange: function (e) {
return setValue("".concat(idx, ".smsSdkAppId"), e.target.value);
} }) }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "defaultSignName", name: "defaultSignName" }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { placeholder: "\u8BF7\u8F93\u5165defaultSignName", type: "text", value: ele.defaultSignName, onChange: function (e) {
return setValue("".concat(idx, ".defaultSignName"), e.target.value);
} }) }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "templates", name: "templates" }, { children: (0, jsx_runtime_1.jsx)(antd_1.Tabs, { tabPosition: 'top', size: 'middle', type: "editable-card",
@ -165,6 +167,6 @@ function Tencent(props) {
function Sms(props) {
var sms = props.sms, setValue = props.setValue, removeItem = props.removeItem, cleanKey = props.cleanKey;
var ali = sms.ali, tencent = sms.tencent;
return ((0, jsx_runtime_1.jsxs)(antd_1.Space, tslib_1.__assign({ direction: "vertical", size: "middle", style: { display: 'flex' } }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Row, { children: (0, jsx_runtime_1.jsx)(antd_1.Card, tslib_1.__assign({ className: web_module_less_1.default.tips }, { children: "\u6BCF\u79CD\u5747\u53EF\u914D\u7F6E\u4E00\u4E2A\uFF0C\u76F8\u5E94\u7684\u670D\u52A1\u6240\u4F7F\u7528\u7684\u5E10\u53F7\u8BF7\u51C6\u786E\u5BF9\u5E94" })) }), (0, jsx_runtime_1.jsx)(Ali, { sms: ali || [], setValue: function (path, value) { return setValue("ali.".concat(path), value); }, removeItem: function (path, index) { return removeItem("ali", index); }, addItem: function (path, index) { return setValue("ali.".concat(index), {}); }, cleanKey: function (path, key) { return cleanKey("ali.".concat(path), key); } }), (0, jsx_runtime_1.jsx)(Tencent, { sms: tencent || [], setValue: function (path, value) { return setValue("tencent.".concat(path), value); }, removeItem: function (path, index) { return removeItem("tencent", index); }, addItem: function (path, index) { return setValue("tencent.".concat(index), {}); }, cleanKey: function (path, key) { return cleanKey("tencent.".concat(path), key); } })] })));
return ((0, jsx_runtime_1.jsxs)(antd_1.Space, tslib_1.__assign({ direction: "vertical", size: "middle", style: { display: 'flex' } }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Row, { children: (0, jsx_runtime_1.jsx)(antd_1.Card, tslib_1.__assign({ className: web_module_less_1.default.tips }, { children: "\u6BCF\u79CD\u5747\u53EF\u914D\u7F6E\u4E00\u4E2A\uFF0C\u76F8\u5E94\u7684\u670D\u52A1\u6240\u4F7F\u7528\u7684\u5E10\u53F7\u8BF7\u51C6\u786E\u5BF9\u5E94" })) }), (0, jsx_runtime_1.jsx)(Tencent, { sms: tencent || [], setValue: function (path, value) { return setValue("tencent.".concat(path), value); }, removeItem: function (path, index) { return removeItem("tencent", index); }, addItem: function (path, index) { return setValue("tencent.".concat(index), {}); }, cleanKey: function (path, key) { return cleanKey("tencent.".concat(path), key); } }), (0, jsx_runtime_1.jsx)(Ali, { sms: ali || [], setValue: function (path, value) { return setValue("ali.".concat(path), value); }, removeItem: function (path, index) { return removeItem("ali", index); }, addItem: function (path, index) { return setValue("ali.".concat(index), {}); }, cleanKey: function (path, key) { return cleanKey("ali.".concat(path), key); } })] })));
}
exports.default = Sms;

View File

@ -26,11 +26,16 @@ export declare type AliCloudConfig = {
accessKeyId: string;
accessKeySecret: string;
regionId: string;
apiVersion: string;
endpoint: string;
smsEndpoint: string;
};
export declare type TencentCloudConfig = {
secretId: string;
secretKey: string;
region: string;
endpoint: string;
smsEndpoint: string;
};
export declare type AmapCloudConfig = {
webApiKey: string;
@ -45,6 +50,7 @@ export declare type AliSmsConfig = {
};
export declare type TencentSmsConfig = {
secretId: string;
smsSdkAppId: string;
defaultSignName: string;
templates: Record<string, {
signName?: string;

View File

@ -97,6 +97,44 @@ function TencentAccount(props: {
/>
</>
</Form.Item>
<Form.Item
label="endpoint"
name="endpoint"
tooltip="访问的域名tencentcloudapi.com"
>
<>
<Input
placeholder="请输入endpoint"
type="text"
value={ele.endpoint}
onChange={(e) =>
setValue(
`${idx}.endpoint`,
e.target.value
)
}
/>
</>
</Form.Item>
<Form.Item
label="短信endpoint"
name="smsEndpoint"
tooltip="访问的域名sms.tencentcloudapi.com"
>
<>
<Input
placeholder="请输入endpoint"
type="text"
value={ele.smsEndpoint}
onChange={(e) =>
setValue(
`${idx}.smsEndpoint`,
e.target.value
)
}
/>
</>
</Form.Item>
</Form>
),
}))
@ -150,6 +188,7 @@ function TencentAccount(props: {
<Form.Item
label="region"
name="region"
tooltip="地域, 华北地区(北京): ap-beijing、 华南地区(广州): ap-guangzhou、华东地区(南京): ap-nanjing"
>
<>
<Input
@ -165,6 +204,25 @@ function TencentAccount(props: {
/>
</>
</Form.Item>
<Form.Item
label="短信endpoint"
name="smsEndpoint"
tooltip="访问的域名sms.tencentcloudapi.com"
>
<>
<Input
placeholder="请输入endpoint"
type="text"
value=""
onChange={(e) =>
setValue(
`0.smsEndpoint`,
e.target.value
)
}
/>
</>
</Form.Item>
</Form>
),
},
@ -397,6 +455,62 @@ function AliAccount(props: {
/>
</>
</Form.Item>
<Form.Item
label="endpoint"
name="endpoint"
tooltip="访问的域名dysmsapi.aliyuncs.com"
>
<>
<Input
placeholder="请输入endpoint"
type="text"
value={ele.endpoint}
onChange={(e) =>
setValue(
`${idx}.endpoint`,
e.target.value
)
}
/>
</>
</Form.Item>
<Form.Item
label="apiVersion"
name="apiVersion"
>
<>
<Input
placeholder="请输入apiVersion"
type="text"
value={ele.apiVersion}
onChange={(e) =>
setValue(
`${idx}.apiVersion`,
e.target.value
)
}
/>
</>
</Form.Item>
<Form.Item
label="短信endpoint"
name="smsEndpoint"
tooltip="访问的域名dysmsapi.aliyuncs.com"
>
<>
<Input
placeholder="请输入endpoint"
type="text"
value={ele.smsEndpoint}
onChange={(e) =>
setValue(
`${idx}.smsEndpoint`,
e.target.value
)
}
/>
</>
</Form.Item>
</Form>
),
}))
@ -465,6 +579,62 @@ function AliAccount(props: {
/>
</>
</Form.Item>
<Form.Item
label="endpoint"
name="endpoint"
tooltip="访问的域名dysmsapi.aliyuncs.com"
>
<>
<Input
placeholder="请输入endpoint"
type="text"
value=""
onChange={(e) =>
setValue(
`0.endpoint`,
e.target.value
)
}
/>
</>
</Form.Item>
<Form.Item
label="apiVersion"
name="apiVersion"
>
<>
<Input
placeholder="请输入apiVersion"
type="text"
value=""
onChange={(e) =>
setValue(
`0.apiVersion`,
e.target.value
)
}
/>
</>
</Form.Item>
<Form.Item
label="短信endpoint"
name="smsEndpoint"
tooltip="访问的域名dysmsapi.aliyuncs.com"
>
<>
<Input
placeholder="请输入endpoint"
type="text"
value=""
onChange={(e) =>
setValue(
`0.smsEndpoint`,
e.target.value
)
}
/>
</>
</Form.Item>
</Form>
),
},

View File

@ -323,6 +323,24 @@ function Tencent(props: {
/>
</>
</Form.Item>
<Form.Item
label="smsSdkAppId"
name="smsSdkAppId"
>
<>
<Input
placeholder="请输入smsSdkAppId"
type="text"
value={ele.smsSdkAppId}
onChange={(e) =>
setValue(
`${idx}.smsSdkAppId`,
e.target.value
)
}
/>
</>
</Form.Item>
<Form.Item
label="defaultSignName"
name="defaultSignName"
@ -526,13 +544,6 @@ export default function Sms(props: {
使
</Card>
</Row>
<Ali
sms={ali || []}
setValue={(path, value) => setValue(`ali.${path}`, value)}
removeItem={(path, index) => removeItem(`ali`, index)}
addItem={(path, index) => setValue(`ali.${index}`, {})}
cleanKey={(path, key) => cleanKey(`ali.${path}`, key)}
/>
<Tencent
sms={tencent || []}
setValue={(path, value) => setValue(`tencent.${path}`, value)}
@ -540,6 +551,13 @@ export default function Sms(props: {
addItem={(path, index) => setValue(`tencent.${index}`, {})}
cleanKey={(path, key) => cleanKey(`tencent.${path}`, key)}
/>
<Ali
sms={ali || []}
setValue={(path, value) => setValue(`ali.${path}`, value)}
removeItem={(path, index) => removeItem(`ali`, index)}
addItem={(path, index) => setValue(`ali.${index}`, {})}
cleanKey={(path, key) => cleanKey(`ali.${path}`, key)}
/>
</Space>
);
}

View File

@ -31,12 +31,17 @@ export type AliCloudConfig = {
accessKeyId: string;
accessKeySecret: string;
regionId: string;
apiVersion: string;
endpoint: string;
smsEndpoint: string;
};
export type TencentCloudConfig = {
secretId: string;
secretKey: string;
region: string;
endpoint: string;
smsEndpoint: string;
};
export type AmapCloudConfig = {
@ -55,12 +60,16 @@ export type AliSmsConfig = {
export type TencentSmsConfig = {
secretId: string;
smsSdkAppId: string;
defaultSignName: string;
templates: Record<string, {
signName?: string;
code: string;
// templateParams改成function注入
}>;
templates: Record<
string,
{
signName?: string;
code: string;
// templateParams改成function注入
}
>;
};
export type QrCodeType = 'wechatMpDomainUrl' | 'wechatMpWxaCode' | 'wechatPublic' | 'wechatPublicForMp' | 'webForWechatPublic';