From 8a89df99fb5d566ee72d27163cd7338948fd1b0a Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期五, 06 二月 2026 17:13:54 +0800
Subject: [PATCH] 测试推送
---
src/manifest.json | 6 ++-
src/App.vue | 77 +++++++++++++++++++++++++++++++-------
2 files changed, 67 insertions(+), 16 deletions(-)
diff --git a/src/App.vue b/src/App.vue
index 62ea239..5d802fc 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,22 +1,71 @@
<template>
- <Splash v-if="showSplash" />
- <div v-else>
- <router-view />
- </div>
+ <Splash v-if="showSplash" />
+ <div v-else>
+ <router-view />
+ </div>
</template>
<script setup>
-import { ref, onMounted } from 'vue'
-import Splash from './components/Splash.vue'
+ import { ref, onMounted } from "vue";
+ import Splash from "./components/Splash.vue";
-const showSplash = ref(true)
-onMounted(() => {
- setTimeout(() => {
- showSplash.value = false
- }, 5000)
-})
+ const showSplash = ref(true);
+ onMounted(() => {
+ setTimeout(() => {
+ showSplash.value = false;
+ }, 5000);
+
+ // 鍒濆鍖栨帹閫佹湇鍔�
+ initPushService();
+ });
+ // 鍒濆鍖栨帹閫佹湇鍔★紙uni-push 1.0锛�
+ const initPushService = () => {
+ // #ifdef APP-PLUS
+ console.log("寮�濮嬪垵濮嬪寲鎺ㄩ�佹湇鍔★紙uni-push 1.0锛�");
+ if (typeof plus !== "undefined" && plus.push) {
+ console.log("plus.push 瀛樺湪:", plus.push);
+
+ // 鑾峰彇瀹㈡埛绔帹閫佹爣璇�
+ console.log("浣跨敤 plus.push.getClientInfo 鑾峰彇瀹㈡埛绔爣璇�");
+ plus.push.getClientInfoAsync(info => {
+ console.log("瀹㈡埛绔帹閫佹爣璇�:", info);
+ // 杩欓噷鍙互灏嗗鎴风鏍囪瘑鍙戦�佸埌鏈嶅姟鍣�
+ });
+ setTimeout(() => {
+ console.log("浣跨敤 plus.push.getClientInfoAsync 鑾峰彇瀹㈡埛绔爣璇�");
+ plus.push.getClientInfoAsync(info => {
+ console.log("瀹㈡埛绔帹閫佹爣璇�:", info);
+ // 杩欓噷鍙互灏嗗鎴风鏍囪瘑鍙戦�佸埌鏈嶅姟鍣�
+ });
+ }, 1000);
+
+ // 鐩戝惉鎺ㄩ�佹秷鎭偣鍑讳簨浠�
+ plus.push.addEventListener("click", handlePushClick, false);
+ // 鐩戝惉鎺ㄩ�佹秷鎭帴鏀朵簨浠�
+ plus.push.addEventListener("receive", handlePushReceive, false);
+ console.log("鎺ㄩ�佹湇鍔℃敞鍐屾垚鍔�");
+ } else {
+ console.log("鎺ㄩ�佹湇鍔′笉鍙敤");
+ }
+ // #endif
+ };
+
+ // 澶勭悊鎺ㄩ�佹秷鎭偣鍑讳簨浠�
+ const handlePushClick = msg => {
+ console.log("鐐瑰嚮鎺ㄩ�佹秷鎭�:", msg);
+ uni.navigateTo({
+ url: msg.payload.pagePath,
+ });
+ // 瑙f瀽骞跺鐞嗘帹閫佹秷鎭�...
+ };
+
+ // 澶勭悊鎺ㄩ�佹秷鎭帴鏀朵簨浠�
+ const handlePushReceive = msg => {
+ console.log("鏀跺埌鎺ㄩ�佹秷鎭�:", msg);
+ // 澶勭悊鎺ユ敹鐨勬帹閫佹秷鎭�...
+ };
</script>
<style lang="scss">
-@import "uview-plus/index.scss";
-@import '@/static/scss/index.scss';
+ @import "uview-plus/index.scss";
+ @import "@/static/scss/index.scss";
</style>
\ No newline at end of file
diff --git a/src/manifest.json b/src/manifest.json
index f1b9741..8d96ae9 100644
--- a/src/manifest.json
+++ b/src/manifest.json
@@ -23,7 +23,8 @@
/* 妯″潡閰嶇疆 */
"modules": {
"Camera": {},
- "Barcode": {}
+ "Barcode": {},
+ "Push": {}
},
/* 搴旂敤鍙戝竷淇℃伅 */
"distribute": {
@@ -69,7 +70,8 @@
"small": {
"ldpi": "D:/xindao/wenjian/img/logo/app.png"
}
- }
+ },
+ "offline": false
}
}
},
--
Gitblit v1.9.3