完成演示demo

This commit is contained in:
2025-08-22 15:14:05 +08:00
parent fc2e48c6b0
commit f743f67454
20 changed files with 60 additions and 81 deletions

View File

@@ -1,8 +1,8 @@
export default defineAppConfig({
app: {
name: "Nuxtor",
author: "Nicola Spadari",
repo: "https://github.com/NicolaSpadari/nuxtor",
name: "PlayTool-Demo",
author: "Estel",
repo: "https://github.com/estel-li",
tauriSite: "https://tauri.app",
nuxtSite: "https://nuxt.com",
nuxtUiSite: "https://ui.nuxt.dev"

View File

@@ -237,6 +237,8 @@
<script setup lang="ts">
import type { FlowNode } from "~/components/flow-nodes/nodes";
import { open, save } from "@tauri-apps/plugin-dialog";
import { readTextFile, writeTextFile } from "@tauri-apps/plugin-fs";
import {
ArrowLeft,
Clock,
@@ -266,8 +268,8 @@
getNodesByCategory,
nodeDefinitions
} from "~/components/flow-nodes/nodes";
import { save, open } from '@tauri-apps/plugin-dialog';
import { writeTextFile, readTextFile } from '@tauri-apps/plugin-fs';
// import { toast } from "#build/ui";
const toast = useToast();
const router = useRouter();
const workflowNodes = ref<FlowNode[]>([]);
@@ -377,6 +379,11 @@
const startTask = () => {
if (workflowNodes.value.length === 0) {
console.log("请先添加任务节点");
toast.add({
title: "任务异常",
description: "当前任务清单并无任何节点,请先添加节点。",
color: "warning"
});
return;
}
@@ -399,6 +406,11 @@
console.log("完整JSON数据:");
console.log(JSON.stringify(taskData, null, 2));
console.log("=== 执行完成 ===");
toast.add({
title: "任务执行成功",
description: `总共执行了 ${taskData.nodes.length} 个节点。`,
color: "success"
});
};
const saveTask = async () => {
@@ -423,8 +435,8 @@
try {
const filePath = await save({
filters: [{
name: 'JSON',
extensions: ['json']
name: "JSON",
extensions: ["json"]
}],
defaultPath: `workflow_${Date.now()}.json`
});
@@ -447,22 +459,22 @@
const selected = await open({
multiple: false,
filters: [{
name: 'JSON',
extensions: ['json']
name: "JSON",
extensions: ["json"]
}]
});
if (selected) {
const content = await readTextFile(selected as string);
const data = JSON.parse(content);
if (data.nodes && Array.isArray(data.nodes)) {
// 验证并重建节点
const importedNodes = data.nodes.map((node: any) => {
// 提取原始节点ID去除时间戳后缀
const originalId = node.id.replace(/-\d+-[a-z0-9]+$/, '');
const originalId = node.id.replace(/-\d+-[a-z0-9]+$/, "");
const definition = nodeDefinitions[originalId];
if (!definition) {
console.warn(`未找到节点定义: ${originalId}`);
return null;

View File

@@ -1,9 +1,6 @@
<template>
<div>
<SiteNavbar class="fixed w-full" />
<SiteSidebar />
<div class="relative overflow-hidden px-6 lg:px-8">
<div>
<DesignTopBlob />
<DesignBottomBlob />

View File

@@ -3,50 +3,11 @@
<div class="grid size-full place-content-center gap-y-8">
<SvgoLogo :filled="true" :font-controlled="false" class="mx-auto size-40" />
<div class="flex flex-col items-center gap-y-3">
<h1 class="animate-pulse text-3xl sm:text-4xl text-pretty font-bold font-heading md:mb-5">
{{ app.name.toUpperCase() }}
</h1>
<p class="leading-7 text-pretty">
Powered by
</p>
<div class="flex flex-wrap justify-center gap-1 md:gap-3">
<UButton
variant="ghost"
size="xl"
:to="app.nuxtSite"
target="_blank"
external
>
Nuxt 4
</UButton>
<UButton
variant="ghost"
size="xl"
:to="app.tauriSite"
target="_blank"
external
>
Tauri 2
</UButton>
<UButton
variant="ghost"
size="xl"
:to="app.nuxtUiSite"
target="_blank"
external
>
NuxtUI 3
</UButton>
</div>
</div>
<div class="flex justify-center">
<UButton
to="/workflows"
>
Star on GitHub
开始演示
</UButton>
</div>
</div>