fix: improve formatting and consistency in ChatHistoryDrawer.vue

This commit is contained in:
wxg0103 2025-08-15 17:59:26 +08:00
parent 15ec70c4a8
commit f78027818d

View File

@ -10,7 +10,7 @@
> >
<el-button class="collapse cursor" circle @click="show = !show"> <el-button class="collapse cursor" circle @click="show = !show">
<el-icon> <el-icon>
<component :is="!show ? 'ArrowRightBold' : 'ArrowLeftBold'" /> <component :is="!show ? 'ArrowRightBold' : 'ArrowLeftBold'"/>
</el-icon> </el-icon>
</el-button> </el-button>
<HistoryPanel <HistoryPanel
@ -32,12 +32,12 @@
chatUser.chat_profile.authentication_type === 'password' chatUser.chat_profile.authentication_type === 'password'
" "
> >
<img src="@/assets/user-icon.svg" style="width: 54%" alt="" /> <img src="@/assets/user-icon.svg" style="width: 54%" alt=""/>
</el-avatar> </el-avatar>
<el-dropdown v-else trigger="click" type="primary" class="w-full"> <el-dropdown v-else trigger="click" type="primary" class="w-full">
<div class="flex align-center"> <div class="flex align-center">
<el-avatar :size="32"> <el-avatar :size="32">
<img src="@/assets/user-icon.svg" style="width: 54%" alt="" /> <img src="@/assets/user-icon.svg" style="width: 54%" alt=""/>
</el-avatar> </el-avatar>
<span class="ml-8 color-text-primary">{{ chatUser.chatUserProfile?.nick_name }}</span> <span class="ml-8 color-text-primary">{{ chatUser.chatUserProfile?.nick_name }}</span>
</div> </div>
@ -47,7 +47,7 @@
<div class="flex align-center p-8"> <div class="flex align-center p-8">
<div class="mr-8 flex align-center"> <div class="mr-8 flex align-center">
<el-avatar :size="40"> <el-avatar :size="40">
<img src="@/assets/user-icon.svg" style="width: 54%" alt="" /> <img src="@/assets/user-icon.svg" style="width: 54%" alt=""/>
</el-avatar> </el-avatar>
</div> </div>
<div> <div>
@ -72,7 +72,7 @@
style="padding-top: 8px; padding-bottom: 8px" style="padding-top: 8px; padding-bottom: 8px"
@click="logout" @click="logout"
> >
<AppIcon iconName="app-export" class="color-secondary" /> <AppIcon iconName="app-export" class="color-secondary"/>
{{ $t('layout.logout') }} {{ $t('layout.logout') }}
</el-dropdown-item> </el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
@ -91,15 +91,16 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, computed, defineModel } from 'vue' import {ref, computed, defineModel} from 'vue'
import useStore from '@/stores' import useStore from '@/stores'
import HistoryPanel from '@/views/chat/component/HistoryPanel.vue' import HistoryPanel from '@/views/chat/component/HistoryPanel.vue'
import ResetPassword from '@/layout/layout-header/avatar/ResetPassword.vue' import ResetPassword from '@/layout/layout-header/avatar/ResetPassword.vue'
import type { ResetCurrentUserPasswordRequest } from '@/api/type/user' import type {ResetCurrentUserPasswordRequest} from '@/api/type/user'
import chatAPI from '@/api/chat/chat' import chatAPI from '@/api/chat/chat'
import { useRouter } from 'vue-router' import {useRoute, useRouter} from 'vue-router'
const router = useRouter()
const router = useRouter()
const route = useRoute()
const show = defineModel<boolean>('show') const show = defineModel<boolean>('show')
const props = defineProps<{ const props = defineProps<{
@ -111,7 +112,7 @@ const props = defineProps<{
const emit = defineEmits(['newChat', 'clickLog', 'deleteLog', 'refreshFieldTitle', 'clearChat']) const emit = defineEmits(['newChat', 'clickLog', 'deleteLog', 'refreshFieldTitle', 'clearChat'])
const { chatUser } = useStore() const {chatUser} = useStore()
const clearChat = () => { const clearChat = () => {
emit('clearChat') emit('clearChat')
@ -128,6 +129,7 @@ const handleClickList = (item: any) => {
const deleteChatLog = (row: any) => { const deleteChatLog = (row: any) => {
emit('deleteLog', row) emit('deleteLog', row)
} }
function refreshFieldTitle(chatId: string, abstract: string) { function refreshFieldTitle(chatId: string, abstract: string) {
emit('refreshFieldTitle', chatId, abstract) emit('refreshFieldTitle', chatId, abstract)
} }
@ -139,13 +141,18 @@ const openResetPassword = () => {
const handleResetPassword = (param: ResetCurrentUserPasswordRequest) => { const handleResetPassword = (param: ResetCurrentUserPasswordRequest) => {
chatAPI.resetCurrentPassword(param).then(() => { chatAPI.resetCurrentPassword(param).then(() => {
router.push({ name: 'login' }) router.push({name: 'login'})
}) })
} }
const logout = () => { const logout = () => {
chatUser.logout().then(() => { chatUser.logout().then(() => {
router.push({ name: 'login' }) router.push({
name: 'login',
params: {accessToken: chatUser.accessToken},
query: route.query,
})
}) })
} }
</script> </script>