@@ -8,14 +8,22 @@ import icon_translate_outlined from '@/assets/svg/icon_translate_outlined.svg'
88import icon_logout_outlined from ' @/assets/svg/icon_logout_outlined.svg'
99import icon_right_outlined from ' @/assets/svg/icon_right_outlined.svg'
1010import icon_done_outlined from ' @/assets/svg/icon_done_outlined.svg'
11-
11+ import { useI18n } from ' vue-i18n'
12+ import PwdForm from ' ./PwdForm.vue'
13+ import { useRouter } from ' vue-router'
14+ import { useUserStore } from ' @/stores/user'
15+ const router = useRouter ()
16+ const userStore = useUserStore ()
17+ const pwdFormRef = ref ()
18+ const { t } = useI18n ()
1219defineProps ({
1320 collapse: { type: [Boolean ], required: true },
1421})
1522
1623const name = ref (' 飞小致' )
1724const currentLanguage = ref (' zh-CN' )
1825const emit = defineEmits ([' selectPerson' ])
26+ const dialogVisible = ref (false )
1927const languageList = [
2028 {
2129 name: ' English' ,
@@ -37,6 +45,20 @@ const handlePersonChange = () => {
3745const handleDefaultLanguageChange = (item : any ) => {
3846 currentLanguage .value = item .value
3947}
48+
49+ const openPwd = () => {
50+ dialogVisible .value = true
51+ }
52+ const closePwd = () => {
53+ dialogVisible .value = false
54+ }
55+ const savePwdHandler = () => {
56+ pwdFormRef .value ?.submit ()
57+ }
58+ const logout = () => {
59+ userStore .logout ()
60+ router .push (' /login' )
61+ }
4062 </script >
4163
4264<template >
@@ -64,7 +86,7 @@ const handleDefaultLanguageChange = (item: any) => {
6486 </el-icon >
6587 <div class =" datasource-name" >系统管理</div >
6688 </div >
67- <div class =" popover-item" >
89+ <div class =" popover-item" @click = " openPwd " >
6890 <el-icon size =" 16" >
6991 <icon _key_outlined ></icon _key_outlined >
7092 </el-icon >
@@ -104,7 +126,7 @@ const handleDefaultLanguageChange = (item: any) => {
104126 </el-icon >
105127 <div class =" datasource-name" >帮助</div >
106128 </div >
107- <div class =" popover-item mr4" >
129+ <div class =" popover-item mr4" @click = " logout " >
108130 <el-icon size =" 16" >
109131 <icon _logout_outlined ></icon _logout_outlined >
110132 </el-icon >
@@ -113,6 +135,16 @@ const handleDefaultLanguageChange = (item: any) => {
113135 </div >
114136 </div >
115137 </el-popover >
138+
139+ <el-dialog v-model =" dialogVisible" :title =" t('user.upgrade_pwd.title')" width =" 600" >
140+ <pwd-form v-if =" dialogVisible" ref =" pwdFormRef" @pwd-saved =" closePwd" />
141+ <template #footer >
142+ <div class =" dialog-footer" >
143+ <el-button @click =" closePwd" >{{ t('common.cancel') }}</el-button >
144+ <el-button type =" primary" @click =" savePwdHandler" >{{ t('common.save') }}</el-button >
145+ </div >
146+ </template >
147+ </el-dialog >
116148</template >
117149
118150<style lang="less" scoped>
0 commit comments