wuxw
2019-05-06 2b759ab5e5d708c4c9a6b4a093103c026667cf38
WebService/src/main/resources/static/js/core.js
@@ -58,19 +58,25 @@
(function(vc){
    vc.http = {
        post:function(componentCode,componentMethod,param,options,successCallback,errorCallback){
                vc.loading('open');
                Vue.http.post('/callComponent/'+componentCode +"/"+componentMethod, param, options)
                .then(function(res){
                    successCallback(res.bodyText,res);
                    vc.loading('close');
                }, function(error){
                    errorCallback(error.bodyText,error);
                    vc.loading('close');
                });
        },
        get:function(componentCode,componentMethod,param,successCallback,errorCallback){
                vc.loading('open');
                Vue.http.get('/callComponent/'+componentCode +"/"+componentMethod, param)
                .then(function(res){
                    successCallback(res.bodyText,res);
                    vc.loading('close');
                }, function(error){
                    errorCallback(error.bodyText,error);
                    vc.loading('close');
                });
        }
@@ -125,11 +131,60 @@
    //保存菜单
    vc.setCurrentMenu = function(_menuId){
        window.localStorage.setItem('hc_menuId',_menuId);
    }
    };
    //获取菜单
    vc.getCurrentMenu = function(){
        return window.localStorage.getItem('hc_menuId');
    };
    //保存用户菜单
    vc.setMenus = function(_menus){
        window.localStorage.setItem('hc_menus',JSON.stringify(_menus));
    };
    //获取用户菜单
    vc.getMenus = function(){
        return JSON.parse(window.localStorage.getItem('hc_menus'));
    };
    //保存当前小区信息 _communityInfo : {"communityId":"123213","name":"测试小区"}
    vc.setCurrentCommunity = function(_currentCommunityInfo){
        window.localStorage.setItem('hc_currentCommunityInfo',JSON.stringify(_currentCommunityInfo));
    };
    //获取当前小区信息
    // @return   {"communityId":"123213","name":"测试小区"}
    vc.getCurrentCommunity = function(){
        return JSON.parse(window.localStorage.getItem('hc_currentCommunityInfo'));
    };
    //保存当前小区信息 _communityInfos : [{"communityId":"123213","name":"测试小区"}]
    vc.setCommunitys = function(_communityInfos){
        window.localStorage.setItem('hc_communityInfos',JSON.stringify(_communityInfos));
    };
    //获取当前小区信息
    // @return   {"communityId":"123213","name":"测试小区"}
    vc.getCommunitys = function(){
        return JSON.parse(window.localStorage.getItem('hc_communityInfos'));
    };
    //删除缓存数据
    vc.clearCacheData = function(){
        window.localStorage.clear();
    };
    //将org 对象的属性值赋值给dst 属性名为一直的属性
    vc.copyObject = function(org,dst){
        //for(key in Object.getOwnPropertyNames(dst)){
        for(var key in dst){
            if (org.hasOwnProperty(key)){
                dst[key] = org[key]
            }
        }
    }
})(window.vc);
/**
@@ -170,4 +225,16 @@
      var s = time.getSeconds();
      return y+'-'+add0(m)+'-'+add0(d)+' '+add0(h)+':'+add0(mm)+':'+add0(s);
    }
})(window.vc);
})(window.vc);
(function(vc){
    vc.propTypes = {
        string:"string",//字符串类型
        array:"array",
        object:"object",
        number:"number"
    }
})(window.vc)