This commit is contained in:
2026-08-26 15:59:08 +08:00
parent ee83d87a85
commit 3c283ada46
19 changed files with 196 additions and 46 deletions
+4 -1
View File
@@ -12,13 +12,15 @@ function ensureListening() {
if (typeof uni.onNetworkStatusChange === 'function') {
uni.onNetworkStatusChange((result) => {
online = Boolean(result.isConnected)
console.info('[Overseas PDA network] status change', { isConnected: result.isConnected, networkType: result.networkType })
notify()
})
}
if (typeof uni.getNetworkType === 'function') {
uni.getNetworkType({
success: (result) => {
success: (result) => {
online = result.networkType !== 'none'
console.info('[Overseas PDA network] initial status', { networkType: result.networkType, online })
notify()
}
})
@@ -31,6 +33,7 @@ export function isOnline() {
}
export function requireOnline(message = '当前网络不可用,请联网后刷新重试') {
console.info('[Overseas PDA network] preflight', { online })
if (!isOnline()) {
const error = new Error(message)
error.network = true