美文网首页
h5在浏览器中打开app

h5在浏览器中打开app

作者: 小码农_影 | 来源:发表于2021-03-25 16:59 被阅读0次
    <div class="footer-box">
            <img src="@/assets/phone/logo.png" alt="" style="width:0.25rem;height:0.25rem;vertical-align: middle;">
            使用易董App(v3.6.0)电子签名
            <span class="openAppWay" style="margin-right: 0.04rem;" @click="openApp('downLoad')">下载APP</span>
            <span class="openAppWay" @click="openApp('open')">启动APP</span>
    /div>
  openApp(str){//打开app
            var u = window.navigator.userAgent;
            var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //android终端或者uc浏览器
            var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
            if (isAndroid) {
                this.android(str);
            }
            if (isiOS) {
                this.ios(str);
            }
        },
        android(str) {
            var HREF = ''
            if(this.globalUrlInfo.signatureId){
                HREF = this.HREF+'?signatureId='+this.globalUrlInfo.signatureId+'&access_token='+this.globalUrlInfo.access_token
            }else{
                HREF = this.HREF+'?uuId='+this.globalUrlInfo.uuId+'&access_token='+this.globalUrlInfo.access_token
            }
            if(str == 'downLoad'){
                window.location.href = 'http://www.valueonline.cn/edong.html'
            }else if(str == 'open'){
                window.location.href = 'yidong://scheme.app/signature?url='+encodeURIComponent(HREF); /***打开app的协议,由安卓同事提供***/
            }
        },
        ios(str) {
           var HREF = ''
           if(this.globalUrlInfo.signatureId){
                HREF = this.HREF+'?signatureId='+this.globalUrlInfo.signatureId+'&access_token='+this.globalUrlInfo.access_token
            }else{
                HREF = this.HREF+'?uuId='+this.globalUrlInfo.uuId+'&access_token='+this.globalUrlInfo.access_token
            }
            if(str == 'downLoad'){
                window.location.href = 'http://www.valueonline.cn/edong.html'
            }else if(str == 'open'){
                window.location.href = 'yidong://scheme.app/signature?url='+encodeURIComponent(HREF); /***打开app的协议,由安卓同事提供***/
            }
        },

相关文章

网友评论

      本文标题:h5在浏览器中打开app

      本文链接:https://www.haomeiwen.com/subject/bxrrhltx.html