From b7340ff101c5cd8e0d3d8453baabec829bf4fab7 Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Sat, 11 Nov 2023 14:51:52 +0800 Subject: [PATCH] =?UTF-8?q?style:=20=E4=B8=AA=E4=BA=BA=E4=B8=AD=E5=BF=83?= =?UTF-8?q?=E5=A4=9A=E8=AF=AD=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/i18n/locales/en-US.ts | 79 ++++++++++++ src/i18n/locales/zh-CN.ts | 79 ++++++++++++ src/views/account/components/base-info.vue | 59 +++++---- src/views/account/components/reset-passwd.vue | 32 ++--- src/views/account/components/style-layout.vue | 115 +++++++++++------- src/views/account/profile.vue | 30 +++-- src/views/account/settings.vue | 8 +- 7 files changed, 304 insertions(+), 98 deletions(-) diff --git a/src/i18n/locales/en-US.ts b/src/i18n/locales/en-US.ts index fb30e84c..6203deb0 100644 --- a/src/i18n/locales/en-US.ts +++ b/src/i18n/locales/en-US.ts @@ -225,6 +225,85 @@ export default { tipContent: 'Congratulations, {username} account registration succeeded!', tipBtn: 'Go to login', }, + account: { + settings: { + baseInfo: "Basic Info", + sex: "Gender", + sexPleace: "Please select the user's gender", + email: "Email", + emailPleace: "Please enter the correct e-mail address", + phonenumber: "Phone", + phonenumberPleace: "Please enter the correct cell phone number", + nick: "NickName", + nickPleace: "Please enter a user nickname", + nickTip: "Nicknames can only contain letters, numbers, Chinese characters and underscores, and no less than 2 digits", + profileTip: "Are you sure you want to submit changes to basic user information?", + profileOk: "The user's basic information is modified successfully!", + know: "I got it.", + uploadPleace: "Please choose an equal-sized image for your avatar, such as {txt}", + upload: "Upload/Change Images", + uploadFormat: 'Only supports uploading image formats ({format})', + uploadSize: 'Image file size must be less than {size}MB', + uploadTip: "Confirmed to upload/change user avatar?", + uploadOk: "Avatar upload/change successful", + resetPasswd: "Reset Password", + oldPassword: "Old Password", + oldPasswordTip: "The old password must not be empty and must be at least 6 digits long", + oldPasswordPleace: "Please enter the old password", + newPassword: "New Password", + newPasswordTip: "Password contains at least upper and lower case letters, numbers, special symbols, and not less than 6 digits", + newPassworddPleace: "Please enter a new password", + confirmPassword: "Confirm new password", + confirmPasswordPleace: "Please confirm the new password", + submit: "Submit changes", + reset: "Reset", + submitTip: "Are you sure you want to submit a password change?", + submitOkTip: "Congratulations, {num} account password changed successfully!", + submitOk: "Sign in again", + equalToPassword: "Please enter a new password to confirm", + equalToPasswordOld: "Same as the old password, please re-enter the new password", + equalToPasswordErr: "Inconsistent new passwords entered twice", + styleLayout: "Personalization", + area1: "Layout Properties", + layout: "Overall Layout", + layoutActions: "Navigation mode module settings", + layoutSide: "Left", + layoutTop: "Top", + layoutMix: "Mixed", + color: "Style color scheme", + colorActions: "Overall style color scheme setting", + colorRandomly: "Randomization", + navTheme: "Dark Menu", + navThemeActions: "Menus that can only change the navigation mode", + fixedHeader: "Fixed top navigation bar", + fixedHeaderActions: "Whether the top navigation bar is fixed and does not move with the scroll bar", + fixSiderbar: "Fixed left menu", + fixSiderbarActions: "Whether the left menu is fixed or not, only valid for left menu layout", + splitMenus: "Auto Split Menu", + splitMenusActions: "Show left menu when there are multiple levels of menus at the top, valid only for mixed menu layouts", + area2: "Content Area", + tabRender: "Navigation tabs", + tabRenderActions: "Whether to show the top tab navigation items", + menuHeaderRender: "Menu Header", + menuHeaderRenderActions: "Whether or not to display the logo area at the top of the left menu bar", + footerRender: "Footer", + footerRenderActions: "Whether to show the bottom navigation bar", + headerRender: "Parapet", + headerRenderActions: "Whether to display the top navigation bar", + }, + profile: { + phonenumber: "Phone", + email: "Email", + deptName: "Department", + postGroup: "Possession of posts", + roleGroup: "Ownership", + loginIp: "Log in", + loginDate: "Login Time", + list: "Lists", + empty: "Empty State", + description: "No data yet, try refreshing", + }, + }, configManage: { neManage: { addNe:'Add Network Element', diff --git a/src/i18n/locales/zh-CN.ts b/src/i18n/locales/zh-CN.ts index 81943a7f..b3fd6758 100644 --- a/src/i18n/locales/zh-CN.ts +++ b/src/i18n/locales/zh-CN.ts @@ -225,6 +225,85 @@ export default { tipContent: '恭喜您,{username} 账号注册成功!', tipBtn: '前往登录', }, + account: { + settings: { + baseInfo: "基础信息", + sex: "用户性别", + sexPleace: "请选择用户性别", + email: "电子邮箱", + emailPleace: "请输入正确的电子邮箱", + phonenumber: "手机号码", + phonenumberPleace: "请输入正确的电子邮箱", + nick: "用户昵称", + nickPleace: "请输入用户昵称", + nickTip: "昵称只能包含字母、数字、中文和下划线,且不少于2位", + profileTip: "确认要提交修改用户基本信息吗?", + profileOk: "用户基本信息修改成功!", + know: "我知道了", + uploadPleace: "请选择等比大小图片作为头像,如{txt}", + upload: "上传/变更图片", + uploadFormat: '只支持上传图片格式({format})', + uploadSize: '图片文件大小必须小于 {size}MB', + uploadTip: "确认要上传/变更用户头像吗?", + uploadOk: "头像上传/变更成功", + resetPasswd: "重置密码", + oldPassword: "旧密码", + oldPasswordTip: "旧密码不能为空,且不少于6位", + oldPasswordPleace: "请输入旧密码", + newPassword: "新密码", + newPasswordTip: "密码至少包含大小写字母、数字、特殊符号,且不少于6位", + newPassworddPleace: "请输入新密码", + confirmPassword: "确认新密码", + confirmPasswordPleace: "请确认新密码", + submit: "提交修改", + reset: "重置", + submitTip: "确认要提交修改密码吗?", + submitOkTip: "恭喜您,{num} 账号密码修改成功!", + submitOk: "重新登录", + equalToPassword: "请输入确认新密码", + equalToPasswordOld: "与旧密码一致,请重新输入新密码", + equalToPasswordErr: "两次输入的新密码不一致", + styleLayout: "个性化", + area1: "布局属性", + layout: "整体布局", + layoutActions: "导航模式模块设置", + layoutSide: "左侧菜单布局", + layoutTop: "顶部菜单布局", + layoutMix: "混合菜单布局", + color: "风格配色", + colorActions: "整体风格配色设置", + colorRandomly: "随机", + navTheme: "深色菜单", + navThemeActions: "只能改变导航模式的菜单", + fixedHeader: "固定顶部导航栏", + fixedHeaderActions: "顶部导航栏是否固定,不随滚动条移动", + fixSiderbar: "固定左侧菜单", + fixSiderbarActions: "左侧菜单是否固定,仅左侧菜单布局时有效", + splitMenus: "自动分割菜单", + splitMenusActions: "顶部有多级菜单时显示左侧菜单,仅混合菜单布局时有效", + area2: "内容区域", + tabRender: "导航标签项", + tabRenderActions: "是否显示顶部Tab导航标签项", + menuHeaderRender: "菜单头", + menuHeaderRenderActions: "是否显示左侧菜单栏顶部LOGO区域", + footerRender: "页脚", + footerRenderActions: "是否显示底部导航栏", + headerRender: "顶栏", + headerRenderActions: "是否显示顶部导航栏", + }, + profile: { + phonenumber: "手机号码", + email: "用户邮箱", + deptName: "所属部门", + postGroup: "拥有岗位", + roleGroup: "拥有角色", + loginIp: "登录地址", + loginDate: "登录时间", + list: "列表", + empty: "空状态", + description: "暂无数据,尝试刷新看看", + }, + }, configManage: { neManage: { addNe:'添加网元', diff --git a/src/views/account/components/base-info.vue b/src/views/account/components/base-info.vue index 02c3d289..541a7eab 100644 --- a/src/views/account/components/base-info.vue +++ b/src/views/account/components/base-info.vue @@ -43,7 +43,7 @@ function fnInitstateForm() { function fnFinish() { Modal.confirm({ title: t('common.tipTitle'), - content: `确认要提交修改用户基本信息吗?`, + content: t('views.account.settings.profileTip'), onOk() { stateForm.formClick = true; // 发送请求 @@ -55,8 +55,8 @@ function fnFinish() { if (res.code === RESULT_CODE_SUCCESS) { Modal.success({ title: t('common.tipTitle'), - content: `用户基本信息修改成功!`, - okText: '我知道了', + content: t('views.account.settings.profileOk'), + okText: t('views.account.settings.know'), onOk() { uerStore.setBaseInfo(form); }, @@ -77,11 +77,14 @@ function fnBeforeUpload(file: FileType) { if (upState.value) return false; const isJpgOrPng = ['image/jpeg', 'image/png'].includes(file.type); if (!isJpgOrPng) { - message.error('只支持上传图片格式(jpg、png)', 3); + message.error( + t('views.account.settings.uploadFormat', { format: 'jpg、png' }), + 3 + ); } const isLt2M = file.size / 1024 / 1024 < 2; if (!isLt2M) { - message.error('图片文件大小必须小于 2MB', 3); + message.error(t('views.account.settings.uploadSize', { size: '2' }), 3); } return isJpgOrPng && isLt2M; } @@ -90,7 +93,7 @@ function fnBeforeUpload(file: FileType) { function fnUpload(up: UploadRequestOption) { Modal.confirm({ title: t('common.tipTitle'), - content: `确认要上传/变更用户头像吗?`, + content: t('views.account.settings.uploadTip'), onOk() { // 发送请求 const hide = message.loading(t('common.loading'), 0); @@ -101,7 +104,7 @@ function fnUpload(up: UploadRequestOption) { upState.value = false; hide(); if (res.code === RESULT_CODE_SUCCESS) { - message.success('头像上传/变更成功', 3); + message.success(t('views.account.settings.uploadOk'), 3); uerStore.setAvatar(res.data); } else { message.error(res.msg, 3); @@ -134,13 +137,13 @@ onMounted(() => { @@ -148,18 +151,18 @@ onMounted(() => { v-model:value="stateForm.form.nickName" allow-clear :maxlength="26" - placeholder="请输入用户昵称" + :placeholder="t('views.account.settings.nickPleace')" > @@ -167,18 +170,18 @@ onMounted(() => { v-model:value="stateForm.form.phonenumber" allow-clear :maxlength="11" - placeholder="请输入手机号码" + :placeholder="t('views.account.settings.phonenumberPleace')" > @@ -186,25 +189,21 @@ onMounted(() => { v-model:value="stateForm.form.email" allow-clear :maxlength="40" - placeholder="请输入电子邮箱" + :placeholder="t('views.account.settings.emailPleace')" > - + @@ -215,21 +214,27 @@ onMounted(() => { html-type="submit" :loading="stateForm.formClick" > - 确认修改 + {{ t('views.account.settings.submit') }} - 重置 + {{ t('views.account.settings.reset') }} - 请选择等比大小图片作为头像,如200x200、400x400 + + {{ + t('views.account.settings.uploadPleace', { + txt: '200x200、400x400', + }) + }} + { :custom-request="fnUpload" > - 上传/变更图片 + {{ t('views.account.settings.upload') }} diff --git a/src/views/account/components/reset-passwd.vue b/src/views/account/components/reset-passwd.vue index aa248ff4..5e15a71f 100644 --- a/src/views/account/components/reset-passwd.vue +++ b/src/views/account/components/reset-passwd.vue @@ -29,22 +29,22 @@ function fnEqualToPassword( callback: (error?: string) => void ) { if (!value) { - return Promise.reject('请输入确认新密码'); + return Promise.reject(t('views.account.settings.equalToPassword')); } if (state.form.oldPassword === value) { - return Promise.reject('与旧密码一致,请重新输入新密码'); + return Promise.reject(t('views.account.settings.equalToPasswordOld')); } if (state.form.newPassword === value) { return Promise.resolve(); } - return Promise.reject('两次输入的新密码不一致'); + return Promise.reject(t('views.account.settings.equalToPasswordErr')); } /**表单验证通过 */ function fnFinish() { Modal.confirm({ title: t('common.tipTitle'), - content: `确认要提交修改密码吗?`, + content: t('views.account.settings.submitTip'), onOk() { state.formClick = true; // 发送请求 @@ -54,8 +54,10 @@ function fnFinish() { if (res.code === RESULT_CODE_SUCCESS) { Modal.success({ title: t('common.tipTitle'), - content: `恭喜您,${userName} 账号密码修改成功!`, - okText: '重新登录', + content: t('views.account.settings.submitOkTip', { + num: userName, + }), + okText: t('views.account.settings.submitOk'), onOk() { fnLogOut().finally(() => router.push({ name: 'Login' })); }, @@ -82,20 +84,20 @@ function fnFinish() { @finish="fnFinish" >