推送
Some checks failed
Uniapp 自动化打包 CI/CD / 打包 Uniapp 项目 (push) Has been cancelled

This commit is contained in:
2025-09-14 18:14:36 +08:00
parent e6772a53e7
commit 2476011b07
3 changed files with 77 additions and 5 deletions

13
App.vue
View File

@@ -4,6 +4,8 @@
showNotification
} from "@/utils/notify.js"
import ws from "@/utils/websocket.js"; // WebSocket 封装类
import NotifyPermission from "@/utils/notification-permission.js"
/**
@@ -22,8 +24,11 @@
// 监听登录成功
uni.$on("loginSuccess", () => {
// 仅在 Android 13+ 才需要
// NotifyPermission.ensurePermission(() => {
// // 权限已开,执行你的逻辑
// this.initWebSocket()
// })
// // 仅在 Android 13+ 才需要
if (plus.os.name === "Android" && parseInt(plus.os.version) >= 13) {
var permission = "android.permission.POST_NOTIFICATIONS";
// 请求权限
@@ -33,10 +38,10 @@
this.initWebSocket()
},
(error) => {
}
);
}else{
} else {
this.initWebSocket()
}
})