local.min.js
6.94 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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
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;
}]);
})();