feat: 增加前端管理界面(第一版)
Browse files- sau_frontend/index.html +13 -0
- sau_frontend/package.json +22 -0
- sau_frontend/public/logo.svg +1 -0
- sau_frontend/src/App.vue +328 -0
- sau_frontend/src/assets/logo.svg +1 -0
- sau_frontend/src/components/AccountView.vue +548 -0
- sau_frontend/src/components/AddAccountModal.vue +362 -0
- sau_frontend/src/components/ArticlePublishView.vue +131 -0
- sau_frontend/src/components/DataView.vue +26 -0
- sau_frontend/src/components/LoginModal.vue +209 -0
- sau_frontend/src/components/MaterialLibraryView.vue +688 -0
- sau_frontend/src/components/MultiPublishView.vue +2303 -0
- sau_frontend/src/components/PublishView.vue +375 -0
- sau_frontend/src/components/VideoPublishView.vue +1759 -0
- sau_frontend/src/components/WebsiteView.vue +26 -0
- sau_frontend/src/components/layout/MainLayout.vue +245 -0
- sau_frontend/src/components/new_file.vue +8 -0
- sau_frontend/src/components/test.vue +70 -0
- sau_frontend/src/config.js +27 -0
- sau_frontend/src/main.js +11 -0
- sau_frontend/src/router/index.js +94 -0
- sau_frontend/vite.config.js +50 -0
sau_frontend/index.html
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<link rel="icon" href="/logo.svg">
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 7 |
+
<title>SAU自媒体自动化运营系统</title>
|
| 8 |
+
</head>
|
| 9 |
+
<body>
|
| 10 |
+
<div id="app"></div>
|
| 11 |
+
<script type="module" src="/src/main.js"></script>
|
| 12 |
+
</body>
|
| 13 |
+
</html>
|
sau_frontend/package.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "sau-frontend",
|
| 3 |
+
"version": "1.0.0",
|
| 4 |
+
"private": true,
|
| 5 |
+
"author": "Edan.Lee",
|
| 6 |
+
"scripts": {
|
| 7 |
+
"dev": "vite --host",
|
| 8 |
+
"build": "vite build",
|
| 9 |
+
"preview": "vite preview"
|
| 10 |
+
},
|
| 11 |
+
"dependencies": {
|
| 12 |
+
"axios": "^1.9.0",
|
| 13 |
+
"pinia": "^2.1.7",
|
| 14 |
+
"vue": "^3.3.4",
|
| 15 |
+
"vue-router": "^4.2.5"
|
| 16 |
+
},
|
| 17 |
+
"devDependencies": {
|
| 18 |
+
"@vitejs/plugin-vue": "^4.3.4",
|
| 19 |
+
"vite": "^4.4.9",
|
| 20 |
+
"vite-plugin-vue-devtools": "^7.7.6"
|
| 21 |
+
}
|
| 22 |
+
}
|
sau_frontend/public/logo.svg
ADDED
|
|
sau_frontend/src/App.vue
ADDED
|
@@ -0,0 +1,328 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
}
|
| 328 |
+
</style>
|
sau_frontend/src/assets/logo.svg
ADDED
|
|
sau_frontend/src/components/AccountView.vue
ADDED
|
@@ -0,0 +1,548 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<template>
|
| 2 |
+
<div class="account-view">
|
| 3 |
+
<h1>账号管理</h1>
|
| 4 |
+
<div class="account-container">
|
| 5 |
+
<!-- 平台选项卡 -->
|
| 6 |
+
<div class="platform-tabs">
|
| 7 |
+
<div v-for="platform in platforms" :key="platform.id" class="platform-tab"
|
| 8 |
+
:class="{ active: activePlatform === platform.id }" @click="activePlatform = platform.id">
|
| 9 |
+
{{ platform.name }}
|
| 10 |
+
</div>
|
| 11 |
+
</div>
|
| 12 |
+
|
| 13 |
+
<div class="filter-bar">
|
| 14 |
+
<div class="filter-item">
|
| 15 |
+
<select v-model="statusFilter">
|
| 16 |
+
<option value="">账号状态</option>
|
| 17 |
+
<option value="正常">正常</option>
|
| 18 |
+
<option value="异常">异常</option>
|
| 19 |
+
<!-- <option value="已封禁">已封禁</option> -->
|
| 20 |
+
</select>
|
| 21 |
+
</div>
|
| 22 |
+
<!-- <div class="filter-item">
|
| 23 |
+
<select>
|
| 24 |
+
<option>分组</option>
|
| 25 |
+
<option>默认分组</option>
|
| 26 |
+
<option>自媒体</option>
|
| 27 |
+
<option>电商</option>
|
| 28 |
+
</select>
|
| 29 |
+
</div> -->
|
| 30 |
+
<div class="search-box">
|
| 31 |
+
<input type="text" placeholder="输入账号名称搜索" v-model="searchQuery" />
|
| 32 |
+
<button><i class="search-icon"></i></button>
|
| 33 |
+
</div>
|
| 34 |
+
<button class="refresh-btn" @click="refreshAccounts" title="刷新账号列表">
|
| 35 |
+
<i class="refresh-icon"></i>
|
| 36 |
+
</button>
|
| 37 |
+
<button class="btn-add" @click="showAddAccountModal">添加账号</button>
|
| 38 |
+
</div>
|
| 39 |
+
|
| 40 |
+
<div class="account-list">
|
| 41 |
+
<!-- 加载状态 -->
|
| 42 |
+
<div v-if="isLoading" class="loading-state">
|
| 43 |
+
<div class="loading-spinner"></div>
|
| 44 |
+
<p>正在加载账号列表...</p>
|
| 45 |
+
</div>
|
| 46 |
+
|
| 47 |
+
<!-- 无数据提示 -->
|
| 48 |
+
<div v-else-if="filteredAccounts.length === 0" class="empty-state">
|
| 49 |
+
<p>暂无账号数据</p>
|
| 50 |
+
<button class="btn-add-small" @click="showAddAccountModal">添加账号</button>
|
| 51 |
+
</div>
|
| 52 |
+
|
| 53 |
+
<!-- 账号列表 -->
|
| 54 |
+
<div v-else v-for="account in filteredAccounts" :key="account.id" class="account-card">
|
| 55 |
+
<div class="account-avatar">
|
| 56 |
+
<img :src="account.avatar" alt="账号头像" />
|
| 57 |
+
</div>
|
| 58 |
+
<div class="account-info">
|
| 59 |
+
<div class="account-name">{{ account.name }}</div>
|
| 60 |
+
<div class="account-stats">
|
| 61 |
+
<div class="stat-item">
|
| 62 |
+
<span class="stat-label">粉丝</span>
|
| 63 |
+
<span class="stat-value">{{ account.followers }}</span>
|
| 64 |
+
</div>
|
| 65 |
+
<div class="stat-item">
|
| 66 |
+
<span class="stat-label">获赞</span>
|
| 67 |
+
<span class="stat-value">{{ account.likes }}</span>
|
| 68 |
+
</div>
|
| 69 |
+
<div class="stat-item">
|
| 70 |
+
<span class="stat-label">播放量</span>
|
| 71 |
+
<span class="stat-value">{{ account.views }}</span>
|
| 72 |
+
</div>
|
| 73 |
+
</div>
|
| 74 |
+
<div class="account-status" :class="'status-' + account.statusType">{{ account.status }}</div>
|
| 75 |
+
</div>
|
| 76 |
+
</div>
|
| 77 |
+
</div>
|
| 78 |
+
</div>
|
| 79 |
+
|
| 80 |
+
<!-- 添加账号模态窗口 -->
|
| 81 |
+
<AddAccountModal :visible="isAddAccountModalVisible" :platformId="activePlatform" @close="closeAddAccountModal"
|
| 82 |
+
@login="handleAccountLogin" @account-added="handleAccountAdded" />
|
| 83 |
+
</div>
|
| 84 |
+
</template>
|
| 85 |
+
|
| 86 |
+
<script setup>
|
| 87 |
+
import { ref, computed, onMounted, watch } from 'vue';
|
| 88 |
+
import AddAccountModal from './AddAccountModal.vue';
|
| 89 |
+
import { API_BASE_URL, globalAccountsCache } from '../config';
|
| 90 |
+
import axios from 'axios'
|
| 91 |
+
import tx from '@assets/fengbaobao.png'
|
| 92 |
+
|
| 93 |
+
// 平台数据
|
| 94 |
+
const platforms = [
|
| 95 |
+
{ id: 'douyin', name: '抖音' },
|
| 96 |
+
{ id: 'kuaishou', name: '快手' },
|
| 97 |
+
{ id: 'xiaohongshu', name: '小红书' },
|
| 98 |
+
{ id: 'shipinhao', name: '视频号' },
|
| 99 |
+
];
|
| 100 |
+
|
| 101 |
+
// 当前选中的平台
|
| 102 |
+
const activePlatform = ref('douyin');
|
| 103 |
+
|
| 104 |
+
// 搜索关键词
|
| 105 |
+
const searchQuery = ref('');
|
| 106 |
+
|
| 107 |
+
// 状态筛选
|
| 108 |
+
const statusFilter = ref('');
|
| 109 |
+
|
| 110 |
+
// 账号数据
|
| 111 |
+
const accountsData = ref({
|
| 112 |
+
douyin: [],
|
| 113 |
+
kuaishou: [],
|
| 114 |
+
xiaohongshu: [],
|
| 115 |
+
shipinhao: []
|
| 116 |
+
});
|
| 117 |
+
|
| 118 |
+
// 加载状态
|
| 119 |
+
const isLoading = ref(false);
|
| 120 |
+
|
| 121 |
+
// 获取账号列表
|
| 122 |
+
const fetchAccounts = async (forceRefresh = false) => {
|
| 123 |
+
// 如果全局缓存有效且不强制刷新,则使用缓存数据
|
| 124 |
+
if (!forceRefresh && globalAccountsCache.isValid()) {
|
| 125 |
+
console.log("使用缓存的账号数据");
|
| 126 |
+
processAccountsData(globalAccountsCache.accounts);
|
| 127 |
+
return;
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
isLoading.value = true;
|
| 131 |
+
try {
|
| 132 |
+
console.log("getValidAccounts请求前",`/api/getValidAccounts`);
|
| 133 |
+
const response = await axios.get(`/api/getValidAccounts`);
|
| 134 |
+
console.log("getValidAccounts", response);
|
| 135 |
+
|
| 136 |
+
if (response.data.code === 200 && response.data.data) {
|
| 137 |
+
// 更新全局缓存
|
| 138 |
+
globalAccountsCache.updateCache(response.data.data);
|
| 139 |
+
|
| 140 |
+
// 处理账号数据
|
| 141 |
+
processAccountsData(response.data.data);
|
| 142 |
+
}
|
| 143 |
+
} catch (error) {
|
| 144 |
+
console.error('获取账号列表失败:', error);
|
| 145 |
+
// 如果获取失败,使用空数组
|
| 146 |
+
accountsData.value = {
|
| 147 |
+
douyin: [],
|
| 148 |
+
xiaohongshu: [],
|
| 149 |
+
shipinhao: []
|
| 150 |
+
};
|
| 151 |
+
} finally {
|
| 152 |
+
isLoading.value = false;
|
| 153 |
+
}
|
| 154 |
+
};
|
| 155 |
+
|
| 156 |
+
// 处理账号数据
|
| 157 |
+
const processAccountsData = (data) => {
|
| 158 |
+
// 清空所有平台的账号数据
|
| 159 |
+
accountsData.value = {
|
| 160 |
+
douyin: [],
|
| 161 |
+
xiaohongshu: [],
|
| 162 |
+
shipinhao: []
|
| 163 |
+
};
|
| 164 |
+
|
| 165 |
+
// 根据type值将账号分配到对应平台
|
| 166 |
+
data.forEach(account => {
|
| 167 |
+
const formattedAccount = {
|
| 168 |
+
id: account[0]|| Math.random().toString(36).substr(2, 9),
|
| 169 |
+
name: account[3] || '未命名账号',
|
| 170 |
+
avatar: tx,
|
| 171 |
+
followers: formatNumber(account.followers || 0),
|
| 172 |
+
likes: formatNumber(account.likes || 0),
|
| 173 |
+
views: formatNumber(account.views || 0),
|
| 174 |
+
status: account[4] === 1 ? '正常' : '异常',
|
| 175 |
+
statusType: account[4] === 1 ? 'normal' : 'warning',
|
| 176 |
+
cookiejson:account[2],
|
| 177 |
+
userData: account
|
| 178 |
+
};
|
| 179 |
+
|
| 180 |
+
// 根据type值分配到对应平台
|
| 181 |
+
switch (account[1]) {
|
| 182 |
+
case 3: // 抖音
|
| 183 |
+
accountsData.value.douyin.push(formattedAccount);
|
| 184 |
+
break;
|
| 185 |
+
case 4: // 新增抖音平台
|
| 186 |
+
accountsData.value.kuaishou.push(formattedAccount);
|
| 187 |
+
break;
|
| 188 |
+
case 1: // 小红书
|
| 189 |
+
accountsData.value.xiaohongshu.push(formattedAccount);
|
| 190 |
+
break;
|
| 191 |
+
case 2: // 视频号
|
| 192 |
+
accountsData.value.shipinhao.push(formattedAccount);
|
| 193 |
+
break;
|
| 194 |
+
default:
|
| 195 |
+
// 如果type不匹配,默认放入当前选中的平台
|
| 196 |
+
accountsData.value[activePlatform.value].push(formattedAccount);
|
| 197 |
+
break;
|
| 198 |
+
}
|
| 199 |
+
});
|
| 200 |
+
};
|
| 201 |
+
|
| 202 |
+
// 强制刷新账号列表
|
| 203 |
+
const refreshAccounts = () => {
|
| 204 |
+
fetchAccounts(true);
|
| 205 |
+
};
|
| 206 |
+
|
| 207 |
+
// 格式化数字
|
| 208 |
+
const formatNumber = (num) => {
|
| 209 |
+
if (num >= 100000000) {
|
| 210 |
+
return (num / 100000000).toFixed(1) + '亿';
|
| 211 |
+
} else if (num >= 10000) {
|
| 212 |
+
return (num / 10000).toFixed(1) + '万';
|
| 213 |
+
}
|
| 214 |
+
return num.toString();
|
| 215 |
+
};
|
| 216 |
+
|
| 217 |
+
// 获取平台ID数字
|
| 218 |
+
const getPlatformIdNumber = (platform) => {
|
| 219 |
+
switch (platform) {
|
| 220 |
+
case 'douyin': return 3;
|
| 221 |
+
case 'douyin2': return 4; // 新增抖音平台,编号为4
|
| 222 |
+
case 'xiaohongshu': return 1;
|
| 223 |
+
case 'shipinhao': return 2;
|
| 224 |
+
default: return 0;
|
| 225 |
+
}
|
| 226 |
+
};
|
| 227 |
+
|
| 228 |
+
// 根据当前选中平台和搜索关键词过滤账号列表
|
| 229 |
+
const filteredAccounts = computed(() => {
|
| 230 |
+
const accounts = accountsData.value[activePlatform.value] || [];
|
| 231 |
+
let filtered = accounts;
|
| 232 |
+
|
| 233 |
+
// 按名称搜索过滤
|
| 234 |
+
if (searchQuery.value) {
|
| 235 |
+
filtered = filtered.filter(account =>
|
| 236 |
+
account.name.toLowerCase().includes(searchQuery.value.toLowerCase())
|
| 237 |
+
);
|
| 238 |
+
}
|
| 239 |
+
|
| 240 |
+
// 按状态过滤
|
| 241 |
+
if (statusFilter.value) {
|
| 242 |
+
filtered = filtered.filter(account => account.status === statusFilter.value);
|
| 243 |
+
}
|
| 244 |
+
|
| 245 |
+
return filtered;
|
| 246 |
+
});
|
| 247 |
+
|
| 248 |
+
// 在组件挂载时获取账号列表
|
| 249 |
+
onMounted(() => {
|
| 250 |
+
fetchAccounts();
|
| 251 |
+
});
|
| 252 |
+
|
| 253 |
+
// 监听平台切换,重新获取账号列表
|
| 254 |
+
watch(activePlatform, () => {
|
| 255 |
+
// 平台切换时不需要强制刷新,可以使用缓存
|
| 256 |
+
fetchAccounts(false);
|
| 257 |
+
});
|
| 258 |
+
|
| 259 |
+
// 添加账号模态窗口控制
|
| 260 |
+
const isAddAccountModalVisible = ref(false);
|
| 261 |
+
|
| 262 |
+
const showAddAccountModal = () => {
|
| 263 |
+
console.log("showAddAccountModal");
|
| 264 |
+
// 确保每次打开都是全新的弹窗状态
|
| 265 |
+
isAddAccountModalVisible.value = true;
|
| 266 |
+
};
|
| 267 |
+
|
| 268 |
+
const closeAddAccountModal = () => {
|
| 269 |
+
isAddAccountModalVisible.value = false;
|
| 270 |
+
// 弹窗关闭后,确保下次打开是全新状态
|
| 271 |
+
console.log('弹窗已关闭,状态已重置');
|
| 272 |
+
};
|
| 273 |
+
|
| 274 |
+
const handleAccountAdded = () => {
|
| 275 |
+
// 账号添加成功后,不再自动刷新列表
|
| 276 |
+
// 用户可以点击刷新按钮手动刷新
|
| 277 |
+
console.log('账号添加成功,可点击刷新按钮更新列表');
|
| 278 |
+
};
|
| 279 |
+
|
| 280 |
+
const handleAccountLogin = (data) => {
|
| 281 |
+
console.log('账号登录状态:', data);
|
| 282 |
+
|
| 283 |
+
// 登录成功后不再自动刷新账号列表
|
| 284 |
+
// 用户可以点击刷新按钮手动刷新
|
| 285 |
+
};
|
| 286 |
+
</script>
|
| 287 |
+
|
| 288 |
+
<style scoped>
|
| 289 |
+
.account-view {
|
| 290 |
+
padding: 20px;
|
| 291 |
+
}
|
| 292 |
+
|
| 293 |
+
h1 {
|
| 294 |
+
margin-bottom: 20px;
|
| 295 |
+
font-size: 24px;
|
| 296 |
+
}
|
| 297 |
+
|
| 298 |
+
.account-container {
|
| 299 |
+
background-color: #fff;
|
| 300 |
+
}
|
| 301 |
+
|
| 302 |
+
/* 加载状态 */
|
| 303 |
+
.loading-state {
|
| 304 |
+
display: flex;
|
| 305 |
+
flex-direction: column;
|
| 306 |
+
align-items: center;
|
| 307 |
+
justify-content: center;
|
| 308 |
+
padding: 40px 0;
|
| 309 |
+
width: 100%;
|
| 310 |
+
}
|
| 311 |
+
|
| 312 |
+
.loading-spinner {
|
| 313 |
+
width: 40px;
|
| 314 |
+
height: 40px;
|
| 315 |
+
border: 4px solid #f3f3f3;
|
| 316 |
+
border-top: 4px solid #3498db;
|
| 317 |
+
border-radius: 50%;
|
| 318 |
+
animation: spin 1s linear infinite;
|
| 319 |
+
margin-bottom: 15px;
|
| 320 |
+
}
|
| 321 |
+
|
| 322 |
+
@keyframes spin {
|
| 323 |
+
0% {
|
| 324 |
+
transform: rotate(0deg);
|
| 325 |
+
}
|
| 326 |
+
|
| 327 |
+
100% {
|
| 328 |
+
transform: rotate(360deg);
|
| 329 |
+
}
|
| 330 |
+
}
|
| 331 |
+
|
| 332 |
+
/* 空状态 */
|
| 333 |
+
.empty-state {
|
| 334 |
+
display: flex;
|
| 335 |
+
flex-direction: column;
|
| 336 |
+
align-items: center;
|
| 337 |
+
justify-content: center;
|
| 338 |
+
padding: 40px 0;
|
| 339 |
+
width: 100%;
|
| 340 |
+
color: #666;
|
| 341 |
+
}
|
| 342 |
+
|
| 343 |
+
.empty-state p {
|
| 344 |
+
margin-bottom: 15px;
|
| 345 |
+
font-size: 16px;
|
| 346 |
+
}
|
| 347 |
+
|
| 348 |
+
.btn-add-small {
|
| 349 |
+
padding: 8px 16px;
|
| 350 |
+
background-color: #1890ff;
|
| 351 |
+
color: white;
|
| 352 |
+
border: none;
|
| 353 |
+
border-radius: 4px;
|
| 354 |
+
cursor: pointer;
|
| 355 |
+
font-size: 14px;
|
| 356 |
+
transition: background-color 0.3s;
|
| 357 |
+
}
|
| 358 |
+
|
| 359 |
+
.btn-add-small:hover {
|
| 360 |
+
background-color: #40a9ff;
|
| 361 |
+
}
|
| 362 |
+
|
| 363 |
+
.filter-bar {
|
| 364 |
+
display: flex;
|
| 365 |
+
margin-bottom: 20px;
|
| 366 |
+
align-items: center;
|
| 367 |
+
}
|
| 368 |
+
|
| 369 |
+
.filter-item {
|
| 370 |
+
margin-right: 15px;
|
| 371 |
+
}
|
| 372 |
+
|
| 373 |
+
.filter-item select {
|
| 374 |
+
padding: 8px 15px;
|
| 375 |
+
border: 1px solid #ddd;
|
| 376 |
+
border-radius: 4px;
|
| 377 |
+
background-color: #fff;
|
| 378 |
+
}
|
| 379 |
+
|
| 380 |
+
.search-box {
|
| 381 |
+
display: flex;
|
| 382 |
+
margin-right: 15px;
|
| 383 |
+
flex: 1;
|
| 384 |
+
}
|
| 385 |
+
|
| 386 |
+
.search-box input {
|
| 387 |
+
flex: 1;
|
| 388 |
+
padding: 8px 15px;
|
| 389 |
+
border: 1px solid #ddd;
|
| 390 |
+
border-radius: 4px 0 0 4px;
|
| 391 |
+
}
|
| 392 |
+
|
| 393 |
+
.search-box button {
|
| 394 |
+
padding: 8px 15px;
|
| 395 |
+
background-color: #f5f5f5;
|
| 396 |
+
border: 1px solid #ddd;
|
| 397 |
+
border-left: none;
|
| 398 |
+
border-radius: 0 4px 4px 0;
|
| 399 |
+
}
|
| 400 |
+
|
| 401 |
+
.refresh-btn {
|
| 402 |
+
background-color: #f5f5f5;
|
| 403 |
+
color: #666;
|
| 404 |
+
border: 1px solid #ddd;
|
| 405 |
+
padding: 8px 15px;
|
| 406 |
+
border-radius: 4px;
|
| 407 |
+
cursor: pointer;
|
| 408 |
+
margin-right: 10px;
|
| 409 |
+
display: flex;
|
| 410 |
+
align-items: center;
|
| 411 |
+
justify-content: center;
|
| 412 |
+
}
|
| 413 |
+
|
| 414 |
+
.refresh-btn:hover {
|
| 415 |
+
background-color: #e6e6e6;
|
| 416 |
+
}
|
| 417 |
+
|
| 418 |
+
.refresh-icon {
|
| 419 |
+
display: inline-block;
|
| 420 |
+
width: 16px;
|
| 421 |
+
height: 16px;
|
| 422 |
+
border: 2px solid #666;
|
| 423 |
+
border-radius: 50%;
|
| 424 |
+
border-top-color: transparent;
|
| 425 |
+
position: relative;
|
| 426 |
+
}
|
| 427 |
+
|
| 428 |
+
.refresh-icon:before {
|
| 429 |
+
content: '';
|
| 430 |
+
position: absolute;
|
| 431 |
+
top: -5px;
|
| 432 |
+
right: 0;
|
| 433 |
+
width: 0;
|
| 434 |
+
height: 0;
|
| 435 |
+
border-style: solid;
|
| 436 |
+
border-width: 0 0 6px 6px;
|
| 437 |
+
border-color: transparent transparent #666 transparent;
|
| 438 |
+
}
|
| 439 |
+
|
| 440 |
+
.btn-add {
|
| 441 |
+
background-color: #6366f1;
|
| 442 |
+
color: white;
|
| 443 |
+
border: none;
|
| 444 |
+
padding: 8px 15px;
|
| 445 |
+
border-radius: 4px;
|
| 446 |
+
cursor: pointer;
|
| 447 |
+
}
|
| 448 |
+
|
| 449 |
+
.account-list {
|
| 450 |
+
margin-top: 20px;
|
| 451 |
+
}
|
| 452 |
+
|
| 453 |
+
.account-card {
|
| 454 |
+
display: flex;
|
| 455 |
+
align-items: center;
|
| 456 |
+
padding: 15px;
|
| 457 |
+
border: 1px solid #eee;
|
| 458 |
+
border-radius: 8px;
|
| 459 |
+
margin-bottom: 10px;
|
| 460 |
+
}
|
| 461 |
+
|
| 462 |
+
.account-avatar {
|
| 463 |
+
width: 50px;
|
| 464 |
+
height: 50px;
|
| 465 |
+
border-radius: 50%;
|
| 466 |
+
overflow: hidden;
|
| 467 |
+
margin-right: 15px;
|
| 468 |
+
}
|
| 469 |
+
|
| 470 |
+
.account-avatar img {
|
| 471 |
+
width: 100%;
|
| 472 |
+
height: 100%;
|
| 473 |
+
object-fit: cover;
|
| 474 |
+
}
|
| 475 |
+
|
| 476 |
+
.account-info {
|
| 477 |
+
display: flex;
|
| 478 |
+
flex-direction: column;
|
| 479 |
+
flex: 1;
|
| 480 |
+
}
|
| 481 |
+
|
| 482 |
+
.account-name {
|
| 483 |
+
font-weight: bold;
|
| 484 |
+
margin-bottom: 5px;
|
| 485 |
+
font-size: 16px;
|
| 486 |
+
}
|
| 487 |
+
|
| 488 |
+
.account-stats {
|
| 489 |
+
display: flex;
|
| 490 |
+
margin-bottom: 5px;
|
| 491 |
+
}
|
| 492 |
+
|
| 493 |
+
.stat-item {
|
| 494 |
+
margin-right: 15px;
|
| 495 |
+
display: flex;
|
| 496 |
+
align-items: center;
|
| 497 |
+
}
|
| 498 |
+
|
| 499 |
+
.stat-label {
|
| 500 |
+
color: #666;
|
| 501 |
+
font-size: 12px;
|
| 502 |
+
margin-right: 5px;
|
| 503 |
+
}
|
| 504 |
+
|
| 505 |
+
.stat-value {
|
| 506 |
+
font-weight: 500;
|
| 507 |
+
font-size: 14px;
|
| 508 |
+
}
|
| 509 |
+
|
| 510 |
+
.account-status {
|
| 511 |
+
font-size: 14px;
|
| 512 |
+
}
|
| 513 |
+
|
| 514 |
+
.status-normal {
|
| 515 |
+
color: #10b981;
|
| 516 |
+
}
|
| 517 |
+
|
| 518 |
+
.status-warning {
|
| 519 |
+
color: #f59e0b;
|
| 520 |
+
}
|
| 521 |
+
|
| 522 |
+
.status-danger {
|
| 523 |
+
color: #ef4444;
|
| 524 |
+
}
|
| 525 |
+
|
| 526 |
+
.platform-tabs {
|
| 527 |
+
display: flex;
|
| 528 |
+
border-bottom: 1px solid #eee;
|
| 529 |
+
margin-bottom: 20px;
|
| 530 |
+
}
|
| 531 |
+
|
| 532 |
+
.platform-tab {
|
| 533 |
+
padding: 10px 20px;
|
| 534 |
+
cursor: pointer;
|
| 535 |
+
border-bottom: 2px solid transparent;
|
| 536 |
+
font-weight: 500;
|
| 537 |
+
transition: all 0.2s;
|
| 538 |
+
}
|
| 539 |
+
|
| 540 |
+
.platform-tab:hover {
|
| 541 |
+
color: #6366f1;
|
| 542 |
+
}
|
| 543 |
+
|
| 544 |
+
.platform-tab.active {
|
| 545 |
+
color: #6366f1;
|
| 546 |
+
border-bottom-color: #6366f1;
|
| 547 |
+
}
|
| 548 |
+
</style>
|
sau_frontend/src/components/AddAccountModal.vue
ADDED
|
@@ -0,0 +1,362 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
| 1 |
+
<template>
|
| 2 |
+
<div class="modal-overlay" v-if="visible">
|
| 3 |
+
<div class="modal-container">
|
| 4 |
+
<div class="modal-header">
|
| 5 |
+
<h2>添加{{ getPlatformName() }}账号</h2>
|
| 6 |
+
<button class="close-btn" @click="closeModal">×</button>
|
| 7 |
+
</div>
|
| 8 |
+
<div class="modal-body">
|
| 9 |
+
<div class="input-group">
|
| 10 |
+
<label for="accountId">账号ID</label>
|
| 11 |
+
<input type="text" id="accountId" v-model="accountId" placeholder="请输入账号ID"
|
| 12 |
+
:class="{ 'error': showError }" />
|
| 13 |
+
<div class="error-message" v-if="showError">请输入账号ID</div>
|
| 14 |
+
</div>
|
| 15 |
+
|
| 16 |
+
<div class="qr-code-container" v-if="showQrCode">
|
| 17 |
+
<h3>请扫描二维码登录</h3>
|
| 18 |
+
<img :src="qrCodeSrc" alt="登录二维码" class="qr-code" />
|
| 19 |
+
</div>
|
| 20 |
+
|
| 21 |
+
<div class="message-container" v-if="message">
|
| 22 |
+
<h3>登录状态</h3>
|
| 23 |
+
<p>{{ message }}</p>
|
| 24 |
+
</div>
|
| 25 |
+
</div>
|
| 26 |
+
<div class="modal-footer">
|
| 27 |
+
<button class="cancel-btn" @click="closeModal">取消</button>
|
| 28 |
+
<button class="add-btn" @click="addAccount" :disabled="isLoading">
|
| 29 |
+
{{ isLoading ? '处理中...' : '添加账号' }}
|
| 30 |
+
</button>
|
| 31 |
+
</div>
|
| 32 |
+
</div>
|
| 33 |
+
</div>
|
| 34 |
+
</template>
|
| 35 |
+
|
| 36 |
+
<script setup>
|
| 37 |
+
import {
|
| 38 |
+
ref,
|
| 39 |
+
defineProps,
|
| 40 |
+
defineEmits,
|
| 41 |
+
watch
|
| 42 |
+
} from 'vue';
|
| 43 |
+
import {
|
| 44 |
+
API_BASE_URL
|
| 45 |
+
} from '../config';
|
| 46 |
+
|
| 47 |
+
const props = defineProps({
|
| 48 |
+
visible: {
|
| 49 |
+
type: Boolean,
|
| 50 |
+
default: false
|
| 51 |
+
},
|
| 52 |
+
platformId: {
|
| 53 |
+
type: String,
|
| 54 |
+
default: 'douyin'
|
| 55 |
+
}
|
| 56 |
+
});
|
| 57 |
+
|
| 58 |
+
const emit = defineEmits(['close', 'login', 'account-added']);
|
| 59 |
+
|
| 60 |
+
// 表单数据
|
| 61 |
+
const accountId = ref('');
|
| 62 |
+
const showError = ref(false);
|
| 63 |
+
const isLoading = ref(false);
|
| 64 |
+
|
| 65 |
+
// SSE 连接相关
|
| 66 |
+
const showQrCode = ref(false);
|
| 67 |
+
const qrCodeSrc = ref('');
|
| 68 |
+
const message = ref('');
|
| 69 |
+
let eventSource = null;
|
| 70 |
+
|
| 71 |
+
// 监听visible变化,重置表单
|
| 72 |
+
watch(() => props.visible, (newValue) => {
|
| 73 |
+
if (!newValue) {
|
| 74 |
+
resetForm();
|
| 75 |
+
}
|
| 76 |
+
});
|
| 77 |
+
|
| 78 |
+
// 获取平台名称
|
| 79 |
+
const getPlatformName = () => {
|
| 80 |
+
const platformMap = {
|
| 81 |
+
'douyin': '抖音',
|
| 82 |
+
'douyin2': '抖音',
|
| 83 |
+
'xiaohongshu': '小红书',
|
| 84 |
+
'shipinhao': '视频号'
|
| 85 |
+
};
|
| 86 |
+
return platformMap[props.platformId] || '';
|
| 87 |
+
};
|
| 88 |
+
|
| 89 |
+
// 关闭模态窗口
|
| 90 |
+
const closeModal = () => {
|
| 91 |
+
// 如果有活跃的 EventSource 连接,关闭它
|
| 92 |
+
if (eventSource) {
|
| 93 |
+
eventSource.close();
|
| 94 |
+
eventSource = null;
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
emit('close');
|
| 98 |
+
};
|
| 99 |
+
|
| 100 |
+
// 重置表单
|
| 101 |
+
const resetForm = () => {
|
| 102 |
+
accountId.value = '';
|
| 103 |
+
showError.value = false;
|
| 104 |
+
isLoading.value = false;
|
| 105 |
+
showQrCode.value = false;
|
| 106 |
+
qrCodeSrc.value = '';
|
| 107 |
+
message.value = '';
|
| 108 |
+
|
| 109 |
+
// 确保关闭 EventSource 连接
|
| 110 |
+
if (eventSource) {
|
| 111 |
+
eventSource.close();
|
| 112 |
+
eventSource = null;
|
| 113 |
+
}
|
| 114 |
+
};
|
| 115 |
+
|
| 116 |
+
// 添加账号
|
| 117 |
+
const addAccount = () => {
|
| 118 |
+
// 表单验证
|
| 119 |
+
if (!accountId.value.trim()) {
|
| 120 |
+
showError.value = true;
|
| 121 |
+
return;
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
showError.value = false;
|
| 125 |
+
isLoading.value = true;
|
| 126 |
+
|
| 127 |
+
// 获取平台对应的type值
|
| 128 |
+
const platformTypeMap = {
|
| 129 |
+
'douyin': 3,
|
| 130 |
+
'kuaishou': 4, // 新增抖音平台,编号为4
|
| 131 |
+
'xiaohongshu': 1,
|
| 132 |
+
'shipinhao': 2
|
| 133 |
+
};
|
| 134 |
+
const platformType = platformTypeMap[props.platformId] || 3; // 默认使用抖音type=3
|
| 135 |
+
|
| 136 |
+
// 创建 EventSource 连接,使用正确的平台type
|
| 137 |
+
const url = `api/login?type=${platformType}&id=${accountId.value}`;
|
| 138 |
+
eventSource = new EventSource(url);
|
| 139 |
+
|
| 140 |
+
let count = 0;
|
| 141 |
+
|
| 142 |
+
// 接收事件流中的消息
|
| 143 |
+
eventSource.onmessage = (event) => {
|
| 144 |
+
console.log("onmessage");
|
| 145 |
+
count++;
|
| 146 |
+
const data = event.data;
|
| 147 |
+
|
| 148 |
+
if (count === 1) {
|
| 149 |
+
// 第一次收到的是 base64 图片(二维码)
|
| 150 |
+
console.log('收到二维码:', data);
|
| 151 |
+
qrCodeSrc.value = `${data}`;
|
| 152 |
+
showQrCode.value = true;
|
| 153 |
+
|
| 154 |
+
// 通知父组件登录过程开始
|
| 155 |
+
emit('login', {
|
| 156 |
+
status: 'qrcode',
|
| 157 |
+
platformId: props.platformId,
|
| 158 |
+
accountId: accountId.value
|
| 159 |
+
});
|
| 160 |
+
} else if (count === 2) {
|
| 161 |
+
// 第二次收到普通消息(登录结果)
|
| 162 |
+
console.log('收到消息:', data);
|
| 163 |
+
message.value = data;
|
| 164 |
+
isLoading.value = false;
|
| 165 |
+
|
| 166 |
+
// 主动关闭连接
|
| 167 |
+
eventSource.close();
|
| 168 |
+
eventSource = null;
|
| 169 |
+
|
| 170 |
+
// 通知父组件账号添加成功
|
| 171 |
+
emit('account-added', {
|
| 172 |
+
status: 'success',
|
| 173 |
+
platformId: props.platformId,
|
| 174 |
+
accountId: accountId.value,
|
| 175 |
+
message: data
|
| 176 |
+
});
|
| 177 |
+
|
| 178 |
+
// 显示成功提示并关闭弹窗
|
| 179 |
+
ElMessage({
|
| 180 |
+
message: `账号添加成功,请手动刷新: ${data}`,
|
| 181 |
+
type: 'success',
|
| 182 |
+
duration: 3000, // 显示时长,单位毫秒
|
| 183 |
+
showClose: true, // 是否显示关闭按钮
|
| 184 |
+
});
|
| 185 |
+
closeModal();
|
| 186 |
+
}
|
| 187 |
+
};
|
| 188 |
+
|
| 189 |
+
// 错误处理
|
| 190 |
+
eventSource.onerror = (err) => {
|
| 191 |
+
console.error('EventSource 发生错误:', err);
|
| 192 |
+
message.value = '连接异常中断';
|
| 193 |
+
isLoading.value = false;
|
| 194 |
+
|
| 195 |
+
if (eventSource) {
|
| 196 |
+
eventSource.close();
|
| 197 |
+
eventSource = null;
|
| 198 |
+
}
|
| 199 |
+
|
| 200 |
+
// 通知父组件登录失败
|
| 201 |
+
emit('login', {
|
| 202 |
+
status: 'error',
|
| 203 |
+
platformId: props.platformId,
|
| 204 |
+
accountId: accountId.value,
|
| 205 |
+
error: '连接异常中断'
|
| 206 |
+
});
|
| 207 |
+
|
| 208 |
+
// 显示错���提示并关闭弹窗
|
| 209 |
+
alert('登录失败: 连接异常中断');
|
| 210 |
+
closeModal();
|
| 211 |
+
};
|
| 212 |
+
};
|
| 213 |
+
</script>
|
| 214 |
+
|
| 215 |
+
<style scoped>
|
| 216 |
+
.modal-overlay {
|
| 217 |
+
position: fixed;
|
| 218 |
+
top: 0;
|
| 219 |
+
left: 0;
|
| 220 |
+
right: 0;
|
| 221 |
+
bottom: 0;
|
| 222 |
+
background-color: rgba(0, 0, 0, 0.5);
|
| 223 |
+
display: flex;
|
| 224 |
+
justify-content: center;
|
| 225 |
+
align-items: center;
|
| 226 |
+
z-index: 1000;
|
| 227 |
+
}
|
| 228 |
+
|
| 229 |
+
.modal-container {
|
| 230 |
+
background-color: white;
|
| 231 |
+
border-radius: 8px;
|
| 232 |
+
width: 500px;
|
| 233 |
+
max-width: 90%;
|
| 234 |
+
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
|
| 235 |
+
overflow: hidden;
|
| 236 |
+
}
|
| 237 |
+
|
| 238 |
+
.modal-header {
|
| 239 |
+
display: flex;
|
| 240 |
+
justify-content: space-between;
|
| 241 |
+
align-items: center;
|
| 242 |
+
padding: 16px 20px;
|
| 243 |
+
border-bottom: 1px solid #eee;
|
| 244 |
+
}
|
| 245 |
+
|
| 246 |
+
.modal-header h2 {
|
| 247 |
+
margin: 0;
|
| 248 |
+
font-size: 18px;
|
| 249 |
+
color: #333;
|
| 250 |
+
}
|
| 251 |
+
|
| 252 |
+
.close-btn {
|
| 253 |
+
background: none;
|
| 254 |
+
border: none;
|
| 255 |
+
font-size: 24px;
|
| 256 |
+
cursor: pointer;
|
| 257 |
+
color: #999;
|
| 258 |
+
}
|
| 259 |
+
|
| 260 |
+
.modal-body {
|
| 261 |
+
padding: 20px;
|
| 262 |
+
}
|
| 263 |
+
|
| 264 |
+
.input-group {
|
| 265 |
+
margin-bottom: 20px;
|
| 266 |
+
}
|
| 267 |
+
|
| 268 |
+
.input-group label {
|
| 269 |
+
display: block;
|
| 270 |
+
margin-bottom: 8px;
|
| 271 |
+
font-weight: 500;
|
| 272 |
+
color: #333;
|
| 273 |
+
}
|
| 274 |
+
|
| 275 |
+
input {
|
| 276 |
+
width: 100%;
|
| 277 |
+
padding: 10px 12px;
|
| 278 |
+
border: 1px solid #ddd;
|
| 279 |
+
border-radius: 4px;
|
| 280 |
+
font-size: 14px;
|
| 281 |
+
transition: border-color 0.3s;
|
| 282 |
+
}
|
| 283 |
+
|
| 284 |
+
input:focus {
|
| 285 |
+
outline: none;
|
| 286 |
+
border-color: #1890ff;
|
| 287 |
+
}
|
| 288 |
+
|
| 289 |
+
input.error {
|
| 290 |
+
border-color: #ff4d4f;
|
| 291 |
+
}
|
| 292 |
+
|
| 293 |
+
.error-message {
|
| 294 |
+
color: #ff4d4f;
|
| 295 |
+
font-size: 12px;
|
| 296 |
+
margin-top: 4px;
|
| 297 |
+
}
|
| 298 |
+
|
| 299 |
+
.modal-footer {
|
| 300 |
+
padding: 16px 20px;
|
| 301 |
+
border-top: 1px solid #eee;
|
| 302 |
+
display: flex;
|
| 303 |
+
justify-content: flex-end;
|
| 304 |
+
gap: 12px;
|
| 305 |
+
}
|
| 306 |
+
|
| 307 |
+
.cancel-btn {
|
| 308 |
+
padding: 8px 16px;
|
| 309 |
+
background-color: #f7f7f7;
|
| 310 |
+
border: 1px solid #ddd;
|
| 311 |
+
border-radius: 4px;
|
| 312 |
+
cursor: pointer;
|
| 313 |
+
font-size: 14px;
|
| 314 |
+
color: #666;
|
| 315 |
+
}
|
| 316 |
+
|
| 317 |
+
.add-btn {
|
| 318 |
+
padding: 8px 16px;
|
| 319 |
+
background-color: #1890ff;
|
| 320 |
+
color: white;
|
| 321 |
+
border: none;
|
| 322 |
+
border-radius: 4px;
|
| 323 |
+
cursor: pointer;
|
| 324 |
+
font-size: 14px;
|
| 325 |
+
}
|
| 326 |
+
|
| 327 |
+
.add-btn:disabled {
|
| 328 |
+
background-color: #bae7ff;
|
| 329 |
+
cursor: not-allowed;
|
| 330 |
+
}
|
| 331 |
+
|
| 332 |
+
.qr-code-container {
|
| 333 |
+
margin-top: 20px;
|
| 334 |
+
text-align: center;
|
| 335 |
+
}
|
| 336 |
+
|
| 337 |
+
.qr-code {
|
| 338 |
+
width: 200px;
|
| 339 |
+
height: 200px;
|
| 340 |
+
margin: 10px auto;
|
| 341 |
+
display: block;
|
| 342 |
+
}
|
| 343 |
+
|
| 344 |
+
.message-container {
|
| 345 |
+
margin-top: 20px;
|
| 346 |
+
padding: 12px;
|
| 347 |
+
background-color: #f6f6f6;
|
| 348 |
+
border-radius: 4px;
|
| 349 |
+
}
|
| 350 |
+
|
| 351 |
+
.message-container h3 {
|
| 352 |
+
margin-top: 0;
|
| 353 |
+
margin-bottom: 8px;
|
| 354 |
+
font-size: 16px;
|
| 355 |
+
color: #333;
|
| 356 |
+
}
|
| 357 |
+
|
| 358 |
+
.message-container p {
|
| 359 |
+
margin: 0;
|
| 360 |
+
color: #666;
|
| 361 |
+
}
|
| 362 |
+
</style>
|
sau_frontend/src/components/ArticlePublishView.vue
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<template>
|
| 2 |
+
<div class="article-publish-view">
|
| 3 |
+
<h1>发布图文</h1>
|
| 4 |
+
|
| 5 |
+
<!-- 标题 -->
|
| 6 |
+
<div class="form-group">
|
| 7 |
+
<label>标题:</label>
|
| 8 |
+
<div class="input-wrapper">
|
| 9 |
+
<input type="text" class="form-input" placeholder="请输入标题" />
|
| 10 |
+
<span class="character-count">0/30</span>
|
| 11 |
+
</div>
|
| 12 |
+
</div>
|
| 13 |
+
|
| 14 |
+
<!-- 图片 -->
|
| 15 |
+
<div class="form-group">
|
| 16 |
+
<label>图片:</label>
|
| 17 |
+
<div class="image-upload-area">
|
| 18 |
+
<div class="upload-box">
|
| 19 |
+
<div class="plus-icon">+</div>
|
| 20 |
+
</div>
|
| 21 |
+
</div>
|
| 22 |
+
</div>
|
| 23 |
+
|
| 24 |
+
<!-- 活动 -->
|
| 25 |
+
<div class="form-group">
|
| 26 |
+
<label>活动:</label>
|
| 27 |
+
<div class="input-wrapper">
|
| 28 |
+
<input type="text" class="form-input" placeholder="请输入活动..." />
|
| 29 |
+
</div>
|
| 30 |
+
</div>
|
| 31 |
+
|
| 32 |
+
<!-- 按钮区域 -->
|
| 33 |
+
<div class="action-buttons">
|
| 34 |
+
<button class="btn btn-preview">预览内容</button>
|
| 35 |
+
<button class="btn btn-publish">零点发布</button>
|
| 36 |
+
</div>
|
| 37 |
+
</div>
|
| 38 |
+
</template>
|
| 39 |
+
|
| 40 |
+
<script setup>
|
| 41 |
+
// 这里可以添加组件逻辑
|
| 42 |
+
</script>
|
| 43 |
+
|
| 44 |
+
<style scoped>
|
| 45 |
+
.article-publish-view {
|
| 46 |
+
padding: 20px;
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
h1 {
|
| 50 |
+
margin-bottom: 30px;
|
| 51 |
+
font-size: 24px;
|
| 52 |
+
font-weight: 500;
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
.form-group {
|
| 56 |
+
margin-bottom: 25px;
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
label {
|
| 60 |
+
display: block;
|
| 61 |
+
margin-bottom: 10px;
|
| 62 |
+
font-weight: 500;
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
.input-wrapper {
|
| 66 |
+
position: relative;
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
.form-input {
|
| 70 |
+
width: 100%;
|
| 71 |
+
padding: 10px 15px;
|
| 72 |
+
border: 1px solid #e0e0e0;
|
| 73 |
+
border-radius: 4px;
|
| 74 |
+
font-size: 14px;
|
| 75 |
+
outline: none;
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
.character-count {
|
| 79 |
+
position: absolute;
|
| 80 |
+
right: 10px;
|
| 81 |
+
top: 10px;
|
| 82 |
+
color: #999;
|
| 83 |
+
font-size: 12px;
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
.image-upload-area {
|
| 87 |
+
display: flex;
|
| 88 |
+
gap: 15px;
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
.upload-box {
|
| 92 |
+
width: 150px;
|
| 93 |
+
height: 150px;
|
| 94 |
+
border: 1px dashed #ccc;
|
| 95 |
+
border-radius: 4px;
|
| 96 |
+
display: flex;
|
| 97 |
+
align-items: center;
|
| 98 |
+
justify-content: center;
|
| 99 |
+
cursor: pointer;
|
| 100 |
+
background-color: #f9f9f9;
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
.plus-icon {
|
| 104 |
+
font-size: 40px;
|
| 105 |
+
color: #ccc;
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
.action-buttons {
|
| 109 |
+
display: flex;
|
| 110 |
+
gap: 15px;
|
| 111 |
+
margin-top: 30px;
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
.btn {
|
| 115 |
+
padding: 10px 20px;
|
| 116 |
+
border-radius: 4px;
|
| 117 |
+
border: none;
|
| 118 |
+
font-size: 14px;
|
| 119 |
+
cursor: pointer;
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
.btn-preview {
|
| 123 |
+
background-color: #fff;
|
| 124 |
+
border: 1px solid #e0e0e0;
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
.btn-publish {
|
| 128 |
+
background-color: #6366f1;
|
| 129 |
+
color: white;
|
| 130 |
+
}
|
| 131 |
+
</style>
|
sau_frontend/src/components/DataView.vue
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<template>
|
| 2 |
+
<div class="data-view">
|
| 3 |
+
<h1>数据</h1>
|
| 4 |
+
<div class="data-container">
|
| 5 |
+
<p>这里是数据分析的内容</p>
|
| 6 |
+
</div>
|
| 7 |
+
</div>
|
| 8 |
+
</template>
|
| 9 |
+
|
| 10 |
+
<style scoped>
|
| 11 |
+
.data-view {
|
| 12 |
+
padding: 20px;
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
h1 {
|
| 16 |
+
margin-bottom: 20px;
|
| 17 |
+
font-size: 24px;
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
.data-container {
|
| 21 |
+
background-color: #fff;
|
| 22 |
+
border-radius: 8px;
|
| 23 |
+
padding: 20px;
|
| 24 |
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
|
| 25 |
+
}
|
| 26 |
+
</style>
|
sau_frontend/src/components/LoginModal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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<template>
|
| 2 |
+
<div v-if="visible" class="login-modal-overlay" @click.self="closeModal">
|
| 3 |
+
<div class="login-modal">
|
| 4 |
+
<div class="login-header">
|
| 5 |
+
<h2>用户登录</h2>
|
| 6 |
+
<button class="close-btn" @click="closeModal">×</button>
|
| 7 |
+
</div>
|
| 8 |
+
<div class="login-body">
|
| 9 |
+
<div class="form-group">
|
| 10 |
+
<label for="username">用户名</label>
|
| 11 |
+
<input
|
| 12 |
+
type="text"
|
| 13 |
+
id="username"
|
| 14 |
+
v-model="username"
|
| 15 |
+
:class="{'error': errors.username}"
|
| 16 |
+
placeholder="请输入用户名"
|
| 17 |
+
/>
|
| 18 |
+
<span class="error-message" v-if="errors.username">{{ errors.username }}</span>
|
| 19 |
+
</div>
|
| 20 |
+
<div class="form-group">
|
| 21 |
+
<label for="password">密码</label>
|
| 22 |
+
<input
|
| 23 |
+
type="password"
|
| 24 |
+
id="password"
|
| 25 |
+
v-model="password"
|
| 26 |
+
:class="{'error': errors.password}"
|
| 27 |
+
placeholder="请输入密码"
|
| 28 |
+
/>
|
| 29 |
+
<span class="error-message" v-if="errors.password">{{ errors.password }}</span>
|
| 30 |
+
</div>
|
| 31 |
+
<div class="form-actions">
|
| 32 |
+
<button class="login-btn" @click="handleLogin">登录</button>
|
| 33 |
+
</div>
|
| 34 |
+
</div>
|
| 35 |
+
</div>
|
| 36 |
+
</div>
|
| 37 |
+
</template>
|
| 38 |
+
|
| 39 |
+
<script setup>
|
| 40 |
+
import { ref, reactive } from 'vue';
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
const props = defineProps();
|
| 44 |
+
const emit = defineEmits(['close', 'login-success']);
|
| 45 |
+
|
| 46 |
+
const username = ref('');
|
| 47 |
+
const password = ref('');
|
| 48 |
+
const errors = reactive({
|
| 49 |
+
username: '',
|
| 50 |
+
password: ''
|
| 51 |
+
});
|
| 52 |
+
|
| 53 |
+
const validateForm = () => {
|
| 54 |
+
let isValid = true;
|
| 55 |
+
|
| 56 |
+
// 重置错误信息
|
| 57 |
+
errors.username = '';
|
| 58 |
+
errors.password = '';
|
| 59 |
+
|
| 60 |
+
// 验证用户名
|
| 61 |
+
if (!username.value) {
|
| 62 |
+
errors.username = '请输入用户名';
|
| 63 |
+
isValid = false;
|
| 64 |
+
} else if (username.value.length < 3) {
|
| 65 |
+
errors.username = '用户名长度不能少于3个字符';
|
| 66 |
+
isValid = false;
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
// 验证密码
|
| 70 |
+
if (!password.value) {
|
| 71 |
+
errors.password = '请输入密码';
|
| 72 |
+
isValid = false;
|
| 73 |
+
} else if (password.value.length < 6) {
|
| 74 |
+
errors.password = '密码长度不能少于6个字符';
|
| 75 |
+
isValid = false;
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
return isValid;
|
| 79 |
+
};
|
| 80 |
+
|
| 81 |
+
const handleLogin = () => {
|
| 82 |
+
if (validateForm()) {
|
| 83 |
+
// 模拟登录成功
|
| 84 |
+
setTimeout(() => {
|
| 85 |
+
// 这里可以添加实际的登录逻辑
|
| 86 |
+
console.log('登录成功', { username: username.value, password: password.value });
|
| 87 |
+
|
| 88 |
+
// 发送登录成功事件
|
| 89 |
+
emit('login-success', { username: username.value });
|
| 90 |
+
|
| 91 |
+
// 关闭模态窗
|
| 92 |
+
closeModal();
|
| 93 |
+
|
| 94 |
+
// 清空表单
|
| 95 |
+
username.value = '';
|
| 96 |
+
password.value = '';
|
| 97 |
+
}, 500);
|
| 98 |
+
}
|
| 99 |
+
};
|
| 100 |
+
|
| 101 |
+
const closeModal = () => {
|
| 102 |
+
emit('close');
|
| 103 |
+
};
|
| 104 |
+
</script>
|
| 105 |
+
|
| 106 |
+
<style scoped>
|
| 107 |
+
.login-modal-overlay {
|
| 108 |
+
position: fixed;
|
| 109 |
+
top: 0;
|
| 110 |
+
left: 0;
|
| 111 |
+
right: 0;
|
| 112 |
+
bottom: 0;
|
| 113 |
+
background-color: rgba(0, 0, 0, 0.5);
|
| 114 |
+
display: flex;
|
| 115 |
+
justify-content: center;
|
| 116 |
+
align-items: center;
|
| 117 |
+
z-index: 1000;
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
.login-modal {
|
| 121 |
+
background-color: white;
|
| 122 |
+
border-radius: 8px;
|
| 123 |
+
width: 400px;
|
| 124 |
+
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
|
| 125 |
+
overflow: hidden;
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
.login-header {
|
| 129 |
+
display: flex;
|
| 130 |
+
justify-content: space-between;
|
| 131 |
+
align-items: center;
|
| 132 |
+
padding: 16px 20px;
|
| 133 |
+
border-bottom: 1px solid #eee;
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
.login-header h2 {
|
| 137 |
+
margin: 0;
|
| 138 |
+
font-size: 18px;
|
| 139 |
+
color: #333;
|
| 140 |
+
}
|
| 141 |
+
|
| 142 |
+
.close-btn {
|
| 143 |
+
background: none;
|
| 144 |
+
border: none;
|
| 145 |
+
font-size: 24px;
|
| 146 |
+
cursor: pointer;
|
| 147 |
+
color: #999;
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
.login-body {
|
| 151 |
+
padding: 20px;
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
.form-group {
|
| 155 |
+
margin-bottom: 16px;
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
.form-group label {
|
| 159 |
+
display: block;
|
| 160 |
+
margin-bottom: 8px;
|
| 161 |
+
font-size: 14px;
|
| 162 |
+
color: #333;
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
+
.form-group input {
|
| 166 |
+
width: 100%;
|
| 167 |
+
padding: 10px 12px;
|
| 168 |
+
border: 1px solid #ddd;
|
| 169 |
+
border-radius: 4px;
|
| 170 |
+
font-size: 14px;
|
| 171 |
+
transition: border-color 0.3s;
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
+
.form-group input:focus {
|
| 175 |
+
outline: none;
|
| 176 |
+
border-color: #4e6ef2;
|
| 177 |
+
}
|
| 178 |
+
|
| 179 |
+
.form-group input.error {
|
| 180 |
+
border-color: #f56c6c;
|
| 181 |
+
}
|
| 182 |
+
|
| 183 |
+
.error-message {
|
| 184 |
+
display: block;
|
| 185 |
+
color: #f56c6c;
|
| 186 |
+
font-size: 12px;
|
| 187 |
+
margin-top: 4px;
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
.form-actions {
|
| 191 |
+
margin-top: 24px;
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
.login-btn {
|
| 195 |
+
width: 100%;
|
| 196 |
+
background-color: #4e6ef2;
|
| 197 |
+
color: white;
|
| 198 |
+
border: none;
|
| 199 |
+
border-radius: 4px;
|
| 200 |
+
padding: 12px 0;
|
| 201 |
+
font-size: 16px;
|
| 202 |
+
cursor: pointer;
|
| 203 |
+
transition: background-color 0.3s;
|
| 204 |
+
}
|
| 205 |
+
|
| 206 |
+
.login-btn:hover {
|
| 207 |
+
background-color: #3c5ae4;
|
| 208 |
+
}
|
| 209 |
+
</style>
|
sau_frontend/src/components/MaterialLibraryView.vue
ADDED
|
@@ -0,0 +1,688 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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7 |
+
<button class="upload-btn" @click="showUploadModal">
|
| 8 |
+
<i class="upload-icon">↑</i> 上传素材
|
| 9 |
+
</button>
|
| 10 |
+
<button class="batch-btn">
|
| 11 |
+
批量操作
|
| 12 |
+
</button>
|
| 13 |
+
<!-- 添加搜索框 -->
|
| 14 |
+
<div class="search-container">
|
| 15 |
+
<input
|
| 16 |
+
type="text"
|
| 17 |
+
v-model="searchQuery"
|
| 18 |
+
placeholder="搜索素材名称"
|
| 19 |
+
class="search-input"
|
| 20 |
+
@input="searchMaterials"
|
| 21 |
+
/>
|
| 22 |
+
<i class="search-icon">🔍</i>
|
| 23 |
+
</div>
|
| 24 |
+
</div>
|
| 25 |
+
|
| 26 |
+
<!-- 素材列表 -->
|
| 27 |
+
<div v-if="filteredMaterials.length > 0" class="materials-grid">
|
| 28 |
+
<div v-for="material in filteredMaterials" :key="material.file_name" class="material-card">
|
| 29 |
+
<!-- 视频预览 -->
|
| 30 |
+
<div class="material-preview">
|
| 31 |
+
<img src="@/assets/bofang.png" alt="播放图标" class="play-icon">
|
| 32 |
+
<button class="delete-btn" @click="deleteMaterial(material)" title="删除素材">×</button>
|
| 33 |
+
</div>
|
| 34 |
+
|
| 35 |
+
<!-- 素材信息 -->
|
| 36 |
+
<div class="material-info">
|
| 37 |
+
<div class="material-name">{{ material.filename }}</div>
|
| 38 |
+
<div class="material-meta">
|
| 39 |
+
<!-- <span>{{ material.filename }}</span> -->
|
| 40 |
+
<span>{{ formatFileSize(material.filesize) }}</span>
|
| 41 |
+
<span>{{ formatDate(material.upload_time) }}</span>
|
| 42 |
+
</div>
|
| 43 |
+
</div>
|
| 44 |
+
</div>
|
| 45 |
+
</div>
|
| 46 |
+
|
| 47 |
+
<!-- 空状态 -->
|
| 48 |
+
<div v-else class="empty-state">
|
| 49 |
+
<div class="empty-image"></div>
|
| 50 |
+
<p class="empty-text">暂无素材,点击上传素材按钮添加</p>
|
| 51 |
+
</div>
|
| 52 |
+
|
| 53 |
+
<!-- 上传素材弹窗 -->
|
| 54 |
+
<div class="upload-modal" v-if="isUploadModalVisible">
|
| 55 |
+
<div class="upload-modal-content">
|
| 56 |
+
<div class="modal-header">
|
| 57 |
+
<h3>上传素材</h3>
|
| 58 |
+
<button class="close-btn" @click="hideUploadModal">×</button>
|
| 59 |
+
</div>
|
| 60 |
+
<div class="modal-body">
|
| 61 |
+
<div class="filename-input">
|
| 62 |
+
<input
|
| 63 |
+
type="text"
|
| 64 |
+
v-model="customFilename"
|
| 65 |
+
placeholder="输入文件名称(可选)"
|
| 66 |
+
class="filename-field"
|
| 67 |
+
/>
|
| 68 |
+
</div>
|
| 69 |
+
|
| 70 |
+
<div class="upload-area" @click="triggerFileInput">
|
| 71 |
+
<div v-if="!selectedFile" class="upload-placeholder">
|
| 72 |
+
<span>点击上传素材</span>
|
| 73 |
+
<div class="upload-hint">图片最大支持20M</div>
|
| 74 |
+
</div>
|
| 75 |
+
<div v-else class="preview-container">
|
| 76 |
+
<video v-if="isVideo(selectedFile.name)" controls class="file-preview">
|
| 77 |
+
<source :src="previewUrl" type="video/mp4">
|
| 78 |
+
</video>
|
| 79 |
+
<img v-else :src="previewUrl" alt="预览" class="file-preview">
|
| 80 |
+
<button class="remove-file-btn" @click.stop="removeSelectedFile">×</button>
|
| 81 |
+
</div>
|
| 82 |
+
</div>
|
| 83 |
+
|
| 84 |
+
<div class="modal-footer">
|
| 85 |
+
<button class="cancel-btn" @click="hideUploadModal">取消</button>
|
| 86 |
+
<button
|
| 87 |
+
class="upload-submit-btn"
|
| 88 |
+
:disabled="!selectedFile || isUploading"
|
| 89 |
+
@click="uploadMaterial"
|
| 90 |
+
>
|
| 91 |
+
{{ isUploading ? '上传中...' : '上传' }}
|
| 92 |
+
</button>
|
| 93 |
+
</div>
|
| 94 |
+
</div>
|
| 95 |
+
</div>
|
| 96 |
+
</div>
|
| 97 |
+
|
| 98 |
+
<!-- 隐藏的文件输入 -->
|
| 99 |
+
<input
|
| 100 |
+
type="file"
|
| 101 |
+
ref="fileInput"
|
| 102 |
+
style="display: none"
|
| 103 |
+
@change="handleFileSelected"
|
| 104 |
+
accept="image/*,video/*"
|
| 105 |
+
/>
|
| 106 |
+
</div>
|
| 107 |
+
</template>
|
| 108 |
+
|
| 109 |
+
<script setup>
|
| 110 |
+
import { ref, onMounted } from 'vue';
|
| 111 |
+
import axios from 'axios';
|
| 112 |
+
|
| 113 |
+
// 素材列表
|
| 114 |
+
const materials = ref([]);
|
| 115 |
+
const filteredMaterials = ref([]);
|
| 116 |
+
const searchQuery = ref('');
|
| 117 |
+
|
| 118 |
+
// 上传弹窗状态
|
| 119 |
+
const isUploadModalVisible = ref(false);
|
| 120 |
+
const isUploading = ref(false);
|
| 121 |
+
const selectedFile = ref(null);
|
| 122 |
+
const previewUrl = ref('');
|
| 123 |
+
const customFilename = ref('');
|
| 124 |
+
const fileInput = ref(null);
|
| 125 |
+
|
| 126 |
+
// 显示上传弹窗
|
| 127 |
+
const showUploadModal = () => {
|
| 128 |
+
isUploadModalVisible.value = true;
|
| 129 |
+
selectedFile.value = null;
|
| 130 |
+
previewUrl.value = '';
|
| 131 |
+
customFilename.value = '';
|
| 132 |
+
// 重置文件输入框,确保每次打开弹窗都能正常选择文件
|
| 133 |
+
if (fileInput.value) {
|
| 134 |
+
fileInput.value.value = '';
|
| 135 |
+
}
|
| 136 |
+
};
|
| 137 |
+
|
| 138 |
+
// 隐藏上传弹窗
|
| 139 |
+
const hideUploadModal = () => {
|
| 140 |
+
isUploadModalVisible.value = false;
|
| 141 |
+
// 清理预览URL
|
| 142 |
+
if (previewUrl.value) {
|
| 143 |
+
URL.revokeObjectURL(previewUrl.value);
|
| 144 |
+
previewUrl.value = '';
|
| 145 |
+
}
|
| 146 |
+
};
|
| 147 |
+
|
| 148 |
+
// 移除点击弹窗外部关闭的函数,不再需要
|
| 149 |
+
// const closeModalOnOutsideClick = (event) => {
|
| 150 |
+
// if (event.target.classList.contains('upload-modal')) {
|
| 151 |
+
// hideUploadModal();
|
| 152 |
+
// }
|
| 153 |
+
// };
|
| 154 |
+
|
| 155 |
+
// 触发文件选择
|
| 156 |
+
const triggerFileInput = () => {
|
| 157 |
+
fileInput.value?.click();
|
| 158 |
+
};
|
| 159 |
+
|
| 160 |
+
// 处理文件选择
|
| 161 |
+
const handleFileSelected = (event) => {
|
| 162 |
+
const file = event.target.files[0];
|
| 163 |
+
if (file) {
|
| 164 |
+
selectedFile.value = file;
|
| 165 |
+
previewUrl.value = URL.createObjectURL(file);
|
| 166 |
+
|
| 167 |
+
// 如果没有自定义文件名,使用原始文件名
|
| 168 |
+
if (!customFilename.value) {
|
| 169 |
+
customFilename.value = file.name;
|
| 170 |
+
}
|
| 171 |
+
}
|
| 172 |
+
};
|
| 173 |
+
|
| 174 |
+
// 移除已选择的文件
|
| 175 |
+
const removeSelectedFile = () => {
|
| 176 |
+
if (previewUrl.value) {
|
| 177 |
+
URL.revokeObjectURL(previewUrl.value);
|
| 178 |
+
}
|
| 179 |
+
selectedFile.value = null;
|
| 180 |
+
previewUrl.value = '';
|
| 181 |
+
if (fileInput.value) {
|
| 182 |
+
fileInput.value.value = '';
|
| 183 |
+
}
|
| 184 |
+
};
|
| 185 |
+
|
| 186 |
+
// 上传素材
|
| 187 |
+
const uploadMaterial = async () => {
|
| 188 |
+
if (!selectedFile.value) return;
|
| 189 |
+
|
| 190 |
+
isUploading.value = true;
|
| 191 |
+
|
| 192 |
+
try {
|
| 193 |
+
const formData = new FormData();
|
| 194 |
+
formData.append('file', selectedFile.value);
|
| 195 |
+
console.log('上传文件:', selectedFile.value);
|
| 196 |
+
console.log('上传文件类型:', selectedFile.value.type);
|
| 197 |
+
|
| 198 |
+
// 使用自定义文件名或原始文件名
|
| 199 |
+
const filename = customFilename.value || selectedFile.value.name;
|
| 200 |
+
formData.append('filename', filename);
|
| 201 |
+
console.log('上传文件名:', filename);
|
| 202 |
+
|
| 203 |
+
const response = await axios.post('/api/uploadSave', formData);
|
| 204 |
+
console.log('上传响应:', response.data);
|
| 205 |
+
if (response.data.code === 200) {
|
| 206 |
+
// 上传成功,刷新素材列表
|
| 207 |
+
fetchMaterials();
|
| 208 |
+
hideUploadModal();
|
| 209 |
+
} else {
|
| 210 |
+
alert('上传失败: ' + (response.data.message || '未知错误'));
|
| 211 |
+
}
|
| 212 |
+
} catch (error) {
|
| 213 |
+
console.error('上传素材失败:', error);
|
| 214 |
+
alert('上传失败: ' + (error.response?.data?.message || error.message || '未知错误'));
|
| 215 |
+
} finally {
|
| 216 |
+
isUploading.value = false;
|
| 217 |
+
}
|
| 218 |
+
};
|
| 219 |
+
|
| 220 |
+
// 搜索素材
|
| 221 |
+
const searchMaterials = () => {
|
| 222 |
+
if (!searchQuery.value) {
|
| 223 |
+
filteredMaterials.value = materials.value;
|
| 224 |
+
return;
|
| 225 |
+
}
|
| 226 |
+
|
| 227 |
+
const query = searchQuery.value.toLowerCase();
|
| 228 |
+
filteredMaterials.value = materials.value.filter(material => {
|
| 229 |
+
return material.filename && material.filename.toLowerCase().includes(query);
|
| 230 |
+
});
|
| 231 |
+
};
|
| 232 |
+
|
| 233 |
+
// 获取素材列表
|
| 234 |
+
const fetchMaterials = async () => {
|
| 235 |
+
try {
|
| 236 |
+
const response = await axios.get(`/api/getFiles`);
|
| 237 |
+
console.log('获取素材列表响应:', response.data);
|
| 238 |
+
|
| 239 |
+
if (response.data.code === 200) {
|
| 240 |
+
// 处理文件路径,添加完整的请求地址
|
| 241 |
+
const materialItems = (response.data.data || []).map(item => {
|
| 242 |
+
return {
|
| 243 |
+
...item,
|
| 244 |
+
file_path: `/api${item.file_path}` // 添加API前缀到文件路径
|
| 245 |
+
};
|
| 246 |
+
});
|
| 247 |
+
|
| 248 |
+
// 对每个素材调用getFile接口获取视频数据
|
| 249 |
+
const materialPromises = materialItems.map(async (item) => {
|
| 250 |
+
try {
|
| 251 |
+
// 从file_path中提取文件名
|
| 252 |
+
const filename = item.file_path.split('/').pop();
|
| 253 |
+
if (!filename) return item;
|
| 254 |
+
|
| 255 |
+
// 调用getFile接口获取视频数据
|
| 256 |
+
const fileResponse = await axios.get(`/api/getFile`, {
|
| 257 |
+
params: { filename: filename }
|
| 258 |
+
});
|
| 259 |
+
|
| 260 |
+
console.log(`获取素材 ${filename} 数据:`, fileResponse.data);
|
| 261 |
+
|
| 262 |
+
if (fileResponse.data.code === 200) {
|
| 263 |
+
// 将获取的视频数据合并到素材对象中
|
| 264 |
+
return {
|
| 265 |
+
...item,
|
| 266 |
+
videoData: fileResponse.data.data
|
| 267 |
+
};
|
| 268 |
+
}
|
| 269 |
+
return item;
|
| 270 |
+
} catch (error) {
|
| 271 |
+
console.error(`获取素材 ${item.filename || item.file_name} 数据失败:`, error);
|
| 272 |
+
return item;
|
| 273 |
+
}
|
| 274 |
+
});
|
| 275 |
+
|
| 276 |
+
// 等待所有getFile请求完成
|
| 277 |
+
materials.value = await Promise.all(materialPromises);
|
| 278 |
+
|
| 279 |
+
// 初始化过滤后的素材列表
|
| 280 |
+
filteredMaterials.value = materials.value;
|
| 281 |
+
console.log('处理后的素材列表:', materials.value);
|
| 282 |
+
} else {
|
| 283 |
+
console.error('获取素材列表失败:', response.data.message);
|
| 284 |
+
}
|
| 285 |
+
} catch (error) {
|
| 286 |
+
console.error('获取素材列表失败:', error);
|
| 287 |
+
}
|
| 288 |
+
};
|
| 289 |
+
|
| 290 |
+
// 删除素材
|
| 291 |
+
const deleteMaterial = async (material) => {
|
| 292 |
+
console.log('要删除的素材:', material);
|
| 293 |
+
if (confirm(`确定要删除素材 ${material.filename || material.file_name} 吗?`)) {
|
| 294 |
+
try {
|
| 295 |
+
// 调用删除API
|
| 296 |
+
const response = await axios.get(`/api/deleteFile?id=${material.id}`);
|
| 297 |
+
console.log('删除素材响应:', response.data);
|
| 298 |
+
|
| 299 |
+
if (response.data.code === 200) {
|
| 300 |
+
// 删除成功,刷新素材列表
|
| 301 |
+
fetchMaterials();
|
| 302 |
+
alert('删除成功');
|
| 303 |
+
} else {
|
| 304 |
+
alert('删除失败: ' + (response.data.message || '未知错误'));
|
| 305 |
+
}
|
| 306 |
+
} catch (error) {
|
| 307 |
+
console.error('删除素材失败:', error);
|
| 308 |
+
alert('删除失败: ' + (error.response?.data?.message || error.message || '未知错误'));
|
| 309 |
+
}
|
| 310 |
+
}
|
| 311 |
+
};
|
| 312 |
+
|
| 313 |
+
// 格式化文件大小
|
| 314 |
+
const formatFileSize = (bytes) => {
|
| 315 |
+
if (!bytes || bytes === 0) return '0 B';
|
| 316 |
+
|
| 317 |
+
const units = ['B', 'KB', 'MB', 'GB'];
|
| 318 |
+
let size = bytes;
|
| 319 |
+
let unitIndex = 0;
|
| 320 |
+
|
| 321 |
+
while (size >= 1024 && unitIndex < units.length - 1) {
|
| 322 |
+
size /= 1024;
|
| 323 |
+
unitIndex++;
|
| 324 |
+
}
|
| 325 |
+
|
| 326 |
+
return `${size.toFixed(2)} ${units[unitIndex]}`;
|
| 327 |
+
};
|
| 328 |
+
|
| 329 |
+
// 格式化日期
|
| 330 |
+
const formatDate = (timestamp) => {
|
| 331 |
+
if (!timestamp) return '';
|
| 332 |
+
|
| 333 |
+
const date = new Date(timestamp);
|
| 334 |
+
return date.toLocaleDateString('zh-CN', {
|
| 335 |
+
year: 'numeric',
|
| 336 |
+
month: '2-digit',
|
| 337 |
+
day: '2-digit',
|
| 338 |
+
hour: '2-digit',
|
| 339 |
+
minute: '2-digit'
|
| 340 |
+
});
|
| 341 |
+
};
|
| 342 |
+
|
| 343 |
+
// 判断是否为视频文件
|
| 344 |
+
const isVideo = (filename) => {
|
| 345 |
+
if (!filename) return false;
|
| 346 |
+
const videoExtensions = ['.mp4', '.avi', '.mov', '.wmv', '.flv', '.mkv'];
|
| 347 |
+
return videoExtensions.some(ext => filename.toLowerCase().endsWith(ext));
|
| 348 |
+
};
|
| 349 |
+
|
| 350 |
+
// 组件挂载时获取素材列表
|
| 351 |
+
onMounted(() => {
|
| 352 |
+
fetchMaterials();
|
| 353 |
+
});
|
| 354 |
+
</script>
|
| 355 |
+
|
| 356 |
+
<style scoped>
|
| 357 |
+
.material-library-container {
|
| 358 |
+
padding: 20px;
|
| 359 |
+
}
|
| 360 |
+
|
| 361 |
+
h1 {
|
| 362 |
+
margin-bottom: 20px;
|
| 363 |
+
font-size: 24px;
|
| 364 |
+
font-weight: 500;
|
| 365 |
+
}
|
| 366 |
+
|
| 367 |
+
/* 操作栏样式 */
|
| 368 |
+
.action-bar {
|
| 369 |
+
display: flex;
|
| 370 |
+
justify-content: flex-start;
|
| 371 |
+
margin-bottom: 20px;
|
| 372 |
+
gap: 15px;
|
| 373 |
+
align-items: center;
|
| 374 |
+
}
|
| 375 |
+
|
| 376 |
+
.upload-btn {
|
| 377 |
+
background-color: #6366f1;
|
| 378 |
+
color: white;
|
| 379 |
+
border: none;
|
| 380 |
+
border-radius: 4px;
|
| 381 |
+
padding: 8px 15px;
|
| 382 |
+
display: flex;
|
| 383 |
+
align-items: center;
|
| 384 |
+
cursor: pointer;
|
| 385 |
+
font-size: 14px;
|
| 386 |
+
}
|
| 387 |
+
|
| 388 |
+
.upload-icon {
|
| 389 |
+
margin-right: 5px;
|
| 390 |
+
font-size: 16px;
|
| 391 |
+
}
|
| 392 |
+
|
| 393 |
+
.batch-btn {
|
| 394 |
+
background-color: white;
|
| 395 |
+
border: 1px solid #e0e0e0;
|
| 396 |
+
border-radius: 4px;
|
| 397 |
+
padding: 8px 15px;
|
| 398 |
+
cursor: pointer;
|
| 399 |
+
font-size: 14px;
|
| 400 |
+
}
|
| 401 |
+
|
| 402 |
+
/* 素材网格样式 */
|
| 403 |
+
.materials-grid {
|
| 404 |
+
display: grid;
|
| 405 |
+
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
|
| 406 |
+
gap: 20px;
|
| 407 |
+
margin-top: 20px;
|
| 408 |
+
}
|
| 409 |
+
|
| 410 |
+
.material-card {
|
| 411 |
+
background-color: white;
|
| 412 |
+
border-radius: 8px;
|
| 413 |
+
overflow: hidden;
|
| 414 |
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
| 415 |
+
transition: transform 0.2s;
|
| 416 |
+
}
|
| 417 |
+
|
| 418 |
+
.material-card:hover {
|
| 419 |
+
transform: translateY(-5px);
|
| 420 |
+
}
|
| 421 |
+
|
| 422 |
+
.material-preview {
|
| 423 |
+
position: relative;
|
| 424 |
+
height: 150px;
|
| 425 |
+
background-color: #f5f5f5;
|
| 426 |
+
display: flex;
|
| 427 |
+
align-items: center;
|
| 428 |
+
justify-content: center;
|
| 429 |
+
overflow: hidden;
|
| 430 |
+
}
|
| 431 |
+
|
| 432 |
+
.material-preview video,
|
| 433 |
+
.material-preview img {
|
| 434 |
+
width: 100%;
|
| 435 |
+
height: 100%;
|
| 436 |
+
object-fit: cover;
|
| 437 |
+
}
|
| 438 |
+
|
| 439 |
+
.delete-btn {
|
| 440 |
+
position: absolute;
|
| 441 |
+
top: 5px;
|
| 442 |
+
right: 5px;
|
| 443 |
+
width: 24px;
|
| 444 |
+
height: 24px;
|
| 445 |
+
border-radius: 50%;
|
| 446 |
+
background-color: rgba(0, 0, 0, 0.5);
|
| 447 |
+
color: white;
|
| 448 |
+
border: none;
|
| 449 |
+
display: flex;
|
| 450 |
+
align-items: center;
|
| 451 |
+
justify-content: center;
|
| 452 |
+
cursor: pointer;
|
| 453 |
+
font-size: 16px;
|
| 454 |
+
opacity: 0;
|
| 455 |
+
transition: opacity 0.2s;
|
| 456 |
+
}
|
| 457 |
+
|
| 458 |
+
.material-card:hover .delete-btn {
|
| 459 |
+
opacity: 1;
|
| 460 |
+
}
|
| 461 |
+
|
| 462 |
+
.material-info {
|
| 463 |
+
padding: 10px;
|
| 464 |
+
}
|
| 465 |
+
|
| 466 |
+
.material-name {
|
| 467 |
+
font-size: 14px;
|
| 468 |
+
font-weight: 500;
|
| 469 |
+
margin-bottom: 5px;
|
| 470 |
+
white-space: nowrap;
|
| 471 |
+
overflow: hidden;
|
| 472 |
+
text-overflow: ellipsis;
|
| 473 |
+
}
|
| 474 |
+
|
| 475 |
+
.material-meta {
|
| 476 |
+
display: flex;
|
| 477 |
+
justify-content: space-between;
|
| 478 |
+
font-size: 12px;
|
| 479 |
+
color: #666;
|
| 480 |
+
}
|
| 481 |
+
|
| 482 |
+
/* 空状态样式 */
|
| 483 |
+
.empty-state {
|
| 484 |
+
display: flex;
|
| 485 |
+
flex-direction: column;
|
| 486 |
+
align-items: center;
|
| 487 |
+
justify-content: center;
|
| 488 |
+
padding: 100px 0;
|
| 489 |
+
background-color: #fff;
|
| 490 |
+
border-radius: 8px;
|
| 491 |
+
margin-top: 20px;
|
| 492 |
+
}
|
| 493 |
+
|
| 494 |
+
.empty-image {
|
| 495 |
+
width: 120px;
|
| 496 |
+
height: 120px;
|
| 497 |
+
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%23d1d5db" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"><path d="M22 12h-4l-3 9L9 3l-3 9H2"/></svg>');
|
| 498 |
+
background-repeat: no-repeat;
|
| 499 |
+
background-position: center;
|
| 500 |
+
background-size: contain;
|
| 501 |
+
margin-bottom: 20px;
|
| 502 |
+
opacity: 0.5;
|
| 503 |
+
}
|
| 504 |
+
|
| 505 |
+
.empty-text {
|
| 506 |
+
color: #9ca3af;
|
| 507 |
+
font-size: 14px;
|
| 508 |
+
}
|
| 509 |
+
|
| 510 |
+
/* 上传弹窗样式 */
|
| 511 |
+
.upload-modal {
|
| 512 |
+
position: fixed;
|
| 513 |
+
top: 0;
|
| 514 |
+
left: 0;
|
| 515 |
+
width: 100%;
|
| 516 |
+
height: 100%;
|
| 517 |
+
background-color: rgba(0, 0, 0, 0.5);
|
| 518 |
+
display: flex;
|
| 519 |
+
justify-content: center;
|
| 520 |
+
align-items: center;
|
| 521 |
+
z-index: 1000;
|
| 522 |
+
}
|
| 523 |
+
|
| 524 |
+
.upload-modal-content {
|
| 525 |
+
background-color: white;
|
| 526 |
+
border-radius: 8px;
|
| 527 |
+
width: 500px;
|
| 528 |
+
max-width: 90%;
|
| 529 |
+
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
|
| 530 |
+
overflow: hidden;
|
| 531 |
+
}
|
| 532 |
+
|
| 533 |
+
.modal-header {
|
| 534 |
+
display: flex;
|
| 535 |
+
justify-content: space-between;
|
| 536 |
+
align-items: center;
|
| 537 |
+
padding: 15px 20px;
|
| 538 |
+
border-bottom: 1px solid #eee;
|
| 539 |
+
}
|
| 540 |
+
|
| 541 |
+
.modal-header h3 {
|
| 542 |
+
margin: 0;
|
| 543 |
+
font-size: 18px;
|
| 544 |
+
font-weight: 500;
|
| 545 |
+
}
|
| 546 |
+
|
| 547 |
+
.close-btn {
|
| 548 |
+
background: none;
|
| 549 |
+
border: none;
|
| 550 |
+
font-size: 20px;
|
| 551 |
+
cursor: pointer;
|
| 552 |
+
color: #999;
|
| 553 |
+
}
|
| 554 |
+
|
| 555 |
+
.modal-body {
|
| 556 |
+
padding: 20px;
|
| 557 |
+
}
|
| 558 |
+
|
| 559 |
+
.filename-input {
|
| 560 |
+
margin-bottom: 15px;
|
| 561 |
+
}
|
| 562 |
+
|
| 563 |
+
.filename-field {
|
| 564 |
+
width: 100%;
|
| 565 |
+
padding: 8px 12px;
|
| 566 |
+
border: 1px solid #ddd;
|
| 567 |
+
border-radius: 4px;
|
| 568 |
+
font-size: 14px;
|
| 569 |
+
}
|
| 570 |
+
|
| 571 |
+
.upload-area {
|
| 572 |
+
border: 2px dashed #ddd;
|
| 573 |
+
border-radius: 8px;
|
| 574 |
+
padding: 30px;
|
| 575 |
+
text-align: center;
|
| 576 |
+
cursor: pointer;
|
| 577 |
+
margin-bottom: 20px;
|
| 578 |
+
min-height: 200px;
|
| 579 |
+
display: flex;
|
| 580 |
+
align-items: center;
|
| 581 |
+
justify-content: center;
|
| 582 |
+
}
|
| 583 |
+
|
| 584 |
+
.upload-area:hover {
|
| 585 |
+
border-color: #6366f1;
|
| 586 |
+
}
|
| 587 |
+
|
| 588 |
+
.upload-placeholder {
|
| 589 |
+
color: #666;
|
| 590 |
+
}
|
| 591 |
+
|
| 592 |
+
.upload-hint {
|
| 593 |
+
margin-top: 10px;
|
| 594 |
+
font-size: 12px;
|
| 595 |
+
color: #999;
|
| 596 |
+
}
|
| 597 |
+
|
| 598 |
+
.preview-container {
|
| 599 |
+
position: relative;
|
| 600 |
+
width: 100%;
|
| 601 |
+
height: 100%;
|
| 602 |
+
min-height: 150px;
|
| 603 |
+
display: flex;
|
| 604 |
+
align-items: center;
|
| 605 |
+
justify-content: center;
|
| 606 |
+
}
|
| 607 |
+
|
| 608 |
+
.file-preview {
|
| 609 |
+
max-width: 100%;
|
| 610 |
+
max-height: 200px;
|
| 611 |
+
object-fit: contain;
|
| 612 |
+
}
|
| 613 |
+
|
| 614 |
+
.remove-file-btn {
|
| 615 |
+
position: absolute;
|
| 616 |
+
top: 5px;
|
| 617 |
+
right: 5px;
|
| 618 |
+
width: 24px;
|
| 619 |
+
height: 24px;
|
| 620 |
+
border-radius: 50%;
|
| 621 |
+
background-color: rgba(0, 0, 0, 0.5);
|
| 622 |
+
color: white;
|
| 623 |
+
border: none;
|
| 624 |
+
display: flex;
|
| 625 |
+
align-items: center;
|
| 626 |
+
justify-content: center;
|
| 627 |
+
cursor: pointer;
|
| 628 |
+
font-size: 16px;
|
| 629 |
+
}
|
| 630 |
+
|
| 631 |
+
.modal-footer {
|
| 632 |
+
display: flex;
|
| 633 |
+
justify-content: flex-end;
|
| 634 |
+
gap: 10px;
|
| 635 |
+
margin-top: 20px;
|
| 636 |
+
}
|
| 637 |
+
|
| 638 |
+
.cancel-btn {
|
| 639 |
+
padding: 8px 15px;
|
| 640 |
+
border: 1px solid #ddd;
|
| 641 |
+
border-radius: 4px;
|
| 642 |
+
background-color: white;
|
| 643 |
+
cursor: pointer;
|
| 644 |
+
}
|
| 645 |
+
|
| 646 |
+
.upload-submit-btn {
|
| 647 |
+
padding: 8px 15px;
|
| 648 |
+
border: none;
|
| 649 |
+
border-radius: 4px;
|
| 650 |
+
background-color: #6366f1;
|
| 651 |
+
color: white;
|
| 652 |
+
cursor: pointer;
|
| 653 |
+
}
|
| 654 |
+
|
| 655 |
+
.upload-submit-btn:disabled {
|
| 656 |
+
background-color: #a5a6f6;
|
| 657 |
+
cursor: not-allowed;
|
| 658 |
+
}
|
| 659 |
+
|
| 660 |
+
/* 搜索框样式 */
|
| 661 |
+
.search-container {
|
| 662 |
+
position: relative;
|
| 663 |
+
flex-grow: 1;
|
| 664 |
+
max-width: 300px;
|
| 665 |
+
}
|
| 666 |
+
|
| 667 |
+
.search-input {
|
| 668 |
+
width: 100%;
|
| 669 |
+
padding: 8px 12px 8px 30px;
|
| 670 |
+
border: 1px solid #e0e0e0;
|
| 671 |
+
border-radius: 4px;
|
| 672 |
+
font-size: 14px;
|
| 673 |
+
outline: none;
|
| 674 |
+
}
|
| 675 |
+
|
| 676 |
+
.search-input:focus {
|
| 677 |
+
border-color: #6366f1;
|
| 678 |
+
}
|
| 679 |
+
|
| 680 |
+
.search-icon {
|
| 681 |
+
position: absolute;
|
| 682 |
+
left: 10px;
|
| 683 |
+
top: 50%;
|
| 684 |
+
transform: translateY(-50%);
|
| 685 |
+
font-size: 14px;
|
| 686 |
+
color: #999;
|
| 687 |
+
}
|
| 688 |
+
</style>
|
sau_frontend/src/components/MultiPublishView.vue
ADDED
|
@@ -0,0 +1,2303 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<template>
|
| 2 |
+
<div class="multi-publish-container">
|
| 3 |
+
<h1>多平台发布</h1>
|
| 4 |
+
|
| 5 |
+
<!-- 添加发布按钮 -->
|
| 6 |
+
<div class="action-bar">
|
| 7 |
+
<button class="add-publish-btn" @click="showPlatformModal">
|
| 8 |
+
<i class="add-icon">+</i> 添加发布
|
| 9 |
+
</button>
|
| 10 |
+
</div>
|
| 11 |
+
|
| 12 |
+
<!-- 平台选择弹窗 -->
|
| 13 |
+
<div class="platform-modal" v-if="isPlatformModalVisible" @click="closeModalOnOutsideClick">
|
| 14 |
+
<div class="platform-modal-content">
|
| 15 |
+
<div class="modal-header">
|
| 16 |
+
<h3>选择平台</h3>
|
| 17 |
+
<button class="close-btn" @click="hidePlatformModal">×</button>
|
| 18 |
+
</div>
|
| 19 |
+
<div class="modal-body">
|
| 20 |
+
<div class="platform-options">
|
| 21 |
+
<div class="platform-option" :class="{ 'selected': selectedPlatform === 3 }"
|
| 22 |
+
@click="selectPlatform(3)">
|
| 23 |
+
<div class="platform-icon douyin-icon"></div>
|
| 24 |
+
<span>抖音</span>
|
| 25 |
+
</div>
|
| 26 |
+
<div class="platform-option" :class="{ 'selected': selectedPlatform === 4 }"
|
| 27 |
+
@click="selectPlatform(4)">
|
| 28 |
+
<div class="platform-icon kuaishou-icon"></div>
|
| 29 |
+
<span>快手</span>
|
| 30 |
+
</div>
|
| 31 |
+
<div class="platform-option" :class="{ 'selected': selectedPlatform === 1 }"
|
| 32 |
+
@click="selectPlatform(1)">
|
| 33 |
+
<div class="platform-icon xiaohongshu-icon"></div>
|
| 34 |
+
<span>小红书</span>
|
| 35 |
+
</div>
|
| 36 |
+
<div class="platform-option" :class="{ 'selected': selectedPlatform === 2 }"
|
| 37 |
+
@click="selectPlatform(2)">
|
| 38 |
+
<div class="platform-icon shipinhao-icon"></div>
|
| 39 |
+
<span>视频号</span>
|
| 40 |
+
</div>
|
| 41 |
+
</div>
|
| 42 |
+
</div>
|
| 43 |
+
<div class="modal-footer">
|
| 44 |
+
<button class="cancel-btn" @click="hidePlatformModal">取消</button>
|
| 45 |
+
<button class="confirm-btn" @click="confirmPlatformSelection">确认</button>
|
| 46 |
+
</div>
|
| 47 |
+
</div>
|
| 48 |
+
</div>
|
| 49 |
+
|
| 50 |
+
<!-- 发布卡片容器 -->
|
| 51 |
+
<div class="publish-cards-container">
|
| 52 |
+
<!-- 滚动控制按钮 -->
|
| 53 |
+
<button v-if="publishCards.length > 2" class="scroll-btn scroll-left" @click="scrollLeft">
|
| 54 |
+
<span><</span>
|
| 55 |
+
</button>
|
| 56 |
+
|
| 57 |
+
<!-- 卡片滚动区域 -->
|
| 58 |
+
<div class="cards-scroll-area" ref="cardsContainer">
|
| 59 |
+
<div v-if="publishCards.length === 0" class="empty-state">
|
| 60 |
+
<p>暂无发布卡片,点击"添加发布"创建新卡片</p>
|
| 61 |
+
</div>
|
| 62 |
+
|
| 63 |
+
<div v-for="(card, index) in publishCards" :key="card.id" class="publish-card">
|
| 64 |
+
<!-- 卡片头部 -->
|
| 65 |
+
<div class="card-header">
|
| 66 |
+
<div class="platform-info">
|
| 67 |
+
<div :class="['platform-icon', getPlatformIconClass(card.platform)]"></div>
|
| 68 |
+
<span>{{ getPlatformName(card.platform) }}</span>
|
| 69 |
+
</div>
|
| 70 |
+
<div class="card-actions">
|
| 71 |
+
<button class="delete-card-btn" @click="deleteCard(index)">删除</button>
|
| 72 |
+
</div>
|
| 73 |
+
</div>
|
| 74 |
+
|
| 75 |
+
<!-- 卡片内容 -->
|
| 76 |
+
<div class="card-content">
|
| 77 |
+
<!-- 账号选择 -->
|
| 78 |
+
<div class="card-section">
|
| 79 |
+
<div class="section-title">账号</div>
|
| 80 |
+
<div class="account-selector" @click="showAccountSelector(index)">
|
| 81 |
+
<div v-if="!card.selectedAccount" class="account-placeholder">
|
| 82 |
+
<span>+ 选择账号</span>
|
| 83 |
+
</div>
|
| 84 |
+
<div v-else class="selected-account">
|
| 85 |
+
<img :src="card.selectedAccount.avatar" alt="账号头像" class="account-avatar" />
|
| 86 |
+
<span class="account-name">{{ card.selectedAccount.name }}</span>
|
| 87 |
+
<span class="account-status"
|
| 88 |
+
:class="card.selectedAccount.statusType">{{ card.selectedAccount.status }}</span>
|
| 89 |
+
</div>
|
| 90 |
+
</div>
|
| 91 |
+
</div>
|
| 92 |
+
|
| 93 |
+
<!-- 发布类型选择 -->
|
| 94 |
+
<div class="card-section">
|
| 95 |
+
<div class="section-title">发布类型</div>
|
| 96 |
+
<div class="publish-type-selector">
|
| 97 |
+
<button class="type-btn" :class="{ 'active': card.publishType === 'video' }"
|
| 98 |
+
@click="setPublishType(index, 'video')">
|
| 99 |
+
视频
|
| 100 |
+
</button>
|
| 101 |
+
<button class="type-btn" :class="{ 'active': card.publishType === 'image' }"
|
| 102 |
+
@click="setPublishType(index, 'image')">
|
| 103 |
+
图文
|
| 104 |
+
</button>
|
| 105 |
+
</div>
|
| 106 |
+
</div>
|
| 107 |
+
|
| 108 |
+
<!-- 媒体上传区域 -->
|
| 109 |
+
<div class="card-section media-section">
|
| 110 |
+
<div class="section-title">{{ card.publishType === 'video' ? '视频' : '图片' }}</div>
|
| 111 |
+
<div class="media-upload-container">
|
| 112 |
+
<!-- 视频上传区域 -->
|
| 113 |
+
<div v-if="card.publishType === 'video'" class="videos-container">
|
| 114 |
+
<div class="video-upload-area" @click="triggerMediaUpload(index)"
|
| 115 |
+
v-if="card.mediaList.length < 5">
|
| 116 |
+
<div class="upload-icon">
|
| 117 |
+
<span class="icon">↑</span>
|
| 118 |
+
<span class="text">上传</span>
|
| 119 |
+
</div>
|
| 120 |
+
</div>
|
| 121 |
+
<div v-for="(media, mediaIndex) in card.mediaList" :key="mediaIndex"
|
| 122 |
+
class="video-preview media-item">
|
| 123 |
+
<video controls :src="media.previewUrl"></video>
|
| 124 |
+
<div class="media-actions">
|
| 125 |
+
<button class="remove-btn"
|
| 126 |
+
@click.stop="removeMedia(index, mediaIndex)">删除</button>
|
| 127 |
+
</div>
|
| 128 |
+
</div>
|
| 129 |
+
</div>
|
| 130 |
+
|
| 131 |
+
<!-- 图片上传区域 -->
|
| 132 |
+
<div v-else class="images-container">
|
| 133 |
+
<div class="image-upload-area" @click="triggerMediaUpload(index)"
|
| 134 |
+
v-if="card.mediaList.length < 9">
|
| 135 |
+
<div class="upload-icon">
|
| 136 |
+
<span class="icon">↑</span>
|
| 137 |
+
<span class="text">上传</span>
|
| 138 |
+
</div>
|
| 139 |
+
</div>
|
| 140 |
+
<div v-for="(media, mediaIndex) in card.mediaList" :key="mediaIndex"
|
| 141 |
+
class="image-preview">
|
| 142 |
+
<img :src="media.previewUrl" alt="预览图片" />
|
| 143 |
+
<div class="media-actions">
|
| 144 |
+
<button class="remove-btn"
|
| 145 |
+
@click.stop="removeMedia(index, mediaIndex)">删除</button>
|
| 146 |
+
</div>
|
| 147 |
+
</div>
|
| 148 |
+
</div>
|
| 149 |
+
</div>
|
| 150 |
+
<div class="media-count" v-if="card.mediaList.length > 0">
|
| 151 |
+
已上传 {{ card.mediaList.length }} 个{{ card.publishType === 'video' ? '视频' : '图片' }}
|
| 152 |
+
(最多{{ card.publishType === 'video' ? '5' : '9' }}个)
|
| 153 |
+
</div>
|
| 154 |
+
</div>
|
| 155 |
+
|
| 156 |
+
<!-- 标题输入区域 -->
|
| 157 |
+
<div class="card-section">
|
| 158 |
+
<div class="section-title">标题</div>
|
| 159 |
+
<div class="title-input-container">
|
| 160 |
+
<textarea v-model="card.title" @input="updateCharCount(index)" placeholder="请输入标题"
|
| 161 |
+
maxlength="100" rows="2"></textarea>
|
| 162 |
+
<div class="char-count">{{ card.charCount }}/100</div>
|
| 163 |
+
</div>
|
| 164 |
+
</div>
|
| 165 |
+
|
| 166 |
+
<!-- 话题选择区域 -->
|
| 167 |
+
<div class="card-section">
|
| 168 |
+
<div class="section-title">话题</div>
|
| 169 |
+
<div class="tags-container">
|
| 170 |
+
<div v-for="(tag, tagIndex) in card.tags" :key="tagIndex" class="tag">
|
| 171 |
+
{{ tag }}
|
| 172 |
+
<span class="remove-tag" @click="removeTag(index, tagIndex)">×</span>
|
| 173 |
+
</div>
|
| 174 |
+
<div class="add-tag" @click="showTagSelector(index)">+ 添加话题</div>
|
| 175 |
+
</div>
|
| 176 |
+
</div>
|
| 177 |
+
|
| 178 |
+
<!-- 定时发布设置 -->
|
| 179 |
+
<div class="card-section">
|
| 180 |
+
<div class="section-title">
|
| 181 |
+
<div class="timer-toggle">
|
| 182 |
+
<label class="switch">
|
| 183 |
+
<input type="checkbox" v-model="card.enableTimer" @change="toggleTimer(index)">
|
| 184 |
+
<span class="slider round"></span>
|
| 185 |
+
</label>
|
| 186 |
+
<span class="toggle-label">定时发布</span>
|
| 187 |
+
</div>
|
| 188 |
+
</div>
|
| 189 |
+
<div v-if="card.enableTimer" class="timer-settings">
|
| 190 |
+
<div class="setting-item">
|
| 191 |
+
<label class="setting-label">每天发布视频数</label>
|
| 192 |
+
<select v-model="card.videosPerDay" @change="updateDailyTimes(index)" class="setting-select">
|
| 193 |
+
<option value="1">1个</option>
|
| 194 |
+
<option value="2">2个</option>
|
| 195 |
+
<option value="3">3个</option>
|
| 196 |
+
<option value="4">4个</option>
|
| 197 |
+
<option value="5">5个</option>
|
| 198 |
+
</select>
|
| 199 |
+
</div>
|
| 200 |
+
<div class="setting-item">
|
| 201 |
+
<label class="setting-label">每天发布时间</label>
|
| 202 |
+
<div class="time-slots">
|
| 203 |
+
<input v-for="(time, timeIndex) in card.dailyTimes" :key="timeIndex" type="time"
|
| 204 |
+
v-model="card.dailyTimes[timeIndex]" class="time-input">
|
| 205 |
+
</div>
|
| 206 |
+
</div>
|
| 207 |
+
<div class="setting-item">
|
| 208 |
+
<label class="setting-label">开始天数</label>
|
| 209 |
+
<div class="days-setting">
|
| 210 |
+
<input type="number" v-model="card.startDays" min="1" max="30" class="days-input">
|
| 211 |
+
<span class="days-unit">天后开始</span>
|
| 212 |
+
</div>
|
| 213 |
+
</div>
|
| 214 |
+
</div>
|
| 215 |
+
</div>
|
| 216 |
+
|
| 217 |
+
<!-- 发布按钮 -->
|
| 218 |
+
<div class="card-actions-bottom">
|
| 219 |
+
<button class="publish-btn" @click="publishContent(index)"
|
| 220 |
+
:disabled="!isCardValid(card) || card.isUploading">
|
| 221 |
+
{{ card.isUploading ? '上传中...' : '发布' }}
|
| 222 |
+
</button>
|
| 223 |
+
</div>
|
| 224 |
+
</div>
|
| 225 |
+
</div>
|
| 226 |
+
</div>
|
| 227 |
+
|
| 228 |
+
<!-- 滚动控制按钮 -->
|
| 229 |
+
<button v-if="publishCards.length > 2" class="scroll-btn scroll-right" @click="scrollRight">
|
| 230 |
+
<span>></span>
|
| 231 |
+
</button>
|
| 232 |
+
</div>
|
| 233 |
+
|
| 234 |
+
<!-- 账号选择弹窗 -->
|
| 235 |
+
<div class="account-selector-modal" v-if="isAccountSelectorVisible" @click="closeAccountModalOnOutsideClick">
|
| 236 |
+
<div class="account-selector-content">
|
| 237 |
+
<div class="modal-header">
|
| 238 |
+
<h3>选择账号</h3>
|
| 239 |
+
<button class="refresh-btn" @click.stop="refreshAccounts" title="刷新账号列表">
|
| 240 |
+
<span class="refresh-icon">↻</span>
|
| 241 |
+
</button>
|
| 242 |
+
<button class="close-btn" @click="hideAccountSelector">×</button>
|
| 243 |
+
</div>
|
| 244 |
+
<div class="modal-body">
|
| 245 |
+
<div v-if="isAccountsLoading" class="loading-accounts">
|
| 246 |
+
<span>加载账号中...</span>
|
| 247 |
+
</div>
|
| 248 |
+
<div v-else-if="filteredAccountList.length === 0" class="no-accounts">
|
| 249 |
+
<span>暂无可用账号</span>
|
| 250 |
+
</div>
|
| 251 |
+
<div v-else class="account-list">
|
| 252 |
+
<div v-for="account in filteredAccountList" :key="account.id" class="account-item"
|
| 253 |
+
@click="selectAccount(account)">
|
| 254 |
+
<img :src="account.avatar" alt="账号头像" class="account-avatar" />
|
| 255 |
+
<div class="account-info">
|
| 256 |
+
<div class="account-name">{{ account.name }}</div>
|
| 257 |
+
<div class="account-status" :class="account.statusType">{{ account.status }}</div>
|
| 258 |
+
</div>
|
| 259 |
+
</div>
|
| 260 |
+
</div>
|
| 261 |
+
</div>
|
| 262 |
+
</div>
|
| 263 |
+
</div>
|
| 264 |
+
|
| 265 |
+
<!-- 话题选择弹窗 -->
|
| 266 |
+
<div class="tag-selector-modal" v-if="isTagSelectorVisible" @click="closeTagSelectorOnOutsideClick">
|
| 267 |
+
<div class="tag-selector-content">
|
| 268 |
+
<div class="modal-header">
|
| 269 |
+
<h3>选择话题</h3>
|
| 270 |
+
<button class="close-btn" @click="hideTagSelector">×</button>
|
| 271 |
+
</div>
|
| 272 |
+
<div class="modal-body">
|
| 273 |
+
<div class="custom-tag-input">
|
| 274 |
+
<input v-model="customTag" placeholder="输入自定义话题" @keyup.enter="addCustomTag" />
|
| 275 |
+
<button @click="addCustomTag">添加</button>
|
| 276 |
+
</div>
|
| 277 |
+
<div class="suggested-tags">
|
| 278 |
+
<h4>推荐话题</h4>
|
| 279 |
+
<div class="tag-grid">
|
| 280 |
+
<div v-for="tag in suggestedTags" :key="tag" class="suggested-tag"
|
| 281 |
+
@click="addSuggestedTag(tag)">
|
| 282 |
+
{{ tag }}
|
| 283 |
+
</div>
|
| 284 |
+
</div>
|
| 285 |
+
</div>
|
| 286 |
+
</div>
|
| 287 |
+
</div>
|
| 288 |
+
</div>
|
| 289 |
+
|
| 290 |
+
<!-- 视频来源选择器 -->
|
| 291 |
+
<div class="source-selector" v-if="isSourceSelectorVisible" @click="hideSourceSelector">
|
| 292 |
+
<div class="source-selector-content" @click.stop>
|
| 293 |
+
<div class="source-option" @click="selectLocalSource">
|
| 294 |
+
<div class="source-icon local-icon">
|
| 295 |
+
<i class="icon-upload">📁</i>
|
| 296 |
+
</div>
|
| 297 |
+
<span class="source-text">本地视频</span>
|
| 298 |
+
</div>
|
| 299 |
+
<div class="source-option" @click="showMaterialLibrary">
|
| 300 |
+
<div class="source-icon library-icon">
|
| 301 |
+
<i class="icon-library">🎬</i>
|
| 302 |
+
</div>
|
| 303 |
+
<span class="source-text">素材库</span>
|
| 304 |
+
</div>
|
| 305 |
+
</div>
|
| 306 |
+
</div>
|
| 307 |
+
|
| 308 |
+
<!-- 素材库选择弹窗 -->
|
| 309 |
+
<div class="material-library-modal" v-if="isMaterialLibraryVisible" @click="closeMaterialLibraryOnOutsideClick">
|
| 310 |
+
<div class="material-library-content">
|
| 311 |
+
<div class="modal-header">
|
| 312 |
+
<h3>选择素材</h3>
|
| 313 |
+
<button class="close-btn" @click="hideMaterialLibrary">×</button>
|
| 314 |
+
</div>
|
| 315 |
+
<div class="modal-body">
|
| 316 |
+
<div v-if="isLoadingMaterials" class="loading-materials">
|
| 317 |
+
<span>加载素材中...</span>
|
| 318 |
+
</div>
|
| 319 |
+
<div v-else-if="materialList.length === 0" class="no-materials">
|
| 320 |
+
<span>暂无可用素材</span>
|
| 321 |
+
</div>
|
| 322 |
+
<div v-else class="material-grid">
|
| 323 |
+
<div v-for="material in materialList" :key="material.id" class="material-item"
|
| 324 |
+
:class="{ 'selected': selectedMaterial === material.id }" @click="selectMaterial(material)">
|
| 325 |
+
<div class="material-checkbox">
|
| 326 |
+
<div class="checkbox" :class="{ 'checked': selectedMaterial === material.id }"></div>
|
| 327 |
+
</div>
|
| 328 |
+
<div class="material-preview">
|
| 329 |
+
<img src="@/assets/bofang.png" alt="播放图标" class="play-icon">
|
| 330 |
+
<button class="delete-btn" @click.stop="deleteMaterial(material)" title="删除素材">×</button>
|
| 331 |
+
</div>
|
| 332 |
+
<div class="material-info">
|
| 333 |
+
<div class="material-name">{{ material.filename }}</div>
|
| 334 |
+
<div class="material-meta">
|
| 335 |
+
<span>{{ formatFileSize(material.filesize) }}</span>
|
| 336 |
+
<span>{{ formatDate(material.upload_time) }}</span>
|
| 337 |
+
</div>
|
| 338 |
+
</div>
|
| 339 |
+
</div>
|
| 340 |
+
</div>
|
| 341 |
+
</div>
|
| 342 |
+
<div class="modal-footer">
|
| 343 |
+
<button class="cancel-btn" @click="hideMaterialLibrary">取消</button>
|
| 344 |
+
<button class="confirm-btn" @click="confirmMaterialSelection"
|
| 345 |
+
:disabled="!selectedMaterial">确认</button>
|
| 346 |
+
</div>
|
| 347 |
+
</div>
|
| 348 |
+
</div>
|
| 349 |
+
|
| 350 |
+
<!-- 隐藏的文件输入 -->
|
| 351 |
+
<input type="file" ref="mediaInput" style="display: none" @change="handleMediaUpload" />
|
| 352 |
+
</div>
|
| 353 |
+
</template>
|
| 354 |
+
|
| 355 |
+
<script setup>
|
| 356 |
+
import {
|
| 357 |
+
ref,
|
| 358 |
+
computed,
|
| 359 |
+
onMounted,
|
| 360 |
+
onUnmounted,
|
| 361 |
+
watch
|
| 362 |
+
} from 'vue';
|
| 363 |
+
import {
|
| 364 |
+
globalAccountsCache
|
| 365 |
+
} from '../config';
|
| 366 |
+
import axios from 'axios';
|
| 367 |
+
import tx from '@assets/fengbaobao.png'
|
| 368 |
+
|
| 369 |
+
// 推荐话题列表
|
| 370 |
+
const suggestedTags = ['游戏', '电影', '音乐', '美食', '旅行', '文化', '科技', '生活', '娱乐', '体育', '教育', '艺术', '健康', '时尚'];
|
| 371 |
+
|
| 372 |
+
// 平台弹窗状态
|
| 373 |
+
const isPlatformModalVisible = ref(false);
|
| 374 |
+
const selectedPlatform = ref(null);
|
| 375 |
+
|
| 376 |
+
// 账号选择状态
|
| 377 |
+
const isAccountSelectorVisible = ref(false);
|
| 378 |
+
const isAccountsLoading = ref(false);
|
| 379 |
+
const accountList = ref([]);
|
| 380 |
+
const currentCardIndex = ref(-1);
|
| 381 |
+
|
| 382 |
+
// 话题选择状态
|
| 383 |
+
const isTagSelectorVisible = ref(false);
|
| 384 |
+
const customTag = ref('');
|
| 385 |
+
|
| 386 |
+
// 媒体上传
|
| 387 |
+
const mediaInput = ref(null);
|
| 388 |
+
const currentUploadCardIndex = ref(-1);
|
| 389 |
+
|
| 390 |
+
// 卡片容器引用
|
| 391 |
+
const cardsContainer = ref(null);
|
| 392 |
+
|
| 393 |
+
// 发布卡片列表
|
| 394 |
+
const publishCards = ref([]);
|
| 395 |
+
|
| 396 |
+
// 显示平台选择弹窗
|
| 397 |
+
const showPlatformModal = () => {
|
| 398 |
+
isPlatformModalVisible.value = true;
|
| 399 |
+
selectedPlatform.value = null;
|
| 400 |
+
};
|
| 401 |
+
|
| 402 |
+
// 隐藏平台选择弹窗
|
| 403 |
+
const hidePlatformModal = () => {
|
| 404 |
+
isPlatformModalVisible.value = false;
|
| 405 |
+
};
|
| 406 |
+
|
| 407 |
+
// 点击弹窗外部关闭
|
| 408 |
+
const closeModalOnOutsideClick = (event) => {
|
| 409 |
+
if (event.target.classList.contains('platform-modal')) {
|
| 410 |
+
hidePlatformModal();
|
| 411 |
+
}
|
| 412 |
+
};
|
| 413 |
+
|
| 414 |
+
// 选择平台
|
| 415 |
+
const selectPlatform = (platformId) => {
|
| 416 |
+
selectedPlatform.value = platformId;
|
| 417 |
+
};
|
| 418 |
+
|
| 419 |
+
// 确认平台选择并创建卡片
|
| 420 |
+
const confirmPlatformSelection = () => {
|
| 421 |
+
if (selectedPlatform.value) {
|
| 422 |
+
// 创建新的发布卡片
|
| 423 |
+
const newCard = {
|
| 424 |
+
id: Date.now().toString(),
|
| 425 |
+
platform: selectedPlatform.value,
|
| 426 |
+
selectedAccount: null,
|
| 427 |
+
publishType: 'video', // 默认为视频类型
|
| 428 |
+
mediaList: [],
|
| 429 |
+
title: '',
|
| 430 |
+
charCount: 0,
|
| 431 |
+
tags: [],
|
| 432 |
+
isUploading: false,
|
| 433 |
+
file_list: [], // 保存上传后的fileID
|
| 434 |
+
// 定时发布相关属性
|
| 435 |
+
enableTimer: false,
|
| 436 |
+
videosPerDay: 1,
|
| 437 |
+
dailyTimes: ['09:00'],
|
| 438 |
+
startDays: 1
|
| 439 |
+
};
|
| 440 |
+
|
| 441 |
+
publishCards.value.push(newCard);
|
| 442 |
+
hidePlatformModal();
|
| 443 |
+
} else {
|
| 444 |
+
alert('请选择一个平台');
|
| 445 |
+
}
|
| 446 |
+
};
|
| 447 |
+
|
| 448 |
+
// 删除卡片
|
| 449 |
+
const deleteCard = (index) => {
|
| 450 |
+
// 清理媒体资源
|
| 451 |
+
publishCards.value[index].mediaList.forEach(media => {
|
| 452 |
+
if (media.previewUrl) {
|
| 453 |
+
URL.revokeObjectURL(media.previewUrl);
|
| 454 |
+
}
|
| 455 |
+
});
|
| 456 |
+
|
| 457 |
+
// 移除卡片
|
| 458 |
+
publishCards.value.splice(index, 1);
|
| 459 |
+
};
|
| 460 |
+
|
| 461 |
+
// 获取平台名称
|
| 462 |
+
const getPlatformName = (platformId) => {
|
| 463 |
+
switch (platformId) {
|
| 464 |
+
case 3:
|
| 465 |
+
return '抖音';
|
| 466 |
+
case 4:
|
| 467 |
+
return '快手';
|
| 468 |
+
case 1:
|
| 469 |
+
return '小红书';
|
| 470 |
+
case 2:
|
| 471 |
+
return '视频号';
|
| 472 |
+
default:
|
| 473 |
+
return '未知平台';
|
| 474 |
+
}
|
| 475 |
+
};
|
| 476 |
+
|
| 477 |
+
// 获取平台图标类名
|
| 478 |
+
const getPlatformIconClass = (platformId) => {
|
| 479 |
+
switch (platformId) {
|
| 480 |
+
case 3:
|
| 481 |
+
return 'douyin-icon';
|
| 482 |
+
case 4:
|
| 483 |
+
return 'kuaishou-icon';
|
| 484 |
+
case 1:
|
| 485 |
+
return 'xiaohongshu-icon';
|
| 486 |
+
case 2:
|
| 487 |
+
return 'shipinhao-icon';
|
| 488 |
+
default:
|
| 489 |
+
return '';
|
| 490 |
+
}
|
| 491 |
+
};
|
| 492 |
+
|
| 493 |
+
// 设置发布类型
|
| 494 |
+
const setPublishType = (cardIndex, type) => {
|
| 495 |
+
const card = publishCards.value[cardIndex];
|
| 496 |
+
|
| 497 |
+
// 如果类型不同,清空已上传的媒体
|
| 498 |
+
if (card.publishType !== type) {
|
| 499 |
+
// 清理媒体资源
|
| 500 |
+
card.mediaList.forEach(media => {
|
| 501 |
+
if (media.previewUrl) {
|
| 502 |
+
URL.revokeObjectURL(media.previewUrl);
|
| 503 |
+
}
|
| 504 |
+
});
|
| 505 |
+
|
| 506 |
+
card.mediaList = [];
|
| 507 |
+
card.file_list = [];
|
| 508 |
+
}
|
| 509 |
+
|
| 510 |
+
card.publishType = type;
|
| 511 |
+
};
|
| 512 |
+
|
| 513 |
+
// 视频来源选择器相关
|
| 514 |
+
const isSourceSelectorVisible = ref(false); // 视频来源选择器是否可见
|
| 515 |
+
const currentSourceCardIndex = ref(-1); // 当前操作的卡片索引
|
| 516 |
+
|
| 517 |
+
// 素材库选择相关
|
| 518 |
+
const isMaterialLibraryVisible = ref(false); // 素材库选择器是否可见
|
| 519 |
+
const isLoadingMaterials = ref(false); // 素材加载状态
|
| 520 |
+
const materialList = ref([]); // 素材列表
|
| 521 |
+
const selectedMaterial = ref(null); // 选中的素材ID
|
| 522 |
+
|
| 523 |
+
// 触发媒体上传
|
| 524 |
+
const triggerMediaUpload = (cardIndex) => {
|
| 525 |
+
currentUploadCardIndex.value = cardIndex;
|
| 526 |
+
|
| 527 |
+
// 设置接受的文件类型
|
| 528 |
+
const card = publishCards.value[cardIndex];
|
| 529 |
+
if (card.publishType === 'video') {
|
| 530 |
+
// 显示视频来源选择器
|
| 531 |
+
currentSourceCardIndex.value = cardIndex;
|
| 532 |
+
isSourceSelectorVisible.value = true;
|
| 533 |
+
} else {
|
| 534 |
+
// 图片直接触发上传
|
| 535 |
+
mediaInput.value.accept = 'image/*';
|
| 536 |
+
mediaInput.value?.click();
|
| 537 |
+
}
|
| 538 |
+
};
|
| 539 |
+
|
| 540 |
+
// 隐藏视频来源选择器
|
| 541 |
+
const hideSourceSelector = () => {
|
| 542 |
+
isSourceSelectorVisible.value = false;
|
| 543 |
+
};
|
| 544 |
+
|
| 545 |
+
// 选择本地视频源
|
| 546 |
+
const selectLocalSource = () => {
|
| 547 |
+
hideSourceSelector();
|
| 548 |
+
mediaInput.value.accept = 'video/*';
|
| 549 |
+
mediaInput.value?.click();
|
| 550 |
+
};
|
| 551 |
+
|
| 552 |
+
// 显示素材库
|
| 553 |
+
const showMaterialLibrary = () => {
|
| 554 |
+
hideSourceSelector();
|
| 555 |
+
isMaterialLibraryVisible.value = true;
|
| 556 |
+
fetchMaterials();
|
| 557 |
+
};
|
| 558 |
+
|
| 559 |
+
// 隐藏素材库
|
| 560 |
+
const hideMaterialLibrary = () => {
|
| 561 |
+
isMaterialLibraryVisible.value = false;
|
| 562 |
+
selectedMaterial.value = null;
|
| 563 |
+
};
|
| 564 |
+
|
| 565 |
+
// 点击素材库外部关闭
|
| 566 |
+
const closeMaterialLibraryOnOutsideClick = (event) => {
|
| 567 |
+
if (event.target.classList.contains('material-library-modal')) {
|
| 568 |
+
hideMaterialLibrary();
|
| 569 |
+
}
|
| 570 |
+
};
|
| 571 |
+
|
| 572 |
+
// 获取素材列表
|
| 573 |
+
const fetchMaterials = async () => {
|
| 574 |
+
isLoadingMaterials.value = true;
|
| 575 |
+
try {
|
| 576 |
+
const response = await axios.get(`/api/getFiles`);
|
| 577 |
+
console.log('获取素材列表响应:', response.data);
|
| 578 |
+
|
| 579 |
+
if (response.data.code === 200) {
|
| 580 |
+
// 处理文件路径,添加完整的请求地址
|
| 581 |
+
const materialItems = (response.data.data || []).map(item => {
|
| 582 |
+
return {
|
| 583 |
+
...item,
|
| 584 |
+
file_path: `/api${item.file_path}` // 添加API前缀到文件路径
|
| 585 |
+
};
|
| 586 |
+
});
|
| 587 |
+
|
| 588 |
+
// 对每个素材调用getFile接口获取视频数据
|
| 589 |
+
const materialPromises = materialItems.map(async (item) => {
|
| 590 |
+
try {
|
| 591 |
+
// 从file_path中提取文件名
|
| 592 |
+
const filename = item.file_path.split('/').pop();
|
| 593 |
+
if (!filename) return item;
|
| 594 |
+
|
| 595 |
+
// 调用getFile接口获取视频数据
|
| 596 |
+
const fileResponse = await axios.get(`/api/getFile`, {
|
| 597 |
+
params: {
|
| 598 |
+
filename: filename
|
| 599 |
+
},
|
| 600 |
+
responseType: 'blob'
|
| 601 |
+
});
|
| 602 |
+
|
| 603 |
+
console.log(`获取素材 ${filename} 数据:`, fileResponse.data);
|
| 604 |
+
|
| 605 |
+
// 创建URL
|
| 606 |
+
const blob = new Blob([fileResponse.data]);
|
| 607 |
+
const url = URL.createObjectURL(blob);
|
| 608 |
+
|
| 609 |
+
// 将获取的视频数据合并到素材对象中
|
| 610 |
+
return {
|
| 611 |
+
...item,
|
| 612 |
+
videoData: {
|
| 613 |
+
...fileResponse.data,
|
| 614 |
+
url: url
|
| 615 |
+
}
|
| 616 |
+
};
|
| 617 |
+
} catch (error) {
|
| 618 |
+
console.error(`获取素材 ${item.filename || item.file_name} 数据失败:`, error);
|
| 619 |
+
return item;
|
| 620 |
+
}
|
| 621 |
+
});
|
| 622 |
+
|
| 623 |
+
// 等待所有getFile请求完成
|
| 624 |
+
materialList.value = await Promise.all(materialPromises);
|
| 625 |
+
|
| 626 |
+
console.log('处理后的素材列表:', materialList.value);
|
| 627 |
+
} else {
|
| 628 |
+
console.error('获取素材列表失败:', response.data.message);
|
| 629 |
+
}
|
| 630 |
+
} catch (error) {
|
| 631 |
+
console.error('获取素材列表失败:', error);
|
| 632 |
+
} finally {
|
| 633 |
+
isLoadingMaterials.value = false;
|
| 634 |
+
}
|
| 635 |
+
};
|
| 636 |
+
|
| 637 |
+
// 选择素材
|
| 638 |
+
const selectMaterial = (material) => {
|
| 639 |
+
// 如果点击的是已选中的素材,则取消选择
|
| 640 |
+
if (selectedMaterial.value === material.id) {
|
| 641 |
+
selectedMaterial.value = null;
|
| 642 |
+
} else {
|
| 643 |
+
selectedMaterial.value = material.id;
|
| 644 |
+
}
|
| 645 |
+
};
|
| 646 |
+
|
| 647 |
+
// 确认素材选择
|
| 648 |
+
const confirmMaterialSelection = () => {
|
| 649 |
+
if (!selectedMaterial.value) return;
|
| 650 |
+
|
| 651 |
+
const material = materialList.value.find(m => m.id === selectedMaterial.value);
|
| 652 |
+
if (material) {
|
| 653 |
+
const cardIndex = currentSourceCardIndex.value;
|
| 654 |
+
const card = publishCards.value[cardIndex];
|
| 655 |
+
|
| 656 |
+
// 从file_path中提取第一个下划线之前的内容作为fileID
|
| 657 |
+
const filePath = material.file_path;
|
| 658 |
+
const fileId = filePath.split('_')[0].split('/').pop();
|
| 659 |
+
console.log('选择的素材ID:', fileId);
|
| 660 |
+
|
| 661 |
+
// 添加到file_list
|
| 662 |
+
if (fileId && !card.file_list.includes(fileId)) {
|
| 663 |
+
card.file_list.push(fileId);
|
| 664 |
+
}
|
| 665 |
+
|
| 666 |
+
// 构建预览URL
|
| 667 |
+
const previewUrl = material.videoData && material.videoData.url ? material.videoData.url : material
|
| 668 |
+
.file_path;
|
| 669 |
+
|
| 670 |
+
// 添加到媒体列表用于预览
|
| 671 |
+
card.mediaList.push({
|
| 672 |
+
previewUrl: previewUrl,
|
| 673 |
+
isFromLibrary: true,
|
| 674 |
+
videoData: material.videoData
|
| 675 |
+
});
|
| 676 |
+
}
|
| 677 |
+
|
| 678 |
+
hideMaterialLibrary();
|
| 679 |
+
};
|
| 680 |
+
|
| 681 |
+
// 判断是否为视频文件
|
| 682 |
+
const isVideo = (filename) => {
|
| 683 |
+
if (!filename) return false;
|
| 684 |
+
const videoExtensions = ['.mp4', '.avi', '.mov', '.wmv', '.flv', '.mkv'];
|
| 685 |
+
return videoExtensions.some(ext => filename.toLowerCase().endsWith(ext));
|
| 686 |
+
};
|
| 687 |
+
|
| 688 |
+
// 处理媒体上传
|
| 689 |
+
const handleMediaUpload = (event) => {
|
| 690 |
+
const input = event.target;
|
| 691 |
+
const cardIndex = currentUploadCardIndex.value;
|
| 692 |
+
|
| 693 |
+
if (cardIndex === -1 || !input.files || input.files.length === 0) return;
|
| 694 |
+
|
| 695 |
+
const card = publishCards.value[cardIndex];
|
| 696 |
+
const file = input.files[0];
|
| 697 |
+
const previewUrl = URL.createObjectURL(file);
|
| 698 |
+
|
| 699 |
+
// 添加到媒体列表
|
| 700 |
+
card.mediaList.push({
|
| 701 |
+
file,
|
| 702 |
+
previewUrl
|
| 703 |
+
});
|
| 704 |
+
|
| 705 |
+
// 清空input,允许再次选择相同文件
|
| 706 |
+
if (mediaInput.value) {
|
| 707 |
+
mediaInput.value.value = '';
|
| 708 |
+
}
|
| 709 |
+
};
|
| 710 |
+
|
| 711 |
+
// 移除媒体
|
| 712 |
+
const removeMedia = (cardIndex, mediaIndex) => {
|
| 713 |
+
const card = publishCards.value[cardIndex];
|
| 714 |
+
|
| 715 |
+
// 释放预览URL
|
| 716 |
+
if (card.mediaList[mediaIndex].previewUrl) {
|
| 717 |
+
URL.revokeObjectURL(card.mediaList[mediaIndex].previewUrl);
|
| 718 |
+
}
|
| 719 |
+
|
| 720 |
+
// 移除媒体
|
| 721 |
+
card.mediaList.splice(mediaIndex, 1);
|
| 722 |
+
};
|
| 723 |
+
|
| 724 |
+
// 更新字符计数
|
| 725 |
+
const updateCharCount = (cardIndex) => {
|
| 726 |
+
const card = publishCards.value[cardIndex];
|
| 727 |
+
card.charCount = card.title.length;
|
| 728 |
+
};
|
| 729 |
+
|
| 730 |
+
// 切换定时发布
|
| 731 |
+
const toggleTimer = (cardIndex) => {
|
| 732 |
+
const card = publishCards.value[cardIndex];
|
| 733 |
+
if (!card.enableTimer) {
|
| 734 |
+
// 重置定时设置
|
| 735 |
+
card.videosPerDay = 1;
|
| 736 |
+
card.dailyTimes = ['09:00'];
|
| 737 |
+
card.startDays = 1;
|
| 738 |
+
}
|
| 739 |
+
};
|
| 740 |
+
|
| 741 |
+
// 更新每日发布时间数组
|
| 742 |
+
const updateDailyTimes = (cardIndex) => {
|
| 743 |
+
const card = publishCards.value[cardIndex];
|
| 744 |
+
const count = parseInt(card.videosPerDay);
|
| 745 |
+
|
| 746 |
+
// 调整时间数组长度
|
| 747 |
+
if (card.dailyTimes.length < count) {
|
| 748 |
+
// 添加新的时间槽
|
| 749 |
+
while (card.dailyTimes.length < count) {
|
| 750 |
+
card.dailyTimes.push('09:00');
|
| 751 |
+
}
|
| 752 |
+
} else if (card.dailyTimes.length > count) {
|
| 753 |
+
// 移除多余的时间槽
|
| 754 |
+
card.dailyTimes.splice(count);
|
| 755 |
+
}
|
| 756 |
+
};
|
| 757 |
+
|
| 758 |
+
// 显示账号选择器
|
| 759 |
+
const showAccountSelector = (cardIndex) => {
|
| 760 |
+
currentCardIndex.value = cardIndex;
|
| 761 |
+
isAccountSelectorVisible.value = true;
|
| 762 |
+
fetchAccounts();
|
| 763 |
+
};
|
| 764 |
+
|
| 765 |
+
// 隐藏账号选择器
|
| 766 |
+
const hideAccountSelector = () => {
|
| 767 |
+
isAccountSelectorVisible.value = false;
|
| 768 |
+
currentCardIndex.value = -1;
|
| 769 |
+
};
|
| 770 |
+
|
| 771 |
+
// 点击账号选择器外部关闭
|
| 772 |
+
const closeAccountModalOnOutsideClick = (event) => {
|
| 773 |
+
if (event.target.classList.contains('account-selector-modal')) {
|
| 774 |
+
hideAccountSelector();
|
| 775 |
+
}
|
| 776 |
+
};
|
| 777 |
+
|
| 778 |
+
// 获取账号列表
|
| 779 |
+
const fetchAccounts = async (forceRefresh = false) => {
|
| 780 |
+
isAccountsLoading.value = true;
|
| 781 |
+
|
| 782 |
+
// 检查全局缓存是否有效且不是强制刷新
|
| 783 |
+
if (!forceRefresh && globalAccountsCache.isValid()) {
|
| 784 |
+
console.log("使用缓存的账号列表数据");
|
| 785 |
+
accountList.value = formatAccountData(globalAccountsCache.accounts);
|
| 786 |
+
isAccountsLoading.value = false;
|
| 787 |
+
return;
|
| 788 |
+
}
|
| 789 |
+
|
| 790 |
+
try {
|
| 791 |
+
const response = await axios.get(`/api/getValidAccounts`);
|
| 792 |
+
|
| 793 |
+
if (response.data.code === 200) {
|
| 794 |
+
// 更新全局缓存
|
| 795 |
+
globalAccountsCache.updateCache(response.data.data);
|
| 796 |
+
|
| 797 |
+
// 格式化账号数据
|
| 798 |
+
accountList.value = formatAccountData(response.data.data);
|
| 799 |
+
}
|
| 800 |
+
} catch (error) {
|
| 801 |
+
console.error('获取账号列表失败:', error);
|
| 802 |
+
accountList.value = [];
|
| 803 |
+
} finally {
|
| 804 |
+
isAccountsLoading.value = false;
|
| 805 |
+
}
|
| 806 |
+
};
|
| 807 |
+
|
| 808 |
+
// 格式化账号数据
|
| 809 |
+
const formatAccountData = (data) => {
|
| 810 |
+
return data.map(account => ({
|
| 811 |
+
id: account[0] || Math.random().toString(36).substr(2, 9),
|
| 812 |
+
name: account[3] || '未命名账号',
|
| 813 |
+
avatar: tx,
|
| 814 |
+
status: account[4] === 1 ? '正常' : '异常',
|
| 815 |
+
statusType: account[4] === 1 ? 'normal' : 'warning',
|
| 816 |
+
type: account[1],
|
| 817 |
+
cookie: account[2] // 保存cookie路径
|
| 818 |
+
}));
|
| 819 |
+
};
|
| 820 |
+
|
| 821 |
+
// 根据当前选中的卡片平台过滤账号列表
|
| 822 |
+
const filteredAccountList = computed(() => {
|
| 823 |
+
if (currentCardIndex.value === -1) return [];
|
| 824 |
+
|
| 825 |
+
const platformId = publishCards.value[currentCardIndex.value].platform;
|
| 826 |
+
return accountList.value.filter(account => account.type === platformId);
|
| 827 |
+
});
|
| 828 |
+
|
| 829 |
+
// 刷新账号列表
|
| 830 |
+
const refreshAccounts = () => {
|
| 831 |
+
fetchAccounts(true); // 强制刷新
|
| 832 |
+
};
|
| 833 |
+
|
| 834 |
+
// 选择账号
|
| 835 |
+
const selectAccount = (account) => {
|
| 836 |
+
if (currentCardIndex.value !== -1) {
|
| 837 |
+
publishCards.value[currentCardIndex.value].selectedAccount = account;
|
| 838 |
+
}
|
| 839 |
+
hideAccountSelector();
|
| 840 |
+
};
|
| 841 |
+
|
| 842 |
+
// 显示话题选择器
|
| 843 |
+
const showTagSelector = (cardIndex) => {
|
| 844 |
+
currentCardIndex.value = cardIndex;
|
| 845 |
+
isTagSelectorVisible.value = true;
|
| 846 |
+
};
|
| 847 |
+
|
| 848 |
+
// 隐藏话题选择器
|
| 849 |
+
const hideTagSelector = () => {
|
| 850 |
+
isTagSelectorVisible.value = false;
|
| 851 |
+
customTag.value = ''; // 清空自定义话题输入
|
| 852 |
+
currentCardIndex.value = -1;
|
| 853 |
+
};
|
| 854 |
+
|
| 855 |
+
// 点击话题选择器外部关闭
|
| 856 |
+
const closeTagSelectorOnOutsideClick = (event) => {
|
| 857 |
+
if (event.target.classList.contains('tag-selector-modal')) {
|
| 858 |
+
hideTagSelector();
|
| 859 |
+
}
|
| 860 |
+
};
|
| 861 |
+
|
| 862 |
+
// 添加预设话题
|
| 863 |
+
const addSuggestedTag = (tag) => {
|
| 864 |
+
if (currentCardIndex.value !== -1) {
|
| 865 |
+
const card = publishCards.value[currentCardIndex.value];
|
| 866 |
+
if (!card.tags.includes(tag)) {
|
| 867 |
+
card.tags.push(tag);
|
| 868 |
+
}
|
| 869 |
+
}
|
| 870 |
+
};
|
| 871 |
+
|
| 872 |
+
// 添加自定义话题
|
| 873 |
+
const addCustomTag = () => {
|
| 874 |
+
if (currentCardIndex.value !== -1 && customTag.value) {
|
| 875 |
+
const card = publishCards.value[currentCardIndex.value];
|
| 876 |
+
if (!card.tags.includes(customTag.value)) {
|
| 877 |
+
card.tags.push(customTag.value);
|
| 878 |
+
customTag.value = ''; // 清空输入
|
| 879 |
+
}
|
| 880 |
+
}
|
| 881 |
+
};
|
| 882 |
+
|
| 883 |
+
// 删除话题
|
| 884 |
+
const removeTag = (cardIndex, tagIndex) => {
|
| 885 |
+
publishCards.value[cardIndex].tags.splice(tagIndex, 1);
|
| 886 |
+
};
|
| 887 |
+
|
| 888 |
+
// 检查卡片是否有效(可发布)
|
| 889 |
+
const isCardValid = (card) => {
|
| 890 |
+
return card.mediaList.length > 0 &&
|
| 891 |
+
card.title &&
|
| 892 |
+
card.selectedAccount !== null;
|
| 893 |
+
};
|
| 894 |
+
|
| 895 |
+
// 发布内容
|
| 896 |
+
const publishContent = async (cardIndex) => {
|
| 897 |
+
const card = publishCards.value[cardIndex];
|
| 898 |
+
console.log('开始发布内容:', card);
|
| 899 |
+
// console.log('账号信息:', publishCards.value);
|
| 900 |
+
|
| 901 |
+
// 验证必填项
|
| 902 |
+
if (card.mediaList.length === 0) {
|
| 903 |
+
alert(`请上传${card.publishType === 'video' ? '视频' : '图片'}`);
|
| 904 |
+
return;
|
| 905 |
+
}
|
| 906 |
+
|
| 907 |
+
if (!card.title) {
|
| 908 |
+
alert('请输入标题');
|
| 909 |
+
return;
|
| 910 |
+
}
|
| 911 |
+
|
| 912 |
+
if (!card.selectedAccount) {
|
| 913 |
+
alert('请选择账号');
|
| 914 |
+
return;
|
| 915 |
+
}
|
| 916 |
+
|
| 917 |
+
// 设置上传状态
|
| 918 |
+
card.isUploading = true;
|
| 919 |
+
|
| 920 |
+
try {
|
| 921 |
+
// 上传所有媒体文件
|
| 922 |
+
for (const mediaItem of card.mediaList) {
|
| 923 |
+
// 创建FormData对象
|
| 924 |
+
const formData = new FormData();
|
| 925 |
+
formData.append('file', mediaItem.file);
|
| 926 |
+
formData.append('filename', mediaItem.file.name);
|
| 927 |
+
|
| 928 |
+
try {
|
| 929 |
+
const response = await axios.post('/api/upload', formData);
|
| 930 |
+
console.log('上传响应:', response.data);
|
| 931 |
+
|
| 932 |
+
// 检查请求是否成功
|
| 933 |
+
if (response.data.code === 200) {
|
| 934 |
+
// 提取fileID并保存
|
| 935 |
+
if (response.data.data) {
|
| 936 |
+
card.file_list.push(response.data.data);
|
| 937 |
+
} else {
|
| 938 |
+
throw new Error('未获取到fileID');
|
| 939 |
+
}
|
| 940 |
+
} else {
|
| 941 |
+
throw new Error(response.data.message || '上传失败');
|
| 942 |
+
}
|
| 943 |
+
} catch (err) {
|
| 944 |
+
console.error('上传失败:', err.response?.data || err.message);
|
| 945 |
+
throw new Error(err.response?.data?.message || err.message || '上传失败');
|
| 946 |
+
}
|
| 947 |
+
}
|
| 948 |
+
|
| 949 |
+
// 准备发布数据
|
| 950 |
+
const postData = {
|
| 951 |
+
fileList: card.file_list,
|
| 952 |
+
accountList: [card.selectedAccount.cookie],
|
| 953 |
+
type: card.platform,
|
| 954 |
+
tags: card.tags,
|
| 955 |
+
title: card.title,
|
| 956 |
+
category: 0
|
| 957 |
+
};
|
| 958 |
+
|
| 959 |
+
// 如果启用定时发布,添加相关参数
|
| 960 |
+
if (card.enableTimer.value) {
|
| 961 |
+
postData.enableTimer = true;
|
| 962 |
+
postData.videos_per_day = card.videosPerDay.value;
|
| 963 |
+
postData.daily_times = card.dailyTimes.value.map(time => {
|
| 964 |
+
const [hours, minutes] = time.split(':');
|
| 965 |
+
return parseInt(hours) * 60 + parseInt(minutes); // 转换为分钟数
|
| 966 |
+
});
|
| 967 |
+
postData.start_days = card.startDays.value;
|
| 968 |
+
} else {
|
| 969 |
+
postData.enableTimer = false;
|
| 970 |
+
}
|
| 971 |
+
|
| 972 |
+
// 发送发布请求
|
| 973 |
+
// 发送发布请求
|
| 974 |
+
const publishResponse = await axios.post('/api/postVideo', postData);
|
| 975 |
+
console.log('发布结果:', publishResponse.data);
|
| 976 |
+
// const apiEndpoint = card.publishType === 'video' ? '/api/postVideo' : '/api/postImage';
|
| 977 |
+
// const publishResponse = await axios.post(apiEndpoint, postData);
|
| 978 |
+
|
| 979 |
+
if (publishResponse.data.code === 200) {
|
| 980 |
+
alert('发布成功!');
|
| 981 |
+
// 删除已发布的卡片
|
| 982 |
+
deleteCard(cardIndex);
|
| 983 |
+
} else {
|
| 984 |
+
throw new Error(publishResponse.data.message || '发布失败');
|
| 985 |
+
}
|
| 986 |
+
} catch (error) {
|
| 987 |
+
console.error(`发布${card.publishType === 'video' ? '视频' : '图文'}失败:`, error);
|
| 988 |
+
alert(`发布失败: ${error instanceof Error ? error.message : '未知错误'}`);
|
| 989 |
+
card.isUploading = false;
|
| 990 |
+
}
|
| 991 |
+
};
|
| 992 |
+
|
| 993 |
+
// 滚动卡片容器
|
| 994 |
+
const scrollLeft = () => {
|
| 995 |
+
if (cardsContainer.value) {
|
| 996 |
+
cardsContainer.value.scrollBy({
|
| 997 |
+
left: -300,
|
| 998 |
+
behavior: 'smooth'
|
| 999 |
+
});
|
| 1000 |
+
}
|
| 1001 |
+
};
|
| 1002 |
+
|
| 1003 |
+
const scrollRight = () => {
|
| 1004 |
+
if (cardsContainer.value) {
|
| 1005 |
+
cardsContainer.value.scrollBy({
|
| 1006 |
+
left: 300,
|
| 1007 |
+
behavior: 'smooth'
|
| 1008 |
+
});
|
| 1009 |
+
}
|
| 1010 |
+
};
|
| 1011 |
+
|
| 1012 |
+
// 状态持久化键名
|
| 1013 |
+
const STORAGE_KEY = 'multi-publish-state';
|
| 1014 |
+
|
| 1015 |
+
// 保存状态到localStorage
|
| 1016 |
+
const saveState = () => {
|
| 1017 |
+
try {
|
| 1018 |
+
const stateToSave = {
|
| 1019 |
+
publishCards: publishCards.value.map(card => ({
|
| 1020 |
+
...card,
|
| 1021 |
+
// 排除不能序列化的属性
|
| 1022 |
+
mediaList: card.mediaList.map(media => ({
|
| 1023 |
+
...media,
|
| 1024 |
+
previewUrl: null, // 预览URL不保存,重新生成
|
| 1025 |
+
file: null // File对象不保存
|
| 1026 |
+
}))
|
| 1027 |
+
}))
|
| 1028 |
+
};
|
| 1029 |
+
localStorage.setItem(STORAGE_KEY, JSON.stringify(stateToSave));
|
| 1030 |
+
} catch (error) {
|
| 1031 |
+
console.warn('保存状态失败:', error);
|
| 1032 |
+
}
|
| 1033 |
+
};
|
| 1034 |
+
|
| 1035 |
+
// 从localStorage恢复状态
|
| 1036 |
+
const restoreState = () => {
|
| 1037 |
+
try {
|
| 1038 |
+
const savedState = localStorage.getItem(STORAGE_KEY);
|
| 1039 |
+
if (savedState) {
|
| 1040 |
+
const parsedState = JSON.parse(savedState);
|
| 1041 |
+
if (parsedState.publishCards && Array.isArray(parsedState.publishCards)) {
|
| 1042 |
+
publishCards.value = parsedState.publishCards;
|
| 1043 |
+
// 重新生成预览URL(如果需要的话)
|
| 1044 |
+
publishCards.value.forEach(card => {
|
| 1045 |
+
card.mediaList.forEach(media => {
|
| 1046 |
+
if (media.isFromLibrary && media.videoData && media.videoData.url) {
|
| 1047 |
+
media.previewUrl = media.videoData.url;
|
| 1048 |
+
}
|
| 1049 |
+
});
|
| 1050 |
+
});
|
| 1051 |
+
}
|
| 1052 |
+
}
|
| 1053 |
+
} catch (error) {
|
| 1054 |
+
console.warn('恢复状态失败:', error);
|
| 1055 |
+
}
|
| 1056 |
+
};
|
| 1057 |
+
|
| 1058 |
+
// 监听状态变化并自动保存
|
| 1059 |
+
watch(publishCards, saveState, {
|
| 1060 |
+
deep: true
|
| 1061 |
+
});
|
| 1062 |
+
|
| 1063 |
+
// 格式化文件大小
|
| 1064 |
+
const formatFileSize = (bytes) => {
|
| 1065 |
+
if (!bytes || bytes === 0) return '0 B';
|
| 1066 |
+
|
| 1067 |
+
const units = ['B', 'KB', 'MB', 'GB'];
|
| 1068 |
+
let size = bytes;
|
| 1069 |
+
let unitIndex = 0;
|
| 1070 |
+
|
| 1071 |
+
while (size >= 1024 && unitIndex < units.length - 1) {
|
| 1072 |
+
size /= 1024;
|
| 1073 |
+
unitIndex++;
|
| 1074 |
+
}
|
| 1075 |
+
|
| 1076 |
+
return `${size.toFixed(2)} ${units[unitIndex]}`;
|
| 1077 |
+
};
|
| 1078 |
+
|
| 1079 |
+
// 格式化日期
|
| 1080 |
+
const formatDate = (timestamp) => {
|
| 1081 |
+
if (!timestamp) return '';
|
| 1082 |
+
|
| 1083 |
+
const date = new Date(timestamp);
|
| 1084 |
+
return date.toLocaleDateString('zh-CN', {
|
| 1085 |
+
year: 'numeric',
|
| 1086 |
+
month: '2-digit',
|
| 1087 |
+
day: '2-digit',
|
| 1088 |
+
hour: '2-digit',
|
| 1089 |
+
minute: '2-digit'
|
| 1090 |
+
});
|
| 1091 |
+
};
|
| 1092 |
+
|
| 1093 |
+
// 删除素材
|
| 1094 |
+
const deleteMaterial = async (material) => {
|
| 1095 |
+
console.log('要删除的素材:', material);
|
| 1096 |
+
if (confirm(`确定要删除素材 ${material.filename || material.file_name} 吗?`)) {
|
| 1097 |
+
try {
|
| 1098 |
+
// 调用删除API
|
| 1099 |
+
const response = await axios.get(`/api/deleteFile?id=${material.id}`);
|
| 1100 |
+
console.log('删除素材响应:', response.data);
|
| 1101 |
+
|
| 1102 |
+
if (response.data.code === 200) {
|
| 1103 |
+
// 删除成功,刷新素材列表
|
| 1104 |
+
fetchMaterials();
|
| 1105 |
+
alert('删除成功');
|
| 1106 |
+
} else {
|
| 1107 |
+
alert('删除失败: ' + (response.data.message || '未知错误'));
|
| 1108 |
+
}
|
| 1109 |
+
} catch (error) {
|
| 1110 |
+
console.error('删除素材失败:', error);
|
| 1111 |
+
alert('删除失败: ' + (error.response?.data?.message || error.message || '未知错误'));
|
| 1112 |
+
}
|
| 1113 |
+
}
|
| 1114 |
+
};
|
| 1115 |
+
|
| 1116 |
+
// 组件挂载时恢复状态
|
| 1117 |
+
onMounted(() => {
|
| 1118 |
+
restoreState();
|
| 1119 |
+
});
|
| 1120 |
+
|
| 1121 |
+
// 组件卸载时清理资源
|
| 1122 |
+
onUnmounted(() => {
|
| 1123 |
+
// 清理所有媒体预览URL
|
| 1124 |
+
publishCards.value.forEach(card => {
|
| 1125 |
+
card.mediaList.forEach(media => {
|
| 1126 |
+
if (media.previewUrl) {
|
| 1127 |
+
URL.revokeObjectURL(media.previewUrl);
|
| 1128 |
+
}
|
| 1129 |
+
});
|
| 1130 |
+
});
|
| 1131 |
+
// 保存最终状态
|
| 1132 |
+
saveState();
|
| 1133 |
+
// 移除事件监听器
|
| 1134 |
+
window.removeEventListener('beforeunload', saveState);
|
| 1135 |
+
});
|
| 1136 |
+
|
| 1137 |
+
// 页面刷新前保存状态
|
| 1138 |
+
window.addEventListener('beforeunload', saveState);
|
| 1139 |
+
</script>
|
| 1140 |
+
|
| 1141 |
+
<style scoped>
|
| 1142 |
+
.multi-publish-container {
|
| 1143 |
+
padding: 20px;
|
| 1144 |
+
}
|
| 1145 |
+
|
| 1146 |
+
h1 {
|
| 1147 |
+
margin-bottom: 20px;
|
| 1148 |
+
font-size: 24px;
|
| 1149 |
+
font-weight: 500;
|
| 1150 |
+
}
|
| 1151 |
+
|
| 1152 |
+
/* 操作栏样式 */
|
| 1153 |
+
.action-bar {
|
| 1154 |
+
display: flex;
|
| 1155 |
+
justify-content: flex-end;
|
| 1156 |
+
margin-bottom: 20px;
|
| 1157 |
+
}
|
| 1158 |
+
|
| 1159 |
+
.add-publish-btn {
|
| 1160 |
+
background-color: #6366f1;
|
| 1161 |
+
color: white;
|
| 1162 |
+
border: none;
|
| 1163 |
+
border-radius: 4px;
|
| 1164 |
+
padding: 8px 15px;
|
| 1165 |
+
display: flex;
|
| 1166 |
+
align-items: center;
|
| 1167 |
+
cursor: pointer;
|
| 1168 |
+
font-size: 14px;
|
| 1169 |
+
}
|
| 1170 |
+
|
| 1171 |
+
.add-icon {
|
| 1172 |
+
margin-right: 5px;
|
| 1173 |
+
font-size: 16px;
|
| 1174 |
+
}
|
| 1175 |
+
|
| 1176 |
+
/* 平台选择弹窗样式 */
|
| 1177 |
+
.platform-modal {
|
| 1178 |
+
position: fixed;
|
| 1179 |
+
top: 0;
|
| 1180 |
+
left: 0;
|
| 1181 |
+
width: 100%;
|
| 1182 |
+
height: 100%;
|
| 1183 |
+
background-color: rgba(0, 0, 0, 0.5);
|
| 1184 |
+
display: flex;
|
| 1185 |
+
justify-content: center;
|
| 1186 |
+
align-items: center;
|
| 1187 |
+
z-index: 1000;
|
| 1188 |
+
}
|
| 1189 |
+
|
| 1190 |
+
.platform-modal-content {
|
| 1191 |
+
background-color: white;
|
| 1192 |
+
border-radius: 8px;
|
| 1193 |
+
width: 400px;
|
| 1194 |
+
max-width: 90%;
|
| 1195 |
+
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
|
| 1196 |
+
overflow: hidden;
|
| 1197 |
+
}
|
| 1198 |
+
|
| 1199 |
+
.modal-header {
|
| 1200 |
+
display: flex;
|
| 1201 |
+
justify-content: space-between;
|
| 1202 |
+
align-items: center;
|
| 1203 |
+
padding: 15px 20px;
|
| 1204 |
+
border-bottom: 1px solid #eee;
|
| 1205 |
+
}
|
| 1206 |
+
|
| 1207 |
+
.modal-header h3 {
|
| 1208 |
+
margin: 0;
|
| 1209 |
+
font-size: 18px;
|
| 1210 |
+
font-weight: 500;
|
| 1211 |
+
}
|
| 1212 |
+
|
| 1213 |
+
.close-btn {
|
| 1214 |
+
background: none;
|
| 1215 |
+
border: none;
|
| 1216 |
+
font-size: 20px;
|
| 1217 |
+
cursor: pointer;
|
| 1218 |
+
color: #999;
|
| 1219 |
+
}
|
| 1220 |
+
|
| 1221 |
+
.modal-body {
|
| 1222 |
+
padding: 20px;
|
| 1223 |
+
}
|
| 1224 |
+
|
| 1225 |
+
.platform-options {
|
| 1226 |
+
display: flex;
|
| 1227 |
+
justify-content: space-around;
|
| 1228 |
+
}
|
| 1229 |
+
|
| 1230 |
+
.platform-option {
|
| 1231 |
+
display: flex;
|
| 1232 |
+
flex-direction: column;
|
| 1233 |
+
align-items: center;
|
| 1234 |
+
padding: 15px;
|
| 1235 |
+
border-radius: 8px;
|
| 1236 |
+
cursor: pointer;
|
| 1237 |
+
transition: all 0.3s;
|
| 1238 |
+
}
|
| 1239 |
+
|
| 1240 |
+
.platform-option:hover {
|
| 1241 |
+
background-color: #f5f5f5;
|
| 1242 |
+
}
|
| 1243 |
+
|
| 1244 |
+
.platform-option.selected {
|
| 1245 |
+
background-color: #e6f7ff;
|
| 1246 |
+
border: 1px solid #91d5ff;
|
| 1247 |
+
}
|
| 1248 |
+
|
| 1249 |
+
.platform-icon {
|
| 1250 |
+
width: 40px;
|
| 1251 |
+
height: 40px;
|
| 1252 |
+
border-radius: 50%;
|
| 1253 |
+
margin-bottom: 10px;
|
| 1254 |
+
display: flex;
|
| 1255 |
+
align-items: center;
|
| 1256 |
+
justify-content: center;
|
| 1257 |
+
}
|
| 1258 |
+
|
| 1259 |
+
.douyin-icon {
|
| 1260 |
+
background-color: #e0e7ff;
|
| 1261 |
+
position: relative;
|
| 1262 |
+
}
|
| 1263 |
+
|
| 1264 |
+
.douyin-icon::before {
|
| 1265 |
+
content: '';
|
| 1266 |
+
width: 20px;
|
| 1267 |
+
height: 20px;
|
| 1268 |
+
background-color: #6366f1;
|
| 1269 |
+
border-radius: 50%;
|
| 1270 |
+
}
|
| 1271 |
+
|
| 1272 |
+
.xiaohongshu-icon {
|
| 1273 |
+
background-color: #fef2f2;
|
| 1274 |
+
position: relative;
|
| 1275 |
+
}
|
| 1276 |
+
|
| 1277 |
+
.xiaohongshu-icon::before {
|
| 1278 |
+
content: '';
|
| 1279 |
+
width: 20px;
|
| 1280 |
+
height: 20px;
|
| 1281 |
+
background-color: #ef4444;
|
| 1282 |
+
border-radius: 50%;
|
| 1283 |
+
}
|
| 1284 |
+
|
| 1285 |
+
.shipinhao-icon {
|
| 1286 |
+
background-color: #ecfdf5;
|
| 1287 |
+
position: relative;
|
| 1288 |
+
}
|
| 1289 |
+
|
| 1290 |
+
.shipinhao-icon::before {
|
| 1291 |
+
content: '';
|
| 1292 |
+
width: 20px;
|
| 1293 |
+
height: 20px;
|
| 1294 |
+
background-color: #10b981;
|
| 1295 |
+
border-radius: 50%;
|
| 1296 |
+
}
|
| 1297 |
+
|
| 1298 |
+
.modal-footer {
|
| 1299 |
+
display: flex;
|
| 1300 |
+
justify-content: flex-end;
|
| 1301 |
+
padding: 15px 20px;
|
| 1302 |
+
border-top: 1px solid #eee;
|
| 1303 |
+
gap: 10px;
|
| 1304 |
+
}
|
| 1305 |
+
|
| 1306 |
+
.cancel-btn {
|
| 1307 |
+
padding: 8px 15px;
|
| 1308 |
+
border: 1px solid #ddd;
|
| 1309 |
+
background-color: white;
|
| 1310 |
+
border-radius: 4px;
|
| 1311 |
+
cursor: pointer;
|
| 1312 |
+
}
|
| 1313 |
+
|
| 1314 |
+
.confirm-btn {
|
| 1315 |
+
padding: 8px 15px;
|
| 1316 |
+
background-color: #6366f1;
|
| 1317 |
+
color: white;
|
| 1318 |
+
border: none;
|
| 1319 |
+
border-radius: 4px;
|
| 1320 |
+
cursor: pointer;
|
| 1321 |
+
}
|
| 1322 |
+
|
| 1323 |
+
/* 发布卡片容器样式 */
|
| 1324 |
+
.publish-cards-container {
|
| 1325 |
+
position: relative;
|
| 1326 |
+
margin-top: 20px;
|
| 1327 |
+
display: flex;
|
| 1328 |
+
align-items: center;
|
| 1329 |
+
}
|
| 1330 |
+
|
| 1331 |
+
.cards-scroll-area {
|
| 1332 |
+
display: flex;
|
| 1333 |
+
overflow-x: auto;
|
| 1334 |
+
scroll-behavior: smooth;
|
| 1335 |
+
padding: 10px 0;
|
| 1336 |
+
gap: 20px;
|
| 1337 |
+
width: 100%;
|
| 1338 |
+
scrollbar-width: none;
|
| 1339 |
+
/* Firefox */
|
| 1340 |
+
-ms-overflow-style: none;
|
| 1341 |
+
/* IE and Edge */
|
| 1342 |
+
}
|
| 1343 |
+
|
| 1344 |
+
.cards-scroll-area::-webkit-scrollbar {
|
| 1345 |
+
display: none;
|
| 1346 |
+
/* Chrome, Safari, Opera */
|
| 1347 |
+
}
|
| 1348 |
+
|
| 1349 |
+
.scroll-btn {
|
| 1350 |
+
position: absolute;
|
| 1351 |
+
top: 50%;
|
| 1352 |
+
transform: translateY(-50%);
|
| 1353 |
+
width: 30px;
|
| 1354 |
+
height: 30px;
|
| 1355 |
+
border-radius: 50%;
|
| 1356 |
+
background-color: white;
|
| 1357 |
+
border: 1px solid #ddd;
|
| 1358 |
+
display: flex;
|
| 1359 |
+
align-items: center;
|
| 1360 |
+
justify-content: center;
|
| 1361 |
+
cursor: pointer;
|
| 1362 |
+
z-index: 10;
|
| 1363 |
+
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
|
| 1364 |
+
}
|
| 1365 |
+
|
| 1366 |
+
.scroll-left {
|
| 1367 |
+
left: -15px;
|
| 1368 |
+
}
|
| 1369 |
+
|
| 1370 |
+
.scroll-right {
|
| 1371 |
+
right: -15px;
|
| 1372 |
+
}
|
| 1373 |
+
|
| 1374 |
+
/* 空状态样式 */
|
| 1375 |
+
.empty-state {
|
| 1376 |
+
width: 100%;
|
| 1377 |
+
padding: 50px 0;
|
| 1378 |
+
text-align: center;
|
| 1379 |
+
color: #999;
|
| 1380 |
+
background-color: #f9f9f9;
|
| 1381 |
+
border-radius: 8px;
|
| 1382 |
+
}
|
| 1383 |
+
|
| 1384 |
+
/* 发布卡片样式 */
|
| 1385 |
+
.publish-card {
|
| 1386 |
+
min-width: 300px;
|
| 1387 |
+
width: 300px;
|
| 1388 |
+
border: 1px solid #eee;
|
| 1389 |
+
border-radius: 8px;
|
| 1390 |
+
background-color: white;
|
| 1391 |
+
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
|
| 1392 |
+
overflow: hidden;
|
| 1393 |
+
flex-shrink: 0;
|
| 1394 |
+
}
|
| 1395 |
+
|
| 1396 |
+
.card-header {
|
| 1397 |
+
display: flex;
|
| 1398 |
+
justify-content: space-between;
|
| 1399 |
+
align-items: center;
|
| 1400 |
+
padding: 10px 15px;
|
| 1401 |
+
background-color: #f8f9fc;
|
| 1402 |
+
border-bottom: 1px solid #eee;
|
| 1403 |
+
}
|
| 1404 |
+
|
| 1405 |
+
.platform-info {
|
| 1406 |
+
display: flex;
|
| 1407 |
+
align-items: center;
|
| 1408 |
+
}
|
| 1409 |
+
|
| 1410 |
+
.platform-info .platform-icon {
|
| 1411 |
+
width: 24px;
|
| 1412 |
+
height: 24px;
|
| 1413 |
+
margin-right: 8px;
|
| 1414 |
+
margin-bottom: 0;
|
| 1415 |
+
}
|
| 1416 |
+
|
| 1417 |
+
.platform-info .platform-icon::before {
|
| 1418 |
+
width: 12px;
|
| 1419 |
+
height: 12px;
|
| 1420 |
+
}
|
| 1421 |
+
|
| 1422 |
+
.card-actions {
|
| 1423 |
+
display: flex;
|
| 1424 |
+
gap: 10px;
|
| 1425 |
+
}
|
| 1426 |
+
|
| 1427 |
+
.delete-card-btn {
|
| 1428 |
+
padding: 4px 8px;
|
| 1429 |
+
background-color: #fff;
|
| 1430 |
+
border: 1px solid #ddd;
|
| 1431 |
+
border-radius: 4px;
|
| 1432 |
+
font-size: 12px;
|
| 1433 |
+
cursor: pointer;
|
| 1434 |
+
}
|
| 1435 |
+
|
| 1436 |
+
.delete-card-btn:hover {
|
| 1437 |
+
background-color: #f5f5f5;
|
| 1438 |
+
}
|
| 1439 |
+
|
| 1440 |
+
.card-content {
|
| 1441 |
+
padding: 15px;
|
| 1442 |
+
}
|
| 1443 |
+
|
| 1444 |
+
.card-section {
|
| 1445 |
+
margin-bottom: 15px;
|
| 1446 |
+
}
|
| 1447 |
+
|
| 1448 |
+
.section-title {
|
| 1449 |
+
font-size: 14px;
|
| 1450 |
+
font-weight: bold;
|
| 1451 |
+
margin-bottom: 8px;
|
| 1452 |
+
color: #333;
|
| 1453 |
+
}
|
| 1454 |
+
|
| 1455 |
+
/* 账号选择器样式 */
|
| 1456 |
+
.account-selector {
|
| 1457 |
+
border: 1px dashed #ddd;
|
| 1458 |
+
border-radius: 4px;
|
| 1459 |
+
padding: 8px;
|
| 1460 |
+
cursor: pointer;
|
| 1461 |
+
min-height: 40px;
|
| 1462 |
+
background-color: #f9f9f9;
|
| 1463 |
+
transition: all 0.3s;
|
| 1464 |
+
}
|
| 1465 |
+
|
| 1466 |
+
.account-selector:hover {
|
| 1467 |
+
border-color: #409eff;
|
| 1468 |
+
background-color: #f0f7ff;
|
| 1469 |
+
}
|
| 1470 |
+
|
| 1471 |
+
.account-placeholder {
|
| 1472 |
+
display: flex;
|
| 1473 |
+
justify-content: center;
|
| 1474 |
+
align-items: center;
|
| 1475 |
+
height: 24px;
|
| 1476 |
+
color: #909399;
|
| 1477 |
+
}
|
| 1478 |
+
|
| 1479 |
+
.selected-account {
|
| 1480 |
+
display: flex;
|
| 1481 |
+
align-items: center;
|
| 1482 |
+
background-color: #f0f7ff;
|
| 1483 |
+
border: 1px solid #d9ecff;
|
| 1484 |
+
border-radius: 4px;
|
| 1485 |
+
padding: 5px 10px;
|
| 1486 |
+
}
|
| 1487 |
+
|
| 1488 |
+
.account-avatar {
|
| 1489 |
+
width: 24px;
|
| 1490 |
+
height: 24px;
|
| 1491 |
+
border-radius: 50%;
|
| 1492 |
+
margin-right: 8px;
|
| 1493 |
+
object-fit: cover;
|
| 1494 |
+
}
|
| 1495 |
+
|
| 1496 |
+
.account-name {
|
| 1497 |
+
font-size: 14px;
|
| 1498 |
+
color: #333;
|
| 1499 |
+
margin-right: 8px;
|
| 1500 |
+
}
|
| 1501 |
+
|
| 1502 |
+
.account-status {
|
| 1503 |
+
font-size: 12px;
|
| 1504 |
+
padding: 2px 6px;
|
| 1505 |
+
border-radius: 10px;
|
| 1506 |
+
}
|
| 1507 |
+
|
| 1508 |
+
.account-status.normal {
|
| 1509 |
+
background-color: #f0f9eb;
|
| 1510 |
+
color: #67c23a;
|
| 1511 |
+
}
|
| 1512 |
+
|
| 1513 |
+
.account-status.warning {
|
| 1514 |
+
background-color: #fdf6ec;
|
| 1515 |
+
color: #e6a23c;
|
| 1516 |
+
}
|
| 1517 |
+
|
| 1518 |
+
/* 发布类型选择器样式 */
|
| 1519 |
+
.publish-type-selector {
|
| 1520 |
+
display: flex;
|
| 1521 |
+
gap: 10px;
|
| 1522 |
+
}
|
| 1523 |
+
|
| 1524 |
+
.type-btn {
|
| 1525 |
+
flex: 1;
|
| 1526 |
+
padding: 8px 0;
|
| 1527 |
+
border: 1px solid #ddd;
|
| 1528 |
+
border-radius: 4px;
|
| 1529 |
+
background-color: white;
|
| 1530 |
+
cursor: pointer;
|
| 1531 |
+
transition: all 0.3s;
|
| 1532 |
+
}
|
| 1533 |
+
|
| 1534 |
+
.type-btn.active {
|
| 1535 |
+
background-color: #6366f1;
|
| 1536 |
+
color: white;
|
| 1537 |
+
border-color: #6366f1;
|
| 1538 |
+
}
|
| 1539 |
+
|
| 1540 |
+
/* 媒体上传区域样式 */
|
| 1541 |
+
.media-container {
|
| 1542 |
+
display: flex;
|
| 1543 |
+
flex-wrap: wrap;
|
| 1544 |
+
gap: 10px;
|
| 1545 |
+
}
|
| 1546 |
+
|
| 1547 |
+
.video-upload-area,
|
| 1548 |
+
.image-upload-area {
|
| 1549 |
+
border: 2px dashed #ddd;
|
| 1550 |
+
border-radius: 4px;
|
| 1551 |
+
width: 80px;
|
| 1552 |
+
height: 80px;
|
| 1553 |
+
display: flex;
|
| 1554 |
+
justify-content: center;
|
| 1555 |
+
align-items: center;
|
| 1556 |
+
cursor: pointer;
|
| 1557 |
+
background-color: #f9f9f9;
|
| 1558 |
+
transition: all 0.3s;
|
| 1559 |
+
}
|
| 1560 |
+
|
| 1561 |
+
.video-upload-area:hover,
|
| 1562 |
+
.image-upload-area:hover {
|
| 1563 |
+
border-color: #409eff;
|
| 1564 |
+
background-color: #f0f7ff;
|
| 1565 |
+
}
|
| 1566 |
+
|
| 1567 |
+
.upload-icon {
|
| 1568 |
+
display: flex;
|
| 1569 |
+
flex-direction: column;
|
| 1570 |
+
align-items: center;
|
| 1571 |
+
}
|
| 1572 |
+
|
| 1573 |
+
.upload-icon .icon {
|
| 1574 |
+
font-size: 20px;
|
| 1575 |
+
color: #909399;
|
| 1576 |
+
}
|
| 1577 |
+
|
| 1578 |
+
.upload-icon .text {
|
| 1579 |
+
margin-top: 5px;
|
| 1580 |
+
color: #606266;
|
| 1581 |
+
font-size: 12px;
|
| 1582 |
+
}
|
| 1583 |
+
|
| 1584 |
+
.video-preview,
|
| 1585 |
+
.image-preview {
|
| 1586 |
+
position: relative;
|
| 1587 |
+
width: 80px;
|
| 1588 |
+
height: 80px;
|
| 1589 |
+
border-radius: 4px;
|
| 1590 |
+
overflow: hidden;
|
| 1591 |
+
}
|
| 1592 |
+
|
| 1593 |
+
.video-preview video,
|
| 1594 |
+
.image-preview img {
|
| 1595 |
+
width: 100%;
|
| 1596 |
+
height: 100%;
|
| 1597 |
+
object-fit: cover;
|
| 1598 |
+
}
|
| 1599 |
+
|
| 1600 |
+
.media-actions {
|
| 1601 |
+
position: absolute;
|
| 1602 |
+
top: 5px;
|
| 1603 |
+
right: 5px;
|
| 1604 |
+
z-index: 10;
|
| 1605 |
+
}
|
| 1606 |
+
|
| 1607 |
+
.remove-btn {
|
| 1608 |
+
background-color: rgba(0, 0, 0, 0.5);
|
| 1609 |
+
color: white;
|
| 1610 |
+
border: none;
|
| 1611 |
+
border-radius: 4px;
|
| 1612 |
+
padding: 2px 5px;
|
| 1613 |
+
cursor: pointer;
|
| 1614 |
+
font-size: 10px;
|
| 1615 |
+
}
|
| 1616 |
+
|
| 1617 |
+
.remove-btn:hover {
|
| 1618 |
+
background-color: rgba(0, 0, 0, 0.7);
|
| 1619 |
+
}
|
| 1620 |
+
|
| 1621 |
+
.media-count {
|
| 1622 |
+
margin-top: 8px;
|
| 1623 |
+
font-size: 12px;
|
| 1624 |
+
color: #909399;
|
| 1625 |
+
}
|
| 1626 |
+
|
| 1627 |
+
/* 标题输入区域样式 */
|
| 1628 |
+
.title-input-container {
|
| 1629 |
+
position: relative;
|
| 1630 |
+
}
|
| 1631 |
+
|
| 1632 |
+
.title-input-container textarea {
|
| 1633 |
+
width: 100%;
|
| 1634 |
+
padding: 8px;
|
| 1635 |
+
border: 1px solid #ddd;
|
| 1636 |
+
border-radius: 4px;
|
| 1637 |
+
resize: none;
|
| 1638 |
+
font-size: 14px;
|
| 1639 |
+
}
|
| 1640 |
+
|
| 1641 |
+
.char-count {
|
| 1642 |
+
position: absolute;
|
| 1643 |
+
bottom: 5px;
|
| 1644 |
+
right: 10px;
|
| 1645 |
+
font-size: 12px;
|
| 1646 |
+
color: #999;
|
| 1647 |
+
}
|
| 1648 |
+
|
| 1649 |
+
/* 话题选择区域样式 */
|
| 1650 |
+
.tags-container {
|
| 1651 |
+
display: flex;
|
| 1652 |
+
flex-wrap: wrap;
|
| 1653 |
+
gap: 8px;
|
| 1654 |
+
}
|
| 1655 |
+
|
| 1656 |
+
.tag {
|
| 1657 |
+
background-color: #f0f7ff;
|
| 1658 |
+
border: 1px solid #d9ecff;
|
| 1659 |
+
border-radius: 4px;
|
| 1660 |
+
padding: 4px 8px;
|
| 1661 |
+
font-size: 12px;
|
| 1662 |
+
color: #409eff;
|
| 1663 |
+
display: flex;
|
| 1664 |
+
align-items: center;
|
| 1665 |
+
}
|
| 1666 |
+
|
| 1667 |
+
.remove-tag {
|
| 1668 |
+
margin-left: 5px;
|
| 1669 |
+
cursor: pointer;
|
| 1670 |
+
font-size: 14px;
|
| 1671 |
+
}
|
| 1672 |
+
|
| 1673 |
+
.add-tag {
|
| 1674 |
+
border: 1px dashed #ddd;
|
| 1675 |
+
border-radius: 4px;
|
| 1676 |
+
padding: 4px 8px;
|
| 1677 |
+
font-size: 12px;
|
| 1678 |
+
color: #909399;
|
| 1679 |
+
cursor: pointer;
|
| 1680 |
+
}
|
| 1681 |
+
|
| 1682 |
+
.add-tag:hover {
|
| 1683 |
+
border-color: #409eff;
|
| 1684 |
+
color: #409eff;
|
| 1685 |
+
}
|
| 1686 |
+
|
| 1687 |
+
/* 底部操作按钮样式 */
|
| 1688 |
+
.card-actions-bottom {
|
| 1689 |
+
display: flex;
|
| 1690 |
+
justify-content: center;
|
| 1691 |
+
margin-top: 15px;
|
| 1692 |
+
}
|
| 1693 |
+
|
| 1694 |
+
.publish-btn {
|
| 1695 |
+
padding: 8px 20px;
|
| 1696 |
+
background-color: #6366f1;
|
| 1697 |
+
color: white;
|
| 1698 |
+
border: none;
|
| 1699 |
+
border-radius: 4px;
|
| 1700 |
+
cursor: pointer;
|
| 1701 |
+
font-size: 14px;
|
| 1702 |
+
}
|
| 1703 |
+
|
| 1704 |
+
.publish-btn:disabled {
|
| 1705 |
+
background-color: #a5a6f6;
|
| 1706 |
+
cursor: not-allowed;
|
| 1707 |
+
}
|
| 1708 |
+
|
| 1709 |
+
/* 账号选择弹窗样式 */
|
| 1710 |
+
.account-selector-modal {
|
| 1711 |
+
position: fixed;
|
| 1712 |
+
top: 0;
|
| 1713 |
+
left: 0;
|
| 1714 |
+
width: 100%;
|
| 1715 |
+
height: 100%;
|
| 1716 |
+
background-color: rgba(0, 0, 0, 0.5);
|
| 1717 |
+
display: flex;
|
| 1718 |
+
justify-content: center;
|
| 1719 |
+
align-items: center;
|
| 1720 |
+
z-index: 1000;
|
| 1721 |
+
}
|
| 1722 |
+
|
| 1723 |
+
.account-selector-content {
|
| 1724 |
+
background-color: white;
|
| 1725 |
+
border-radius: 8px;
|
| 1726 |
+
width: 400px;
|
| 1727 |
+
max-width: 90%;
|
| 1728 |
+
max-height: 80vh;
|
| 1729 |
+
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
|
| 1730 |
+
overflow: hidden;
|
| 1731 |
+
display: flex;
|
| 1732 |
+
flex-direction: column;
|
| 1733 |
+
}
|
| 1734 |
+
|
| 1735 |
+
.refresh-btn {
|
| 1736 |
+
background: none;
|
| 1737 |
+
border: none;
|
| 1738 |
+
cursor: pointer;
|
| 1739 |
+
color: #999;
|
| 1740 |
+
font-size: 16px;
|
| 1741 |
+
margin-right: 10px;
|
| 1742 |
+
}
|
| 1743 |
+
|
| 1744 |
+
.refresh-icon {
|
| 1745 |
+
display: inline-block;
|
| 1746 |
+
}
|
| 1747 |
+
|
| 1748 |
+
.loading-accounts,
|
| 1749 |
+
.no-accounts {
|
| 1750 |
+
padding: 20px;
|
| 1751 |
+
text-align: center;
|
| 1752 |
+
color: #999;
|
| 1753 |
+
}
|
| 1754 |
+
|
| 1755 |
+
.account-list {
|
| 1756 |
+
max-height: 300px;
|
| 1757 |
+
overflow-y: auto;
|
| 1758 |
+
padding: 0 10px;
|
| 1759 |
+
}
|
| 1760 |
+
|
| 1761 |
+
.account-item {
|
| 1762 |
+
display: flex;
|
| 1763 |
+
align-items: center;
|
| 1764 |
+
padding: 10px;
|
| 1765 |
+
border-bottom: 1px solid #eee;
|
| 1766 |
+
cursor: pointer;
|
| 1767 |
+
}
|
| 1768 |
+
|
| 1769 |
+
.account-item:hover {
|
| 1770 |
+
background-color: #f5f5f5;
|
| 1771 |
+
}
|
| 1772 |
+
|
| 1773 |
+
.account-item:last-child {
|
| 1774 |
+
border-bottom: none;
|
| 1775 |
+
}
|
| 1776 |
+
|
| 1777 |
+
.account-info {
|
| 1778 |
+
display: flex;
|
| 1779 |
+
flex-direction: column;
|
| 1780 |
+
}
|
| 1781 |
+
|
| 1782 |
+
/* 话题选择弹窗样式 */
|
| 1783 |
+
.tag-selector-modal {
|
| 1784 |
+
position: fixed;
|
| 1785 |
+
top: 0;
|
| 1786 |
+
left: 0;
|
| 1787 |
+
width: 100%;
|
| 1788 |
+
height: 100%;
|
| 1789 |
+
background-color: rgba(0, 0, 0, 0.5);
|
| 1790 |
+
display: flex;
|
| 1791 |
+
justify-content: center;
|
| 1792 |
+
align-items: center;
|
| 1793 |
+
z-index: 1000;
|
| 1794 |
+
}
|
| 1795 |
+
|
| 1796 |
+
.tag-selector-content {
|
| 1797 |
+
background-color: white;
|
| 1798 |
+
border-radius: 8px;
|
| 1799 |
+
width: 400px;
|
| 1800 |
+
max-width: 90%;
|
| 1801 |
+
max-height: 80vh;
|
| 1802 |
+
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
|
| 1803 |
+
overflow: hidden;
|
| 1804 |
+
display: flex;
|
| 1805 |
+
flex-direction: column;
|
| 1806 |
+
}
|
| 1807 |
+
|
| 1808 |
+
.custom-tag-input {
|
| 1809 |
+
display: flex;
|
| 1810 |
+
margin-bottom: 15px;
|
| 1811 |
+
}
|
| 1812 |
+
|
| 1813 |
+
.custom-tag-input input {
|
| 1814 |
+
flex: 1;
|
| 1815 |
+
padding: 8px;
|
| 1816 |
+
border: 1px solid #ddd;
|
| 1817 |
+
border-radius: 4px 0 0 4px;
|
| 1818 |
+
font-size: 14px;
|
| 1819 |
+
}
|
| 1820 |
+
|
| 1821 |
+
.custom-tag-input button {
|
| 1822 |
+
padding: 8px 15px;
|
| 1823 |
+
background-color: #6366f1;
|
| 1824 |
+
color: white;
|
| 1825 |
+
border: none;
|
| 1826 |
+
border-radius: 0 4px 4px 0;
|
| 1827 |
+
cursor: pointer;
|
| 1828 |
+
}
|
| 1829 |
+
|
| 1830 |
+
.suggested-tags h4 {
|
| 1831 |
+
margin-bottom: 10px;
|
| 1832 |
+
font-size: 14px;
|
| 1833 |
+
font-weight: 500;
|
| 1834 |
+
}
|
| 1835 |
+
|
| 1836 |
+
.tag-grid {
|
| 1837 |
+
display: grid;
|
| 1838 |
+
grid-template-columns: repeat(3, 1fr);
|
| 1839 |
+
gap: 10px;
|
| 1840 |
+
}
|
| 1841 |
+
|
| 1842 |
+
.suggested-tag {
|
| 1843 |
+
background-color: #f5f5f5;
|
| 1844 |
+
border-radius: 4px;
|
| 1845 |
+
padding: 8px;
|
| 1846 |
+
text-align: center;
|
| 1847 |
+
font-size: 12px;
|
| 1848 |
+
cursor: pointer;
|
| 1849 |
+
}
|
| 1850 |
+
|
| 1851 |
+
.suggested-tag:hover {
|
| 1852 |
+
background-color: #e0e0e0;
|
| 1853 |
+
}
|
| 1854 |
+
|
| 1855 |
+
/* 视频来源选择器样式 */
|
| 1856 |
+
.source-selector {
|
| 1857 |
+
position: fixed;
|
| 1858 |
+
top: 0;
|
| 1859 |
+
left: 0;
|
| 1860 |
+
right: 0;
|
| 1861 |
+
bottom: 0;
|
| 1862 |
+
background-color: rgba(0, 0, 0, 0.5);
|
| 1863 |
+
z-index: 1000;
|
| 1864 |
+
display: flex;
|
| 1865 |
+
justify-content: center;
|
| 1866 |
+
align-items: center;
|
| 1867 |
+
}
|
| 1868 |
+
|
| 1869 |
+
.source-selector-content {
|
| 1870 |
+
background-color: white;
|
| 1871 |
+
border-radius: 12px;
|
| 1872 |
+
padding: 20px;
|
| 1873 |
+
width: 280px;
|
| 1874 |
+
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
|
| 1875 |
+
display: flex;
|
| 1876 |
+
flex-direction: column;
|
| 1877 |
+
gap: 15px;
|
| 1878 |
+
}
|
| 1879 |
+
|
| 1880 |
+
.source-option {
|
| 1881 |
+
display: flex;
|
| 1882 |
+
flex-direction: column;
|
| 1883 |
+
align-items: center;
|
| 1884 |
+
padding: 20px 15px;
|
| 1885 |
+
border-radius: 8px;
|
| 1886 |
+
cursor: pointer;
|
| 1887 |
+
transition: all 0.3s ease;
|
| 1888 |
+
border: 2px solid #f0f0f0;
|
| 1889 |
+
}
|
| 1890 |
+
|
| 1891 |
+
.source-option:hover {
|
| 1892 |
+
background-color: #f8f9ff;
|
| 1893 |
+
border-color: #6366f1;
|
| 1894 |
+
transform: translateY(-2px);
|
| 1895 |
+
box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
|
| 1896 |
+
}
|
| 1897 |
+
|
| 1898 |
+
.source-icon {
|
| 1899 |
+
width: 48px;
|
| 1900 |
+
height: 48px;
|
| 1901 |
+
border-radius: 50%;
|
| 1902 |
+
display: flex;
|
| 1903 |
+
align-items: center;
|
| 1904 |
+
justify-content: center;
|
| 1905 |
+
margin-bottom: 8px;
|
| 1906 |
+
font-size: 24px;
|
| 1907 |
+
}
|
| 1908 |
+
|
| 1909 |
+
.local-icon {
|
| 1910 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 1911 |
+
color: white;
|
| 1912 |
+
}
|
| 1913 |
+
|
| 1914 |
+
.library-icon {
|
| 1915 |
+
background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
|
| 1916 |
+
color: white;
|
| 1917 |
+
}
|
| 1918 |
+
|
| 1919 |
+
.source-text {
|
| 1920 |
+
font-size: 14px;
|
| 1921 |
+
font-weight: 500;
|
| 1922 |
+
color: #333;
|
| 1923 |
+
}
|
| 1924 |
+
|
| 1925 |
+
/* 媒体上传区域间距 */
|
| 1926 |
+
.media-section {
|
| 1927 |
+
margin-bottom: 25px;
|
| 1928 |
+
}
|
| 1929 |
+
|
| 1930 |
+
.media-item {
|
| 1931 |
+
margin-bottom: 15px;
|
| 1932 |
+
}
|
| 1933 |
+
|
| 1934 |
+
.media-item:last-child {
|
| 1935 |
+
margin-bottom: 0;
|
| 1936 |
+
}
|
| 1937 |
+
|
| 1938 |
+
/* 定时发布设置美化样式 */
|
| 1939 |
+
.timer-toggle {
|
| 1940 |
+
display: flex;
|
| 1941 |
+
align-items: center;
|
| 1942 |
+
margin-bottom: 15px;
|
| 1943 |
+
}
|
| 1944 |
+
|
| 1945 |
+
.switch {
|
| 1946 |
+
position: relative;
|
| 1947 |
+
display: inline-block;
|
| 1948 |
+
width: 44px;
|
| 1949 |
+
height: 24px;
|
| 1950 |
+
margin-right: 12px;
|
| 1951 |
+
}
|
| 1952 |
+
|
| 1953 |
+
.switch input {
|
| 1954 |
+
opacity: 0;
|
| 1955 |
+
width: 0;
|
| 1956 |
+
height: 0;
|
| 1957 |
+
}
|
| 1958 |
+
|
| 1959 |
+
.slider {
|
| 1960 |
+
position: absolute;
|
| 1961 |
+
cursor: pointer;
|
| 1962 |
+
top: 0;
|
| 1963 |
+
left: 0;
|
| 1964 |
+
right: 0;
|
| 1965 |
+
bottom: 0;
|
| 1966 |
+
background-color: #dcdfe6;
|
| 1967 |
+
transition: .4s;
|
| 1968 |
+
}
|
| 1969 |
+
|
| 1970 |
+
.slider:before {
|
| 1971 |
+
position: absolute;
|
| 1972 |
+
content: "";
|
| 1973 |
+
height: 18px;
|
| 1974 |
+
width: 18px;
|
| 1975 |
+
left: 3px;
|
| 1976 |
+
bottom: 3px;
|
| 1977 |
+
background-color: white;
|
| 1978 |
+
transition: .4s;
|
| 1979 |
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
| 1980 |
+
}
|
| 1981 |
+
|
| 1982 |
+
input:checked + .slider {
|
| 1983 |
+
background-color: #6366f1;
|
| 1984 |
+
}
|
| 1985 |
+
|
| 1986 |
+
input:checked + .slider:before {
|
| 1987 |
+
transform: translateX(20px);
|
| 1988 |
+
}
|
| 1989 |
+
|
| 1990 |
+
.slider.round {
|
| 1991 |
+
border-radius: 24px;
|
| 1992 |
+
}
|
| 1993 |
+
|
| 1994 |
+
.slider.round:before {
|
| 1995 |
+
border-radius: 50%;
|
| 1996 |
+
}
|
| 1997 |
+
|
| 1998 |
+
.toggle-label {
|
| 1999 |
+
font-size: 16px;
|
| 2000 |
+
font-weight: 500;
|
| 2001 |
+
color: #333;
|
| 2002 |
+
}
|
| 2003 |
+
|
| 2004 |
+
.timer-settings {
|
| 2005 |
+
background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
|
| 2006 |
+
border-radius: 12px;
|
| 2007 |
+
padding: 20px;
|
| 2008 |
+
border: 1px solid #e1e8ed;
|
| 2009 |
+
}
|
| 2010 |
+
|
| 2011 |
+
.setting-item {
|
| 2012 |
+
margin-bottom: 18px;
|
| 2013 |
+
}
|
| 2014 |
+
|
| 2015 |
+
.setting-item:last-child {
|
| 2016 |
+
margin-bottom: 0;
|
| 2017 |
+
}
|
| 2018 |
+
|
| 2019 |
+
.setting-label {
|
| 2020 |
+
display: block;
|
| 2021 |
+
margin-bottom: 8px;
|
| 2022 |
+
font-size: 14px;
|
| 2023 |
+
font-weight: 500;
|
| 2024 |
+
color: #4a5568;
|
| 2025 |
+
}
|
| 2026 |
+
|
| 2027 |
+
.setting-select {
|
| 2028 |
+
width: 100%;
|
| 2029 |
+
padding: 10px 12px;
|
| 2030 |
+
border: 2px solid #e2e8f0;
|
| 2031 |
+
border-radius: 8px;
|
| 2032 |
+
font-size: 14px;
|
| 2033 |
+
background-color: white;
|
| 2034 |
+
transition: border-color 0.3s ease;
|
| 2035 |
+
}
|
| 2036 |
+
|
| 2037 |
+
.setting-select:focus {
|
| 2038 |
+
outline: none;
|
| 2039 |
+
border-color: #6366f1;
|
| 2040 |
+
box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
|
| 2041 |
+
}
|
| 2042 |
+
|
| 2043 |
+
.time-slots {
|
| 2044 |
+
display: flex;
|
| 2045 |
+
flex-wrap: wrap;
|
| 2046 |
+
gap: 10px;
|
| 2047 |
+
}
|
| 2048 |
+
|
| 2049 |
+
.time-input {
|
| 2050 |
+
padding: 8px 10px;
|
| 2051 |
+
border: 2px solid #e2e8f0;
|
| 2052 |
+
border-radius: 6px;
|
| 2053 |
+
font-size: 14px;
|
| 2054 |
+
background-color: white;
|
| 2055 |
+
transition: border-color 0.3s ease;
|
| 2056 |
+
min-width: 120px;
|
| 2057 |
+
}
|
| 2058 |
+
|
| 2059 |
+
.time-input:focus {
|
| 2060 |
+
outline: none;
|
| 2061 |
+
border-color: #6366f1;
|
| 2062 |
+
box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
|
| 2063 |
+
}
|
| 2064 |
+
|
| 2065 |
+
.days-setting {
|
| 2066 |
+
display: flex;
|
| 2067 |
+
align-items: center;
|
| 2068 |
+
gap: 10px;
|
| 2069 |
+
}
|
| 2070 |
+
|
| 2071 |
+
.days-input {
|
| 2072 |
+
width: 80px;
|
| 2073 |
+
padding: 8px 10px;
|
| 2074 |
+
border: 2px solid #e2e8f0;
|
| 2075 |
+
border-radius: 6px;
|
| 2076 |
+
font-size: 14px;
|
| 2077 |
+
background-color: white;
|
| 2078 |
+
transition: border-color 0.3s ease;
|
| 2079 |
+
}
|
| 2080 |
+
|
| 2081 |
+
.days-input:focus {
|
| 2082 |
+
outline: none;
|
| 2083 |
+
border-color: #6366f1;
|
| 2084 |
+
box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
|
| 2085 |
+
}
|
| 2086 |
+
|
| 2087 |
+
.days-unit {
|
| 2088 |
+
font-size: 14px;
|
| 2089 |
+
color: #6b7280;
|
| 2090 |
+
font-weight: 500;
|
| 2091 |
+
}
|
| 2092 |
+
|
| 2093 |
+
/* 素材库弹窗样式 */
|
| 2094 |
+
.material-library-modal {
|
| 2095 |
+
position: fixed;
|
| 2096 |
+
top: 0;
|
| 2097 |
+
left: 0;
|
| 2098 |
+
right: 0;
|
| 2099 |
+
bottom: 0;
|
| 2100 |
+
background-color: rgba(0, 0, 0, 0.5);
|
| 2101 |
+
z-index: 1000;
|
| 2102 |
+
display: flex;
|
| 2103 |
+
justify-content: center;
|
| 2104 |
+
align-items: center;
|
| 2105 |
+
}
|
| 2106 |
+
|
| 2107 |
+
.material-library-content {
|
| 2108 |
+
background-color: white;
|
| 2109 |
+
border-radius: 8px;
|
| 2110 |
+
width: 80%;
|
| 2111 |
+
max-width: 900px;
|
| 2112 |
+
max-height: 80vh;
|
| 2113 |
+
overflow: hidden;
|
| 2114 |
+
display: flex;
|
| 2115 |
+
flex-direction: column;
|
| 2116 |
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
| 2117 |
+
}
|
| 2118 |
+
|
| 2119 |
+
.modal-header {
|
| 2120 |
+
display: flex;
|
| 2121 |
+
justify-content: space-between;
|
| 2122 |
+
align-items: center;
|
| 2123 |
+
padding: 15px 20px;
|
| 2124 |
+
border-bottom: 1px solid #eee;
|
| 2125 |
+
}
|
| 2126 |
+
|
| 2127 |
+
.modal-header h3 {
|
| 2128 |
+
margin: 0;
|
| 2129 |
+
font-size: 18px;
|
| 2130 |
+
font-weight: 500;
|
| 2131 |
+
}
|
| 2132 |
+
|
| 2133 |
+
.close-btn {
|
| 2134 |
+
background: none;
|
| 2135 |
+
border: none;
|
| 2136 |
+
font-size: 20px;
|
| 2137 |
+
cursor: pointer;
|
| 2138 |
+
color: #666;
|
| 2139 |
+
}
|
| 2140 |
+
|
| 2141 |
+
.modal-body {
|
| 2142 |
+
padding: 20px;
|
| 2143 |
+
overflow-y: auto;
|
| 2144 |
+
flex: 1;
|
| 2145 |
+
}
|
| 2146 |
+
|
| 2147 |
+
.loading-materials,
|
| 2148 |
+
.no-materials {
|
| 2149 |
+
display: flex;
|
| 2150 |
+
justify-content: center;
|
| 2151 |
+
align-items: center;
|
| 2152 |
+
height: 200px;
|
| 2153 |
+
color: #666;
|
| 2154 |
+
}
|
| 2155 |
+
|
| 2156 |
+
.material-grid {
|
| 2157 |
+
display: grid;
|
| 2158 |
+
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
|
| 2159 |
+
gap: 15px;
|
| 2160 |
+
}
|
| 2161 |
+
|
| 2162 |
+
.material-item {
|
| 2163 |
+
border: 1px solid #eee;
|
| 2164 |
+
border-radius: 8px;
|
| 2165 |
+
overflow: hidden;
|
| 2166 |
+
cursor: pointer;
|
| 2167 |
+
transition: transform 0.2s, box-shadow 0.2s;
|
| 2168 |
+
position: relative;
|
| 2169 |
+
background-color: white;
|
| 2170 |
+
}
|
| 2171 |
+
|
| 2172 |
+
.material-item:hover {
|
| 2173 |
+
transform: translateY(-3px);
|
| 2174 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
| 2175 |
+
}
|
| 2176 |
+
|
| 2177 |
+
.material-item.selected {
|
| 2178 |
+
border-color: #6366f1;
|
| 2179 |
+
box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
|
| 2180 |
+
}
|
| 2181 |
+
|
| 2182 |
+
.material-checkbox {
|
| 2183 |
+
position: absolute;
|
| 2184 |
+
top: 10px;
|
| 2185 |
+
left: 10px;
|
| 2186 |
+
z-index: 2;
|
| 2187 |
+
}
|
| 2188 |
+
|
| 2189 |
+
.checkbox {
|
| 2190 |
+
width: 20px;
|
| 2191 |
+
height: 20px;
|
| 2192 |
+
border: 2px solid #ddd;
|
| 2193 |
+
border-radius: 4px;
|
| 2194 |
+
background-color: white;
|
| 2195 |
+
display: flex;
|
| 2196 |
+
align-items: center;
|
| 2197 |
+
justify-content: center;
|
| 2198 |
+
transition: all 0.2s;
|
| 2199 |
+
}
|
| 2200 |
+
|
| 2201 |
+
.checkbox.checked {
|
| 2202 |
+
background-color: #6366f1;
|
| 2203 |
+
border-color: #6366f1;
|
| 2204 |
+
}
|
| 2205 |
+
|
| 2206 |
+
.checkbox.checked::after {
|
| 2207 |
+
content: '✓';
|
| 2208 |
+
color: white;
|
| 2209 |
+
font-size: 12px;
|
| 2210 |
+
font-weight: bold;
|
| 2211 |
+
}
|
| 2212 |
+
|
| 2213 |
+
.material-preview {
|
| 2214 |
+
position: relative;
|
| 2215 |
+
height: 120px;
|
| 2216 |
+
background-color: #f5f5f5;
|
| 2217 |
+
display: flex;
|
| 2218 |
+
align-items: center;
|
| 2219 |
+
justify-content: center;
|
| 2220 |
+
overflow: hidden;
|
| 2221 |
+
}
|
| 2222 |
+
|
| 2223 |
+
.material-preview .delete-btn {
|
| 2224 |
+
position: absolute;
|
| 2225 |
+
top: 5px;
|
| 2226 |
+
right: 5px;
|
| 2227 |
+
width: 24px;
|
| 2228 |
+
height: 24px;
|
| 2229 |
+
border-radius: 50%;
|
| 2230 |
+
background-color: rgba(0, 0, 0, 0.5);
|
| 2231 |
+
color: white;
|
| 2232 |
+
border: none;
|
| 2233 |
+
display: flex;
|
| 2234 |
+
align-items: center;
|
| 2235 |
+
justify-content: center;
|
| 2236 |
+
cursor: pointer;
|
| 2237 |
+
font-size: 16px;
|
| 2238 |
+
opacity: 0;
|
| 2239 |
+
transition: opacity 0.2s;
|
| 2240 |
+
}
|
| 2241 |
+
|
| 2242 |
+
.material-item:hover .delete-btn {
|
| 2243 |
+
opacity: 1;
|
| 2244 |
+
}
|
| 2245 |
+
|
| 2246 |
+
.play-icon {
|
| 2247 |
+
width: 40px;
|
| 2248 |
+
height: 40px;
|
| 2249 |
+
opacity: 0.7;
|
| 2250 |
+
}
|
| 2251 |
+
|
| 2252 |
+
.material-info {
|
| 2253 |
+
padding: 10px;
|
| 2254 |
+
}
|
| 2255 |
+
|
| 2256 |
+
.material-name {
|
| 2257 |
+
font-size: 14px;
|
| 2258 |
+
font-weight: 500;
|
| 2259 |
+
margin-bottom: 5px;
|
| 2260 |
+
white-space: nowrap;
|
| 2261 |
+
overflow: hidden;
|
| 2262 |
+
text-overflow: ellipsis;
|
| 2263 |
+
}
|
| 2264 |
+
|
| 2265 |
+
.material-meta {
|
| 2266 |
+
display: flex;
|
| 2267 |
+
justify-content: space-between;
|
| 2268 |
+
font-size: 12px;
|
| 2269 |
+
color: #666;
|
| 2270 |
+
}
|
| 2271 |
+
|
| 2272 |
+
.modal-footer {
|
| 2273 |
+
display: flex;
|
| 2274 |
+
justify-content: flex-end;
|
| 2275 |
+
gap: 10px;
|
| 2276 |
+
padding: 15px 20px;
|
| 2277 |
+
border-top: 1px solid #eee;
|
| 2278 |
+
}
|
| 2279 |
+
|
| 2280 |
+
.cancel-btn {
|
| 2281 |
+
padding: 8px 16px;
|
| 2282 |
+
background-color: #f5f5f5;
|
| 2283 |
+
border: 1px solid #ddd;
|
| 2284 |
+
border-radius: 4px;
|
| 2285 |
+
cursor: pointer;
|
| 2286 |
+
font-size: 14px;
|
| 2287 |
+
}
|
| 2288 |
+
|
| 2289 |
+
.confirm-btn {
|
| 2290 |
+
padding: 8px 16px;
|
| 2291 |
+
background-color: #6366f1;
|
| 2292 |
+
color: white;
|
| 2293 |
+
border: none;
|
| 2294 |
+
border-radius: 4px;
|
| 2295 |
+
cursor: pointer;
|
| 2296 |
+
font-size: 14px;
|
| 2297 |
+
}
|
| 2298 |
+
|
| 2299 |
+
.confirm-btn:disabled {
|
| 2300 |
+
background-color: #a5a6f6;
|
| 2301 |
+
cursor: not-allowed;
|
| 2302 |
+
}
|
| 2303 |
+
</style>
|
sau_frontend/src/components/PublishView.vue
ADDED
|
@@ -0,0 +1,375 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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>
|
| 4 |
+
|
| 5 |
+
<!-- 筛选栏 -->
|
| 6 |
+
<div class="filter-bar">
|
| 7 |
+
<div class="filter-items">
|
| 8 |
+
<div class="filter-item">
|
| 9 |
+
<select class="filter-select" v-model="selectedPublisher">
|
| 10 |
+
<option value="">全部发布人</option>
|
| 11 |
+
<option v-for="account in accountsList" :key="account.id" :value="account.id">
|
| 12 |
+
{{ account.name }}
|
| 13 |
+
</option>
|
| 14 |
+
</select>
|
| 15 |
+
</div>
|
| 16 |
+
|
| 17 |
+
<div class="filter-item">
|
| 18 |
+
<select class="filter-select">
|
| 19 |
+
<option value="">全部发布类型</option>
|
| 20 |
+
<option value="video">视频</option>
|
| 21 |
+
<option value="image">图文</option>
|
| 22 |
+
</select>
|
| 23 |
+
</div>
|
| 24 |
+
|
| 25 |
+
<!-- <div class="filter-item">
|
| 26 |
+
<select class="filter-select">
|
| 27 |
+
<option value="">全部推送状态</option>
|
| 28 |
+
<option value="success">成功</option>
|
| 29 |
+
<option value="failed">失败</option>
|
| 30 |
+
<option value="pending">待发布</option>
|
| 31 |
+
</select>
|
| 32 |
+
</div> -->
|
| 33 |
+
</div>
|
| 34 |
+
|
| 35 |
+
<div class="action-buttons">
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
<!-- 新增发布按钮及下拉菜单 -->
|
| 39 |
+
<div class="dropdown"
|
| 40 |
+
@mouseenter="showDropdown"
|
| 41 |
+
@mouseleave="hideDropdown">
|
| 42 |
+
<button class="btn btn-add">
|
| 43 |
+
<i class="add-icon">+</i> 新增发布
|
| 44 |
+
</button>
|
| 45 |
+
<div class="dropdown-menu" :class="{ 'show': dropdownVisible }">
|
| 46 |
+
<div class="dropdown-item" @click="addVideoPublishRoute">
|
| 47 |
+
<div class="item-icon video-icon"></div>
|
| 48 |
+
<span>视频</span>
|
| 49 |
+
</div>
|
| 50 |
+
<div class="dropdown-item">
|
| 51 |
+
<div class="item-icon image-icon"></div>
|
| 52 |
+
<span>图文</span>
|
| 53 |
+
</div>
|
| 54 |
+
<div class="dropdown-item" @click="goToMultiPublish">
|
| 55 |
+
<div class="item-icon multi-icon"></div>
|
| 56 |
+
<span>多平台发布</span>
|
| 57 |
+
</div>
|
| 58 |
+
<!-- <div class="dropdown-item">
|
| 59 |
+
<div class="item-icon article-icon"></div>
|
| 60 |
+
<span>文章</span>
|
| 61 |
+
</div>
|
| 62 |
+
<div class="dropdown-item">
|
| 63 |
+
<div class="item-icon wechat-icon"></div>
|
| 64 |
+
<span>公众号</span>
|
| 65 |
+
</div> -->
|
| 66 |
+
</div>
|
| 67 |
+
</div>
|
| 68 |
+
</div>
|
| 69 |
+
</div>
|
| 70 |
+
|
| 71 |
+
<!-- 空状态提示 -->
|
| 72 |
+
<div class="empty-state">
|
| 73 |
+
<div class="empty-image"></div>
|
| 74 |
+
<p class="empty-text">暂无发布记录,点击新增发布任务吧~</p>
|
| 75 |
+
</div>
|
| 76 |
+
</div>
|
| 77 |
+
</template>
|
| 78 |
+
|
| 79 |
+
<script setup>
|
| 80 |
+
import { ref, computed, onMounted } from 'vue';
|
| 81 |
+
import { useRouter } from 'vue-router';
|
| 82 |
+
import { addVideoRoute } from '@/router';
|
| 83 |
+
import { globalAccountsCache } from '../config';
|
| 84 |
+
import axios from 'axios';
|
| 85 |
+
import tx from '@assets/fengbaobao.png'
|
| 86 |
+
|
| 87 |
+
const router = useRouter();
|
| 88 |
+
|
| 89 |
+
// 控制下拉菜单的显示状态
|
| 90 |
+
const dropdownVisible = ref(false);
|
| 91 |
+
|
| 92 |
+
// 选中的发布人
|
| 93 |
+
const selectedPublisher = ref('');
|
| 94 |
+
|
| 95 |
+
// 账号列表
|
| 96 |
+
const accountsList = ref([]);
|
| 97 |
+
|
| 98 |
+
// 显示下拉菜单
|
| 99 |
+
const showDropdown = () => {
|
| 100 |
+
dropdownVisible.value = true;
|
| 101 |
+
};
|
| 102 |
+
|
| 103 |
+
// 隐藏下拉菜单
|
| 104 |
+
const hideDropdown = () => {
|
| 105 |
+
dropdownVisible.value = false;
|
| 106 |
+
};
|
| 107 |
+
|
| 108 |
+
// 添加视频发布路由
|
| 109 |
+
const addVideoPublishRoute = () => {
|
| 110 |
+
const newRoute = addVideoRoute();
|
| 111 |
+
router.push(newRoute.path);
|
| 112 |
+
hideDropdown();
|
| 113 |
+
};
|
| 114 |
+
|
| 115 |
+
// 跳转到多平台发布页面
|
| 116 |
+
const goToMultiPublish = () => {
|
| 117 |
+
router.push('/multi-publish');
|
| 118 |
+
hideDropdown();
|
| 119 |
+
};
|
| 120 |
+
|
| 121 |
+
// 获取账号列表
|
| 122 |
+
const fetchAccounts = async () => {
|
| 123 |
+
try {
|
| 124 |
+
// 如果全局缓存有效,则使用缓存数据
|
| 125 |
+
if (globalAccountsCache.isValid()) {
|
| 126 |
+
processAccountsData(globalAccountsCache.accounts);
|
| 127 |
+
return;
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
// 否则从API获取数据
|
| 131 |
+
const response = await axios.get(`/api/getValidAccounts`);
|
| 132 |
+
if (response.data.code === 200 && response.data.data) {
|
| 133 |
+
// 更新全局缓存
|
| 134 |
+
globalAccountsCache.updateCache(response.data.data);
|
| 135 |
+
// 处理账号数据
|
| 136 |
+
processAccountsData(response.data.data);
|
| 137 |
+
}
|
| 138 |
+
} catch (error) {
|
| 139 |
+
console.error('获取账号列表失败:', error);
|
| 140 |
+
accountsList.value = [];
|
| 141 |
+
}
|
| 142 |
+
};
|
| 143 |
+
|
| 144 |
+
// 处理账号数据
|
| 145 |
+
const processAccountsData = (data) => {
|
| 146 |
+
// 提取所有账号的昵称信息
|
| 147 |
+
accountsList.value = data.map(account => ({
|
| 148 |
+
id: account[0] || Math.random().toString(36).substr(2, 9),
|
| 149 |
+
name: account[3] || '未命名账号',
|
| 150 |
+
type: account[1]
|
| 151 |
+
|
| 152 |
+
}));
|
| 153 |
+
};
|
| 154 |
+
|
| 155 |
+
// 组件挂载时获取账号列表
|
| 156 |
+
onMounted(() => {
|
| 157 |
+
fetchAccounts();
|
| 158 |
+
});
|
| 159 |
+
|
| 160 |
+
</script>
|
| 161 |
+
|
| 162 |
+
<style scoped>
|
| 163 |
+
.publish-view {
|
| 164 |
+
padding: 20px;
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
h1 {
|
| 168 |
+
margin-bottom: 20px;
|
| 169 |
+
font-size: 24px;
|
| 170 |
+
font-weight: 500;
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
/* 筛选栏样式 */
|
| 174 |
+
.filter-bar {
|
| 175 |
+
display: flex;
|
| 176 |
+
justify-content: space-between;
|
| 177 |
+
margin-bottom: 20px;
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
.filter-items {
|
| 181 |
+
display: flex;
|
| 182 |
+
gap: 15px;
|
| 183 |
+
}
|
| 184 |
+
|
| 185 |
+
.filter-select {
|
| 186 |
+
padding: 8px 15px;
|
| 187 |
+
border: 1px solid #e0e0e0;
|
| 188 |
+
border-radius: 4px;
|
| 189 |
+
background-color: #fff;
|
| 190 |
+
min-width: 150px;
|
| 191 |
+
font-size: 14px;
|
| 192 |
+
outline: none;
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
/* 按钮样式 */
|
| 196 |
+
.action-buttons {
|
| 197 |
+
display: flex;
|
| 198 |
+
gap: 15px;
|
| 199 |
+
}
|
| 200 |
+
|
| 201 |
+
.btn {
|
| 202 |
+
padding: 8px 15px;
|
| 203 |
+
border-radius: 4px;
|
| 204 |
+
border: none;
|
| 205 |
+
font-size: 14px;
|
| 206 |
+
cursor: pointer;
|
| 207 |
+
display: flex;
|
| 208 |
+
align-items: center;
|
| 209 |
+
justify-content: center;
|
| 210 |
+
}
|
| 211 |
+
|
| 212 |
+
.btn-export, .btn-delete {
|
| 213 |
+
background-color: #fff;
|
| 214 |
+
border: 1px solid #e0e0e0;
|
| 215 |
+
}
|
| 216 |
+
|
| 217 |
+
.btn-add {
|
| 218 |
+
background-color: #6366f1;
|
| 219 |
+
color: white;
|
| 220 |
+
position: relative;
|
| 221 |
+
}
|
| 222 |
+
|
| 223 |
+
.add-icon {
|
| 224 |
+
margin-right: 5px;
|
| 225 |
+
font-size: 16px;
|
| 226 |
+
}
|
| 227 |
+
|
| 228 |
+
/* 下拉菜单样式 */
|
| 229 |
+
.dropdown {
|
| 230 |
+
position: relative;
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
.dropdown-menu {
|
| 234 |
+
position: absolute;
|
| 235 |
+
top: 100%;
|
| 236 |
+
right: 0;
|
| 237 |
+
width: 200px;
|
| 238 |
+
background: white;
|
| 239 |
+
border-radius: 8px;
|
| 240 |
+
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
|
| 241 |
+
margin-top: 5px;
|
| 242 |
+
z-index: 10;
|
| 243 |
+
overflow: hidden;
|
| 244 |
+
display: none;
|
| 245 |
+
padding-top: 5px; /* 添加顶部内边距 */
|
| 246 |
+
}
|
| 247 |
+
|
| 248 |
+
/* 添加一个看不见的连接区域 */
|
| 249 |
+
.dropdown::after {
|
| 250 |
+
content: '';
|
| 251 |
+
position: absolute;
|
| 252 |
+
height: 10px;
|
| 253 |
+
width: 100%;
|
| 254 |
+
bottom: -10px;
|
| 255 |
+
left: 0;
|
| 256 |
+
}
|
| 257 |
+
|
| 258 |
+
.dropdown-menu.show {
|
| 259 |
+
display: block;
|
| 260 |
+
}
|
| 261 |
+
|
| 262 |
+
.dropdown-item {
|
| 263 |
+
padding: 12px 15px;
|
| 264 |
+
display: flex;
|
| 265 |
+
align-items: center;
|
| 266 |
+
cursor: pointer;
|
| 267 |
+
}
|
| 268 |
+
|
| 269 |
+
.dropdown-item:hover {
|
| 270 |
+
background-color: #f5f5f5;
|
| 271 |
+
}
|
| 272 |
+
|
| 273 |
+
.item-icon {
|
| 274 |
+
width: 24px;
|
| 275 |
+
height: 24px;
|
| 276 |
+
border-radius: 50%;
|
| 277 |
+
margin-right: 10px;
|
| 278 |
+
display: flex;
|
| 279 |
+
align-items: center;
|
| 280 |
+
justify-content: center;
|
| 281 |
+
}
|
| 282 |
+
|
| 283 |
+
.video-icon {
|
| 284 |
+
background-color: #e0f2fe;
|
| 285 |
+
position: relative;
|
| 286 |
+
}
|
| 287 |
+
|
| 288 |
+
.video-icon::before {
|
| 289 |
+
content: '';
|
| 290 |
+
width: 10px;
|
| 291 |
+
height: 10px;
|
| 292 |
+
background-color: #0ea5e9;
|
| 293 |
+
border-radius: 50%;
|
| 294 |
+
}
|
| 295 |
+
|
| 296 |
+
.image-icon {
|
| 297 |
+
background-color: #dcfce7;
|
| 298 |
+
position: relative;
|
| 299 |
+
}
|
| 300 |
+
|
| 301 |
+
.image-icon::before {
|
| 302 |
+
content: '';
|
| 303 |
+
width: 10px;
|
| 304 |
+
height: 10px;
|
| 305 |
+
background-color: #22c55e;
|
| 306 |
+
border-radius: 50%;
|
| 307 |
+
}
|
| 308 |
+
|
| 309 |
+
.multi-icon {
|
| 310 |
+
background-color: #f0e7fe;
|
| 311 |
+
position: relative;
|
| 312 |
+
}
|
| 313 |
+
|
| 314 |
+
.multi-icon::before {
|
| 315 |
+
content: '';
|
| 316 |
+
width: 10px;
|
| 317 |
+
height: 10px;
|
| 318 |
+
background-color: #8b5cf6;
|
| 319 |
+
border-radius: 50%;
|
| 320 |
+
}
|
| 321 |
+
|
| 322 |
+
.article-icon {
|
| 323 |
+
background-color: #fef2f2;
|
| 324 |
+
position: relative;
|
| 325 |
+
}
|
| 326 |
+
|
| 327 |
+
.article-icon::before {
|
| 328 |
+
content: '';
|
| 329 |
+
width: 10px;
|
| 330 |
+
height: 10px;
|
| 331 |
+
background-color: #ef4444;
|
| 332 |
+
border-radius: 50%;
|
| 333 |
+
}
|
| 334 |
+
|
| 335 |
+
.wechat-icon {
|
| 336 |
+
background-color: #ecfdf5;
|
| 337 |
+
position: relative;
|
| 338 |
+
}
|
| 339 |
+
|
| 340 |
+
.wechat-icon::before {
|
| 341 |
+
content: '';
|
| 342 |
+
width: 10px;
|
| 343 |
+
height: 10px;
|
| 344 |
+
background-color: #10b981;
|
| 345 |
+
border-radius: 50%;
|
| 346 |
+
}
|
| 347 |
+
|
| 348 |
+
/* 空状态样式 */
|
| 349 |
+
.empty-state {
|
| 350 |
+
display: flex;
|
| 351 |
+
flex-direction: column;
|
| 352 |
+
align-items: center;
|
| 353 |
+
justify-content: center;
|
| 354 |
+
padding: 100px 0;
|
| 355 |
+
background-color: #fff;
|
| 356 |
+
border-radius: 8px;
|
| 357 |
+
margin-top: 20px;
|
| 358 |
+
}
|
| 359 |
+
|
| 360 |
+
.empty-image {
|
| 361 |
+
width: 120px;
|
| 362 |
+
height: 120px;
|
| 363 |
+
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%23d1d5db" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"><path d="M22 12h-4l-3 9L9 3l-3 9H2"/></svg>');
|
| 364 |
+
background-repeat: no-repeat;
|
| 365 |
+
background-position: center;
|
| 366 |
+
background-size: contain;
|
| 367 |
+
margin-bottom: 20px;
|
| 368 |
+
opacity: 0.5;
|
| 369 |
+
}
|
| 370 |
+
|
| 371 |
+
.empty-text {
|
| 372 |
+
color: #9ca3af;
|
| 373 |
+
font-size: 14px;
|
| 374 |
+
}
|
| 375 |
+
</style>
|
sau_frontend/src/components/VideoPublishView.vue
ADDED
|
@@ -0,0 +1,1759 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
| 1 |
+
<template>
|
| 2 |
+
<div class="video-publish-container">
|
| 3 |
+
<!-- 视频上传区域 -->
|
| 4 |
+
<div class="section">
|
| 5 |
+
<div class="section-title">视频</div>
|
| 6 |
+
<div class="videos-container">
|
| 7 |
+
<div class="video-upload-area" @click="showSourceSelector" v-if="videoList.length < 5">
|
| 8 |
+
<div class="upload-icon">
|
| 9 |
+
<span class="icon">↑</span>
|
| 10 |
+
<span class="text">上传</span>
|
| 11 |
+
</div>
|
| 12 |
+
</div>
|
| 13 |
+
<div v-for="(video, index) in videoList" :key="index" class="video-preview">
|
| 14 |
+
<video controls :src="video.previewUrl"></video>
|
| 15 |
+
<div class="video-actions">
|
| 16 |
+
<button class="remove-btn" @click.stop="removeVideo(index)">删除</button>
|
| 17 |
+
</div>
|
| 18 |
+
</div>
|
| 19 |
+
</div>
|
| 20 |
+
<div class="video-count" v-if="videoList.length > 0">
|
| 21 |
+
已上传 {{ videoList.length }} 个视频 (最多5个)
|
| 22 |
+
</div>
|
| 23 |
+
<input type="file" ref="videoInput" accept="video/*" style="display: none" @change="handleVideoUpload" />
|
| 24 |
+
|
| 25 |
+
<!-- 视频来源选择器 -->
|
| 26 |
+
<div class="source-selector" v-if="isSourceSelectorVisible" @click="hideSourceSelector">
|
| 27 |
+
<div class="source-selector-content" @click.stop>
|
| 28 |
+
<div class="source-option" @click="selectLocalSource">
|
| 29 |
+
<span>本地视频</span>
|
| 30 |
+
</div>
|
| 31 |
+
<div class="source-option" @click="showMaterialLibrary">
|
| 32 |
+
<span>素材库</span>
|
| 33 |
+
</div>
|
| 34 |
+
</div>
|
| 35 |
+
</div>
|
| 36 |
+
|
| 37 |
+
<!-- 素材库选择弹窗 -->
|
| 38 |
+
<div class="material-library-modal" v-if="isMaterialLibraryVisible" @click="closeMaterialLibraryOnOutsideClick">
|
| 39 |
+
<div class="material-library-content">
|
| 40 |
+
<div class="modal-header">
|
| 41 |
+
<h3>选择素材</h3>
|
| 42 |
+
<button class="close-btn" @click="hideMaterialLibrary">×</button>
|
| 43 |
+
</div>
|
| 44 |
+
<div class="modal-body">
|
| 45 |
+
<div v-if="isLoadingMaterials" class="loading-materials">
|
| 46 |
+
<span>加载素材中...</span>
|
| 47 |
+
</div>
|
| 48 |
+
<div v-else-if="materialList.length === 0" class="no-materials">
|
| 49 |
+
<span>暂无可用素材</span>
|
| 50 |
+
</div>
|
| 51 |
+
<div v-else class="material-grid">
|
| 52 |
+
<div v-for="material in materialList" :key="material.id" class="material-item"
|
| 53 |
+
:class="{ 'selected': selectedMaterial === material.id }" @click="selectMaterial(material)">
|
| 54 |
+
<div class="material-checkbox">
|
| 55 |
+
<div class="checkbox" :class="{ 'checked': selectedMaterial === material.id }"></div>
|
| 56 |
+
</div>
|
| 57 |
+
<div class="material-preview">
|
| 58 |
+
<img src="@/assets/bofang.png" alt="播放图标" class="play-icon">
|
| 59 |
+
</div>
|
| 60 |
+
<div class="material-info">
|
| 61 |
+
<div class="material-name">{{ material.filename }}</div>
|
| 62 |
+
</div>
|
| 63 |
+
</div>
|
| 64 |
+
</div>
|
| 65 |
+
</div>
|
| 66 |
+
<div class="modal-footer">
|
| 67 |
+
<button class="cancel-btn" @click="hideMaterialLibrary">取消</button>
|
| 68 |
+
<button class="confirm-btn" @click="confirmMaterialSelection" :disabled="!selectedMaterial">确认</button>
|
| 69 |
+
</div>
|
| 70 |
+
</div>
|
| 71 |
+
</div>
|
| 72 |
+
</div>
|
| 73 |
+
|
| 74 |
+
<!-- 账号选择区域 -->
|
| 75 |
+
<div class="section">
|
| 76 |
+
<div class="section-title">账号</div>
|
| 77 |
+
<div class="account-selector" @click="showAccountSelector">
|
| 78 |
+
<div v-if="selectedAccounts.length === 0" class="account-placeholder">
|
| 79 |
+
<span>+ 添加账号</span>
|
| 80 |
+
</div>
|
| 81 |
+
<div v-else class="selected-accounts-container">
|
| 82 |
+
<div v-for="(account, index) in selectedAccounts" :key="account.id" class="selected-account">
|
| 83 |
+
<img :src="account.avatar" alt="账号头像" class="account-avatar" />
|
| 84 |
+
<span class="account-name">{{ account.name }}</span>
|
| 85 |
+
<span class="account-status" :class="account.statusType">{{ account.status }}</span>
|
| 86 |
+
<button class="remove-account-btn" @click.stop="removeAccount(index)">×</button>
|
| 87 |
+
</div>
|
| 88 |
+
<div class="add-more-account" @click.stop="showAccountSelector">
|
| 89 |
+
<span>+ 添加更多</span>
|
| 90 |
+
</div>
|
| 91 |
+
</div>
|
| 92 |
+
</div>
|
| 93 |
+
</div>
|
| 94 |
+
|
| 95 |
+
<!-- 账号选择弹窗 -->
|
| 96 |
+
<div class="account-selector-modal" v-if="isAccountSelectorVisible" @click="closeModalOnOutsideClick">
|
| 97 |
+
<div class="account-selector-content">
|
| 98 |
+
<div class="modal-header">
|
| 99 |
+
<h3>选择账号</h3>
|
| 100 |
+
<button class="refresh-btn" @click.stop="refreshAccounts" title="刷新账号列表">
|
| 101 |
+
<span class="refresh-icon">↻</span>
|
| 102 |
+
</button>
|
| 103 |
+
<button class="close-btn" @click="hideAccountSelector">×</button>
|
| 104 |
+
</div>
|
| 105 |
+
<div class="modal-body">
|
| 106 |
+
<div v-if="isAccountsLoading" class="loading-accounts">
|
| 107 |
+
<span>加载账号中...</span>
|
| 108 |
+
</div>
|
| 109 |
+
<div v-else-if="accountList.length === 0" class="no-accounts">
|
| 110 |
+
<span>暂无可用账号</span>
|
| 111 |
+
</div>
|
| 112 |
+
<div v-else class="account-list">
|
| 113 |
+
<div v-for="account in accountList" :key="account.id" class="account-item"
|
| 114 |
+
:class="{ 'selected': isAccountSelected(account) }" @click="selectAccount(account)">
|
| 115 |
+
<div class="account-checkbox">
|
| 116 |
+
<div class="checkbox" :class="{ 'checked': isAccountSelected(account) }"></div>
|
| 117 |
+
</div>
|
| 118 |
+
<img :src="account.avatar" alt="账号头像" class="account-avatar" />
|
| 119 |
+
<div class="account-info">
|
| 120 |
+
<div class="account-name">{{ account.name }}</div>
|
| 121 |
+
<div class="account-status" :class="account.statusType">{{ account.status }}</div>
|
| 122 |
+
</div>
|
| 123 |
+
</div>
|
| 124 |
+
</div>
|
| 125 |
+
</div>
|
| 126 |
+
<div class="modal-footer">
|
| 127 |
+
<button class="cancel-btn" @click="hideAccountSelector">取消</button>
|
| 128 |
+
<button class="confirm-btn" @click="confirmAccountSelection">确认</button>
|
| 129 |
+
</div>
|
| 130 |
+
</div>
|
| 131 |
+
</div>
|
| 132 |
+
|
| 133 |
+
<!-- 平台选择区域 -->
|
| 134 |
+
<div class="section">
|
| 135 |
+
<div class="section-title">平台</div>
|
| 136 |
+
<div class="platform-selector">
|
| 137 |
+
<button class="platform-btn" :class="{ 'active': selectedPlatform === 3 }" @click="selectPlatform(3)">
|
| 138 |
+
抖音
|
| 139 |
+
</button>
|
| 140 |
+
<button class="platform-btn" :class="{ 'active': selectedPlatform === 4 }" @click="selectPlatform(4)">
|
| 141 |
+
快手
|
| 142 |
+
</button>
|
| 143 |
+
<button class="platform-btn" :class="{ 'active': selectedPlatform === 2 }" @click="selectPlatform(2)">
|
| 144 |
+
视频号
|
| 145 |
+
</button>
|
| 146 |
+
<button class="platform-btn" :class="{ 'active': selectedPlatform === 1 }" @click="selectPlatform(1)">
|
| 147 |
+
小红书
|
| 148 |
+
</button>
|
| 149 |
+
</div>
|
| 150 |
+
</div>
|
| 151 |
+
|
| 152 |
+
<!-- 标题输入区域 -->
|
| 153 |
+
<div class="section">
|
| 154 |
+
<div class="section-title">标题</div>
|
| 155 |
+
<div class="title-input-container">
|
| 156 |
+
<textarea v-model="title" @input="updateCharCount" placeholder="请输入标题" maxlength="100"
|
| 157 |
+
rows="2"></textarea>
|
| 158 |
+
<div class="char-count">{{ charCount }}/100</div>
|
| 159 |
+
</div>
|
| 160 |
+
</div>
|
| 161 |
+
|
| 162 |
+
<!-- 话题选择区域 -->
|
| 163 |
+
<div class="section">
|
| 164 |
+
<div class="section-title">话题</div>
|
| 165 |
+
<div class="tags-container">
|
| 166 |
+
<div v-for="(tag, index) in tags" :key="index" class="tag">
|
| 167 |
+
{{ tag }}
|
| 168 |
+
<span class="remove-tag" @click="removeTag(index)">×</span>
|
| 169 |
+
</div>
|
| 170 |
+
<div class="add-tag" @click="showTagSelector">+ 添加话题</div>
|
| 171 |
+
</div>
|
| 172 |
+
</div>
|
| 173 |
+
|
| 174 |
+
<!-- 话题选择弹窗 -->
|
| 175 |
+
<div class="tag-selector-modal" v-if="isTagSelectorVisible" @click="closeTagSelectorOnOutsideClick">
|
| 176 |
+
<div class="tag-selector-content">
|
| 177 |
+
<div class="modal-header">
|
| 178 |
+
<h3>选择话题</h3>
|
| 179 |
+
<button class="close-btn" @click="hideTagSelector">×</button>
|
| 180 |
+
</div>
|
| 181 |
+
<div class="modal-body">
|
| 182 |
+
<div class="custom-tag-input">
|
| 183 |
+
<input v-model="customTag" placeholder="输入自定义话题" @keyup.enter="addCustomTag" />
|
| 184 |
+
<button @click="addCustomTag">添加</button>
|
| 185 |
+
</div>
|
| 186 |
+
<div class="suggested-tags">
|
| 187 |
+
<h4>推荐话题</h4>
|
| 188 |
+
<div class="tag-grid">
|
| 189 |
+
<div v-for="tag in suggestedTags" :key="tag" class="suggested-tag"
|
| 190 |
+
@click="addSuggestedTag(tag)">
|
| 191 |
+
{{ tag }}
|
| 192 |
+
</div>
|
| 193 |
+
</div>
|
| 194 |
+
</div>
|
| 195 |
+
</div>
|
| 196 |
+
</div>
|
| 197 |
+
</div>
|
| 198 |
+
|
| 199 |
+
<!-- 位置输入区域 -->
|
| 200 |
+
<!-- <div class="section">
|
| 201 |
+
<div class="section-title">位置</div>
|
| 202 |
+
<div class="location-input-container">
|
| 203 |
+
<input v-model="location" placeholder="请输入位置" maxlength="50" />
|
| 204 |
+
</div>
|
| 205 |
+
</div> -->
|
| 206 |
+
|
| 207 |
+
<!-- 定时发布设置区域 -->
|
| 208 |
+
<div class="section">
|
| 209 |
+
<div class="section-title">定时发布</div>
|
| 210 |
+
<div class="timer-toggle">
|
| 211 |
+
<label class="switch">
|
| 212 |
+
<input type="checkbox" v-model="enableTimer">
|
| 213 |
+
<span class="slider round"></span>
|
| 214 |
+
</label>
|
| 215 |
+
<span>{{ enableTimer ? '已开启' : '已关闭' }}</span>
|
| 216 |
+
</div>
|
| 217 |
+
|
| 218 |
+
<div class="timer-settings" v-if="enableTimer">
|
| 219 |
+
<div class="setting-item">
|
| 220 |
+
<label>每天发布视频数</label>
|
| 221 |
+
<select v-model="videosPerDay">
|
| 222 |
+
<option v-for="n in 5" :key="n" :value="n">{{ n }}</option>
|
| 223 |
+
</select>
|
| 224 |
+
</div>
|
| 225 |
+
|
| 226 |
+
<div class="setting-item">
|
| 227 |
+
<label>每天发布时间</label>
|
| 228 |
+
<div class="time-slots">
|
| 229 |
+
<div v-for="(time, index) in dailyTimes" :key="index" class="time-slot">
|
| 230 |
+
<input type="time" v-model="dailyTimes[index]">
|
| 231 |
+
<button v-if="dailyTimes.length > 1" @click="removeTimeSlot(index)"
|
| 232 |
+
class="remove-time-btn">×</button>
|
| 233 |
+
</div>
|
| 234 |
+
<button v-if="dailyTimes.length < videosPerDay" @click="addTimeSlot" class="add-time-btn">+
|
| 235 |
+
添加时间</button>
|
| 236 |
+
</div>
|
| 237 |
+
</div>
|
| 238 |
+
|
| 239 |
+
<div class="setting-item">
|
| 240 |
+
<label>开始天数</label>
|
| 241 |
+
<select v-model="startDays">
|
| 242 |
+
<option :value="0">明天</option>
|
| 243 |
+
<option :value="1">后天</option>
|
| 244 |
+
</select>
|
| 245 |
+
</div>
|
| 246 |
+
</div>
|
| 247 |
+
</div>
|
| 248 |
+
|
| 249 |
+
<!-- 操作按钮区域 -->
|
| 250 |
+
<div class="action-buttons">
|
| 251 |
+
<button class="preview-btn" @click="previewContent" :disabled="videoList.length === 0 || isUploading">
|
| 252 |
+
预览
|
| 253 |
+
</button>
|
| 254 |
+
<button class="publish-btn" @click="publishContent"
|
| 255 |
+
:disabled="videoList.length === 0 || !title || selectedAccounts.length === 0 || !selectedPlatform || isUploading">
|
| 256 |
+
{{ isUploading ? '上传中...' : '发布' }}
|
| 257 |
+
</button>
|
| 258 |
+
</div>
|
| 259 |
+
</div>
|
| 260 |
+
</template>
|
| 261 |
+
|
| 262 |
+
<script setup>
|
| 263 |
+
import { ref, onMounted, onUnmounted, watch, defineProps } from 'vue';
|
| 264 |
+
import { useRoute } from 'vue-router';
|
| 265 |
+
import { API_BASE_URL, globalAccountsCache } from '../config';
|
| 266 |
+
import axios from 'axios';
|
| 267 |
+
import tx from '@assets/fengbaobao.png'
|
| 268 |
+
|
| 269 |
+
// 定义props接收路由参数
|
| 270 |
+
const props = defineProps({
|
| 271 |
+
id: {
|
| 272 |
+
type: String,
|
| 273 |
+
required: true
|
| 274 |
+
}
|
| 275 |
+
});
|
| 276 |
+
|
| 277 |
+
// 使用路由参数作为组件实例的唯一标识
|
| 278 |
+
const route = useRoute();
|
| 279 |
+
const suggestedTags = ['游戏', '电影', '音乐', '美食', '旅行', '文化', '科技', '生活', '娱乐', '体育', '教育', '艺术', '健康', '时尚', '美食', '旅行', '文化', '科技', '生活', '娱乐', '体育', '教育', '艺术', '健康', '时尚'];
|
| 280 |
+
const instanceId = route.params.id || Date.now().toString();
|
| 281 |
+
|
| 282 |
+
// 组件状态
|
| 283 |
+
// 组件状态
|
| 284 |
+
const videoInput = ref(null);
|
| 285 |
+
const videoList = ref([]); // 修改为视频列表
|
| 286 |
+
const title = ref('');
|
| 287 |
+
const charCount = ref(0);
|
| 288 |
+
const tags = ref([]);
|
| 289 |
+
const location = ref('');
|
| 290 |
+
const file_list = ref([]); // 保存上传后的fileID
|
| 291 |
+
const isUploading = ref(false); // 上传状态
|
| 292 |
+
const customTag = ref(''); // 自定义话题输入
|
| 293 |
+
const isTagSelectorVisible = ref(false); // 话题选择器是否可见
|
| 294 |
+
|
| 295 |
+
// 视频来源选择器相关
|
| 296 |
+
const isSourceSelectorVisible = ref(false); // 视频来源选择器是否可见
|
| 297 |
+
|
| 298 |
+
// 素材库选择相关
|
| 299 |
+
const isMaterialLibraryVisible = ref(false); // 素材库选择器是否可见
|
| 300 |
+
const isLoadingMaterials = ref(false); // 素材加载状态
|
| 301 |
+
const materialList = ref([]); // 素材列表
|
| 302 |
+
const selectedMaterial = ref(null); // 选中的素材ID
|
| 303 |
+
|
| 304 |
+
// 账号选择相关
|
| 305 |
+
const selectedAccounts = ref([]); // 选中的账号列表
|
| 306 |
+
const tempSelectedAccounts = ref([]); // 临时选中的账号列表,用于确认前的暂存
|
| 307 |
+
const isAccountSelectorVisible = ref(false); // 账号选择器是否可见
|
| 308 |
+
const isAccountsLoading = ref(false); // 账号加载状态
|
| 309 |
+
const accountList = ref([]); // 账号列表
|
| 310 |
+
const account_list = ref([]); // 保存选中账号的cookie
|
| 311 |
+
|
| 312 |
+
// 平台选择相关
|
| 313 |
+
const selectedPlatform = ref(null); // 选中的平台:3-抖音,2-视频号,1-小红书
|
| 314 |
+
|
| 315 |
+
// 定时发布相关
|
| 316 |
+
const enableTimer = ref(false); // 是否启用定时发布
|
| 317 |
+
const videosPerDay = ref(1); // 每天发布视频数
|
| 318 |
+
const dailyTimes = ref(['08:00']); // 每天发布时间
|
| 319 |
+
const startDays = ref(0); // 开始天数:0-明天,1-后天
|
| 320 |
+
|
| 321 |
+
// 触发视频上传
|
| 322 |
+
const triggerVideoUpload = () => {
|
| 323 |
+
videoInput.value?.click();
|
| 324 |
+
};
|
| 325 |
+
|
| 326 |
+
// 显示视频来源选择器
|
| 327 |
+
const showSourceSelector = () => {
|
| 328 |
+
isSourceSelectorVisible.value = true;
|
| 329 |
+
};
|
| 330 |
+
|
| 331 |
+
// 隐藏视频来源选择器
|
| 332 |
+
const hideSourceSelector = () => {
|
| 333 |
+
isSourceSelectorVisible.value = false;
|
| 334 |
+
};
|
| 335 |
+
|
| 336 |
+
// 选择本地视频源
|
| 337 |
+
const selectLocalSource = () => {
|
| 338 |
+
hideSourceSelector();
|
| 339 |
+
triggerVideoUpload();
|
| 340 |
+
};
|
| 341 |
+
|
| 342 |
+
// 显示素材库
|
| 343 |
+
const showMaterialLibrary = () => {
|
| 344 |
+
hideSourceSelector();
|
| 345 |
+
isMaterialLibraryVisible.value = true;
|
| 346 |
+
fetchMaterials();
|
| 347 |
+
};
|
| 348 |
+
|
| 349 |
+
// 隐藏素材库
|
| 350 |
+
const hideMaterialLibrary = () => {
|
| 351 |
+
isMaterialLibraryVisible.value = false;
|
| 352 |
+
selectedMaterial.value = null;
|
| 353 |
+
};
|
| 354 |
+
|
| 355 |
+
// 点击素材库外部关闭
|
| 356 |
+
const closeMaterialLibraryOnOutsideClick = (event) => {
|
| 357 |
+
if (event.target.classList.contains('material-library-modal')) {
|
| 358 |
+
hideMaterialLibrary();
|
| 359 |
+
}
|
| 360 |
+
};
|
| 361 |
+
|
| 362 |
+
// 获取素材列表
|
| 363 |
+
const fetchMaterials = async () => {
|
| 364 |
+
isLoadingMaterials.value = true;
|
| 365 |
+
try {
|
| 366 |
+
const response = await axios.get(`/api/getFiles`);
|
| 367 |
+
console.log('获取素材列表响应:', response.data);
|
| 368 |
+
|
| 369 |
+
if (response.data.code === 200) {
|
| 370 |
+
// 处理文件路径,添加完整的请求地址
|
| 371 |
+
const materialItems = (response.data.data || []).map(item => {
|
| 372 |
+
return {
|
| 373 |
+
...item,
|
| 374 |
+
file_path: `/api${item.file_path}` // 添加API前缀到文件路径
|
| 375 |
+
};
|
| 376 |
+
});
|
| 377 |
+
|
| 378 |
+
// 对每个素材调用getFile接口获取视频数据
|
| 379 |
+
const materialPromises = materialItems.map(async (item) => {
|
| 380 |
+
try {
|
| 381 |
+
// 从file_path中提取文件名
|
| 382 |
+
const filename = item.file_path.split('/').pop();
|
| 383 |
+
if (!filename) return item;
|
| 384 |
+
|
| 385 |
+
// 调用getFile接口获取视频数据
|
| 386 |
+
const fileResponse = await axios.get(`/api/getFile`, {
|
| 387 |
+
params: { filename: filename }
|
| 388 |
+
});
|
| 389 |
+
|
| 390 |
+
console.log(`获取素材 ${filename} 数据:`, fileResponse.data);
|
| 391 |
+
|
| 392 |
+
if (fileResponse.data.code === 200) {
|
| 393 |
+
// 将获取的视频数据合并到素材对象中
|
| 394 |
+
return {
|
| 395 |
+
...item,
|
| 396 |
+
videoData: fileResponse.data.data
|
| 397 |
+
};
|
| 398 |
+
}
|
| 399 |
+
return item;
|
| 400 |
+
} catch (error) {
|
| 401 |
+
console.error(`获取素材 ${item.filename || item.file_name} 数据失败:`, error);
|
| 402 |
+
return item;
|
| 403 |
+
}
|
| 404 |
+
});
|
| 405 |
+
|
| 406 |
+
// 等待所有getFile请求完成
|
| 407 |
+
materialList.value = await Promise.all(materialPromises);
|
| 408 |
+
|
| 409 |
+
console.log('处理后的素材列表:', materialList.value);
|
| 410 |
+
} else {
|
| 411 |
+
console.error('获取素材列表失败:', response.data.message);
|
| 412 |
+
}
|
| 413 |
+
} catch (error) {
|
| 414 |
+
console.error('获取素材列表失败:', error);
|
| 415 |
+
} finally {
|
| 416 |
+
isLoadingMaterials.value = false;
|
| 417 |
+
}
|
| 418 |
+
};
|
| 419 |
+
|
| 420 |
+
// 选择素材
|
| 421 |
+
const selectMaterial = (material) => {
|
| 422 |
+
// 如果点击的是已选中的素材,则取消选���
|
| 423 |
+
if (selectedMaterial.value === material.id) {
|
| 424 |
+
selectedMaterial.value = null;
|
| 425 |
+
} else {
|
| 426 |
+
selectedMaterial.value = material.id;
|
| 427 |
+
}
|
| 428 |
+
};
|
| 429 |
+
|
| 430 |
+
// 确认素材选择
|
| 431 |
+
const confirmMaterialSelection = () => {
|
| 432 |
+
if (!selectedMaterial.value) return;
|
| 433 |
+
|
| 434 |
+
const material = materialList.value.find(m => m.id === selectedMaterial.value);
|
| 435 |
+
if (material) {
|
| 436 |
+
// 从file_path中提取第一个下划线之前的内容作为fileID
|
| 437 |
+
const filePath = material.file_path;
|
| 438 |
+
const fileId = filePath.split('_')[0].split('/').pop();
|
| 439 |
+
console.log('选择的素材ID:', fileId);
|
| 440 |
+
|
| 441 |
+
// 添加到file_list
|
| 442 |
+
if (fileId && !file_list.value.includes(fileId)) {
|
| 443 |
+
file_list.value.push(fileId);
|
| 444 |
+
}
|
| 445 |
+
|
| 446 |
+
// 添加到视频列表用于预览
|
| 447 |
+
videoList.value.push({
|
| 448 |
+
previewUrl: material.file_path,
|
| 449 |
+
isFromLibrary: true
|
| 450 |
+
});
|
| 451 |
+
}
|
| 452 |
+
|
| 453 |
+
hideMaterialLibrary();
|
| 454 |
+
};
|
| 455 |
+
|
| 456 |
+
// 判断是否为视频文件
|
| 457 |
+
const isVideo = (filename) => {
|
| 458 |
+
if (!filename) return false;
|
| 459 |
+
const videoExtensions = ['.mp4', '.avi', '.mov', '.wmv', '.flv', '.mkv'];
|
| 460 |
+
return videoExtensions.some(ext => filename.toLowerCase().endsWith(ext));
|
| 461 |
+
};
|
| 462 |
+
|
| 463 |
+
// 处理视频上传
|
| 464 |
+
const handleVideoUpload = (event) => {
|
| 465 |
+
const input = event.target;
|
| 466 |
+
console.log('触发视频上传:', input);
|
| 467 |
+
if (input.files && input.files.length > 0) {
|
| 468 |
+
const file = input.files[0];
|
| 469 |
+
console.log('上传的文件:', file);
|
| 470 |
+
const previewUrl = URL.createObjectURL(file);
|
| 471 |
+
console.log('预览URL:', previewUrl);
|
| 472 |
+
videoList.value.push({ file, previewUrl });
|
| 473 |
+
console.log('添加到视频列表:', videoList.value);
|
| 474 |
+
|
| 475 |
+
// 清空input,允许再次选择相同文件
|
| 476 |
+
if (videoInput.value) {
|
| 477 |
+
videoInput.value.value = '';
|
| 478 |
+
}
|
| 479 |
+
}
|
| 480 |
+
};
|
| 481 |
+
|
| 482 |
+
// 删除视频
|
| 483 |
+
const removeVideo = (index) => {
|
| 484 |
+
if (videoList.value[index].previewUrl) {
|
| 485 |
+
URL.revokeObjectURL(videoList.value[index].previewUrl);
|
| 486 |
+
}
|
| 487 |
+
videoList.value.splice(index, 1);
|
| 488 |
+
};
|
| 489 |
+
|
| 490 |
+
// 更新字符计数
|
| 491 |
+
const updateCharCount = () => {
|
| 492 |
+
charCount.value = title.value.length;
|
| 493 |
+
};
|
| 494 |
+
|
| 495 |
+
// 显示话题选择器
|
| 496 |
+
const showTagSelector = () => {
|
| 497 |
+
isTagSelectorVisible.value = true;
|
| 498 |
+
};
|
| 499 |
+
|
| 500 |
+
// 隐藏话题选择器
|
| 501 |
+
const hideTagSelector = () => {
|
| 502 |
+
isTagSelectorVisible.value = false;
|
| 503 |
+
customTag.value = ''; // 清空自定义话题输入
|
| 504 |
+
};
|
| 505 |
+
|
| 506 |
+
// 点击话题选择器外部关闭
|
| 507 |
+
const closeTagSelectorOnOutsideClick = (event) => {
|
| 508 |
+
if (event.target.classList.contains('tag-selector-modal')) {
|
| 509 |
+
hideTagSelector();
|
| 510 |
+
}
|
| 511 |
+
};
|
| 512 |
+
|
| 513 |
+
// 添加预设话题
|
| 514 |
+
const addSuggestedTag = (tag) => {
|
| 515 |
+
if (!tags.value.includes(tag)) {
|
| 516 |
+
tags.value.push(tag);
|
| 517 |
+
}
|
| 518 |
+
};
|
| 519 |
+
|
| 520 |
+
// 添加自定义话题
|
| 521 |
+
const addCustomTag = () => {
|
| 522 |
+
if (customTag.value && !tags.value.includes(customTag.value)) {
|
| 523 |
+
tags.value.push(customTag.value);
|
| 524 |
+
customTag.value = ''; // 清空输入
|
| 525 |
+
}
|
| 526 |
+
};
|
| 527 |
+
|
| 528 |
+
// 删除话题
|
| 529 |
+
const removeTag = (index) => {
|
| 530 |
+
tags.value.splice(index, 1);
|
| 531 |
+
};
|
| 532 |
+
|
| 533 |
+
// 显示账号选择器
|
| 534 |
+
const showAccountSelector = () => {
|
| 535 |
+
// 检查是否已选择平台
|
| 536 |
+
if (!selectedPlatform.value) {
|
| 537 |
+
alert('请先选择平台');
|
| 538 |
+
return;
|
| 539 |
+
}
|
| 540 |
+
|
| 541 |
+
isAccountSelectorVisible.value = true;
|
| 542 |
+
// 复制当前选中的账号到临时选中列表
|
| 543 |
+
tempSelectedAccounts.value = [...selectedAccounts.value];
|
| 544 |
+
fetchAccounts();
|
| 545 |
+
};
|
| 546 |
+
|
| 547 |
+
// 隐藏账号选择器
|
| 548 |
+
const hideAccountSelector = () => {
|
| 549 |
+
isAccountSelectorVisible.value = false;
|
| 550 |
+
// 清空临时选中列表
|
| 551 |
+
tempSelectedAccounts.value = [];
|
| 552 |
+
};
|
| 553 |
+
|
| 554 |
+
// 点击模态框外部关闭
|
| 555 |
+
const closeModalOnOutsideClick = (event) => {
|
| 556 |
+
if (event.target.classList.contains('account-selector-modal')) {
|
| 557 |
+
hideAccountSelector();
|
| 558 |
+
}
|
| 559 |
+
};
|
| 560 |
+
|
| 561 |
+
// 获取账号列表
|
| 562 |
+
const fetchAccounts = async (forceRefresh = false) => {
|
| 563 |
+
isAccountsLoading.value = true;
|
| 564 |
+
|
| 565 |
+
// 检查全局缓存是否有效且不是强制刷新
|
| 566 |
+
if (!forceRefresh && globalAccountsCache.isValid()) {
|
| 567 |
+
console.log("使用缓存的账号列表数据");
|
| 568 |
+
accountList.value = formatAccountData(globalAccountsCache.accounts);
|
| 569 |
+
isAccountsLoading.value = false;
|
| 570 |
+
return;
|
| 571 |
+
}
|
| 572 |
+
|
| 573 |
+
try {
|
| 574 |
+
console.log("getValidAccounts请求前", `api/getValidAccounts`);
|
| 575 |
+
const response = await axios.get(`api/getValidAccounts`);
|
| 576 |
+
console.log("getValidAccounts",response.data.code);
|
| 577 |
+
|
| 578 |
+
if (response.data.code === 200) {
|
| 579 |
+
console.log("getValidAccounts",response.data.data);
|
| 580 |
+
|
| 581 |
+
// 更新全局缓存
|
| 582 |
+
globalAccountsCache.updateCache(response.data.data);
|
| 583 |
+
|
| 584 |
+
// 格式化账号数据
|
| 585 |
+
accountList.value = formatAccountData(response.data.data);
|
| 586 |
+
}
|
| 587 |
+
} catch (error) {
|
| 588 |
+
console.error('获取账号列表失败:', error);
|
| 589 |
+
accountList.value = [];
|
| 590 |
+
} finally {
|
| 591 |
+
isAccountsLoading.value = false;
|
| 592 |
+
}
|
| 593 |
+
};
|
| 594 |
+
|
| 595 |
+
// 格式化账号数据
|
| 596 |
+
const formatAccountData = (data) => {
|
| 597 |
+
return data.map(account => ({
|
| 598 |
+
id: account[0] || Math.random().toString(36).substr(2, 9),
|
| 599 |
+
name: account[3] || '未命名账号',
|
| 600 |
+
avatar: tx,
|
| 601 |
+
status: account[4] === 1 ? '正常' : '异常',
|
| 602 |
+
statusType: account[4] === 1 ? 'normal' : 'warning',
|
| 603 |
+
userData: account,
|
| 604 |
+
cookie: account[2] // 保存cookie路径
|
| 605 |
+
}));
|
| 606 |
+
};
|
| 607 |
+
|
| 608 |
+
// 刷新账号列表
|
| 609 |
+
const refreshAccounts = () => {
|
| 610 |
+
fetchAccounts(true); // 强制刷新
|
| 611 |
+
};
|
| 612 |
+
|
| 613 |
+
// 选择账号
|
| 614 |
+
const selectAccount = (account) => {
|
| 615 |
+
const index = tempSelectedAccounts.value.findIndex(item => item.id === account.id);
|
| 616 |
+
if (index === -1) {
|
| 617 |
+
// 如果账号不在临时选中列表中,添加它
|
| 618 |
+
tempSelectedAccounts.value.push(account);
|
| 619 |
+
} else {
|
| 620 |
+
// 如果账号已在临时选中列表中,移除它
|
| 621 |
+
tempSelectedAccounts.value.splice(index, 1);
|
| 622 |
+
}
|
| 623 |
+
};
|
| 624 |
+
|
| 625 |
+
// 确认账号选择
|
| 626 |
+
const confirmAccountSelection = () => {
|
| 627 |
+
// 将临时选中的账号列表应用到实际选中的账号列表
|
| 628 |
+
selectedAccounts.value = [...tempSelectedAccounts.value];
|
| 629 |
+
// 更新 account_list 用于 API 请求
|
| 630 |
+
account_list.value = selectedAccounts.value.map(account => account.cookie);
|
| 631 |
+
hideAccountSelector();
|
| 632 |
+
};
|
| 633 |
+
|
| 634 |
+
// 检查账号是否被选中
|
| 635 |
+
const isAccountSelected = (account) => {
|
| 636 |
+
return tempSelectedAccounts.value.some(item => item.id === account.id);
|
| 637 |
+
};
|
| 638 |
+
|
| 639 |
+
// 移除已选择的账号
|
| 640 |
+
const removeAccount = (index) => {
|
| 641 |
+
selectedAccounts.value.splice(index, 1);
|
| 642 |
+
// 更新 account_list
|
| 643 |
+
account_list.value = selectedAccounts.value.map(account => account.cookie);
|
| 644 |
+
};
|
| 645 |
+
|
| 646 |
+
// 选择平台
|
| 647 |
+
const selectPlatform = (platformId) => {
|
| 648 |
+
selectedPlatform.value = platformId;
|
| 649 |
+
};
|
| 650 |
+
|
| 651 |
+
// 添加时间槽
|
| 652 |
+
const addTimeSlot = () => {
|
| 653 |
+
if (dailyTimes.value.length < videosPerDay.value) {
|
| 654 |
+
dailyTimes.value.push('12:00');
|
| 655 |
+
}
|
| 656 |
+
};
|
| 657 |
+
|
| 658 |
+
// 移除时间槽
|
| 659 |
+
const removeTimeSlot = (index) => {
|
| 660 |
+
dailyTimes.value.splice(index, 1);
|
| 661 |
+
};
|
| 662 |
+
|
| 663 |
+
// 监听视频数量变化,调整时间槽
|
| 664 |
+
watch(videosPerDay, (newValue, oldValue) => {
|
| 665 |
+
if (newValue > oldValue) {
|
| 666 |
+
// 增加时间槽
|
| 667 |
+
for (let i = dailyTimes.value.length; i < newValue; i++) {
|
| 668 |
+
dailyTimes.value.push('12:00');
|
| 669 |
+
}
|
| 670 |
+
} else if (newValue < oldValue) {
|
| 671 |
+
// 减少时间槽
|
| 672 |
+
dailyTimes.value = dailyTimes.value.slice(0, newValue);
|
| 673 |
+
}
|
| 674 |
+
});
|
| 675 |
+
|
| 676 |
+
// 预览内容
|
| 677 |
+
const previewContent = () => {
|
| 678 |
+
if (videoList.value.length === 0) {
|
| 679 |
+
alert('请上传视频');
|
| 680 |
+
return;
|
| 681 |
+
}
|
| 682 |
+
|
| 683 |
+
// 这里可以实现预览逻辑
|
| 684 |
+
alert('预览功能开发中...');
|
| 685 |
+
};
|
| 686 |
+
|
| 687 |
+
// 发布内容
|
| 688 |
+
const publishContent = async () => {
|
| 689 |
+
// 验证必填项
|
| 690 |
+
if (videoList.value.length === 0) {
|
| 691 |
+
alert('请上传视频');
|
| 692 |
+
return;
|
| 693 |
+
}
|
| 694 |
+
|
| 695 |
+
if (!title.value) {
|
| 696 |
+
alert('请输入标题');
|
| 697 |
+
return;
|
| 698 |
+
}
|
| 699 |
+
|
| 700 |
+
if (selectedAccounts.value.length === 0) {
|
| 701 |
+
alert('请选择至少一个账号');
|
| 702 |
+
return;
|
| 703 |
+
}
|
| 704 |
+
|
| 705 |
+
if (!selectedPlatform.value) {
|
| 706 |
+
alert('请选择发布平台');
|
| 707 |
+
return;
|
| 708 |
+
}
|
| 709 |
+
|
| 710 |
+
// 设置上传状态
|
| 711 |
+
isUploading.value = true;
|
| 712 |
+
|
| 713 |
+
try {
|
| 714 |
+
// 上传所有视频
|
| 715 |
+
console.log('上传视频...');
|
| 716 |
+
for (const videoItem of videoList.value) {
|
| 717 |
+
// 创建FormData对象
|
| 718 |
+
console.log('上传文件:', videoItem.file.name);
|
| 719 |
+
const formData = new FormData();
|
| 720 |
+
formData.append('file', videoItem.file);
|
| 721 |
+
formData.append('filename', videoItem.file.name);
|
| 722 |
+
|
| 723 |
+
for (let [key, value] of formData) {
|
| 724 |
+
console.log(key, value);
|
| 725 |
+
}
|
| 726 |
+
|
| 727 |
+
try {
|
| 728 |
+
const response = await axios.post('/api/upload', formData);
|
| 729 |
+
console.log('上传成功,请手动刷新列表', response.data);
|
| 730 |
+
|
| 731 |
+
// 检查请求是否成功
|
| 732 |
+
if (response.data.code === 200) {
|
| 733 |
+
// 提取fileID并保存
|
| 734 |
+
if (response.data.data) {
|
| 735 |
+
file_list.value.push(response.data.data);
|
| 736 |
+
console.log('文件上传成功,fileID:', response.data.data);
|
| 737 |
+
console.log('file_list:', file_list.value);
|
| 738 |
+
} else {
|
| 739 |
+
throw new Error('未获取到fileID');
|
| 740 |
+
}
|
| 741 |
+
} else {
|
| 742 |
+
throw new Error(response.data.message || '上传失败');
|
| 743 |
+
}
|
| 744 |
+
} catch (err) {
|
| 745 |
+
console.error('上传失败:', err.response?.data || err.message);
|
| 746 |
+
throw new Error(err.response?.data?.message || err.message || '上传失败');
|
| 747 |
+
}
|
| 748 |
+
}
|
| 749 |
+
|
| 750 |
+
// 准备发布数据
|
| 751 |
+
|
| 752 |
+
const postData = {
|
| 753 |
+
fileList: file_list.value,
|
| 754 |
+
accountList: account_list.value,
|
| 755 |
+
type: selectedPlatform.value,
|
| 756 |
+
tags: tags.value,
|
| 757 |
+
title: title.value,
|
| 758 |
+
category: 0
|
| 759 |
+
};
|
| 760 |
+
|
| 761 |
+
// 如果启用定时发布,添加相关参数
|
| 762 |
+
if (enableTimer.value) {
|
| 763 |
+
postData.enableTimer = true;
|
| 764 |
+
postData.videos_per_day = videosPerDay.value;
|
| 765 |
+
postData.daily_times = dailyTimes.value.map(time => {
|
| 766 |
+
const [hours, minutes] = time.split(':');
|
| 767 |
+
return parseInt(hours) * 60 + parseInt(minutes); // 转换为分钟数
|
| 768 |
+
});
|
| 769 |
+
postData.start_days = startDays.value;
|
| 770 |
+
} else {
|
| 771 |
+
postData.enableTimer = false;
|
| 772 |
+
}
|
| 773 |
+
|
| 774 |
+
// 发送发布请求
|
| 775 |
+
const publishResponse = await axios.post('/api/postVideo', postData);
|
| 776 |
+
console.log('发布结果:', publishResponse.data);
|
| 777 |
+
|
| 778 |
+
if (publishResponse.data.code === 200) {
|
| 779 |
+
alert('发布成功!');
|
| 780 |
+
// 重置表单
|
| 781 |
+
resetForm();
|
| 782 |
+
} else {
|
| 783 |
+
throw new Error(publishResponse.data.message || '发布失败');
|
| 784 |
+
}
|
| 785 |
+
} catch (error) {
|
| 786 |
+
console.error('发布视频失败:', error);
|
| 787 |
+
alert(`发布失败: ${error instanceof Error ? error.message : '未知错误'}`);
|
| 788 |
+
} finally {
|
| 789 |
+
isUploading.value = false;
|
| 790 |
+
}
|
| 791 |
+
};
|
| 792 |
+
|
| 793 |
+
// 重置表单
|
| 794 |
+
const resetForm = () => {
|
| 795 |
+
// 清理所有视频预览URL
|
| 796 |
+
videoList.value.forEach(video => {
|
| 797 |
+
if (video.previewUrl) {
|
| 798 |
+
URL.revokeObjectURL(video.previewUrl);
|
| 799 |
+
}
|
| 800 |
+
});
|
| 801 |
+
videoList.value = [];
|
| 802 |
+
title.value = '';
|
| 803 |
+
tags.value = [];
|
| 804 |
+
location.value = '';
|
| 805 |
+
file_list.value = [];
|
| 806 |
+
selectedAccounts.value = [];
|
| 807 |
+
account_list.value = [];
|
| 808 |
+
selectedPlatform.value = null;
|
| 809 |
+
enableTimer.value = false;
|
| 810 |
+
videosPerDay.value = 1;
|
| 811 |
+
dailyTimes.value = ['08:00'];
|
| 812 |
+
startDays.value = 0;
|
| 813 |
+
};
|
| 814 |
+
|
| 815 |
+
// 组件卸载时清理资源
|
| 816 |
+
onUnmounted(() => {
|
| 817 |
+
// 清理所有视频预览URL
|
| 818 |
+
videoList.value.forEach(video => {
|
| 819 |
+
if (video.previewUrl) {
|
| 820 |
+
URL.revokeObjectURL(video.previewUrl);
|
| 821 |
+
}
|
| 822 |
+
});
|
| 823 |
+
});
|
| 824 |
+
</script>
|
| 825 |
+
|
| 826 |
+
<style scoped>
|
| 827 |
+
.video-publish-container {
|
| 828 |
+
max-width: 800px;
|
| 829 |
+
margin: 0 auto;
|
| 830 |
+
padding: 20px;
|
| 831 |
+
}
|
| 832 |
+
|
| 833 |
+
/* 通用部分样式 */
|
| 834 |
+
.section {
|
| 835 |
+
margin-bottom: 20px;
|
| 836 |
+
border: 1px solid #eee;
|
| 837 |
+
border-radius: 8px;
|
| 838 |
+
padding: 15px;
|
| 839 |
+
background-color: #fff;
|
| 840 |
+
}
|
| 841 |
+
|
| 842 |
+
.section-title {
|
| 843 |
+
font-size: 16px;
|
| 844 |
+
font-weight: bold;
|
| 845 |
+
margin-bottom: 10px;
|
| 846 |
+
color: #333;
|
| 847 |
+
}
|
| 848 |
+
|
| 849 |
+
/* 视频上传区域样式 - 更新 */
|
| 850 |
+
.videos-container {
|
| 851 |
+
display: flex;
|
| 852 |
+
flex-wrap: wrap;
|
| 853 |
+
gap: 15px;
|
| 854 |
+
}
|
| 855 |
+
|
| 856 |
+
.video-upload-area {
|
| 857 |
+
border: 2px dashed #ddd;
|
| 858 |
+
border-radius: 8px;
|
| 859 |
+
width: 200px;
|
| 860 |
+
height: 150px;
|
| 861 |
+
display: flex;
|
| 862 |
+
justify-content: center;
|
| 863 |
+
align-items: center;
|
| 864 |
+
cursor: pointer;
|
| 865 |
+
background-color: #f9f9f9;
|
| 866 |
+
transition: all 0.3s;
|
| 867 |
+
}
|
| 868 |
+
|
| 869 |
+
.video-upload-area:hover {
|
| 870 |
+
border-color: #409eff;
|
| 871 |
+
background-color: #f0f7ff;
|
| 872 |
+
}
|
| 873 |
+
|
| 874 |
+
.upload-icon {
|
| 875 |
+
display: flex;
|
| 876 |
+
flex-direction: column;
|
| 877 |
+
align-items: center;
|
| 878 |
+
}
|
| 879 |
+
|
| 880 |
+
.upload-icon .icon {
|
| 881 |
+
font-size: 30px;
|
| 882 |
+
color: #909399;
|
| 883 |
+
}
|
| 884 |
+
|
| 885 |
+
.upload-icon .text {
|
| 886 |
+
margin-top: 10px;
|
| 887 |
+
color: #606266;
|
| 888 |
+
}
|
| 889 |
+
|
| 890 |
+
.video-preview {
|
| 891 |
+
position: relative;
|
| 892 |
+
width: 200px;
|
| 893 |
+
height: 150px;
|
| 894 |
+
border-radius: 8px;
|
| 895 |
+
overflow: hidden;
|
| 896 |
+
}
|
| 897 |
+
|
| 898 |
+
.video-preview video {
|
| 899 |
+
width: 100%;
|
| 900 |
+
height: 100%;
|
| 901 |
+
object-fit: cover;
|
| 902 |
+
}
|
| 903 |
+
|
| 904 |
+
.video-actions {
|
| 905 |
+
position: absolute;
|
| 906 |
+
top: 10px;
|
| 907 |
+
right: 10px;
|
| 908 |
+
z-index: 10;
|
| 909 |
+
}
|
| 910 |
+
|
| 911 |
+
.remove-btn {
|
| 912 |
+
background-color: rgba(0, 0, 0, 0.5);
|
| 913 |
+
color: white;
|
| 914 |
+
border: none;
|
| 915 |
+
border-radius: 4px;
|
| 916 |
+
padding: 5px 10px;
|
| 917 |
+
cursor: pointer;
|
| 918 |
+
font-size: 12px;
|
| 919 |
+
}
|
| 920 |
+
|
| 921 |
+
.remove-btn:hover {
|
| 922 |
+
background-color: rgba(0, 0, 0, 0.7);
|
| 923 |
+
}
|
| 924 |
+
|
| 925 |
+
.video-count {
|
| 926 |
+
margin-top: 10px;
|
| 927 |
+
font-size: 14px;
|
| 928 |
+
color: #909399;
|
| 929 |
+
}
|
| 930 |
+
|
| 931 |
+
/* 账号选择区域样式 */
|
| 932 |
+
.account-selector {
|
| 933 |
+
border: 1px dashed #ddd;
|
| 934 |
+
border-radius: 8px;
|
| 935 |
+
padding: 10px;
|
| 936 |
+
cursor: pointer;
|
| 937 |
+
min-height: 50px;
|
| 938 |
+
background-color: #f9f9f9;
|
| 939 |
+
transition: all 0.3s;
|
| 940 |
+
}
|
| 941 |
+
|
| 942 |
+
.account-selector:hover {
|
| 943 |
+
border-color: #409eff;
|
| 944 |
+
background-color: #f0f7ff;
|
| 945 |
+
}
|
| 946 |
+
|
| 947 |
+
.account-placeholder {
|
| 948 |
+
display: flex;
|
| 949 |
+
justify-content: center;
|
| 950 |
+
align-items: center;
|
| 951 |
+
height: 30px;
|
| 952 |
+
color: #909399;
|
| 953 |
+
}
|
| 954 |
+
|
| 955 |
+
.selected-accounts-container {
|
| 956 |
+
display: flex;
|
| 957 |
+
flex-wrap: wrap;
|
| 958 |
+
gap: 10px;
|
| 959 |
+
}
|
| 960 |
+
|
| 961 |
+
.selected-account {
|
| 962 |
+
display: flex;
|
| 963 |
+
align-items: center;
|
| 964 |
+
background-color: #f0f7ff;
|
| 965 |
+
border: 1px solid #d9ecff;
|
| 966 |
+
border-radius: 4px;
|
| 967 |
+
padding: 5px 10px;
|
| 968 |
+
position: relative;
|
| 969 |
+
}
|
| 970 |
+
|
| 971 |
+
.account-avatar {
|
| 972 |
+
width: 24px;
|
| 973 |
+
height: 24px;
|
| 974 |
+
border-radius: 50%;
|
| 975 |
+
margin-right: 8px;
|
| 976 |
+
object-fit: cover;
|
| 977 |
+
}
|
| 978 |
+
|
| 979 |
+
.account-name {
|
| 980 |
+
font-size: 14px;
|
| 981 |
+
color: #333;
|
| 982 |
+
margin-right: 8px;
|
| 983 |
+
}
|
| 984 |
+
|
| 985 |
+
.account-status {
|
| 986 |
+
font-size: 12px;
|
| 987 |
+
padding: 2px 6px;
|
| 988 |
+
border-radius: 10px;
|
| 989 |
+
}
|
| 990 |
+
|
| 991 |
+
.account-status.normal {
|
| 992 |
+
background-color: #f0f9eb;
|
| 993 |
+
color: #67c23a;
|
| 994 |
+
}
|
| 995 |
+
|
| 996 |
+
.account-status.warning {
|
| 997 |
+
background-color: #fdf6ec;
|
| 998 |
+
color: #e6a23c;
|
| 999 |
+
}
|
| 1000 |
+
|
| 1001 |
+
.remove-account-btn {
|
| 1002 |
+
background: none;
|
| 1003 |
+
border: none;
|
| 1004 |
+
color: #909399;
|
| 1005 |
+
cursor: pointer;
|
| 1006 |
+
font-size: 16px;
|
| 1007 |
+
margin-left: 5px;
|
| 1008 |
+
padding: 0 5px;
|
| 1009 |
+
}
|
| 1010 |
+
|
| 1011 |
+
.remove-account-btn:hover {
|
| 1012 |
+
color: #f56c6c;
|
| 1013 |
+
}
|
| 1014 |
+
|
| 1015 |
+
.add-more-account {
|
| 1016 |
+
display: flex;
|
| 1017 |
+
align-items: center;
|
| 1018 |
+
color: #409eff;
|
| 1019 |
+
font-size: 14px;
|
| 1020 |
+
cursor: pointer;
|
| 1021 |
+
padding: 5px 10px;
|
| 1022 |
+
}
|
| 1023 |
+
|
| 1024 |
+
/* 账号选择弹窗样式 */
|
| 1025 |
+
.account-selector-modal {
|
| 1026 |
+
position: fixed;
|
| 1027 |
+
top: 0;
|
| 1028 |
+
left: 0;
|
| 1029 |
+
width: 100%;
|
| 1030 |
+
height: 100%;
|
| 1031 |
+
background-color: rgba(0, 0, 0, 0.5);
|
| 1032 |
+
display: flex;
|
| 1033 |
+
justify-content: center;
|
| 1034 |
+
align-items: center;
|
| 1035 |
+
z-index: 1000;
|
| 1036 |
+
}
|
| 1037 |
+
|
| 1038 |
+
.account-selector-content {
|
| 1039 |
+
width: 90%;
|
| 1040 |
+
max-width: 500px;
|
| 1041 |
+
background-color: white;
|
| 1042 |
+
border-radius: 8px;
|
| 1043 |
+
overflow: hidden;
|
| 1044 |
+
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
| 1045 |
+
}
|
| 1046 |
+
|
| 1047 |
+
.modal-header {
|
| 1048 |
+
display: flex;
|
| 1049 |
+
justify-content: space-between;
|
| 1050 |
+
align-items: center;
|
| 1051 |
+
padding: 15px;
|
| 1052 |
+
border-bottom: 1px solid #eee;
|
| 1053 |
+
}
|
| 1054 |
+
|
| 1055 |
+
.modal-header h3 {
|
| 1056 |
+
margin: 0;
|
| 1057 |
+
font-size: 18px;
|
| 1058 |
+
}
|
| 1059 |
+
|
| 1060 |
+
.close-btn {
|
| 1061 |
+
background: none;
|
| 1062 |
+
border: none;
|
| 1063 |
+
font-size: 24px;
|
| 1064 |
+
cursor: pointer;
|
| 1065 |
+
color: #666;
|
| 1066 |
+
}
|
| 1067 |
+
|
| 1068 |
+
.refresh-btn {
|
| 1069 |
+
background: none;
|
| 1070 |
+
border: none;
|
| 1071 |
+
font-size: 18px;
|
| 1072 |
+
cursor: pointer;
|
| 1073 |
+
color: #666;
|
| 1074 |
+
margin-left: auto;
|
| 1075 |
+
margin-right: 10px;
|
| 1076 |
+
display: flex;
|
| 1077 |
+
align-items: center;
|
| 1078 |
+
justify-content: center;
|
| 1079 |
+
}
|
| 1080 |
+
|
| 1081 |
+
.refresh-icon {
|
| 1082 |
+
display: inline-block;
|
| 1083 |
+
transition: transform 0.3s ease;
|
| 1084 |
+
}
|
| 1085 |
+
|
| 1086 |
+
.refresh-btn:hover .refresh-icon {
|
| 1087 |
+
transform: rotate(180deg);
|
| 1088 |
+
color: #409eff;
|
| 1089 |
+
}
|
| 1090 |
+
|
| 1091 |
+
.close-btn:hover {
|
| 1092 |
+
color: #f56c6c;
|
| 1093 |
+
}
|
| 1094 |
+
|
| 1095 |
+
.modal-body {
|
| 1096 |
+
padding: 20px;
|
| 1097 |
+
max-height: 400px;
|
| 1098 |
+
overflow-y: auto;
|
| 1099 |
+
}
|
| 1100 |
+
|
| 1101 |
+
.loading-accounts,
|
| 1102 |
+
.no-accounts {
|
| 1103 |
+
display: flex;
|
| 1104 |
+
justify-content: center;
|
| 1105 |
+
align-items: center;
|
| 1106 |
+
height: 100px;
|
| 1107 |
+
color: #909399;
|
| 1108 |
+
}
|
| 1109 |
+
|
| 1110 |
+
.account-list {
|
| 1111 |
+
display: flex;
|
| 1112 |
+
flex-direction: column;
|
| 1113 |
+
gap: 10px;
|
| 1114 |
+
}
|
| 1115 |
+
|
| 1116 |
+
.account-item {
|
| 1117 |
+
display: flex;
|
| 1118 |
+
align-items: center;
|
| 1119 |
+
padding: 10px;
|
| 1120 |
+
border-radius: 4px;
|
| 1121 |
+
cursor: pointer;
|
| 1122 |
+
transition: background-color 0.3s;
|
| 1123 |
+
}
|
| 1124 |
+
|
| 1125 |
+
.account-item:hover {
|
| 1126 |
+
background-color: #f5f7fa;
|
| 1127 |
+
}
|
| 1128 |
+
|
| 1129 |
+
.account-item.selected {
|
| 1130 |
+
background-color: #f0f7ff;
|
| 1131 |
+
}
|
| 1132 |
+
|
| 1133 |
+
.account-checkbox {
|
| 1134 |
+
margin-right: 10px;
|
| 1135 |
+
}
|
| 1136 |
+
|
| 1137 |
+
.checkbox {
|
| 1138 |
+
width: 18px;
|
| 1139 |
+
height: 18px;
|
| 1140 |
+
border: 2px solid #dcdfe6;
|
| 1141 |
+
border-radius: 2px;
|
| 1142 |
+
position: relative;
|
| 1143 |
+
}
|
| 1144 |
+
|
| 1145 |
+
.checkbox.checked {
|
| 1146 |
+
background-color: #409eff;
|
| 1147 |
+
border-color: #409eff;
|
| 1148 |
+
}
|
| 1149 |
+
|
| 1150 |
+
.checkbox.checked::after {
|
| 1151 |
+
content: '';
|
| 1152 |
+
position: absolute;
|
| 1153 |
+
top: 3px;
|
| 1154 |
+
left: 6px;
|
| 1155 |
+
width: 3px;
|
| 1156 |
+
height: 7px;
|
| 1157 |
+
border: solid white;
|
| 1158 |
+
border-width: 0 2px 2px 0;
|
| 1159 |
+
transform: rotate(45deg);
|
| 1160 |
+
}
|
| 1161 |
+
|
| 1162 |
+
.account-info {
|
| 1163 |
+
flex: 1;
|
| 1164 |
+
}
|
| 1165 |
+
|
| 1166 |
+
.modal-footer {
|
| 1167 |
+
display: flex;
|
| 1168 |
+
justify-content: flex-end;
|
| 1169 |
+
padding: 15px 20px;
|
| 1170 |
+
border-top: 1px solid #eee;
|
| 1171 |
+
gap: 10px;
|
| 1172 |
+
}
|
| 1173 |
+
|
| 1174 |
+
.cancel-btn,
|
| 1175 |
+
.confirm-btn {
|
| 1176 |
+
padding: 8px 20px;
|
| 1177 |
+
border-radius: 4px;
|
| 1178 |
+
cursor: pointer;
|
| 1179 |
+
font-size: 14px;
|
| 1180 |
+
}
|
| 1181 |
+
|
| 1182 |
+
.cancel-btn {
|
| 1183 |
+
background-color: #f5f7fa;
|
| 1184 |
+
border: 1px solid #dcdfe6;
|
| 1185 |
+
color: #606266;
|
| 1186 |
+
}
|
| 1187 |
+
|
| 1188 |
+
.confirm-btn {
|
| 1189 |
+
background-color: #409eff;
|
| 1190 |
+
border: 1px solid #409eff;
|
| 1191 |
+
color: white;
|
| 1192 |
+
}
|
| 1193 |
+
|
| 1194 |
+
.cancel-btn:hover {
|
| 1195 |
+
background-color: #e9ebef;
|
| 1196 |
+
}
|
| 1197 |
+
|
| 1198 |
+
.confirm-btn:hover {
|
| 1199 |
+
background-color: #66b1ff;
|
| 1200 |
+
}
|
| 1201 |
+
|
| 1202 |
+
/* 平台选择区域样式 */
|
| 1203 |
+
.platform-selector {
|
| 1204 |
+
display: flex;
|
| 1205 |
+
gap: 10px;
|
| 1206 |
+
}
|
| 1207 |
+
|
| 1208 |
+
.platform-btn {
|
| 1209 |
+
flex: 1;
|
| 1210 |
+
padding: 10px 15px;
|
| 1211 |
+
border: 1px solid #dcdfe6;
|
| 1212 |
+
border-radius: 4px;
|
| 1213 |
+
background-color: white;
|
| 1214 |
+
color: #606266;
|
| 1215 |
+
cursor: pointer;
|
| 1216 |
+
font-size: 14px;
|
| 1217 |
+
transition: all 0.3s;
|
| 1218 |
+
}
|
| 1219 |
+
|
| 1220 |
+
.platform-btn:hover {
|
| 1221 |
+
border-color: #c6e2ff;
|
| 1222 |
+
color: #409eff;
|
| 1223 |
+
}
|
| 1224 |
+
|
| 1225 |
+
.platform-btn.active {
|
| 1226 |
+
background-color: #409eff;
|
| 1227 |
+
border-color: #409eff;
|
| 1228 |
+
color: white;
|
| 1229 |
+
}
|
| 1230 |
+
|
| 1231 |
+
/* 标题输入区域样式 */
|
| 1232 |
+
.title-input-container {
|
| 1233 |
+
position: relative;
|
| 1234 |
+
}
|
| 1235 |
+
|
| 1236 |
+
textarea {
|
| 1237 |
+
width: 100%;
|
| 1238 |
+
padding: 10px;
|
| 1239 |
+
border: 1px solid #dcdfe6;
|
| 1240 |
+
border-radius: 4px;
|
| 1241 |
+
font-size: 14px;
|
| 1242 |
+
resize: none;
|
| 1243 |
+
}
|
| 1244 |
+
|
| 1245 |
+
.char-count {
|
| 1246 |
+
position: absolute;
|
| 1247 |
+
bottom: 5px;
|
| 1248 |
+
right: 10px;
|
| 1249 |
+
font-size: 12px;
|
| 1250 |
+
color: #909399;
|
| 1251 |
+
}
|
| 1252 |
+
|
| 1253 |
+
/* 话题选择区域样式 */
|
| 1254 |
+
.tags-container {
|
| 1255 |
+
display: flex;
|
| 1256 |
+
flex-wrap: wrap;
|
| 1257 |
+
gap: 10px;
|
| 1258 |
+
}
|
| 1259 |
+
|
| 1260 |
+
.tag {
|
| 1261 |
+
display: flex;
|
| 1262 |
+
align-items: center;
|
| 1263 |
+
background-color: #f0f7ff;
|
| 1264 |
+
border: 1px solid #d9ecff;
|
| 1265 |
+
border-radius: 4px;
|
| 1266 |
+
padding: 5px 10px;
|
| 1267 |
+
font-size: 14px;
|
| 1268 |
+
color: #409eff;
|
| 1269 |
+
}
|
| 1270 |
+
|
| 1271 |
+
.remove-tag {
|
| 1272 |
+
margin-left: 5px;
|
| 1273 |
+
cursor: pointer;
|
| 1274 |
+
color: #909399;
|
| 1275 |
+
}
|
| 1276 |
+
|
| 1277 |
+
.remove-tag:hover {
|
| 1278 |
+
color: #f56c6c;
|
| 1279 |
+
}
|
| 1280 |
+
|
| 1281 |
+
.add-tag {
|
| 1282 |
+
display: flex;
|
| 1283 |
+
align-items: center;
|
| 1284 |
+
color: #409eff;
|
| 1285 |
+
border: 1px dashed #d9ecff;
|
| 1286 |
+
border-radius: 4px;
|
| 1287 |
+
padding: 5px 10px;
|
| 1288 |
+
cursor: pointer;
|
| 1289 |
+
font-size: 14px;
|
| 1290 |
+
}
|
| 1291 |
+
|
| 1292 |
+
.add-tag:hover {
|
| 1293 |
+
background-color: #f0f7ff;
|
| 1294 |
+
}
|
| 1295 |
+
|
| 1296 |
+
/* 话题选择弹窗样式 */
|
| 1297 |
+
.tag-selector-modal {
|
| 1298 |
+
position: fixed;
|
| 1299 |
+
top: 0;
|
| 1300 |
+
left: 0;
|
| 1301 |
+
width: 100%;
|
| 1302 |
+
height: 100%;
|
| 1303 |
+
background-color: rgba(0, 0, 0, 0.5);
|
| 1304 |
+
display: flex;
|
| 1305 |
+
justify-content: center;
|
| 1306 |
+
align-items: center;
|
| 1307 |
+
z-index: 1000;
|
| 1308 |
+
}
|
| 1309 |
+
|
| 1310 |
+
.tag-selector-content {
|
| 1311 |
+
width: 90%;
|
| 1312 |
+
max-width: 500px;
|
| 1313 |
+
background-color: white;
|
| 1314 |
+
border-radius: 8px;
|
| 1315 |
+
overflow: hidden;
|
| 1316 |
+
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
| 1317 |
+
}
|
| 1318 |
+
|
| 1319 |
+
.custom-tag-input {
|
| 1320 |
+
display: flex;
|
| 1321 |
+
margin-bottom: 15px;
|
| 1322 |
+
}
|
| 1323 |
+
|
| 1324 |
+
.custom-tag-input input {
|
| 1325 |
+
flex: 1;
|
| 1326 |
+
padding: 8px 10px;
|
| 1327 |
+
border: 1px solid #dcdfe6;
|
| 1328 |
+
border-radius: 4px 0 0 4px;
|
| 1329 |
+
font-size: 14px;
|
| 1330 |
+
}
|
| 1331 |
+
|
| 1332 |
+
.custom-tag-input button {
|
| 1333 |
+
padding: 8px 15px;
|
| 1334 |
+
background-color: #409eff;
|
| 1335 |
+
border: 1px solid #409eff;
|
| 1336 |
+
border-radius: 0 4px 4px 0;
|
| 1337 |
+
color: white;
|
| 1338 |
+
cursor: pointer;
|
| 1339 |
+
font-size: 14px;
|
| 1340 |
+
}
|
| 1341 |
+
|
| 1342 |
+
.suggested-tags h4 {
|
| 1343 |
+
margin-top: 0;
|
| 1344 |
+
margin-bottom: 10px;
|
| 1345 |
+
font-size: 16px;
|
| 1346 |
+
color: #333;
|
| 1347 |
+
}
|
| 1348 |
+
|
| 1349 |
+
.tag-grid {
|
| 1350 |
+
display: grid;
|
| 1351 |
+
grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
|
| 1352 |
+
gap: 10px;
|
| 1353 |
+
}
|
| 1354 |
+
|
| 1355 |
+
.suggested-tag {
|
| 1356 |
+
background-color: #f5f7fa;
|
| 1357 |
+
border: 1px solid #e4e7ed;
|
| 1358 |
+
border-radius: 4px;
|
| 1359 |
+
padding: 8px 12px;
|
| 1360 |
+
font-size: 14px;
|
| 1361 |
+
color: #606266;
|
| 1362 |
+
cursor: pointer;
|
| 1363 |
+
text-align: center;
|
| 1364 |
+
transition: all 0.3s;
|
| 1365 |
+
}
|
| 1366 |
+
|
| 1367 |
+
.suggested-tag:hover {
|
| 1368 |
+
background-color: #f0f7ff;
|
| 1369 |
+
border-color: #d9ecff;
|
| 1370 |
+
color: #409eff;
|
| 1371 |
+
}
|
| 1372 |
+
|
| 1373 |
+
/* 位置输入区域样�� */
|
| 1374 |
+
.location-input-container input {
|
| 1375 |
+
width: 100%;
|
| 1376 |
+
padding: 10px;
|
| 1377 |
+
border: 1px solid #dcdfe6;
|
| 1378 |
+
border-radius: 4px;
|
| 1379 |
+
font-size: 14px;
|
| 1380 |
+
}
|
| 1381 |
+
|
| 1382 |
+
/* 定时发布设置区域样式 */
|
| 1383 |
+
.timer-toggle {
|
| 1384 |
+
display: flex;
|
| 1385 |
+
align-items: center;
|
| 1386 |
+
margin-bottom: 15px;
|
| 1387 |
+
}
|
| 1388 |
+
|
| 1389 |
+
.switch {
|
| 1390 |
+
position: relative;
|
| 1391 |
+
display: inline-block;
|
| 1392 |
+
width: 40px;
|
| 1393 |
+
height: 20px;
|
| 1394 |
+
margin-right: 10px;
|
| 1395 |
+
}
|
| 1396 |
+
|
| 1397 |
+
.switch input {
|
| 1398 |
+
opacity: 0;
|
| 1399 |
+
width: 0;
|
| 1400 |
+
height: 0;
|
| 1401 |
+
}
|
| 1402 |
+
|
| 1403 |
+
.slider {
|
| 1404 |
+
position: absolute;
|
| 1405 |
+
cursor: pointer;
|
| 1406 |
+
top: 0;
|
| 1407 |
+
left: 0;
|
| 1408 |
+
right: 0;
|
| 1409 |
+
bottom: 0;
|
| 1410 |
+
background-color: #dcdfe6;
|
| 1411 |
+
transition: .4s;
|
| 1412 |
+
}
|
| 1413 |
+
|
| 1414 |
+
.slider:before {
|
| 1415 |
+
position: absolute;
|
| 1416 |
+
content: "";
|
| 1417 |
+
height: 16px;
|
| 1418 |
+
width: 16px;
|
| 1419 |
+
left: 2px;
|
| 1420 |
+
bottom: 2px;
|
| 1421 |
+
background-color: white;
|
| 1422 |
+
transition: .4s;
|
| 1423 |
+
}
|
| 1424 |
+
|
| 1425 |
+
input:checked+.slider {
|
| 1426 |
+
background-color: #409eff;
|
| 1427 |
+
}
|
| 1428 |
+
|
| 1429 |
+
input:checked+.slider:before {
|
| 1430 |
+
transform: translateX(20px);
|
| 1431 |
+
}
|
| 1432 |
+
|
| 1433 |
+
.slider.round {
|
| 1434 |
+
border-radius: 20px;
|
| 1435 |
+
}
|
| 1436 |
+
|
| 1437 |
+
.slider.round:before {
|
| 1438 |
+
border-radius: 50%;
|
| 1439 |
+
}
|
| 1440 |
+
|
| 1441 |
+
.timer-settings {
|
| 1442 |
+
background-color: #f5f7fa;
|
| 1443 |
+
border-radius: 4px;
|
| 1444 |
+
padding: 15px;
|
| 1445 |
+
}
|
| 1446 |
+
|
| 1447 |
+
.setting-item {
|
| 1448 |
+
margin-bottom: 15px;
|
| 1449 |
+
}
|
| 1450 |
+
|
| 1451 |
+
.setting-item:last-child {
|
| 1452 |
+
margin-bottom: 0;
|
| 1453 |
+
}
|
| 1454 |
+
|
| 1455 |
+
.setting-item label {
|
| 1456 |
+
display: block;
|
| 1457 |
+
margin-bottom: 5px;
|
| 1458 |
+
font-size: 14px;
|
| 1459 |
+
color: #606266;
|
| 1460 |
+
}
|
| 1461 |
+
|
| 1462 |
+
.setting-item select {
|
| 1463 |
+
width: 100%;
|
| 1464 |
+
padding: 8px 10px;
|
| 1465 |
+
border: 1px solid #dcdfe6;
|
| 1466 |
+
border-radius: 4px;
|
| 1467 |
+
font-size: 14px;
|
| 1468 |
+
background-color: white;
|
| 1469 |
+
}
|
| 1470 |
+
|
| 1471 |
+
.time-slots {
|
| 1472 |
+
display: flex;
|
| 1473 |
+
flex-direction: column;
|
| 1474 |
+
gap: 10px;
|
| 1475 |
+
}
|
| 1476 |
+
|
| 1477 |
+
.time-slot {
|
| 1478 |
+
display: flex;
|
| 1479 |
+
align-items: center;
|
| 1480 |
+
}
|
| 1481 |
+
|
| 1482 |
+
.time-slot input {
|
| 1483 |
+
flex: 1;
|
| 1484 |
+
padding: 8px 10px;
|
| 1485 |
+
border: 1px solid #dcdfe6;
|
| 1486 |
+
border-radius: 4px;
|
| 1487 |
+
font-size: 14px;
|
| 1488 |
+
}
|
| 1489 |
+
|
| 1490 |
+
.remove-time-btn {
|
| 1491 |
+
background: none;
|
| 1492 |
+
border: none;
|
| 1493 |
+
color: #909399;
|
| 1494 |
+
cursor: pointer;
|
| 1495 |
+
font-size: 16px;
|
| 1496 |
+
margin-left: 10px;
|
| 1497 |
+
}
|
| 1498 |
+
|
| 1499 |
+
.remove-time-btn:hover {
|
| 1500 |
+
color: #f56c6c;
|
| 1501 |
+
}
|
| 1502 |
+
|
| 1503 |
+
.add-time-btn {
|
| 1504 |
+
background-color: #f5f7fa;
|
| 1505 |
+
border: 1px dashed #dcdfe6;
|
| 1506 |
+
border-radius: 4px;
|
| 1507 |
+
padding: 8px 0;
|
| 1508 |
+
color: #409eff;
|
| 1509 |
+
cursor: pointer;
|
| 1510 |
+
font-size: 14px;
|
| 1511 |
+
text-align: center;
|
| 1512 |
+
width: 100%;
|
| 1513 |
+
}
|
| 1514 |
+
|
| 1515 |
+
.add-time-btn:hover {
|
| 1516 |
+
background-color: #f0f7ff;
|
| 1517 |
+
border-color: #c6e2ff;
|
| 1518 |
+
}
|
| 1519 |
+
|
| 1520 |
+
/* 操作按钮区域样式 */
|
| 1521 |
+
.action-buttons {
|
| 1522 |
+
display: flex;
|
| 1523 |
+
justify-content: flex-end;
|
| 1524 |
+
gap: 15px;
|
| 1525 |
+
margin-top: 20px;
|
| 1526 |
+
}
|
| 1527 |
+
|
| 1528 |
+
.preview-btn,
|
| 1529 |
+
.publish-btn {
|
| 1530 |
+
padding: 10px 20px;
|
| 1531 |
+
border-radius: 4px;
|
| 1532 |
+
cursor: pointer;
|
| 1533 |
+
font-size: 14px;
|
| 1534 |
+
border: none;
|
| 1535 |
+
}
|
| 1536 |
+
|
| 1537 |
+
.preview-btn {
|
| 1538 |
+
background-color: #f5f7fa;
|
| 1539 |
+
color: #606266;
|
| 1540 |
+
}
|
| 1541 |
+
|
| 1542 |
+
.publish-btn {
|
| 1543 |
+
background-color: #409eff;
|
| 1544 |
+
color: white;
|
| 1545 |
+
}
|
| 1546 |
+
|
| 1547 |
+
.preview-btn:hover {
|
| 1548 |
+
background-color: #e9ebef;
|
| 1549 |
+
}
|
| 1550 |
+
|
| 1551 |
+
.publish-btn:hover {
|
| 1552 |
+
background-color: #66b1ff;
|
| 1553 |
+
}
|
| 1554 |
+
|
| 1555 |
+
.preview-btn:disabled,
|
| 1556 |
+
.publish-btn:disabled {
|
| 1557 |
+
background-color: #f5f7fa;
|
| 1558 |
+
color: #c0c4cc;
|
| 1559 |
+
cursor: not-allowed;
|
| 1560 |
+
}
|
| 1561 |
+
|
| 1562 |
+
/* 视频来源选择器样式 */
|
| 1563 |
+
.source-selector {
|
| 1564 |
+
position: fixed;
|
| 1565 |
+
top: 0;
|
| 1566 |
+
left: 0;
|
| 1567 |
+
right: 0;
|
| 1568 |
+
bottom: 0;
|
| 1569 |
+
background-color: rgba(0, 0, 0, 0.5);
|
| 1570 |
+
z-index: 1000;
|
| 1571 |
+
display: flex;
|
| 1572 |
+
justify-content: center;
|
| 1573 |
+
align-items: center;
|
| 1574 |
+
}
|
| 1575 |
+
|
| 1576 |
+
.source-selector-content {
|
| 1577 |
+
background-color: white;
|
| 1578 |
+
border-radius: 8px;
|
| 1579 |
+
padding: 15px;
|
| 1580 |
+
width: 200px;
|
| 1581 |
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
| 1582 |
+
}
|
| 1583 |
+
|
| 1584 |
+
.source-option {
|
| 1585 |
+
padding: 12px 15px;
|
| 1586 |
+
cursor: pointer;
|
| 1587 |
+
border-radius: 4px;
|
| 1588 |
+
transition: background-color 0.2s;
|
| 1589 |
+
}
|
| 1590 |
+
|
| 1591 |
+
.source-option:hover {
|
| 1592 |
+
background-color: #f5f5f5;
|
| 1593 |
+
}
|
| 1594 |
+
|
| 1595 |
+
/* 素材库弹窗样式 */
|
| 1596 |
+
.material-library-modal {
|
| 1597 |
+
position: fixed;
|
| 1598 |
+
top: 0;
|
| 1599 |
+
left: 0;
|
| 1600 |
+
right: 0;
|
| 1601 |
+
bottom: 0;
|
| 1602 |
+
background-color: rgba(0, 0, 0, 0.5);
|
| 1603 |
+
z-index: 1000;
|
| 1604 |
+
display: flex;
|
| 1605 |
+
justify-content: center;
|
| 1606 |
+
align-items: center;
|
| 1607 |
+
}
|
| 1608 |
+
|
| 1609 |
+
.material-library-content {
|
| 1610 |
+
background-color: white;
|
| 1611 |
+
border-radius: 8px;
|
| 1612 |
+
width: 80%;
|
| 1613 |
+
max-width: 900px;
|
| 1614 |
+
max-height: 80vh;
|
| 1615 |
+
overflow: hidden;
|
| 1616 |
+
display: flex;
|
| 1617 |
+
flex-direction: column;
|
| 1618 |
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
| 1619 |
+
}
|
| 1620 |
+
|
| 1621 |
+
.modal-header {
|
| 1622 |
+
display: flex;
|
| 1623 |
+
justify-content: space-between;
|
| 1624 |
+
align-items: center;
|
| 1625 |
+
padding: 15px 20px;
|
| 1626 |
+
border-bottom: 1px solid #eee;
|
| 1627 |
+
}
|
| 1628 |
+
|
| 1629 |
+
.modal-header h3 {
|
| 1630 |
+
margin: 0;
|
| 1631 |
+
font-size: 18px;
|
| 1632 |
+
font-weight: 500;
|
| 1633 |
+
}
|
| 1634 |
+
|
| 1635 |
+
.close-btn {
|
| 1636 |
+
background: none;
|
| 1637 |
+
border: none;
|
| 1638 |
+
font-size: 20px;
|
| 1639 |
+
cursor: pointer;
|
| 1640 |
+
color: #666;
|
| 1641 |
+
}
|
| 1642 |
+
|
| 1643 |
+
.modal-body {
|
| 1644 |
+
padding: 20px;
|
| 1645 |
+
overflow-y: auto;
|
| 1646 |
+
flex: 1;
|
| 1647 |
+
}
|
| 1648 |
+
|
| 1649 |
+
.loading-materials,
|
| 1650 |
+
.no-materials {
|
| 1651 |
+
display: flex;
|
| 1652 |
+
justify-content: center;
|
| 1653 |
+
align-items: center;
|
| 1654 |
+
height: 200px;
|
| 1655 |
+
color: #666;
|
| 1656 |
+
}
|
| 1657 |
+
|
| 1658 |
+
.material-grid {
|
| 1659 |
+
display: grid;
|
| 1660 |
+
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
|
| 1661 |
+
gap: 15px;
|
| 1662 |
+
}
|
| 1663 |
+
|
| 1664 |
+
.material-item {
|
| 1665 |
+
border: 1px solid #eee;
|
| 1666 |
+
border-radius: 8px;
|
| 1667 |
+
overflow: hidden;
|
| 1668 |
+
cursor: pointer;
|
| 1669 |
+
transition: transform 0.2s, box-shadow 0.2s;
|
| 1670 |
+
position: relative;
|
| 1671 |
+
}
|
| 1672 |
+
|
| 1673 |
+
.material-item:hover {
|
| 1674 |
+
transform: translateY(-3px);
|
| 1675 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
| 1676 |
+
}
|
| 1677 |
+
|
| 1678 |
+
.material-item.selected {
|
| 1679 |
+
border-color: #1890ff;
|
| 1680 |
+
box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
|
| 1681 |
+
}
|
| 1682 |
+
|
| 1683 |
+
.material-checkbox {
|
| 1684 |
+
position: absolute;
|
| 1685 |
+
top: 10px;
|
| 1686 |
+
right: 10px;
|
| 1687 |
+
z-index: 1;
|
| 1688 |
+
}
|
| 1689 |
+
|
| 1690 |
+
.checkbox {
|
| 1691 |
+
width: 18px;
|
| 1692 |
+
height: 18px;
|
| 1693 |
+
border: 2px solid #fff;
|
| 1694 |
+
border-radius: 50%;
|
| 1695 |
+
background-color: rgba(0, 0, 0, 0.3);
|
| 1696 |
+
}
|
| 1697 |
+
|
| 1698 |
+
.checkbox.checked {
|
| 1699 |
+
background-color: #1890ff;
|
| 1700 |
+
border-color: #fff;
|
| 1701 |
+
}
|
| 1702 |
+
|
| 1703 |
+
.material-preview {
|
| 1704 |
+
height: 120px;
|
| 1705 |
+
background-color: #f5f5f5;
|
| 1706 |
+
display: flex;
|
| 1707 |
+
align-items: center;
|
| 1708 |
+
justify-content: center;
|
| 1709 |
+
overflow: hidden;
|
| 1710 |
+
}
|
| 1711 |
+
|
| 1712 |
+
.material-preview video,
|
| 1713 |
+
.material-preview img {
|
| 1714 |
+
width: 100%;
|
| 1715 |
+
height: 100%;
|
| 1716 |
+
object-fit: cover;
|
| 1717 |
+
}
|
| 1718 |
+
|
| 1719 |
+
.material-info {
|
| 1720 |
+
padding: 10px;
|
| 1721 |
+
}
|
| 1722 |
+
|
| 1723 |
+
.material-name {
|
| 1724 |
+
font-size: 14px;
|
| 1725 |
+
white-space: nowrap;
|
| 1726 |
+
overflow: hidden;
|
| 1727 |
+
text-overflow: ellipsis;
|
| 1728 |
+
}
|
| 1729 |
+
|
| 1730 |
+
.modal-footer {
|
| 1731 |
+
display: flex;
|
| 1732 |
+
justify-content: flex-end;
|
| 1733 |
+
padding: 15px 20px;
|
| 1734 |
+
border-top: 1px solid #eee;
|
| 1735 |
+
gap: 10px;
|
| 1736 |
+
}
|
| 1737 |
+
|
| 1738 |
+
.cancel-btn {
|
| 1739 |
+
padding: 8px 15px;
|
| 1740 |
+
background-color: white;
|
| 1741 |
+
border: 1px solid #ddd;
|
| 1742 |
+
border-radius: 4px;
|
| 1743 |
+
cursor: pointer;
|
| 1744 |
+
}
|
| 1745 |
+
|
| 1746 |
+
.confirm-btn {
|
| 1747 |
+
padding: 8px 15px;
|
| 1748 |
+
background-color: #1890ff;
|
| 1749 |
+
color: white;
|
| 1750 |
+
border: none;
|
| 1751 |
+
border-radius: 4px;
|
| 1752 |
+
cursor: pointer;
|
| 1753 |
+
}
|
| 1754 |
+
|
| 1755 |
+
.confirm-btn:disabled {
|
| 1756 |
+
background-color: #ccc;
|
| 1757 |
+
cursor: not-allowed;
|
| 1758 |
+
}
|
| 1759 |
+
</style>
|
sau_frontend/src/components/WebsiteView.vue
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<template>
|
| 2 |
+
<div class="website-view">
|
| 3 |
+
<h1>网站</h1>
|
| 4 |
+
<div class="website-container">
|
| 5 |
+
<p>这里是网站管理的内容</p>
|
| 6 |
+
</div>
|
| 7 |
+
</div>
|
| 8 |
+
</template>
|
| 9 |
+
|
| 10 |
+
<style scoped>
|
| 11 |
+
.website-view {
|
| 12 |
+
padding: 20px;
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
h1 {
|
| 16 |
+
margin-bottom: 20px;
|
| 17 |
+
font-size: 24px;
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
.website-container {
|
| 21 |
+
background-color: #fff;
|
| 22 |
+
border-radius: 8px;
|
| 23 |
+
padding: 20px;
|
| 24 |
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
|
| 25 |
+
}
|
| 26 |
+
</style>
|
sau_frontend/src/components/layout/MainLayout.vue
ADDED
|
@@ -0,0 +1,245 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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="logo">
|
| 6 |
+
<img src="@/assets/favicon.ico" alt="Logo" class="logo-img" />
|
| 7 |
+
<span>呃呃呃呃呃</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">联系客服</button>
|
| 14 |
+
<div class="avatar">
|
| 15 |
+
<img src="@/assets/tudong.jpg" alt="Avatar" />
|
| 16 |
+
</div>
|
| 17 |
+
</div>
|
| 18 |
+
</header>
|
| 19 |
+
|
| 20 |
+
<!-- 主体内容区 -->
|
| 21 |
+
<div class="content-container">
|
| 22 |
+
<!-- 修改后的左侧导航栏 -->
|
| 23 |
+
<aside class="sidebar">
|
| 24 |
+
<nav>
|
| 25 |
+
<router-link
|
| 26 |
+
v-for="route in routes"
|
| 27 |
+
:key="route.path"
|
| 28 |
+
:to="route.path"
|
| 29 |
+
class="nav-item"
|
| 30 |
+
active-class="active"
|
| 31 |
+
>
|
| 32 |
+
<i :class="route.meta.icon"></i>
|
| 33 |
+
<span>{{ route.meta.title }}</span>
|
| 34 |
+
</router-link>
|
| 35 |
+
</nav>
|
| 36 |
+
</aside>
|
| 37 |
+
|
| 38 |
+
<!-- 右侧内容区 -->
|
| 39 |
+
<main class="main-content">
|
| 40 |
+
<router-view></router-view>
|
| 41 |
+
</main>
|
| 42 |
+
</div>
|
| 43 |
+
</div>
|
| 44 |
+
</template>
|
| 45 |
+
|
| 46 |
+
<script setup>
|
| 47 |
+
import { computed, ref, onMounted } from 'vue';
|
| 48 |
+
import { useRouter } from 'vue-router';
|
| 49 |
+
|
| 50 |
+
const router = useRouter();
|
| 51 |
+
// 修改后的响应式路由列表
|
| 52 |
+
const routes = computed(() => {
|
| 53 |
+
return router.getRoutes()
|
| 54 |
+
.filter(route =>
|
| 55 |
+
route.meta?.title && // 必须有标题
|
| 56 |
+
!route.meta.hidden && // 过滤隐藏路由
|
| 57 |
+
route.path !== '/' && // 排除根重定向
|
| 58 |
+
!route.redirect // 排除其他重定向路由
|
| 59 |
+
)
|
| 60 |
+
.sort((a, b) => { // 保持路由顺序稳定
|
| 61 |
+
const order = ['/account', '/publish', '/website', '/data'];
|
| 62 |
+
return order.indexOf(a.path) - order.indexOf(b.path);
|
| 63 |
+
});
|
| 64 |
+
});
|
| 65 |
+
const filteredRoutes = computed(() => routes.value.filter(route => route.path !== '/video-publish'));
|
| 66 |
+
|
| 67 |
+
// 控制视频发布路由的显示
|
| 68 |
+
const showVideoPublishRoute = ref(false);
|
| 69 |
+
|
| 70 |
+
// 在组件挂载时检查本地存储
|
| 71 |
+
onMounted(() => {
|
| 72 |
+
const shouldShow = localStorage.getItem('showVideoPublishRoute');
|
| 73 |
+
if (shouldShow === 'true') {
|
| 74 |
+
showVideoPublishRoute.value = true;
|
| 75 |
+
}
|
| 76 |
+
});
|
| 77 |
+
|
| 78 |
+
// 移除视频发布路由
|
| 79 |
+
const removeVideoPublishRoute = () => {
|
| 80 |
+
showVideoPublishRoute.value = false;
|
| 81 |
+
localStorage.removeItem('showVideoPublishRoute');
|
| 82 |
+
|
| 83 |
+
// 如果当前在视频发布页面,则导航到发布中心
|
| 84 |
+
if (router.currentRoute.value.path === '/video-publish') {
|
| 85 |
+
router.push('/publish');
|
| 86 |
+
}
|
| 87 |
+
};
|
| 88 |
+
|
| 89 |
+
const tabs = [
|
| 90 |
+
{ id: 1, name: '抖音' },
|
| 91 |
+
{ id: 2, name: '小红书' },
|
| 92 |
+
{ id: 3, name: '微信视频号' },
|
| 93 |
+
{ id: 4, name: '快手' },
|
| 94 |
+
{ id: 5, name: '视频号小店' },
|
| 95 |
+
{ id: 6, name: 'TikTok' }
|
| 96 |
+
];
|
| 97 |
+
</script>
|
| 98 |
+
|
| 99 |
+
<style scoped>
|
| 100 |
+
.main-layout {
|
| 101 |
+
display: flex;
|
| 102 |
+
flex-direction: column;
|
| 103 |
+
height: 100vh;
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
.header {
|
| 107 |
+
height: 60px;
|
| 108 |
+
background-color: #fff;
|
| 109 |
+
border-bottom: 1px solid #eee;
|
| 110 |
+
display: flex;
|
| 111 |
+
align-items: center;
|
| 112 |
+
padding: 0 20px;
|
| 113 |
+
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
.logo {
|
| 117 |
+
display: flex;
|
| 118 |
+
align-items: center;
|
| 119 |
+
font-weight: bold;
|
| 120 |
+
font-size: 18px;
|
| 121 |
+
margin-right: 40px;
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
.logo-img {
|
| 125 |
+
width: 30px;
|
| 126 |
+
height: 30px;
|
| 127 |
+
margin-right: 10px;
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
.header-tabs {
|
| 131 |
+
display: flex;
|
| 132 |
+
flex: 1;
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
.tab-item {
|
| 136 |
+
padding: 0 15px;
|
| 137 |
+
cursor: pointer;
|
| 138 |
+
height: 60px;
|
| 139 |
+
display: flex;
|
| 140 |
+
align-items: center;
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
.tab-item:hover {
|
| 144 |
+
color: #4e6ef2;
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
.user-info {
|
| 148 |
+
display: flex;
|
| 149 |
+
align-items: center;
|
| 150 |
+
}
|
| 151 |
+
|
| 152 |
+
.btn-upgrade {
|
| 153 |
+
background-color: #f0f2ff;
|
| 154 |
+
color: #4e6ef2;
|
| 155 |
+
border: none;
|
| 156 |
+
padding: 6px 12px;
|
| 157 |
+
border-radius: 4px;
|
| 158 |
+
margin-right: 15px;
|
| 159 |
+
cursor: pointer;
|
| 160 |
+
}
|
| 161 |
+
|
| 162 |
+
.avatar {
|
| 163 |
+
width: 36px;
|
| 164 |
+
height: 36px;
|
| 165 |
+
border-radius: 50%;
|
| 166 |
+
overflow: hidden;
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
.avatar img {
|
| 170 |
+
width: 100%;
|
| 171 |
+
height: 100%;
|
| 172 |
+
object-fit: cover;
|
| 173 |
+
}
|
| 174 |
+
|
| 175 |
+
.content-container {
|
| 176 |
+
display: flex;
|
| 177 |
+
flex: 1;
|
| 178 |
+
overflow: hidden;
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
+
.sidebar {
|
| 182 |
+
width: 200px;
|
| 183 |
+
background-color: #f8f9fc;
|
| 184 |
+
border-right: 1px solid #eee;
|
| 185 |
+
padding: 20px 0;
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
.nav-item {
|
| 189 |
+
display: flex;
|
| 190 |
+
align-items: center;
|
| 191 |
+
padding: 12px 20px;
|
| 192 |
+
color: #333;
|
| 193 |
+
text-decoration: none;
|
| 194 |
+
margin-bottom: 5px;
|
| 195 |
+
}
|
| 196 |
+
|
| 197 |
+
.nav-item i {
|
| 198 |
+
margin-right: 10px;
|
| 199 |
+
font-size: 18px;
|
| 200 |
+
}
|
| 201 |
+
|
| 202 |
+
.nav-item.active {
|
| 203 |
+
background-color: #e6f7ff;
|
| 204 |
+
color: #4e6ef2;
|
| 205 |
+
border-right: 3px solid #4e6ef2;
|
| 206 |
+
}
|
| 207 |
+
|
| 208 |
+
.nav-divider {
|
| 209 |
+
height: 1px;
|
| 210 |
+
background-color: #e0e0e0;
|
| 211 |
+
margin: 10px 20px;
|
| 212 |
+
}
|
| 213 |
+
|
| 214 |
+
.main-content {
|
| 215 |
+
flex: 1;
|
| 216 |
+
padding: 20px;
|
| 217 |
+
overflow-y: auto;
|
| 218 |
+
}
|
| 219 |
+
|
| 220 |
+
.nav-item-with-close {
|
| 221 |
+
position: relative;
|
| 222 |
+
display: flex;
|
| 223 |
+
align-items: center;
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
.close-btn {
|
| 227 |
+
position: absolute;
|
| 228 |
+
right: 10px;
|
| 229 |
+
background: none;
|
| 230 |
+
border: none;
|
| 231 |
+
color: #999;
|
| 232 |
+
font-size: 16px;
|
| 233 |
+
cursor: pointer;
|
| 234 |
+
padding: 0;
|
| 235 |
+
width: 20px;
|
| 236 |
+
height: 20px;
|
| 237 |
+
display: flex;
|
| 238 |
+
align-items: center;
|
| 239 |
+
justify-content: center;
|
| 240 |
+
}
|
| 241 |
+
|
| 242 |
+
.close-btn:hover {
|
| 243 |
+
color: #333;
|
| 244 |
+
}
|
| 245 |
+
</style>
|
sau_frontend/src/components/new_file.vue
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<template>
|
| 2 |
+
</template>
|
| 3 |
+
|
| 4 |
+
<script>
|
| 5 |
+
</script>
|
| 6 |
+
|
| 7 |
+
<style>
|
| 8 |
+
</style>
|
sau_frontend/src/components/test.vue
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<template>
|
| 2 |
+
<div style="padding: 20px;">
|
| 3 |
+
<button @click="openInput">添加账号</button>
|
| 4 |
+
|
| 5 |
+
<div v-if="showQrCode" style="margin-top: 20px;">
|
| 6 |
+
<h3>收到的二维码:</h3>
|
| 7 |
+
<img :src="qrCodeSrc" alt="二维码" style="width: 200px;" />
|
| 8 |
+
</div>
|
| 9 |
+
|
| 10 |
+
<div v-if="message" style="margin-top: 20px;">
|
| 11 |
+
<h3>收到的消息:</h3>
|
| 12 |
+
<p>{{ message }}</p>
|
| 13 |
+
</div>
|
| 14 |
+
</div>
|
| 15 |
+
</template>
|
| 16 |
+
|
| 17 |
+
<script setup>
|
| 18 |
+
import {
|
| 19 |
+
ref
|
| 20 |
+
} from 'vue'
|
| 21 |
+
|
| 22 |
+
const showQrCode = ref(false)
|
| 23 |
+
const qrCodeSrc = ref('')
|
| 24 |
+
const message = ref(null)
|
| 25 |
+
let eventSource = null
|
| 26 |
+
|
| 27 |
+
// 弹出输入框并直接建立 EventSource 连接
|
| 28 |
+
const openInput = () => {
|
| 29 |
+
const id = prompt('请输入ID:')
|
| 30 |
+
if (!id) return
|
| 31 |
+
|
| 32 |
+
// 直接创建 EventSource 连接,带上参数 type=2&id=xxx
|
| 33 |
+
const url = `http://localhost:5409/login?type=2&id=${id}&_=${Date.now()}`
|
| 34 |
+
eventSource = new EventSource(url)
|
| 35 |
+
|
| 36 |
+
let count = 0
|
| 37 |
+
|
| 38 |
+
// 接收事件流中的消息
|
| 39 |
+
eventSource.onmessage = (event) => {
|
| 40 |
+
count++
|
| 41 |
+
const data = event.data
|
| 42 |
+
|
| 43 |
+
if (count === 1) {
|
| 44 |
+
// 第一次收到的是 base64 图片
|
| 45 |
+
console.log('收到二维码:', data)
|
| 46 |
+
qrCodeSrc.value = `${data}`
|
| 47 |
+
showQrCode.value = true
|
| 48 |
+
} else if (count === 2) {
|
| 49 |
+
// 第二次收到普通消息
|
| 50 |
+
console.log('收到消息:', data)
|
| 51 |
+
message.value = data
|
| 52 |
+
|
| 53 |
+
// 主动关闭连接
|
| 54 |
+
eventSource.close()
|
| 55 |
+
alert('已完成操作,连接已关闭')
|
| 56 |
+
}
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
// 错误处理
|
| 60 |
+
eventSource.onerror = (err) => {
|
| 61 |
+
console.error('EventSource 发生错误:', err)
|
| 62 |
+
eventSource.close()
|
| 63 |
+
alert('连接异常中断')
|
| 64 |
+
}
|
| 65 |
+
}
|
| 66 |
+
</script>
|
| 67 |
+
|
| 68 |
+
<style scoped>
|
| 69 |
+
/* 可根据需要添加样式 */
|
| 70 |
+
</style>
|
sau_frontend/src/config.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// 全局配置文件
|
| 2 |
+
|
| 3 |
+
// API基础URL
|
| 4 |
+
export const API_BASE_URL = 'http://localhost:5409';
|
| 5 |
+
|
| 6 |
+
// 全局账号列表缓存
|
| 7 |
+
export const globalAccountsCache = {
|
| 8 |
+
accounts: null, // 缓存的账号数据
|
| 9 |
+
lastFetchTime: null, // 最后一次获取数据的时间
|
| 10 |
+
|
| 11 |
+
// 检查缓存是否有效
|
| 12 |
+
isValid() {
|
| 13 |
+
return this.accounts !== null;
|
| 14 |
+
},
|
| 15 |
+
|
| 16 |
+
// 更新缓存
|
| 17 |
+
updateCache(accounts) {
|
| 18 |
+
this.accounts = accounts;
|
| 19 |
+
this.lastFetchTime = new Date().getTime();
|
| 20 |
+
},
|
| 21 |
+
|
| 22 |
+
// 清除缓存
|
| 23 |
+
clearCache() {
|
| 24 |
+
this.accounts = null;
|
| 25 |
+
this.lastFetchTime = null;
|
| 26 |
+
}
|
| 27 |
+
};
|
sau_frontend/src/main.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//引入createApp用于创建应用
|
| 2 |
+
import { createApp } from 'vue'
|
| 3 |
+
//引入APP根组件
|
| 4 |
+
import App from './App.vue'
|
| 5 |
+
|
| 6 |
+
const app = createApp(App)
|
| 7 |
+
import router from './router'
|
| 8 |
+
|
| 9 |
+
app.use(router)
|
| 10 |
+
|
| 11 |
+
app.mount('#app')
|
sau_frontend/src/router/index.js
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//引入createRouter
|
| 2 |
+
import { createRouter, createWebHistory} from 'vue-router'
|
| 3 |
+
import { ref } from 'vue'
|
| 4 |
+
//创建路由
|
| 5 |
+
import Account from '@/components/AccountView.vue'
|
| 6 |
+
import Publish from '@/components/PublishView.vue'
|
| 7 |
+
import Website from '@/components/WebsiteView.vue'
|
| 8 |
+
import Data from '@/components/DataView.vue'
|
| 9 |
+
import VideoPublish from '@/components/VideoPublishView.vue'
|
| 10 |
+
import MultiPublish from '@/components/MultiPublishView.vue'
|
| 11 |
+
import MaterialLibrary from '@/components/MaterialLibraryView.vue'
|
| 12 |
+
|
| 13 |
+
// 存储动态添加的视频发布路由
|
| 14 |
+
const videoRoutes = ref([])
|
| 15 |
+
|
| 16 |
+
// 添加新的视频发布路由
|
| 17 |
+
function addVideoRoute() {
|
| 18 |
+
const id = `video-${Date.now()}`;
|
| 19 |
+
const newRoute = {
|
| 20 |
+
id,
|
| 21 |
+
path: `/video-publish/${id}`, // 修改路径为参数化形式
|
| 22 |
+
name: `VideoPublish-${id}`,
|
| 23 |
+
// 使用工厂函数返回组件,确保每个路由使用独立的组件实例
|
| 24 |
+
component: () => import('@/components/VideoPublishView.vue'),
|
| 25 |
+
props: route => ({ id: route.params.id }), // 将路由参数映射到组件props
|
| 26 |
+
meta: { title: `发布视频 ${videoRoutes.value.length + 1}`, isVideoPublish: true }
|
| 27 |
+
};
|
| 28 |
+
videoRoutes.value.push(newRoute);
|
| 29 |
+
|
| 30 |
+
// 动态添加路由
|
| 31 |
+
if (!router.hasRoute(newRoute.name)) {
|
| 32 |
+
router.addRoute(newRoute);
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
return newRoute;
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
// 删除视频发布路由
|
| 39 |
+
function removeVideoRoute(id) {
|
| 40 |
+
const index = videoRoutes.value.findIndex(route => route.id === id)
|
| 41 |
+
if (index !== -1) {
|
| 42 |
+
const route = videoRoutes.value[index]
|
| 43 |
+
// 从router中移除路由
|
| 44 |
+
if (router.hasRoute(route.name)) {
|
| 45 |
+
router.removeRoute(route.name)
|
| 46 |
+
}
|
| 47 |
+
// 从数组中移除路由
|
| 48 |
+
videoRoutes.value.splice(index, 1)
|
| 49 |
+
}
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
const router = createRouter({
|
| 53 |
+
history: createWebHistory(),
|
| 54 |
+
routes: [
|
| 55 |
+
{
|
| 56 |
+
path: '/',
|
| 57 |
+
redirect: '/account'
|
| 58 |
+
},
|
| 59 |
+
{
|
| 60 |
+
path: '/account',
|
| 61 |
+
component: Account,
|
| 62 |
+
meta: { title: '账号管理', icon: 'icon-account' }
|
| 63 |
+
},
|
| 64 |
+
{
|
| 65 |
+
path: '/publish',
|
| 66 |
+
component: Publish,
|
| 67 |
+
meta: { title: '发布中心', icon: 'icon-publish' }
|
| 68 |
+
},
|
| 69 |
+
{
|
| 70 |
+
path: '/multi-publish',
|
| 71 |
+
component: MultiPublish,
|
| 72 |
+
meta: { title: '多平台发布', icon: 'icon-multi-publish' }
|
| 73 |
+
},
|
| 74 |
+
{
|
| 75 |
+
path: '/material-library',
|
| 76 |
+
component: MaterialLibrary,
|
| 77 |
+
meta: { title: '素材库', icon: 'icon-material' }
|
| 78 |
+
},
|
| 79 |
+
{
|
| 80 |
+
path: '/website',
|
| 81 |
+
component: Website,
|
| 82 |
+
meta: { title: '网站', icon: 'icon-website' }
|
| 83 |
+
},
|
| 84 |
+
{
|
| 85 |
+
path: '/data',
|
| 86 |
+
component: Data,
|
| 87 |
+
meta: { title: '数据', icon: 'icon-data' }
|
| 88 |
+
},
|
| 89 |
+
]
|
| 90 |
+
})
|
| 91 |
+
export default router
|
| 92 |
+
|
| 93 |
+
// 导出视频路由相关功能
|
| 94 |
+
export { videoRoutes, addVideoRoute, removeVideoRoute }
|
sau_frontend/vite.config.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { fileURLToPath, URL } from 'node:url'
|
| 2 |
+
|
| 3 |
+
import { defineConfig } from 'vite'
|
| 4 |
+
import vue from '@vitejs/plugin-vue'
|
| 5 |
+
// import vueDevTools from 'vite-plugin-vue-devtools'
|
| 6 |
+
|
| 7 |
+
// https://vite.dev/config/
|
| 8 |
+
export default defineConfig({
|
| 9 |
+
plugins: [
|
| 10 |
+
vue(),
|
| 11 |
+
// vueDevTools(),
|
| 12 |
+
],
|
| 13 |
+
resolve: {
|
| 14 |
+
alias: {
|
| 15 |
+
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
| 16 |
+
'@assets': fileURLToPath(new URL('./src/assets', import.meta.url)),
|
| 17 |
+
},
|
| 18 |
+
},
|
| 19 |
+
optimizeDeps: {
|
| 20 |
+
exclude: ['fsevents'],
|
| 21 |
+
},
|
| 22 |
+
server: {
|
| 23 |
+
proxy: {
|
| 24 |
+
'/api': {
|
| 25 |
+
target: 'http://localhost:5409',
|
| 26 |
+
changeOrigin: true,
|
| 27 |
+
rewrite: (path) => path.replace(/^\/api/, ''),
|
| 28 |
+
// configure: (proxy, options) => {
|
| 29 |
+
// proxy.on('proxyReq', (proxyReq, req, res) => {
|
| 30 |
+
// // 支持SSE连接
|
| 31 |
+
// if (req.url && req.url.includes('/login')) {
|
| 32 |
+
// proxyReq.setHeader('Accept', 'text/event-stream');
|
| 33 |
+
// proxyReq.setHeader('Cache-Control', 'no-cache');
|
| 34 |
+
// proxyReq.setHeader('Connection', 'keep-alive');
|
| 35 |
+
// }
|
| 36 |
+
// });
|
| 37 |
+
// proxy.on('proxyRes', (proxyRes, req, res) => {
|
| 38 |
+
// // 确保SSE响应头正确设置
|
| 39 |
+
// if (req.url && req.url.includes('/login')) {
|
| 40 |
+
// proxyRes.headers['content-type'] = 'text/event-stream';
|
| 41 |
+
// proxyRes.headers['cache-control'] = 'no-cache';
|
| 42 |
+
// proxyRes.headers['connection'] = 'keep-alive';
|
| 43 |
+
// proxyRes.headers['access-control-allow-origin'] = '*';
|
| 44 |
+
// }
|
| 45 |
+
// });
|
| 46 |
+
// }
|
| 47 |
+
}
|
| 48 |
+
}
|
| 49 |
+
}
|
| 50 |
+
})
|