Skip to content

Commit

Permalink
feat: 撤回
Browse files Browse the repository at this point in the history
  • Loading branch information
Soulter committed Apr 14, 2024
1 parent 57947e3 commit e35ce4f
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 6 deletions.
Binary file modified frontend/src/assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 14 additions & 4 deletions frontend/src/components/PostCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,18 @@
max-width="400"
style="border-radius: 10px; color: #fff"
>
<template v-slot:prepend>
<v-icon color="white" style="font-size: 25px">mdi-pin</v-icon>
<h3 style="margin-left: 8px">稿件</h3>
</template>
<div style="width: 100%; padding: 8px 8px 0px 8px">
<div style="display: flex; align-items: center; justify-content: space-between;">
<div style="display: flex; align-items: center;">
<v-icon color="white" style="font-size: 25px">mdi-pin</v-icon>
<h3 style="margin-left: 8px">稿件</h3>
</div>
<!-- 取消投稿 -->
<v-btn v-if="post.status == '待审核'" text="撤回" @click="recall" variant="plain"></v-btn>
</div>

</div>

<v-card-text class="py-2" style="font-size: 16px; font-weight: bold; line-height: 1.5; word-spacing: 2px">
{{post.text}}
</v-card-text>
Expand Down Expand Up @@ -72,6 +79,9 @@
randomColor() {
let colors = ["#FFC107", "#42A5F5", "#9CCC65", "#F06292", "#76FF03", "#9E9E9E", "#8D6E63"]
return colors[Math.floor(Math.random() * colors.length)]
},
recall() {
this.$emit('recall', this.post.id)
}
}
}
Expand Down
1 change: 1 addition & 0 deletions frontend/src/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
<v-card title="😉 投稿礼仪">

<v-card-text>
<p>0. 有诉求请使用正确的语言合理表达,我们讨厌无实际意义的情绪宣泄。</p>
<p>1. 发表针对特定人的负面信息或发表任何人的照片,不允许匿名,同时要求 QQ 等级高于一个太阳</p>
<p>2. 请勿选择不完全符合内容的标签,否则可能导致封禁</p>
<p>3. 以下情形拒绝:涉及政论、主义、国、党等一切敏感内容</p>
Expand Down
22 changes: 20 additions & 2 deletions frontend/src/pages/world.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
variant="solo"
@update:model-value="getPosts"
></v-select>
<PostCard v-for="p in posts" :key="p.id" :post="p" style="margin-top: 16px" />
<PostCard v-for="p in posts" :key="p.id" :post="p" style="margin-top: 16px" @recall="recallPost" />
</div>
</v-window-item>
<v-window-item value="2">
Expand Down Expand Up @@ -125,7 +125,25 @@ export default {
toast(text, color = 'error') {
this.snackbar.text = text
this.snackbar.color = color
}
},
recallPost(post) {
console.log(post)
this.$axios.post('/v1/post/cancel', {
"post_id": post.id
})
.then((response) => {
if (response.data.code === 0) {
this.toast('撤回成功', 'success')
this.getPosts()
} else {
this.toast('撤回失败:' + response.data.msg)
}
})
.catch((error) => {
this.toast('撤回失败:' + error.response.data.msg)
console.error(error)
})
},
}
}
</script>

0 comments on commit e35ce4f

Please sign in to comment.