diff --git a/src/components/capture/Capture.vue b/src/components/capture/Capture.vue index ad12b965..c4d9539c 100644 --- a/src/components/capture/Capture.vue +++ b/src/components/capture/Capture.vue @@ -4,7 +4,7 @@ import { ref, computed, watch } from 'vue' import { questionsEN, Question } from './questionsEN' import { questionsCN } from './questionsCN' // 全局消息组件(顶部) -import message from '@/components/alert/Message' +import Message from '@/components/alert/Message' // 导入消息 store import { useKUNGalgameMessageStore } from '@/store/modules/message' // 导入设置组件,目的是获取语言 @@ -82,7 +82,7 @@ const submitAnswer = () => { isCaptureSuccessful.value = true // 关闭面板 isShowCapture.value = false - message( + Message( 'Human-machine identity verification successful ~', '人机身份验证通过 ~', 'success' @@ -91,7 +91,7 @@ const submitAnswer = () => { // 回答错误 errorCounter.value++ - message('Wrong answer!', '回答错误!', 'warn') + Message('Wrong answer!', '回答错误!', 'warn') // 随机选择一个新的问题 const randomIndex = randomizeQuestion() diff --git a/src/components/quill-editor/Help.vue b/src/components/quill-editor/Help.vue index bb0ca061..bbfb325e 100644 --- a/src/components/quill-editor/Help.vue +++ b/src/components/quill-editor/Help.vue @@ -1,7 +1,7 @@ diff --git a/src/components/setting-panel/components/Background.vue b/src/components/setting-panel/components/Background.vue index c8f5e2bb..5bdb952d 100644 --- a/src/components/setting-panel/components/Background.vue +++ b/src/components/setting-panel/components/Background.vue @@ -7,7 +7,7 @@ import { useKUNGalgameSettingsStore } from '@/store/modules/settings' import { storeToRefs } from 'pinia' // 全局消息组件(顶部) -import message from '@/components/alert/Message' +import Message from '@/components/alert/Message' import backgroundImages from './background' @@ -45,7 +45,7 @@ const handleCustomBackground = () => { showKUNGalgameBackground.value = '1007' url.value = '' } else { - message('Please input valid image url', '请输入合法的图片链接', 'warn') + Message('Please input valid image url', '请输入合法的图片链接', 'warn') } } // 恢复空白背景 diff --git a/src/components/setting-panel/components/Font.vue b/src/components/setting-panel/components/Font.vue index c241d84e..0626370d 100644 --- a/src/components/setting-panel/components/Font.vue +++ b/src/components/setting-panel/components/Font.vue @@ -2,7 +2,7 @@ import { ref } from 'vue' // 全局消息组件(顶部) -import message from '@/components/alert/Message' +import Message from '@/components/alert/Message' import { useKUNGalgameSettingsStore } from '@/store/modules/settings' import { storeToRefs } from 'pinia' @@ -17,7 +17,7 @@ const handleSetFont = () => { settingsStore.setKUNGalgameFontStyle(font.value) font.value = '' } else { - message('Please input valid font name', '请输入合法的字体名', 'warn') + Message('Please input valid font name', '请输入合法的字体名', 'warn') } } diff --git a/src/components/top-bar/KUNGalgameUserInfo.vue b/src/components/top-bar/KUNGalgameUserInfo.vue index 2f193c78..cb838a5e 100644 --- a/src/components/top-bar/KUNGalgameUserInfo.vue +++ b/src/components/top-bar/KUNGalgameUserInfo.vue @@ -2,7 +2,7 @@ import { onMounted, ref } from 'vue' import { useRouter } from 'vue-router' // 全局消息组件(顶部) -import message from '@/components/alert/Message' +import Message from '@/components/alert/Message' // 全局消息组件(底部) import { useKUNGalgameMessageStore } from '@/store/modules/message' import { useKUNGalgameUserStore } from '@/store/modules/kungalgamer' @@ -42,7 +42,7 @@ const logOut = async () => { kungalgameStoreReset() router.push('/login') resetRouter() - message('Logout successfully!', '登出成功', 'success') + Message('Logout successfully!', '登出成功', 'success') } } diff --git a/src/directives/permission/permission.ts b/src/directives/permission/permission.ts index bc8a6ae9..98dbeca9 100644 --- a/src/directives/permission/permission.ts +++ b/src/directives/permission/permission.ts @@ -1,5 +1,5 @@ import type { Directive, DirectiveBinding } from 'vue' -import message from '@/components/alert/Message' +import Message from '@/components/alert/Message' import { currentUserInfo } from '@/utils/getCurrentUserInfo' import router from '@/router' @@ -29,7 +29,7 @@ interface BindingProps { const handleUnauthorizedAccess = (element: HTMLElement) => { element.parentNode?.removeChild(element) - message( + Message( 'You do not have sufficient permissions!', '您没有足够的权限!', 'error', diff --git a/src/error/errorHandler.ts b/src/error/errorHandler.ts index 84539dac..c77592e9 100644 --- a/src/error/errorHandler.ts +++ b/src/error/errorHandler.ts @@ -1,12 +1,12 @@ // 全局消息组件(顶部) -import message from '@/components/alert/Message' +import Message from '@/components/alert/Message' import { getErrorMessageEN, getErrorMessageCN } from './errorI18n' const showMessage = (errorCode: number) => { const messageType = 'error' const messageTextEN = getErrorMessageEN(errorCode) const messageTextCN = getErrorMessageCN(errorCode) - message(messageTextEN, messageTextCN, messageType) + Message(messageTextEN, messageTextCN, messageType) } /** diff --git a/src/error/onRequestError.ts b/src/error/onRequestError.ts index 7fee2592..64fce514 100644 --- a/src/error/onRequestError.ts +++ b/src/error/onRequestError.ts @@ -1,5 +1,5 @@ // 全局消息组件(顶部) -import message from '@/components/alert/Message' +import Message from '@/components/alert/Message' import { generateTokenByRefreshTokenApi } from '@/api' // 使用用户 store import { useKUNGalgameUserStore } from '@/store/modules/kungalgamer' @@ -30,7 +30,7 @@ export async function onRequestError(response: Response) { location.reload() } else { // 否则提示用户重新登陆 - message( + Message( 'Login expired, please log in again.', '登陆过期,请重新登陆', 'error' @@ -42,7 +42,7 @@ export async function onRequestError(response: Response) { } if (response.status === 404) { - message( + Message( 'Not Found, request address is incorrect.', '资源未找到,请求地址出错', 'error' diff --git a/src/store/utils/checkTopicPublish.ts b/src/store/utils/checkTopicPublish.ts index 5f643926..cbc3f832 100644 --- a/src/store/utils/checkTopicPublish.ts +++ b/src/store/utils/checkTopicPublish.ts @@ -2,7 +2,7 @@ import { EditCreateTopicRequestData, EditUpdateTopicRequestData } from '@/api' // 全局消息组件(顶部) -import message from '@/components/alert/Message' +import Message from '@/components/alert/Message' // 类型守卫,确定 EditUpdateTopicRequestData 含有 tid const isEditUpdateTopicData = (data: any): data is EditUpdateTopicRequestData => @@ -17,7 +17,7 @@ export const checkTopicPublish = ( if (isEditUpdateTopicData(topicData)) { // 话题 id 为零,应该。。。。不存在吧( if (!topicData.tid) { - message('Failed to resolve topic', '未能解析话题 ID', 'error') + Message('Failed to resolve topic', '未能解析话题 ID', 'error') return false } } @@ -25,30 +25,30 @@ export const checkTopicPublish = ( // 检查标题 if (!topicData.title.trim()) { // 标题为空的话,警告 - message('Title cannot be empty!', '标题不可为空!', 'warn') + Message('Title cannot be empty!', '标题不可为空!', 'warn') return false } // 检查内容字数 if (!textCount) { // 内容为空的话,警告 - message('Content cannot be empty!', '内容不可为空!', 'warn') + Message('Content cannot be empty!', '内容不可为空!', 'warn') return false } if (textCount > 100007) { - message('Content max length is 100007!', '内容最大长度为100007!', 'warn') + Message('Content max length is 100007!', '内容最大长度为100007!', 'warn') return false } // 检查 tag if (!topicData.tags.length) { - message('Please use at least one tag!', '请至少使用一个标签!', 'warn') + Message('Please use at least one tag!', '请至少使用一个标签!', 'warn') return false } // 检查分类 if (!topicData.category.length) { - message( + Message( 'Please select at least one category!', '请至少选择一个分类!', 'warn' diff --git a/src/views/edit/components/Tags.vue b/src/views/edit/components/Tags.vue index 0e15928e..58d9dd1f 100644 --- a/src/views/edit/components/Tags.vue +++ b/src/views/edit/components/Tags.vue @@ -2,7 +2,7 @@ import { ref, computed, watch, onBeforeMount, onMounted } from 'vue' import { useRoute } from 'vue-router' // 全局消息组件(顶部) -import message from '@/components/alert/Message' +import Message from '@/components/alert/Message' // 导入编辑话题的 store import { useKUNGalgameEditStore } from '@/store/modules/edit' import { useKUNGalgameTopicStore } from '@/store/modules/topic' @@ -96,7 +96,7 @@ const handleAddTag = () => { // 检测到已经有这个 tag 则警告 if (selectedTags.value.includes(tagName)) { - message( + Message( 'Tag already exists, please choose another one', '标签已存在,请更换', 'warn' diff --git a/src/views/kungalgamer/components/Avatar.vue b/src/views/kungalgamer/components/Avatar.vue index 1d41b344..3bda5ed7 100644 --- a/src/views/kungalgamer/components/Avatar.vue +++ b/src/views/kungalgamer/components/Avatar.vue @@ -1,6 +1,6 @@ diff --git a/src/views/kungalgamer/utils/handleFileChange.ts b/src/views/kungalgamer/utils/handleFileChange.ts index c00b15d4..513ae599 100644 --- a/src/views/kungalgamer/utils/handleFileChange.ts +++ b/src/views/kungalgamer/utils/handleFileChange.ts @@ -1,4 +1,4 @@ -import message from '@/components/alert/Message' +import Message from '@/components/alert/Message' const dataURItoBlob = (dataURI: string) => { const byteString = atob(dataURI.split(',')[1]) @@ -15,7 +15,7 @@ export const checkImageValid = (file: File) => { if (file.type === 'image/jpeg' || file.type === 'image/png') { return true } else { - message( + Message( 'Invalid file type. Please select a JPEG or PNG image.', '非法的文件类型,请选择 JPG 或 PNG 图片!', 'warn' @@ -56,7 +56,7 @@ export const resizeImage = (file: File): Promise => { const resizedFile = dataURItoBlob(canvas.toDataURL('image/webp', 0.77)) if (resizedFile.size > 1007 * 1024) { - message( + Message( 'Image is too large. Please select an image smaller than 1007KB!', '文件过大, 请选择小于 1007KB 的文件! ', 'warn' diff --git a/src/views/login/components/Register.vue b/src/views/login/components/Register.vue index ebd97baa..affa5d0a 100644 --- a/src/views/login/components/Register.vue +++ b/src/views/login/components/Register.vue @@ -7,7 +7,7 @@ import { useKUNGalgameMessageStore } from '@/store/modules/message' import { useKUNGalgameUserStore } from '@/store/modules/kungalgamer' import { storeToRefs } from 'pinia' // 全局消息组件(顶部) -import message from '@/components/alert/Message' +import Message from '@/components/alert/Message' // 使用设置 import Settings from './Settings.vue' @@ -45,13 +45,13 @@ const registerForm = reactive>({ // 验证表单是否为空 const isEmptyInput = () => { if (!registerForm.name.trim()) { - message('Username cannot be empty!', '用户名不可为空!', 'warn') + Message('Username cannot be empty!', '用户名不可为空!', 'warn') return false } else if (!registerForm.email.trim()) { - message('Email cannot be empty!', '邮箱不可为空!', 'warn') + Message('Email cannot be empty!', '邮箱不可为空!', 'warn') return false } else if (!registerForm.password.trim()) { - message('Password cannot be empty!', '密码不可为空!', 'warn') + Message('Password cannot be empty!', '密码不可为空!', 'warn') return false } else { return true @@ -64,15 +64,15 @@ const isValidInput = (): boolean => { return false } if (!isValidName(registerForm.name)) { - message('Invalid username format!', '非法的用户名格式!', 'warn') + Message('Invalid username format!', '非法的用户名格式!', 'warn') return false } if (!isValidEmail(registerForm.email)) { - message('Invalid email format!', '非法的邮箱格式!', 'warn') + Message('Invalid email format!', '非法的邮箱格式!', 'warn') return false } if (!isValidPassword(registerForm.password)) { - message('Invalid password format!', '非法的密码格式!', 'warn') + Message('Invalid password format!', '非法的密码格式!', 'warn') return false } return true @@ -82,7 +82,7 @@ const isValidInput = (): boolean => { const handleSendCode = () => { // 表单为空 if (!isValidInput()) { - message('Form cannot be empty', '表单不可为空', 'warn') + Message('Form cannot be empty', '表单不可为空', 'warn') return } @@ -99,7 +99,7 @@ const handleSendCode = () => { const handleRegister = async () => { if (!isSendCode.value) { - message( + Message( 'Need to send an email verification code', '需要发送邮箱验证码', 'warn' @@ -108,7 +108,7 @@ const handleRegister = async () => { } if (!registerForm.code.trim()) { - message( + Message( 'Email verification code cannot be empty', '邮箱验证码不可为空', 'warn' @@ -117,7 +117,7 @@ const handleRegister = async () => { } if (!isValidMailConfirmCode(registerForm.code)) { - message( + Message( 'Invalid email verification code format!', '非法的邮箱验证码格式!', 'warn' @@ -136,10 +136,10 @@ const handleRegister = async () => { // 如果请求成功跳转到主页 if (res.code === 200) { router.push('/') - message('Register successfully!', '注册成功!', 'success') + Message('Register successfully!', '注册成功!', 'success') info.info(tm('AlertInfo.login.success')) } else { - message('Register failed!', '注册失败!', 'error') + Message('Register failed!', '注册失败!', 'error') } } diff --git a/src/views/topic/KUNGalgameTopicPage.vue b/src/views/topic/KUNGalgameTopicPage.vue index 0d0a5f07..8f45cbbd 100644 --- a/src/views/topic/KUNGalgameTopicPage.vue +++ b/src/views/topic/KUNGalgameTopicPage.vue @@ -11,7 +11,7 @@ import { watch, } from 'vue' import { onBeforeRouteLeave, useRoute } from 'vue-router' -import message from '@/components/alert/Message' +import Message from '@/components/alert/Message' // 全局消息组件(底部) import { useKUNGalgameMessageStore } from '@/store/modules/message' @@ -161,7 +161,7 @@ watch( childElement.classList.remove('active') // 找不到指定话题,因为这个话题还没有被加载至 DOM } else { - message( + Message( 'Unable to find the specified reply for now. Please scroll down.', '暂时找不到指定回复,请下滑', 'info' diff --git a/src/views/topic/components/comment/CommentPanel.vue b/src/views/topic/components/comment/CommentPanel.vue index e53e1f2e..5d745393 100644 --- a/src/views/topic/components/comment/CommentPanel.vue +++ b/src/views/topic/components/comment/CommentPanel.vue @@ -1,7 +1,7 @@ diff --git a/src/views/topic/components/footer/Like.vue b/src/views/topic/components/footer/Like.vue index 0d6e43f8..58d5efe9 100644 --- a/src/views/topic/components/footer/Like.vue +++ b/src/views/topic/components/footer/Like.vue @@ -3,7 +3,7 @@ import { watch, ref } from 'vue' import { Icon } from '@iconify/vue' // 全局消息组件(顶部) -import message from '@/components/alert/Message' +import Message from '@/components/alert/Message' // throttle 函数 import { throttle } from '@/utils/throttle' @@ -34,7 +34,7 @@ watch( // throttle 回调函数 const throttleCallback = () => { - message( + Message( 'You can only perform one operation within 1007 milliseconds', '您在 1007 毫秒内只能进行一次操作', 'warn' @@ -66,7 +66,7 @@ const likeOperation = async ( const toggleLike = async () => { // 当前用户不可以给自己点赞 if (props.uid === props.toUid) { - message('You cannot like yourself', '您不可以给自己点赞', 'warn') + Message('You cannot like yourself', '您不可以给自己点赞', 'warn') return } @@ -81,15 +81,15 @@ const toggleLike = async () => { likesCount.value += isPush ? 1 : -1 if (isPush) { - message('Like successfully!', '点赞成功!', 'success') + Message('Like successfully!', '点赞成功!', 'success') } else { - message('Cancel like successfully!', '取消点赞成功!', 'success') + Message('Cancel like successfully!', '取消点赞成功!', 'success') } } else { if (isPush) { - message('Like failed!', '点赞失败!', 'error') + Message('Like failed!', '点赞失败!', 'error') } else { - message('Cancel like failed!', '取消点赞失败!', 'error') + Message('Cancel like failed!', '取消点赞失败!', 'error') } } } diff --git a/src/views/topic/components/footer/Upvote.vue b/src/views/topic/components/footer/Upvote.vue index d26cbf06..ae89ee93 100644 --- a/src/views/topic/components/footer/Upvote.vue +++ b/src/views/topic/components/footer/Upvote.vue @@ -5,7 +5,7 @@ import { Icon } from '@iconify/vue' // 全局消息组件(底部) import { useKUNGalgameMessageStore } from '@/store/modules/message' // 全局消息组件(顶部) -import message from '@/components/alert/Message' +import Message from '@/components/alert/Message' // 导入话题页面 store import { useKUNGalgameTopicStore } from '@/store/modules/topic' @@ -49,9 +49,9 @@ const upvoteTopic = async () => { upvoteCount.value++ isUpvote.value = true - message('Topic upvote successfully', '推话题成功', 'success') + Message('Topic upvote successfully', '推话题成功', 'success') } else { - message('Topic upvote failed!', '推话题失败', 'error') + Message('Topic upvote failed!', '推话题失败', 'error') } } } @@ -79,9 +79,9 @@ const upvoteReply = async () => { upvoteCount.value++ isUpvote.value = true - message('Reply upvote successfully', '推回复成功', 'success') + Message('Reply upvote successfully', '推回复成功', 'success') } else { - message('Reply upvote failed!', '推回复失败', 'error') + Message('Reply upvote failed!', '推回复失败', 'error') } } } @@ -90,7 +90,7 @@ const upvoteReply = async () => { const handleClickUpvote = async () => { // 当前用户不可以推自己 if (props.uid === props.toUid) { - message('You cannot upvote your own topic', '您不可以推自己的话题', 'warn') + Message('You cannot upvote your own topic', '您不可以推自己的话题', 'warn') return } diff --git a/src/views/topic/components/reply/ReplyPanelBtn.vue b/src/views/topic/components/reply/ReplyPanelBtn.vue index 28651639..7e03906f 100644 --- a/src/views/topic/components/reply/ReplyPanelBtn.vue +++ b/src/views/topic/components/reply/ReplyPanelBtn.vue @@ -2,7 +2,7 @@ // 全局消息组件(底部) import { useKUNGalgameMessageStore } from '@/store/modules/message' // 全局消息组件(顶部) -import message from '@/components/alert/Message' +import Message from '@/components/alert/Message' // 导入话题页面 store import { useKUNGalgameTopicStore } from '@/store/modules/topic' // 回复临时数据 @@ -43,12 +43,12 @@ const publishReply = async () => { // 关闭面板 isEdit.value = false // 发布成功提示 - message('Publish reply successfully!', '发布回复成功!', 'success') + Message('Publish reply successfully!', '发布回复成功!', 'success') } else { - message('Publish reply failed!', '发布回复失败!', 'error') + Message('Publish reply failed!', '发布回复失败!', 'error') } } else { - message('Reply content cannot be empty!', '回复内容不能为空!', 'warn') + Message('Reply content cannot be empty!', '回复内容不能为空!', 'warn') } } @@ -60,7 +60,7 @@ const handlePublish = async () => { publishReply() } else { // 取消发布提示 - message('Cancel publish reply', '取消发布回复', 'info') + Message('Cancel publish reply', '取消发布回复', 'info') } } @@ -83,7 +83,7 @@ const handleRewrite = async () => { if (responseData.code === 200) { // 改变发布状态,前端会新增回复的数据 - message('Reply rewrite successfully', '回复重新编辑成功', 'success') + Message('Reply rewrite successfully', '回复重新编辑成功', 'success') // 保存新话题的数据,实际上就是草稿的数据 saveRewriteReply() @@ -93,7 +93,7 @@ const handleRewrite = async () => { isShowAdvance.value = false isEdit.value = false } else { - message('Reply rewrite failed!', '回复重新编辑失败!', 'error') + Message('Reply rewrite failed!', '回复重新编辑失败!', 'error') } } } @@ -103,7 +103,7 @@ const handleSave = () => { // 设置保存为 true replyDraft.value.isSaveReply = true // 这里实现用户的保存逻辑 - message( + Message( 'The draft has been saved successfully!', '草稿已经保存成功', 'success'