header.vue 5.7 KB

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