From ee087fee5544a9546637613e25bdbad55faded56 Mon Sep 17 00:00:00 2001 From: maxmon <541182180@qq.com> Date: Wed, 9 Jun 2021 00:29:26 +0800 Subject: [PATCH] =?UTF-8?q?+=20=E7=BC=A9=E7=9F=AD=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E6=9C=AA=E5=8A=A0=E8=BD=BD=E5=88=A4=E6=96=AD=E9=97=B4=E9=9A=94?= =?UTF-8?q?=EF=BC=8C=E4=BB=A5=E5=8F=8A=E5=A2=9E=E5=8A=A02=E6=AC=A1?= =?UTF-8?q?=E5=87=BA=E9=94=99=E9=87=8D=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fe/src/components/NER/index.vue | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/fe/src/components/NER/index.vue b/fe/src/components/NER/index.vue index cfb5e08..6d875b7 100644 --- a/fe/src/components/NER/index.vue +++ b/fe/src/components/NER/index.vue @@ -116,7 +116,7 @@ function get (url, cb) { function post (url, data, cb) { query('POST', url, data, cb) } -function query (method, url, data = '', cb) { +function query (method, url, data = '', cb, tryTimes = 0) { var xhr = new XMLHttpRequest() xhr.open(method, url) xhr.setRequestHeader('content-type', 'application/json') @@ -124,7 +124,13 @@ function query (method, url, data = '', cb) { if (xhr.readyState === 4 && xhr.status === 200) { const result = JSON.parse(xhr.responseText) if (result.errCode !== 0) { - alert(result.errMsg) + if (tryTimes >= 2) { + alert(result.errMsg) + } else { + setTimeout(() => { + query(method, url, data = '', cb, tryTimes + 1) + }, 200) + } } else { cb && cb(result.info) } @@ -249,7 +255,7 @@ export default { }, save: function () { if (window.isLoadingNowText) { - if (Date.now() - window.isLoadingNowText < 30 * 1000) { + if (Date.now() - window.isLoadingNowText < 10 * 1000) { alert('请等待文件内容加载') return false } else {