Edan233 commited on
Commit
d11736a
·
1 Parent(s): b56f85a

fix: 修改首页内容

Browse files
Files changed (1) hide show
  1. sau_frontend/src/App.vue +174 -300
sau_frontend/src/App.vue CHANGED
@@ -1,327 +1,201 @@
1
  <template>
2
- <div class="main-layout">
3
- <!-- 顶部导航栏 -->
4
- <header class="header">
5
- <div class="logo">
6
- <img src="@/assets/logo.svg" alt="Logo" class="logo-img" />
7
- <span>SAU自媒体自动化运营系统</span>
8
- </div>
9
- <div class="header-tabs">
10
- <!-- <div class="tab-item" v-for="tab in tabs" :key="tab.id">{{ tab.name }}</div> -->
11
- </div>
12
- <!-- <div class="user-info">
13
- <button class="btn-upgrade" @click="showLoginModal">登录</button>
14
- <div class="avatar">
15
- <img src="@/assets/tudong.jpg" alt="Avatar" />
16
- </div>
17
- </div> -->
18
- <LoginModal :visible="isLoginModalVisible" @close="closeLoginModal" @login-success="handleLoginSuccess" />
19
- </header>
20
-
21
- <!-- 主体内容区 -->
22
- <div class="content-container">
23
- <!-- 左侧导航栏 -->
24
- <aside class="sidebar">
25
- <nav>
26
- <!-- 静态路由 -->
27
- <router-link
28
- v-for="route in staticRoutes"
29
- :key="route.path"
30
- :to="route.path"
31
- class="nav-item"
32
- active-class="active"
33
- >
34
- <i :class="route.meta.icon"></i>
35
- <span>{{ route.meta.title }}</span>
36
- </router-link>
37
-
38
- <!-- 动态视频发布路由 -->
39
- <div
40
- v-for="route in videoRoutes"
41
- :key="route.id"
42
- class="nav-item-with-close"
43
  >
44
- <router-link
45
- :to="`/video-publish/${route.id}`"
46
- class="nav-item"
47
- active-class="active"
48
- >
49
- <i class="icon-video"></i>
50
- <span>{{ route.meta.title }}</span>
51
- </router-link>
52
- <button
53
- class="close-btn"
54
- @click="handleRemoveVideoRoute(route.id)"
55
- title="删除路由"
56
- >×</button>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  </div>
58
- </nav>
59
- </aside>
60
-
61
- <!-- 右侧内容区 -->
62
- <main class="main-content">
63
- <router-view></router-view>
64
- </main>
65
- </div>
66
  </div>
67
  </template>
68
 
69
  <script setup>
70
- import { computed, ref, watch } from 'vue';
71
- import { useRouter } from 'vue-router';
72
- import LoginModal from '@/components/LoginModal.vue';
73
- import { videoRoutes, removeVideoRoute } from '@/router';
 
 
74
 
75
- const router = useRouter();
76
 
77
- // 静态路由
78
- const staticRoutes = computed(() => router.options.routes.filter(route => route.meta?.title));
79
-
80
- // 动态视频发布路由已从router导入
81
-
82
- // 监听视频路由变化,动态添加/删除路由
83
- watch(videoRoutes, (newRoutes) => {
84
- // 确保路由已添加到router中
85
- newRoutes.forEach(route => {
86
- if (!router.hasRoute(route.name)) {
87
- router.addRoute(route);
88
- }
89
- });
90
- }, { immediate: true });
91
-
92
- // 删除视频发布路由
93
- const handleRemoveVideoRoute = (id) => {
94
- const route = videoRoutes.value.find(r => r.id === id);
95
- if (route && router.currentRoute.value.path === route.path) {
96
- // 如果当前在要删除的路由页面,先跳转到其他页面
97
- router.push('/publish');
98
- }
99
- // 调用router中的removeVideoRoute函数
100
- removeVideoRoute(id);
101
- };
102
 
