header.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <template>
  2. <div>
  3. <img src="../../assets/images/logoHeader.png" />
  4. <span>深圳市多元世纪信息技术股份有限公司</span>
  5. </div>
  6. <div class="m-layout-header-right">
  7. <div @click="openDrawer">
  8. <span>{{ username }},您好!</span>
  9. </div>
  10. <div class="relative">
  11. <!-- <a-input-search ref="userNameInput"
  12. class="searchInput"
  13. readonly
  14. placeholder="请输入代码/名称"
  15. @pressEnter="search">
  16. </a-input-search> -->
  17. <!-- <a-icon type="search" /> -->
  18. </div>
  19. <div class="news-container">
  20. <a-badge @click="openNotice">
  21. <svg class="icon svg-icon"
  22. aria-hidden="true">
  23. <use xlink:href="#icon-xiaoxi"></use>
  24. </svg>
  25. </a-badge>
  26. </div>
  27. <div>
  28. <a-popover v-model:visible="visible"
  29. trigger="click"
  30. placement="bottomRight">
  31. <template #content>
  32. <div v-for="item in setMenu"
  33. @click="chooseSetMenu(item.path)"
  34. :key="item.path">{{ item.name }}</div>
  35. </template>
  36. <a-avatar :size="24">
  37. <template #icon>
  38. <UserOutlined />
  39. </template>
  40. </a-avatar>
  41. </a-popover>
  42. <Setting />
  43. </div>
  44. </div>
  45. </template>
  46. <script lang="ts">
  47. import { defineComponent, ref, provide } from 'vue';
  48. import APP from '@/services';
  49. import { openModal } from '@/common/setup/modal/index';
  50. import { UserOutlined } from '@ant-design/icons-vue';
  51. import Setting from '@/views/setting/index.vue';
  52. // 设置
  53. const setFn = () => {
  54. const visible = ref<boolean>(false);
  55. const chooseSetupItem = ref<string>('');
  56. provide('ControlModal', chooseSetupItem);
  57. const setMenu = [
  58. // { name: '修改密码', path: 'password' },
  59. // { name: '收货地址', path: 'addresss' },
  60. // // {name: '发票', path: 'setup-password'},
  61. // { name: '手机号码绑定/解绑', path: 'phone' },
  62. // { name: '关于我们', path: 'aboutUs' },
  63. { name: '退出', path: 'logout' },
  64. ];
  65. const { openAction } = openModal('logout');
  66. function chooseSetMenu(path: string) {
  67. // chooseSetupItem.value = path;
  68. openAction();
  69. console.log(path);
  70. visible.value = false;
  71. }
  72. return { visible, setMenu, chooseSetMenu };
  73. };
  74. // 搜索
  75. const onSearch = () => {
  76. function search(value: string) {
  77. console.log(value);
  78. }
  79. return { search };
  80. };
  81. export default defineComponent({
  82. components: {
  83. UserOutlined,
  84. Setting,
  85. },
  86. props: {
  87. collapsed: {
  88. default: true,
  89. type: Boolean,
  90. },
  91. },
  92. setup() {
  93. const username = APP.get('username');
  94. const { openAction: openNotice } = openModal('notice');
  95. return {
  96. username,
  97. openNotice,
  98. ...setFn(),
  99. ...onSearch(),
  100. };
  101. },
  102. });
  103. </script>