fix: 修改首页内容
This commit is contained in:
+177
-303
@@ -1,327 +1,201 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="main-layout">
|
<div id="app">
|
||||||
<!-- 顶部导航栏 -->
|
<el-container>
|
||||||
<header class="header">
|
<el-aside :width="isCollapse ? '64px' : '200px'">
|
||||||
<div class="logo">
|
<div class="sidebar">
|
||||||
<img src="@/assets/logo.svg" alt="Logo" class="logo-img" />
|
<div class="logo">
|
||||||
<span>SAU自媒体自动化运营系统</span>
|
<img v-show="isCollapse" src="/vite.svg" alt="Logo" class="logo-img">
|
||||||
</div>
|
<h2 v-show="!isCollapse">自媒体自动化运营系统</h2>
|
||||||
<div class="header-tabs">
|
|
||||||
<!-- <div class="tab-item" v-for="tab in tabs" :key="tab.id">{{ tab.name }}</div> -->
|
|
||||||
</div>
|
|
||||||
<!-- <div class="user-info">
|
|
||||||
<button class="btn-upgrade" @click="showLoginModal">登录</button>
|
|
||||||
<div class="avatar">
|
|
||||||
<img src="@/assets/tudong.jpg" alt="Avatar" />
|
|
||||||
</div>
|
|
||||||
</div> -->
|
|
||||||
<LoginModal :visible="isLoginModalVisible" @close="closeLoginModal" @login-success="handleLoginSuccess" />
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<!-- 主体内容区 -->
|
|
||||||
<div class="content-container">
|
|
||||||
<!-- 左侧导航栏 -->
|
|
||||||
<aside class="sidebar">
|
|
||||||
<nav>
|
|
||||||
<!-- 静态路由 -->
|
|
||||||
<router-link
|
|
||||||
v-for="route in staticRoutes"
|
|
||||||
:key="route.path"
|
|
||||||
:to="route.path"
|
|
||||||
class="nav-item"
|
|
||||||
active-class="active"
|
|
||||||
>
|
|
||||||
<i :class="route.meta.icon"></i>
|
|
||||||
<span>{{ route.meta.title }}</span>
|
|
||||||
</router-link>
|
|
||||||
|
|
||||||
<!-- 动态视频发布路由 -->
|
|
||||||
<div
|
|
||||||
v-for="route in videoRoutes"
|
|
||||||
:key="route.id"
|
|
||||||
class="nav-item-with-close"
|
|
||||||
>
|
|
||||||
<router-link
|
|
||||||
:to="`/video-publish/${route.id}`"
|
|
||||||
class="nav-item"
|
|
||||||
active-class="active"
|
|
||||||
>
|
|
||||||
<i class="icon-video"></i>
|
|
||||||
<span>{{ route.meta.title }}</span>
|
|
||||||
</router-link>
|
|
||||||
<button
|
|
||||||
class="close-btn"
|
|
||||||
@click="handleRemoveVideoRoute(route.id)"
|
|
||||||
title="删除路由"
|
|
||||||
>×</button>
|
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
<el-menu
|
||||||
</aside>
|
:router="true"
|
||||||
|
:default-active="activeMenu"
|
||||||
<!-- 右侧内容区 -->
|
:collapse="isCollapse"
|
||||||
<main class="main-content">
|
class="sidebar-menu"
|
||||||
<router-view></router-view>
|
background-color="#001529"
|
||||||
</main>
|
text-color="#fff"
|
||||||
</div>
|
active-text-color="#409EFF"
|
||||||
|
>
|
||||||
|
<el-menu-item index="/">
|
||||||
|
<el-icon><HomeFilled /></el-icon>
|
||||||
|
<span>首页</span>
|
||||||
|
</el-menu-item>
|
||||||
|
<el-menu-item index="/account-management">
|
||||||
|
<el-icon><User /></el-icon>
|
||||||
|
<span>账号管理</span>
|
||||||
|
</el-menu-item>
|
||||||
|
<el-menu-item index="/material-management">
|
||||||
|
<el-icon><Picture /></el-icon>
|
||||||
|
<span>素材管理</span>
|
||||||
|
</el-menu-item>
|
||||||
|
<el-menu-item index="/publish-center">
|
||||||
|
<el-icon><Upload /></el-icon>
|
||||||
|
<span>发布中心</span>
|
||||||
|
</el-menu-item>
|
||||||
|
<el-menu-item index="/website">
|
||||||
|
<el-icon><Monitor /></el-icon>
|
||||||
|
<span>网站</span>
|
||||||
|
</el-menu-item>
|
||||||
|
<el-menu-item index="/data">
|
||||||
|
<el-icon><DataAnalysis /></el-icon>
|
||||||
|
<span>数据</span>
|
||||||
|
</el-menu-item>
|
||||||
|
</el-menu>
|
||||||
|
</div>
|
||||||
|
</el-aside>
|
||||||
|
<el-container>
|
||||||
|
<el-header>
|
||||||
|
<div class="header-content">
|
||||||
|
<div class="header-left">
|
||||||
|
<el-icon class="toggle-sidebar" @click="toggleSidebar"><Fold /></el-icon>
|
||||||
|
</div>
|
||||||
|
<div class="header-right">
|
||||||
|
<!-- 账号信息已移除 -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-header>
|
||||||
|
<el-main>
|
||||||
|
<router-view />
|
||||||
|
</el-main>
|
||||||
|
</el-container>
|
||||||
|
</el-container>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, ref, watch } from 'vue';
|
import { ref, computed } from 'vue'
|
||||||
import { useRouter } from 'vue-router';
|
import { useRoute } from 'vue-router'
|
||||||
import LoginModal from '@/components/LoginModal.vue';
|
import {
|
||||||
import { videoRoutes, removeVideoRoute } from '@/router';
|
HomeFilled, User, Monitor, DataAnalysis,
|
||||||
|
Fold, Picture, Upload
|
||||||
|
} from '@element-plus/icons-vue'
|
||||||
|
|
||||||
const router = useRouter();
|
const route = useRoute()
|
||||||
|
|
||||||
// 静态路由
|
// 当前激活的菜单项
|
||||||
const staticRoutes = computed(() => router.options.routes.filter(route => route.meta?.title));
|
const activeMenu = computed(() => {
|
||||||
|
return route.path
|
||||||
|
})
|
||||||
|
|
||||||
// 动态视频发布路由已从router导入
|
// 侧边栏折叠状态
|
||||||
|
const isCollapse = ref(false)
|
||||||
|
|
||||||
// 监听视频路由变化,动态添加/删除路由
|
// 切换侧边栏折叠状态
|
||||||
watch(videoRoutes, (newRoutes) => {
|
const toggleSidebar = () => {
|
||||||
// 确保路由已添加到router中
|
isCollapse.value = !isCollapse.value
|
||||||
newRoutes.forEach(route => {
|
}
|
||||||
if (!router.hasRoute(route.name)) {
|
|
||||||
router.addRoute(route);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}, { immediate: true });
|
|
||||||
|
|
||||||
// 删除视频发布路由
|
|
||||||
const handleRemoveVideoRoute = (id) => {
|
|
||||||
const route = videoRoutes.value.find(r => r.id === id);
|
|
||||||
if (route && router.currentRoute.value.path === route.path) {
|
|
||||||
// 如果当前在要删除的路由页面,先跳转到其他页面
|
|
||||||
router.push('/publish');
|
|
||||||
}
|
|
||||||
// 调用router中的removeVideoRoute函数
|
|
||||||
removeVideoRoute(id);
|
|
||||||
};
|
|
||||||
|
|
||||||
// 登录模态窗口控制
|
|
||||||
const isLoginModalVisible = ref(false);
|
|
||||||
|
|
||||||
const showLoginModal = () => {
|
|
||||||
isLoginModalVisible.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
const closeLoginModal = () => {
|
|
||||||
isLoginModalVisible.value = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleLoginSuccess = (userData) => {
|
|
||||||
console.log('用户登录成功:', userData);
|
|
||||||
// 这里可以添加登录成功后的逻辑,比如更新用户状态等
|
|
||||||
};
|
|
||||||
|
|
||||||
const tabs = [
|
|
||||||
{ id: 1, name: '抖音' },
|
|
||||||
{ id: 2, name: '小红书' },
|
|
||||||
{ id: 3, name: '微信视频号' },
|
|
||||||
{ id: 4, name: '快手' },
|
|
||||||
{ id: 5, name: '视频号小店' },
|
|
||||||
{ id: 6, name: 'TikTok' }
|
|
||||||
];
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style lang="scss" scoped>
|
||||||
* {
|
@use '@/styles/variables.scss' as *;
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
#app {
|
||||||
box-sizing: border-box;
|
min-height: 100vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
.el-container {
|
||||||
font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
|
|
||||||
color: #333;
|
|
||||||
background-color: #f5f7fa;
|
|
||||||
}
|
|
||||||
|
|
||||||
.main-layout {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header {
|
.el-aside {
|
||||||
height: 60px;
|
background-color: #001529;
|
||||||
|
color: #fff;
|
||||||
|
height: 100vh;
|
||||||
|
overflow: hidden;
|
||||||
|
transition: width 0.3s;
|
||||||
|
|
||||||
|
.sidebar {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
height: 100%;
|
||||||
|
|
||||||
|
.logo {
|
||||||
|
height: 60px;
|
||||||
|
padding: 0 16px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
background-color: #002140;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
.logo-img {
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
|
margin-right: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
color: #fff;
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 600;
|
||||||
|
white-space: nowrap;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-menu {
|
||||||
|
border-right: none;
|
||||||
|
flex: 1;
|
||||||
|
|
||||||
|
.el-menu-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
.el-icon {
|
||||||
|
margin-right: 10px;
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-header {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
border-bottom: 1px solid #eee;
|
box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
|
||||||
display: flex;
|
padding: 0;
|
||||||
align-items: center;
|
|
||||||
padding: 0 20px;
|
|
||||||
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
|
|
||||||
}
|
|
||||||
|
|
||||||
.logo {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
font-weight: bold;
|
|
||||||
font-size: 18px;
|
|
||||||
margin-right: 40px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.logo-img {
|
|
||||||
width: 30px;
|
|
||||||
height: 30px;
|
|
||||||
margin-right: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.header-tabs {
|
|
||||||
display: flex;
|
|
||||||
flex: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tab-item {
|
|
||||||
padding: 0 15px;
|
|
||||||
cursor: pointer;
|
|
||||||
height: 60px;
|
height: 60px;
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
.header-content {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
height: 100%;
|
||||||
|
padding: 0 16px;
|
||||||
|
|
||||||
|
.header-left {
|
||||||
|
.toggle-sidebar {
|
||||||
|
font-size: 20px;
|
||||||
|
cursor: pointer;
|
||||||
|
color: $text-regular;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
color: $primary-color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-right {
|
||||||
|
.user-dropdown {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
.username {
|
||||||
|
margin: 0 8px;
|
||||||
|
color: $text-regular;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-icon {
|
||||||
|
font-size: 12px;
|
||||||
|
color: $text-secondary;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab-item:hover {
|
.el-main {
|
||||||
color: #4e6ef2;
|
background-color: $bg-color-page;
|
||||||
}
|
|
||||||
|
|
||||||
.user-info {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-upgrade {
|
|
||||||
background-color: #f0f2ff;
|
|
||||||
color: #4e6ef2;
|
|
||||||
border: none;
|
|
||||||
padding: 6px 12px;
|
|
||||||
border-radius: 4px;
|
|
||||||
margin-right: 15px;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: background-color 0.3s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-upgrade:hover {
|
|
||||||
background-color: #e0e5ff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.avatar {
|
|
||||||
width: 36px;
|
|
||||||
height: 36px;
|
|
||||||
border-radius: 50%;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.avatar img {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
object-fit: cover;
|
|
||||||
}
|
|
||||||
|
|
||||||
.content-container {
|
|
||||||
display: flex;
|
|
||||||
flex: 1;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar {
|
|
||||||
width: 200px;
|
|
||||||
background-color: #f8f9fc;
|
|
||||||
border-right: 1px solid #eee;
|
|
||||||
padding: 20px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav-item {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
padding: 12px 20px;
|
|
||||||
color: #333;
|
|
||||||
text-decoration: none;
|
|
||||||
margin-bottom: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav-item i {
|
|
||||||
margin-right: 10px;
|
|
||||||
font-size: 18px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 图标样式 */
|
|
||||||
.icon-account, .icon-publish, .icon-website, .icon-data, .icon-video, .icon-multi-publish, .icon-material {
|
|
||||||
display: inline-block;
|
|
||||||
width: 18px;
|
|
||||||
height: 18px;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon-multi-publish::before {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
width: 12px;
|
|
||||||
height: 12px;
|
|
||||||
background-color: #8b5cf6;
|
|
||||||
border-radius: 50%;
|
|
||||||
top: 3px;
|
|
||||||
left: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon-material::before {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
width: 12px;
|
|
||||||
height: 12px;
|
|
||||||
background-color: #10b981;
|
|
||||||
border-radius: 50%;
|
|
||||||
top: 3px;
|
|
||||||
left: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav-item.active {
|
|
||||||
background-color: #e6f7ff;
|
|
||||||
color: #4e6ef2;
|
|
||||||
border-right: 3px solid #4e6ef2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 带关闭按钮的导航项 */
|
|
||||||
.nav-item-with-close {
|
|
||||||
position: relative;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
margin-bottom: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav-item-with-close .nav-item {
|
|
||||||
flex: 1;
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.close-btn {
|
|
||||||
position: absolute;
|
|
||||||
right: 10px;
|
|
||||||
background: none;
|
|
||||||
border: none;
|
|
||||||
color: #999;
|
|
||||||
font-size: 16px;
|
|
||||||
cursor: pointer;
|
|
||||||
display: none;
|
|
||||||
width: 20px;
|
|
||||||
height: 20px;
|
|
||||||
line-height: 18px;
|
|
||||||
text-align: center;
|
|
||||||
border-radius: 50%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.close-btn:hover {
|
|
||||||
background-color: rgba(0, 0, 0, 0.1);
|
|
||||||
color: #666;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav-item-with-close:hover .close-btn {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.main-content {
|
|
||||||
flex: 1;
|
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user