Main.js 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. Ext.define('saas.view.main.Main', {
  2. extend: 'Ext.container.Container',
  3. xtype: 'main',
  4. requires: [
  5. 'Ext.list.Tree',
  6. 'Ext.Img'
  7. ],
  8. controller: 'main',
  9. viewModel: 'main',
  10. cls: 'main-ct',
  11. id: 'mainView',
  12. itemId: 'mainView',
  13. layout: {
  14. type: 'vbox',
  15. align: 'stretch'
  16. },
  17. items: [
  18. {
  19. xtype: 'toolbar',
  20. cls: 'main-headerbar shadow',
  21. height: 64,
  22. itemId: 'headerBar',
  23. items: [
  24. {
  25. xtype: 'component',
  26. reference: 'mainLogo',
  27. cls: 'main-logo-wrap',
  28. html: '<div class="main-logo"><img src="resources/images/default/logo-default.png"/><div class="logo-text">优企云服</div></div>',
  29. bind: {
  30. width: '{navWidth}'
  31. }
  32. },
  33. {
  34. margin: '0 0 0 8',
  35. ui: 'header',
  36. iconCls:'x-fa fa-navicon',
  37. id: 'main-navigation-btn',
  38. handler: 'onToggleNavigationSize'
  39. },{
  40. reference: 'mainprofile',
  41. arrowVisible: false,
  42. ui: 'header',
  43. bind: {
  44. text: '{company.name}'
  45. },
  46. menu: {
  47. items: [{
  48. xtype: 'menuseparator'
  49. }]
  50. }
  51. },
  52. '->',
  53. {
  54. iconCls:'icon-usoftchina',
  55. ui: 'header',
  56. tooltip: '优软云',
  57. handler:function(){
  58. window.open('http://www.usoftchina.com','_blank');
  59. }
  60. },
  61. {
  62. iconCls:'x-fa fa-question',
  63. ui: 'header',
  64. arrowVisible: false,
  65. width:50,
  66. listeners:{
  67. 'mouseover':function(){
  68. this.showMenu();
  69. },
  70. 'mouseout':function(btn,e){
  71. var cx = e.browserEvent.clientX, cy = e.browserEvent.clientY;
  72. var btnLayout = btn.el.dom.getBoundingClientRect();
  73. if(cx <= btnLayout.left || cx >= btnLayout.left+btnLayout.width || cy <= btnLayout.top) {
  74. btn.hideMenu();
  75. }
  76. }
  77. },
  78. menu: {
  79. cls:'nav-menu',
  80. items: [{
  81. text: '新手导航',
  82. iconCls:'x-fa fa-comment-o',
  83. handler:function(){
  84. console.log("新手导航");
  85. openTab('sys-guide-formpanel','新手导航', 'sys-guide-formpanel-nav');
  86. }
  87. },{
  88. text: '用户手册',
  89. iconCls:'x-fa fa-comment-o',
  90. handler:function(){
  91. window.open('http://www.usoftchina.com','_blank');
  92. }
  93. },{
  94. text: '常见问题',
  95. iconCls:'x-fa fa-question-circle-o',
  96. handler:function(){
  97. window.open('http://www.usoftchina.com','_blank');
  98. }
  99. },{
  100. text: '客服热线',
  101. iconCls:'x-fa fa-comment-o',
  102. menu:{
  103. items:[{
  104. text:'<span onclick="javascript:window.open(\'http://www.usoftchina.com\');" style="text-decoration:underline;color:blue;">优软科技官网</span>'
  105. },{
  106. text:'<span>电话:400-830-1818</span>'
  107. },{
  108. text:'<span>邮箱:info@usoftchina.com</span>'
  109. }]
  110. }/* ,listeners: {
  111. 'mouseover': function() {
  112. this.over = true;
  113. },
  114. 'mouseleave': function() {
  115. this.over = false;
  116. this.hide();
  117. }
  118. } */
  119. }]
  120. }
  121. },
  122. {
  123. margin: '0 0 0 8',
  124. xtype: 'tbtext',
  125. cls:'nav-realname',
  126. bind: {
  127. //tooltip: '{account.realname}',
  128. html: '{account.realname}'
  129. },
  130. style:{
  131. cursor:'default',
  132. textAlign:'center'
  133. }
  134. },
  135. {
  136. ui: 'header',
  137. id:"userImage",
  138. height: 35,
  139. width: 35,
  140. bind: {
  141. html:'<img class="x-img x-box-item x-toolbar-item x-img-header" style="width: 35px; height: 35px; margin: 0px;" src="{avatarUrl}" alt="">'
  142. },
  143. menu: {
  144. cls:'nav-menu',
  145. items: [ {
  146. text: '账户中心',
  147. iconCls:'x-fa x-fa fa-user-o',
  148. handler:function(){
  149. window.open('http://www.usoftchina.com','_blank');
  150. }
  151. },{
  152. text: '意见反馈',
  153. iconCls:'x-fa fa-comment-o',
  154. handler:'feedbackMsg'
  155. }, {
  156. text: '退出',
  157. iconCls:'x-fa fa-power-off',
  158. handler: 'onLogout'
  159. }]
  160. } ,
  161. listeners:{
  162. 'mouseover':function(btn){
  163. console.log("btn:",btn);
  164. btn.menu ? (btn.menu.isVisible() ? '' : btn.showMenu()) : '';
  165. },
  166. 'mouseout':function(btn,e){
  167. console.log("btn:",btn);
  168. window.setTimeout(function(){
  169. var cx = e.browserEvent.clientX, cy = e.browserEvent.clientY;
  170. console.log(btn.el.dom);
  171. var btnLayout = btn.el.dom.getBoundingClientRect();
  172. if(cx <= btnLayout.left || cx >= btnLayout.left+btnLayout.width || cy <= btnLayout.top) {
  173. btn.hideMenu();
  174. }
  175. }, 10);
  176. }
  177. }
  178. }
  179. ]
  180. },
  181. {
  182. xtype: 'maincontainerwrap'
  183. }
  184. ]
  185. });