|

楼主 |
发表于 2017-9-18 18:06:07
|
显示全部楼层
- require("cordova!cordova-plugin-customurlscheme");
- var Model = function(){
- this.callParent();
- //修改主页,初始化门户
- this.on('onInit', function(event) {
- event.config.main.url = '$UI/IntegratedApp/mobile/xfj/main.w';
- event.config.changePassword.url = '$UI/portal/mobile/changePassword/changePassword.w';
- event.config.loginURL = '$UI/IntegratedApp/mobile/xfj/login.w';
- event.config.leftURL = '';
-
- this.initPortal();
- });
-
- //登录前清理相关
- this.on('onBeforeLogin', this.doBeforeLogin);
- //登录成功后加载展现
- this.on('onLogin', this.doAfterLogin);
- //onload事件
- this.on('onLoad', this.doLoad);
-
- this.eventName = new Date().getTime() + "";
- $(window).on('handleOpenURL.'+this.eventName,this.handleOpenURL);
-
- var u = navigator.userAgent, app = navigator.appVersion;
- var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; // android终端或者uc浏览器
- var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); // ios终端
- if (isIOS) {
- alert("isIOS");
- // 通过iframe的方式试图打开APP,如果能正常打开,会直接切换到APP,并自动阻止a标签的默认行为
- // 否则打开a标签的href链接
- var ifr = document.createElement('iframe');
- ifr.src = 'X5XXPT://';
- ifr.style.display = 'none';
- document.body.appendChild(ifr);
- window.setTimeout(function() {
- document.body.removeChild(ifr);
- }, 3000);
- }
- if (isAndroid) {
- alert("isAndroid");
- var ifr = document.createElement("iframe");
- ifr.src = "X5XXPT://";// 打开app的协议,有app同事提供
- ifr.style.display = "none";
- document.body.appendChild(ifr);
- window.setTimeout(function(){
- document.body.removeChild(ifr);
- },2000);
- }
- };
- Model.prototype.modelUnLoad = function(event) {
- if (this._updateDateTimeHandle)
- window.clearInterval(this._updateDateTimeHandle);
- $(window).off("handleOpenURL." + this.eventName);
- };
- // 在此接收URL参数
- Model.prototype.handleOpenURL = function(event, url) {
- justep.Util.hint("接收到URL参数: " + url);
- // justep.Util.hint("开发者现在可以根据接收到的URL参数进行不同的处理,在此并不在做展示");
- };
复制代码 这是我现在的代码,还是不能跳转
|
|