From eae0d67996332579baf9ae4c39b8da734fec4806 Mon Sep 17 00:00:00 2001 From: "97694732@qq.com" Date: Sat, 6 Jun 2026 16:04:36 +0800 Subject: [PATCH] =?UTF-8?q?fix:getNoIsbnBook=E9=9D=9E200/=E7=BD=91?= =?UTF-8?q?=E7=BB=9C=E9=94=99=E8=AF=AF=E6=98=BE=E7=A4=BA=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=B9=B6=E5=81=9C=E6=AD=A2=E5=90=8E=E7=BB=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/upload/upload.vue | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/pages/upload/upload.vue b/pages/upload/upload.vue index 820a72f..96fe6b1 100644 --- a/pages/upload/upload.vue +++ b/pages/upload/upload.vue @@ -2420,12 +2420,25 @@ export default { }) return } + // code=200但无数据,走回调(进入孔网搜索) + if (typeof callback === 'function') callback.call(that, false) + } else { + // 非200或code≠200,显示错误,不执行下一步 + var errMsg = '' + if (res.data) { + errMsg = res.data.msg || res.data.message || ('请求失败: ' + res.statusCode) + } else { + errMsg = '请求失败: HTTP ' + res.statusCode + } + console.error('【getNoIsbnBook】错误:', errMsg) + uni.showToast({ title: errMsg, icon: 'none', duration: 3000 }) + if (typeof callback === 'function') callback.call(that, true) } - // 无数据,走回调 - if (typeof callback === 'function') callback.call(that, false) }, - fail: function() { - if (typeof callback === 'function') callback.call(that, false) + fail: function(err) { + console.error('【getNoIsbnBook】网络请求失败:', JSON.stringify(err)) + uni.showToast({ title: '网络请求失败', icon: 'none', duration: 3000 }) + if (typeof callback === 'function') callback.call(that, true) } }) },