_MainHeader.cshtml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. @using Abp.Configuration
  2. @using ContractService.Configuration
  3. @using ContractService.Helpers
  4. @using IwbZero.Runtime.Session
  5. @{
  6. }
  7. <style>
  8. .main-header .nav-item > .nav-link, .main-header .nav-item > .nav-link > .fa {
  9. font-size: 1rem;
  10. }
  11. </style>
  12. <!-- Navbar -->
  13. <nav class="main-header navbar navbar-expand navbar-white navbar-light">
  14. <!-- Left navbar links -->
  15. <ul class="navbar-nav">
  16. <li class="nav-item">
  17. <a id="PushMenuBar" class="nav-link" data-widget="pushmenu" href="/" onclick="PushmenuExtra(this)"><i class="fa fa-bars"></i></a>
  18. </li>
  19. <li class="nav-item d-none d-sm-inline-block">
  20. <a href="@(ApplicationPath)" class="nav-link">@(L("Home"))</a>
  21. </li>
  22. @if (AbpSession.AccountType != AccountTypeDefinition.System)
  23. {
  24. <li class="nav-item">
  25. <a class="nav-link " href="javascript:void(0)" style="color: var(--mc); font-size: 1.25rem; font-weight: 600; padding-top: 0;">@(AbpSession.GetClaimValue(IwbConsts.UserSystemNameClaimType))</a>
  26. </li>
  27. }
  28. </ul>
  29. <!-- Right navbar links -->
  30. <ul class="navbar-nav ml-auto">
  31. <!-- Notifications Dropdown Menu -->
  32. <li class="nav-item dropdown" id="header_notification_bar">
  33. <a class="nav-link" data-toggle="dropdown" href="#">
  34. <i class="fa fa-bell text-warning"></i>
  35. @*<span class="bg-danger navbar-badge" style="top: 0px;border-radius: 50%;width: 15px;height: 15px;line-height: 10px;"></span>*@
  36. </a>
  37. <div class="dropdown-menu dropdown-menu-lg dropdown-menu-right">
  38. </div>
  39. </li>
  40. @Html.Action("UserMenu", "Layout")
  41. @if (ShowLang())
  42. {
  43. @Html.Action("LanguageChange", "Layout")
  44. }
  45. <li class="nav-item">
  46. <a class="nav-link" data-widget="control-sidebar" data-slide="true" href="#">
  47. <i class="fa fa-th-large"></i>
  48. </a>
  49. </li>
  50. </ul>
  51. </nav>
  52. <!-- /.navbar -->
  53. @using (Html.BeginScripts())
  54. {
  55. <!-- Navbar -->
  56. <script>
  57. function PushmenuExtra(that) {
  58. if ($(that).hasClass("iwb-collapse")) {
  59. $(that).removeClass("iwb-collapse");
  60. } else {
  61. $(that).addClass("iwb-collapse");
  62. }
  63. }
  64. $(function () {
  65. //监听 #PushMenuBar 的class变化
  66. var mutationObserver = new MutationObserver(function (m, o) {
  67. console.log(m, o);
  68. $('.iwb-bootstrap-table').fadeOut(200);
  69. setTimeout(function () {
  70. $('table').each(function () {
  71. if ($(this).data('iwb.table')) {
  72. $(this).iwbTable('resetView');
  73. $('.iwb-bootstrap-table').fadeIn();
  74. }
  75. });
  76. },
  77. 300);
  78. });
  79. mutationObserver.observe($('#PushMenuBar')[0], { attributes: true, attributeFilter: ['class'], attributeOldValue: true });
  80. });
  81. </script>
  82. <script id="headerNotificationBarTemplate" type="x-tmpl-mustache">
  83. <a class="nav-link" data-toggle="dropdown" href="#">
  84. <i class="fa fa-bell text-warning"></i>
  85. {{#unreadCount}}
  86. <span class="bg-danger navbar-badge" style="top: 0px;border-radius: 50%;width: 15px;height: 15px;line-height: 10px;"> {{unreadCount}}</span>
  87. {{/unreadCount}}
  88. </a>
  89. <div class="dropdown-menu notification-menu dropdown-menu-right">
  90. {{#notifications.length}}
  91. <span class="dropdown-header">{{unreadCount}} @L("NewNotifications")</span>
  92. <div class="dropdown-divider"></div>
  93. {{/notifications.length}}
  94. {{#notifications}}
  95. <a class="dropdown-item notification-item {{#url}}notification-url{{/url}} {{#isUnread}}user-notification-item-unread{{/isUnread}}" data-url="{{url}}">
  96. <div class="item-icon">
  97. <i class="{{icon}}"></i>
  98. </div>
  99. <div class="item-title">{{{text}}}</div>
  100. <div class="item-time text-i">{{timeAgo}}</div>
  101. <div class="item-state set-read">
  102. {{#isUnread}}
  103. <span data-notification-id="{{userNotificationId}}" class="no-read">@L("NoRead")</span>
  104. {{/isUnread}}
  105. {{^isUnread}}
  106. <span class="has-read">@L("HasRead")</span>
  107. {{/isUnread}}
  108. </div>
  109. </a>
  110. {{/notifications}}
  111. {{^notifications.length}}
  112. <span class="notification-empty-text p-3">
  113. @L("ThereIsNoNotification")
  114. </span>
  115. {{/notifications.length}}
  116. {{#notifications.length}}
  117. <div class="dropdown-divider"></div>
  118. <div class="row m-2">
  119. {{#unreadCount}}
  120. <div class="text-center col-6">
  121. <a href="" id="SetAllNotificationsAsRead">@L("SetAllAsRead")</a>
  122. </div>
  123. {{/unreadCount}}
  124. <div class="text-center col-6">
  125. <div class="text-center"><a href="@Url.Action("Notification", "BaseSystem")">@L("SeeAllNotifications")</a></div>
  126. </div>
  127. </div>
  128. {{/notifications.length}}
  129. </div>
  130. </script>
  131. <!-- /.navbar -->
  132. }