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) {