feat: 分离文章slug与URL字段并支持slug模式匹配查询
- 新增 `post_url` 字段存储文章完整URL,`post_slug` 仅存储标识符 - 更新管理后台评论列表、编辑、统计及域名获取接口以使用新字段 - 修改公共评论查询接口,支持slug精确匹配及带`?`、`#`参数的模糊匹配 - 更新前端管理界面,在评论编辑表单中增加"评论地址"(`postUrl`)字段 - 同步更新API文档,明确字段用途及查询参数说明
This commit is contained in:
@@ -13,6 +13,7 @@ export type CommentItem = {
|
||||
email: string;
|
||||
avatar: string;
|
||||
postSlug: string;
|
||||
postUrl: string | null;
|
||||
url: string | null;
|
||||
ipAddress: string | null;
|
||||
contentText: string;
|
||||
@@ -172,6 +173,7 @@ export function updateComment(data: {
|
||||
name: string;
|
||||
email: string;
|
||||
url?: string | null;
|
||||
postUrl?: string | null;
|
||||
postSlug?: string;
|
||||
contentText: string;
|
||||
status?: string;
|
||||
@@ -182,6 +184,7 @@ export function updateComment(data: {
|
||||
name: data.name,
|
||||
email: data.email,
|
||||
url: data.url ?? null,
|
||||
postUrl: data.postUrl ?? null,
|
||||
postSlug: data.postSlug,
|
||||
content: data.contentText,
|
||||
status: data.status,
|
||||
|
||||
@@ -16,9 +16,13 @@
|
||||
<input v-model="form.url" class="form-input" type="text" />
|
||||
</div>
|
||||
<div class="form-item">
|
||||
<label class="form-label">评论地址</label>
|
||||
<label class="form-label">页面标识</label>
|
||||
<input v-model="form.postSlug" class="form-input" type="text" />
|
||||
</div>
|
||||
<div class="form-item">
|
||||
<label class="form-label">评论地址</label>
|
||||
<input v-model="form.postUrl" class="form-input" type="text" />
|
||||
</div>
|
||||
<div class="form-item">
|
||||
<label class="form-label">评论内容</label>
|
||||
<textarea v-model="form.contentText" class="form-input" rows="4"></textarea>
|
||||
@@ -66,6 +70,7 @@ interface EditForm {
|
||||
email: string;
|
||||
url: string;
|
||||
postSlug: string;
|
||||
postUrl: string;
|
||||
contentText: string;
|
||||
status: string;
|
||||
priority: number;
|
||||
|
||||
@@ -263,6 +263,7 @@ const editForm = ref<{
|
||||
email: string;
|
||||
url: string;
|
||||
postSlug: string;
|
||||
postUrl: string;
|
||||
contentText: string;
|
||||
status: string;
|
||||
priority: number;
|
||||
@@ -438,6 +439,7 @@ function openEdit(item: CommentItem) {
|
||||
email: item.email,
|
||||
url: item.url || "",
|
||||
postSlug: item.postSlug || "",
|
||||
postUrl: item.postUrl || "",
|
||||
contentText: item.contentText,
|
||||
status: item.status,
|
||||
priority:
|
||||
@@ -466,6 +468,7 @@ async function submitEdit() {
|
||||
const trimmedContent = current.contentText.trim();
|
||||
const trimmedUrl = current.url.trim();
|
||||
const trimmedPostSlug = current.postSlug.trim();
|
||||
const trimmedPostUrl = current.postUrl.trim();
|
||||
const priorityValue =
|
||||
typeof current.priority === "number" && Number.isFinite(current.priority)
|
||||
? current.priority
|
||||
@@ -485,6 +488,7 @@ async function submitEdit() {
|
||||
name: trimmedName,
|
||||
email: trimmedEmail,
|
||||
url: trimmedUrl || null,
|
||||
postUrl: trimmedPostUrl || null,
|
||||
postSlug: newPostSlug,
|
||||
contentText: trimmedContent,
|
||||
status: current.status,
|
||||
@@ -497,6 +501,7 @@ async function submitEdit() {
|
||||
email: trimmedEmail,
|
||||
url: trimmedUrl || null,
|
||||
postSlug: newPostSlug,
|
||||
postUrl: trimmedPostUrl || null,
|
||||
contentText: trimmedContent,
|
||||
status: current.status,
|
||||
priority: priorityValue,
|
||||
|
||||
Reference in New Issue
Block a user