11<template >
22 <el-dialog
33 :model-value =" visible"
4- :title =" t('auth.account ')"
4+ :title =" t('auth.accountSettings ')"
55 width =" 460px"
66 @close =" emit('update:visible', false)"
77 >
88 <el-form label-position =" top" >
9+ <el-form-item :label =" t('auth.username')" >
10+ <div class =" account-dialog__static-value" >{{ username }}</div >
11+ </el-form-item >
912 <el-form-item :label =" t('auth.displayName')" >
1013 <el-input v-model =" form.display_name" maxlength =" 120" />
1114 </el-form-item >
@@ -37,14 +40,15 @@ import { useI18n } from "@/composables/useI18n";
3740const props = defineProps <{
3841 visible: boolean ;
3942 submitting: boolean ;
43+ username: string ;
4044 displayName: string ;
4145}>();
4246
4347const emit = defineEmits <{
4448 " update:visible" : [value : boolean ];
4549 submit: [{
4650 display_name: string ;
47- current_password: string ;
51+ current_password? : string ;
4852 new_password? : string ;
4953 }];
5054}>();
@@ -76,11 +80,15 @@ function handleSave() {
7680 const newPassword = form .new_password .trim ();
7781 const confirmPassword = form .confirm_password .trim ();
7882
79- if (! displayName || ! currentPassword ) {
83+ if (! displayName ) {
8084 ElMessage .error (t (" auth.accountRequired" ));
8185 return ;
8286 }
8387 if (newPassword || confirmPassword ) {
88+ if (! currentPassword ) {
89+ ElMessage .error (t (" auth.currentPasswordRequired" ));
90+ return ;
91+ }
8492 if (newPassword !== confirmPassword ) {
8593 ElMessage .error (t (" auth.passwordMismatch" ));
8694 return ;
@@ -93,7 +101,7 @@ function handleSave() {
93101
94102 emit (" submit" , {
95103 display_name: displayName ,
96- current_password: currentPassword ,
104+ current_password: currentPassword || undefined ,
97105 new_password: newPassword || undefined ,
98106 });
99107}
@@ -105,4 +113,9 @@ function handleSave() {
105113 justify-content : flex-end ;
106114 gap : 8px ;
107115}
116+
117+ .account-dialog__static-value {
118+ color : #303133 ;
119+ line-height : 32px ;
120+ }
108121 </style >
0 commit comments