Files
wwjcloud-nest-v1/admin-vben/apps/web-antd/src/views/channel/weapp/config/data.ts

155 lines
3.6 KiB
TypeScript
Raw Normal View History

import type { VbenFormSchema } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';
export interface WeappConfigApi {
getWeappConfig: () => Promise<any>;
setWeappConfig: (data: any) => Promise<any>;
setWeappDomain: (data: any) => Promise<any>;
getWeappPrivacySetting: () => Promise<any>;
setWeappPrivacySetting: (data: any) => Promise<any>;
getIsTradeManaged: () => Promise<any>;
}
export interface DomainForm {
request_domain: string;
ws_request_domain: string;
upload_domain: string;
download_domain: string;
udp_domain: string;
tcp_domain: string;
}
export const basicFormSchema: VbenFormSchema[] = [
{
fieldName: 'weapp_name',
label: '小程序名称',
component: 'Input',
rules: 'required',
},
{
fieldName: 'weapp_original',
label: '小程序原始ID',
component: 'Input',
rules: 'required',
},
{
fieldName: 'app_id',
label: 'AppID',
component: 'Input',
rules: 'required',
},
{
fieldName: 'app_secret',
label: 'AppSecret',
component: 'InputPassword',
rules: 'required',
},
{
fieldName: 'qr_code',
label: '小程序码',
component: 'Input',
componentProps: {
placeholder: '请输入小程序码图片地址',
},
},
];
export const serverFormSchema: VbenFormSchema[] = [
{
fieldName: 'serve_url',
label: '服务器地址',
component: 'Input',
rules: 'required',
componentProps: {
placeholder: '请以http://或https://开头',
},
},
{
fieldName: 'token',
label: '令牌(Token)',
component: 'Input',
rules: 'required',
componentProps: {
placeholder: '必须为3-32字符',
},
},
{
fieldName: 'encoding_aes_key',
label: '消息加密密钥',
component: 'Input',
rules: 'required',
componentProps: {
placeholder: '43位字符',
},
},
{
fieldName: 'encryption_type',
label: '加密方式',
component: 'RadioGroup',
rules: 'required',
componentProps: {
options: [
{ label: '明文模式', value: 1 },
{ label: '兼容模式', value: 2 },
{ label: '安全模式(推荐)', value: 3 },
],
},
},
];
export const domainFormSchema: VbenFormSchema[] = [
{
fieldName: 'request_domain',
label: 'request合法域名',
component: 'Textarea',
componentProps: {
placeholder: '多个域名以;分隔https://api.example.com;https://api2.example.com',
rows: 3,
},
},
{
fieldName: 'ws_request_domain',
label: 'socket合法域名',
component: 'Textarea',
componentProps: {
placeholder: '多个域名以;分隔wss://ws.example.com;wss://ws2.example.com',
rows: 3,
},
},
{
fieldName: 'upload_domain',
label: 'uploadFile合法域名',
component: 'Textarea',
componentProps: {
placeholder: '多个域名以;分隔https://upload.example.com',
rows: 3,
},
},
{
fieldName: 'download_domain',
label: 'downloadFile合法域名',
component: 'Textarea',
componentProps: {
placeholder: '多个域名以;分隔https://download.example.com',
rows: 3,
},
},
{
fieldName: 'udp_domain',
label: 'udp合法域名',
component: 'Textarea',
componentProps: {
placeholder: '多个域名以;分隔udp://udp.example.com',
rows: 3,
},
},
{
fieldName: 'tcp_domain',
label: 'tcp合法域名',
component: 'Textarea',
componentProps: {
placeholder: '多个域名以;分隔tcp://tcp.example.com',
rows: 3,
},
},
];