Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: DingTalk Adapter 前端实现 #76

Merged
merged 2 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/components.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// generated by unplugin-vue-components
// We suggest you to commit this file into source control
// Read more: https://github.com/vuejs/vue-next/pull/3399
/* eslint-disable */
/* prettier-ignore */
// @ts-nocheck
// Generated by unplugin-vue-components
// Read more: https://github.com/vuejs/core/pull/3399
export {}

declare module 'vue' {
export interface GlobalComponents {
Expand Down Expand Up @@ -85,5 +88,3 @@ declare module 'vue' {
PageTest: typeof import('./components/PageTest.vue')['default']
}
}

export { }
28 changes: 28 additions & 0 deletions src/components/PageConnectInfoItems.vue
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@
<el-option label="Telegram帐号" :value="3"></el-option>
<el-option label="Minecraft服务器(Paper)" :value="4"></el-option>
<el-option label="Dodo语音" :value="5"></el-option>
<el-option label="钉钉" :value="8"></el-option>
</el-select>
</el-form-item>

Expand Down Expand Up @@ -776,6 +777,30 @@
</small>
</el-form-item>

<el-form-item v-if="form.accountType === 8" label="昵称" :label-width="formLabelWidth" >
<el-input v-model="form.nickname" type="string" autocomplete="off" placeholder="机器人的昵称"></el-input>
</el-form-item>
<el-form-item v-if="form.accountType === 8" label="ClientID" :label-width="formLabelWidth" required>
<el-input v-model="form.clientID" type="string" autocomplete="off"></el-input>
</el-form-item>
<el-form-item v-if="form.accountType === 8" label="RobotCode" :label-width="formLabelWidth" required>
<el-input v-model="form.robotCode" type="string" autocomplete="off"></el-input>
</el-form-item>

<el-form-item v-if="form.accountType === 8" label="Token" :label-width="formLabelWidth" required>
<el-input v-model="form.token" type="string" autocomplete="off"></el-input>
<small>
<div>提示: 前往钉钉开发者平台 https://open-dev.dingtalk.com/fe/app </div>
<div>点击创建应用</div>
<div>点击 基础信息 - 应用信息</div>
<div>把 AppKey 复制到 ClientID 内</div>
<div>把 AppSecret 复制到 Token 内</div>
<div>创建完成之后点击 应用功能 - 机器人与消息推送 并将机器人配置的开关打开</div>
<div>请务必确保 推送方式/消息接受模式 都为 Stream 模式</div>
<div>点击发布后 复制 RobotCode 到 RobotCode 内</div>
</small>
</el-form-item>

</el-form>
</template>
<template v-else-if="form.step === 2">
Expand Down Expand Up @@ -877,6 +902,7 @@
(form.accountType === 1 || form.accountType === 2 || form.accountType === 3) && form.token === '' ||
form.accountType === 4 && form.url === '' ||
form.accountType === 5 && (form.clientID === '' || form.token === '') ||
form.accountType === 8 && (form.clientID === '' || form.token === '' || form.robotCode === '') ||
form.accountType === 6 && (form.account === '' || form.connectUrl === '' || form.relWorkDir === '') ||
form.accountType === 7 && (form.host === '' || form.port === '' || form.token === '')">
下一步</el-button>
Expand Down Expand Up @@ -1236,6 +1262,7 @@ const form = reactive({
step: 1,
isEnd: false,
account: '',
nickname: '',
password: '',
protocol: 1,
appVersion: '',
Expand All @@ -1245,6 +1272,7 @@ const form = reactive({
proxyURL:'',
url:'',
clientID:'',
robotCode:'',
ignoreFriendRequest: false,
extraArgs: '',
endpoint: null as any as DiceConnection,
Expand Down
6 changes: 4 additions & 2 deletions src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ export const useStore = defineStore('main', {
return info as any
},

async addImConnection(form: { accountType: number, account: string, password: string, protocol: number, appVersion: string, token: string, proxyURL: string, url: string, host: string, port: number, clientID: string, implementation: string, connectUrl: string, accessToken: string, relWorkDir: string, useSignServer: boolean, signServerConfig: any }) {
const { accountType, account, password, protocol, appVersion, token, proxyURL, url, host, port, clientID, implementation, relWorkDir, connectUrl, accessToken, useSignServer, signServerConfig } = form
async addImConnection(form: { accountType: number, nickname: string,account: string, password: string, protocol: number, appVersion: string, token: string, proxyURL: string, url: string, host: string, port: number, clientID: string, robotCode: string, implementation: string, connectUrl: string, accessToken: string, relWorkDir: string, useSignServer: boolean, signServerConfig: any }) {
const { accountType, nickname, account, password, protocol, appVersion, token, proxyURL, url, host, port, clientID, robotCode, implementation, relWorkDir, connectUrl, accessToken, useSignServer, signServerConfig } = form
let info = null
switch (accountType) {
//QQ
Expand Down Expand Up @@ -219,6 +219,8 @@ export const useStore = defineStore('main', {
case 7:
info = await backend.post(urlPrefix + '/im_connections/addRed', { host, port, token }, { timeout: 65000 })
break
case 8:
info = await backend.post(urlPrefix + '/im_connections/addDingtalk', { clientID, token, nickname, robotCode }, { timeout: 65000 })
}
return info as any as DiceConnection
},
Expand Down