Skip to content

Commit

Permalink
Merge pull request #43 from putianyi889/patch-34
Browse files Browse the repository at this point in the history
登录表单反馈的本地化
  • Loading branch information
eee555 authored Jun 6, 2024
2 parents 33a322c + 4c96c4d commit 30f8102
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 30 deletions.
38 changes: 19 additions & 19 deletions front_end/src/components/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
minlength="6" maxlength="20"></el-input>
</el-form-item>
<el-form-item>
<div style="color: red;">{{ hint_message }}</div>
<div style="color: red;">{{ $t(hint_message) }}</div>
</el-form-item>
<el-form-item>
<el-button
Expand Down Expand Up @@ -302,15 +302,15 @@ const login = async () => {
const retrieve = () => {
if (!user_email_reg.value) {
hint_message.value = "请输入邮箱!";
hint_message.value = "common.msg.emptyEmail";
return
}
if (!user_password_reg.value) {
hint_message.value = "请输入密码!";
hint_message.value = "common.msg.emptyPassword";
return
}
if (user_password_reg.value != user_password2_reg.value) {
hint_message.value = "两次输入的密码不一致!";
hint_message.value = "common.msg.confirmPasswordFail";
return
}
var user_params = new URLSearchParams()
Expand All @@ -332,7 +332,7 @@ const retrieve = () => {
store.player = response.data.msg;
emit('login'); // 向父组件发送消息
retrieve_visible.value = false;
ElMessage.success({ message: '修改密码成功!', offset: 68 });
ElMessage.success({ message: t.t('common.msg.forgetPassword.success'), offset: 68 });
} else if (response.data.status >= 101) {
hint_message.value = response.data.msg;
}
Expand All @@ -341,48 +341,48 @@ const retrieve = () => {
const register = () => {
if (!user_name_reg.value) {
hint_message.value = "请输入用户名!";
hint_message.value = "common.msg.emptyUsername";
return
}
if (!user_email_reg.value) {
hint_message.value = "请输入邮箱!";
hint_message.value = "common.msg.emptyEmail";
return
}
if (user_email_valid_code_reg.value.length != 6) {
hint_message.value = "请输入6位邮箱验证码!";
hint_message.value = "common.msg.emptyEmailCode";
return
}
if (!user_password_reg.value) {
hint_message.value = "请输入密码!";
hint_message.value = "common.msg.emptyPassword";
return
}
if (user_password_reg.value != user_password2_reg.value) {
hint_message.value = "两次输入的密码不一致!";
hint_message.value = "common.msg.confirmPasswordFail";
return
}
if (!checkout_user_agreement.value) {
hint_message.value = "请同意用户协议!";
hint_message.value = "common.msg.agreeTAC";
return
}
const email_form = document.getElementById('register_email_form') as HTMLInputElement;
if (!email_form.checkValidity()) {
hint_message.value = "邮箱格式不正确!";
hint_message.value = "common.msg.invalidEmail";
return
}
const user_name_form = document.getElementById('register_user_name_form') as HTMLInputElement;
if (!user_name_form.checkValidity()) {
// 不可能进来
hint_message.value = "用户名格式不正确!长度不超过20位。";
hint_message.value = "common.msg.invalidUsername";
return
}
const email_valid_code_form = document.getElementById('register_email_valid_code_form') as HTMLInputElement;
if (!email_valid_code_form.checkValidity()) {
hint_message.value = "邮箱验证码格式不正确!请点击邮箱验证码并打开邮箱查收。";
hint_message.value = "common.msg.invalidEmailCode";
return
}
const user_password_form = document.getElementById('register_user_password_form') as HTMLInputElement;
if (!user_password_form.checkValidity()) {
hint_message.value = "密码格式不正确!长度应该为6-20位。";
hint_message.value = "common.msg.invalidPassword";
return
}
var user_params = new URLSearchParams()
Expand Down Expand Up @@ -440,12 +440,12 @@ const logout = async () => {
country: ""
};
emit('logout'); // 向父组件发送消息
ElMessage.success({ message: '退出成果!', offset: 68 });
ElMessage.success({ message: t.t('common.msg.logoutSuccess'), offset: 68 });
register_visible.value = false;
login_visible.value = false;
retrieve_visible.value = false;
} else if (response.data.status >= 101) {
ElMessage.error({ message: '退出失败!', offset: 68 });
ElMessage.error({ message: t.t('common.msg.logoutFail'), offset: 68 });
}
}).catch(function (error) {
// console.log("eee:" + error);
Expand All @@ -455,7 +455,7 @@ const logout = async () => {
const get_email_captcha = (type: string) => {
if (!user_email_reg.value) {
hint_message.value = "请输入邮箱!";
hint_message.value = "common.msg.emptyEmail";
return
}
var params = new URLSearchParams()
Expand All @@ -475,7 +475,7 @@ const get_email_captcha = (type: string) => {
if (response.data.status == 100) {
hint_message.value = ""
email_key = response.data.hashkey;
ElMessage.success({ message: '获取验证码成功,请至邮箱查看!', offset: 68 });
ElMessage.success({ message: t.t('common.msg.emailCodeSent'), offset: 68 });
} else if (response.data.status > 100) {
hint_message.value = "*" + response.data.msg;
refValidCode2.value!.refreshPic();
Expand Down
10 changes: 5 additions & 5 deletions front_end/src/components/VideoList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -198,19 +198,19 @@ const handleFreeze = async function (row: any) {
let status = await freeze(proxy, row.key);
if (status == 'True') {
ElNotification({
title: '审核成功',
message: '录像已通过审核',
title: '冻结成功',
message: '录像已冻结',
type: 'success',
})
} else if (status == 'False') {
ElNotification({
title: '审核失败',
message: '录像已通过审核',
title: '冻结失败',
message: '录像已冻结',
type: 'warning',
})
} else {
ElNotification({
title: '审核失败',
title: '冻结失败',
message: '发生未知错误: status=' + status,
type: 'error',
})
Expand Down
26 changes: 20 additions & 6 deletions front_end/src/i18n/locales/zh-cn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,32 @@ export const zhCn = {
upload_time: '上传时间',
},
msg: {
connectionFail: '无法连接到服务器!'
agreeTAC: '请同意用户协议!',
confirmPasswordFail: '两次输入的密码不一致!',
connectionFail: '无法连接到服务器!',
emailCodeSent: '获取验证码成功,请至邮箱查看!',
emptyEmail: '请输入邮箱!',
emptyEmailCode: '请输入6位邮箱验证码!',
emptyPassword: '请输入密码!',
emptyUsername: '请输入用户名!',
invalidEmail: '邮箱格式不正确!',
invalidEmailCode: '邮箱验证码格式不正确!请点击邮箱验证码并打开邮箱查收。',
invalidPassword: '密码格式不正确!长度应该为6-20位。',
invalidUsername: '用户名格式不正确!长度不超过20位。',
logoutFail: '退出失败!',
logoutSuccess: '退出成功!',
}
},
forgetPassword: {
title: '找回密码',
email: '请输入邮箱',
captcha: '验证码',
getEmailCode: '获取邮箱验证码',
confirm: '确认修改密码',
confirmPassword: '请输入确认密码',
email: '请输入邮箱',
emailCode: '请输入邮箱验证码',
getEmailCode: '获取邮箱验证码',
password: '请输入新的6-20位密码',
confirmPassword: '请输入确认密码',
confirm: '确认修改密码'
success: '修改密码成功!',
},
login: {
title: '欢迎登录',
Expand Down Expand Up @@ -119,6 +133,6 @@ export const zhCn = {
confirmPassword: '请输入确认密码',
agreeTo: '已阅读并同意',
termsAndConditions: '元扫雷网用户协议',
confirm: '注册'
confirm: '注册',
},
}

0 comments on commit 30f8102

Please sign in to comment.