|
|
@@ -1,12 +1,13 @@
|
|
|
<script lang="ts" setup>
|
|
|
import { computed, ref } from 'vue'
|
|
|
-import { NButton, NInput, NPopconfirm, NSelect, useMessage } from 'naive-ui'
|
|
|
+import { NButton, NInput, NPopconfirm, NSelect, useMessage, useDialog } from 'naive-ui'
|
|
|
import type { Language, Theme } from '@/store/modules/app/helper'
|
|
|
import { SvgIcon } from '@/components/common'
|
|
|
import { useAppStore, useUserStore } from '@/store'
|
|
|
import type { UserInfo } from '@/store/modules/user/helper'
|
|
|
import { getCurrentDate } from '@/utils/functions'
|
|
|
import { useBasicLayout } from '@/hooks/useBasicLayout'
|
|
|
+import { useRouter } from 'vue-router'
|
|
|
import { t } from '@/locales'
|
|
|
|
|
|
const appStore = useAppStore()
|
|
|
@@ -70,6 +71,24 @@ function handleReset() {
|
|
|
window.location.reload()
|
|
|
}
|
|
|
|
|
|
+const router = useRouter()
|
|
|
+const dialog = useDialog()
|
|
|
+const message = useMessage()
|
|
|
+function handleLogout() {
|
|
|
+ dialog.create({
|
|
|
+ title: '提示',
|
|
|
+ content: '确认要退出登录吗?',
|
|
|
+ positiveText: '退出登录',
|
|
|
+ negativeText: '取消',
|
|
|
+ maskClosable: false,
|
|
|
+ onPositiveClick: () => {
|
|
|
+ userStore.logout()
|
|
|
+ message.success('退出登录成功')
|
|
|
+ router.replace('/home')
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
function exportData(): void {
|
|
|
const date = getCurrentDate()
|
|
|
const data: string = localStorage.getItem('chatStorage') || '{}'
|
|
|
@@ -119,7 +138,7 @@ function handleImportButtonClick(): void {
|
|
|
<template>
|
|
|
<div class="p-4 space-y-5 min-h-[200px]">
|
|
|
<div class="space-y-6">
|
|
|
- <div class="flex items-center space-x-4">
|
|
|
+ <!-- <div class="flex items-center space-x-4">
|
|
|
<span class="flex-shrink-0 w-[100px]">{{ $t('setting.avatarLink') }}</span>
|
|
|
<div class="flex-1">
|
|
|
<NInput v-model:value="avatar" placeholder="" />
|
|
|
@@ -145,7 +164,7 @@ function handleImportButtonClick(): void {
|
|
|
<NButton size="tiny" text type="primary" @click="updateUserInfo({ description })">
|
|
|
{{ $t('common.save') }}
|
|
|
</NButton>
|
|
|
- </div>
|
|
|
+ </div> -->
|
|
|
<div class="flex items-center space-x-4" :class="isMobile && 'items-start'">
|
|
|
<span class="flex-shrink-0 w-[100px]">{{ $t('setting.chatHistory') }}</span>
|
|
|
|
|
|
@@ -194,7 +213,7 @@ function handleImportButtonClick(): void {
|
|
|
</template>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="flex items-center space-x-4">
|
|
|
+ <!-- <div class="flex items-center space-x-4">
|
|
|
<span class="flex-shrink-0 w-[100px]">{{ $t('setting.language') }}</span>
|
|
|
<div class="flex flex-wrap items-center gap-4">
|
|
|
<NSelect
|
|
|
@@ -204,12 +223,16 @@ function handleImportButtonClick(): void {
|
|
|
@update-value="value => appStore.setLanguage(value)"
|
|
|
/>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- <div class="flex items-center space-x-4">
|
|
|
+ </div> -->
|
|
|
+ <!-- <div class="flex items-center space-x-4">
|
|
|
<span class="flex-shrink-0 w-[100px]">{{ $t('setting.resetUserInfo') }}</span>
|
|
|
<NButton size="small" @click="handleReset">
|
|
|
{{ $t('common.reset') }}
|
|
|
</NButton>
|
|
|
+ </div> -->
|
|
|
+ <div class="flex items-center space-x-4">
|
|
|
+ <span class="flex-shrink-0 w-[100px]">退出登录</span>
|
|
|
+ <NButton size="small" @click="handleLogout"> 退出登录 </NButton>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|