| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748 |
- <template>
- <el-container class="layout-container">
- <el-aside width="200px">
- <div class="logo">浠艾福</div>
- <el-scrollbar wrap-class="sidebar-scrollbar-wrap">
- <el-menu
- :default-active="activeMenu"
- class="sidebar-menu"
- background-color="transparent"
- text-color="#64748B"
- active-text-color="#6366F1"
- @select="handleMenuSelect"
- >
- <template v-for="item in menuItems">
- <el-submenu v-if="item.children && hasPerm(item.perm)" :key="item.title || item.path" :index="item.title || item.path">
- <template slot="title">
- <i :class="item.icon"></i>
- <span>{{ item.label || item.title }}</span>
- </template>
- <template v-for="child in item.children">
- <!-- 子项有 children = 三级菜单 -->
- <el-submenu v-if="child.children && hasPerm(child.perm)" :key="child.title" :index="child.title">
- <template slot="title">
- <i :class="child.icon"></i>
- <span>{{ child.title }}</span>
- </template>
- <el-menu-item
- v-for="grandson in child.children"
- :key="grandson.path"
- :index="grandson.path"
- >
- <i :class="grandson.icon"></i>
- <span slot="title">{{ grandson.label }}</span>
- </el-menu-item>
- </el-submenu>
- <!-- 普通二级菜单项 -->
- <el-menu-item v-else-if="hasPerm(child.perm)" :key="child.path" :index="child.path">
- <i :class="child.icon"></i>
- <span slot="title">{{ child.label }}</span>
- </el-menu-item>
- </template>
- </el-submenu>
- <el-menu-item v-else-if="hasPerm(item.perm)" :key="item.path" :index="getMenuIndex(item)">
- <i :class="item.icon"></i>
- <span slot="title">{{ item.label }}</span>
- </el-menu-item>
- </template>
- </el-menu>
- </el-scrollbar>
- </el-aside>
- <el-container>
- <el-header>
- <div class="header-right">
- <el-badge :value="unreadMessageCount" :hidden="unreadMessageCount === 0" class="msg-badge">
- <el-button type="text" class="msg-btn" @click="handleMessageClick" icon="el-icon-bell"></el-button>
- </el-badge>
- <el-button v-if="hasPerm('service:*')" type="text" class="invite-code-btn" @click="showInviteCode" icon="el-icon-share">
- 邀请码
- </el-button>
- <el-dropdown trigger="click" @command="handleProfileCommand">
- <span class="el-dropdown-link username">
- {{ displayUserLabel }}<i class="el-icon-arrow-down el-icon--right"></i>
- </span>
- <el-dropdown-menu slot="dropdown">
- <el-dropdown-item command="profile" icon="el-icon-user">个人信息</el-dropdown-item>
- <el-dropdown-item command="password" icon="el-icon-key">修改密码</el-dropdown-item>
- <el-dropdown-item command="logout" icon="el-icon-switch-button" divided>退出登录</el-dropdown-item>
- </el-dropdown-menu>
- </el-dropdown>
- </div>
- <!-- 邀请码 dialog -->
- <el-dialog title="我的邀请码" :visible.sync="inviteCodeVisible" width="500px" :close-on-click-modal="false">
- <div v-loading="inviteCodeLoading">
- <div v-if="inviteCodeData" class="invite-code-content">
- <div class="invite-code-section">
- <div class="invite-code-label">团队邀请码</div>
- <div class="invite-code-value">
- <span class="code-text">{{ inviteCodeData.code || '无' }}</span>
- <el-button size="mini" type="primary" @click="copyCode(inviteCodeData.code)" plain>复制</el-button>
- </div>
- <div class="invite-code-desc">
- 家庭用户通过此码加入您的团队
- </div>
- </div>
- </div>
- <div v-else-if="!inviteCodeLoading" class="no-invite-code">
- <i class="el-icon-warning-outline"></i>
- <p>暂无邀请码,请先生成</p>
- <el-button type="primary" @click="generateInviteCode">生成邀请码</el-button>
- </div>
- </div>
- </el-dialog>
- </el-header>
- <!-- 个人信息 dialog -->
- <el-dialog title="个人信息" :visible.sync="profileDialogVisible" width="400px">
- <el-form :model="profileForm" label-width="80px">
- <el-form-item label="用户名">
- <el-input v-model="profileForm.username" disabled></el-input>
- </el-form-item>
- <el-form-item label="真实姓名">
- <el-input v-model="profileForm.realName" disabled></el-input>
- </el-form-item>
- <el-form-item label="昵称">
- <el-input v-model="profileForm.nickname"></el-input>
- </el-form-item>
- <el-form-item label="手机号">
- <el-input v-model="profileForm.phone"></el-input>
- </el-form-item>
- <el-form-item label="邮箱">
- <el-input v-model="profileForm.email"></el-input>
- </el-form-item>
- </el-form>
- <span slot="footer">
- <el-button @click="profileDialogVisible = false">取消</el-button>
- <el-button type="primary" @click="confirmUpdateInfo" :loading="submitting">保存</el-button>
- </span>
- </el-dialog>
- <!-- 修改密码 dialog -->
- <el-dialog title="修改密码" :visible.sync="passwordDialogVisible" width="400px">
- <el-form :model="passwordForm" :rules="passwordRules" ref="passwordForm" label-width="100px">
- <el-form-item label="原密码" prop="oldPassword">
- <el-input v-model="passwordForm.oldPassword" type="password" show-password></el-input>
- </el-form-item>
- <el-form-item label="新密码" prop="newPassword">
- <el-input v-model="passwordForm.newPassword" type="password" show-password></el-input>
- </el-form-item>
- <el-form-item label="确认密码" prop="confirmPassword">
- <el-input v-model="passwordForm.confirmPassword" type="password" show-password></el-input>
- </el-form-item>
- </el-form>
- <span slot="footer">
- <el-button @click="passwordDialogVisible = false">取消</el-button>
- <el-button type="primary" @click="confirmChangePassword" :loading="submitting">确定</el-button>
- </span>
- </el-dialog>
- <el-main>
- <div class="main-wrapper">
- <router-view />
- </div>
- </el-main>
- </el-container>
- </el-container>
- </template>
- <script>
- import { getAdminInfo, changePassword } from '@/api/auth'
- import { updateAdminInfo } from '@/api/admin'
- import { getMyInviteCode } from '@/api/guide'
- import { getUnreadMessageCount } from '@/api/teacherMessage'
- import { getEffectivePermissions, hasPermission, getRoleLabel } from '@/utils/permissions'
- export default {
- data() {
- return {
- menuItems: [
- // ===== 1. 首页 (ALL) =====
- { path: '/dashboard', label: '首页', icon: 'el-icon-s-home', perm: 'dashboard' },
- // ===== 2. 家庭运营 (admin) =====
- { title: '家庭运营', icon: 'el-icon-s-custom', perm: 'operation',
- children: [
- { path: '/families', label: '家庭列表', icon: 'el-icon-s-custom', perm: 'family:list' },
- { path: '/children', label: '孩子管理', icon: 'el-icon-user-solid', perm: 'family:children' },
- { path: '/points', label: '积分管理', icon: 'el-icon-s-finance', perm: 'family:points' },
- { path: '/points-log', label: '积分记录', icon: 'el-icon-document', perm: 'family:points' },
- { path: '/wishes', label: '心愿管理', icon: 'el-icon-star-off', perm: 'family:wishes' },
- { path: '/rewards', label: '奖励管理', icon: 'el-icon-s-goods', perm: 'reward:list' },
- ]},
- // ===== 3. 任务中心 (admin) =====
- { title: '任务中心', icon: 'el-icon-s-order', perm: 'task:*',
- children: [
- { path: '/tasks', label: '任务列表', icon: 'el-icon-s-order', perm: 'task:list' },
- { path: '/task-templates', label: '任务模板', icon: 'el-icon-document', perm: 'task:templates' },
- { path: '/growth-task', label: '成长任务管理', icon: 'el-icon-s-management', perm: 'task:list' },
- ]},
- // ===== 4. 审核中心 (admin) =====
- { title: '审核中心', icon: 'el-icon-s-check', perm: 'audit',
- children: [
- { path: '/package-audit', label: '套餐审核', icon: 'el-icon-document-checked', perm: 'audit:package' },
- { path: '/guide-audit', label: '规划师审核', icon: 'el-icon-document-checked', perm: 'audit:guide' },
- { path: '/vendor-review', label: '服务商审核', icon: 'el-icon-document-checked', perm: 'audit:vendor' },
- { path: '/withdraw-audit', label: '提现审核', icon: 'el-icon-document-checked', perm: 'audit:withdraw' },
- ]},
- // ===== 5. 商城营销 (admin) =====
- { title: '商城营销', icon: 'el-icon-s-goods', perm: 'commerce',
- children: [
- { path: '/product-manage', label: '商品管理', icon: 'el-icon-s-goods', perm: 'commerce:products' },
- { path: '/order-manage', label: '订单管理', icon: 'el-icon-s-order', perm: 'commerce:orders' },
- { path: '/pending-refund', label: '待退款管理', icon: 'el-icon-warning', perm: 'commerce:orders' },
- { path: '/product-profit-rate', label: '产品利润率', icon: 'el-icon-data-line', perm: 'commerce:profit' },
- { path: '/coupon', label: '优惠券管理', icon: 'el-icon-ticket', perm: 'marketing:coupon' },
- { path: '/promotion', label: '推广管理', icon: 'el-icon-s-marketing', perm: 'marketing:promotion' },
- ]},
- // ===== 6. 知识中心 (admin + article_manager + activity_manager) =====
- { title: '知识中心', icon: 'el-icon-document', perm: 'content',
- children: [
- { path: '/article-categories', label: '知识分类', icon: 'el-icon-folder', perm: 'articles:categories' },
- { path: '/article-manage', label: '知识管理', icon: 'el-icon-document', perm: 'articles:manage' },
- { path: '/knowledge-tags', label: '知识标签', icon: 'el-icon-price-tag', perm: 'articles:categories' },
- { path: '/knowledge-base', label: '知识库', icon: 'el-icon-reading', perm: 'system:config' },
- { path: '/activities', label: '活动列表', icon: 'el-icon-date', perm: 'activity:list' },
- { path: '/activity-review', label: '活动审核', icon: 'el-icon-document-checked', perm: 'activity:review' },
- { path: '/activity-registration-review', label: '活动报名审核', icon: 'el-icon-document-checked', perm: 'activity:review' },
- ]},
- // ===== 7. 健康饮食 (admin + nutritionist) =====
- { title: '健康饮食', icon: 'el-icon-first-aid-kit', perm: 'health',
- children: [
- { path: '/health-reports', label: '健康报告', icon: 'el-icon-document', perm: 'health:reports' },
- { path: '/health-report-audit', label: '报告审核', icon: 'el-icon-document-checked', perm: 'health:reports' },
- { path: '/health-indicators', label: '健康指标', icon: 'el-icon-data-line', perm: 'health:indicators' },
- { path: '/health-checkins', label: '健康打卡', icon: 'el-icon-s-order', perm: 'health:checkins' },
- { path: '/emotion-alert', label: '情绪告警', icon: 'el-icon-warning', perm: 'health:checkins' },
- { path: '/nutrition-mappings', label: '营养素映射', icon: 'el-icon-connection', perm: 'health:mappings' },
- { path: '/energy-sandbox', label: '五维能量', icon: 'el-icon-data-line', perm: 'energy' },
- { path: '/energy-rule', label: '能量规则管理', icon: 'el-icon-setting', perm: 'energy' },
- { path: '/foods', label: '食材管理', icon: 'el-icon-apple', perm: 'diet:foods' },
- { path: '/recipes', label: '食谱管理', icon: 'el-icon-dish', perm: 'diet:recipes' },
- { path: '/seasonal-foods', label: '应季食材', icon: 'el-icon-sunny', perm: 'diet:seasonal' },
- ]},
- { title: '家庭服务', icon: 'el-icon-s-custom', perm: 'service:*',
- children: [
- { path: '/my-families', label: '我的家庭', icon: 'el-icon-s-custom', perm: 'service:family' },
- { path: '/teacher-team', label: '我的团队', icon: 'el-icon-s-custom', perm: 'service:team' },
- ]},
- { title: '业务管理', icon: 'el-icon-s-marketing', perm: 'biz:*',
- children: [
- { path: '/teacher-packages', label: '套餐管理', icon: 'el-icon-s-goods', perm: 'biz:packages' },
- { path: '/teacher-orders', label: '订单佣金', icon: 'el-icon-s-order', perm: 'biz:orders' },
- ]},
- { title: '测评咨询', icon: 'el-icon-edit', perm: 'assessment:*',
- children: [
- { path: '/teacher-assessment', label: 'DAN测评', icon: 'el-icon-edit', perm: 'assessment:dan' },
- { path: '/teacher-consult', label: '家长咨询', icon: 'el-icon-chat-dot-round', perm: 'assessment:consult' },
- { path: '/growth-records', label: '成长记录', icon: 'el-icon-document', perm: 'growth:records' },
- { path: '/growth-plans', label: '成长计划', icon: 'el-icon-document', perm: 'growth:plans' },
- ]},
- // ===== 9. 系统配置 (admin) =====
- { title: '系统配置', icon: 'el-icon-s-tools', perm: 'system:*',
- children: [
- // --- 基础管理 ---
- { title: '基础管理', icon: 'el-icon-s-tools', perm: 'system:config',
- children: [
- { path: '/sys-config', label: '系统配置', icon: 'el-icon-s-tools', perm: 'system:config' },
- { path: '/users', label: '用户管理', icon: 'el-icon-user', perm: 'system:users' },
- { path: '/operation-logs', label: '操作日志', icon: 'el-icon-s-order', perm: 'system:logs' },
- { path: '/membership-center', label: '会员中心', icon: 'el-icon-s-custom', perm: 'system:config' },
- ]},
- // --- 配置中心 ---
- { title: '配置中心', icon: 'el-icon-setting', perm: 'system:config',
- children: [
- { path: '/dimension-config', label: '维度配置', icon: 'el-icon-data-line', perm: 'system:config' },
- { path: '/relationship-types', label: '关系类型', icon: 'el-icon-share', perm: 'system:config' },
- { path: '/service-types', label: '服务类型', icon: 'el-icon-s-management', perm: 'system:config' },
- { path: '/service-contents', label: '服务内容', icon: 'el-icon-s-management', perm: 'system:config' },
- { path: '/package-templates', label: '套餐模板', icon: 'el-icon-s-management', perm: 'system:config' },
- ]},
- // --- 教育体系 ---
- { title: '教育体系', icon: 'el-icon-s-management', perm: 'system:education',
- children: [
- { path: '/education-systems', label: '教育体系', icon: 'el-icon-s-management', perm: 'system:education' },
- ]},
- // --- 供应商体系 ---
- { title: '供应商体系', icon: 'el-icon-s-management', perm: 'system:supply',
- children: [
- { path: '/supply-system', label: '供应商体系', icon: 'el-icon-s-management', perm: 'system:supply' },
- ]},
- // --- 供应商管理 (supplier_admin) ---
- { title: '供应商管理', icon: 'el-icon-s-shop', perm: 'supply:manage',
- children: [
- { path: '/supply-manage', label: '供应商管理', icon: 'el-icon-s-shop', perm: 'supply:manage' },
- ]},
- // --- 健康配置 ---
- { title: '健康配置', icon: 'el-icon-first-aid-kit', perm: 'system:config',
- children: [
- { path: '/health-norm-config', label: '健康常模', icon: 'el-icon-data-line', perm: 'system:config' },
- { path: '/health-data-source', label: '健康数据源', icon: 'el-icon-data-line', perm: 'system:config' },
- { path: '/health-energy-config', label: '七维能量配置', icon: 'el-icon-data-line', perm: 'system:config' },
- ]},
- // --- 人生维度 ---
- { title: '人生维度', icon: 'el-icon-s-custom', perm: 'system:config',
- children: [
- { path: '/zodiac-configs', label: '星座配置', icon: 'el-icon-s-management', perm: 'system:config' },
- { path: '/bazi-configs', label: '八字配置', icon: 'el-icon-s-management', perm: 'system:config' },
- { path: '/blood-type-configs', label: '血型配置', icon: 'el-icon-s-management', perm: 'system:config' },
- ]},
- // --- 测评管理 ---
- { title: '测评管理', icon: 'el-icon-edit', perm: 'assessment:dan',
- children: [
- { path: '/assessment-admin', label: '测评管理', icon: 'el-icon-edit', perm: 'assessment:dan' },
- ]},
- // --- 虚拟团队 ---
- { title: '虚拟团队', icon: 'el-icon-s-custom', perm: 'system:config',
- children: [
- { path: '/virtual-teams', label: '虚拟团队', icon: 'el-icon-s-custom', perm: 'system:config' },
- ]},
- ]},
- ],
- profileDialogVisible: false,
- passwordDialogVisible: false,
- submitting: false,
- profileForm: {
- nickname: '',
- phone: '',
- email: '',
- username: '',
- realName: ''
- },
- passwordForm: {
- oldPassword: '',
- newPassword: '',
- confirmPassword: ''
- },
- inviteCodeVisible: false,
- inviteCodeLoading: false,
- inviteCodeData: null,
- unreadMessageCount: 0,
- passwordRules: {
- oldPassword: [
- { required: true, message: '请输入原密码', trigger: 'blur' }
- ],
- newPassword: [
- { required: true, message: '请输入新密码', trigger: 'blur' },
- { min: 6, message: '密码长度不能少于6位', trigger: 'blur' }
- ],
- confirmPassword: [
- { required: true, message: '请确认新密码', trigger: 'blur' },
- {
- validator: (rule, value, callback) => {
- if (value !== this.passwordForm.newPassword) {
- callback(new Error('两次输入密码不一致'))
- } else {
- callback()
- }
- },
- trigger: 'blur'
- }
- ]
- }
- }
- },
- computed: {
- activeMenu() {
- return this.$route.path
- },
- currentRole() {
- return localStorage.getItem('role') || 'admin'
- },
- vendorType() {
- return localStorage.getItem('vendorType') || ''
- },
- effectivePerms() {
- const rolesStr = localStorage.getItem('roles')
- const roles = rolesStr ? JSON.parse(rolesStr) : [this.currentRole]
- return getEffectivePermissions(roles)
- },
- displayRoles() {
- const rolesStr = localStorage.getItem('roles')
- const roles = rolesStr ? JSON.parse(rolesStr) : [this.currentRole]
- return roles.map(function(r) { return getRoleLabel(r) }).join(' / ')
- },
- displayUserLabel() {
- const adminName = localStorage.getItem('adminName')
- if (adminName) {
- return adminName + ' (' + this.displayRoles + ')'
- }
- return this.displayRoles
- }
- },
- mounted() {
- // 清除可能的 beforeunload 处理,防止页面刷新弹出"离开网站?"提示
- window.onbeforeunload = null
- // 有消息权限(老师/营养师角色)才加载未读数,管理员不调用
- if (hasPermission(this.effectivePerms, 'messages') && this.currentRole !== 'admin') {
- this.fetchUnreadCount()
- }
- },
- methods: {
- hasPerm(required) {
- return hasPermission(this.effectivePerms, required)
- },
- getMenuIndex(item) {
- return item.path === '/dashboard' && this.currentRole === 'teacher'
- ? '/teacher-dashboard'
- : item.path
- },
- handleMenuSelect(index) {
- if (index && index.startsWith('/')) {
- this.$router.push(index)
- }
- },
- handleProfileCommand(command) {
- if (command === 'profile') {
- this.loadAdminInfo()
- this.profileDialogVisible = true
- } else if (command === 'password') {
- this.passwordForm = { oldPassword: '', newPassword: '', confirmPassword: '' }
- this.passwordDialogVisible = true
- } else if (command === 'logout') {
- this.handleLogout()
- }
- },
- async loadAdminInfo() {
- try {
- const res = await getAdminInfo()
- this.profileForm = {
- nickname: res.data.nickname || '',
- phone: res.data.phone || '',
- email: res.data.email || '',
- username: res.data.username || '',
- realName: res.data.realName || ''
- }
- } catch (e) {
- this.$message.error('加载个人信息失败')
- }
- },
- async confirmUpdateInfo() {
- this.submitting = true
- try {
- await updateAdminInfo({
- nickname: this.profileForm.nickname,
- phone: this.profileForm.phone,
- email: this.profileForm.email
- })
- if (this.profileForm.nickname) {
- localStorage.setItem('adminName', this.profileForm.nickname)
- }
- this.$message.success('保存成功')
- this.profileDialogVisible = false
- } catch (e) {
- this.$message.error(e.message || '保存失败')
- } finally {
- this.submitting = false
- }
- },
- async confirmChangePassword() {
- this.$refs.passwordForm.validate(async (valid) => {
- if (!valid) return
- this.submitting = true
- try {
- await changePassword({
- oldPassword: this.passwordForm.oldPassword,
- newPassword: this.passwordForm.newPassword
- })
- this.$message.success('密码修改成功')
- this.passwordDialogVisible = false
- } catch (e) {
- this.$message.error(e.message || '密码修改失败')
- } finally {
- this.submitting = false
- }
- })
- },
- async showInviteCode() {
- this.inviteCodeVisible = true
- this.inviteCodeLoading = true
- this.inviteCodeData = null
- try {
- const res = await getMyInviteCode()
- if (res.data) {
- this.inviteCodeData = res.data
- }
- } catch (e) {
- this.$message.error('获取邀请码失败')
- } finally {
- this.inviteCodeLoading = false
- }
- },
- async generateInviteCode() {
- this.inviteCodeLoading = true
- try {
- const res = await getMyInviteCode()
- if (res.data) {
- this.inviteCodeData = res.data
- this.$message.success('邀请码已生成')
- }
- } catch (e) {
- this.$message.error('生成邀请码失败')
- } finally {
- this.inviteCodeLoading = false
- }
- },
- copyCode(code) {
- if (!code) return
- const input = document.createElement('input')
- input.value = code
- document.body.appendChild(input)
- input.select()
- document.execCommand('copy')
- document.body.removeChild(input)
- this.$message.success('已复制邀请码')
- },
- async fetchUnreadCount() {
- try {
- const res = await getUnreadMessageCount()
- if (res.data !== undefined) {
- this.unreadMessageCount = res.data || 0
- }
- } catch (e) {
- // silent: not critical
- }
- },
- handleMessageClick() {
- this.$router.push('/teacher-messages')
- },
- handleLogout() {
- // 不使用 modal 遮罩(全局 .v-modal { display:none } 会与 $confirm 的遮罩冲突)
- this.$confirm('确定要退出登录吗?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- modal: false,
- customClass: 'cfc-logout-confirm'
- }).then(() => {
- localStorage.removeItem('token')
- localStorage.removeItem('role')
- localStorage.removeItem('roles')
- localStorage.removeItem('adminId')
- localStorage.removeItem('adminName')
- this.$router.push('/login')
- })
- }
- }
- }
- </script>
- <style>
- /* 全局防御:防止 Element UI 弹窗或组件残留 DOM 产生遮罩覆盖 */
- .v-modal {
- display: none !important;
- }
- .layout-container {
- height: 100vh;
- }
- .el-aside {
- background-color: #304156;
- overflow: visible;
- display: flex;
- flex-direction: column;
- }
- .logo {
- height: 60px;
- line-height: 60px;
- text-align: center;
- color: #fff;
- font-size: 20px;
- font-weight: bold;
- background-color: #2b3a4a;
- flex-shrink: 0;
- }
- /* 侧边栏滚动条样式 */
- .sidebar-scrollbar-wrap {
- height: calc(100vh - 60px) !important;
- overflow-x: hidden !important;
- overflow-y: auto !important;
- }
- .sidebar-scrollbar-wrap .el-scrollbar__view {
- height: 100%;
- }
- .sidebar-scrollbar-wrap::-webkit-scrollbar {
- width: 6px;
- }
- .sidebar-scrollbar-wrap::-webkit-scrollbar-track {
- background: #304156;
- }
- .sidebar-scrollbar-wrap::-webkit-scrollbar-thumb {
- background: #4a5568;
- border-radius: 3px;
- }
- .sidebar-scrollbar-wrap::-webkit-scrollbar-thumb:hover {
- background: #5a6578;
- }
- .el-header {
- background-color: #fff;
- box-shadow: 0 1px 4px rgba(0,21,41,.08);
- display: flex;
- justify-content: flex-end;
- align-items: center;
- padding: 0 20px;
- }
- .header-right {
- display: flex;
- align-items: center;
- gap: 12px;
- }
- .username {
- margin-right: 20px;
- color: #606266;
- }
- .invite-code-btn {
- color: #6366F1;
- font-size: 13px;
- }
- .invite-code-btn:hover {
- color: #4F46E5;
- }
- .msg-badge {
- margin-right: 4px;
- }
- .msg-badge .el-badge__content.is-fixed {
- top: 10px;
- right: 6px;
- }
- .msg-btn {
- font-size: 18px;
- color: #606266;
- padding: 4px;
- }
- .msg-btn:hover {
- color: #6366F1;
- }
- .invite-code-content {
- padding: 8px 0;
- }
- .invite-code-section {
- background: #F8FAFC;
- border: 1px solid #E2E8F0;
- border-radius: 8px;
- padding: 20px;
- text-align: center;
- }
- .invite-code-label {
- font-size: 14px;
- color: #64748B;
- margin-bottom: 12px;
- }
- .invite-code-value {
- display: flex;
- align-items: center;
- justify-content: center;
- gap: 12px;
- margin-bottom: 8px;
- }
- .code-text {
- font-size: 28px;
- font-weight: 700;
- letter-spacing: 6px;
- color: #1E293B;
- font-family: monospace;
- }
- .no-invite-code {
- text-align: center;
- padding: 24px;
- color: #94A3B8;
- }
- .no-invite-code i {
- font-size: 48px;
- margin-bottom: 12px;
- }
- .no-invite-code p {
- margin-bottom: 16px;
- }
- .el-main {
- background-color: #f0f2f5;
- padding: 20px;
- position: relative;
- z-index: 1;
- display: flex;
- flex-direction: column;
- min-height: 0; /* flexbox overflow fix */
- }
- .main-wrapper {
- flex: 1;
- display: flex;
- flex-direction: column;
- min-height: 0;
- overflow-y: auto;
- overflow-x: hidden;
- }
- /* ========== 全局 .admin-page 样式 ========== */
- /* 所有后台维护页面根元素使用此 class,使页面内容充满可视区 */
- .admin-page {
- flex: 1;
- display: flex;
- flex-direction: column;
- min-height: 0;
- }
- /* 当 admin-page 的直接子元素是 el-card 时让卡片自动填充 */
- .admin-page > .el-card {
- flex: 1;
- display: flex;
- flex-direction: column;
- min-height: 0;
- }
- .admin-page > .el-card .el-card__body {
- flex: 1;
- display: flex;
- flex-direction: column;
- min-height: 0;
- padding: 20px;
- overflow-y: auto;
- }
- /* 当 admin-page > div > el-card(如 ArticleManage 的嵌套 div) */
- .admin-page > div:only-child {
- flex: 1;
- display: flex;
- flex-direction: column;
- min-height: 0;
- }
- .admin-page > div:only-child > .el-card {
- flex: 1;
- display: flex;
- flex-direction: column;
- min-height: 0;
- }
- .admin-page > div:only-child > .el-card .el-card__body {
- flex: 1;
- display: flex;
- flex-direction: column;
- min-height: 0;
- padding: 20px;
- overflow-y: auto;
- }
- </style>
|