i18n develop: login page

This commit is contained in:
LazyCreeper 2022-07-28 21:29:37 +08:00
parent c969813026
commit a160355576
2 changed files with 38 additions and 18 deletions

View File

@ -41,8 +41,8 @@
<Panel id="login-panel" body-style="padding:44px;" v-loading="loading">
<template #default>
<form action="/login" method="post">
<div style="font-size: 24px; font-weight: 600">身份验证</div>
<p>使用服务器的 MCSManager 账号登录到面板</p>
<div style="font-size: 24px; font-weight: 600">{{ $t("login.title") }}</div>
<p>{{ $t("login.titleInfo") }}</p>
<form action="/" method="post">
<div style="margin-top: 22px">
<div>
@ -50,7 +50,7 @@
type="text"
name="mcsm_username"
v-model="form.username"
placeholder="账号"
:placeholder="$t('login.account')"
autocomplete="on"
:disabled="close"
@keyup.enter="submit"
@ -65,7 +65,7 @@
type="password"
name="mcsm_password"
v-model="form.password"
placeholder="密码"
:placeholder="$t('login.passWord')"
autocomplete="on"
:disabled="close"
@keyup.enter="submit"
@ -79,7 +79,7 @@
<transition name="fade">
<div v-if="cause" id="login-cause">{{ cause }}</div>
<div v-else class="login-info-wrapper fgp" @click="forgotPassword">
<a href="javascript:void(0)" rel="noopener noreferrer"> 忘记密码 </a>
<a href="javascript:void(0)" rel="noopener noreferrer"> {{ $t("login.forgotPassword") }} </a>
</div>
</transition>
<el-button
@ -153,7 +153,7 @@ export default {
},
close: false,
closeWindow: false,
loginText: "登录",
loginText: this.$t("login.login"),
loading: false,
cause: "",
loginInfo: ""
@ -168,11 +168,11 @@ export default {
async login() {
try {
if (!this.form.username || !this.form.username) {
throw new Error("账号或密码不能为空值");
throw new Error("");
}
this.loading = true;
this.cause = "";
this.loginText = "登录中";
this.cause = this.$t("login.isNull");
this.loginText = this.$t("login.logging");
await sleep(600);
const res = await request({
method: "POST",
@ -195,9 +195,9 @@ export default {
async failed(error) {
this.cause = error.message;
if (this.cause == "null") {
this.cause = "账号或密码错误,请检查后重试";
this.cause = this.$t("login.errorUOrP");
}
this.loginText = "重新登录";
this.loginText = this.$t("login.logBackIn");
this.close = true;
await sleep(400);
this.close = false;
@ -206,13 +206,13 @@ export default {
async success() {
this.close = true;
this.closeWindow = true;
this.loginText = "登录成功";
this.loginText = this.$t("login.loginSuccess");
try {
await setupUserInfo();
} catch (error) {
this.$notify({
title: "网页无法正确运作",
message: "无法获取身份数据,网页所有功能将全部不可用,请立刻刷新网页或重新登录",
title: this.$t("login.notify.title"),
message: this.$t("login.notify.message"),
type: "error",
duration: 0
});
@ -231,11 +231,11 @@ export default {
},
forgotPassword() {
this.$confirm(
`如果您是管理员且第一次登录默认账号密码为root123456。如果您是普通用户请要求您的服务商帮助您重置密码。如果您是管理员请删除 mcsmanager/web/data/Users 文件夹重启面板端以重新加载用户。`,
"忘记密码",
this.$t("login.forgotPasswordInfo"),
this.$t("login.forgotPassword"),
{
confirmButtonText: "好的",
cancelButtonText: "关闭"
confirmButtonText: this.$t("general.confirm"),
cancelButtonText: this.$t("general.closed")
}
);
}

View File

@ -19,6 +19,26 @@ export default {
allow: "准许",
forbid: "禁止",
enable: "启用",
closed: "关闭",
},
login: {
title: "身份验证",
titleInfo: "使用服务器的 MCSManager 账号登录到面板",
account: "账号",
passWord: "密码",
forgotPassword: "忘记密码",
forgotPasswordInfo: "如果您是管理员且第一次登录默认账号密码为root123456。如果您是普通用户请要求您的服务商帮助您重置密码。如果您是管理员请删除 mcsmanager/web/data/Users 文件夹重启面板端以重新加载用户。",
login: "登录",
logging: "登录中",
isNull: "账号或密码不能为空值",
errorUOrP: "账号或密码错误,请检查后重试",
logBackIn: "重新登录",
loginSuccess: "登录成功",
notify: {
title: "网页无法正确运作",
message: "无法获取身份数据,网页所有功能将全部不可用,请立刻刷新网页或重新登录",
},
},
overview: {
systemInfoTable: "系统信息表",