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