Files
violin-home/src/components/layout/NavBar.vue
T
simple321vip 4da6832b44 feat: R1 重构对称迁移 + 升级依赖 + 配置文件分离
- 命名重构:tenant → customer(对齐后端 R1 重构)
  - Tenant → Customer / tenant_id → customerId
  - tenantStore → customerStore / getTenant/setTenant → getCustomer/setCustomer
  - cookie key tenant → customer, HTTP header tenantId → customerId
- 后端契约更新:AuthResponse 加 sub 字段
- 接口 URL 修复:/auth/oidc/callback → /api/v1/auth/oidc/callback
- 依赖升级:vue 3.5 / element-plus 2.8 / vite 5 / typescript 5.6 / sass 1.79
- 删 node-sass / scss / sass-loader / moment / mock/index.ts
- 配置文件拆分:.env.development / .env.production / .env.example
- 删除冗余 view/auth/auth/callback.vue 副本
- .gitignore 增加 dist / .opencode / tmp
- 新增 AGENT.md 与后端风格对齐
2026-06-22 08:02:21 +08:00

163 lines
4.9 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<el-row class="pd-0">
<el-col :xs="2" :lg="1" :md="1" :sm="1" :xl="1" style="z-index:100">
<!-- <div class="menu-total" @click="totalCollapse">
<div v-if="isCollapse" class="gvaIcon gvaIcon-arrow-double-right" />
<div v-else class="gvaIcon gvaIcon-arrow-double-left" />
</div> -->
</el-col>
<el-col :xs="10" :lg="14" :md="14" :sm="9" :xl="14" :pull="1">
<!-- 修改为手机端不显示顶部标签 -->
<!-- <el-breadcrumb v-show="!isMobile" class="breadcrumb">
<el-breadcrumb-item
v-for="item in matched.slice(1,matched.length)"
:key="item.path"
>{{ fmtTitle(item.meta.title,route) }}</el-breadcrumb-item>
</el-breadcrumb> -->
</el-col>
<el-col :xs="12" :lg="9" :md="9" :sm="14" :xl="9">
<div class="right-box">
<el-dropdown class="item">
<div class="dp-flex justify-content-center align-items height-full width-full">
<el-button v-show="!useSettingsStore.isMobile" type="success" round>appStatus</el-button>
</div>
<template #dropdown>
<el-dropdown-menu class="dropdown-group">
<el-dropdown-item v-for="status in appStatus">
<el-icon v-if="status.status" color="green">
<CircleCheck />
</el-icon>
<el-icon v-if="!status.status" color="red">
<Warning />
</el-icon>
{{ status.appName }}
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
<el-badge :value="messageCount" class="item">
<el-button round @click="drawer = true">
<template #icon>
<el-icon>
<Message />
</el-icon>
<el-drawer v-model="drawer" title="I am the title" :with-header="false">
<span>站内信呢</span>
<div v-for="msg in messageList">
</div>
</el-drawer>
</template>
</el-button>
</el-badge>
<el-dropdown>
<div class="dp-flex justify-content-center align-items height-full width-full">
<span class="header-avatar" style="cursor: pointer">
<CustomPic />
<span v-show="!useSettingsStore.isMobile" style="margin-left: 5px">{{
useCustomerStore.customer.account
}}</span>
<el-icon>
<arrow-down />
</el-icon>
</span>
</div>
<template #dropdown>
<el-dropdown-menu class="dropdown-group">
<el-dropdown-item>
<span style="font-weight: 600;">
当前角色{{ useCustomerStore.customer.account }}
</span>
</el-dropdown-item>
<template v-if="useCustomerStore.customer.account">
<!-- <el-dropdown-item v-for="item in userStore.userInfo.authorities.filter(i=>i.authorityId!==userStore.userInfo.authorityId)" :key="item.authorityId" @click="changeUserAuth(item.authorityId)">
<span>
切换为{{ item.authorityName }}
</span>
</el-dropdown-item> -->
</template>
<el-dropdown-item icon="avatar" @click="toPerson">个人信息</el-dropdown-item>
<el-dropdown-item icon="reading-lamp" @click="useCustomerStore.logout"> </el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</div>
</el-col>
</el-row>
</template>
<script setup lang='ts'>
import CustomPic from "@/components/customPic/index.vue";
import { customerStore } from '@/store/modules/customer'
import { settingsStore } from '@/store/modules/settings'
import { Message } from "@element-plus/icons-vue"
import { reactive, ref } from "vue";
// -- IMPORT --
const useCustomerStore = customerStore()
const useSettingsStore = settingsStore()
// -- REACTIVE OBJECT --
const appStatus = reactive([
{
appName: "wiki",
status: true,
},
{
appName: "bookmark",
status: true,
},
{
appName: "calendar",
status: false,
},
])
// -- REF OBJECT --
const messageCount = ref()
const drawer = ref(false)
const messageList = reactive<any[]>([
{
title: "过期通知",
type: "",
message: "尊敬的用户,你的账号余额已不足,请充值",
Unread: true,
}
])
// -- EVENT DEFINITION
const toPerson = () => {
}
useCustomerStore.reflush()
</script>
<style lang="scss" scoped>
.right-box {
padding-top: 16px;
display: flex;
justify-content: flex-end;
align-items: center;
img {
vertical-align: middle;
border: 1px solid #ccc;
border-radius: 6px;
}
}
.item {
margin-top: 5px;
margin-right: 30px;
}
.header-avatar {
display: flex;
justify-content: center;
align-items: center;
}
</style>