guide.js
4.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
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;
/*导航*/
$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);
};
}]);
};