/*
* File: app/view/MainPanel.js
*
* This file was generated by Sencha Architect version 2.0.0.
* http://www.sencha.com/products/architect/
*
* This file requires use of the Sencha Touch 2.0.x library, under independent license.
* License of Sencha Architect does not include license for Sencha Touch 2.0.x. For more
* details see http://www.sencha.com/license or contact license@sencha.com.
*
* This file will be auto-generated each and everytime you save your project.
*
* Do NOT hand edit this file.
*/
Ext.define('StorageMedia.view.MainPanel', {
extend: 'Ext.Panel',
config: {
id: 'MainPanel',
layout: {
animation: 'slide',
type: 'card'
},
items: [
{
xtype: 'panel',
id: 'pnlHome',
layout: {
type: 'card'
},
items: [
{
xtype: 'titlebar',
docked: 'top',
title: '首页',
items: [
{
xtype: 'button',
ui: 'action',
iconAlign: 'right',
text: '登录',
align: 'right'
},
{
xtype: 'image',
height: 30,
id: 'imgLogo',
left: '',
width: 66,
src: 'resources/images/logo.png'
}
]
},
{
xtype: 'container',
id: 'HomeBody',
items: [
{
xtype: 'carousel',
height: 138,
id: 'focusImg',
margin: 3,
top: '',
ui: 'light',
width: 314
},
{
xtype: 'panel',
height: 262,
id: 'homeMovielist',
layout: {
type: 'fit'
}
}
]
}
]
},
{
xtype: 'panel',
id: 'pnlChannel',
itemId: 'mypanel3',
layout: {
type: 'card'
},
items: [
{
xtype: 'titlebar',
docked: 'top',
title: '分类',
items: [
{
xtype: 'button',
handler: function(button, event) {
HistoryBack('left');
},
ui: 'back',
text: '返回'
}
]
}
]
},
{
xtype: 'panel',
id: 'pnlList',
itemId: 'mypanel4',
layout: {
type: 'card'
},
items: [
{
xtype: 'titlebar',
docked: 'top',
id: 'titleBarList',
style: '',
title: '分类名称',
items: [
{
xtype: 'button',
handler: function(button, event) {
HistoryBack('left');
},
ui: 'back',
text: '返回'
}
]
},
{
xtype: 'panel',
id: 'showMovieList',
layout: {
type: 'fit'
}
}
]
},
{
xtype: 'panel',
id: 'pnlDetail',
itemId: 'mypanel5',
layout: {
type: 'card'
},
items: [
{
xtype: 'titlebar',
docked: 'top',
id: 'titleBarDetail',
title: '视频名称',
items: [
{
xtype: 'button',
handler: function(button, event) {
HistoryBack('left');
},
ui: 'back',
text: '返回'
}
]
},
{
xtype: 'toolbar',
docked: 'top',
height: 34,
ui: 'light',
items: [
{
xtype: 'button',
height: 30,
left: 20,
margin: 0,
ui: 'action',
iconMask: true,
text: '我要评分'
},
{
xtype: 'button',
centered: true,
height: 30,
text: '我要评论'
},
{
xtype: 'button',
height: 30,
left: '',
margin: 0,
right: 20,
iconMask: true,
text: '我要收藏'
}
]
},
{
xtype: 'panel',
height: '',
id: 'detailBody',
layout: {
type: 'vbox'
},
scrollable: 'vertical',
items: [
{
xtype: 'panel',
height: 170,
items: [
{
xtype: 'image',
height: 170,
id: 'imgVideoCover',
width: '',
src: 'cache/cover.jpg'
}
]
},
{
xtype: 'panel',
top: '',
width: '100%',
items: [
{
xtype: 'label',
height: 20,
html: '评分信息',
id: 'lblCommentpoint',
margin: 4,
style: ''
},
{
xtype: 'label',
html: '视频介绍:',
id: 'lblDescription',
margin: 4
}
]
},
{
xtype: 'panel',
bottom: '',
id: 'commentList',
width: '100%',
items: [
{
xtype: 'label',
html: '视频评论',
margin: 4,
style: 'font-weight:bold'
}
]
},
{
xtype: 'panel',
bottom: '',
height: '',
id: 'commentMore',
modal: false,
scrollable: false,
items: [
{
xtype: 'button',
handler: function(button, event) {
ShowMovieComment();
},
text: 'loading more...'
}
]
}
]
}
]
},
{
xtype: 'panel',
id: 'pnlPlayMovie',
layout: {
type: 'card'
}
},
{
xtype: 'panel',
id: 'pnlLogin',
layout: {
type: 'card'
},
items: [
{
xtype: 'titlebar',
docked: 'top',
title: '登录',
items: [
{
xtype: 'button',
handler: function(button, event) {
HistoryBack('left');
},
ui: 'back',
text: '返回'
}
]
}
]
},
{
xtype: 'panel',
id: 'pnlChangePassword',
layout: {
type: 'card'
},
items: [
{
xtype: 'titlebar',
docked: 'top',
title: '修改密码',
items: [
{
xtype: 'button',
handler: function(button, event) {
HistoryBack('left');
},
ui: 'back',
text: '返回'
}
]
}
]
},
{
xtype: 'panel',
id: 'pnlRegister',
layout: {
type: 'card'
},
items: [
{
xtype: 'titlebar',
docked: 'top',
title: '注册',
items: [
{
xtype: 'button',
handler: function(button, event) {
HistoryBack('left');
},
ui: 'back',
text: '返回'
}
]
}
]
},
{
xtype: 'panel',
id: 'pnlFavorite',
layout: {
type: 'card'
},
items: [
{
xtype: 'titlebar',
docked: 'top',
title: '收藏夹',
items: [
{
xtype: 'button',
handler: function(button, event) {
HistoryBack('left');
},
ui: 'back',
text: '返回'
}
]
}
]
},
{
xtype: 'panel',
id: 'pnlFindPassword1',
layout: {
type: 'card'
},
items: [
{
xtype: 'titlebar',
docked: 'top',
title: '找回密码',
items: [
{
xtype: 'button',
handler: function(button, event) {
HistoryBack('left');
},
ui: 'back',
text: '返回'
}
]
}
]
},
{
xtype: 'panel',
id: 'pnlFindPassword2',
items: [
{
xtype: 'titlebar',
docked: 'top',
title: '找回密码',
items: [
{
xtype: 'button',
ui: 'back',
iconCls: '',
iconMask: true,
text: '返回'
}
]
}
]
},
{
xtype: 'panel',
id: 'pnlUserCenter',
itemId: 'mypanel18',
layout: {
type: 'card'
},
items: [
{
xtype: 'titlebar',
docked: 'top',
title: '个人中心',
items: [
{
xtype: 'button',
handler: function(button, event) {
HistoryBack('left');
},
ui: 'back',
text: '返回'
}
]
},
{
xtype: 'container',
margin: 0,
padding: '',
top: 20,
width: '100%',
layout: {
type: 'vbox'
},
items: [
{
xtype: 'panel',
height: 82,
margin: '',
layout: {
type: 'hbox'
},
flex: 1,
items: [
{
xtype: 'button',
handler: function(button, event) {
ShowPanel(8, 'left');
},
height: 82,
left: 15,
width: 82,
text: '注册账号'
},
{
xtype: 'button',
handler: function(button, event) {
ShowPanel(7, 'left');
},
centered: true,
height: 82,
width: 82,
text: '修改密码'
},
{
xtype: 'button',
handler: function(button, event) {
ShowPanel(10, 'left');
},
height: 82,
right: 15,
width: 82,
text: '找回密码'
}
]
},
{
xtype: 'panel',
border: '',
height: 82,
style: 'margin-top:20px;',
top: '',
layout: {
type: 'hbox'
},
flex: 2,
items: [
{
xtype: 'button',
handler: function(button, event) {
ShowPanel(9, 'left');
},
height: 82,
left: 15,
width: 82,
text: '收藏夹'
},
{
xtype: 'button',
handler: function(button, event) {
ShowPanel(13, 'left');
},
centered: true,
height: 82,
width: 82,
text: '帮助'
},
{
xtype: 'button',
handler: function(button, event) {
ShowPanel(14, 'left');
},
height: 82,
right: 15,
width: 82,
text: '关于我们'
}
]
}
]
}
]
},
{
xtype: 'panel',
id: 'pnlHelp',
layout: {
type: 'card'
},
items: [
{
xtype: 'titlebar',
docked: 'top',
title: '帮助',
items: [
{
xtype: 'button',
handler: function(button, event) {
HistoryBack('left');
},
ui: 'back',
text: '返回'
}
]
}
]
},
{
xtype: 'panel',
id: 'pnlAboutus',
layout: {
type: 'card'
},
items: [
{
xtype: 'titlebar',
docked: 'top',
title: '关于我们',
items: [
{
xtype: 'button',
handler: function(button, event) {
HistoryBack('left');
},
ui: 'back',
text: '返回'
}
]
}
]
},
{
xtype: 'toolbar',
docked: 'bottom',
id: 'Toolbar1',
items: [
{
xtype: 'image',
centered: true,
height: 40,
id: 'btnHome',
itemId: 'myimage',
left: '4%',
margin: 3,
right: '',
width: 80,
src: 'resources/images/ico-home-0.png'
},
{
xtype: 'image',
centered: true,
height: 40,
id: 'btnChannel',
itemId: 'myimage1',
width: 80,
src: 'resources/images/ico-channel-0.png'
},
{
xtype: 'image',
height: 40,
id: 'btnUserCenter',
itemId: 'myimage2',
margin: 3,
right: '4%',
ui: '',
width: 80,
src: 'resources/images/ico-more-0.png'
}
]
}
],
listeners: [
{
fn: 'onPnlHomeShow',
event: 'show',
delegate: '#pnlHome'
},
{
fn: 'onPnlChannelShow',
event: 'show',
delegate: '#pnlChannel'
},
{
fn: 'onPnlListShow',
event: 'show',
delegate: '#pnlList'
},
{
fn: 'onPnlDetailShow',
event: 'show',
delegate: '#pnlDetail'
},
{
fn: 'onPnlUserCenterShow',
event: 'show',
delegate: '#pnlUserCenter'
},
{
fn: 'onBtnHomeTap',
event: 'tap',
delegate: '#btnHome'
},
{
fn: 'onBtnChannelTap',
event: 'tap',
delegate: '#btnChannel'
},
{
fn: 'onBtnMoreTap',
event: 'tap',
delegate: '#btnUserCenter'
}
]
},
onPnlHomeShow: function(component, options) {
SetToolbarButton(0);
if (!HomeAdvLoaded) {
ShowMask('focusImg','加载数据...');
Ext.data.JsonP.request({
url: config.url + 'home_adv.php',
timeout: 5000,
success: function(response) {
//Ext.Msg.alert('', response.result.length);
HomeAdvList = response.result;
FillHomeAdv();
HomeAdvLoaded = true; //标志设为true
HideMask('focusImg');
},
failure: function() {
HideMask('focusImg');
}
});
}
else{
FillHomeAdv();
}
if (!HomeMovieLoaded) {
ShowMask('homeMovielist','加载数据...');
Ext.data.JsonP.request({
url: config.url + 'home_movie.php',
timeout: 5000,
success: function(response) {
HomeMovieList = response.result;
FillHomeMovie();
HomeMovieLoaded = true; //标志设为true
HideMask('homeMovielist');
},
failure: function() {
Ext.Msg.alert('', '您当前的网络不好,请稍后再试');
HideMask('homeMovielist');
}
});
}
else{
FillHomeMovie();//直接填充
}
},
onPnlChannelShow: function(component, options) {
SetToolbarButton(1);
},
onPnlListShow: function(component, options) {
if (ListMovieList.length===0) {
var store = Ext.create('Ext.data.Store', {
model: 'Movie',
data: ListMovieList,
clearOnPageLoad: false,
pageSize: 15,
autoLoad: false,
proxy: {
type: 'jsonp',
pageParam: 'currentpage',
limitParam: 'pagesize',
url: config.url + 'list.php?typeid='+ CurrentTypeId,
reader: {
type: 'json',
rootProperty: 'result'
}
}
});
store.load();
var list = new Ext.List({
itemTpl: tpl.listmovielist,
width: '100%',
store: store,
plugins: [{
xclass: 'Ext.plugin.ListPaging',
autoPaging: true,
loadMoreText: '',
noMoreRecordsText: '结束.'
}]
});
Ext.getCmp('showMovieList').add(list);
}
},
onPnlDetailShow: function(component, options) {
Ext.getCmp("detailBody").getScrollable().getScroller().on('scrollend', function(scroller, offset) {
if(offset.y > scroller.maxPosition.y)
{
Ext.Msg.alert('','滚到底了,你可以做分页取数据了');
}
else{
Ext.Msg.alert('',scroller.picker.bar.getHeight()+':'+scroller.maxPosition.y);
}
});
if(1>0)
{
Ext.data.JsonP.request({
url: config.url + 'detail_movieinfo.php',
timeout: 5000,
success: function(response) {
var movieinfo = response.result[0];
Ext.getCmp('imgVideoCover').setSrc(movieinfo.coverpicmb);
Ext.getCmp('lblCommentpoint').setHtml('<a class="stars'+movieinfo.stars+'"></a> '+movieinfo.commentpointnum+'人已评分');
Ext.getCmp('lblDescription').setHtml('<span class="title">视频简介</span><br />'+movieinfo.description+'<hr>');
},
failure: function() {}
});
}
ShowMovieComment();
},
onPnlUserCenterShow: function(component, options) {
SetToolbarButton(2);
},
onBtnHomeTap: function(img, e, options) {
ShowPanel(1, 'right');
},
onBtnChannelTap: function(img, e, options) {
ShowPanel(2, 'left');
},
onBtnMoreTap: function(img, e, options) {
ShowPanel(12, 'left');
}
});
[责任编辑:jumbot]