103
- // 登录模态窗口控制
104
- const isLoginModalVisible = ref(false);
105
 
106
- const showLoginModal = () => {
107
- isLoginModalVisible.value = true;
108
- };
109
-
110
- const closeLoginModal = () => {
111
- isLoginModalVisible.value = false;
112
- };
113
-
114
- const handleLoginSuccess = (userData) => {
115
- console.log('用户登录成功:', userData);
116
- // 这里可以添加登录成功后的逻辑,比如更新用户状态等
117
- };
118
-
119
- const tabs = [
120
- { id: 1, name: '抖音' },
121
- { id: 2, name: '小红书' },
122
- { id: 3, name: '微信视频号' },
123
- { id: 4, name: '快手' },
124
- { id: 5, name: '视频号小店' },
125
- { id: 6, name: 'TikTok' }
126
- ];
127
  </script>
128
 
129
- <style>
130
- * {
131
- margin: 0;
132
- padding: 0;
133
- box-sizing: border-box;
134
- }
135
 
136
- body {
137
- font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
138
- color: #333;
139
- background-color: #f5f7fa;
140
  }
141
 
142
- .main-layout {
143
- display: flex;
144
- flex-direction: column;
145
  height: 100vh;
146
  }
147
 
148
- .header {
149
- height: 60px;
150
- background-color: #fff;
151
- border-bottom: 1px solid #eee;
152
- display: flex;
153
- align-items: center;
154
- padding: 0 20px;
155
- box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
156
- }
157
-
158
- .logo {
159
- display: flex;
160
- align-items: center;
161
- font-weight: bold;
162
- font-size: 18px;
163
- margin-right: 40px;
164
- }
165
-
166
- .logo-img {
167
- width: 30px;
168
- height: 30px;
169
- margin-right: 10px;
170
- }
171
-
172
- .header-tabs {
173
- display: flex;
174
- flex: 1;
175
- }
176
-
177
- .tab-item {
178
- padding: 0 15px;
179
- cursor: pointer;
180
- height: 60px;
181
- display: flex;
182
- align-items: center;
183
- }
184
-
185
- .tab-item:hover {
186
- color: #4e6ef2;
187
- }
188
-
189
- .user-info {
190
- display: flex;
191
- align-items: center;
192
- }
193
-
194
- .btn-upgrade {
195
- background-color: #f0f2ff;
196
- color: #4e6ef2;
197
- border: none;
198
- padding: 6px 12px;
199
- border-radius: 4px;
200
- margin-right: 15px;
201
- cursor: pointer;
202
- transition: background-color 0.3s;
203
- }
204
-
205
- .btn-upgrade:hover {
206
- background-color: #e0e5ff;
207
- }
208
-
209
- .avatar {
210
- width: 36px;
211
- height: 36px;
212
- border-radius: 50%;
213
- overflow: hidden;
214
- }
215
-
216
- .avatar img {
217
- width: 100%;
218
- height: 100%;
219
- object-fit: cover;
220
- }
221
-
222
- .content-container {
223
- display: flex;
224
- flex: 1;
225
  overflow: hidden;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
226
  }
227
 
