feat: There is no way the, 注释

This commit is contained in:
super_liu
2022-04-24 10:40:02 +08:00
parent 204253cf0f
commit 0c647203c5
+100 -100
View File
@@ -225,109 +225,109 @@ export default {
}
},
mounted() {
this.setTheme(this.getTheme)
//实现对字符码的截获,keypress中屏蔽了这些功能按键
document.onkeypress = this.banBackSpace
//对功能按键的获取
document.onkeydown = this.banBackSpace
this.visibilitychangeFn = (e) => { //这个方法是监测浏览器窗口发生变化的时候执行
// 切换到当前页面
if (document.hidden == false) {
const userInfoModifyTime = this.userInfoModifyTime
const userInfoModifyTimeInLocalStorage = localStorage.getItem('userInfoModifyTime')
// 用户未切换 不执行任何操作
if (userInfoModifyTime === userInfoModifyTimeInLocalStorage) {
return
}
if (userInfoModifyTimeInLocalStorage === null && webLoginType === 'idm') {
this.$store.dispatch('syncStorageData')
const currentPage = this.$route.name
if (currentPage === 'Login') {
return
}
this.currentMinute = 3
this.loading && this.loading.close()
this.loading = this.$loading({
lock: true,
// text: 'Loading',
// spinner: 'el-icon-loading',
// background: 'rgba(0, 0, 0, 0.7)'
});
this.messageForLogin && this.messageForLogin.close()
this.messageForLogin = this.$message({
message: `用户已退出,${this.currentMinute}秒后将跳转到登录1页面`,
type: 'warning'
})
this.intervalForLogin = setInterval(() => {
if (this.currentMinute === 0) {
clearInterval(this.intervalForLogin)
this.loading.close()
this.$router.push('/login')
console.log('切换到登录页面', currentPage)
}
this.currentMinute--
this.messageForLogin.message = `用户已退出,${this.currentMinute}秒后将跳转到登录页面`
}, 0)
} else if (userInfoModifyTime !== userInfoModifyTimeInLocalStorage && webLoginType === 'idm') {
this.$store.dispatch('syncStorageData')
console.log('用户信息已更改,同步数据')
this.currentMinute = 3
this.loading && this.loading.close()
this.loading = this.$loading({
lock: true,
// text: 'Loading',
// spinner: 'el-icon-loading',
// background: 'rgba(0, 0, 0, 0.7)'
});
this.messageForHome && this.messageForHome.close()
this.messageForHome = this.$message({
message: `用户已切换,${this.currentMinute}秒后将跳转到用户首页`,
type: 'warning'
})
this.intervalForHome = setInterval(() => {
if (this.currentMinute === 0) {
clearInterval(this.intervalForHome)
this.loading.close()
this.$router.push({
path: '/redirect',
query: '/home2'
})
}
this.currentMinute--
this.messageForHome.message = `用户已切换,${this.currentMinute}秒后将跳转到用户首页`
}, 1000)
// const route = this.$router.resolve('/home')
// this.$router.push({
// path: '/redirect',
// query: '/home'
// })
// location.reload();
}
}
}
document.addEventListener('visibilitychange', this.visibilitychangeFn);
// this.setTheme(this.getTheme)
// //实现对字符码的截获,keypress中屏蔽了这些功能按键
// document.onkeypress = this.banBackSpace
// //对功能按键的获取
// document.onkeydown = this.banBackSpace
// this.visibilitychangeFn = (e) => { //这个方法是监测浏览器窗口发生变化的时候执行
// // 切换到当前页面
// if (document.hidden == false) {
// const userInfoModifyTime = this.userInfoModifyTime
// const userInfoModifyTimeInLocalStorage = localStorage.getItem('userInfoModifyTime')
//
// // 用户未切换 不执行任何操作
// if (userInfoModifyTime === userInfoModifyTimeInLocalStorage) {
// return
// }
//
// if (userInfoModifyTimeInLocalStorage === null && webLoginType === 'idm') {
// this.$store.dispatch('syncStorageData')
//
// const currentPage = this.$route.name
// if (currentPage === 'Login') {
// return
// }
// this.currentMinute = 3
// this.loading && this.loading.close()
// this.loading = this.$loading({
// lock: true,
// // text: 'Loading',
// // spinner: 'el-icon-loading',
// // background: 'rgba(0, 0, 0, 0.7)'
// });
// this.messageForLogin && this.messageForLogin.close()
// this.messageForLogin = this.$message({
// message: `用户已退出,${this.currentMinute}秒后将跳转到登录1页面`,
// type: 'warning'
// })
//
//
// this.intervalForLogin = setInterval(() => {
// if (this.currentMinute === 0) {
// clearInterval(this.intervalForLogin)
// this.loading.close()
//
// this.$router.push('/login')
// console.log('切换到登录页面', currentPage)
// }
// this.currentMinute--
// this.messageForLogin.message = `用户已退出,${this.currentMinute}秒后将跳转到登录页面`
// }, 0)
//
// } else if (userInfoModifyTime !== userInfoModifyTimeInLocalStorage && webLoginType === 'idm') {
// this.$store.dispatch('syncStorageData')
//
// console.log('用户信息已更改,同步数据')
//
// this.currentMinute = 3
//
// this.loading && this.loading.close()
// this.loading = this.$loading({
// lock: true,
// // text: 'Loading',
// // spinner: 'el-icon-loading',
// // background: 'rgba(0, 0, 0, 0.7)'
// });
//
// this.messageForHome && this.messageForHome.close()
// this.messageForHome = this.$message({
// message: `用户已切换,${this.currentMinute}秒后将跳转到用户首页`,
// type: 'warning'
// })
// this.intervalForHome = setInterval(() => {
// if (this.currentMinute === 0) {
// clearInterval(this.intervalForHome)
// this.loading.close()
//
// this.$router.push({
// path: '/redirect',
// query: '/home2'
// })
// }
// this.currentMinute--
// this.messageForHome.message = `用户已切换,${this.currentMinute}秒后将跳转到用户首页`
// }, 1000)
//
// // const route = this.$router.resolve('/home')
// // this.$router.push({
// // path: '/redirect',
// // query: '/home'
// // })
// // location.reload();
// }
//
// }
// }
// document.addEventListener('visibilitychange', this.visibilitychangeFn);
},
beforeDestroy() {
document.onkeypress = null
document.onkeydown = null
document.removeEventListener('visibilitychange', this.visibilitychangeFn)
clearInterval(this.intervalForLogin)
clearInterval(this.intervalForHome)
// document.onkeypress = null
// document.onkeydown = null
// document.removeEventListener('visibilitychange', this.visibilitychangeFn)
// clearInterval(this.intervalForLogin)
// clearInterval(this.intervalForHome)
}
}
</script>