From 0553675a9bd78da221aa0ceceb769a1fea4b35c6 Mon Sep 17 00:00:00 2001 From: Soulter <905617992@qq.com> Date: Sat, 20 Apr 2024 04:20:07 -0400 Subject: [PATCH] =?UTF-8?q?perf:=20=E9=A2=9C=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/PostCard.vue | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/PostCard.vue b/frontend/src/components/PostCard.vue index f5bcaea..ba830bc 100644 --- a/frontend/src/components/PostCard.vue +++ b/frontend/src/components/PostCard.vue @@ -99,8 +99,20 @@ export default { }, methods: { randomColor() { - let colors = ["#FFC107", "#42A5F5", "#9CCC65", "#F06292", "#76FF03", "#9E9E9E", "#8D6E63"] - return colors[Math.floor(Math.random() * 100) % colors.length] + let colors = ["#FFC107", "#42A5F5", "#9CCC65", "#F06292", "#9E9E9E", "#8D6E63"] + switch (this.post.status) { + case '待审核': + return colors[1] + case '已通过': + return colors[2] + case '已拒绝': + return colors[3] + case '已取消': + return colors[0] + default: + return colors[4] + } + // return colors[Math.floor(Math.random() * 100) % colors.length] }, recall() { this.$emit('recall', this.post.id)