228
- .sidebar {
229
- width: 200px;
230
- background-color: #f8f9fc;
231
- border-right: 1px solid #eee;
232
- padding: 20px 0;
233
- }
234
-
235
- .nav-item {
236
- display: flex;
237
- align-items: center;
238
- padding: 12px 20px;
239
- color: #333;
240
- text-decoration: none;
241
- margin-bottom: 5px;
242
- }
243
-
244
- .nav-item i {
245
- margin-right: 10px;
246
- font-size: 18px;
247
- }
248
-
249
- /* 图标样式 */
250
- .icon-account, .icon-publish, .icon-website, .icon-data, .icon-video, .icon-multi-publish, .icon-material {
251
- display: inline-block;
252
- width: 18px;
253
- height: 18px;
254
- position: relative;
255
- }
256
-
257
- .icon-multi-publish::before {
258
- content: '';
259
- position: absolute;
260
- width: 12px;
261
- height: 12px;
262
- background-color: #8b5cf6;
263
- border-radius: 50%;
264
- top: 3px;
265
- left: 3px;
266
- }
267
-
268
- .icon-material::before {
269
- content: '';
270
- position: absolute;
271
- width: 12px;
272
- height: 12px;
273
- background-color: #10b981;
274
- border-radius: 50%;
275
- top: 3px;
276
- left: 3px;
277
- }
278
-
279
- .nav-item.active {
280
- background-color: #e6f7ff;
281
- color: #4e6ef2;
282
- border-right: 3px solid #4e6ef2;
283
- }
284
-
285
- /* 带关闭按钮的导航项 */
286
- .nav-item-with-close {
287
- position: relative;
288
- display: flex;
289
- align-items: center;
290
- margin-bottom: 5px;
291
- }
292
-
293
- .nav-item-with-close .nav-item {
294
- flex: 1;
295
- margin-bottom: 0;
296
- }
297
-
298
- .close-btn {
299
- position: absolute;
300
- right: 10px;
301
- background: none;
302
- border: none;
303
- color: #999;
304
- font-size: 16px;
305
- cursor: pointer;
306
- display: none;
307
- width: 20px;
308
- height: 20px;
309
- line-height: 18px;
310
- text-align: center;
311
- border-radius: 50%;
312
- }
313
-
314
- .close-btn:hover {
315
- background-color: rgba(0, 0, 0, 0.1);
316
- color: #666;
317
- }
318
-
319
- .nav-item-with-close:hover .close-btn {
320
- display: block;
321
  }
322
 
323
- .main-content {
324
- flex: 1;
325
  padding: 20px;
326
  overflow-y: auto;
327
  }
 
1
  <template>
2
+ <div id="app">
3
+ <el-container>
4
+ <el-aside :width="isCollapse ? '64px' : '200px'">
5
+ <div class="sidebar">
6
+ <div class="logo">
7
+ <img v-show="isCollapse" src="/vite.svg" alt="Logo" class="logo-img">
8
+ <h2 v-show="!isCollapse">自媒体自动化运营系统</h2>
9
+ </div>
10
+ <el-menu
11
+ :router="true"
12
+ :default-active="activeMenu"
13
+ :collapse="isCollapse"
14
+ class="sidebar-menu"
15
+ background-color="#001529"
16
+ text-color="#fff"
17
+ active-text-color="#409EFF"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  >
19
+ <el-menu-item index="/">
20
+ <el-icon><HomeFilled /></el-icon>
21
+ <span>首页</span>
22
+ </el-menu-item>
23
+ <el-menu-item index="/account-management">
24
+ <el-icon><User /></el-icon>
25
+ <span>账号管理</span>
26
+ </el-menu-item>
27
+ <el-menu-item index="/material-management">
28
+ <el-icon><Picture /></el-icon>
29
+ <span>素材管理</span>
30
+ </el-menu-item>
31
+ <el-menu-item index="/publish-center">
32
+ <el-icon><Upload /></el-icon>
33
+ <span>发布中心</span>
34
+ </el-menu-item>
35
+ <el-menu-item index="/website">
36
+ <el-icon><Monitor /></el-icon>
37
+ <span>网站</span>
38
+ </el-menu-item>
39
+ <el-menu-item index="/data">
40
+ <el-icon><DataAnalysis /></el-icon>
41
+ <span>数据</span>
42
+ </el-menu-item>
43
+ </el-menu>
44
+ </div>
45
+ </el-aside>
46
+ <el-container>
47
+ <el-header>
48
+ <div class="header-content">
49
+ <div class="header-left">
50
+ <el-icon class="toggle-sidebar" @click="toggleSidebar"><Fold /></el-icon>
51
+ </div>
52
+ <div class="header-right">
53
+ <!-- 账号信息已移除 -->
54
+ </div>
55
  </div>
