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