header.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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. placeholder="请输入代码/名称"
  24. @pressEnter="search">
  25. readonly
  26. </a-input-search>-->
  27. <!-- <a-icon type="search" /> -->
  28. </div>
  29. <div v-if="isOemByEnum(OemType.wrspot)">
  30. <a-popover trigger="click" placement="bottom" overlayClassName="friendPopover">
  31. <template #content>
  32. <Friend />
  33. </template>
  34. <span class="friendIcon">
  35. <svg class="icon svg-icon" aria-hidden="true">
  36. <use xlink:href="#icon-pengyou1" />
  37. </svg>
  38. </span>
  39. </a-popover>
  40. </div>
  41. <div class="news-container">
  42. <a-badge @click="openNotice" :dot="getUnReadNoticeLength() > 0">
  43. <svg class="icon svg-icon" aria-hidden="true">
  44. <use xlink:href="#icon-xiaoxi" />
  45. </svg>
  46. </a-badge>
  47. </div>
  48. <div>
  49. <a-popover v-model:visible="visible" trigger="click" placement="bottomRight">
  50. <template #content>
  51. <div
  52. v-for="item in setMenu"
  53. class="popItem"
  54. @click="chooseSetMenu(item.path)"
  55. :key="item.path"
  56. >{{ item.name }}</div>
  57. </template>
  58. <a-avatar :size="24">
  59. <template #icon>
  60. <SettingFilled />
  61. <!-- <svg class="icon svg-icon" aria-hidden="true">
  62. <use xlink:href="#icon-yonghu1" />
  63. </svg>-->
  64. </template>
  65. </a-avatar>
  66. </a-popover>
  67. <Setting />
  68. </div>
  69. </div>
  70. </template>
  71. <script lang="ts">
  72. import { defineComponent, ref, provide } from 'vue';
  73. import { openModal } from '@/common/setup/modal/index';
  74. import { UserOutlined, SettingFilled } from '@ant-design/icons-vue';
  75. import Setting from '@/views/setting/index.vue';
  76. import { getUserName } from '@/services/bus/user';
  77. import { logout } from '@/services/bus/login';
  78. import APP from '@/services';
  79. import Router from '@/router';
  80. import { handleNotice } from '@/views/setting/notice/setup';
  81. import { isOemByEnum, OemType } from '@/common/config/projectName';
  82. import { changeTheme, ThemeEnum } from '@/common/config/theme';
  83. import { initData } from '@/common/methods';
  84. import Friend from '@/views/setting/friends/index.vue';
  85. // 设置
  86. const setFn = () => {
  87. const visible = ref<boolean>(false);
  88. const chooseSetupItem = ref<string>('');
  89. provide('ControlModal', chooseSetupItem);
  90. const setMenu = ref([{ name: '退出', path: 'logout' }]);
  91. // const setMenu = [
  92. // // { name: '修改密码', path: 'password' },
  93. // // { name: '收货地址', path: 'addresss' },
  94. // // // {name: '发票', path: 'setup-password'},
  95. // // { name: '手机号码绑定/解绑', path: 'phone' },
  96. // // { name: '关于我们', path: 'aboutUs' },
  97. // { name: '白主题', path: ThemeEnum.light },
  98. // { name: '黑主题', path: ThemeEnum.dark },
  99. // { name: '退出', path: 'logout' },
  100. // ];
  101. initData(() => {
  102. if (isOemByEnum(OemType.wrspot)) {
  103. const theme = [
  104. { name: '白主题', path: ThemeEnum.light },
  105. { name: '黑主题', path: ThemeEnum.dark },
  106. ];
  107. setMenu.value = [...theme, ...setMenu.value];
  108. }
  109. });
  110. const { openAction } = openModal('logout');
  111. function chooseSetMenu(path: string) {
  112. if (path === 'logout') {
  113. logout();
  114. APP.closeServer();
  115. Router.replace('/login');
  116. } else {
  117. changeTheme(path as ThemeEnum);
  118. // openAction();
  119. }
  120. visible.value = false;
  121. }
  122. return { visible, setMenu, chooseSetMenu };
  123. };
  124. // 搜索
  125. const onSearch = () => {
  126. function search(value: string) {}
  127. return { search };
  128. };
  129. export default defineComponent({
  130. components: {
  131. UserOutlined,
  132. Setting,
  133. Friend,
  134. SettingFilled,
  135. },
  136. props: {
  137. collapsed: {
  138. default: true,
  139. type: Boolean,
  140. },
  141. },
  142. setup() {
  143. const { openAction: openNotice } = openModal('notice');
  144. const { getUnReadNoticeLength } = handleNotice();
  145. return {
  146. openNotice,
  147. getUserName,
  148. getUnReadNoticeLength,
  149. ...setFn(),
  150. ...onSearch(),
  151. isOemByEnum,
  152. OemType,
  153. };
  154. },
  155. });
  156. </script>
  157. <style lang="less">
  158. .friendIcon {
  159. .icon {
  160. font-size: 20px;
  161. line-height: 32px;
  162. margin: 6px 5px;
  163. }
  164. }
  165. </style>