主页面
/** * @Author sai */ Ext.define("Sencha.view.Main", { extend : 'Ext.tab.Panel', xtype : 'Main', //requires: ['Sencha.view.MenuButton','Sencha.view.MenuItemButton'], config : { tabBar : { docked : 'bottom' }, scrollable :{ direction : 'horizontal' }, items:[{ title : '首页', iconCls : 'home', loadMask : true, html: ' Screen 1' }, { title : '应用超市', iconCls : 'user', loadMask : true, html: 'Screen 2' }], listeners : { initialize : function(panel) { debugger; var b=panel.getTabBar().element.down('div[class^="x-tab-normal x-tab x-iconalign-center"]:nth-child(2)').dom; var el = document.createElement("div"); el.setAttribute("class","x-tab-normal x-tab x-iconalign-center x-tab-icon x-layout-box-item x-stretched"); b.parentNode.insertBefore(el,b); var button=Ext.create('Sencha.view.MenuButton',{left:10,bottom:0}).element.dom; el.appendChild(button); var div = document.createElement("div"); var style="position:absolute; padding: 10px; height: 62px !important;bottom:-20px !important; width: 62px !important; background:url(resources/images/roB.png) 0 0 no-repeat;background-size:100% 100%;" div.setAttribute("style",style); div.setAttribute("id","radius"); el.appendChild(div); var items=[ {xtype: 'menuitembutton',iconCls:'user',route:'contact',id:'test01',t:'test01'}, {xtype: 'menuitembutton',iconCls:'user',route:'mail',id:'test02',t:'test02'}, {xtype: 'menuitembutton',iconCls:'user',route:'app',id:'test03',t:'test03'}, {xtype: 'menuitembutton',iconCls:'user',route:'app',id:'test04',t:'test04'}, {xtype: 'menuitembutton',iconCls:'user',route:'app',id:'test05',t:'test05'} ]; Ext.Viewport.add(items); } } } })
/** * 快捷菜单控制器 * @Author sai */ Ext.define('Sencha.controller.Menu', { extend: 'Ext.app.Controller', requires: [ 'Sencha.view.MenuItemButton', 'Sencha.view.MenuButton', 'Ext.util.DelayedTask' ], config: { before: { showContact: 'authenticate' }, routes: { 'mail':'showMail', 'contact': 'showContact', 'main':'showMain' }, refs: { menubutton: 'menubutton', menuitembutton: 'menuitembutton' }, control: { menubutton: { tap: 'onMenuButtonTap' }, menuitembutton: { tap: 'onMenuItemButtonTap' } } }, /** * * @param {} button */ onMenuItemButtonTap: function(button) { var menuButton = Ext.ComponentQuery.query('menubutton')[0]; button.addCls('tapped'); button.setZIndex(0); this.closeMenu(menuButton); //var h= this.getApplication().getHistory(); this.redirectTo(button.getRoute()); }, /** * * @param {} menuButton */ onMenuButtonTap: function(menuButton) { if (!menuButton.getIsOpen()) { // open menu this.openMenu(menuButton); } else { // close Menu this.closeMenu(menuButton); } }, openMenu: function(menuButton) { Ext.Viewport.setMasked(true); var masks= Ext.ComponentQuery.query('mask'); for(var i=0, max=0; i
/** * @Author sai */ Ext.define('Sencha.view.MenuButton', { extend: 'Ext.Button', requires: ['Ext.Button'], alias: 'widget.menubutton', xtype: 'menubutton', config: { //iconCls: 'add', ui : 'pathmenu', iconMask: true, height: 50, width: 50, zIndex:'10', cls: 'menubutton', listeners:{ 'hide':function(){ var div = document.getElementById("radius"); var style="display:none"; div.setAttribute("style",style); }, 'show':function(){ //var left=parseInt(this.getLeft())-parseInt(5); var left=3; var div = document.getElementById("radius"); var style="position:absolute; padding: 10px; height: 62px !important; width: 62px !important; left: "+left+"px !important; bottom: 5px !important; background:url(images/roB.png) 0 0 no-repeat;background-size:100% 100%;" div.setAttribute("style",style); } }, isOpen: false } });
/** * 快捷菜单选项 * @Author sai */ Ext.define('Sencha.view.MenuItemButton', { extend: 'Ext.Button', alias: 'widget.menuitembutton', xtype: 'menuitembutton', config: { iconMask: true, ui : 'pathmenu', t:'', height: 40, width: 40, zIndex:'0', cls: 'menuitembutton', isActive: false, listeners:{'initialize':function(){ this.setLeft(document.body.clientWidth*0.5); this.setBottom(15); this.setStyle('margin-left:-20px'); var el = document.createElement("div"); el.id=this.getId()+'-field'; el.innerHTML=this.getT(); el.setAttribute("class", "s-text"); el.setAttribute("style","display:none;"); Ext.Viewport.element.appendChild(el); }, 'resize':function(){ // debugger; this.setLeft(document.body.clientWidth*0.5); this.setBottom(15); }, 'show':function(){ //debugger; var id=this.getId()+'-field'; var el=document.getElementById(id); var b=this.getBottom()-20; var style='left:'+this.getLeft()+'px !important; bottom:'+b+'px !important; margin-left:-20px; z-index: '+this.getZIndex()+'!important;'; el.setAttribute("style",style); }, 'hide':function(){ //debugger; var id=this.getId()+'-field'; var el=document.getElementById(id); el.setAttribute("style","display:none;"); } }, route: '' } });
.x-button.x-button-pathmenu{background:url(../images/ro.png) 0 0 no-repeat;background-size:100% 100%;/*background-color:#f7f7f7;background-image:-webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #dedede), color-stop(10%, #ebebeb), color-stop(65%, #f7f7f7), color-stop(100%, #f9f9f9));background-image:-webkit-linear-gradient(top, #dedede,#ebebeb 10%,#f7f7f7 65%,#f9f9f9);background-image:linear-gradient(top, #dedede,#ebebeb 10%,#f7f7f7 65%,#f9f9f9);border:3px solid #fff;*/border-radius:1.75em;padding:0.5em;border:0;} .x-button.x-button-pathmenu.menubutton{background:url(../images/roa.png) 0 0 no-repeat;background-size:100% 100%;} .x-button.x-button-pathmenu.open{-webkit-transform:rotate(360deg) translateZ(0)} .x-button.x-button-pathmenu.close{-webkit-transform:rotate(-360deg) translateZ(0)} .x-button.x-button-pathmenu.menubutton{-webkit-transition:all 300ms} .x-button.x-button-pathmenu.menubutton.open{-webkit-transform:rotate(45deg) translateZ(0); background:url(../images/roa.png) 0 0 no-repeat #1E93E4; background-size:100% 100%; } .x-button.x-button-pathmenu.menubutton.close{-webkit-transform:rotate(0deg) translateZ(0)} .x-button.x-button-pathmenu.menuitembutton{-webkit-transition-duration:300ms;-webkit-transition-property:opacity, left, bottom, -webkit-transform;-webkit-transition-timing-function:cubic-bezier(0.68, -0.55, 0.265, 1.55);opacity:1} .x-button.x-button-pathmenu.menuitembutton.tapped{-webkit-transform:rotate(180deg) scale(4) translatez(0);opacity:0} .s-bbox{height:135px;width:270px; background:none; background:-webkit-gradient(radial,bottom center,0,bottom center,100,from(rgba(0,0,0,0.4)),color-stop(80%,rgba(0,0,0,0.6)),to(rgba(0,0,0,0.2))); background:-webkit-radial-gradient(bottom center,135px 135px,rgba(0,0,0,0.4) 0%,rgba(0,0,0,0.6) 80%,rgba(0,0,0,0.2) 100%); background-image: radial-gradient(bottom center, circle, rgba(50,50,50,1) 0%, rgba(68,68,68,1) 100%); border-radius:135px 135px 0 0;position:absolute;left:50%;margin-left:-135px;bottom:3em;} .s-text{ position:absolute; height: 14px !important; width: 40px !important; text-align:center; font-size:12px; color:#fff; font-weight:bold; -webkit-transition-duration: 300ms;-webkit-transition-property: opacity, left, bottom, -webkit-transform;-webkit-transition-timing-function: cubic-bezier(0.68, -0.55, 0.265, 1.55); }
如果对你有帮助 可以捐助我呀!大老板们