| | |
| | | <script setup> |
| | | import { ref, onMounted } from "vue"; |
| | | import Splash from "./components/Splash.vue"; |
| | | import { confirmMessage } from "@/api/login.js"; |
| | | |
| | | const showSplash = ref(true); |
| | | onMounted(() => { |
| | |
| | | // 处理推送消息点击事件 |
| | | const handlePushClick = msg => { |
| | | console.log("点击推送消息:", msg); |
| | | uni.navigateTo({ |
| | | url: msg.payload.pagePath, |
| | | }); |
| | | console.log("解析后:", msg.payload.noticeId); |
| | | try { |
| | | 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, |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | } catch (error) { |
| | | uni.showToast({ |
| | | title: "路径:" + msg.payload, |
| | | icon: "none", |
| | | }); |
| | | uni.showToast({ |
| | | title: "跳转失败:" + error.message, |
| | | icon: "none", |
| | | }); |
| | | } |
| | | // 解析并处理推送消息... |
| | | }; |
| | | |