DESKTOP-O04BTUJ\muzen %!s(int64=3) %!d(string=hai) anos
pai
achega
3de3ed39db
Modificáronse 1 ficheiros con 40 adicións e 1 borrados
  1. 40 1
      src/main.js

+ 40 - 1
src/main.js

@@ -3,9 +3,48 @@ import App from './App'
 
 Vue.config.productionTip = false
 
+// 打开App
+Vue.prototype.openApp = function (page, channel, audioType, audioId) {
+  const res = uni.getSystemInfoSync()
+  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 {
+    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)
+    }
+  }
+}
+
 App.mpType = 'app'
 
 const app = new Vue({
   ...App
 })
-app.$mount()
+app.$mount()