feat: update admin
This commit is contained in:
@@ -130,7 +130,7 @@ const fetchPost = async (id) => {
|
||||
post.head_images = postData.head_images || []; // Add head images
|
||||
loadHeadImagePreviews(); // Load head image previews
|
||||
} catch (error) {
|
||||
toast.add({ severity: 'error', summary: '错误', detail: '加载文章失败', life: 3000 });
|
||||
toast.add({ severity: 'error', summary: '错误', detail: '加载曲谱失败', life: 3000 });
|
||||
router.push('/posts');
|
||||
} finally {
|
||||
loading.value = false;
|
||||
@@ -231,12 +231,12 @@ const savePost = async () => {
|
||||
let valid = true;
|
||||
|
||||
if (!post.title.trim()) {
|
||||
errors.title = '请填写文章标题';
|
||||
errors.title = '请填写曲谱标题';
|
||||
valid = false;
|
||||
}
|
||||
|
||||
// if (!post.introduction.trim()) {
|
||||
// errors.introduction = '请填写文章介绍';
|
||||
// errors.introduction = '请填写曲谱介绍';
|
||||
// valid = false;
|
||||
// }
|
||||
|
||||
@@ -270,10 +270,10 @@ const savePost = async () => {
|
||||
return;
|
||||
}
|
||||
|
||||
toast.add({ severity: 'success', summary: '成功', detail: '文章已成功更新', life: 3000 });
|
||||
toast.add({ severity: 'success', summary: '成功', detail: '曲谱已成功更新', life: 3000 });
|
||||
router.push('/posts');
|
||||
} catch (error) {
|
||||
toast.add({ severity: 'error', summary: '错误', detail: '更新文章失败', life: 3000 });
|
||||
toast.add({ severity: 'error', summary: '错误', detail: '更新曲谱失败', life: 3000 });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -297,7 +297,7 @@ onMounted(() => {
|
||||
if (postId) {
|
||||
fetchPost(postId);
|
||||
} else {
|
||||
toast.add({ severity: 'error', summary: '错误', detail: '未提供文章ID', life: 3000 });
|
||||
toast.add({ severity: 'error', summary: '错误', detail: '未提供曲谱ID', life: 3000 });
|
||||
router.push('/posts');
|
||||
}
|
||||
});
|
||||
@@ -307,7 +307,7 @@ onMounted(() => {
|
||||
|
||||
<div class="w-full max-w-6xl mx-auto">
|
||||
<div class="flex justify-between items-center mb-6">
|
||||
<h1 class="text-2xl font-bold text-gray-800">编辑文章</h1>
|
||||
<h1 class="text-2xl font-bold text-gray-800">编辑曲谱</h1>
|
||||
<div class="flex gap-2">
|
||||
<Button label="取消" icon="pi pi-times" severity="secondary" @click="cancelEdit" />
|
||||
<Button label="保存" icon="pi pi-check" severity="primary" @click="savePost" />
|
||||
@@ -316,7 +316,7 @@ onMounted(() => {
|
||||
|
||||
<div v-if="loading" class="flex flex-col items-center justify-center py-12">
|
||||
<ProgressSpinner style="width:50px;height:50px" />
|
||||
<span class="mt-4">加载文章数据...</span>
|
||||
<span class="mt-4">加载曲谱数据...</span>
|
||||
</div>
|
||||
|
||||
<div v-else>
|
||||
@@ -359,7 +359,7 @@ onMounted(() => {
|
||||
<!-- Title -->
|
||||
<div class="col-span-2">
|
||||
<label for="title" class="block text-sm font-medium text-gray-700 mb-1">标题</label>
|
||||
<InputText id="title" v-model="post.title" class="w-full p-inputtext-lg" placeholder="输入文章标题" />
|
||||
<InputText id="title" v-model="post.title" class="w-full p-inputtext-lg" placeholder="输入曲谱标题" />
|
||||
<small v-if="errors.title" class="text-red-500">{{ errors.title }}</small>
|
||||
</div>
|
||||
|
||||
@@ -392,9 +392,9 @@ onMounted(() => {
|
||||
|
||||
<!-- Introduction -->
|
||||
<div class="col-span-2">
|
||||
<label for="introduction" class="block text-sm font-medium text-gray-700 mb-1">文章介绍</label>
|
||||
<label for="introduction" class="block text-sm font-medium text-gray-700 mb-1">曲谱介绍</label>
|
||||
<Textarea id="introduction" v-model="post.introduction" rows="5" class="w-full"
|
||||
placeholder="输入文章介绍内容" />
|
||||
placeholder="输入曲谱介绍内容" />
|
||||
<small v-if="errors.introduction" class="p-error">{{ errors.introduction }}</small>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user