ocr关闭页面刷新

This commit is contained in:
caoyang
2022-03-16 10:10:19 +08:00
parent 7bee5e4f3a
commit 08b7a26992
@@ -159,6 +159,7 @@
title:this.$t('UploadFile'),
listType:'text',
token:Vue.ls.get(ACCESS_TOKEN),
websock: null,
}
},
props:{
@@ -172,19 +173,12 @@
// this.refresh()
},
watch:{
// drawVisible(val){
// if(val&&this.timer){
// clearInterval(this.timer)
// }else{
// clearInterval(this.timer)
// this.initSetTimeout(this.today)//调用每隔10秒刷新数据
// }
// }
},
methods:{
initWebSocket: function () {
let token = Vue.ls.get(ACCESS_TOKEN)
console.log("------------WebSocket连接成功");
// console.log("------------WebSocket连接成功");
// WebSocket与普通的请求所用协议有所不同,ws等同于http,wss等同于https
let userId = store.getters.userInfo.id;
let url = window._CONFIG['domianWebSocketURL'].replace("https://","wss://").replace("http://","ws://") + '/websocket/socketServer'
@@ -223,7 +217,9 @@
}
},
websocketOnclose: function (e) {
this.reconnect();
this.websock.close()
// console.log('close')
// this.reconnect();
},
websocketSend(text) {
// 数据发送
@@ -367,7 +363,6 @@
},
//上传确定按钮
modalOk(){
this.$refs.fileForm.sumber()
},
handleCancel(){
@@ -431,19 +426,13 @@
addFormClick() {
this.fileVisible = false
},
//10秒刷新页面
// initSetTimeout(today) {//每隔10秒刷新数据,也就是每隔10秒向后台请求一次数据
// this.timer=setInterval( () => {
// eventBUs.$emit('searchReset')
// }, 10000)
// },
},
// beforeDestroy(){
// clearInterval(this.timer)
// },
beforeDestroy(){
},
destroyed() {
// 离开页面生命周期函数
this.websocketOnclose();
clearInterval(this.timer)
}
}
</script>