feat(评论系统): 新增评论审核功能及界面优化
实现新评论需审核后显示的功能,包括后台设置开关、API支持、前端状态提示 优化管理后台界面样式和分页组件 添加成功消息提示组件及样式 更新相关文档说明
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -42,6 +42,7 @@ export type CommentSettingsResponse = {
|
||||
allowedDomains?: string[];
|
||||
adminKey?: string | null;
|
||||
adminKeySet?: boolean;
|
||||
requireReview?: boolean;
|
||||
};
|
||||
|
||||
export type EmailNotifySettingsResponse = {
|
||||
@@ -135,6 +136,7 @@ export function saveCommentSettings(data: {
|
||||
adminEnabled?: boolean;
|
||||
allowedDomains?: string[];
|
||||
adminKey?: string;
|
||||
requireReview?: boolean;
|
||||
}): Promise<{ message: string }> {
|
||||
return put<{ message: string }>('/admin/settings/comments', data);
|
||||
}
|
||||
|
||||
@@ -369,14 +369,14 @@ onMounted(() => {
|
||||
|
||||
.table-row {
|
||||
display: flex;
|
||||
border-bottom: 1px solid #eaeae0;
|
||||
/* border-bottom: 1px solid #eaeae0; */
|
||||
}
|
||||
|
||||
.table-row:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.table-row:hover {
|
||||
.table-row:hover .table-cell{
|
||||
background-color: #f8f9fa;
|
||||
}
|
||||
|
||||
@@ -387,6 +387,7 @@ onMounted(() => {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
box-sizing: border-box;
|
||||
border-bottom: 1px solid #eaeae0;
|
||||
}
|
||||
|
||||
.table-cell-id {
|
||||
@@ -499,7 +500,7 @@ onMounted(() => {
|
||||
.cell-avatar {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border-radius: 50%;
|
||||
border-radius: 5px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
@@ -568,17 +569,22 @@ onMounted(() => {
|
||||
.pagination {
|
||||
margin-top: 30px;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.pagination-button {
|
||||
height: 28px;
|
||||
min-width: 28px;
|
||||
padding: 4px 8px;
|
||||
border-radius: 4px;
|
||||
border: 1px solid #d0d7de;
|
||||
background-color: #f6f8fa;
|
||||
font-size: 12px;
|
||||
cursor: pointer;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.pagination-button:disabled {
|
||||
@@ -608,7 +614,7 @@ onMounted(() => {
|
||||
|
||||
.pagination-input {
|
||||
width: 60px;
|
||||
height: 24px;
|
||||
height: 28px;
|
||||
box-sizing: border-box;
|
||||
padding: 2px 4px;
|
||||
border-radius: 4px;
|
||||
|
||||
@@ -27,6 +27,13 @@
|
||||
<span class="slider" />
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-item">
|
||||
<label class="form-label">新评论是否审核后再显示</label>
|
||||
<label class="switch">
|
||||
<input v-model="requireReview" type="checkbox" />
|
||||
<span class="slider" />
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-item">
|
||||
<label class="form-label">头像前缀(默认:https://gravatar.com/avatar)</label>
|
||||
<input v-model="avatarPrefix" class="form-input" type="text" />
|
||||
@@ -300,6 +307,7 @@ const commentAdminEnabled = ref(false);
|
||||
const allowedDomains = ref("");
|
||||
const commentAdminKey = ref("");
|
||||
const adminKeySet = ref(false);
|
||||
const requireReview = ref(false);
|
||||
const savingEmail = ref(false);
|
||||
const testingEmail = ref(false);
|
||||
const savingComment = ref(false);
|
||||
@@ -359,6 +367,7 @@ async function load() {
|
||||
: "";
|
||||
commentAdminKey.value = commentRes.adminKey || "";
|
||||
adminKeySet.value = !!commentRes.adminKeySet;
|
||||
requireReview.value = !!commentRes.requireReview;
|
||||
emailGlobalEnabled.value = !!emailNotifyRes.globalEnabled;
|
||||
|
||||
if (emailNotifyRes.templates) {
|
||||
@@ -488,6 +497,7 @@ async function saveComment() {
|
||||
.map((d) => d.trim())
|
||||
.filter(Boolean),
|
||||
adminKey: commentAdminKey.value || undefined,
|
||||
requireReview: requireReview.value,
|
||||
});
|
||||
|
||||
showToast(res.message || "保存成功", "success");
|
||||
|
||||
Reference in New Issue
Block a user