Handy_Cao 1 éve
szülő
commit
f7578136ab

+ 9 - 1
public/locales/en-US.json

@@ -29,6 +29,7 @@
         "choice1": "Please enter kewords",
         "yes": "Yes",
         "no": "No",
+        "submitfailure": "Submit Failure:",
         "requestfailure": "Request failed, click Reload"
     },
     "tabbar": {
@@ -91,6 +92,7 @@
         "Withholding": "Withholding Apply",
         "closeall": "Close All",
         "openall": "Open All",
+        "modifyavatar": "Modify Avatar",
         "agree": "Agree"
     },
     "chart": {
@@ -1216,9 +1218,15 @@
         },
         "password": {
             "title": "Modify Password",
+            "title1": "Modify Login Password",
             "newpwd": "New Pwd",
             "confirmpwd": "Conform Pwd",
-            "oldpwd": "Old Pwd"
+            "oldpwd": "Old Pwd",
+            "tips1": "Please enter the old password",
+            "tips2": "Please enter the new password",
+            "tips3": "Please re-enter the new password",
+            "tips4": "Password input is inconsistent!",
+            "tips5": "Password changed successfully, please log in again."
         },
         "forget": {
             "title": "Reset Login Pwd",

+ 9 - 1
public/locales/zh-CN.json

@@ -30,6 +30,8 @@
         "choice1": "请输入关键字",
         "yes": "是",
         "no": "否",
+        "modifyavatar": "修改头像",
+        "submitfailure": "提交失败:",
         "requestfailure": "请求失败,点击重新加载"
     },
     "tabbar": {
@@ -1221,9 +1223,15 @@
         },
         "password": {
             "title": "修改密码",
+            "title1": "修改登录密码",
             "newpwd": "新密码",
             "confirmpwd": "确认密码",
-            "oldpwd": "原密码"
+            "oldpwd": "原密码",
+            "tips1": "请输入原密码",
+            "tips2": "请输入新密码",
+            "tips3": "请重新输入新密码",
+            "tips4": "密码输入不一致!",
+            "tips5": "密码修改成功,请重新登录。"
         },
         "forget": {
             "title": "重置登录密码",

+ 13 - 13
src/packages/pc/components/layouts/header/components/modify/index.vue

@@ -1,20 +1,20 @@
 <!-- 系统公告 -->
 <template>
-    <app-drawer title="修改登录密码" :width="400" v-model:show="show" :loading="loading" :refresh="refresh">
-        <el-form ref="formRef" class="el-form--vertical" label-width="80px" :model="formData" :rules="formRules">
-            <el-form-item label="原密码" prop="OldPwd">
-                <el-input placeholder="请输入原密码" show-password v-model="formData.OldPwd" />
+    <app-drawer :title="t('user.password.title1')" :width="480" v-model:show="show" :loading="loading" :refresh="refresh">
+        <el-form ref="formRef" class="el-form--vertical" label-width="110px" :model="formData" :rules="formRules">
+            <el-form-item :label="t('user.password.oldpwd')" prop="OldPwd">
+                <el-input :placeholder="t('user.password.tips1')" show-password v-model="formData.OldPwd" />
             </el-form-item>
-            <el-form-item label="新密码" prop="NewPwd">
+            <el-form-item :label="t('user.password.newpwd')" prop="NewPwd">
                 <el-tooltip placement="top" trigger="click" :hide-after="0">
                     <template #content>
                         <span style="color: #f2f2f2;">{{ validateRules.password.message }}</span>
                     </template>
-                    <el-input placeholder="请输入新密码" show-password v-model="formData.NewPwd" />
+                    <el-input :placeholder="t('user.password.tips2')" show-password v-model="formData.NewPwd" />
                 </el-tooltip>
             </el-form-item>
-            <el-form-item label="确认密码" prop="Confirmpassword">
-                <el-input placeholder="请重新输入新密码" show-password v-model="Confirmpassword" />
+            <el-form-item :label="t('user.password.confirmpwd')" prop="Confirmpassword">
+                <el-input :placeholder="t('user.password.tips3')" show-password v-model="Confirmpassword" />
             </el-form-item>
         </el-form>
         <template #footer>
@@ -42,14 +42,14 @@ const Confirmpassword = ref('')
 const { t } = i18n.global
 
 const formRules: FormRules = {
-    OldPwd: [{ required: true, message: '请输入原密码', trigger: 'blur' }],
+    OldPwd: [{ required: true, message: t('user.password.tips1'), trigger: 'blur' }],
     NewPwd: [{
         required: true,
         validator: (rule, value, callback) => {
             if (validateRules.password.validate(value)) {
                 callback()
             } else {
-                callback(new Error('请输入新密码'))
+                callback(new Error(t('user.password.tips2')))
             }
         },
         trigger: 'blur'
@@ -61,7 +61,7 @@ const formRules: FormRules = {
                 if (Confirmpassword.value === formData.NewPwd) {
                     callback()
                 } else {
-                    callback(new Error('密码输入不一致!'))
+                    callback(new Error(t('user.password.tips4')))
                 }
             },
             trigger: 'blur'
@@ -79,9 +79,9 @@ const onSubmit = () => {
         if (valid) {
             formSubmit().then(() => {
                 onCancel(true)
-                eventBus.$emit('LogoutNotify', '密码修改成功,请重新登录。')
+                eventBus.$emit('LogoutNotify', t('user.password.tips5'))
             }).catch((err) => {
-                ElMessage.error('提交失败:' + err)
+                ElMessage.error(t('common.submitfailure') + err)
             })
         }
     })

+ 6 - 5
src/packages/pc/components/layouts/header/index.vue

@@ -23,11 +23,11 @@
                 </span>
                 <template #dropdown>
                     <el-dropdown-menu>
-                        <el-dropdown-item :icon="Avatar" @click="openComponent('avater')">修改头像</el-dropdown-item>
-                        <el-dropdown-item :icon="Unlock" @click="openComponent('modify')">修改密码</el-dropdown-item>
+                        <el-dropdown-item :icon="Avatar" @click="openComponent('avater')">{{ t('operation.modifyavatar') }}</el-dropdown-item>
+                        <el-dropdown-item :icon="Unlock" @click="openComponent('modify')">{{ t('routes.modifypwd') }}</el-dropdown-item>
                         <!-- <el-dropdown-item :icon="Delete" @click="openComponent('cancel')">注销账户</el-dropdown-item> -->
                         <el-dropdown-item :icon="SwitchButton"
-                            @click="eventBus.$emit('LogoutNotify')">退出登录</el-dropdown-item>
+                            @click="eventBus.$emit('LogoutNotify')">{{ t('common.logout') }}</el-dropdown-item>
                     </el-dropdown-menu>
                 </template>
             </el-dropdown>
@@ -41,10 +41,10 @@ import { ref, onMounted, computed, defineAsyncComponent } from 'vue'
 import { SwitchButton, Unlock, Avatar } from '@element-plus/icons-vue'
 import { getFileUrl, diffDays } from '@/filters'
 import { useComponent } from '@/hooks/component'
-import { useLoginStore, useUserStore, useGlobalStore, useNoticeStore } from '@/stores'
+import { useLoginStore, useUserStore, useGlobalStore, useNoticeStore, i18n } from '@/stores'
+import { localData } from '@/stores/storage'
 import eventBus from '@/services/bus'
 import AppIcon from '@pc/components/base/icon/index.vue'
-import { localData } from '@/stores/storage'
 
 const componentMap = new Map<string, unknown>([
     ['notice', defineAsyncComponent(() => import('./components/notice/index.vue'))],
@@ -61,6 +61,7 @@ const globalStore = useGlobalStore()
 const userStore = useUserStore()
 const noticeStore = useNoticeStore()
 const fullScreen = ref(false)
+const { t } = i18n.global
 
 // 用户头像
 const userAvatar = computed(() => {