feat: update content creation management

This commit is contained in:
2026-04-27 10:23:27 +08:00
parent d628dfdd72
commit d516886fc9

View File

@@ -1,4 +1,4 @@
<template>
<template>
<div class="creation-page" :class="{ 'is-submitting': submitLoading }">
<div v-if="submitLoading" class="creation-loading-mask">
<div class="creation-loading-card">
@@ -100,7 +100,7 @@
</template>
<script setup lang="ts">
import { computed, nextTick, onMounted, reactive, ref, watch } from 'vue';
import { computed, onMounted, reactive, ref, watch } from 'vue';
import { ElMessage, type FormInstance, type FormRules } from 'element-plus';
import {
createCreation,
@@ -175,7 +175,8 @@ const rules: FormRules = {
title: [{ required: true, message: '请输入标题', trigger: 'blur' }],
style: [{ required: true, message: '请选择内容风格', trigger: 'change' }],
count: [{ required: true, message: '请输入生成条数', trigger: 'change' }],
image_per_post: [{
image_per_post: [
{
required: true,
message: '请输入配图数量',
trigger: 'change',
@@ -185,8 +186,10 @@ const rules: FormRules = {
if (!value) return callback(new Error('请输入配图数量'));
callback();
},
}],
image_ratio: [{
},
],
image_ratio: [
{
required: true,
message: '请选择图片比例',
trigger: 'change',
@@ -196,7 +199,8 @@ const rules: FormRules = {
if (!value) return callback(new Error('请选择图片比例'));
callback();
},
}],
},
],
};
const joinUrl = (base: string, path: string) => `${base.replace(/\/$/, '')}${path.startsWith('/') ? path : `/${path}`}`;
const buildAssetUrl = (path?: string) => {
@@ -297,16 +301,6 @@ const downloadNode = async (data: TreeNode) => {
ElMessage.error('下载失败');
}
};
const findFirstPreviewNode = (nodes: TreeNode[]): TreeNode | null => {
for (const node of nodes) {
if (node.nodeType === 'html' || node.nodeType === 'image') return node;
if (node.children?.length) {
const matched = findFirstPreviewNode(node.children);
if (matched) return matched;
}
}
return null;
};
const getList = async () => {
treeLoading.value = true;
try {
@@ -314,9 +308,6 @@ const getList = async () => {
imgAddressPrefix.value = res.data?.imgAddressPrefix || '';
treeNodes.value = buildTreeNodes(res.data?.Tree || []);
selectedPreview.value = null;
await nextTick();
const firstLeaf = findFirstPreviewNode(treeNodes.value);
if (firstLeaf) handleNodeClick(firstLeaf);
} catch {
treeNodes.value = [];
imgAddressPrefix.value = '';