From 8d4a66c31aa0f6418403ade8a780f27c9fa9d921 Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期二, 10 二月 2026 17:43:30 +0800
Subject: [PATCH] 消息列表

---
 src/App.vue |   91 +++++++++++++++++++++++++++++++++++++++------
 1 files changed, 79 insertions(+), 12 deletions(-)

diff --git a/src/App.vue b/src/App.vue
index f664715..092696f 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,23 +1,90 @@
 <template>
   <Splash v-if="showSplash" />
-	<div v-else>
+  <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);
+        uni.setStorageSync("clientid", info.clientid);
+
+        // 杩欓噷鍙互灏嗗鎴风鏍囪瘑鍙戦�佸埌鏈嶅姟鍣�
+      });
+      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);
+    try {
+      if (msg.payload.indexOf("/") === 0) {
+        uni.navigateTo({
+          url: msg.payload,
+        });
+      } else {
+        uni.navigateTo({
+          url: "/" + msg.payload,
+        });
+      }
+    } catch (error) {
+      uni.showToast({
+        title: "璺緞:" + msg.payload,
+        icon: "none",
+      });
+      uni.showToast({
+        title: "璺宠浆澶辫触:" + error.message,
+        icon: "none",
+      });
+    }
+    // 瑙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