From 01e3d60b6c1a0402e9a93d5ce596f003f8866e89 Mon Sep 17 00:00:00 2001 From: qiaomu <3520484422@qq.com> Date: Mon, 29 Jul 2024 16:46:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8D=87=E7=BA=A7=E5=92=8C40?= =?UTF-8?q?4=E5=88=A4=E6=96=AD=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/login/index.js | 3 ++- utils/request.js | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/pages/login/index.js b/pages/login/index.js index da7302a..5b9bd06 100644 --- a/pages/login/index.js +++ b/pages/login/index.js @@ -21,6 +21,7 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad() { + this.getPrivacy(); const user = wx.getStorageSync('user') if (!user || !user.id) { return; @@ -34,7 +35,7 @@ Page({ wx.switchTab({ url: '/pages/home/index', }) - this.getPrivacy(); + }, async getPrivacy() { const { code, message, data } = await getPrivaciList() diff --git a/utils/request.js b/utils/request.js index deb7ad5..13ce795 100644 --- a/utils/request.js +++ b/utils/request.js @@ -95,6 +95,10 @@ const parseResponse = function (response, url) { return { code: 403, message: "非法访问" } } if (statusCode === 404) { + wx.redirectTo({ + url: '/pages/login/index', + }) + wx.clearStorageSync() return { code: 404, message: "服务故障" } } if (500 <= statusCode && statusCode < 600) {