app.js
27.7 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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
/**
calendar.js * @ngdoc overview
* @name angularjsApp
* @description
* # angularjsApp
*
* Main module of the application.
*/
var App = angular
.module('espeed', [
'ui.router',
'ngAnimate',
'ngCookies',
'ngResource',
'ui.bootstrap',
'oc.lazyLoad',
'ngRoute',
'ngSanitize',
'ngTouch'
]);
App.run(["$rootScope", "$state", "$stateParams", "$location", '$window', '$templateCache','GetUserParam', function ($rootScope, $state, $stateParams, $location, $window, $templateCache,GetUserParam) {
//清空template缓存
$rootScope.$on('$routeChangeStart',function(event,next,current){
if (typeof(current) !== 'undefined'){
$templateCache.remove(current.templateUrl);
}
})
// Set reference to access them from any scope
$rootScope.$state = $state;
$rootScope.$stateParams = $stateParams;
$rootScope.$storage = $window.localStorage;
$rootScope.kediter = "";
$rootScope.mailid = 0;
$rootScope.pagesize=20;
$rootScope.maxSize = 5;
$rootScope.myinfo='';
$rootScope.userType=0; //1:营销邮用户(企业未开通客户管理模块),0:易外销用户(企业开通了客户管理模块)
$rootScope.userInfo='';//当前用户的信息集合
$rootScope.specificTime=[];//具体时间集合
$rootScope.webUrl = "",//网页url
$rootScope.modul_thumbnail = "";//模板上传缩约图
$rootScope.ismanager = 0;
$rootScope.isnotsys = false; //判断是否是info和kf账号
$rootScope.levelType = 0; //判断模板的级别
$rootScope.temp_webUrl = ""; //模板内容url
$rootScope.tableTitle = "客户分类"; //新建计划表格标题
$rootScope.other_name = ""; //个性营销条件值
$rootScope.runType = 0; //立即营销跳转到写信,0:非跳转,1:本地库跳转,2:客户库跳转
$rootScope.is_yunying = 0;//判断当前用户是否是运营 0:不是 1:是
GetUserParam.getuserinfo().then(function(data){
if(data!=null){
$rootScope.userInfo = data;
$rootScope.myinfo=data.login_id+"@"+data.domain;
$rootScope.userType = data.user_type;
$rootScope.is_yunying = data.is_yunying;
//waimaoyou.cn不显示公司模板
var account = $rootScope.myinfo;
var temp = account.split("@");
if(temp[1]!='waimaoyou.cn'){
$rootScope.isnotdomain = true;
}else{
$rootScope.isnotdomain = false;
}
}
});
$rootScope.logout=function(){
if(confirm("您确定要退出吗?")){
window.location.href="logout.action";
}
}
//点击屏幕其他地方隐藏
$('body').click(function (e) {
var target = $(e.target);
if (!target.is('#navbar-hover,#navbar-hover *')) {
$('.ng-div').hide(200);
$('#navbar-hover').removeClass('navbar-hover1')
}else{
$('#navbar-hover').addClass('navbar-hover1')
$('.ng-div').show(200);
}
document.getElementById("right_video").style.display = "none";
});
//修改密码
$rootScope.updateCurrentUserPwd = function (id) {
$("#edit_old_pwd").val('');
$("#edit_password1").val('');//清空
$("#edit_password2").val('');
$("#dialog-updatepwd1").dialog({
modal: true,
resizable: false,
width: 360,
close:function(){
$(this).dialog("destroy");
},
buttons: {
"确认修改": function () {
var oldPassword = $("#edit_old_pwd").val();//原密码
var password1 = $("#edit_password1").val();//新密码
var password2 = $("#edit_password2").val();//确认密码
//判断旧密码
if(oldPassword.length == 0){
$rootScope.tipshow(0, '原密码不能为空');
return false
}
//验证新密码
if(oldPassword.length < 6 || oldPassword.length > 16){
$rootScope.tipshow(0, '原密码长度6-16位');
return false
}
//判断新密码是否为空
if(password1.length == 0){
$rootScope.tipshow(0, '新密码不能为空');
return false
}
//验证新密码
if(password1.length < 6 || password1.length > 16){
$rootScope.tipshow(0, '新密码长度6-16位');
return false
}
//判断确认新密码是否为空
if(password2.length == 0){
$rootScope.tipshow(0, '确认密码不能为空');
return false
}
//验证确认密码
if(password2.length < 6 || password2.length > 16){//验证确认密码
$rootScope.tipshow(0, '确认密码长度6-16位');
return false
}
//判断新密码和确认密码是否相等
if(password1 != password2){//验证确认密码
$rootScope.tipshow(0, '两次输入的密码不一致,请重新输入');
return false
}
var datapost = {up_userid:id,up_password:oldPassword};
//判断原密码是否输入正确
GetUserParam.verifyuserpassword(datapost).then(function(data){
if(parseInt(data) == 0){
$rootScope.tipshow(0, '原密码输入错误');
return false
}else{
//将验证完的密码传入后台修改密码
var datapost1 = {up_userid:id,up_password:password2};
GetUserParam.updateuserpassword(datapost1).then(function(data){
if(parseInt(data)==1){ //成功
$rootScope.tipshow(1, '修改成功');
}else{
$rootScope.tipshow(0, '修改失败');
}
});
$("#dialog-updatepwd1").dialog("destroy");
}
});
},
"取消": function () {
$(this).dialog("destroy");
}
}
});
};
//窗口大小改变时,对话框始终居中
window.onresize = function(){
var bodyW = $(window).width();
var bodyH = $(window).height();
var elW = $("#videoDialog").width();
var elH = $("#videoDialog").height();
$("#videoDialog").css({"left":(bodyW-elW)/2 + 'px',"top":(bodyH-elH)/2 + 'px'});
};
//右键视频属性
$rootScope.videoAttribute = function(){
$("#video_bg").show();
$("#videoDialog").show();
document.getElementById("right_video").style.display = "none";
var videoSrc = imgClick[0].getAttribute('src');//获取视频路径
var videoWidth = imgClick[0].getAttribute('width');//获取视频宽度
var videoHeight = imgClick[0].getAttribute('height');//获取视频高度
var videoAutoplay = imgClick[0].getAttribute('autoplay');//获取视频是否自动播放
$("#videoUrl").val(videoSrc)
$("#videoWidth").val(videoWidth)
$("#videoHeight").val(videoHeight)
if(videoAutoplay != null){
$("#videoPlay").prop("checked",true);
}else{
$("#videoPlay").prop("checked",false);
}
//点击关闭
$(".video_close").click(function(){
$("#videoDialog").hide();
$("#video_bg").hide();
})
var videoAttrH = videoHeight;
//修改宽度随之高度也改变
$("#videoWidth").blur(function(){
//修改宽高
videoAttrH = Math.round(videoHeight / videoWidth * parseInt($("#videoWidth").val(), 10));
$("#videoHeight").val(videoAttrH)
});
//点击弹窗video属性修改
$("#confirmUpdate").off("click").on("click",function(){
//修改图片路径
if($("#videoUrl").val() == ""){
alert("请输入有效的URL地址。");
return;
}
imgClick[0].setAttribute("src", $("#videoUrl").val());
imgClick[0].setAttribute("data-ke-src", $("#videoUrl").val());
//修改图片宽高
imgClick[0].setAttribute("width", $("#videoWidth").val());
if(videoWidth == $("#videoWidth").val()){ //宽度没有改变
imgClick[0].setAttribute("height", $("#videoHeight").val());
}else{
imgClick[0].setAttribute("height", videoAttrH);
}
//设置自动播放
if($("#videoPlay").is(':checked')){
imgClick[0].setAttribute("autoplay", "true");
}else{
imgClick[0].removeAttribute("autoplay");
}
//关闭弹窗
$("#videoDialog").hide();
$("#video_bg").hide();
});
};
// Scope Globals
// -----------------------------------
$rootScope.app = {
name: '时速邮件CRM',
description: '时速邮件CRM,描述',
year: ((new Date()).getFullYear()),
layout: {
isFixed: true,
isCollapsed: false,
isBoxed: false,
isRTL: false,
horizontal: false,
isFloat: false,
asideHover: false,
theme: null
},
viewAnimation: 'ng-fadeInUp'
};
//清空控件
$rootScope.clearinput = function () {
$("input:text").val("");
$("input:file").val("");
$("select").val(0);
$("textarea").val("");
};
var transform = function (data) {
return $.param(data);
};
$rootScope.postCfg = {
headers: {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'},
transformRequest: transform
};
//定义全局变量 默认等于0
$rootScope.crmtype=0;
// 检查列表选中位置
var isActive = function (item) {
if (!item) return;
var loc = $location.url();
var foundActive = false;
if (item == loc) foundActive = true;
return foundActive;
};
$rootScope.getActiveClass = function (item) {
return isActive(item) ? ' active' : '';
};
$rootScope.tipshow = function (k, txt) {
var $tip = $(".lg-showtip");
if (k == 1) {
$tip.removeClass("alert alert-danger").addClass("alert alert-success");
} else if (k == 0) {
$tip.removeClass("alert alert-success").addClass("alert alert-danger");
} else {
$tip.removeClass("alert alert-danger").addClass("alert alert-success");
}
$tip.html(txt);
var tipwidth = $tip.width();
$tip.css({"margin-left": -tipwidth / 2 + "px"});
$tip.fadeIn(200);
setTimeout(function () {
$tip.fadeOut(200);
}, 4000);
}
}]);
App.config(['$stateProvider', '$locationProvider', '$urlRouterProvider', 'RouteHelpersProvider','$httpProvider',
function ($stateProvider, $locationProvider, $urlRouterProvider, helper,$httpProvider) {
'use strict';
//清空route缓存
if(!$httpProvider.defaults.headers.get){
$httpProvider.defaults.headers.get = {};
}
$httpProvider.defaults.headers.common["X-Requested-With"] = 'XMLHttpRequest';
$httpProvider.defaults.headers.get["Cache-Control"] = 'no-cache';
$httpProvider.defaults.headers.get["Pragma"] = 'no-cache';
$locationProvider.html5Mode(false);
// default route
var customerid=$("#customerid").val();
var iscrmsend=$("#iscrmsend").val();
var getTimestamp = new Date().getTime();
if(iscrmsend==1){
var customeremail=$("#customeremail").val();
var jinchengid=$("#jinchengid").val();
$urlRouterProvider.otherwise('/es/email');
$stateProvider.state("app.email", {
url: "/email",
templateUrl: helper.basepath('email.html?timestamp=' + getTimestamp),
params: {mailid: 0,emails:customeremail,typeid:0,typename:"",sendci:0,iscrmsend:iscrmsend,jinchengid:jinchengid,customerid:customerid,utype:0},
resolve: helper.resolveFor('kindeditor','html2canvas', 'angularBootstrapNavTree', 'angularFileUpload'),
controller: 'emailCtrl'
})
}else{
$("#customeremail").val("");
$urlRouterProvider.otherwise('/es/home');
$stateProvider.state("app.email", {
url: "/email",
templateUrl: helper.basepath('email.html?timestamp=' + getTimestamp),
params: {mailid: 0,emails:"",typeid:0,typename:"",sendci:0,iscrmsend:iscrmsend,jinchengid:"",customerid:customerid,utype:0},
resolve: helper.resolveFor('kindeditor','html2canvas', 'angularBootstrapNavTree', 'angularFileUpload'),
controller: 'emailCtrl'
})
}
// Application Routes
// -----------------------------------
$stateProvider
.state('app', {
url: '/es',
templateUrl: helper.basepath('app.html?timestamp=' + getTimestamp),
resolve: helper.resolveFor('jquery-ui', 'animate', 'datetimepicker', 'slimScroll', 'perfectscrollbar', 'icons', 'bootstrapvalidator', 'jquery-form')
})
.state("app.home", {
url: "/home",
templateUrl: helper.basepath('home.html?timestamp=' + getTimestamp),
resolve: helper.resolveFor('flot-chart', 'flot-chart-plugins'),
controller:'homeCtrl'
})
.state("app.emailsuccess", {
url: "/emailsuccess",
templateUrl: helper.basepath('emailsuccess.html?timestamp=' + getTimestamp),
params: {result:""},
controller: 'emailsuccessCtrl'
}).state("app.task", {
url: "/task",
templateUrl: helper.basepath('sendtask/index.html?timestamp=' + getTimestamp)
}).state("app.task.wait", {
url: "/wait",
templateUrl: helper.basepath('sendtask/sendwait.html?timestamp=' + getTimestamp)
}).state("app.task.time", {
url: "/time",
templateUrl: helper.basepath('sendtask/sendtime.html?timestamp=' + getTimestamp),
controller: 'TasktimeCtrl'
}).state("app.task.timingmailinfo", {
url: "/timingmailinfo/:mailId",
templateUrl: helper.basepath('sendtask/timingmailinfo.html?timestamp=' + getTimestamp),
controller: 'timingmailinfoCtrl'
}).state("app.success", {
url: "/success",
templateUrl: helper.basepath('success/index.html?timestamp=' + getTimestamp),
controller:'sendindexCtrl'
}).state("app.success.sendsuccess", {
url: "/sendsuccess",
params: {mailUID:""},
templateUrl: helper.basepath('success/sendsuccess.html?timestamp=' + getTimestamp),
controller:'sendsuccessCtrl'
}).state("app.success.sendnum", {
url: "/sendnum/:mailId",
templateUrl: helper.basepath('success/sendnum.html?timestamp=' + getTimestamp),
controller: 'sendnumCtrl'
}).state("app.success.sendmailinfo", {
url: "/sendmailinfo/:mid/:mailId",
templateUrl: helper.basepath('success/sendmailinfo.html?timestamp=' + getTimestamp),
controller: 'sendmailinfoCtrl'
}).state("app.success.sendread", {
url: "/sendread",
templateUrl: helper.basepath('success/sendread.html?timestamp=' + getTimestamp),
controller: 'sendreadCtrl'
}).state("app.success.sendtype", {
url: "/sendtype",
templateUrl: helper.basepath('success/sendtype.html?timestamp=' + getTimestamp)
}).state("app.plan", {
url: "/plan",
templateUrl: helper.basepath('plan/index.html?timestamp=' + getTimestamp)
}).state("app.plan.timeline", {
url: "/timeline",
templateUrl: helper.basepath('plan/timeline.html?timestamp=' + getTimestamp),
controller: 'timelineCtrl'
}).state("app.plan.planview", {
url: "/planview",
templateUrl: helper.basepath('plan/planview.html?timestamp=' + getTimestamp),
controller: 'planviewCtrl'
}).state("app.plan.planadd", {
url: "/planadd",
templateUrl: helper.basepath('plan/planadd.html?timestamp=' + getTimestamp),
controller: 'planaddCtrl'
}).state("app.template", {
url: "/template",
templateUrl: helper.basepath('template/index.html?timestamp=' + getTimestamp),
controller: 'templateCtrl'
}).state("app.template.tempsys", {
url: "/tempsys",
templateUrl: helper.basepath('template/tempsys.html?timestamp=' + getTimestamp),
controller: 'tempsysCtrl'
}).state("app.template.tempcom", {
url: "/tempcom",
templateUrl: helper.basepath('template/tempcom.html?timestamp=' + getTimestamp),
controller: 'tempcomCtrl'
}).state("app.template.tempuser", {
url: "/tempuser",
templateUrl: helper.basepath('template/tempuser.html?timestamp=' + getTimestamp),
controller: 'tempuserCtrl'
}).state("app.template.add", {
url: "/addtemp",
templateUrl: helper.basepath('template/add.html?timestamp=' + getTimestamp),
params: {mid: 0,levelid:0},
resolve: helper.resolveFor('kindeditor','html2canvas'),
controller: 'tempaddCtrl'
})
// .state("app.template.view", {
// url: "/viewtemp",
// templateUrl: helper.basepath('template/tempview.html?timestamp=' + getTimestamp),
// params: {mid: 0,levelid:0},
// resolve: helper.resolveFor('kindeditor'),
// controller: 'tempviewCtrl'
// })
.state("app.template.preview", {
url: "/preview",
templateUrl: helper.basepath('preview/tempview.html?timestamp=' + getTimestamp),
params: {mid: 0},
controller: 'tempviewCtrl'
})
.state("app.reportforms", {
url: "/reportforms",
templateUrl: helper.basepath('reportforms.html?timestamp=' + getTimestamp),
resolve: helper.resolveFor('hjs'),
controller: 'reportformsCtrl'
}).state("app.address", {
url: "/address",
templateUrl: helper.basepath('address/index.html?timestamp=' + getTimestamp),
controller: 'addressCtrl'
}).state("app.address.mail", {
url: "/mail",
templateUrl: helper.basepath('address/address.html?timestamp=' + getTimestamp),
controller: 'addressmailCtrl'
}).state("app.address.typelist", {
url: "/typelist",
templateUrl: helper.basepath('address/typelist.html?timestamp=' + getTimestamp),
controller: 'typelistCtrl'
}).state("app.filter", {
url: "/filter",
templateUrl: helper.basepath('filter/index.html?timestamp=' + getTimestamp),
controller: 'filterCtrl'
}).state("app.filter.filtertype", {
url: "/filtertype",
templateUrl: helper.basepath('filter/filtertype.html?timestamp=' + getTimestamp),
controller: 'filtertypeCtrl'
}).state("app.filter.filterword", {
url: "/filterword",
templateUrl: helper.basepath('filter/filterword.html?timestamp=' + getTimestamp),
controller: 'filterwordCtrl'
}).state("app.filter.unsubscribe", {
url: "/unsubscribe",
templateUrl: helper.basepath('filter/unsubscribe.html?timestamp=' + getTimestamp),
controller: 'unsubscribeCtrl'
}).state("app.user", {
url: "/user",
templateUrl: helper.basepath('usermanage/index.html?timestamp=' + getTimestamp),
controller: 'userCtrl'
}).state("app.user.info", {
url: "/info",
templateUrl: helper.basepath('usermanage/userinfo.html?timestamp=' + getTimestamp),
controller: 'infoCtrl'
}).state("app.user.haveread", {
url: "/haveread",
templateUrl: helper.basepath('usermanage/haveread.html?timestamp=' + getTimestamp),
controller: 'readCtrl'
}).state("app.user.maillist", {
url: "/maillist",
templateUrl: helper.basepath('usermanage/maillist.html'),
controller: 'maillistCtrl'
}).state("app.user.domaincount", {
url: "/domaincount",
templateUrl: helper.basepath('usermanage/domaincount.html?timestamp=' + getTimestamp),
resolve: helper.resolveFor('flot-chart', 'flot-chart-plugins'),
controller: 'domaincountCtrl'
}).state("app.user.count", {
url: "/count",
templateUrl: helper.basepath('usermanage/count.html?timestamp=' + getTimestamp),
resolve: helper.resolveFor('hjs'),
controller: 'usercountCtrl'
}).state("app.user.usermailinfo", {
url: "/usermailinfo/:mid/:mailId",
templateUrl: helper.basepath('usermanage/usermailinfo.html?timestamp=' + getTimestamp),
controller: 'usermailinfoCtrl'
})
}]);
/**=========================================================
* Module: constants.js
* Define constants to inject across the application
=========================================================*/
App.constant('APP_REQUIRES', {
// jQuery based and standalone scripts
scripts: {
'slimScroll': ['bower_components/slimScroll/jquery.slimscroll.min.js'],
'icons': ['bower_components/font-awesome/css/font-awesome.min.css'],
'flot-chart': ['bower_components/Flot/jquery.flot.js'],
'animate': ['bower_components/animate.css/animate.min.css'],
'flot-chart-plugins': ['bower_components/flot.tooltip/js/jquery.flot.tooltip.min.js',
'bower_components/Flot/jquery.flot.resize.js',
'bower_components/Flot/jquery.flot.pie.js',
'bower_components/Flot/jquery.flot.time.js',
'bower_components/Flot/jquery.flot.categories.js',
'bower_components/flot-spline/js/jquery.flot.spline.min.js'],
'jquery-form': ['bower_components/jquery/jquery.form.js'],
'jquery-ui': ['bower_components/jquery-ui/jquery-ui-1.10.0.custom.css', 'bower_components/jquery-ui/jquery-ui-1.10.0.custom.min.js'],
'filestyle': ['bower_components/bootstrap-filestyle/src/bootstrap-filestyle.js'],
'bootstrapvalidator': ['bower_components/bootstrapvalidator/dist/css/bootstrapValidator.min.css', 'bower_components/bootstrapvalidator/dist/js/bootstrapValidator.min.js']
},
// Angular based script (use the right module name)
modules: [
{name: 'kindeditor', files: ['bower_components/kindeditor-4.1.10/kindeditor.js']},
{
name: 'angularBootstrapNavTree',
files: ['bower_components/angular-bootstrap-nav-tree/dist/abn_tree_directive.js',
'bower_components/angular-bootstrap-nav-tree/dist/abn_tree.css']
},
{name: 'html5uploader', files: ['bower_components/html5uploader/jquery.html5uploader.min.js']},
{
name: 'perfectscrollbar',
files: ['bower_components/perfect-scrollbar/css/perfect-scrollbar.css', 'bower_components/perfect-scrollbar/js/perfect-scrollbar.jquery.js']
},
{name: 'angularFileUpload', files: ['bower_components/angular-file-upload/dist/angular-file-upload.min.js']},
//{
// name: 'datetimepicker',
// files: [ 'bower_components/bootstrap-datetimepicker/bootstrap-datetimepicker.min.css','bower_components/bootstrap-datetimepicker/bootstrap-datetimepicker.min.js']
//},
{
name: 'datetimepicker',
files: [ 'bower_components/datetimepicker/jquery.datetimepicker.css','bower_components/datetimepicker/jquery.datetimepicker.js']
},
{
name: 'hjs',
files: [ 'bower_components/hjs/highcharts.js']
}
,{
name: 'html2canvas',
files: [ 'bower_components/html2canvas/html2canvas.js']
},{
name: 'Jcrop',
files: [ 'bower_components/jquery-Jcrop/css/jquery.Jcrop.css','bower_components/jquery-Jcrop/js/jquery.Jcrop.js']
}
]
}).constant('paginationConfig', {
itemsPerPage: 20,
boundaryLinks: false,
directionLinks: true,
firstText: '首页',
previousText: '上一页',
nextText: '下一页',
lastText: '最后',
rotate: true
})
/**=========================================================
* Module: helpers.js
* 提供路由定义的辅助函数
=========================================================*/
App.provider('RouteHelpers', ['APP_REQUIRES', function (appRequires) {
"use strict";
// 在此基础上设置相对路径
// 应用于所有的应用程序视图
this.basepath = function (uri) {
return 'app/views/' + uri;
};
// 通过脚本名称生成解决对象
// 在constant.app_requires先前配置
this.resolveFor = function () {
var _args = arguments;
return {
deps: ['$ocLazyLoad', '$q', function ($ocLL, $q) {
// 为每个参数创建一个承诺链
var promise = $q.when(1); // empty promise
for (var i = 0, len = _args.length; i < len; i++) {
promise = andThen(_args[i]);
}
return promise;
// 创建承诺链动态
function andThen(_arg) {
// 还支持一个函数,返回一个承诺
if (typeof _arg == 'function')
return promise.then(_arg);
else
return promise.then(function () {
// 如果是一个模块,通过名称。如果没有,通过数组
var whatToLoad = getRequired(_arg);
// 简单的错误检查
if (!whatToLoad) return $.error('Route resolve: Bad resource name [' + _arg + ']');
// 最后,返回一个承诺
return $ocLL.load(whatToLoad);
});
}
// 检查并返回所需的数据
// 分析模块项目的形式[name: '', files: []]
// 脚本文件简单的数组(没有角的JS)
function getRequired(name) {
if (appRequires.modules)
for (var m in appRequires.modules)
if (appRequires.modules[m].name && appRequires.modules[m].name === name)
return appRequires.modules[m];
return appRequires.scripts && appRequires.scripts[name];
}
}]
};
}; // resolveFor
// 非必要,只用于在配置块的路由
this.$get = function () {
};
}]);