From 70e98509689d16ea96a562dfe250e9de48edaeed Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Thu, 24 Jun 2021 12:35:26 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=85=AC=E5=85=B1=E9=93=BE=E6=8E=A5?= =?UTF-8?q?=E5=88=86=E4=BA=AB=E5=AF=86=E7=A0=81=E9=A1=B5=E9=9D=A2=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E8=A1=A8=E5=8D=95=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/lang/en.js | 7 +++ frontend/src/lang/tw.js | 7 +++ frontend/src/lang/zh.js | 7 +++ frontend/src/views/link/pwd/index.vue | 84 ++++++++++++++++----------- 4 files changed, 72 insertions(+), 33 deletions(-) diff --git a/frontend/src/lang/en.js b/frontend/src/lang/en.js index f61cbdcc22..30f2962361 100644 --- a/frontend/src/lang/en.js +++ b/frontend/src/lang/en.js @@ -871,6 +871,13 @@ export default { input_limit_2_25: '2-25 chars', input_limit_0_50: '0-50 chars' }, + pblink: { + key_pwd: 'Please enter the password to open the link', + input_placeholder: 'Please enter the 4-digit password', + pwd_error: 'Wrong password', + pwd_format_error: 'Please enter the 4-digit password', + sure_bt: 'Confirm' + }, panel: { no_auth_role: 'Unshared roles', auth_role: 'Shared roles', diff --git a/frontend/src/lang/tw.js b/frontend/src/lang/tw.js index 962c9e3e77..ef81334f33 100644 --- a/frontend/src/lang/tw.js +++ b/frontend/src/lang/tw.js @@ -871,6 +871,13 @@ export default { input_limit_2_25: '2-25字符', input_limit_0_50: '0-50字符' }, + pblink: { + key_pwd: '請輸入密碼打開鏈接', + input_placeholder: '請輸入4位數字密碼', + pwd_error: '密碼錯誤', + pwd_format_error: '請輸入4位數字密碼', + sure_bt: '確定' + }, panel: { no_auth_role: '未分享角色', auth_role: '已分享角色', diff --git a/frontend/src/lang/zh.js b/frontend/src/lang/zh.js index a7f0fa5671..799ee3af6a 100644 --- a/frontend/src/lang/zh.js +++ b/frontend/src/lang/zh.js @@ -871,6 +871,13 @@ export default { input_limit_2_25: '2-25字符', input_limit_0_50: '0-50字符' }, + pblink: { + key_pwd: '请输入密码打开链接', + input_placeholder: '请输入4位数字密码', + pwd_error: '密码错误', + pwd_format_error: '请输入4位数字密码', + sure_bt: '确定' + }, panel: { no_auth_role: '未分享角色', auth_role: '已分享角色', diff --git a/frontend/src/views/link/pwd/index.vue b/frontend/src/views/link/pwd/index.vue index b365faa011..9ce3dc973e 100644 --- a/frontend/src/views/link/pwd/index.vue +++ b/frontend/src/views/link/pwd/index.vue @@ -5,14 +5,18 @@
- 请输入密码打开链接 + {{ $t('pblink.key_pwd') }}
- + + + + +
@@ -22,7 +26,7 @@
- 确定 + {{ $t('pblink.sure_bt') }}
@@ -45,24 +49,38 @@ export default { }, data() { return { - pwd: null, - msg: null + msg: null, + form: { password: null }, + rule: { + password: [ + { required: true, message: this.$t('pblink.key_pwd'), trigger: 'blur' }, + { + required: true, + pattern: /^\d{4}$/, + message: this.$t('pblink.pwd_format_error'), + trigger: 'blur' + } + ] + } } }, methods: { // 验证密码是否正确 如果正确 设置请求头部带LINK-PWD-TOKEN=entrypt(pwd)再刷新页面 refresh() { - const param = { - password: encrypt(this.pwd), - resourceId: this.resourceId - } - validatePwd(param).then(res => { - if (!res.data) { - this.msg = '密码错误' - } else { - window.location.reload() + this.$refs.pwdForm.validate(valid => { + if (!valid) return false + const param = { + password: encrypt(this.form.password), + resourceId: this.resourceId } + validatePwd(param).then(res => { + if (!res.data) { + this.msg = this.$t('pblink.pwd_error') + } else { + window.location.reload() + } + }) }) } } @@ -145,25 +163,25 @@ export default { display: block; } .input-layout{ - width: 152px; + width: 200px; position: relative; margin: 0px auto; padding: 0; display: block; } .input-main { - width: 150px; - height: 30px; + width: 192px; + height: 35px; position: relative; margin-top: 30px; border: 1px solid #e8eaed; display: block; } - .div-input { - inset: 2px 4px; - position: absolute; - display: block; - } + // .div-input { + // inset: 2px 4px; + // position: absolute; + // display: block; + // } .abs-input { height: 20px; position: relative; @@ -183,18 +201,18 @@ export default { color: #E65251; box-sizing: border-box; } - .real-input { - width: 100%; - height: 100%; - border: none; - outline: none; - padding: 0px; - margin: 0px; - inset: 0px; - position: absolute; - display: block; + // .real-input { + // width: 100%; + // height: 100%; + // border: none; + // outline: none; + // padding: 0px; + // margin: 0px; + // inset: 0px; + // position: absolute; + // display: block; - } + // } .auth-root-class { margin: 15px 0px 5px; text-align: center;