zhangwencui
4 天以前 4071a902f383275b7ed284876bbdf3e19cfa3522
src/App.vue
@@ -28,6 +28,8 @@
      console.log("使用 plus.push.getClientInfo 获取客户端标识");
      plus.push.getClientInfoAsync(info => {
        console.log("客户端推送标识:", info);
        uni.setStorageSync("clientid", info.clientid);
        // 这里可以将客户端标识发送到服务器
      });
      setTimeout(() => {
@@ -52,9 +54,26 @@
  // 处理推送消息点击事件
  const handlePushClick = msg => {
    console.log("点击推送消息:", msg);
    uni.navigateTo({
      url: msg.payload.pagePath,
    });
    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",
      });
    }
    // 解析并处理推送消息...
  };