local.min.js 6.94 KB
var initApp=function(){
    "use strict";
    var ref = [
        /*公共组件依赖*/
        "xn.common", /*公共指令 xn.directive.common 、xn.filter.common、xn.service.common*/
        "xn.service.interceptor",   /*拦截器*/
        "xn.directive.top",          /*灯塔组件*/
        "xn.directive.loading",     /*进度条*/
        /**/
        "xn.guide.filter",
        "xn.guide.service",
        /*当前项目页面*/
        "xn.page",
        /*项目需求加载组件*/
        "ui.bootstrap"
    ];

    var app =angular.module("xn", ref);

    /*基本配置设置*/
    app.value("xnConfig",xnConfig);
    /*拦截器设置*/
    app.config(["$httpProvider", function ($httpProvider) {
        $httpProvider.interceptors.push("httpInterceptor");
    }]);

    app.controller("BodyController",["$scope", function($scope) {

        $scope.global={loadingInit:false};
        $scope.maxPageSize=5;


        /*导航效果处理(一二级导航)*/
        var navShow=''; /*临时存储*/
        var subNavShow='';
        $scope.$on("navShow",function(event ,show){
            $scope.navShow=show;
            navShow=show;
            console.log(navShow)
        });
        /*二级导航*/
        $scope.$on("subNavShow",function(event ,show){
            $scope.subNavShow=show;
            subNavShow=show;
        });

        $scope.navMouseenter=function (number) {
            $scope.navShow=number;
            $scope.subNavShow=null;
        };
        /*移出导航*/
        $scope.cancelNav=function () {
            $scope.navShow=navShow;
            $scope.subNavShow=subNavShow;
        };
        $scope.cancelSubNav=function () {
            $scope.subNavShow=null;
        };



        /*导航*/
        $scope.navActive=null;
        $scope.doSetActive=function (index) {
            if($scope.navActive===index){
                $scope.navActive=null;
            }else {
                $scope.navActive=index;
            }
        };
        $scope.navList=[
            {
                title:"html / css",
                link:"",
                childList:[
                    {title:"H5",link:""},
                    {title:"CSS3",link:""},
                    {title:"Less",link:""}
                ]
            },
            {
                title:"JavaScript",
                link:"",
                childList:[
                    {title:"jquery",link:""}
                ]
            },
            {
                title:"移动端",
                link:"",
                childList:[
                    {title:"H5",link:""},
                    {title:"CSS3",link:""},
                    {title:"Less",link:""}
                ]
            },
            {
                title:"Angular",
                link:"",
                childList:[
                    {title:"项目",link:"/guide/angular/create/index.htm"},
                    {title:"基础知识",link:"/guide/angular/module/index.htm"},
                    {title:"bug",link:"/guide/angular/module/index.htm"},
                    {title:"组件",link:"/guide/angular/module/index.htm"}
                ]
            },
            {
                title:"Vue",
                link:"",
                childList:[
                    {title:"H5",link:""},
                    {title:"CSS3",link:""},
                    {title:"Less",link:""}
                ]
            },
            {
                title:"React",
                link:"",
                childList:[
                    {title:"H5",link:""},
                    {title:"CSS3",link:""},
                    {title:"Less",link:""}
                ]
            },
            {
                title:"Node",
                link:"",
                childList:[
                    {title:"H5",link:""},
                    {title:"CSS3",link:""},
                    {title:"Less",link:""}
                ]
            }
        ];

        //日期转换函数
        Date.prototype.format = function(format){
            var o = {
                "M+" : this.getMonth()+1, //month
                "d+" : this.getDate(),    //day
                "h+" : this.getHours(),   //hour
                "m+" : this.getMinutes(), //minute
                "s+" : this.getSeconds(), //second
                "q+" : Math.floor((this.getMonth()+3)/3),  //quarter
                "S" : this.getMilliseconds() //millisecond
            };
            if(/(y+)/.test(format)) format=format.replace(RegExp.$1,
                (this.getFullYear()+"").substr(4 - RegExp.$1.length));
            for(var k in o)if(new RegExp("("+ k +")").test(format))
                format = format.replace(RegExp.$1,
                    RegExp.$1.length==1 ? o[k] :
                        ("00"+ o[k]).substr((""+ o[k]).length));
            return format;
        };

        //关闭错误
        $scope.closeAlert = function (index,form) {
            form.splice(index,1);
        };

    }]);
};
(function(){
    "use strict";
    angular.module("xn.guide.filter", [])

})();
(function(){
    "use strict";
    angular.module("xn.guide.service", [])
    .config(['$httpProvider',
            function ($httpProvider) {
                $httpProvider.defaults.headers.post['Content-Type'] = 'text/plain';
                $httpProvider.defaults.withCredentials=true;
                $httpProvider.defaults.useXDomain = true;
            }])
    .factory('guideService', ['$http', function ($http) {
        var service = {};
        var url = "/api/tutorial.do";
        /**
        * 根据Id获取部门
        */
        service.getDepartment = function (data) {
            return $http({method: 'POST', url: url, data: data, params: {"method": "api.tutorial.department.get"}});
        };
        return service;
        }])
        .factory('myService', ['$http', function ($http) {
            var service = {};
            var url = xnConfig.myUrl+"/api/foundation.do";
            var sysUrl=xnConfig.myUrl+"system/api.do";
            var diskUrl=xnConfig.myUrl+"/api/diskFileUpload.do";
            /*获取承租人信息*/
            service.getTenant = function (data) {
                return $http({
                    method: 'POST',
                    url: sysUrl,
                    data: data,
                    params: {"method": "api.system.tenant.get"} });
            };

            /*获取*/
            service.apiFoundationDiskGet = function (data) {
                return $http({
                    method: 'POST',
                    url: url,
                    data: data,
                    params: {"method": "api.foundation.disk.get"} });
            };

            //上传附件
            service.diskFileUpload = function (data) {
                return  $http({
                    method: 'POST',
                    url: diskUrl,
                    headers: {'Content-Type': undefined },
                    transformRequest: angular.identity,
                    data: data

                });
            };
        return service;
    }]);
})();