|
@@ -15,45 +15,60 @@ export default {
|
|
|
document.getElementById("app").oncontextmenu = function (e) {
|
|
|
return false;
|
|
|
};
|
|
|
- // this.$nextTick(()=>{
|
|
|
- // document.onkeydown = function (e){
|
|
|
- // if (e && e.keyCode === 123){
|
|
|
- // e.returnValue = false;
|
|
|
- // return false;
|
|
|
- // }
|
|
|
- //
|
|
|
+
|
|
|
+ // window.addEventListener("beforeunload", e => {
|
|
|
+ // this.beforeunloadHandler(e)
|
|
|
+ // let userAgent = navigator.userAgent
|
|
|
+ // let isOpera = userAgent.indexOf("Opera") > -1;
|
|
|
+ // if (isOpera) { //判断是否Opera浏览器
|
|
|
+ // return "Opera"
|
|
|
+ // }
|
|
|
+ // if (userAgent.indexOf("Firefox") > -1) {
|
|
|
+ // this.unloadHandler();
|
|
|
// }
|
|
|
- //
|
|
|
- // })
|
|
|
- // window.addEventListener('beforeunload', e => this.beforeunloadHandler(e))
|
|
|
- // window.addEventListener('unload', e => this.unloadHandler(e))
|
|
|
+ // if (userAgent.indexOf("MSIE") > -1) {
|
|
|
+ // this.unloadHandler();
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // window.addEventListener("unload", async e => {
|
|
|
+ // this.unloadHandler(e)
|
|
|
+ // });
|
|
|
},
|
|
|
- // 解除窗口关闭[监听]事件
|
|
|
- // destroyed() {
|
|
|
- // window.removeEventListener('beforeunload', e => this.beforeunloadHandler(e))
|
|
|
- // window.removeEventListener('unload', e => this.unloadHandler(e))
|
|
|
- // },
|
|
|
// methods: {
|
|
|
- // beforeunloadHandler(){
|
|
|
- // this._beforeUnload_time=new Date().getTime();
|
|
|
+ // beforeunloadHandler(e) {
|
|
|
+ // this._beforeUnload_time = new Date().getTime();
|
|
|
// },
|
|
|
- // unloadHandler(e){
|
|
|
- // this._gap_time=new Date().getTime()-this._beforeUnload_time;
|
|
|
+ // unloadHandler(e) {
|
|
|
+ // this._gap_time = new Date().getTime() - this._beforeUnload_time;
|
|
|
+ //
|
|
|
// //判断是窗口关闭还是刷新
|
|
|
- // if(this._gap_time<=5){
|
|
|
- // //如果是登录状态,关闭窗口前,移除用户
|
|
|
- // if(sessionStorage.getItem('jy')!=null){
|
|
|
- // this.$axios.post(
|
|
|
- // '/logout', {}
|
|
|
- // ).then((res) => {
|
|
|
- // this.$message.success(res.data)
|
|
|
- // removeToken()
|
|
|
- // //注销返回自己的登录页
|
|
|
- // this.$router.push(`/login?redirect=${this.$route.fullPath}`)
|
|
|
- // })
|
|
|
- // }
|
|
|
+ // localStorage.setItem('time', this._gap_time)
|
|
|
+ // console.log(this._gap_time, 333333)
|
|
|
+ // if (this._gap_time <= 5) {
|
|
|
+ // console.log(this._gap_time, 333333)
|
|
|
+ // // // 发送设置同步 (退出登陆的api)
|
|
|
+ // // this.$store.dispatch('LogOut').then(() => {
|
|
|
+ // // location.href = '/index';
|
|
|
+ // // })
|
|
|
+ //
|
|
|
+ //
|
|
|
+ // this.$axios.post(
|
|
|
+ // '/logout', {}
|
|
|
+ // ).then((res) => {
|
|
|
+ // this.$message.success(res.data)
|
|
|
+ // removeToken()
|
|
|
+ // //注销返回自己的登录页
|
|
|
+ // this.$router.push(`/login?redirect=${this.$route.fullPath}`)
|
|
|
+ // })
|
|
|
+ // } else {
|
|
|
// }
|
|
|
- // }
|
|
|
+ // },
|
|
|
+ // },
|
|
|
+ // destroyed() {
|
|
|
+ // window.removeEventListener("beforeunload", e =>
|
|
|
+ // this.beforeunloadHandler(e)
|
|
|
+ // );
|
|
|
+ // window.removeEventListener("unload", e => this.unloadHandler(e));
|
|
|
// }
|
|
|
}
|
|
|
</script>
|