处理无响应请求

This commit is contained in:
qiaomu 2025-05-14 09:57:14 +08:00
parent a3c4e78c22
commit d27fa31ac7
2 changed files with 25 additions and 3 deletions

View File

@ -85,8 +85,26 @@ Page({
}, },
fail: function (e) { fail: function (e) {
alertError("打开失败") // alertError("打开失败")
console.log('打开失败错误为', e) // console.log('打开失败错误为', e)
wx.showModal({
title: '提示',
content: '打开失败,请复制链接后通过浏览器打开',
complete: (res) => {
if (res.cancel) {
}
if (res.confirm) {
wx.setClipboardData({
data: data,
success: () => {
alertSuccess("复制成功")
}
})
}
}
})
} }
}) })
} }

View File

@ -80,7 +80,11 @@ const request = async function (options, config = {}) {
const parseResponse = function (response, url) { const parseResponse = function (response, url) {
console.log('response', response) console.log('response', response)
if (!response) { if (!response) {
alertError("服务无响应") wx.redirectTo({
url: '/pages/login/index',
})
wx.clearStorageSync()
alertError("无响应,请重试")
return return
} }