common_sider.html 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. {{define "menuItems"}}
  2. <a-menu-item key="{{ .base_path }}panel/">
  3. <a-icon type="dashboard"></a-icon>
  4. <span>{{ i18n "menu.dashboard"}}</span>
  5. </a-menu-item>
  6. <a-menu-item key="{{ .base_path }}panel/inbounds">
  7. <a-icon type="user"></a-icon>
  8. <span>{{ i18n "menu.inbounds"}}</span>
  9. </a-menu-item>
  10. <a-menu-item key="{{ .base_path }}panel/settings">
  11. <a-icon type="setting"></a-icon>
  12. <span>{{ i18n "menu.settings"}}</span>
  13. </a-menu-item>
  14. <a-menu-item key="{{ .base_path }}panel/xray">
  15. <a-icon type="tool"></a-icon>
  16. <span>{{ i18n "menu.xray"}}</span>
  17. </a-menu-item>
  18. <!--<a-menu-item key="{{ .base_path }}panel/clients">-->
  19. <!-- <a-icon type="laptop"></a-icon>-->
  20. <!-- <span>Client</span>-->
  21. <!--</a-menu-item>-->
  22. <a-menu-item key="{{ .base_path }}logout">
  23. <a-icon type="logout"></a-icon>
  24. <span>{{ i18n "menu.logout"}}</span>
  25. </a-menu-item>
  26. {{end}}
  27. {{define "commonSider"}}
  28. <a-layout-sider :theme="themeSwitcher.currentTheme" id="sider" collapsible breakpoint="md" collapsed-width="0">
  29. <a-menu :theme="themeSwitcher.currentTheme" mode="inline" selected-keys="">
  30. <a-menu-item mode="inline">
  31. <a-icon type="bulb" :theme="themeSwitcher.isDarkTheme ? 'filled' : 'outlined'"></a-icon>
  32. <theme-switch />
  33. </a-menu-item>
  34. </a-menu>
  35. <a-menu :theme="themeSwitcher.currentTheme" mode="inline" :selected-keys="['{{ .request_uri }}']"
  36. @click="({key}) => key.startsWith('http') ? window.open(key) : location.href = key">
  37. {{template "menuItems" .}}
  38. </a-menu>
  39. </a-layout-sider>
  40. <a-drawer id="sider-drawer" placement="left" :closable="false"
  41. @close="siderDrawer.close()"
  42. :visible="siderDrawer.visible"
  43. :wrap-class-name="themeSwitcher.currentTheme"
  44. :wrap-style="{ padding: 0 }">
  45. <div class="drawer-handle" @click="siderDrawer.change()" slot="handle">
  46. <a-icon :type="siderDrawer.visible ? 'close' : 'menu-fold'"></a-icon>
  47. </div>
  48. <a-menu :theme="themeSwitcher.currentTheme" mode="inline" selected-keys="">
  49. <a-menu-item mode="inline">
  50. <a-icon type="bulb" :theme="themeSwitcher.isDarkTheme ? 'filled' : 'outlined'"></a-icon>
  51. <theme-switch />
  52. </a-menu-item>
  53. </a-menu>
  54. <a-menu :theme="themeSwitcher.currentTheme" mode="inline" :selected-keys="['{{ .request_uri }}']"
  55. @click="({key}) => key.startsWith('http') ? window.open(key) : location.href = key">
  56. {{template "menuItems" .}}
  57. </a-menu>
  58. </a-drawer>
  59. <script>
  60. const siderDrawer = {
  61. visible: false,
  62. show() {
  63. this.visible = true;
  64. },
  65. close() {
  66. this.visible = false;
  67. },
  68. change() {
  69. this.visible = !this.visible;
  70. },
  71. };
  72. </script>
  73. {{end}}