在web中判断是否有app,没有则跳转,包括读取a标签参数,获取后台数据
来源:互联网 发布:日本人用的软件 编辑:程序博客网 时间:2024/05/29 18:45
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-status-bar-style" content="black"/> <meta name='apple-itunes-app' content='app-id=477927812'> <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0"> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-status-bar-style" content="black"> <meta name="format-detection" content="telephone=no"> <title>下载春桃医生</title> <link rel="stylesheet" href="css/weui.min.css"> <link rel="stylesheet" href="css/jquery-weui.css"> <link rel="stylesheet" href="css/style.css"> <script src="js/jquery-2.1.4.js"></script> <script src="js/jquery-weui.js"></script></head><body><div class="weui_de"> <div class="content" id="docone"> <div class="content_text"> <h3 class="weui_wecliam">注册 春桃医生</h3> <p class="weui_d_fa">来自于好友"<span class="patient">艾力托马斯</span>"的推荐</p> </div> <div class="content_texts"> <div class="weui-cells weui-cells_form"> <div class="weui-cell"> <div class="weui-cell__hd"><label class="weui-label">请输入手机号: </label></div> <div class="weui-cell__bd"> <input class="weui-input" type="number" pattern="[0-9]*" placeholder="" id="recordPhone" value="18323215661"> </div> </div> </div> <p class="lodingtext">输入手机号与推荐人自动成为好友,手机号仅用于登录</p> <span class="weui-agree"> <input id="weuiAgree" type="checkbox" class="weui-agree__checkbox" onclick="checkeds();" checked> <span class="weui-agree__text"> 阅读并同意<a href="agreement.html">《新用户注册协议》</a> </span> </span> </div> <div class="downlode"> <div class="weui-flex"> <div class="weui-flex__item weui_fl_margin"> <a href="javascript:;" class="weui-btn weui-btn_primary weui_btn_back_dow openApp" data-id="doctorbtn" id="doctorbtn" onclick="sendMessageDOCTOR();"> <img src="images/a_1.png" alt="" width="22px" height="19px"> 下载医生端 </a> </div> </div> <div class="weui-flex"> <div class="weui-flex__item weui_fl_margin"> <a href="javascript:;" class="weui-btn weui-btn_primary weui_btn_back_dow openApp" data-id="userbtn" id="userbtn" onclick="sendMessageUSER();"> <img src="images/a_1.png" alt="" width="22px" height="19px"> 下载用户端 </a> </div> </div> </div> </div></div><div class="weixin-tip"> <p> <img src="images/2.png" alt="" class="imgopen"> </p></div></body><script> //判断是否是微信 $(window).on("load",function(){ var winHeight = $(window).height(); function is_weixin() { var ua = navigator.userAgent.toLowerCase(); if (ua.match(/MicroMessenger/i) == "micromessenger") { return true; } else { return false; } } var isWeixin = is_weixin(); if(isWeixin){ $(".weixin-tip").css("height",winHeight); $(".weixin-tip").show(); } }) //获取url链接中的参数 var getParam = function(name){ var search = document.location.search; var pattern = new RegExp("[?&]"+name+"\=([^&]+)", "g"); var matcher = pattern.exec(search); var items = null; if(null != matcher){ try{ items = decodeURIComponent(decodeURIComponent(matcher[1])); }catch(e){ try{ items = decodeURIComponent(matcher[1]); }catch(e){ items = matcher[1]; } } } return items; }; //checkbox是否选中 function checkeds() { if($("#weuiAgree").is(":checked")==true){ $("#doctorbtn").attr("disabled",false); $("#doctorbtn").css({"background-color":"#ff7700"}) $("#userbtn").attr("disabled",false); $("#userbtn").css({"background-color":"#ff7700"})// $('#userbtn').attr('onclick');// $('#doctorbtn').attr('onclick'); }else{ $("#doctorbtn").attr("disabled","disabled"); $("#doctorbtn").css({"background-color":"#f1a05a"}) $("#userbtn").attr("disabled","disabled"); $("#userbtn").css({"background-color":"#f1a05a"})// $('#userbtn').removeAttr('onclick');// $('#doctorbtn').removeAttr('onclick'); } } //获取推荐人 var url=window.location.href;//设置或获取整个url为字符串 //console.log(url); var refereesId=getParam('refereesId'); if(url.indexOf('refereesId')<0){//判断otp是否存在 $.alert("您访问的链接不正确,请重新访问!"); }else{ $.ajax({ type: 'GET', url: '/api/v1s1/commonly/refereesName', dataType: 'json', data: { "refereesId": refereesId, "refereesType": "d" }, success: function (data) { if(data.code=="OK"){ $(".patient").text(data.body.name); } // console.log(data.body); }, error: function (data) { // console.log(data); } }) } //用户下载链接 var user='http://down.chuntaoyisheng.com/file/v1.0.0/patient-release.apk'; //医生下载链接 var doctor='http://down.chuntaoyisheng.com/file/v1.0.0/doctor-release.apk'; //打开医生端(安卓,ios) var url=window.location.href; //下载医生端 function sendMessageDOCTOR() { if (navigator.userAgent.match(/(iPhone|iPod|iPad)/i)) { var href= "ctDoctorIos://zhaolingling/?wangzhao="+url; var client=$("#doctorbtn").data("id"); var ios='http://itunes.apple.com/cn/app/id1214191498?mt=8'; } else if (navigator.userAgent.match(/android/i)) { var href= "wanglangzh://zhaolinglingwl/?wangzhao="+url; } sendMessage(doctor,href,client,ios); $("#"+client).attr("href",href); } //下载用户端 function sendMessageUSER() { if (navigator.userAgent.match(/(iPhone|iPod|iPad)/i)) { var href= "ctUserIos://zhaolingling/?wangzhao="+url; var client=$("#userbtn").data("id"); var ios='https://itunes.apple.com/cn/app/id1214194117?mt=8'; } else if (navigator.userAgent.match(/android/i)) { var href= "wanglangzhp://zhaolingling/?wangzhao="+url; } sendMessage(user,href,client,ios); $("#"+client).attr("href",href); } //获取手机 function sendMessage(download,href,client,ios){ var recordPhone = $("#recordPhone").val().trim(); var refereesId=getParam('refereesId'); var referralId=getParam('referralId'); var tell=/^1(3|4|5|7|8)\d{9}$/; if(!recordPhone){ $.alert("请输入手机号码"); return false; }else if(!tell.test(recordPhone)){ $.alert("请输入正确的手机号码!"); return false; }else { $.ajax({ type:'POST', url:'/api/v1s1/commonly/relRecord', dataType:'json', contentType:"application/json", data:JSON.stringify({ 'recordPhone':recordPhone, 'refereesId':refereesId, 'referralId':referralId }), success:function (obj) { if(obj.code=="OK"){ openclient(download,href,client,ios); } }, error:function (data) { $.alert(data.message); } }) } } //打开春桃医生用户端 var ua = navigator.userAgent.toLowerCase(); var t; var url=window.location.href; var config = { /*scheme:必须*/ scheme_IOS: "ctDoctorIos://zhaolingling/?wangzhao="+url, scheme_Adr: "wanglangzh://zhaolinglingwl/?wangzhao=="+url, download_url:'http://down.chuntaoyisheng.com/file/v1.0.0/patient-release.apk',// download_url:download, timeout: 600 }; function openclient(obj,scheme,client,ios) { var url=window.location.href; var schemeUrl = "wanglangzh://zhaolinglingwl/?wangzhao="+url; if (navigator.userAgent.match(/(iPhone|iPod|iPad)/i)) { var href=scheme;// $("#"+client).attr("href",href);// $("#"+client).trigger("click"); window.location=href; var loadDateTime = new Date(); window.setTimeout(function() { var timeOutDateTime = new Date(); if (timeOutDateTime - loadDateTime < 5000) { window.location = ios;//ios下载地址 } else { window.close(); } },250); } else if (navigator.userAgent.match(/android/i)) { var href=scheme; $("#"+client).attr("href",href); var startTime = Date.now(); var ifr = document.createElement('iframe');// ifr.src = ua.indexOf('os') > 0 ? scheme : config.scheme_Adr; ifr.src=scheme;// $.alert(scheme); ifr.style.display = 'none'; document.body.appendChild(ifr); var t = setTimeout(function() { var endTime = Date.now(); if (!startTime || endTime - startTime < config.timeout + 200) {// window.location = config.download_url; window.location=obj;// $.alert("你暂未下载春桃医生端App!") } else { } }, config.timeout); } window.onblur = function() { clearTimeout(t); } } //打开春桃医生用户端</script></html>
阅读全文
1 0
- 在web中判断是否有app,没有则跳转,包括读取a标签参数,获取后台数据
- 查询A表在关联B中是否有没有关联到的数据
- GirdView 同时传递两个参数,在原页面中判断是否有数据
- a标签href带参数跳转在javascript中问题
- 判断<a>标签跳转
- 怎样在js中控制a标签的href是否跳转
- 网页判断判断是否安装APP并启动,没有安装就跳转到下载页面
- 判断app是否后台运行,判断activity是否已经打开,是否点中home键
- 在input 标签中添加 a标签跳转链接
- iOS判断app在appstore是否有可用的更新
- a标签中有点击事件禁止跳转
- struts2标签判断集合中是否有值
- struts2 #parameters.XXX获取参数 在s:if标签中判断要注意!
- 判断是否有网络,如果没有网络,弹出对话框,然后可以跳转到设置页面
- h5判断移动设备是否安装了某app,有跳转,无则跳至下载页面
- Android判断app是否后台运行中,后台运行通知栏提示
- 判断数据窗口中是否有主键重复的数据
- 判断App是否在后台运行,判断App后台运行
- Android Paint的使用详解
- C语言学习
- Unity官方案例精讲笔记-unity脚本事件的执行顺序
- C++中for循环语句简析
- Zabbix Agent active主动模式监控日志(多关键字)
- 在web中判断是否有app,没有则跳转,包括读取a标签参数,获取后台数据
- quartz+oozie+sqoop批量导数
- JSONObject使用方法
- 【整理】I/O复用模型中的 select、poll、epoll
- 采药
- mapdb实现分析
- 闲聊软件测试自动化(3): 我们期望什么样的测试自动化?
- maven出现 invalid LOC header (bad signature)的解决办法
- 矩阵快速幂与快速幂模板 整理