From bc9b280fc17fb1c84ae478548ea63361157372f0 Mon Sep 17 00:00:00 2001 From: KUN1007 Date: Sun, 22 Oct 2023 16:17:46 +0800 Subject: [PATCH] pref: ErrorHandler --- .vscode/settings.json | 1 + src/components/top-bar/KUNGalgameTopBar.vue | 20 ++++++++++++++++---- src/error/errorI18n.ts | 6 ++++++ src/views/topic/components/footer/Footer.vue | 6 +++--- src/views/topic/components/footer/Reply.vue | 1 + src/views/topic/components/footer/Upvote.vue | 12 +++++++++++- 6 files changed, 38 insertions(+), 8 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index acd4457e..5ac52760 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -46,6 +46,7 @@ "mockjs", "moemoe", "moemoepoint", + "moemoepoints", "Murasame", "Nanami", "nawa", diff --git a/src/components/top-bar/KUNGalgameTopBar.vue b/src/components/top-bar/KUNGalgameTopBar.vue index bd902605..691ff275 100644 --- a/src/components/top-bar/KUNGalgameTopBar.vue +++ b/src/components/top-bar/KUNGalgameTopBar.vue @@ -86,7 +86,10 @@ onBeforeRouteLeave(() => {
- +
@@ -240,13 +243,16 @@ $navNumber: v-bind(navItemNum); .kungalgamer-info { display: flex; + justify-content: center; align-items: center; margin-right: 50px; - > span { + + .settings { + display: flex; + justify-content: center; + align-items: center; color: var(--kungalgame-font-color-2); font-size: 25px; - margin-top: 10px; - margin-right: 30px; cursor: pointer; } } @@ -254,9 +260,15 @@ $navNumber: v-bind(navItemNum); .avatar { position: relative; display: flex; + justify-content: center; + align-items: center; span { + white-space: nowrap; cursor: pointer; + font-size: medium; + margin-left: 30px; + color: var(--kungalgame-font-color-2); &:hover { color: var(--kungalgame-blue-5); } diff --git a/src/error/errorI18n.ts b/src/error/errorI18n.ts index ba021a70..7ae9ad85 100644 --- a/src/error/errorI18n.ts +++ b/src/error/errorI18n.ts @@ -4,6 +4,9 @@ const errorMessagesEN: Record = { 10103: 'Email verification code error', 10104: 'Email is already registered, please change it', 10105: 'Username is already registered, please change it', + + 10201: 'Your daily topic limit has been reached for today.', + 10202: `Your moemoepoints are less than 1100, so you can't use the topic suggestion feature`, } const errorMessagesCN: Record = { @@ -12,6 +15,9 @@ const errorMessagesCN: Record = { 10103: '邮箱验证码错误', 10104: '邮箱已被注册,请更改', 10105: '用户名已被注册,请修改', + + 10201: '您今日可以发表的话题数已达上限', + 10202: '您的萌萌点不足 1100, 无法使用推话题功能', } export const getErrorMessageEN = (errorCode: number) => { diff --git a/src/views/topic/components/footer/Footer.vue b/src/views/topic/components/footer/Footer.vue index 91f9efbe..89dafcd2 100644 --- a/src/views/topic/components/footer/Footer.vue +++ b/src/views/topic/components/footer/Footer.vue @@ -142,9 +142,9 @@ Link: https://www.kungal.com/topic/${props.info.tid}` /> - + + + diff --git a/src/views/topic/components/footer/Reply.vue b/src/views/topic/components/footer/Reply.vue index a1987594..a5eae3d0 100644 --- a/src/views/topic/components/footer/Reply.vue +++ b/src/views/topic/components/footer/Reply.vue @@ -46,6 +46,7 @@ const handleClickReply = () => { cursor: pointer; transition: all 0.2s; margin-right: 10px; + &::before, &::after { content: ''; diff --git a/src/views/topic/components/footer/Upvote.vue b/src/views/topic/components/footer/Upvote.vue index ae89ee93..162e0eb3 100644 --- a/src/views/topic/components/footer/Upvote.vue +++ b/src/views/topic/components/footer/Upvote.vue @@ -6,8 +6,8 @@ import { Icon } from '@iconify/vue' import { useKUNGalgameMessageStore } from '@/store/modules/message' // 全局消息组件(顶部) import Message from '@/components/alert/Message' -// 导入话题页面 store import { useKUNGalgameTopicStore } from '@/store/modules/topic' +import { useKUNGalgameUserStore } from '@/store/modules/kungalgamer' // 接受父组件的传值 const props = defineProps<{ @@ -94,6 +94,16 @@ const handleClickUpvote = async () => { return } + // 当前用户不可以推自己,后端也有判断 + if (useKUNGalgameUserStore().moemoepoint < 1100) { + Message( + `Your moemoepoints are less than 1100, so you can't use the topic suggestion feature`, + '您的萌萌点不足 1100, 无法使用推话题功能', + 'warn' + ) + return + } + // 为零是楼主的话题 if (props.rid === 0) { upvoteTopic()