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

90 lines
2.1 KiB
Vue
Raw Normal View History

2023-11-29 09:34:45 +00:00
<template>
2023-12-01 11:17:58 +00:00
<div class="chat" v-loading="loading">
2023-11-29 09:34:45 +00:00
<div class="chat__header">
2023-11-30 10:50:42 +00:00
<div class="chat-width">
<h2 class="ml-24">{{ applicationDetail?.name }}</h2>
</div>
</div>
2023-12-01 11:17:58 +00:00
<div class="chat__main chat-width">
2023-12-06 09:30:46 +00:00
<AiChat v-model:data="applicationDetail" :appId="applicationDetail?.id"></AiChat>
2023-11-29 09:34:45 +00:00
</div>
2023-12-01 11:17:58 +00:00
<div class="chat__footer"></div>
2023-11-29 09:34:45 +00:00
</div>
</template>
<script setup lang="ts">
2023-11-30 10:50:42 +00:00
import { reactive, ref, watch, onMounted } from 'vue'
import { useRouter, useRoute } from 'vue-router'
import applicationApi from '@/api/application'
import useStore from '@/stores'
const route = useRoute()
const {
params: { accessToken }
} = route as any
const { application, user } = useStore()
const loading = ref(false)
const applicationDetail = ref<any>({})
function getAccessToken(token: string) {
2023-12-01 07:59:50 +00:00
application.asyncAppAuthentication(token, loading).then((res) => {
getProfile()
})
2023-11-30 10:50:42 +00:00
}
function getProfile() {
applicationApi.getProfile(loading).then((res) => {
applicationDetail.value = res.data
})
}
onMounted(() => {
user.changeUserType(2)
getAccessToken(accessToken)
})
2023-11-29 09:34:45 +00:00
</script>
2023-12-26 08:56:14 +00:00
<style lang="scss">
2023-11-29 09:34:45 +00:00
.chat {
background-color: var(--app-layout-bg-color);
2023-12-26 08:56:14 +00:00
overflow: hidden;
2023-11-29 09:34:45 +00:00
&__header {
background: var(--app-header-bg-color);
position: fixed;
width: 100%;
left: 0;
top: 0;
z-index: 100;
height: var(--app-header-height);
line-height: var(--app-header-height);
box-sizing: border-box;
2024-02-23 09:55:55 +00:00
border-bottom: 1px solid rgba(31, 35, 41, 0.15);
2023-11-29 09:34:45 +00:00
}
&__main {
padding-top: calc(var(--app-header-height) + 24px);
height: calc(100vh - var(--app-header-height) - 24px);
2023-12-26 08:56:14 +00:00
overflow: hidden;
2023-11-29 09:34:45 +00:00
}
2023-12-01 11:17:58 +00:00
&__footer {
background: #f3f7f9;
height: 80px;
position: absolute;
bottom: 0;
left: 0;
width: 100%;
box-sizing: border-box;
2023-12-26 08:56:14 +00:00
border-radius: 8px !important;
2023-12-01 11:17:58 +00:00
&:before {
background: linear-gradient(0deg, #f3f7f9 0%, rgba(243, 247, 249, 0) 100%);
content: '';
position: absolute;
width: 100%;
top: -16px;
left: 0;
height: 16px;
}
}
2023-11-29 09:34:45 +00:00
.chat-width {
2023-12-11 10:27:31 +00:00
max-width: var(--app-chat-width, 860px);
2023-11-29 09:34:45 +00:00
margin: 0 auto;
}
}
</style>