Unverified Commit 5b80c761 authored by Zzm0809's avatar Zzm0809 Committed by GitHub

Support wechat custom url (#2680)

* Spotless Apply * support-wechat-custom-url * Spotless Apply --------- Co-authored-by: 's avatarZzm0809 <Zzm0809@users.noreply.github.com>
parent f1ef316e
......@@ -25,10 +25,9 @@ import org.dinky.alert.AlertBaseConstant;
public class WeChatConstants extends AlertBaseConstant {
public static final String TYPE = "WeChat";
/** WeChat alert baseconstant */
public static final String WECHAT_PUSH_URL = "https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=%s";
public static final String WECHAT_PUSH_URL = "%s/message/send?access_token=%s";
public static final String WECHAT_TOKEN_URL =
"https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=%s&corpsecret=%s";
public static final String WECHAT_TOKEN_URL = "%s/gettoken?corpid=%s&corpsecret=%s";
public static final String CORP_ID = "corpId";
public static final String TEAM_SEND_MSG = "teamSendMsg";
public static final String AGENT_ID = "agentId";
......
......@@ -65,8 +65,11 @@ public class WeChatSender {
if (wechatParams.getSendType().equals(WeChatType.CHAT.getValue())) {
requireNonNull(wechatParams.getWebhook(), WeChatConstants.WEB_HOOK + " must not null");
}
weChatTokenUrlReplace =
String.format(WeChatConstants.WECHAT_TOKEN_URL, wechatParams.getCorpId(), wechatParams.getSecret());
weChatTokenUrlReplace = String.format(
WeChatConstants.WECHAT_TOKEN_URL,
wechatParams.getSendUrl(),
wechatParams.getCorpId(),
wechatParams.getSecret());
}
/**
......@@ -99,7 +102,7 @@ public class WeChatSender {
if (WeChatType.APP.getValue().equals(wechatParams.getSendType())) {
String token = getToken();
assert token != null;
url = String.format(WeChatConstants.WECHAT_PUSH_URL, token);
url = String.format(WeChatConstants.WECHAT_PUSH_URL, wechatParams.getSendUrl(), token);
} else {
url = wechatParams.getWebhook();
}
......
......@@ -40,5 +40,6 @@ public class WechatParams {
private int agentId;
private List<String> atUsers = new ArrayList<>();
private String webhook;
private String sendUrl = "https://qyapi.weixin.qq.com/cgi-bin";
private String keyword;
}
......@@ -17,46 +17,51 @@
*
*/
import {TabsItemType, TaskDataType} from '@/pages/DataStudio/model';
import {Button} from 'antd';
import { TabsItemType, TaskDataType } from '@/pages/DataStudio/model';
import { Tab } from '@/pages/DataStudio/route';
import { Button } from 'antd';
import React from 'react';
import {Tab} from '@/pages/DataStudio/route';
export type CircleButtonProps = {
icon: React.ReactNode;
loading?: boolean;
onClick?: () => void;
title?: string;
key?: string;
icon: React.ReactNode;
loading?: boolean;
onClick?: () => void;
title?: string;
key?: string;
};
export type CircleBottomButtonProps = {
icon: React.ReactNode;
loading?: boolean;
onClick?: (tabs: Tab[], key: string, data: TaskDataType | undefined,refresh:any) => Promise<void>;
title?: string;
key?: string;
icon: React.ReactNode;
loading?: boolean;
onClick?: (
tabs: Tab[],
key: string,
data: TaskDataType | undefined,
refresh: any
) => Promise<void>;
title?: string;
key?: string;
};
export type CircleDataStudioButtonProps = {
icon: React.ReactNode;
loading?: boolean;
onClick?: (panes: TabsItemType[], activeKey: string) => void;
title?: string;
key?: string;
isShow?: boolean;
icon: React.ReactNode;
loading?: boolean;
onClick?: (panes: TabsItemType[], activeKey: string) => void;
title?: string;
key?: string;
isShow?: boolean;
};
export const CircleBtn: React.FC<CircleButtonProps> = (props) => {
const {onClick, title, icon, loading} = props;
const { onClick, title, icon, loading } = props;
return (
<Button
title={title}
loading={loading}
icon={icon}
block
type={'text'}
shape={'circle'}
onClick={onClick}
/>
);
return (
<Button
title={title}
loading={loading}
icon={icon}
block
type={'text'}
shape={'circle'}
onClick={onClick}
/>
);
};
......@@ -516,6 +516,11 @@ export default {
'rc.ai.actionPleaseHolder': 'Please enter the interface method',
'rc.ai.agentId': 'AgentId',
'rc.ai.agentIdPleaseHolder': 'Please enter AgentId',
'rc.ai.sendUrl': 'QiWei Send Addr',
'rc.ai.sendUrlPleaseHolder': 'Please enter the sending address or the proxy address',
'rc.ai.sendUrlValidate': 'Please enter the correct sending address, no / is required at the end',
'rc.ai.sendUrlTooltip':
'You can enter the proxy address for the sending address, such as: http://127.0.0.1:8080/cgi-bin, the default is: https://qyapi.weixin.qq.com/cgi-bin ',
'rc.ai.apikey': 'Account unique identifier',
'rc.ai.apikeyPleaseHolder': 'Please enter the unique ID of the account',
'rc.ai.appId': 'App ID',
......
......@@ -495,6 +495,11 @@ export default {
'rc.ai.actionPleaseHolder': '请输入接口方法',
'rc.ai.agentId': '代理ID',
'rc.ai.agentIdPleaseHolder': '请输入 AgentId',
'rc.ai.sendUrl': '企微发送地址',
'rc.ai.sendUrlPleaseHolder': '请输入发送地址可输入代理地址',
'rc.ai.sendUrlValidate': '请输入正确的发送地址,末尾不需要带 /',
'rc.ai.sendUrlTooltip':
'发送地址可输入代理地址,如:http://127.0.0.1:8080/cgi-bin ,默认为:https://qyapi.weixin.qq.com/cgi-bin',
'rc.ai.apikey': '账号唯一标识',
'rc.ai.apikeyPleaseHolder': '请输入账号唯一标识',
'rc.ai.appId': '应用 ID',
......
......@@ -17,79 +17,85 @@
*
*/
import {SseData} from '@/models/Sse';
import {TaskDataType} from '@/pages/DataStudio/model';
import {SSE_TOPIC} from '@/pages/DevOps/constants';
import {postAll} from '@/services/api';
import {l} from '@/utils/intl';
import {useModel} from '@@/exports';
import {Modal, Select} from 'antd';
import { SseData } from '@/models/Sse';
import { TaskDataType } from '@/pages/DataStudio/model';
import { SSE_TOPIC } from '@/pages/DevOps/constants';
import { postAll } from '@/services/api';
import { l } from '@/utils/intl';
import { useModel } from '@@/exports';
import { Modal, Select } from 'antd';
import TextArea from 'antd/es/input/TextArea';
import {Tab} from 'rc-tabs/lib/interface.d';
import * as React from 'react';
import {useEffect, useState} from 'react';
import { Tab } from 'rc-tabs/lib/interface.d';
import { useEffect, useState } from 'react';
export async function getPrintTables(statement: string) {
return postAll('api/printTable/getPrintTables', {statement});
return postAll('api/printTable/getPrintTables', { statement });
}
/*--- Clear Console ---*/
export type PrintTable = {
tableName: string;
fullTableName: string;
tableName: string;
fullTableName: string;
};
export const DataPage = (props: any) => {
const {style, title} = props;
const [consoleInfo, setConsoleInfo] = useState<string>('');
const {subscribeTopic} = useModel('Sse', (model: any) => ({
subscribeTopic: model.subscribeTopic
}));
const [tableName, setTableName] = useState<string>('');
const { style, title } = props;
const [consoleInfo, setConsoleInfo] = useState<string>('');
const { subscribeTopic } = useModel('Sse', (model: any) => ({
subscribeTopic: model.subscribeTopic
}));
const [tableName, setTableName] = useState<string>('');
useEffect(() => {
if (title) {
setTableName(title.tableName);
const topic = `${SSE_TOPIC.PRINT_TABLE}/${title.fullTableName}`;
return subscribeTopic([topic], (data: SseData) => {
setConsoleInfo((preConsoleInfo) => preConsoleInfo + '\n' + data.data);
});
}
}, []);
useEffect(() => {
if (title) {
setTableName(title.tableName);
const topic = `${SSE_TOPIC.PRINT_TABLE}/${title.fullTableName}`;
return subscribeTopic([topic], (data: SseData) => {
setConsoleInfo((preConsoleInfo) => preConsoleInfo + '\n' + data.data);
});
}
}, []);
return <TextArea value={consoleInfo} style={{width: style.width, height: style.height}}/>;
return <TextArea value={consoleInfo} style={{ width: style.width, height: style.height }} />;
};
export const onAdd = async (tabs: Tab[], key: string, data: TaskDataType | undefined, refresh: any) => {
const statement = data?.statement;
export const onAdd = async (
tabs: Tab[],
key: string,
data: TaskDataType | undefined,
refresh: any
) => {
const statement = data?.statement;
if (!statement) return;
const tabNames = tabs.map((tab) => tab.label);
const result = await getPrintTables(statement);
const tables: PrintTable[] = result.data.filter((table: PrintTable) => !tabNames.includes(table.tableName));
if (!statement) return;
const tabNames = tabs.map((tab) => tab.label);
const result = await getPrintTables(statement);
const tables: PrintTable[] = result.data.filter(
(table: PrintTable) => !tabNames.includes(table.tableName)
);
let selectTable: PrintTable;
Modal.confirm({
title: l('pages.datastudio.print.table.inputTableName'),
content: (
<Select
defaultValue=''
style={{width: '90%'}}
onChange={(e, t: any) => {
selectTable = {tableName: t.label, fullTableName: t.value};
}}
options={tables.map((table) => ({label: table.tableName, value: table.fullTableName}))}
/>
),
onOk() {
tabs.push({
key: key + "/" + selectTable.tableName,
label: selectTable.tableName,
children: <DataPage title={selectTable} style={{width: '100%', height: '100%'}}/>
});
refresh()
// onOk(selectTable);
},
zIndex: 1000
});
}
\ No newline at end of file
let selectTable: PrintTable;
Modal.confirm({
title: l('pages.datastudio.print.table.inputTableName'),
content: (
<Select
defaultValue=''
style={{ width: '90%' }}
onChange={(e, t: any) => {
selectTable = { tableName: t.label, fullTableName: t.value };
}}
options={tables.map((table) => ({ label: table.tableName, value: table.fullTableName }))}
/>
),
onOk() {
tabs.push({
key: key + '/' + selectTable.tableName,
label: selectTable.tableName,
children: <DataPage title={selectTable} style={{ width: '100%', height: '100%' }} />
});
refresh();
// onOk(selectTable);
},
zIndex: 1000
});
};
......@@ -17,110 +17,97 @@
*
*/
import {CircleDataStudioButtonProps} from "@/components/CallBackButton/CircleBtn";
import { CircleDataStudioButtonProps } from '@/components/CallBackButton/CircleBtn';
import { l } from '@/utils/intl';
import {
ArrowsAltOutlined,
EnvironmentOutlined,
PlusCircleOutlined,
PlusOutlined,
ReloadOutlined,
ShrinkOutlined
} from "@ant-design/icons";
import {l} from "@/utils/intl";
import React, {createContext, useContext, useReducer} from "react";
ArrowsAltOutlined,
EnvironmentOutlined,
PlusCircleOutlined,
PlusOutlined,
ReloadOutlined,
ShrinkOutlined
} from '@ant-design/icons';
import { createContext, useContext, useReducer } from 'react';
export const BtnRoute: { [c: string]: CircleDataStudioButtonProps[] } = {
'menu.datastudio.datasource': [
{
icon: <PlusOutlined/>,
title: l('button.create'),
onClick: () => {
}
},
{
icon: <ReloadOutlined/>,
title: l('button.refresh'),
onClick: () => {
}
}
],
'menu.datastudio.catalog': [
{
icon: <ReloadOutlined/>,
title: l('button.refresh'),
onClick: () => {
}
}
],
'menu.datastudio.project': [
{
icon: <PlusCircleOutlined/>,
title: l('right.menu.createRoot'),
key: 'right.menu.createRoot',
onClick: () => {
}
},
{
icon: <ArrowsAltOutlined/>,
title: l('button.expand-all'),
key: 'button.expand-all',
onClick: () => {
}
},
{
icon: <ShrinkOutlined/>,
title: l('button.collapse-all'),
key: 'button.collapse-all',
onClick: () => {
}
},
{
icon: <EnvironmentOutlined/>,
title: l('button.position'),
key: 'button.position',
onClick: () => {
}
}
]
'menu.datastudio.datasource': [
{
icon: <PlusOutlined />,
title: l('button.create'),
onClick: () => {}
},
{
icon: <ReloadOutlined />,
title: l('button.refresh'),
onClick: () => {}
}
],
'menu.datastudio.catalog': [
{
icon: <ReloadOutlined />,
title: l('button.refresh'),
onClick: () => {}
}
],
'menu.datastudio.project': [
{
icon: <PlusCircleOutlined />,
title: l('right.menu.createRoot'),
key: 'right.menu.createRoot',
onClick: () => {}
},
{
icon: <ArrowsAltOutlined />,
title: l('button.expand-all'),
key: 'button.expand-all',
onClick: () => {}
},
{
icon: <ShrinkOutlined />,
title: l('button.collapse-all'),
key: 'button.collapse-all',
onClick: () => {}
},
{
icon: <EnvironmentOutlined />,
title: l('button.position'),
key: 'button.position',
onClick: () => {}
}
]
};
type BtnAction = {
type: 'change',
selectKey: string,
payload: CircleDataStudioButtonProps[]
}
type: 'change';
selectKey: string;
payload: CircleDataStudioButtonProps[];
};
export const BtnContext = createContext(BtnRoute);
const BtnDispatchContext = createContext((params: BtnAction) => {
});
const BtnDispatchContext = createContext((params: BtnAction) => {});
export function useTasksDispatch() {
return useContext(BtnDispatchContext);
return useContext(BtnDispatchContext);
}
function BtnReducer(state = BtnRoute, action: BtnAction) {
switch (action.type) {
case 'change': {
return {...state, [action.selectKey]: action.payload}
}
default:
return {...state}
switch (action.type) {
case 'change': {
return { ...state, [action.selectKey]: action.payload };
}
default:
return { ...state };
}
}
// @ts-ignore
export function BtnProvider({children}) {
const [btn, dispatch] = useReducer(
BtnReducer,
BtnRoute
);
export function BtnProvider({ children }) {
const [btn, dispatch] = useReducer(BtnReducer, BtnRoute);
return (
<BtnContext.Provider value={btn}>
<BtnDispatchContext.Provider value={dispatch}>
{children}
</BtnDispatchContext.Provider>
</BtnContext.Provider>
);
}
\ No newline at end of file
return (
<BtnContext.Provider value={btn}>
<BtnDispatchContext.Provider value={dispatch}>{children}</BtnDispatchContext.Provider>
</BtnContext.Provider>
);
}
......@@ -19,6 +19,7 @@
import { getCurrentData } from '@/pages/DataStudio/function';
import { isSql } from '@/pages/DataStudio/HeaderContainer/service';
import { BtnRoute, useTasksDispatch } from '@/pages/DataStudio/LeftContainer/BtnContext';
import { TableDataNode } from '@/pages/DataStudio/LeftContainer/Catalog/data';
import { StateType } from '@/pages/DataStudio/model';
import ColumnInfo from '@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/ColumnInfo';
......@@ -38,9 +39,8 @@ import { Button, Col, Empty, Modal, Row, Select, Spin, Tabs } from 'antd';
import { DataNode } from 'antd/es/tree';
import DirectoryTree from 'antd/es/tree/DirectoryTree';
import { DefaultOptionType } from 'rc-select/lib/Select';
import React, {useEffect, useState} from 'react';
import React, { useEffect, useState } from 'react';
import { getMSCatalogs, getMSColumns, getMSSchemaInfo } from './service';
import {BtnRoute, useTasksDispatch} from "@/pages/DataStudio/LeftContainer/BtnContext";
const Catalog: React.FC = (props: connect) => {
const { tabs } = props;
......@@ -86,7 +86,7 @@ const Catalog: React.FC = (props: connect) => {
type: 'change',
selectKey: currentTabName,
payload: btnEvent
})
});
useEffect(() => {
getCatalogs();
......
......@@ -18,6 +18,7 @@
*/
import { TagAlignLeft } from '@/components/StyledComponents';
import { BtnRoute, useTasksDispatch } from '@/pages/DataStudio/LeftContainer/BtnContext';
import SchemaTree from '@/pages/RegCenter/DataSource/components/DataSourceDetail/SchemaTree';
import DataSourceModal from '@/pages/RegCenter/DataSource/components/DataSourceModal';
import { handleTest, saveOrUpdateHandle } from '@/pages/RegCenter/DataSource/service';
......@@ -30,7 +31,6 @@ import { Spin, Tag } from 'antd';
import { useEffect, useState } from 'react';
import { StateType, STUDIO_MODEL } from '../../model';
import { clearDataSourceTable, getDataSourceList, showDataSourceTable } from './service';
import {BtnRoute, useTasksDispatch} from "@/pages/DataStudio/LeftContainer/BtnContext";
const DataSource = (props: any) => {
const {
......@@ -106,7 +106,7 @@ const DataSource = (props: any) => {
type: 'change',
selectKey: currentTabName,
payload: btnEvent
})
});
/**
* 构建数据库列表 下拉框
......
......@@ -31,7 +31,7 @@ import { Key } from '@ant-design/pro-components';
import { Empty, Tree } from 'antd';
import Search from 'antd/es/input/Search';
import React, { useEffect, useState } from 'react';
import {BtnRoute, useTasksDispatch} from '../../BtnContext';
import { BtnRoute, useTasksDispatch } from '../../BtnContext';
const { DirectoryTree } = Tree;
......@@ -62,7 +62,6 @@ const JobTree: React.FC<TreeProps & connect> = (props) => {
const [data, setData] = useState<any[]>(buildProjectTree(projectData, searchValue));
const btnDispatch = useTasksDispatch();
useEffect(() => {
setData(buildProjectTree(projectData, searchValue));
}, [searchValue, projectData]);
......@@ -138,7 +137,7 @@ const JobTree: React.FC<TreeProps & connect> = (props) => {
type: 'change',
selectKey: currentTabName,
payload: btnEvent
})
});
return (
<>
......
......@@ -18,6 +18,7 @@
*/
import Title from '@/components/Front/Title';
import { BtnRoute, useTasksDispatch } from '@/pages/DataStudio/LeftContainer/BtnContext';
import FolderModal from '@/pages/DataStudio/LeftContainer/Project/FolderModal';
import { StateType, STUDIO_MODEL_ASYNC } from '@/pages/DataStudio/model';
import { handleAddOrUpdate } from '@/services/BusinessCrud';
......@@ -27,7 +28,6 @@ import { l } from '@/utils/intl';
import { connect } from '@umijs/max';
import { Space } from 'antd';
import React, { useState } from 'react';
import {BtnRoute, useTasksDispatch} from "@/pages/DataStudio/LeftContainer/BtnContext";
const ProjectTitle: React.FC<StateType & connect> = (props) => {
const {
......@@ -72,9 +72,9 @@ const ProjectTitle: React.FC<StateType & connect> = (props) => {
btn[0].onClick = () => handleCreateClick();
btnDispatch({
type: 'change',
selectKey:currentTabName,
selectKey: currentTabName,
payload: btn
})
});
/**
* 渲染侧边栏标题
......
......@@ -20,6 +20,7 @@
import RightContextMenu from '@/components/RightContextMenu';
import { LeftBottomKey } from '@/pages/DataStudio/data.d';
import { getTabByTaskId } from '@/pages/DataStudio/function';
import { useTasksDispatch } from '@/pages/DataStudio/LeftContainer/BtnContext';
import {
FOLDER_RIGHT_MENU,
JOB_RIGHT_MENU
......@@ -53,7 +54,6 @@ import { Modal, Typography } from 'antd';
import { MenuInfo } from 'rc-menu/es/interface';
import React, { Key, useEffect, useState } from 'react';
import { connect } from 'umi';
import {useTasksDispatch} from "@/pages/DataStudio/LeftContainer/BtnContext";
const { Text } = Typography;
......@@ -67,7 +67,6 @@ const Project: React.FC = (props: connect) => {
const [projectState, setProjectState] = useState<ProjectState>(InitProjectState);
const btnDispatch = useTasksDispatch();
useEffect(() => {
setProjectState((prevState) => ({
...prevState,
......
......@@ -20,13 +20,13 @@
import { CircleBtn, CircleDataStudioButtonProps } from '@/components/CallBackButton/CircleBtn';
import MovableSidebar, { MovableSidebarProps } from '@/components/Sidebar/MovableSidebar';
import useThemeValue from '@/hooks/useThemeValue';
import { BtnContext } from '@/pages/DataStudio/LeftContainer/BtnContext';
import ProjectTitle from '@/pages/DataStudio/LeftContainer/Project/ProjectTitle';
import { StateType, STUDIO_MODEL, VIEW } from '@/pages/DataStudio/model';
import { LeftSide } from '@/pages/DataStudio/route';
import { connect } from '@@/exports';
import { Tabs } from 'antd';
import React, {useContext} from 'react';
import {BtnContext} from "@/pages/DataStudio/LeftContainer/BtnContext";
import React, { useContext } from 'react';
export type LeftContainerProps = {
size: number;
......
......@@ -17,25 +17,29 @@
*
*/
import React from "react";
import {Tab} from "@/pages/DataStudio/route";
import {TaskDataType} from "@/pages/DataStudio/model";
import {LeftBottomKey} from "@/pages/DataStudio/data.d";
import {onAdd} from "@/pages/DataStudio/BottomContainer/TableData";
import { onAdd } from '@/pages/DataStudio/BottomContainer/TableData';
import { LeftBottomKey } from '@/pages/DataStudio/data.d';
import { TaskDataType } from '@/pages/DataStudio/model';
import { Tab } from '@/pages/DataStudio/route';
import React from 'react';
export type BottomTabProps = {
icon?: React.ReactNode;
onAdd: (tabs: Tab[], key: string, data: TaskDataType | undefined, operator: any) => Promise<void>;
onRemove?: (tabs: Tab[], key: string, data: TaskDataType | undefined, tabKey: string, refresh: any) => Promise<void>;
key: string;
icon?: React.ReactNode;
onAdd: (tabs: Tab[], key: string, data: TaskDataType | undefined, operator: any) => Promise<void>;
onRemove?: (
tabs: Tab[],
key: string,
data: TaskDataType | undefined,
tabKey: string,
refresh: any
) => Promise<void>;
key: string;
};
export const BottomTabRoute: { [c: string]: BottomTabProps } = {
[LeftBottomKey.TABLE_DATA_KEY]:
{
key: 'add table data',
onAdd: async (tabs, key, data, operator) => {
await onAdd(tabs, key, data, operator);
}
}
}
\ No newline at end of file
[LeftBottomKey.TABLE_DATA_KEY]: {
key: 'add table data',
onAdd: async (tabs, key, data, operator) => {
await onAdd(tabs, key, data, operator);
}
}
};
......@@ -26,6 +26,7 @@ import FooterContainer from '@/pages/DataStudio/FooterContainer';
import { isProjectTabs, mapDispatchToProps } from '@/pages/DataStudio/function';
import SecondHeaderContainer from '@/pages/DataStudio/HeaderContainer';
import LeftContainer from '@/pages/DataStudio/LeftContainer';
import { BtnProvider } from '@/pages/DataStudio/LeftContainer/BtnContext';
import { getDataSourceList } from '@/pages/DataStudio/LeftContainer/DataSource/service';
import { getTaskData } from '@/pages/DataStudio/LeftContainer/Project/service';
import MiddleContainer from '@/pages/DataStudio/MiddleContainer';
......@@ -44,12 +45,11 @@ import {
} from '@/pages/DataStudio/RightContainer/JobConfig/service';
import { LeftBottomMoreTabs, LeftBottomSide, LeftSide, RightSide } from '@/pages/DataStudio/route';
import { PageContainer } from '@ant-design/pro-layout';
import { useAsyncEffect } from 'ahooks';
import { Layout, Menu, theme } from 'antd';
import { useEffect, useState } from 'react';
import { PersistGate } from 'redux-persist/integration/react';
import { connect, getDvaApp } from 'umi';
import {BtnProvider} from "@/pages/DataStudio/LeftContainer/BtnContext";
import {useAsyncEffect} from "ahooks";
const { Sider, Content } = Layout;
......@@ -279,13 +279,13 @@ const DataStudio = (props: any) => {
<Content style={{ display: 'flex', flexDirection: 'column', minWidth: 0 }}>
<div style={{ display: 'flex' }}>
<BtnProvider>
<LeftContainer
size={size}
leftContainer={leftContainer}
rightContainer={rightContainer}
/>
</BtnProvider>
<BtnProvider>
<LeftContainer
size={size}
leftContainer={leftContainer}
rightContainer={rightContainer}
/>
</BtnProvider>
<Content
style={{
width:
......
This diff is collapsed.
......@@ -61,6 +61,20 @@ const WeChat = (props: WeChatProps) => {
}
];
const validateRulesWeChatSendUrl = [
{
required: true,
validator: async (rule: Rule, value: string) => {
if (!value) {
return Promise.reject(l('rc.ai.sendUrlPleaseHolder'));
}
if (value.endsWith('/')) {
return Promise.reject(l('rc.ai.sendUrlValidate'));
}
}
}
];
/**
* render
*/
......@@ -120,26 +134,35 @@ const WeChat = (props: WeChatProps) => {
// if sendType is app
<>
<ProFormText
width='md'
width='sm'
name={['params', 'corpId']}
label={l('rc.ai.corpId')}
rules={[{ required: true, message: l('rc.ai.corpIdPleaseHolder') }]}
placeholder={l('rc.ai.corpIdPleaseHolder')}
/>
<ProFormText.Password
width='lg'
width='xl'
name={['params', 'secret']}
label={l('rc.ai.secret')}
rules={[{ required: true, message: l('rc.ai.secretPleaseHolder') }]}
placeholder={l('rc.ai.secretPleaseHolder')}
/>
<ProFormDigit
width='md'
width='sm'
name={['params', 'agentId']}
label={l('rc.ai.agentId')}
rules={[{ required: true, message: l('rc.ai.agentIdPleaseHolder') }]}
placeholder={l('rc.ai.agentIdPleaseHolder')}
/>
<ProFormText
width='xl'
name={['params', 'sendUrl']}
label={l('rc.ai.sendUrl')}
tooltip={l('rc.ai.sendUrlTooltip')}
initialValue={'https://qyapi.weixin.qq.com/cgi-bin'}
rules={validateRulesWeChatSendUrl}
placeholder={l('rc.ai.sendUrlPleaseHolder')}
/>
</>
)
)}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment