feat: implement post editing

This commit is contained in:
Tim
2025-07-22 18:09:59 +08:00
parent 929b9baa0c
commit 7d29b7d6e8
5 changed files with 392 additions and 0 deletions

View File

@@ -155,6 +155,7 @@ export default {
const articleMenuItems = computed(() => {
const items = []
if (isAuthor.value || isAdmin.value) {
items.push({ text: '编辑文章', onClick: () => editPost() })
items.push({ text: '删除文章', color: 'red', onClick: () => deletePost() })
}
if (isAdmin.value && status.value === 'PENDING') {
@@ -394,6 +395,10 @@ export default {
}
}
const editPost = () => {
router.push(`/posts/${postId}/edit`)
}
const deletePost = async () => {
const token = getToken()
if (!token) {
@@ -506,6 +511,7 @@ export default {
status,
isAdmin,
approvePost,
editPost,
onCommentDeleted,
deletePost,
rejectPost,