ocr刷新

This commit is contained in:
caoyang
2022-03-14 17:51:23 +08:00
parent c3bee0a86b
commit 4cb567eaf7
10 changed files with 370 additions and 40 deletions
@@ -78,7 +78,7 @@
</div>
<doc-table v-if="drawVisible" :drawVisible="drawVisible" :drawTableSorce="drawTableSorce" @visible="docVisible" @exportVisible="exportVisible"></doc-table>
<ocr-upload ref="uploadFile1" :disabled="disabled" :accept="accept" @uploadSuccess="uploadSuccess"></ocr-upload>
<ocr-upload ref="uploadFile1" :disabled="disabled" :accept="accept" :title="title" :listType='listType' @uploadSuccess="uploadSuccess"></ocr-upload>
</a-card>
</div>
@@ -153,7 +153,9 @@
record:{},
accept:'application/pdf',
today:'',
timer:''
timer:'',
title:this.$t('UploadFile'),
listType:'text',
}
},
props:{
@@ -182,7 +184,8 @@
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/' + userId;
let url = window._CONFIG['domianWebSocketURL'].replace("https://","wss://").replace("http://","ws://") + '/websocket/socketServer'
// let url = 'http://10.0.1.25:8080/jero-boot'.replace("https://","wss://").replace("http://","ws://") + '/websocket/socketServer'
this.websock = new WebSocket(url);
this.websock.onopen = this.websocketOnopen;
this.websock.onerror = this.websocketOnerror;
@@ -190,16 +193,30 @@
this.websock.onclose = this.websocketOnclose;
},
websocketOnopen: function (e) {
console.log("WebSocket连接成功");
// console.log("WebSocket连接成功");
// console.log('eee',e)
// 添加心跳检测,每10秒发一次数据,防止连接断开(这跟服务器的设置有关,如果服务器没有设置每隔多长时间不发消息断开,可以不进行心跳设置)
let self = this;
this.timer = setInterval(() => {
try {
self.websock.send('test')
// console.log('发送消息');
}catch(err){
console.log('断开了:' + err);
self.connection()
}
}, 10000)
},
websocketOnerror: function (e) {
console.log("WebSocket连接发生错误");
// console.log("WebSocket连接发生错误");
this.reconnect();
},
websocketOnmessage: function (e) {
console.log("WebSocket连接数据");
// console.log("WebSocket连接数据1111");
if(e.data=='1'){
eventBUs.$emit('searchReset')
}
},
websocketOnclose: function (e) {
this.reconnect();
@@ -218,7 +235,7 @@
that.lockReconnect = true;
//没连接上会一直重连,设置延迟避免请求过多
setTimeout(function () {
console.info("尝试重连...");
// console.info("尝试重连...");
that.initWebSocket();
that.lockReconnect = false;
}, 5000);