新版app输入地址后右上角会有一个设置服务器地址的图标
原因是因为h5没有和app交互
文件地址
1.核心代码
    this.IosJsBridge = function (callback) {
        if (window.WebViewJavascriptBridge) {
            return callback(WebViewJavascriptBridge);
        }
        if (window.WVJBCallbacks) {
            return window.WVJBCallbacks.push(callback);
        }
        window.WVJBCallbacks = [callback]; // 创建一个 WVJBCallbacks 全局属性数组,并将 callback 插入到数组中。
        var WVJBIframe = document.createElement('iframe'); // 创建一个 iframe 元素
        WVJBIframe.style.display = 'none'; // 不显示
        WVJBIframe.src = 'wvjbscheme://__BRIDGE_LOADED__'; // 设置 iframe 的 src 属性
        document.documentElement.appendChild(WVJBIframe); // 把 iframe 添加到当前文导航上。
        setTimeout(function() { document.documentElement.removeChild(WVJBIframe) }, 0)
    }
    this.AndroidJsBridge = function(callback) {
        if (window.WebViewJavascriptBridge) {
            callback(WebViewJavascriptBridge)
        } else {
            document.addEventListener(
                'WebViewJavascriptBridgeReady'
                , function() {
                    callback(WebViewJavascriptBridge)
                },
                false
            );
        }
    };
位置在Portal/Mobile/js/services.js
2.登录交互(Portal/Mobile/js/controller/loginCtrl.js)

001D010D-A1F9-496a-85EC-108506D09214.png

注意添加:ionicPlatform   
module.controller('loginCtrl', function ($scope, $rootScope, $ionicHistory, $state, commonJS, loginService, focus, $ionicPlatform) {
3.登录后交互 (Portal/Mobile/js/controller/homeCtrl.js)

869F1B26-9A4B-413d-9E5F-8692F09365A1.png

注意添加:ionicPlatform  
    module.controller('HomeCtrl', function ($scope, $rootScope, $state, $stateParams, $timeout, $ionicLoading, $http, $ionicScrollDelegate, $ionicSlideBoxDelegate, httpService, commonJS, workItemService, $ionicHistory, $cordovaBadge,$ionicPlatform) {

Kanni
22 声望0 粉丝

null