extjs 雲資源平台 2014.2.5-Portal門戶頁面

來源:互聯網
上載者:User

玩了一下門戶頁面,按extjs的demo改造過來的,隨機圖表內容,會隨機播放五個項目中的一個進行統計.每次看到統計項目可能不一樣哦





/**
* @class Ext.app.Portal
* @extends Object
*/

Ext.define("Ext.app.Portal', {

extend: 'Ext.container.Viewport',
//requires: [ 'Ext.diag.layout.ContextItem', 'Ext.diag.layout.Context' ],
uses: ['Ext.app.PortalPanel', 'Ext.app.PortalColumn', 'Ext.app.GridPortlet', 'Ext.app.ChartPortlet', 'Ext.app.Gridmyinfo', 'Ext.app.GridNews'],

getTools: function () {
return [{
xtype: 'tool',
type: 'gear',
handler: function (e, target, panelHeader, tool) {
var portlet = panelHeader.ownerCt;
portlet.setLoading('Loading...');
Ext.defer(function () {
portlet.setLoading(false);
}, 2000);
}
}];
},

initComponent: function () {


var responseArray = [];
Ext.Ajax.request({
url: '../IndexPage.aspx',
async: false,
success: function (response) {
responseArray = Ext.JSON.decode(response.responseText);
},
failure: function (response) {
Ext.MessageBox.alert('錯誤', '請與後台服務人員聯絡');
}
});


Ext.apply(this, {
id: 'app-viewport',
layout: {
type: 'border',
padding: '0 5 5 5' // pad the layout from the window edges
},
items: [{
id: 'app-header',
xtype: 'box',
region: 'north',
height: 40,
html: responseArray.dwmc
}, {
xtype: 'container',
region: 'center',
layout: 'border',
items: [{
id: 'app-options',
title: 'Portal 資訊',
region: 'west',
animCollapse: true,
width: 150,
minWidth: 140,
maxWidth: 400,
split: true,
collapsible: true,
layout: {
type: 'accordion',
animate: true
},
items: [{
title: '系統統計',
border: false,
autoScroll: true,
iconCls: 'nav',
html: responseArray.tjxx
}, {
title: '上傳排行',
border: false,
autoScroll: true,
iconCls: 'nav',
html: responseArray.upcount
}, {
title: '積分排行',
border: false,
autoScroll: true,
iconCls: 'nav',
html: responseArray.integration
},{
title: '軟體版本',
border: false,
autoScroll: true,
iconCls: 'info',
html: responseArray.copyright
}]
}, {
id: 'app-portal',
xtype: 'portalpanel',
region: 'center',
items: [{
id: 'col-1',
items: [{
id: 'portlet-1',
title: '隨機資源統計表',
tools: this.getTools(),
items: Ext.create('Ext.app.GridPortlet'),
listeners: {
'close': Ext.bind(this.onPortletClose, this)
}
}, {
id: 'portlet-2',
title: '新聞平台',
tools: this.getTools(),
items: Ext.create('Ext.app.GridNews'),
listeners: {
'close': Ext.bind(this.onPortletClose, this)
}
}]
}, {
id: 'col-2',
items: [{
id: 'portlet-3',
title: '最近登陸',
tools: this.getTools(),
html: responseArray.lastlogin,
listeners: {
'close': Ext.bind(this.onPortletClose, this)
}
}, {
id: 'portlet-5',
title: '個人統計資訊',
tools: this.getTools(),
items: Ext.create('Ext.app.Gridmyinfo'),
listeners: {
'close': Ext.bind(this.onPortletClose, this)
}
}, {
id: 'portlet-7',
title: '最熱資源',
collapsed: true,
tools: this.getTools(),
html: responseArray.browcount,
listeners: {
'close': Ext.bind(this.onPortletClose, this)
}
}]
}, {
id: 'col-3',
items: [{
id: 'portlet-4',
title: '隨機資源統計圖',
tools: this.getTools(),
items: Ext.create('Ext.app.ChartPortlet'),
listeners: {
'close': Ext.bind(this.onPortletClose, this)
}
}, {
id: 'portlet-6',
title: '最新資源',
tools: this.getTools(),
html: responseArray.fileupdate,
listeners: {
'close': Ext.bind(this.onPortletClose, this)
}
}]
}]
}]
}]
});
this.callParent(arguments);
},

onPortletClose: function (portlet) {
this.showMsg('"' + portlet.title + '" 被刪除');
},

showMsg: function (msg) {
var el = Ext.get('app-msg'),
msgId = Ext.id();

this.msgId = msgId;
el.update(msg).show();

Ext.defer(this.clearMsg, 3000, this, [msgId]);
},

clearMsg: function (msgId) {
if (msgId === this.msgId) {
Ext.get('app-msg').hide();
}
}
});




聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.