Skip to content

Commit b06924b

Browse files
committed
refactor: 优化代码
1 parent 401552e commit b06924b

File tree

7 files changed

+43
-15
lines changed

7 files changed

+43
-15
lines changed

ui/src/components/ai-chat/ExecutionDetailDialog.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
title="执行详情"
55
v-model="dialogVisible"
66
destroy-on-close
7+
append-to-body
78
align-center
89
@click.stop
910
>

ui/src/components/ai-chat/component/ParagraphCard.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</template>
1818
<template #footer>
1919
<div class="footer-content flex-between">
20-
<el-text class="flex align-center" style="width: 70%;">
20+
<el-text class="flex align-center" style="width: 70%">
2121
<el-icon class="mr-4">
2222
<Document />
2323
</el-icon>

ui/src/views/authentication/component/EditModal.vue

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
template
22
<template>
3-
<el-drawer v-model="visible" size="60%" :append-to-body="true" :destroy-on-close="true">
3+
<el-drawer
4+
v-model="visible"
5+
size="60%"
6+
:append-to-body="true"
7+
:destroy-on-close="true"
8+
@close="handleClose"
9+
>
410
<template #header>
511
<div class="flex align-center" style="margin-left: -8px">
612
<h4>{{ currentPlatform.name + '设置' }}</h4>
@@ -31,7 +37,7 @@ template
3137
</el-form>
3238
<template #footer>
3339
<span class="dialog-footer">
34-
<el-button @click="visible = false">取 消</el-button>
40+
<el-button @click="handleClose">取 消</el-button>
3541
<el-button @click="validateConnection">校 验</el-button>
3642
<el-button type="primary" @click="validateForm">保 存</el-button>
3743
</span>
@@ -115,7 +121,7 @@ const open = async (platform: Platform) => {
115121
switch (platform.key) {
116122
case 'wecom':
117123
case 'dingtalk':
118-
if (currentPlatform.config.agent_id) {
124+
if (currentPlatform.config.agent_id && currentPlatform.key === 'dingtalk') {
119125
currentPlatform.config.corp_id = currentPlatform.config.agent_id
120126
delete currentPlatform.config.agent_id
121127
}
@@ -141,6 +147,12 @@ const validateForm = () => {
141147
})
142148
}
143149
150+
const handleClose = () => {
151+
visible.value = false
152+
formRef.value?.clearValidate()
153+
emit('refresh')
154+
}
155+
144156
function validateConnection() {
145157
platformApi.validateConnection(currentPlatform, loading).then((res: any) => {
146158
if (res.data) {

ui/src/views/authentication/component/SCAN.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ function createPlatform(key: string, name: string): Platform {
130130
}
131131
132132
const config = {
133-
...(key === 'dingtalk' ? { corp_id: '' } : {}),
134133
...(key === 'wecom' ? { corp_id: '', agent_id: '' } : { app_key: '' }),
134+
...(key === 'dingtalk' ? { corp_id: '' } : {}),
135135
app_secret: '',
136136
callback_url: ''
137137
}

ui/src/views/chat/auth/component/password.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@
1111
top="25vh"
1212
center
1313
:modal="true"
14+
@click.stop
1415
>
15-
<el-form ref="FormRef" :model="form" @submit.prevent="validator">
16+
<el-form ref="FormRef" :model="form" @submit.prevent="validator" @click.stop>
1617
<el-form-item prop="value" :rules="rules.value">
1718
<el-input show-password v-model="form.value" />
1819
</el-form-item>
19-
<el-button class="w-full mt-8" type="primary" @click="validator" :loading="loading"
20+
<el-button class="w-full mt-8" type="primary" @click.stop="validator" :loading="loading"
2021
>确定</el-button
2122
>
2223
</el-form>

ui/src/views/chat/auth/index.vue

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div class="chat-pc__header">
2+
<div class="chat-pc__header" :style="customStyle">
33
<div class="flex align-center">
44
<div class="mr-12 ml-24 flex">
55
<AppAvatar
@@ -21,17 +21,18 @@
2121
<h4>{{ application_profile?.name }}</h4>
2222
</div>
2323
</div>
24-
<div>
25-
<component
26-
:is="auth_components[`/src/views/chat/auth/component/${auth_type}.vue`].default"
27-
v-model="is_auth"
28-
:applicationProfile="application_profile"
29-
/>
30-
</div>
24+
25+
<component
26+
:is="auth_components[`/src/views/chat/auth/component/${auth_type}.vue`].default"
27+
v-model="is_auth"
28+
:applicationProfile="application_profile"
29+
/>
3130
</template>
3231
<script setup lang="ts">
3332
import { computed } from 'vue'
3433
import { isAppIcon } from '@/utils/application'
34+
import { hexToRgba } from '@/utils/theme'
35+
3536
const auth_components: any = import.meta.glob('@/views/chat/auth/component/*.vue', {
3637
eager: true
3738
})
@@ -52,5 +53,13 @@ const is_auth = computed({
5253
emit('update:modelValue', v)
5354
}
5455
})
56+
57+
const customStyle = computed(() => {
58+
return {
59+
background: props.application_profile?.custom_theme?.theme_color,
60+
color: props.application_profile?.custom_theme?.header_font_color,
61+
border: 'none'
62+
}
63+
})
5564
</script>
5665
<style lang="scss"></style>

ui/src/views/chat/index.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,18 @@
1212
:application_profile="application_profile"
1313
:auth_type="application_profile.authentication_type"
1414
v-model="is_auth"
15+
:style="{
16+
'--el-color-primary': application_profile?.custom_theme?.theme_color,
17+
'--el-color-primary-light-9': hexToRgba(application_profile?.custom_theme?.theme_color, 0.1)
18+
}"
1519
></Auth>
1620
</template>
1721
<script setup lang="ts">
1822
import { ref, onBeforeMount, computed } from 'vue'
1923
import { useRoute } from 'vue-router'
2024
import useStore from '@/stores'
2125
import Auth from '@/views/chat/auth/index.vue'
26+
import { hexToRgba } from '@/utils/theme'
2227
const route = useRoute()
2328
const { application, user } = useStore()
2429

0 commit comments

Comments
 (0)