更新 Web/src/layout/lockScreen/index.vue
锁屏后,刷新页面后window.__env__.VITE_SM_PUBLIC_KEY保存的公钥就会丢失,就没办法解锁。已经修复
This commit is contained in:
parent
c104298874
commit
fe4300256f
@ -36,7 +36,14 @@
|
|||||||
<el-button style="max-width: 80px; margin-top: 20px" size="default" @click="hideMessage"> 确认 </el-button>
|
<el-button style="max-width: 80px; margin-top: 20px" size="default" @click="hideMessage"> 确认 </el-button>
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="layout-lock-screen-login-box-value">
|
<div v-else class="layout-lock-screen-login-box-value">
|
||||||
<el-input placeholder="请输入密码" :type="state.isShowPassword ? 'text' : 'password'" ref="layoutLockScreenInputRef" size="default" v-model="state.lockScreenPassword" @keyup.enter.native.stop="onLockScreenSubmit()">
|
<el-input
|
||||||
|
placeholder="请输入密码"
|
||||||
|
:type="state.isShowPassword ? 'text' : 'password'"
|
||||||
|
ref="layoutLockScreenInputRef"
|
||||||
|
size="default"
|
||||||
|
v-model="state.lockScreenPassword"
|
||||||
|
@keyup.enter.native.stop="onLockScreenSubmit()"
|
||||||
|
>
|
||||||
<template #append>
|
<template #append>
|
||||||
<el-button @click="onLockScreenSubmit">
|
<el-button @click="onLockScreenSubmit">
|
||||||
<el-icon class="el-input__icon">
|
<el-icon class="el-input__icon">
|
||||||
@ -45,7 +52,11 @@
|
|||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
<template #suffix>
|
<template #suffix>
|
||||||
<i class="iconfont el-input__icon login-content-password" :class="state.isShowPassword ? 'icon-yincangmima' : 'icon-xianshimima'" @click="state.isShowPassword = !state.isShowPassword">
|
<i
|
||||||
|
class="iconfont el-input__icon login-content-password"
|
||||||
|
:class="state.isShowPassword ? 'icon-yincangmima' : 'icon-xianshimima'"
|
||||||
|
@click="state.isShowPassword = !state.isShowPassword"
|
||||||
|
>
|
||||||
</i>
|
</i>
|
||||||
</template>
|
</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
@ -72,7 +83,8 @@ import { useUserInfo } from '/@/stores/userInfo';
|
|||||||
import { sm2 } from 'sm-crypto-v2';
|
import { sm2 } from 'sm-crypto-v2';
|
||||||
import { feature, getAPI } from '/@/utils/axios-utils';
|
import { feature, getAPI } from '/@/utils/axios-utils';
|
||||||
import { SysAuthApi } from '/@/api-services';
|
import { SysAuthApi } from '/@/api-services';
|
||||||
|
import { useRoute } from 'vue-router';
|
||||||
|
import { loadSysInfo } from '/@/utils/sysInfo';
|
||||||
// 定义变量内容
|
// 定义变量内容
|
||||||
const layoutLockScreenDateRef = ref<HtmlType>();
|
const layoutLockScreenDateRef = ref<HtmlType>();
|
||||||
const layoutLockScreenInputRef = ref();
|
const layoutLockScreenInputRef = ref();
|
||||||
@ -100,7 +112,7 @@ const state = reactive({
|
|||||||
showMessage: false,
|
showMessage: false,
|
||||||
isShowPassword: false,
|
isShowPassword: false,
|
||||||
});
|
});
|
||||||
|
const route = useRoute();
|
||||||
// 鼠标按下 pc
|
// 鼠标按下 pc
|
||||||
const onDownPc = (down: MouseEvent) => {
|
const onDownPc = (down: MouseEvent) => {
|
||||||
state.isFlags = true;
|
state.isFlags = true;
|
||||||
@ -205,9 +217,10 @@ const onLockScreenSubmit = async () => {
|
|||||||
setLocalThemeConfig();
|
setLocalThemeConfig();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
console.log('userInfos', userInfos);
|
||||||
// SM2加密密码
|
// SM2加密密码
|
||||||
const publicKey = window.__env__.VITE_SM_PUBLIC_KEY;
|
const publicKey = window.__env__.VITE_SM_PUBLIC_KEY;
|
||||||
|
console.log('publicKey', publicKey);
|
||||||
const password = sm2.doEncrypt(state.lockScreenPassword, publicKey, 1);
|
const password = sm2.doEncrypt(state.lockScreenPassword, publicKey, 1);
|
||||||
const [err, res] = await feature(getAPI(SysAuthApi).apiSysAuthUnLockScreenPost(password));
|
const [err, res] = await feature(getAPI(SysAuthApi).apiSysAuthUnLockScreenPost(password));
|
||||||
if (err) {
|
if (err) {
|
||||||
@ -235,11 +248,18 @@ const hideMessage = () => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
// 页面加载时
|
// 页面加载时
|
||||||
onMounted(() => {
|
onMounted(async() => {
|
||||||
initGetElement();
|
initGetElement();
|
||||||
initSetTime();
|
initSetTime();
|
||||||
initLockScreen();
|
initLockScreen();
|
||||||
|
// 获取租户Id标识
|
||||||
|
var tenantid = Number(route.query.tid);
|
||||||
|
if (isNaN(tenantid)) {
|
||||||
|
tenantid = 0;
|
||||||
|
} else if (tenantid > 99999) {
|
||||||
|
Local.set('tid', tenantid);
|
||||||
|
}
|
||||||
|
await loadSysInfo(tenantid);
|
||||||
// 侦听ENTER按钮事件
|
// 侦听ENTER按钮事件
|
||||||
document.onkeydown = (e) => {
|
document.onkeydown = (e) => {
|
||||||
if (e.key === 'Enter') {
|
if (e.key === 'Enter') {
|
||||||
@ -263,7 +283,6 @@ onUnmounted(() => {
|
|||||||
window.clearInterval(state.setIntervalTime);
|
window.clearInterval(state.setIntervalTime);
|
||||||
window.clearInterval(state.isShowLockScreenIntervalTime);
|
window.clearInterval(state.isShowLockScreenIntervalTime);
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user