杨磊
1 天以前 cabc1ce19c57a7c7388502952eaaafd558363145
src/layout/components/headerPage.vue
@@ -36,15 +36,22 @@
          </div>
          <div v-else class="userInfoBox">
            <el-dropdown @command="handleCommand">
              <span style="cursor: pointer">欢迎您,{{ userStore?.userInfo.name }}!</span>
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item icon="el-icon-user" command="gotoPersonalCenter"
                  >个人中心</el-dropdown-item
                >
                <el-dropdown-item icon="el-icon-switch-button" command="logout"
                  >退出登录</el-dropdown-item
                >
              </el-dropdown-menu>
              <span class="el-dropdown-link">
                欢迎您,{{ userStore?.userInfo.name }}!
                <el-icon class="el-icon--right">
                  <arrow-down />
                </el-icon>
              </span>
              <template #dropdown>
                <el-dropdown-menu>
                  <el-dropdown-item icon="el-icon-user" command="gotoPersonalCenter"
                    >个人中心</el-dropdown-item
                  >
                  <el-dropdown-item icon="el-icon-switch-button" command="logout"
                    >退出登录</el-dropdown-item
                  >
                </el-dropdown-menu>
              </template>
            </el-dropdown>
          </div>
        </div>
@@ -71,7 +78,7 @@
import login from './login.vue'
import { onMounted, ref } from 'vue'
import { Search } from '@element-plus/icons-vue'
import { useUserStore } from '@/stores'
import { useUserStore } from '@/store'
import { useRouter } from 'vue-router'
const userStore = useUserStore()
const router = useRouter()
@@ -115,7 +122,19 @@
})
const gotoSearch = () => {}
const handleCommand = () => {}
const handleCommand = (item) => {
  if (item === 'gotoPersonalCenter') {
    router.push({
      path: '/personalCenter',
    })
  }
  if (item === 'logout') {
    localStorage.clear()
    router.push({
      path: '/home',
    })
  }
}
const gotoPage = (item) => {
  router.push(item.path)
}
@@ -134,17 +153,11 @@
    p {
      float: left;
    }
    .loginInfoBox {
      float: right;
      .loginBtnBox {
        a {
          cursor: pointer;
          text-decoration: none;
          color: inherit;
          margin: 0 4px;
        }
      }
    }
  }
  .loginInfoBox {
    width: 200px;
    margin-left: 20px;
  }
  .logoBox {
    padding: 25px 0;
@@ -162,9 +175,9 @@
      width: 670px;
      float: right;
      padding-right: 10px;
      line-height: 66px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      .searchItem {
        width: 120px;
        vertical-align: initial;