修改升级和404判断处理

This commit is contained in:
qiaomu 2024-07-29 16:46:47 +08:00
parent 5b280a9e9d
commit 01e3d60b6c
2 changed files with 6 additions and 1 deletions

View File

@ -21,6 +21,7 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad() { onLoad() {
this.getPrivacy();
const user = wx.getStorageSync('user') const user = wx.getStorageSync('user')
if (!user || !user.id) { if (!user || !user.id) {
return; return;
@ -34,7 +35,7 @@ Page({
wx.switchTab({ wx.switchTab({
url: '/pages/home/index', url: '/pages/home/index',
}) })
this.getPrivacy();
}, },
async getPrivacy() { async getPrivacy() {
const { code, message, data } = await getPrivaciList() const { code, message, data } = await getPrivaciList()

View File

@ -95,6 +95,10 @@ const parseResponse = function (response, url) {
return { code: 403, message: "非法访问" } return { code: 403, message: "非法访问" }
} }
if (statusCode === 404) { if (statusCode === 404) {
wx.redirectTo({
url: '/pages/login/index',
})
wx.clearStorageSync()
return { code: 404, message: "服务故障" } return { code: 404, message: "服务故障" }
} }
if (500 <= statusCode && statusCode < 600) { if (500 <= statusCode && statusCode < 600) {