Main.js 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  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: 50,
  22. itemId: 'headerBar',
  23. items: [
  24. {
  25. xtype: 'component',
  26. reference: 'mainLogo',
  27. width: 180,
  28. cls: 'main-logo-wrap',
  29. html: '<div class="main-logo"><img src="resources/images/default/logo-default.png"/><div class="logo-text">U企云服</div></div>',
  30. bind: {
  31. width: '{navWidth}'
  32. }
  33. },
  34. {
  35. margin: '0 8 0 8',
  36. padding: '7 0 7 0',
  37. ui: 'header',
  38. iconCls:'x-sa sa-arrows-left',
  39. id: 'main-navigation-toggle-btn',
  40. handler: 'onToggleNavigationSize'
  41. },{
  42. padding: '0 0 0 0',
  43. reference: 'mainprofile',
  44. cls:'x-main-master',
  45. ui: 'header',
  46. bind: {
  47. text: '{company.name}',
  48. arrowVisible: '{hasManyCompany}',
  49. },
  50. menu: {
  51. items: []
  52. }
  53. },
  54. '->',
  55. {
  56. iconCls:'icon-usoftchina',
  57. ui: 'header',
  58. tooltip: '优软云',
  59. handler:function(){
  60. window.open('http://www.usoftchina.com','_blank');
  61. }
  62. },
  63. {
  64. margin:'0 3 0 6',
  65. iconCls:'x-fa fa-share-square',
  66. cls:'sa-nav-button',
  67. ui: 'header',
  68. tooltip: '邀请同事',
  69. handler:'shareCompany'
  70. },
  71. {
  72. iconCls:'x-sa sa-help',
  73. cls:'sa-nav-button',
  74. ui: 'header',
  75. arrowVisible: false,
  76. tooltip: '帮助',
  77. width:50,
  78. height:45,
  79. menu: {
  80. cls:'x-main-menu sa-nav-menu',
  81. height: 66,
  82. items: [{
  83. text: '新手导航',
  84. iconCls:'x-fa sa-navicon fa-comment-o',
  85. handler:function(){
  86. saas.util.BaseUtil.openTab('sys-guide-formpanel','新手导航', 'sys-guide-formpanel-nav');
  87. }
  88. }/* ,{
  89. text: '用户手册',
  90. hidden:true,
  91. iconCls:'x-fa sa-navicon fa-address-book-o',
  92. handler:function(){
  93. window.open('http://www.usoftchina.com','_blank');
  94. }
  95. },{
  96. text: '常见问题',
  97. iconCls:'x-fa fa-question-circle-o sa-navicon',
  98. handler:function(){
  99. window.open('http://www.usoftchina.com','_blank');
  100. }
  101. } */,{
  102. text: '客服热线',
  103. iconCls:'x-fa fa-phone sa-navicon',
  104. menu:{
  105. cls:'sa-nav-menu',
  106. items:[{
  107. text:'<span onclick="javascript:window.open(\'http://www.usoftchina.com\');" style="text-decoration:underline;color:blue;">优软科技官网</span>'
  108. },{
  109. text:'<span>电话:400-830-1818</span>'
  110. },{
  111. text:'<span>邮箱:info@usoftchina.com</span>'
  112. }]
  113. }
  114. }]
  115. }
  116. },
  117. {
  118. //margin: '0 0 0 0',
  119. xtype: 'tbtext',
  120. name:'realname',
  121. cls:'sa-nav-button nav-realname',
  122. bind: {
  123. html: '{account.realname}'
  124. },
  125. style:{
  126. cursor:'default',
  127. textAlign:'center'
  128. },
  129. listeners:{
  130. afterrender:function(b){
  131. var main = b.ownerCt.ownerCt;
  132. //调用
  133. var _localStorage = Ext.decode(localStorage.getItem('app-state-session'));
  134. var nowCompanyId = _localStorage.account.companyId;
  135. if(_localStorage.account.rolesMap){
  136. var rolesMap = _localStorage.account.rolesMap[nowCompanyId];
  137. if(rolesMap&&rolesMap.length>0){
  138. for(var i = 0; i < rolesMap.length; i++) {
  139. if(rolesMap[i].type==0){
  140. main.isAdmin = true;
  141. main.getController().loadInvitationMsg(1,nowCompanyId)
  142. }
  143. }
  144. }
  145. }
  146. }
  147. },
  148. },
  149. {
  150. // ui: 'header',
  151. cls:' sa-nav-button',
  152. width: 50,
  153. height:50,
  154. bind: {
  155. html:'<img class="x-img x-box-item x-toolbar-item x-img-header" style="height:35px;width:35px;margin-top: 6px;margin-left: 14px;" src="{avatarUrl}" alt="">'
  156. },
  157. menu: {
  158. // height: 132,
  159. cls:'x-main-menu2 sa-nav-menu',
  160. items: [ {
  161. text: '账户中心',
  162. iconCls:'x-fa fa-user-o sa-navicon',
  163. handler:function(){
  164. var userId = saas.util.BaseUtil.getCurrentUser().id,
  165. url = Ext.manifest.server.accountEnterprise;
  166. if(userId == '-99999') {
  167. url = Ext.manifest.server.accountCenter;
  168. }
  169. window.open(url, '_blank');
  170. }
  171. },{
  172. text: '意见反馈',
  173. iconCls:'x-fa fa-comment-o sa-navicon',
  174. handler:'feedbackMsg'
  175. }, {
  176. text: '加入申请',
  177. name:'join',
  178. iconCls:'x-fa fa-handshake-o sa-navicon',
  179. handler:function(b){
  180. saas.util.BaseUtil.openTab('sys-invitation-datalist','申请列表', 'sys-invitation-datalist');
  181. },
  182. bind: {hidden: '{!isAdmin}'}
  183. }, {
  184. text: '退出',
  185. iconCls:'x-fa fa-power-off sa-navicon',
  186. handler: 'onLogout'
  187. }],
  188. listeners:{
  189. show:function(m){
  190. var name = m.ownerCmp.ownerCt.down('[name=realname]');
  191. var classList = name.getEl().dom.classList;
  192. if(classList.contains('x-header-redpoint')){
  193. m.getEl().dom.classList.add('x-menu-redpoint')
  194. }else{
  195. m.getEl().dom.classList.remove('x-menu-redpoint')
  196. }
  197. }
  198. }
  199. }
  200. }
  201. ]
  202. },
  203. {
  204. xtype: 'maincontainerwrap'
  205. }
  206. ]
  207. });