header.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <template>
  2. <!-- 风险管理 -->
  3. <div v-if="isOemByEnum(OemType.manager)">
  4. <img src="../../assets/images/logoHeader.png" />
  5. <span>深圳市多元世纪信息技术股份有限公司</span>
  6. </div>
  7. <!-- 云融 -->
  8. <div v-else-if="isOemByEnum(OemType.wrspot)">
  9. <img src="../../assets/images/headLogo.jpg" />
  10. <span>云融</span>
  11. </div>
  12. <div v-else>
  13. <img src="../../assets/images/logoHeader.png" />
  14. <span>深圳市多元世纪信息技术股份有限公司</span>
  15. </div>
  16. <div class="m-layout-header-right">
  17. <div @click="openDrawer">
  18. <span>{{ getUserName() }},您好!</span>
  19. </div>
  20. <div class="relative">
  21. <!-- <a-input-search ref="userNameInput"
  22. class="searchInput"
  23. readonly
  24. placeholder="请输入代码/名称"
  25. @pressEnter="search">
  26. </a-input-search>-->
  27. <!-- <a-icon type="search" /> -->
  28. </div>
  29. <div class="news-container">
  30. <a-badge @click="openNotice"
  31. :dot="getUnReadNoticeLength() > 0">
  32. <svg class="icon svg-icon"
  33. aria-hidden="true">
  34. <use xlink:href="#icon-xiaoxi" />
  35. </svg>
  36. </a-badge>
  37. </div>
  38. <div>
  39. <a-popover v-model:visible="visible"
  40. trigger="click"
  41. placement="bottomRight">
  42. <template #content>
  43. <div v-for="item in setMenu"
  44. class="popItem"
  45. @click="chooseSetMenu(item.path)"
  46. :key="item.path">{{ item.name }}</div>
  47. </template>
  48. <a-avatar :size="24">
  49. <template #icon>
  50. <!-- <SettingFilled /> -->
  51. <svg class="icon svg-icon"
  52. aria-hidden="true">
  53. <use xlink:href="#icon-yonghu4" />
  54. </svg>
  55. </template>
  56. </a-avatar>
  57. </a-popover>
  58. <Setting />
  59. </div>
  60. </div>
  61. </template>
  62. <script lang="ts">
  63. import { defineComponent, ref, provide } from 'vue';
  64. import { openModal } from '@/common/setup/modal/index';
  65. import { UserOutlined } from '@ant-design/icons-vue';
  66. import Setting from '@/views/setting/index.vue';
  67. import { getUserName } from '@/services/bus/user';
  68. import { logout } from '@/services/bus/login';
  69. import APP from '@/services';
  70. import Router from '@/router';
  71. import { handleNotice } from '@/views/setting/notice/setup';
  72. import { isOemByEnum, OemType } from '@/common/config/projectName';
  73. import { changeTheme, ThemeEnum } from '@/common/config/theme';
  74. // 设置
  75. const setFn = () => {
  76. const visible = ref<boolean>(false);
  77. const chooseSetupItem = ref<string>('');
  78. provide('ControlModal', chooseSetupItem);
  79. const setMenu = [
  80. // { name: '修改密码', path: 'password' },
  81. // { name: '收货地址', path: 'addresss' },
  82. // // {name: '发票', path: 'setup-password'},
  83. // { name: '手机号码绑定/解绑', path: 'phone' },
  84. // { name: '关于我们', path: 'aboutUs' },
  85. { name: '退出', path: 'logout' },
  86. // { name: '白主题', path: ThemeEnum.light },
  87. // { name: '黑主题', path: ThemeEnum.dark },
  88. ];
  89. const { openAction } = openModal('logout');
  90. function chooseSetMenu(path: string) {
  91. if (path === 'logout') {
  92. logout();
  93. APP.closeServer();
  94. Router.replace('/login');
  95. } else {
  96. changeTheme(path as ThemeEnum);
  97. // openAction();
  98. }
  99. visible.value = false;
  100. }
  101. return { visible, setMenu, chooseSetMenu };
  102. };
  103. // 搜索
  104. const onSearch = () => {
  105. function search(value: string) {}
  106. return { search };
  107. };
  108. export default defineComponent({
  109. components: {
  110. UserOutlined,
  111. Setting,
  112. },
  113. props: {
  114. collapsed: {
  115. default: true,
  116. type: Boolean,
  117. },
  118. },
  119. setup() {
  120. const { openAction: openNotice } = openModal('notice');
  121. const { getUnReadNoticeLength } = handleNotice();
  122. return {
  123. openNotice,
  124. getUserName,
  125. getUnReadNoticeLength,
  126. ...setFn(),
  127. ...onSearch(),
  128. isOemByEnum,
  129. OemType,
  130. };
  131. },
  132. });
  133. </script>