您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <template>
  2. <!-- 头部选项 -->
  3. <div class="as-gravity-center-start" style=" height: 100%">
  4. <!-- 图标部分 -->
  5. <div class="as-weight">
  6. <el-icon size="24px" color="#FFFFFF" @click="cut">
  7. <fold v-if="menuStart.menuIsExpansion" />
  8. <expand v-if="!menuStart.menuIsExpansion" />
  9. </el-icon>
  10. </div>
  11. <!-- 我的部分 -->
  12. <div class="as-gravity-center-start" style="height: 100%">
  13. <!-- 搜索 -->
  14. <search id="header-search" />
  15. <!-- 全屏 -->
  16. <el-icon @click="fullScreen" style="margin: 0px 20px 0px 20px" size="24px" color="#FFFFFF">
  17. <FullScreen />
  18. </el-icon>
  19. <!-- 弹出框提示 -->
  20. <el-popover v-model:visible="visible" placement="bottom" :width="160">
  21. <div class="as-layout-vertical">
  22. <el-button type="text" @click="hint('个人中心')" class="as-text-14px" style="width: 100%;">个人中心</el-button>
  23. <el-button type="text" @click="hint('退出登录')" class="as-text-14px" style="margin-right: 10px;">退出登录</el-button>
  24. </div>
  25. <template #reference>
  26. <!-- 头像 -->
  27. <div style="margin-left: 20px">
  28. <el-avatar @click="visible = !visible" shape="square" :size="40" src="/logo2.png" />
  29. </div>
  30. </template>
  31. </el-popover>
  32. <!-- 设置 -->
  33. <el-icon @click="hint('点击了设置')" style="margin: 0px 30px 0px 30px" size="24px" color="#FFFFFF">
  34. <setting />
  35. </el-icon>
  36. </div>
  37. </div>
  38. </template>
  39. <script setup lang="ts">
  40. import screenfull from "screenfull" //引入全屏依赖
  41. import ImgHead from '@/assets/image/head.png' //默认头像资源
  42. import $store from "@/store/index" // 引入vuex
  43. import Search from '@/components/HeaderSearch/index.vue' //搜索组件
  44. import {
  45. ref,
  46. reactive,
  47. nextTick
  48. } from 'vue'
  49. import {
  50. useRouter
  51. } from 'vue-router'
  52. import {
  53. ElMessage
  54. } from 'element-plus' //消息提示
  55. import Cookies from 'js-cookie'
  56. const visible = ref(false)
  57. const router = useRouter()
  58. let menuStart = reactive($store.state.data) //菜单开关
  59. //切换菜单开关监听
  60. function cut() {
  61. $store.dispatch('cutMenu', !menuStart.menuIsExpansion)
  62. }
  63. //全屏监听
  64. function fullScreen() {
  65. screenfull.toggle()
  66. }
  67. //提示点击
  68. function hint(msg) {
  69. if (msg === '退出登录') {
  70. Cookies.remove('token')
  71. Cookies.remove('rememberPSWD')
  72. Cookies.remove('account')
  73. Cookies.remove('password')
  74. router.replace('/')
  75. location.reload()
  76. } else {
  77. ElMessage({
  78. message: msg,
  79. type: 'success'
  80. })
  81. }
  82. }
  83. </script>
  84. <style lang="scss" scoped>
  85. </style>