top.js
29.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
//公共组件
//服务接口
angular.module("xn/template/header.html",[]).run(["$templateCache", function($templateCache) {
"use strict";
$templateCache.put("headerTopInfoCenter/tpl.html",
"<div class='xn-pharos clearfix'>"
+ " <ul class='header-right clearfix' ng-init='pcApp=false;phoneApp=false;showApp=false;showMessage=false;showTask=false;showPersonInfo=false;'>"
+" <li class='header-li' ng-show='showConfig.isShowApp||showConfig.isShowYun||showConfig.isShowAddressBook'>"
+" <span class='light-item' ng-show='showConfig.isShowApp' ng-mouseover='pcApp=true;' ng-mouseleave='pcApp=false'><a class='light-txt'>{{i18n.new.appPc }}</a>"
+" <div class='header-list pc-app' ng-show='pcApp==true' ng-mouseover='pcApp=true;' ng-mouseleave='pcApp=false'>"
+" <div class='hide-tri'></div>"
+" <div class='header-info-ul header-info-pc-app clearfix'>"
+" <div class='pc-app-item'>" +
" <a class='pc-app-link' href='http://xn-static.oss-cn-hangzhou.aliyuncs.com/soft/xntalk/win/XNTALK-WIN.zip' target='_blank' download=\"XNTALK-WIN.zip\">" +
" <div class='pc-app-icon pc-app-mac'></div>" +
" <div class='pc-app-name'>{{i18n.new.appPcMacName}}</div>" +
" </a></div>"
+" <div class='pc-app-item'>" +
" <a class='pc-app-link' href='http://xn-static.oss-cn-hangzhou.aliyuncs.com/soft/xntalk/osx/XNTALK-OSX.zip' target='_blank' download=\"XNTALK-OSX.zip\">" +
" <div class='pc-app-icon pc-app-win'></div>" +
" <div class='pc-app-name'>{{i18n.new.appPcWinName}}</div>" +
" </a></div>"
+" </div>"
+" </div>"
+" </span>"
+" <span class='light-item' ng-show='showConfig.isShowApp' ng-mouseover='phoneApp=true;' ng-mouseleave='phoneApp=false'><a class='light-txt'>{{i18n.new.app }}</a>"
+" <div class='header-list phone-app' ng-show='phoneApp==true' ng-mouseover='phoneApp=true;' ng-mouseleave='phoneApp=false'>"
+" <div class='hide-tri'></div>"
+" <div class='header-info-ul'>"
+ "<img src='https://cdn.xiniunet.com/web/auth/img/xntalk.jpg' width='100%'>"
+" </div>"
+" </div>"
+" </span>"
+" <span class=\"light-item\" ng-show='showConfig.isShowYun'><a class='light-txt ' href='{{xnConfig.myUrl}}pan/file.htm' target='_blank'>{{i18n.new.disk }}</a></span>"
+" <span class=\"light-item\" ng-show='showConfig.isShowAddressBook'><a class='light-txt' href='{{xnConfig.myUrl}}addressBook.htm' target='_blank'>{{i18n.new.contacts}}</a></span>"
+" </li>"
+" <li class='header-li' ng-class=\"!showConfig.isShowCustomer&&!showConfig.isShowYun&&!showConfig.isShowAddressBook?'header-none':''\">"
+" <span class=\"light-item\" ng-show='showConfig.isShowCustomer'><a class='light-txt ' href='{{xnConfig.serviceUrl}}feedback/create.htm' target='_blank'>{{i18n.new.service}}</a></span>"
+" <span class=\"light-item\" ng-show='showConfig.isShowHelp'><a class='light-txt ' href='{{xnConfig.helpUrl}}helpCenter/index.htm' target='_blank'>{{i18n.new.help}}</a></span>"
+" </li>"
+" <li class='header-li'>"
+" <span class=\"light-item\" ng-show='showConfig.isShowIndex'><a class='deep-txt' href='{{xnConfig.myUrl}}index.htm' target=\"_self\">{{i18n.new.home}}</a></span>"
+" <span class=\"light-item\" ng-mouseover='showApp=true;' ng-mouseleave='showApp=false'>"
+" <a class='deep-txt orange-txt' href='{{xnConfig.myUrl}}application.htm' target=\"_self\" >{{i18n.new.application}}</a>"
//#*常用应用下拉框*#
+" <div class='header-list app-list' ng-show='showApp==true' ng-mouseover='showApp=true;' ng-mouseleave='showApp=false'>"
+" <div class='hide-tri'></div>"
+" <ul class='header-info-ul'>"
+" <li class='header-info-li' ng-repeat='app in appList' ng-if=\"$index<8\" >"
+" <a href='{{app.url}}'>"
+" <img class ='app-img' ng-src='{{iconBaseUrl}}icon/application/{{app.applicationId}}.png'/>"
+" <span>{{app.applicationName}}</span>"
+" </a>"
+" </li>"
+" <div class=\"header-no-info\" ng-if=\"appList.length==0\"><span class='img'>{{i18n.new.noApplication}}</span></div>"
+" <li class='header-info-li info-bottom'>"
+" <a href='{{xnConfig.myUrl}}application.htm'>"
+" <span class ='app-all-img'><i class='icon icon-app'></i></span>"
+" <span class='app-name'>{{i18n.new.allApplication}}</span>"
+" </a>"
+" </li>"
+" </ul>"
+" </div>"
+" </span>"
+" </li>"
+" <li class='header-li' ng-show='showConfig.isShowMessage || showConfig.isShowTask'>"
+" <span class=\"light-item\" ng-show='showConfig.isShowMessage' ng-mouseover='showMessage=true;' ng-mouseleave='showMessage=false'>"
+" <a class='deep-txt' href='{{xnConfig.myUrl}}mine/message/index.htm'>{{i18n.new.message}}<span class='number' ng-show='messagesAll.length>0'>{{messagesAll.length}}</span></a>"
//消息下拉框
+" <div class='header-list message-list' ng-show='showMessage==true' ng-mouseover='showMessage=true;' ng-mouseleave='showMessage=false'>"
+" <div class='hide-tri'></div>"
+" <ul class='header-info-ul'>"
+" <li class='header-info-li' ng-repeat='message in messages'>"
+" <a ng-click='messageDetail(message.id)'><span>{{message.messageTitle | substr:20}}</span></a>"
+" </li>"
+" <div class=\"header-no-info\" ng-if=\"messages.length==0\"><span class='img'>{{i18n.new.noMessage}}</span></div>"
+" <li class='header-info-li info-bottom xn-text-center' >"
+" <a href='{{xnConfig.myUrl}}mine/message/index.htm'>{{i18n.new.allMessage}}</a>"
+" </li>"
+" </ul>"
+" </div>"
+" </span>"
+" <span class=\"light-item\" ng-show='showConfig.isShowTask' ng-mouseover='showTask=true;' ng-mouseleave='showTask=false'>"
+" <a class='deep-txt ' href='{{xnConfig.myUrl}}task/futrue.htm'>{{i18n.new.task}}<span class='number' ng-show='tasksAll.length>0'>{{tasksAll.length}}</span></a>"
//任务下拉框
+" <div class='header-list task-list' ng-show='showTask==true' ng-mouseover='showTask=true;' ng-mouseleave='showTask=false'>"
+" <div class='hide-tri'></div>"
+" <ul class='header-info-ul'>"
+" <li class='header-info-li' ng-repeat='task in tasks'>"
+" <a href='{{task.assignReason}}'>"
+" <span>{{task.owner.name}}{{task.assignCode | substr:40}}</span>"
+" </a>"
+" </li>"
+" <div class=\"header-no-info\" ng-if=\"tasks.length==0\"><span class='img'>{{i18n.new.noTask}}</span></div>"
+" <li class='header-info-li info-bottom xn-text-center'>"
+" <a href='{{xnConfig.myUrl}}task/futrue.htm'><span>{{i18n.new.allTask}}</span></a>"
+" </li>"
+" </ul>"
+" </div>"
+" </span>"
+" </li>"
+" <li class='header-li'>"
+" <span class=\"light-item\" ng-mouseover='showPersonInfo=true;' ng-mouseleave='showPersonInfo=false'>"
+" <a class='deep-txt ' href='{{xnConfig.myUrl}}profileView'>{{i18n.new.personal}}</a>"
+" <div class='header-list info-list' ng-show='showPersonInfo==true' ng-mouseover='showPersonInfo=true;'ng-mouseleave='showPersonInfo=false'>"
+" <div class='hide-tri'></div>"
+" <ul class='header-info-ul'>"
+" <li class='header-info-li' ng-show='showConfig.isShowInformation'>"
+" <a title='{{i18n.new.information}}' href='{{xnConfig.myUrl}}profileView'>"
+" <i class='icon icon-individual'></i><span>{{i18n.new.information}}</span></a>"
+" </li>"
+" <li class='header-info-li ' ng-show='showConfig.isShowTenant'>"
+" <a title='{{i18n.new.tenant}}' href='{{xnConfig.myUrl}}tenant'>"
+" <i class='icon icon-renter '></i><span>{{i18n.new.tenant}}</span></a>"
+" </li>"
+" <li class='header-info-li ' ng-show='showConfig.isShowCollection'>"
+" <a title='{{i18n.new.collection}}' href='{{xnConfig.myUrl}}mine/collection/index.htm'>"
+" <i class='icon icon-gerenshoucang '></i><span>{{i18n.new.collection}}</span></a>"
+" </li>"
+" <li class='header-info-li ' ng-show='showConfig.isShowHistory'>"
+" <a title='{{i18n.new.history}}' href='{{xnConfig.myUrl}}mine/history/index.htm'>"
+" <i class='icon icon-lishijilu '></i><span>{{i18n.new.history}}</span></a>"
+" </li>"
+" <li class='header-info-li ' ng-show='showConfig.isShowPan'>"
+" <a title='{{i18n.new.file}}' href='{{xnConfig.myUrl}}pan/file.htm'>"
+" <i class='icon icon-onlinedisk '></i><span>{{i18n.new.file}}</span></a>"
+" </li>"
+" <li class='header-info-li ' >"
+" <a title='{{i18n.new.fileCenter}}' href='{{xnConfig.myUrl}}mine/file/index.htm'>"
+" <i class='icon icon-DOC '></i><span>{{i18n.new.fileCenter}}</span></a>"
+" </li>"
+" <li class='header-info-li' ng-show='showConfig.isShowChangePassword'>"
+" <a title='{{i18n.new.password}}' href='{{xnConfig.myUrl}}auth/change.htm'>"
+" <i class='icon icon-modifypassword '></i><span>{{i18n.new.password}}</span></a>"
+" </li>"
+" <li class='header-info-li' ng-show='showConfig.isShowAbout'>"
+" <a title='{{i18n.new.system}}' href='{{aboutUrl}}' target='_blank'>"
+" <i class='icon icon-aboutthissystem'></i><span>{{i18n.new.system}}</span></a>"
+" </li>"
+" <li class='header-info-li info-bottom' ng-show='showConfig.isShowLogout'>"
+" <a title='{{i18n.new.out}}' href='{{xnConfig.myUrl}}auth/logout.htm'>"
+" <i class='icon icon-quit'></i><span>{{i18n.new.out}}</span></a>"
+" </li>"
+" </ul>"
+" </div>"
+" </span>"
+" </li>"
+" </ul>"
+"</div>"
);
}]);
angular.module("xn.directive.top",["xn/template/header.html"])
.value("xnConfig", [])
.filter('substr', function() {
return function(input,start) {
String.prototype.lengthB = function( ){
var b = 0, l = this.length;
if( l ){
for( var i = 0; i < l; i ++ ){
if(this.charCodeAt( i ) > 255 ){
b += 2;
}else{
b ++ ;
}
}
return b;
}else{
return 0;
}
};
if(input){
var data="";
if(start){
if(input.lengthB()>start){
data =input.substr(0, start)+"...";
}else{
data =input.substr(0, start)
}
}else{
data=input;
}
return data;
};
}
})
.directive("headerInfoCenter", ["$modal","CommonService","xnConfig",function($modal,CommonService,xnConfig) {
var config = [];
var defaultInfoConfig={
"isShowApp":true,
"isShowCustomer":true,
"isShowHelp":true,
"isShowYun":true,
"isShowAddressBook":false, /*企业通讯录*/
"isShowIndex":false, /*首页*/
"isShowMessage":false, /*消息*/
"isShowInformation":true, /*个人信息*/
"isShowTenant":true, /*承租人*/
"isShowCollection":true, /*收藏*/
"isShowHistory":true, /*历史记录*/
"isShowPan":true, /*网盘*/
"isShowChangePassword":true, /*修改密码*/
"isShowAbout":true, /*关于*/
"isShowLogout":true /*退出*/
};
if(xnConfig){
config = angular.extend(config, xnConfig);
};
return {
restrict: "AE",
scope: {
aboutUrl: "@",
iconBaseUrl: "@",
defaultShow:"=",
userType:"@",
language:"@"
},
templateUrl: "headerTopInfoCenter/tpl.html",
link: function(scope,element,atter,ngModel) {
if(config){
scope.xnConfig = config
}
scope.i18n={
new:{},
cn:{
"appPc":"电脑端",
"appPcMacName":"Mac版下载",
"appPcWinName":"Win版下载",
"app":"手机APP",
"disk":"云盘",
"contacts":"通讯录",
"service":"客服",
"help":"帮助中心",
"home":"首页",
"application":"应用中心",
"noApplication":"暂无常用应用",
"allApplication":"全部应用",
"message":"消息",
"noMessage":"暂无消息",
"allMessage":"查看全部",
"task":"任务",
"noTask":"暂无任务",
"allTask":"查看全部",
"personal":"个人中心",
"information":"个人信息",
"tenant":"企业信息",
"collection":"个人收藏",
"history":"历史记录",
"file":"个人网盘",
"fileCenter":"文件中心",
"password":"修改密码",
"system":"关于本系统",
"out":"退出",
},
en:{
"appPc":"xntalk-pc",
"appPcMacName":"Mac",
"appPcWinName":"Win",
"app":"APP",
"disk":"Cloud Disk",
"contacts":"Contacts",
"service":"Customer Service",
"help":"Help",
"home":"Home",
"application":"Application",
"noApplication":"Have not set",
"allApplication":"All Application",
"message":"Message",
"noMessage":"No Messages",
"allMessage":"View All",
"task":"Task",
"noTask":"No Task",
"allTask":"View All",
"personal":"Personal",
"information":"My info",
"tenant":"Corporate",
"collection":"Collection",
"history":"History",
"file":"Personal Disk",
"fileCenter":"File center",
"password":"Reset Password",
"system":"About System",
"out":"Exit"
}
};
function doLanguage (language,start) {
switch (language){
//简体中文(中国)
case "ZH_CN":
// 繁体中文(台湾地区)
case "ZH_TW":
// 繁体中文(香港地区)
case "ZH_HK":
scope.i18n.new=scope.i18n.cn;
break;
// 英语(香港地区)
case "EN_HK":
// 英语(美国)
case "EN_US":
// 英语(英国)
case "EN_GB":
// 英语(全球)
case "EN_WW":
// 英语(欧洲)
case "EN_EU":
scope.i18n.new=scope.i18n.en;
break;
// // 法语(欧洲)
// case "FR_EU":
// // 德语(欧洲)
// case "DE_EU":
// // 日语(日本)
// case "JA_JP":
default:
if(start){
doLanguage(xnConfig.language);
}else {
scope.i18n.new=scope.i18n.cn;
}
break;
}
}
doLanguage(scope.language,true);
/*赋值哪些显示哪些不显示*/
if(scope.defaultShow && angular.isObject(scope.defaultShow)){
scope.showConfig=angular.extend(defaultInfoConfig, scope.defaultShow);
}else {
scope.showConfig=defaultInfoConfig;
}
if(scope.userType){
switch (scope.userType)
{ case "EMPLOYEE":
case "NONE":
scope.showConfig.isShowAddressBook=true;
scope.showConfig.isShowIndex=true;
scope.showConfig.isShowMessage=true;
scope.showConfig.isShowTask=true;
break;
case "MEMBER":
// 会员
scope.showConfig.isShowApp=false;
scope.showConfig.isShowYun=false;
scope.showConfig.isShowCustomer=false;
scope.showConfig.isShowAddressBook=false;
scope.showConfig.isShowHelp=false;
scope.showConfig.isShowIndex=false;
scope.showConfig.isShowMessage=false;
scope.showConfig.isShowTask=false;
scope.showConfig.isShowTenant=false;
scope.showConfig.isShowCollection=false;
scope.showConfig.isShowHistory=false;
scope.showConfig.isShowPan=false;
break;
case "SUPPLIER":
// 供应商
scope.showConfig.isShowApp=false;
scope.showConfig.isShowYun=false;
scope.showConfig.isShowCustomer=false;
scope.showConfig.isShowAddressBook=false;
scope.showConfig.isShowHelp=false;
scope.showConfig.isShowIndex=false;
scope.showConfig.isShowMessage=true;
scope.showConfig.isShowTask=false;
scope.showConfig.isShowTenant=false;
scope.showConfig.isShowCollection=false;
scope.showConfig.isShowHistory=false;
scope.showConfig.isShowPan=false;
break;
default:
scope.showConfig.isShowAddressBook=false;
scope.showConfig.isShowIndex=false;
scope.showConfig.isShowMessage=false;
scope.showConfig.isShowTask=false;
break;
}
}
/*获取应用列表*/
scope.getAppList=function(){
CommonService.getCommonlyAppList().success(function(data) {
scope.appList = [];
scope.appAll = data.result;
if (scope.appAll != undefined) {
if (data.result.length > 8) {
for (var i = 0; i <8; i++) {
scope.appList.push(data.result[i]);
}
} else {
scope.appList = data.result;
}
}else{
scope.appAll=[];
}
});
};
scope.getAppList();
//获取消息列表
scope.getMessageList = function () {
CommonService.getMessageList().success(function (data) {
scope.messages = [];
scope.messagesAll = data.result;
if (scope.messagesAll != undefined) {
if (data.result.length > 10) {
for (var i = 0; i < 10; i++) {
scope.messages.push(data.result[i]);
}
} else {
scope.messages = data.result;
}
}else{
scope.messagesAll=[];
}
});
};
if(scope.showConfig.isShowMessage){
scope.getMessageList();
}
/*获取任务列表*/
scope.getTaskList = function () {
CommonService.getTaskList().success(function (data) {
scope.tasks = [];
scope.tasksAll = data.result;
if (scope.tasksAll != undefined) {
if (data.result.length > 10) {
for (var i = 0; i < 10; i++) {
scope.tasks.push(data.result[i]);
}
} else {
scope.tasks = data.result;
}
}else{
scope.tasksAll=[];
}
});
};
if(scope.showConfig.isShowTask){
scope.getTaskList();
}
scope.messageDetail=function(id){
var modalInstance = $modal.open({
template:"<div class=\"modal-header\">"+
" <h3 class=\"modal-title\">{{messageDetail.messageTitle}}</h3>"+
" </div>"+
" <div class=\"modal-body clearfix\" >"+
" <div class=\"form-group col-sm-10 col-md-offset-1 clearfix\">"+
" <dd>{{messageDetail.messageContent}}</dd>"+
" </div>"+
" </div>"+
" <div class=\"modal-footer\">"+
" <a class=\"btn btn-default col-md-2 col-md-offset-1\" ng-click=\"cancel()\" ng-href=\"{{messageDetail.messageUrl}}\" target=\"_blank\""+
" ng-if=\"messageDetail.messageUrl!=undefined\">跳转</a>"+
" <button class=\"btn btn-warning\" ng-click=\"cancel()\">关闭</button>"+
" </div>",
controller:["$scope","$modalInstance","items","CommonService", function ($scope, $modalInstance,items , CommonService) {
var vm = {id:items.id};
//页面加载消息详细信息
$scope.getMessageDetail = function () {
CommonService.getMessageDetail(vm).success(function (data) {
$scope.messageDetail = data.message;
});
};
$scope.doRead = function () {
$scope.messageReadIds = [];
$scope.messageReadIds.push(vm.id);
CommonService.doRead($scope.messageReadIds).success(function () {});
};
$scope.cancel = function () {
$modalInstance.dismiss("cancel");
};
$scope.getMessageDetail();
$scope.doRead();
}] ,
resolve: {
items: function () {
return {id:id};
}
}
});
modalInstance.result.then(function () {
scope.getMessageList();
},function () {
scope.getMessageList();
});
}
}
};
}])
.factory("CommonService",["$http",function($http){
var service={};
//消息明细获取
service.getMessageDetail=function(request) {
/* var url="http://local.xiniunet.com/api/foundation.do";*/
var url=xnConfig.myUrl+"api/foundation.do";
return $http({
method : "GET",
withCredentials:true,
url : url,
params:{"method":"api.foundation.message.get","ids":[request.id]}
//data:request
});
};
//未读消息读取
service.getMessageList=function() {
var url=xnConfig.myUrl+"api/foundation.do";
return $http({
method : "POST",
withCredentials:true,
url : url,
params:{"method":"api.foundation.messages.get"}
});
};
//已读消息读取
service.getReadedMessageList=function() {
var url=xnConfig.myUrl+"api/foundation.do";
return $http({
method : "POST",
withCredentials:true,
url : url,
params:{"method":"api.foundation.readedmessage.get"}
});
};
//读消息
service.doRead=function(messageIdList) {
/* var url="http://local.xiniunet.com/api/foundation.do";*/
var url=xnConfig.myUrl+"api/foundation.do";
return $http({
method : "GET",
withCredentials:true,
url : url,
params:{"method":"api.foundation.message.read","ids":messageIdList}
});
};
//待办任务获取
service.getTaskList=function() {
var url=xnConfig.myUrl+"api/foundation.do";
return $http({
method : "POST",
withCredentials:true,
url : url,
params:{"method":"api.foundation.tasks.get"}
});
};
//获取应用列表
service.getCommonlyAppList = function () {
var url = xnConfig.myUrl+"system/api.do";
return $http({
method: "POST",
withCredentials:true,
url: url,
params: {"method": "api.platform.application.get.commonly"}
});
};
return service;
}]);