Skip to content

Commit 8ee9bc0

Browse files
committed
feat: add WeCom Bot configuration support in application settings
1 parent 6279c9b commit 8ee9bc0

File tree

5 files changed

+88
-34
lines changed

5 files changed

+88
-34
lines changed

ui/src/locales/lang/en-US/views/application.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ export default {
161161
title: 'APP Access',
162162
wecom: 'WeCom',
163163
wecomTip: 'Create WeCom intelligent APP',
164+
wecomBot: 'WeCom Bot',
165+
wecomBotTip: 'Create WeCom intelligent Bot',
164166
dingtalk: 'DingTalk',
165167
dingtalkTip: 'Create DingTalk intelligent APP',
166168
wechat: 'WeChat',
@@ -208,6 +210,10 @@ export default {
208210
urlInfo:
209211
'-Settings and Development-Basic Configuration-"Server Address URL" in server configuration',
210212
},
213+
wecomBotSetting: {
214+
title: 'WeCom Bot Configuration',
215+
urlInfo: '-Security and Management-Management Tools-Intelligent Bots-API Mode',
216+
},
211217
larkSetting: {
212218
title: 'Lark Configuration',
213219
appIdPlaceholder: 'Please enter APP ID',

ui/src/locales/lang/zh-CN/views/application.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ export default {
150150
title: '应用接入',
151151
wecom: '企业微信应用',
152152
wecomTip: '打造企业微信智能应用',
153+
wecomBot: '企业微信智能机器人',
154+
wecomBotTip: '打造企业微信智能机器人应用',
153155
dingtalk: '钉钉应用',
154156
dingtalkTip: '打造钉钉智能应用',
155157
wechat: '公众号',
@@ -176,6 +178,10 @@ export default {
176178
authenticationSuccessful: '认证成功',
177179
urlInfo: '-应用管理-自建-创建的应用-接收消息-设置 API 接收的 "URL" 中',
178180
},
181+
wecomBotSetting: {
182+
title: '企业微信应用配置',
183+
urlInfo: '-安全与管理-管理工具-智能机器人- API 模式创建的 "URL" 中',
184+
},
179185
dingtalkSetting: {
180186
title: '钉钉应用配置',
181187
clientIdPlaceholder: '请输入Client ID',

ui/src/locales/lang/zh-Hant/views/application.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ export default {
153153
wecomTip: '打造企業微信智慧應用',
154154
dingtalk: '釘釘應用',
155155
dingtalkTip: '打造釘釘智慧應用',
156+
wecomBot: '企業微信智能機器人',
157+
wecomBotTip: '打造企業微信智能機器人',
156158
wechat: '公眾號',
157159
wechatTip: '打造公眾號智慧應用',
158160
lark: '飛書應用',
@@ -201,6 +203,10 @@ export default {
201203
appSecretPlaceholder: '請輸入App Secret',
202204
verificationTokenPlaceholder: '請輸入Verification Token',
203205
urlInfo: '-事件與回呼-事件配置-配置訂閱方式的 "請求位址" 中',
206+
},
207+
wecomBotSetting: {
208+
title: '企業微信機器人配置',
209+
urlInfo: '-安全與管理-管理工具-智能機器人- API 模式建立的 "URL" 中',
204210
},
205211
slackSetting: {
206212
title: 'Slack 應用配置',

ui/src/views/application/ApplicationAccess.vue

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,14 @@ const platforms = reactive([
109109
isActive: false,
110110
exists: false,
111111
},
112+
{
113+
key: 'wecomBot',
114+
logoSrc: new URL(`../../assets/logo/logo_wechat-work.svg`, import.meta.url).href,
115+
name: t('views.application.applicationAccess.wecomBot'),
116+
description: t('views.application.applicationAccess.wecomBotTip'),
117+
isActive: false,
118+
exists: false,
119+
},
112120
])
113121
114122
const AccessSettingDrawerRef = ref()

ui/src/views/application/component/AccessSettingDrawer.vue

Lines changed: 62 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
</template>
3131
<div v-if="configType === 'wechat'" class="flex align-center mb-16">
3232
<span class="lighter mr-8">{{
33-
$t('views.application.applicationAccess.wecomSetting.authenticationSuccessful')
34-
}}</span>
35-
<el-switch v-if="configType === 'wechat'" v-model="form[configType].is_certification" />
33+
$t('views.application.applicationAccess.wecomSetting.authenticationSuccessful')
34+
}}</span>
35+
<el-switch v-if="configType === 'wechat'" v-model="form[configType].is_certification"/>
3636
</div>
3737

3838
<h4 class="title-decoration-1 mb-16">
@@ -56,7 +56,7 @@
5656
class="color-primary"
5757
href="https://mp.weixin.qq.com/advanced/advanced?action=dev&t=advanced/dev"
5858
target="_blank"
59-
>{{ $t('views.application.applicationAccess.wechatPlatform') }}</a
59+
>{{ $t('views.application.applicationAccess.wechatPlatform') }}</a
6060
>{{ $t('views.application.applicationAccess.wechatSetting.urlInfo') }}
6161
</el-text>
6262
<el-text type="info" v-if="configType === 'dingtalk'">
@@ -65,7 +65,7 @@
6565
class="color-primary"
6666
href="https://open-dev.dingtalk.com/fe/app?hash=%23%2Fcorp%2Fapp#/corp/app"
6767
target="_blank"
68-
>{{ $t('views.application.applicationAccess.dingtalkPlatform') }}</a
68+
>{{ $t('views.application.applicationAccess.dingtalkPlatform') }}</a
6969
>{{ $t('views.application.applicationAccess.dingtalkSetting.urlInfo') }}
7070
</el-text>
7171
<el-text type="info" v-if="configType === 'wecom'">
@@ -74,14 +74,14 @@
7474
class="color-primary"
7575
href="https://work.weixin.qq.com/wework_admin/frame#apps"
7676
target="_blank"
77-
>{{ $t('views.application.applicationAccess.wecomPlatform') }}</a
77+
>{{ $t('views.application.applicationAccess.wecomPlatform') }}</a
7878
>{{ $t('views.application.applicationAccess.wecomSetting.urlInfo') }}
7979
</el-text>
8080
<el-text type="info" v-if="configType === 'lark'">
8181
{{ $t('views.application.applicationAccess.copyUrl') }}
8282
<a class="primary" href="https://open.feishu.cn/app/" target="_blank">{{
83-
$t('views.application.applicationAccess.larkPlatform')
84-
}}</a
83+
$t('views.application.applicationAccess.larkPlatform')
84+
}}</a
8585
>{{ $t('views.application.applicationAccess.larkSetting.urlInfo') }}
8686
</el-text>
8787
</el-form-item>
@@ -99,19 +99,20 @@
9999
</template>
100100

101101
<script setup lang="ts">
102-
import { ref, reactive, computed } from 'vue'
103-
import type { FormInstance } from 'element-plus'
104-
import { useRoute } from 'vue-router'
105-
import { MsgError, MsgSuccess } from '@/utils/message'
106-
import { copyClick } from '@/utils/clipboard'
107-
import { t } from '@/locales'
108-
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
109-
type PlatformType = 'wechat' | 'dingtalk' | 'wecom' | 'lark' | 'slack'
102+
import {ref, reactive, computed} from 'vue'
103+
import type {FormInstance} from 'element-plus'
104+
import {useRoute} from 'vue-router'
105+
import {MsgError, MsgSuccess} from '@/utils/message'
106+
import {copyClick} from '@/utils/clipboard'
107+
import {t} from '@/locales'
108+
import {loadSharedApi} from '@/utils/dynamics-api/shared-api'
109+
110+
type PlatformType = 'wechat' | 'dingtalk' | 'wecom' | 'lark' | 'slack' | 'wecomBot'
110111
111112
const route = useRoute()
112113
113114
const {
114-
params: { id },
115+
params: {id},
115116
} = route as any
116117
const apiType = computed(() => {
117118
if (route.path.includes('resource-management')) {
@@ -136,7 +137,7 @@ const form = reactive<any>({
136137
is_certification: false,
137138
callback_url: '',
138139
},
139-
dingtalk: { client_id: '', client_secret: '', callback_url: '' },
140+
dingtalk: {client_id: '', client_secret: '', callback_url: ''},
140141
wecom: {
141142
app_id: '',
142143
agent_id: '',
@@ -145,8 +146,13 @@ const form = reactive<any>({
145146
encoding_aes_key: '',
146147
callback_url: '',
147148
},
148-
lark: { app_id: '', app_secret: '', verification_token: '', callback_url: '' },
149-
slack: { signing_secret: '', bot_user_token: '', callback_url: '' },
149+
lark: {app_id: '', app_secret: '', verification_token: '', callback_url: ''},
150+
slack: {signing_secret: '', bot_user_token: '', callback_url: ''},
151+
wecomBot: {
152+
token: '',
153+
encoding_aes_key: '',
154+
callback_url: '',
155+
}
150156
})
151157
152158
const rules = reactive<{ [propName: string]: any }>({
@@ -272,6 +278,22 @@ const rules = reactive<{ [propName: string]: any }>({
272278
},
273279
],
274280
},
281+
wecomBot: {
282+
token: [
283+
{
284+
required: true,
285+
message: t('views.application.applicationAccess.wecomSetting.tokenPlaceholder'),
286+
trigger: 'blur',
287+
},
288+
],
289+
encoding_aes_key: [
290+
{
291+
required: true,
292+
message: t('views.application.applicationAccess.wecomSetting.encodingAesKeyPlaceholder'),
293+
trigger: 'blur',
294+
},
295+
],
296+
},
275297
})
276298
277299
const configFields: { [propName: string]: { [propName: string]: any } } = {
@@ -284,34 +306,38 @@ const configFields: { [propName: string]: { [propName: string]: any } } = {
284306
label: t('views.application.applicationAccess.wechatSetting.appSecret'),
285307
placeholder: '',
286308
},
287-
token: { label: t('views.application.applicationAccess.wechatSetting.token'), placeholder: '' },
309+
token: {label: t('views.application.applicationAccess.wechatSetting.token'), placeholder: ''},
288310
encoding_aes_key: {
289311
label: t('views.application.applicationAccess.wechatSetting.aesKey'),
290312
placeholder: '',
291313
},
292314
},
293315
dingtalk: {
294-
client_id: { label: 'Client ID', placeholder: '' },
295-
client_secret: { label: 'Client Secret', placeholder: '' },
316+
client_id: {label: 'Client ID', placeholder: ''},
317+
client_secret: {label: 'Client Secret', placeholder: ''},
296318
},
297319
wecom: {
298320
app_id: {
299321
label: t('views.application.applicationAccess.wecomSetting.cropId'),
300322
placeholder: '',
301323
},
302-
agent_id: { label: 'Agent ID', placeholder: '' },
303-
secret: { label: 'Secret', placeholder: '' },
304-
token: { label: 'Token', placeholder: '' },
305-
encoding_aes_key: { label: 'EncodingAESKey', placeholder: '' },
324+
agent_id: {label: 'Agent ID', placeholder: ''},
325+
secret: {label: 'Secret', placeholder: ''},
326+
token: {label: 'Token', placeholder: ''},
327+
encoding_aes_key: {label: 'EncodingAESKey', placeholder: ''},
328+
},
329+
wecomBot: {
330+
token: {label: 'Token', placeholder: ''},
331+
encoding_aes_key: {label: 'EncodingAESKey', placeholder: ''},
306332
},
307333
lark: {
308-
app_id: { label: 'App ID', placeholder: '' },
309-
app_secret: { label: 'App Secret', placeholder: '' },
310-
verification_token: { label: 'Verification Token', placeholder: '' },
334+
app_id: {label: 'App ID', placeholder: ''},
335+
app_secret: {label: 'App Secret', placeholder: ''},
336+
verification_token: {label: 'Verification Token', placeholder: ''},
311337
},
312338
slack: {
313-
signing_secret: { label: 'Signing Secret', placeholder: '' },
314-
bot_user_token: { label: 'Bot User Token', placeholder: '' },
339+
signing_secret: {label: 'Signing Secret', placeholder: ''},
340+
bot_user_token: {label: 'Bot User Token', placeholder: ''},
315341
},
316342
}
317343
@@ -331,6 +357,7 @@ const drawerTitle = computed(
331357
wecom: t('views.application.applicationAccess.wecomSetting.title'),
332358
lark: t('views.application.applicationAccess.larkSetting.title'),
333359
slack: t('views.application.applicationAccess.slackSetting.title'),
360+
wecomBot: t('views.application.applicationAccess.wecomBotSetting.title'),
334361
})[configType.value],
335362
)
336363
@@ -342,6 +369,7 @@ const infoTitle = computed(
342369
wecom: t('views.applicationOverview.appInfo.header'),
343370
lark: t('views.applicationOverview.appInfo.header'),
344371
slack: t('views.applicationOverview.appInfo.header'),
372+
wecomBot: t('views.applicationOverview.appInfo.header'),
345373
})[configType.value],
346374
)
347375
@@ -369,7 +397,7 @@ const submit = async () => {
369397
formRef.value?.validate(async (valid) => {
370398
if (valid) {
371399
try {
372-
loadSharedApi({ type: 'application', systemType: apiType.value })
400+
loadSharedApi({type: 'application', systemType: apiType.value})
373401
.updatePlatformConfig(id, configType.value, form[configType.value], loading)
374402
.then(() => {
375403
MsgSuccess(t('common.saveSuccess'))
@@ -407,5 +435,5 @@ const open = async (id: string, type: PlatformType) => {
407435
}
408436
}
409437
410-
defineExpose({ open })
438+
defineExpose({open})
411439
</script>

0 commit comments

Comments
 (0)