Skip to content

Commit 16b1a79

Browse files
feat: chat
1 parent 5acf2f6 commit 16b1a79

File tree

8 files changed

+188
-220
lines changed

8 files changed

+188
-220
lines changed

ui/env/.env.chat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
VITE_APP_NAME=chat
22
VITE_BASE_PATH=/chat/
3-
VITE_APP_PORT=3000
3+
VITE_APP_PORT=3001
44
VITE_APP_TITLE = 'MaxKB'
55
VITE_ENTRY="entry/chat/index.html"

ui/src/router/chat/routes.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,14 @@ import type { RouteRecordRaw } from 'vue-router'
33
export const routes: Array<RouteRecordRaw> = [
44
// 对话
55
{
6-
path: '/chat/:accessToken',
6+
path: '/:accessToken',
77
name: 'Chat',
88
component: () => import('@/views/chat/index.vue'),
99
},
10+
// 对话用户登录
11+
{
12+
path: '/user-login/:accessToken',
13+
name: 'UserLogin',
14+
component: () => import('@/views/chat/user-login/index.vue'),
15+
},
1016
]

ui/src/router/routes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const routes: Array<RouteRecordRaw> = [
2424
component: () => import('@/views/chat/index.vue'),
2525
},
2626

27-
// 对话用户登录
27+
// 对话用户登录
2828
{
2929
path: '/user-login/:accessToken',
3030
name: 'UserLogin',

ui/src/stores/modules/application.ts

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,16 @@ const useApplicationStore = defineStore('application', {
6262

6363
async asyncGetAppProfile(loading?: Ref<boolean>) {
6464
return new Promise((resolve, reject) => {
65-
// applicationApi
66-
// .getAppProfile(loading)
67-
// .then((res) => {
68-
// sessionStorage.setItem('language', res.data?.language || getBrowserLang())
69-
// resolve(res)
70-
// })
71-
// .catch((error) => {
72-
// reject(error)
73-
// })
65+
console.log('xxxx')
66+
applicationApi
67+
.getAppProfile(loading)
68+
.then((res) => {
69+
sessionStorage.setItem('language', res.data?.language || getBrowserLang())
70+
resolve(res)
71+
})
72+
.catch((error) => {
73+
reject(error)
74+
})
7475
})
7576
},
7677

@@ -80,16 +81,16 @@ const useApplicationStore = defineStore('application', {
8081
authentication_value?: any,
8182
) {
8283
return new Promise((resolve, reject) => {
83-
// applicationApi
84-
// .postAppAuthentication(token, loading, authentication_value)
85-
// .then((res) => {
86-
// localStorage.setItem(`${token}-accessToken`, res.data)
87-
// sessionStorage.setItem(`${token}-accessToken`, res.data)
88-
// resolve(res)
89-
// })
90-
// .catch((error) => {
91-
// reject(error)
92-
// })
84+
applicationApi
85+
.postAppAuthentication(token, loading, authentication_value)
86+
.then((res) => {
87+
localStorage.setItem(`${token}-accessToken`, res.data)
88+
sessionStorage.setItem(`${token}-accessToken`, res.data)
89+
resolve(res)
90+
})
91+
.catch((error) => {
92+
reject(error)
93+
})
9394
})
9495
},
9596
async refreshAccessToken(token: string) {

ui/src/views/application-overview/component/XPackDisplaySettingDialog.vue

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,10 @@
4141
>
4242
<img :src="detail?.icon" alt="" />
4343
</el-avatar>
44-
<el-avatar
45-
v-else-if="detail?.name"
46-
:name="detail?.name"
47-
pinyinColor
48-
shape="square"
49-
:size="32"
44+
<LogoIcon
45+
v-else
46+
height="28px"
47+
style="width: 28px; height: 28px; display: block"
5048
/>
5149
</div>
5250

ui/src/views/application-workflow/index.vue

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,7 @@
9292
>
9393
<img :src="detail?.icon" alt="" />
9494
</el-avatar>
95-
<el-avatar
96-
v-else-if="detail?.name"
97-
:name="detail?.name"
98-
pinyinColor
99-
shape="square"
100-
:size="32"
101-
/>
95+
<LogoIcon v-else height="28px" style="width: 28px; height: 28px; display: block" />
10296
</div>
10397

10498
<h4>
@@ -157,7 +151,7 @@ const isDefaultTheme = computed(() => {
157151
return user.isDefaultTheme()
158152
})
159153
const {
160-
params: { id }
154+
params: { id },
161155
} = route as any
162156
163157
let interval: any
@@ -182,7 +176,7 @@ function back() {
182176
confirmButtonText: t('views.applicationWorkflow.setting.exitSave'),
183177
cancelButtonText: t('views.applicationWorkflow.setting.exit'),
184178
type: 'warning',
185-
distinguishCancelAndClose: true
179+
distinguishCancelAndClose: true,
186180
})
187181
.then(() => {
188182
saveApplication(true, true)
@@ -268,7 +262,7 @@ async function publicHandle() {
268262
?.validate()
269263
.then(async () => {
270264
const obj = {
271-
work_flow: getGraphData()
265+
work_flow: getGraphData(),
272266
}
273267
await application.asyncPutApplication(id, obj, loading)
274268
const workflow = new WorkFlowInstance(obj.work_flow)
@@ -293,14 +287,14 @@ async function publicHandle() {
293287
MsgError(
294288
res.node.properties?.stepName +
295289
` ${t('views.applicationWorkflow.node').toLowerCase()} ` +
296-
err_message.toLowerCase()
290+
err_message.toLowerCase(),
297291
)
298292
} else {
299293
const keys = Object.keys(err_message)
300294
MsgError(
301295
node.properties?.stepName +
302296
` ${t('views.applicationWorkflow.node').toLowerCase()} ` +
303-
err_message[keys[0]]?.[0]?.message.toLowerCase()
297+
err_message[keys[0]]?.[0]?.message.toLowerCase(),
304298
)
305299
}
306300
})
@@ -318,7 +312,7 @@ const clickShowDebug = () => {
318312
...detail.value,
319313
type: 'WORK_FLOW',
320314
...workflow.get_base_node()?.properties.node_data,
321-
work_flow: getGraphData()
315+
work_flow: getGraphData(),
322316
}
323317
324318
showDebug.value = true
@@ -331,14 +325,14 @@ const clickShowDebug = () => {
331325
const err_message = res.errMessage
332326
if (typeof err_message == 'string') {
333327
MsgError(
334-
res.node.properties?.stepName + ` ${t('views.applicationWorkflow.node')},` + err_message
328+
res.node.properties?.stepName + ` ${t('views.applicationWorkflow.node')},` + err_message,
335329
)
336330
} else {
337331
const keys = Object.keys(err_message)
338332
MsgError(
339333
node.properties?.stepName +
340334
` ${t('views.applicationWorkflow.node')},` +
341-
err_message[keys[0]]?.[0]?.message
335+
err_message[keys[0]]?.[0]?.message,
342336
)
343337
}
344338
})
@@ -376,7 +370,7 @@ function getDetail() {
376370
377371
function saveApplication(bool?: boolean, back?: boolean) {
378372
const obj = {
379-
work_flow: getGraphData()
373+
work_flow: getGraphData(),
380374
}
381375
loading.value = back || false
382376
application

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

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,4 @@
11
<template>
2-
<div class="chat-pc__header" :style="customStyle">
3-
<div class="flex align-center">
4-
<div class="mr-12 ml-24 flex">
5-
<el-avatar
6-
v-if="isAppIcon(application_profile?.icon)"
7-
shape="square"
8-
:size="32"
9-
style="background: none"
10-
>
11-
<img :src="application_profile?.icon" alt="" />
12-
</el-avatar>
13-
<el-avatar
14-
v-else-if="application_profile?.name"
15-
:name="application_profile?.name"
16-
pinyinColor
17-
shape="square"
18-
:size="32"
19-
/>
20-
</div>
21-
<h4>{{ application_profile?.name }}</h4>
22-
</div>
23-
</div>
24-
252
<component
263
:is="auth_components[`/src/views/chat/auth/component/${auth_type}.vue`].default"
274
v-model="is_auth"
@@ -33,7 +10,7 @@ import { computed } from 'vue'
3310
import { isAppIcon } from '@/utils/common'
3411
3512
const auth_components: any = import.meta.glob('@/views/chat/auth/component/*.vue', {
36-
eager: true
13+
eager: true,
3714
})
3815
3916
const emit = defineEmits(['update:modelValue'])
@@ -42,24 +19,24 @@ const props = withDefaults(
4219
defineProps<{ modelValue: boolean; application_profile: any; auth_type?: string; style?: any }>(),
4320
{
4421
auth_type: 'password',
45-
style: {}
46-
}
22+
style: {},
23+
},
4724
)
4825
const is_auth = computed({
4926
get: () => {
5027
return props.modelValue
5128
},
5229
set: (v) => {
5330
emit('update:modelValue', v)
54-
}
31+
},
5532
})
5633
5734
const customStyle = computed(() => {
5835
return {
5936
background: props.application_profile?.custom_theme?.theme_color,
6037
color: props.application_profile?.custom_theme?.header_font_color,
6138
border: 'none',
62-
...props.style
39+
...props.style,
6340
}
6441
})
6542
</script>

0 commit comments

Comments
 (0)