1
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
<script setup>
|
||||
import { computed } from "vue";
|
||||
import { useRoute } from "vue-router";
|
||||
import { useAuthStore } from "../stores/auth";
|
||||
|
||||
const route = useRoute();
|
||||
const auth = useAuthStore();
|
||||
|
||||
const baseMenuItems = [
|
||||
{ name: "home", label: "首页", to: "/", icon: "home" },
|
||||
@@ -17,13 +19,24 @@ const baseMenuItems = [
|
||||
];
|
||||
|
||||
const menuItems = computed(() => {
|
||||
if (import.meta.env.DEV) {
|
||||
return [...baseMenuItems, { name: "debug", label: "调试", to: "/debug", icon: "debug" }];
|
||||
const items = [...baseMenuItems];
|
||||
if (auth.isAdmin) {
|
||||
items.push({ name: "admin", label: "管理", to: "/admin", icon: "admin" });
|
||||
}
|
||||
return baseMenuItems;
|
||||
if (auth.isAgent) {
|
||||
items.push({ name: "agent", label: "代理", to: "/agent", icon: "agent" });
|
||||
}
|
||||
if (import.meta.env.DEV) {
|
||||
items.push({ name: "debug", label: "调试", to: "/debug", icon: "debug" });
|
||||
}
|
||||
return items;
|
||||
});
|
||||
|
||||
const activeName = computed(() => route.name);
|
||||
const activeName = computed(() => {
|
||||
if (route.path.startsWith("/admin")) return "admin";
|
||||
if (route.path.startsWith("/agent")) return "agent";
|
||||
return route.name;
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -72,6 +85,14 @@ const activeName = computed(() => route.name);
|
||||
<circle cx="12" cy="12" r="9" />
|
||||
<path d="M9.5 9a2.5 2.5 0 1 1 4.2 1.8c-.8.7-1.2 1.2-1.2 2.2M12 17h.01" stroke-linecap="round" />
|
||||
</svg>
|
||||
<svg v-else-if="item.icon === 'admin'" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
|
||||
<path d="M12 3l8 4v6c0 5-3.5 8-8 8s-8-3-8-8V7l8-4z" stroke-linejoin="round" />
|
||||
<path d="M9 12l2 2 4-4" stroke-linecap="round" stroke-linejoin="round" />
|
||||
</svg>
|
||||
<svg v-else-if="item.icon === 'agent'" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
|
||||
<circle cx="12" cy="8" r="3" />
|
||||
<path d="M5 20c0-3.5 3-6 7-6s7 2.5 7 6" stroke-linecap="round" />
|
||||
</svg>
|
||||
<svg v-else-if="item.icon === 'debug'" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
|
||||
<path d="M12 6v2M12 16v2M6 12h2M16 12h2" stroke-linecap="round" />
|
||||
<circle cx="12" cy="12" r="4" />
|
||||
|
||||
30
src/components/admin/AdminSubNav.vue
Normal file
30
src/components/admin/AdminSubNav.vue
Normal file
@@ -0,0 +1,30 @@
|
||||
<script setup>
|
||||
import { computed } from "vue";
|
||||
import { useRoute } from "vue-router";
|
||||
|
||||
const route = useRoute();
|
||||
|
||||
const menuItems = [
|
||||
{ name: "admin-overview", label: "概览", to: "/admin" },
|
||||
{ name: "admin-users", label: "用户管理", to: "/admin/users" },
|
||||
{ name: "admin-card-keys", label: "卡密管理", to: "/admin/card-keys" },
|
||||
{ name: "admin-desktop-config", label: "桌面配置", to: "/admin/desktop-config" },
|
||||
];
|
||||
|
||||
const activeName = computed(() => route.name);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<nav class="admin-sub-nav" aria-label="管理后台导航">
|
||||
<p class="admin-sub-nav__title">管理后台</p>
|
||||
<RouterLink
|
||||
v-for="item in menuItems"
|
||||
:key="item.name"
|
||||
:to="item.to"
|
||||
class="admin-sub-nav__item"
|
||||
:class="{ 'admin-sub-nav__item--active': activeName === item.name }"
|
||||
>
|
||||
{{ item.label }}
|
||||
</RouterLink>
|
||||
</nav>
|
||||
</template>
|
||||
@@ -4,7 +4,12 @@ import { storeToRefs } from "pinia";
|
||||
import { useWorkflowStore, executeVideoRewrite } from "../../stores/workflow.js";
|
||||
|
||||
const workflow = useWorkflowStore();
|
||||
const { videoLinkModalVisible, videoShareText, videoRewriting } = storeToRefs(workflow);
|
||||
const {
|
||||
videoLinkModalVisible,
|
||||
videoShareText,
|
||||
videoRewriting,
|
||||
rewriteProgress,
|
||||
} = storeToRefs(workflow);
|
||||
|
||||
const feedback = ref({ severity: "", message: "" });
|
||||
|
||||
@@ -12,8 +17,7 @@ const tipItems = [
|
||||
"已支持抖音分享文本、抖音视频链接、抖音短链接",
|
||||
"支持直接视频文件 URL(如 .mp4、.mov 等)",
|
||||
"快手、小红书、B站、视频号分享链接目前会提示暂不支持",
|
||||
"使用 FUNASR 进行语音识别",
|
||||
"根据设置的仿写提示词生成仿写文案",
|
||||
"流程:解析链接 → 下载视频 → 提取音频 → 语音识别 → AI 仿写",
|
||||
];
|
||||
|
||||
function onCancel() {
|
||||
@@ -26,6 +30,8 @@ async function onRewrite() {
|
||||
const result = await executeVideoRewrite(workflow);
|
||||
if (!result.ok) {
|
||||
feedback.value = { severity: "error", message: result.message };
|
||||
} else {
|
||||
feedback.value = { severity: "success", message: result.message };
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -49,6 +55,15 @@ async function onRewrite() {
|
||||
{{ feedback.message }}
|
||||
</Message>
|
||||
|
||||
<Message
|
||||
v-if="videoRewriting && rewriteProgress"
|
||||
severity="info"
|
||||
:closable="false"
|
||||
class="w-full"
|
||||
>
|
||||
{{ rewriteProgress }}
|
||||
</Message>
|
||||
|
||||
<div>
|
||||
<label class="mb-2 block font-medium text-slate-200">
|
||||
请粘贴视频分享文本或视频链接
|
||||
|
||||
Reference in New Issue
Block a user