emis-frontend/src/components/LockScreen/locking-page.vue

67 lines
1.8 KiB
Vue
Raw Normal View History

2024-06-17 10:53:52 +00:00
<template>
<div style="width: 100%;height: 100%;background: rgb(16, 22, 44)">
<div class="unlock-con"
style="z-index:10000">
<unlock :show-unlock="showUnlock"
@on-unlock="handleUnlock"
@on-unlockFalse="handleUnlockFalse"></unlock>
</div>
</div>
</template>
<script>
import unlock from './unlock.vue';
import Cookies from 'js-cookie';
export default {
components: {
unlock
},
data () {
return {
showUnlock: false
};
},
methods: {
handleUnlock () {
let lockScreenBack = document.getElementById('lock_screen_back');
this.showUnlock = false;
lockScreenBack.style.zIndex = 1005;
lockScreenBack.style.boxShadow = '0 0 0 0 #667aa6 inset';
this.$router.push({
path: Cookies.get('pageRoute') // 解锁之后跳转到锁屏之前的页面
});
}
,
handleUnlockFalse () {
let lockScreenBack = document.getElementById('lock_screen_back');
this.showUnlock = false;
lockScreenBack.style.zIndex = 1005;
lockScreenBack.style.boxShadow = '0 0 0 0 #667aa6 inset';
sessionStorage.clear()
localStorage.clear()
this.$router.push({
name: 'login'
});
window.document.title = '登录'
}
},
mounted () {
this.showUnlock = true;
history.pushState(null, null, document.URL);
window.addEventListener('popstate', function () {
history.pushState(null, null, document.URL);
});
if (!document.getElementById('lock_screen_back')) {
let lockdiv = document.createElement('div');
lockdiv.setAttribute('id', 'lock_screen_back');
lockdiv.setAttribute('class', 'lock-screen-back');
document.body.appendChild(lockdiv);
}
let lockScreenBack = document.getElementById('lock_screen_back');
lockScreenBack.style.zIndex = 1005;
}
}
</script>