main.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import Vue from 'vue'
  2. import App from './App'
  3. Vue.config.productionTip = false
  4. // 打开App
  5. Vue.prototype.openApp = function (page, channel, audioType, audioId) {
  6. const res = uni.getSystemInfoSync()
  7. var ua = window.navigator.userAgent.toLowerCase();
  8. if (ua.match(/MicroMessenger/i) == 'micromessenger' || ua.match(/WeiBo/i) == "weibo" || ua.match(/QQ/i) == "qq") {
  9. uni.showToast({
  10. icon: 'none',
  11. title: '右上角在浏览器打开',
  12. mask: true
  13. })
  14. } else {
  15. if (res.platform === 'ios') {
  16. window.location.href = 'airsmart://?page=${page}&channel=${channel}&audioType=${audioType}&audioId=${audioId}'
  17. } else {
  18. window.location.href = `airsmart://com.muzen.radioplayer:8888/main?page=${page}&channel=${channel}&audioType=${audioType}&audioId=${audioId}`
  19. }
  20. var timer = setTimeout(() => {
  21. if (res.platform === 'ios') {
  22. window.location.href = 'itms-appss://itunes.apple.com/cn/app/apple-store/id1621419943?mt=8'
  23. } else {
  24. window.location.href = 'https://music-play.oss-cn-shenzhen.aliyuncs.com/backOss/file/bacde3d529014ad08fcddb6baaffbc28.apk'
  25. }
  26. }, 3000);
  27. }
  28. document.addEventListener('visibilitychange', function () {
  29. if (document.hidden) {
  30. clearTimeout(timer)
  31. }
  32. })
  33. window.onpagehide = event => {
  34. if (event.persisted) {
  35. clearTimeout(timer)
  36. }
  37. }
  38. }
  39. App.mpType = 'app'
  40. const app = new Vue({
  41. ...App
  42. })
  43. app.$mount()