From 8a89df99fb5d566ee72d27163cd7338948fd1b0a Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期五, 06 二月 2026 17:13:54 +0800
Subject: [PATCH] 测试推送

---
 src/App.vue |   77 +++++++++++++++++++++++++++++++-------
 1 files changed, 63 insertions(+), 14 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

--
Gitblit v1.9.3