2021-03-25 18:58:05 +08:00
|
|
|
<template>
|
2021-03-26 18:44:41 +08:00
|
|
|
<div class="pwd-body">
|
|
|
|
<div class="pwd-wrapper">
|
|
|
|
<div class="pwd-content">
|
|
|
|
|
|
|
|
<div class="span-header">
|
|
|
|
<div class="bi-text">
|
2021-06-24 12:35:26 +08:00
|
|
|
{{ $t('pblink.key_pwd') }}
|
2021-03-26 18:44:41 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="input-layout">
|
|
|
|
<div class="input-main">
|
|
|
|
<div class="div-input">
|
2021-06-24 12:35:26 +08:00
|
|
|
<el-form ref="pwdForm" :model="form" :rules="rule" size="small">
|
|
|
|
<el-form-item prop="password">
|
|
|
|
<el-input v-model="form.password" maxlength="4" show-password class="real-input" :placeholder="$t('pblink.input_placeholder')" />
|
|
|
|
</el-form-item>
|
|
|
|
</el-form>
|
2021-03-26 18:44:41 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="abs-input">
|
|
|
|
<div class="input-text">{{ msg }}</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="auth-root-class">
|
|
|
|
<span slot="footer">
|
2021-06-24 12:35:26 +08:00
|
|
|
<el-button size="mini" type="primary" @click="refresh">{{ $t('pblink.sure_bt') }}</el-button>
|
2021-03-26 18:44:41 +08:00
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
2021-03-25 18:58:05 +08:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2021-03-26 18:44:41 +08:00
|
|
|
import { validatePwd } from '@/api/link'
|
2021-03-29 14:15:39 +08:00
|
|
|
import { encrypt } from '@/utils/rsaEncrypt'
|
|
|
|
|
2021-03-25 18:58:05 +08:00
|
|
|
export default {
|
|
|
|
name: 'LinkPwd',
|
2021-03-26 18:44:41 +08:00
|
|
|
props: {
|
|
|
|
resourceId: {
|
|
|
|
type: String,
|
|
|
|
default: null
|
|
|
|
}
|
|
|
|
},
|
2021-03-25 18:58:05 +08:00
|
|
|
data() {
|
|
|
|
return {
|
2021-06-24 12:35:26 +08:00
|
|
|
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'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
2021-03-25 18:58:05 +08:00
|
|
|
}
|
|
|
|
},
|
2021-03-29 14:15:39 +08:00
|
|
|
|
2021-03-25 18:58:05 +08:00
|
|
|
methods: {
|
2021-03-26 18:44:41 +08:00
|
|
|
// 验证密码是否正确 如果正确 设置请求头部带LINK-PWD-TOKEN=entrypt(pwd)再刷新页面
|
|
|
|
refresh() {
|
2021-06-24 12:35:26 +08:00
|
|
|
this.$refs.pwdForm.validate(valid => {
|
|
|
|
if (!valid) return false
|
|
|
|
const param = {
|
|
|
|
password: encrypt(this.form.password),
|
|
|
|
resourceId: this.resourceId
|
2021-03-26 18:44:41 +08:00
|
|
|
}
|
2021-06-24 12:35:26 +08:00
|
|
|
validatePwd(param).then(res => {
|
|
|
|
if (!res.data) {
|
|
|
|
this.msg = this.$t('pblink.pwd_error')
|
|
|
|
} else {
|
|
|
|
window.location.reload()
|
|
|
|
}
|
|
|
|
})
|
2021-03-26 18:44:41 +08:00
|
|
|
})
|
|
|
|
}
|
2021-03-25 18:58:05 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
2021-03-26 18:44:41 +08:00
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.pwd-body {
|
|
|
|
position: absolute;
|
|
|
|
width: 100%;
|
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
background-repeat: repeat;
|
|
|
|
-webkit-user-select: none;
|
|
|
|
-moz-user-select: none;
|
|
|
|
-ms-user-select: none;
|
|
|
|
-o-user-select: none;
|
|
|
|
user-select: none;
|
|
|
|
color: #3d4d66;
|
|
|
|
font: normal 12px Helvetica Neue,Arial,PingFang SC,Hiragino Sans GB,Microsoft YaHei,微软雅黑,Heiti,黑体,sans-serif;
|
|
|
|
-webkit-font-smoothing: antialiased;
|
|
|
|
-moz-osx-font-smoothing: grayscale;
|
|
|
|
text-decoration: none;
|
|
|
|
-kthml-user-focus: normal;
|
|
|
|
-moz-user-focus: normal;
|
|
|
|
-moz-outline: 0 none;
|
|
|
|
outline: 0 none;
|
|
|
|
height: 100%;
|
|
|
|
display: block;
|
|
|
|
}
|
|
|
|
.pwd-wrapper {
|
|
|
|
background-color: #F7F8FA;
|
|
|
|
height: 100%;
|
|
|
|
justify-content: center !important;
|
|
|
|
align-items: center !important;
|
|
|
|
min-height: 25px;
|
|
|
|
display: flex;
|
|
|
|
-moz-flex-direction: row;
|
|
|
|
-o-flex-direction: row;
|
|
|
|
flex-direction: row;
|
|
|
|
-moz-justify-content: flex-start;
|
|
|
|
-ms-justify-content: flex-start;
|
|
|
|
-o-justify-content: flex-start;
|
|
|
|
justify-content: flex-start;
|
|
|
|
-moz-align-items: flex-start;
|
|
|
|
-ms-align-items: flex-start;
|
|
|
|
-o-align-items: flex-start;
|
|
|
|
align-items: flex-start;
|
|
|
|
-o-flex-wrap: nowrap;
|
|
|
|
flex-wrap: nowrap;
|
|
|
|
}
|
|
|
|
.pwd-content {
|
|
|
|
width: 450px;
|
|
|
|
height: 250px;
|
|
|
|
position: relative;
|
|
|
|
flex-shrink: 0;
|
|
|
|
background-color: #FFFFFF;
|
|
|
|
display: block;
|
|
|
|
}
|
|
|
|
.span-header {
|
|
|
|
position: relative;
|
|
|
|
margin: 57px auto 0px;
|
|
|
|
justify-content: center !important;
|
|
|
|
align-items: center !important;
|
|
|
|
}
|
|
|
|
.bi-text {
|
|
|
|
max-width: 100%;
|
|
|
|
text-align: center;
|
|
|
|
white-space: pre;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
position: relative;
|
|
|
|
flex-shrink: 0;
|
|
|
|
box-sizing: border-box;
|
|
|
|
overflow: hidden;
|
|
|
|
overflow-x: hidden;
|
|
|
|
overflow-y: hidden;
|
|
|
|
word-break: break-all;
|
|
|
|
display: block;
|
|
|
|
}
|
|
|
|
.input-layout{
|
2021-06-24 12:35:26 +08:00
|
|
|
width: 200px;
|
2021-03-26 18:44:41 +08:00
|
|
|
position: relative;
|
|
|
|
margin: 0px auto;
|
|
|
|
padding: 0;
|
|
|
|
display: block;
|
|
|
|
}
|
|
|
|
.input-main {
|
2021-06-24 12:35:26 +08:00
|
|
|
width: 192px;
|
|
|
|
height: 35px;
|
2021-03-26 18:44:41 +08:00
|
|
|
position: relative;
|
|
|
|
margin-top: 30px;
|
|
|
|
border: 1px solid #e8eaed;
|
|
|
|
display: block;
|
|
|
|
}
|
2021-06-24 12:35:26 +08:00
|
|
|
// .div-input {
|
|
|
|
// inset: 2px 4px;
|
|
|
|
// position: absolute;
|
|
|
|
// display: block;
|
|
|
|
// }
|
2021-03-26 18:44:41 +08:00
|
|
|
.abs-input {
|
|
|
|
height: 20px;
|
|
|
|
position: relative;
|
|
|
|
margin-top: 5px;
|
|
|
|
display: block;
|
|
|
|
}
|
|
|
|
.input-text {
|
|
|
|
height: 20px;
|
|
|
|
line-height: 20px;
|
|
|
|
text-align: center;
|
|
|
|
white-space: pre;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
left: 0px;
|
|
|
|
top: 0px;
|
|
|
|
bottom: 0px;
|
|
|
|
position: absolute;
|
|
|
|
color: #E65251;
|
|
|
|
box-sizing: border-box;
|
|
|
|
}
|
2021-06-24 12:35:26 +08:00
|
|
|
// .real-input {
|
|
|
|
// width: 100%;
|
|
|
|
// height: 100%;
|
|
|
|
// border: none;
|
|
|
|
// outline: none;
|
|
|
|
// padding: 0px;
|
|
|
|
// margin: 0px;
|
|
|
|
// inset: 0px;
|
|
|
|
// position: absolute;
|
|
|
|
// display: block;
|
2021-03-26 18:44:41 +08:00
|
|
|
|
2021-06-24 12:35:26 +08:00
|
|
|
// }
|
2021-03-26 18:44:41 +08:00
|
|
|
.auth-root-class {
|
|
|
|
margin: 15px 0px 5px;
|
|
|
|
text-align: center;
|
|
|
|
}
|
|
|
|
|
|
|
|
</style>
|