From 071fa55dbba2ad1fbb30e230a0268cf478e40122 Mon Sep 17 00:00:00 2001 From: chen <2659004835@qq.com> Date: Fri, 29 Apr 2022 18:59:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=AF=B7=E6=B1=82=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jsFile/requst.js | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/jsFile/requst.js b/jsFile/requst.js index 5c17833..2cc812d 100644 --- a/jsFile/requst.js +++ b/jsFile/requst.js @@ -45,6 +45,7 @@ const refreshTokenPage = () => { }, }); } +let errorFlag = true; // 请求错误处理 const checkError = (e) => { // console.error("----接口错误----", e) @@ -87,7 +88,33 @@ const checkError = (e) => { break; } } - } + } else { + if(e.errMsg=="request:fail 对应的服务器证书无效。" || e.errno==600001) { + if(errorFlag) { + errorFlag = false; + uni.showModal({ + title:'服务器证书无效', + confirmText:'确定', + showCancel:false, + success:(e)=> { + if(e.confirm) { + // #ifdef MP-WEIXIN + // 退出小程序 + wx.exitMiniProgram(); + // #endif + // #ifdef APP-PLUS + if (uni.getSystemInfoSync().platform == 'ios'){ + plus.ios.import("UIApplication").sharedApplication().performSelector("exit") + } else if (uni.getSystemInfoSync().platform == 'android'){ + plus.runtime.quit(); + } + // #endif + } + } + }) + } + } + } } // 封装request的(GET、POST)请求