home.js
1.96 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
define(function(){
return function(){
var body=$(document.body);
var layout=body.children(".rs-base").children(".rs-layout");
var west=layout.layout("panel","west");
var btnMenu=west.find(".btn-menu");
var panel = getSelectedPanel();//初始化面板
var homeLayout=panel.children('.pl-home-page').layout({
fit:true
});
var center=homeLayout.layout("panel","center");
var east=homeLayout.layout("panel","east");
center.rs_load().rs_load("show");
$.post("./menu/select/system.json",function(json){
if(responseUtils(json)){
center.rs_load("hide");
$.each(json.list,addSystemModule);
}
});
east.panel("setTitle",resource.home.otherPlatformTitle);
var items=east.children(".item");
if(items.length==0){
east.append('<div class="item">'+resource.home.noPlatform+'</div>');
}else{
items.bind("click.home",function(){
var btn=$(this);
$.messager.confirm(resource.msg_title, resource.home.changePlatformTitle, function(r){
if (r){
window.location.href="./platform?id="+btn.attr("options");
}
});
});
}
function addSystemModule(i,item){
var btn=$('<a class="pl-home-module '+(i==0?"selected":"")+'" href="javascript:void(0);" options="'+item.id+'"></a>').appendTo(center);
var icon=$('<span class="icon'+(item.icon?' '+item.icon:'')+'"></span>').appendTo(btn);
var text=$('<span class="text"></span>').appendTo(btn);
text.html(item.name);
if(item.url&&$.trim(item.url)!=''){
btn.attr("href",item.url+(item.url.indexOf('?')>0?'&':'?')+'platid='+global.platId+'&pltid='+global.platTypeId);
btn.attr("target","_blank");
}else{
btn.bind("click.home",function(){
var obj=$(this);
if(!obj.hasClass("selected")){
obj.parent().children(".pl-home-module").removeClass("selected");
obj.addClass("selected");
menuReloadUtils($(this).attr("options"));
}
if(!btnMenu.hasClass("shrink")){
btnMenu.triggerHandler("click");
}
});
}
}
}
});