56
+ </el-header>
57
+ <el-main>
58
+ <router-view />
59
+ </el-main>
60
+ </el-container>
61
+ </el-container>
 
 
62
  </div>
63
  </template>
64
 
65
  <script setup>
66
+ import { ref, computed } from 'vue'
67
+ import { useRoute } from 'vue-router'
68
+ import {
69
+ HomeFilled, User, Monitor, DataAnalysis,
70
+ Fold, Picture, Upload
71
+ } from '@element-plus/icons-vue'
72
 
73
+ const route = useRoute()
74
 
75
+ // 当前激活的菜单项
76
+ const activeMenu = computed(() => {
77
+ return route.path
78
+ })
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
 
80
+ // 侧边栏折叠状态
81
+ const isCollapse = ref(false)
82
 
83
+ // 切换侧边栏折叠状态
84
+ const toggleSidebar = () => {
85
+ isCollapse.value = !isCollapse.value
86
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  </script>
88
 
89
+ <style lang="scss" scoped>
90
+ @use '@/styles/variables.scss' as *;
 
 
 
 
91
 
92
+ #app {
93
+ min-height: 100vh;
 
 
94
  }
95
 
96
+ .el-container {
 
 
97
  height: 100vh;
98
  }
99
 
100
+ .el-aside {
101
+ background-color: #001529;
102
+ color: #fff;
103
+ height: 100vh;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
  overflow: hidden;
105
+ transition: width 0.3s;
106
+
107
+ .sidebar {
108
+ display: flex;
109
+ flex-direction: column;
110
+ height: 100%;
111
+
112
+ .logo {
113
+ height: 60px;
114
+ padding: 0 16px;
115
+ display: flex;
116
+ align-items: center;
117
+ background-color: #002140;
118
+ overflow: hidden;
119
+
120
+ .logo-img {
121
+ width: 32px;
122
+ height: 32px;
123
+ margin-right: 12px;
124
+ }
125
+
126
+ h2 {
127
+ color: #fff;
128
+ font-size: 16px;
129
+ font-weight: 600;
130
+ white-space: nowrap;
131
+ margin: 0;
132
+ }
133
+ }
134
+
135
+ .sidebar-menu {
136
+ border-right: none;
137
+ flex: 1;
138
+
139
+ .el-menu-item {
140
+ display: flex;
141
+ align-items: center;
142
+
143
+ .el-icon {
144
+ margin-right: 10px;
145
+ font-size: 18px;
146
+ }
147
+ }
148
+ }
149
+ }
150
  }
151
 
152
+ .el-header {
153
+ background-color: #fff;
154
+ box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
155
+ padding: 0;
156
+ height: 60px;
157
+
158
+ .header-content {
159
+ display: flex;
160
+ justify-content: space-between;
161
+ align-items: center;
162
+ height: 100%;
163
+ padding: 0 16px;
164
+
165
+ .header-left {
166
+ .toggle-sidebar {
167
+ font-size: 20px;
168
+ cursor: pointer;
169
+ color: $text-regular;
170
+
171
+ &:hover {
172
+ color: $primary-color;
173
+ }
174
+ }
175
+ }
176
+
177
+ .header-right {
178
+ .user-dropdown {
179
+ display: flex;
180
+ align-items: center;
181
+ cursor: pointer;
182
+
183
+ .username {
184
+ margin: 0 8px;
185
+ color: $text-regular;
186
+ }
187
+
188
+ .el-icon {
189
+ font-size: 12px;
190
+ color: $text-secondary;
191
+ }
192
+ }
193
+ }
194
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
195
  }
196
 
197
+ .el-main {
198
+ background-color: $bg-color-page;
199
  padding: 20px;
200
  overflow-y: auto;
201
  }