123456789101112131415161718192021222324252627282930313233343536373839 |
- const openApp = function (url) {
- 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) == "qqbrowser ") {
- uni.showToast({
- icon: 'none',
- title: '右上角在浏览器打开',
- mask: true
- })
- } else {
- if (res.platform === 'ios') {
- window.location.href = `airsmart://${url}&cmd=openPage`
- } else {
- window.location.href = `airsmart://muzen${url}&cmd=openPage`
- }
- 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 = 'http://download.radio1964.com/readme?'
- }
- }, 3000)
- }
- document.addEventListener('visibilitychange', function () {
- if (document.hidden) {
- clearTimeout(timer)
- }
- })
- window.onpagehide = event => {
- if (event.persisted) {
- clearTimeout(timer)
- }
- }
- }
- export default openApp;
|