From ed39f5e8cb15ece064c45ee6ee0f370fc740244d Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 04 六月 2026 17:11:30 +0800
Subject: [PATCH] 马铃薯app 1.白屏问题解决

---
 src/App.vue |  111 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 111 insertions(+), 0 deletions(-)

diff --git a/src/App.vue b/src/App.vue
new file mode 100644
index 0000000..6cf062d
--- /dev/null
+++ b/src/App.vue
@@ -0,0 +1,111 @@
+<template>
+	<Splash v-if="showSplash" />
+	<view v-else>
+		<router-view />
+	</view>
+</template>
+<script setup>
+import { ref, onMounted } from "vue";
+import Splash from "./components/Splash.vue";
+import { confirmMessage } from "@/api/login.js";
+
+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);
+	console.log("瑙f瀽鍚�:", msg.payload.noticeId);
+	try {
+		if (msg.payload.needMarkRead) {
+			confirmMessage(msg.payload.noticeId, 1).then(res => {
+				if (msg.payload.url) {
+					if (msg.payload.url.indexOf("/") === 0) {
+						uni.navigateTo({
+							url: msg.payload.url,
+						});
+					} else {
+						uni.navigateTo({
+							url: "/" + msg.payload.url,
+						});
+					}
+				}
+			});
+		} else {
+			if (msg.payload.url) {
+				if (msg.payload.url.indexOf("/") === 0) {
+					uni.navigateTo({
+						url: msg.payload.url,
+					});
+				} else {
+					uni.navigateTo({
+						url: "/" + msg.payload.url,
+					});
+				}
+			}
+		}
+	} 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";
+</style>
\ No newline at end of file

--
Gitblit v1.9.3