H5网页打开App以及App内某个页面

/**
 * 下载、打开App
 * @param type  doctor:医生端   patient:患者端
 * @param meetData  跳转app页面携带参数
 */
export const downLoadApp = (type?: string, meetData?: any) => {
  let openAppUrl = ‘‘
  let downloadIosApp = ‘‘
  let downloadAndroidApp = ‘‘
  if (type === ‘doctor‘) {
    openAppUrl = ‘hxqdoctor://‘ + meetData
    downloadIosApp =
      ‘https://itunes.apple.com/cn/app/hao-xin-qing-yi-sheng-ban/id1079814056?mt=8‘
    downloadAndroidApp =
      ‘http://a.app.qq.com/o/simple.jsp?pkgname=com.hxqydyl.app.ys‘
  } else {
    // 患者端app下载连接(腾讯应用宝链接)
    openAppUrl = downloadIosApp = downloadAndroidApp = ‘http://t.cn/RcxMVvL‘
  }
  const openIframe = createIframe()
  if (isIphone()) {
    if (isUserApp() || isDoctorApp()) { // 此操作是为了提醒Iphone用户下载最新app,否则不可用部分功能
      window.location.href = downloadIosApp
    } else {
      window.location.href = openAppUrl
      const loadDateTime = Date.now()
      setTimeout(() => {
        const timeOutDateTime = Date.now()
        if (timeOutDateTime - loadDateTime < 1000) {
          window.location.href = downloadIosApp
        }
      }, 25)
    }
  } else if (isAndroid()) {
    if (isUserApp() || isDoctorApp()) { // 此操作是为了提醒安卓用户下载最新app,否则不可用部分功能
      window.location.href = downloadAndroidApp
    } else {
      if (isChrome()) {
        // chrome浏览器用iframe打不开得直接去打开,算一个坑
        window.location.href = openAppUrl
      } else {
        // 抛出你的scheme
        openIframe.src = openAppUrl
      }
      setTimeout(() => {
        window.location.href = downloadAndroidApp
      }, 500)
    }
  }
}

 

H5网页打开App以及App内某个页面

上一篇:Android学习笔记Log类输出日志信息


下一篇:如果你的application.properties中还存在明文密码----加密Spring Boo