header.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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" :dot="getUnReadNoticeLength() > 0">
  31. <svg class="icon svg-icon" aria-hidden="true">
  32. <use xlink:href="#icon-xiaoxi" />
  33. </svg>
  34. </a-badge>
  35. </div>
  36. <div>
  37. <a-popover v-model:visible="visible" trigger="click" placement="bottomRight">
  38. <template #content>
  39. <div
  40. v-for="item in setMenu"
  41. class="popItem"
  42. @click="chooseSetMenu(item.path)"
  43. :key="item.path"
  44. >{{ item.name }}</div>
  45. </template>
  46. <a-avatar :size="24">
  47. <template #icon>
  48. <!-- <SettingFilled /> -->
  49. <svg class="icon svg-icon" aria-hidden="true">
  50. <use xlink:href="#icon-yonghu4" />
  51. </svg>
  52. </template>
  53. </a-avatar>
  54. </a-popover>
  55. <Setting />
  56. </div>
  57. </div>
  58. </template>
  59. <script lang="ts">
  60. import { defineComponent, ref, provide } from 'vue';
  61. import { openModal } from '@/common/setup/modal/index';
  62. import { UserOutlined } from '@ant-design/icons-vue';
  63. import Setting from '@/views/setting/index.vue';
  64. import { getUserName } from '@/services/bus/user';
  65. import { logout } from '@/services/bus/login';
  66. import APP from '@/services';
  67. import Router from '@/router';
  68. import { handleNotice } from '@/views/setting/notice/setup';
  69. import { isOemByEnum, OemType } from '@/common/config/projectName';
  70. import { changeTheme, ThemeEnum } from '@/common/config/theme';
  71. // 设置
  72. const setFn = () => {
  73. const visible = ref<boolean>(false);
  74. const chooseSetupItem = ref<string>('');
  75. provide('ControlModal', chooseSetupItem);
  76. const setMenu = [
  77. // { name: '修改密码', path: 'password' },
  78. // { name: '收货地址', path: 'addresss' },
  79. // // {name: '发票', path: 'setup-password'},
  80. // { name: '手机号码绑定/解绑', path: 'phone' },
  81. // { name: '关于我们', path: 'aboutUs' },
  82. { name: '白主题', path: ThemeEnum.light },
  83. { name: '黑主题', path: ThemeEnum.dark },
  84. { name: '退出', path: 'logout' },
  85. ];
  86. const { openAction } = openModal('logout');
  87. function chooseSetMenu(path: string) {
  88. if (path === 'logout') {
  89. logout();
  90. APP.closeServer();
  91. Router.replace('/login');
  92. } else {
  93. changeTheme(path as ThemeEnum);
  94. // openAction();
  95. }
  96. visible.value = false;
  97. }
  98. return { visible, setMenu, chooseSetMenu };
  99. };
  100. // 搜索
  101. const onSearch = () => {
  102. function search(value: string) {}
  103. return { search };
  104. };
  105. export default defineComponent({
  106. components: {
  107. UserOutlined,
  108. Setting,
  109. },
  110. props: {
  111. collapsed: {
  112. default: true,
  113. type: Boolean,
  114. },
  115. },
  116. setup() {
  117. const { openAction: openNotice } = openModal('notice');
  118. const { getUnReadNoticeLength } = handleNotice();
  119. return {
  120. openNotice,
  121. getUserName,
  122. getUnReadNoticeLength,
  123. ...setFn(),
  124. ...onSearch(),
  125. isOemByEnum,
  126. OemType,
  127. };
  128. },
  129. });
  130. </script>