DESKTOP-O04BTUJ\muzen 3 år sedan
förälder
incheckning
0d4128c23f
1 ändrade filer med 33 tillägg och 4 borttagningar
  1. 33 4
      src/main.js

+ 33 - 4
src/main.js

@@ -4,12 +4,41 @@ import App from './App'
 Vue.config.productionTip = false
 
 // 打开App
-Vue.prototype.openApp = function () {
+Vue.prototype.openApp = function (page, channel, audioType, audioId) {
   const res = uni.getSystemInfoSync()
-  if (res.platform === 'ios') {
-    window.location.href = 'MKROhPlay://'
+  var ua = window.navigator.userAgent.toLowerCase();
+  if (ua.match(/MicroMessenger/i) == 'micromessenger' || ua.match(/WeiBo/i) == "weibo" || ua.match(/QQ/i) == "qq") {
+    uni.showToast({
+      icon: 'none',
+      title: '右上角在浏览器打开',
+      mask: true
+    })
   } else {
-    window.location.href = 'airsmart://com.muzen.radioplayer:8888/main'
+    if (res.platform === 'ios') {
+      window.location.href = 'airsmart://?page=${page}&channel=${channel}&audioType=${audioType}&audioId=${audioId}'
+    } else {
+      window.location.href = `airsmart://com.muzen.radioplayer:8888/main?page=${page}&channel=${channel}&audioType=${audioType}&audioId=${audioId}`
+    }
+
+    var timer = setTimeout(() => {
+      if (res.platform === 'ios') {
+        window.location.href = 'itms-appss://itunes.apple.com/cn/app/apple-store/id1621419943?mt=8'
+      } else {
+        window.location.href = 'https://music-play.oss-cn-shenzhen.aliyuncs.com/backOss/file/bacde3d529014ad08fcddb6baaffbc28.apk'
+      }
+    }, 3000);
+  }
+
+  document.addEventListener('visibilitychange', function () {
+    if (document.hidden) {
+      clearTimeout(timer)
+    }
+  })
+
+  window.onpagehide = event => {
+    if (event.persisted) {
+      clearTimeout(timer)
+    }
   }
 }