Browse Source

feature:增加弹框提示

zeng.chen 1 day ago
parent
commit
c981fe285d
1 changed files with 17 additions and 2 deletions
  1. 17 2
      src/pages/ximalaya/index.vue

+ 17 - 2
src/pages/ximalaya/index.vue

@@ -29,10 +29,25 @@ export default {
       const code = res.code === 0 ? "1" : "0"
       const postMessage = `?name=${name}&code=${code}`
     if (window.wx && window.wx.miniProgram) {
-      window.wx && window.wx.miniProgram.postMessage(postMessage);
+      uni.showToast({
+        title: "微信小程序环境",
+        icon: 'none',
+        duration: 2000
+      });
+      window.wx.miniProgram.postMessage(postMessage);
     } else if (window.webChannel) {
+      uni.showToast({
+        title: "app环境",
+        icon: 'none',
+        duration: 2000
+      });
       webChannel.postMessage(postMessage)
-    }
+    } else {
+      uni.showToast({
+        title: "其他环境",
+        icon: 'none',
+        duration: 2000
+      });}
     })
   },  getEnvType() {
     if (window.wx && window.wx.miniProgram) {