pref: replace message to Message

This commit is contained in:
KUN1007 2023-10-13 23:05:30 +08:00
parent 233dd4a5d2
commit c425aac9b2
23 changed files with 98 additions and 98 deletions

View file

@ -4,7 +4,7 @@ import { ref, computed, watch } from 'vue'
import { questionsEN, Question } from './questionsEN' import { questionsEN, Question } from './questionsEN'
import { questionsCN } from './questionsCN' import { questionsCN } from './questionsCN'
// //
import message from '@/components/alert/Message' import Message from '@/components/alert/Message'
// store // store
import { useKUNGalgameMessageStore } from '@/store/modules/message' import { useKUNGalgameMessageStore } from '@/store/modules/message'
// //
@ -82,7 +82,7 @@ const submitAnswer = () => {
isCaptureSuccessful.value = true isCaptureSuccessful.value = true
// //
isShowCapture.value = false isShowCapture.value = false
message( Message(
'Human-machine identity verification successful ~', 'Human-machine identity verification successful ~',
'人机身份验证通过 ~', '人机身份验证通过 ~',
'success' 'success'
@ -91,7 +91,7 @@ const submitAnswer = () => {
// //
errorCounter.value++ errorCounter.value++
message('Wrong answer!', '回答错误!', 'warn') Message('Wrong answer!', '回答错误!', 'warn')
// //
const randomIndex = randomizeQuestion() const randomIndex = randomizeQuestion()

View file

@ -1,7 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, computed } from 'vue' import { ref, computed } from 'vue'
// //
import message from '@/components/alert/Message' import Message from '@/components/alert/Message'
// //
import { useRoute, useRouter } from 'vue-router' import { useRoute, useRouter } from 'vue-router'
@ -42,7 +42,7 @@ const handleClickHelp = () => {
<p>网站的代码是手写的错误在所难免</p> <p>网站的代码是手写的错误在所难免</p>
<p>如果您遇到错误<a style="color: var(--kungalgame-blue-4); border-bottom: 2px solid var(--kungalgame-blue-4);" href="/contact">联系我们</a></p>` <p>如果您遇到错误<a style="color: var(--kungalgame-blue-4); border-bottom: 2px solid var(--kungalgame-blue-4);" href="/contact">联系我们</a></p>`
message(helpHtmlEN, helpHtmlCN, 'info', 5000) Message(helpHtmlEN, helpHtmlCN, 'info', 5000)
} }
} }
</script> </script>

View file

@ -7,7 +7,7 @@ import { useKUNGalgameSettingsStore } from '@/store/modules/settings'
import { storeToRefs } from 'pinia' import { storeToRefs } from 'pinia'
// //
import message from '@/components/alert/Message' import Message from '@/components/alert/Message'
import backgroundImages from './background' import backgroundImages from './background'
@ -45,7 +45,7 @@ const handleCustomBackground = () => {
showKUNGalgameBackground.value = '1007' showKUNGalgameBackground.value = '1007'
url.value = '' url.value = ''
} else { } else {
message('Please input valid image url', '请输入合法的图片链接', 'warn') Message('Please input valid image url', '请输入合法的图片链接', 'warn')
} }
} }
// //

View file

@ -2,7 +2,7 @@
import { ref } from 'vue' import { ref } from 'vue'
// //
import message from '@/components/alert/Message' import Message from '@/components/alert/Message'
import { useKUNGalgameSettingsStore } from '@/store/modules/settings' import { useKUNGalgameSettingsStore } from '@/store/modules/settings'
import { storeToRefs } from 'pinia' import { storeToRefs } from 'pinia'
@ -17,7 +17,7 @@ const handleSetFont = () => {
settingsStore.setKUNGalgameFontStyle(font.value) settingsStore.setKUNGalgameFontStyle(font.value)
font.value = '' font.value = ''
} else { } else {
message('Please input valid font name', '请输入合法的字体名', 'warn') Message('Please input valid font name', '请输入合法的字体名', 'warn')
} }
} }
</script> </script>

View file

@ -2,7 +2,7 @@
import { onMounted, ref } from 'vue' import { onMounted, ref } from 'vue'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
// //
import message from '@/components/alert/Message' import Message from '@/components/alert/Message'
// //
import { useKUNGalgameMessageStore } from '@/store/modules/message' import { useKUNGalgameMessageStore } from '@/store/modules/message'
import { useKUNGalgameUserStore } from '@/store/modules/kungalgamer' import { useKUNGalgameUserStore } from '@/store/modules/kungalgamer'
@ -42,7 +42,7 @@ const logOut = async () => {
kungalgameStoreReset() kungalgameStoreReset()
router.push('/login') router.push('/login')
resetRouter() resetRouter()
message('Logout successfully!', '登出成功', 'success') Message('Logout successfully!', '登出成功', 'success')
} }
} }

View file

@ -1,5 +1,5 @@
import type { Directive, DirectiveBinding } from 'vue' import type { Directive, DirectiveBinding } from 'vue'
import message from '@/components/alert/Message' import Message from '@/components/alert/Message'
import { currentUserInfo } from '@/utils/getCurrentUserInfo' import { currentUserInfo } from '@/utils/getCurrentUserInfo'
import router from '@/router' import router from '@/router'
@ -29,7 +29,7 @@ interface BindingProps {
const handleUnauthorizedAccess = (element: HTMLElement) => { const handleUnauthorizedAccess = (element: HTMLElement) => {
element.parentNode?.removeChild(element) element.parentNode?.removeChild(element)
message( Message(
'You do not have sufficient permissions!', 'You do not have sufficient permissions!',
'您没有足够的权限!', '您没有足够的权限!',
'error', 'error',

View file

@ -1,12 +1,12 @@
// 全局消息组件(顶部) // 全局消息组件(顶部)
import message from '@/components/alert/Message' import Message from '@/components/alert/Message'
import { getErrorMessageEN, getErrorMessageCN } from './errorI18n' import { getErrorMessageEN, getErrorMessageCN } from './errorI18n'
const showMessage = (errorCode: number) => { const showMessage = (errorCode: number) => {
const messageType = 'error' const messageType = 'error'
const messageTextEN = getErrorMessageEN(errorCode) const messageTextEN = getErrorMessageEN(errorCode)
const messageTextCN = getErrorMessageCN(errorCode) const messageTextCN = getErrorMessageCN(errorCode)
message(messageTextEN, messageTextCN, messageType) Message(messageTextEN, messageTextCN, messageType)
} }
/** /**

View file

@ -1,5 +1,5 @@
// 全局消息组件(顶部) // 全局消息组件(顶部)
import message from '@/components/alert/Message' import Message from '@/components/alert/Message'
import { generateTokenByRefreshTokenApi } from '@/api' import { generateTokenByRefreshTokenApi } from '@/api'
// 使用用户 store // 使用用户 store
import { useKUNGalgameUserStore } from '@/store/modules/kungalgamer' import { useKUNGalgameUserStore } from '@/store/modules/kungalgamer'
@ -30,7 +30,7 @@ export async function onRequestError(response: Response) {
location.reload() location.reload()
} else { } else {
// 否则提示用户重新登陆 // 否则提示用户重新登陆
message( Message(
'Login expired, please log in again.', 'Login expired, please log in again.',
'登陆过期,请重新登陆', '登陆过期,请重新登陆',
'error' 'error'
@ -42,7 +42,7 @@ export async function onRequestError(response: Response) {
} }
if (response.status === 404) { if (response.status === 404) {
message( Message(
'Not Found, request address is incorrect.', 'Not Found, request address is incorrect.',
'资源未找到,请求地址出错', '资源未找到,请求地址出错',
'error' 'error'

View file

@ -2,7 +2,7 @@
import { EditCreateTopicRequestData, EditUpdateTopicRequestData } from '@/api' import { EditCreateTopicRequestData, EditUpdateTopicRequestData } from '@/api'
// 全局消息组件(顶部) // 全局消息组件(顶部)
import message from '@/components/alert/Message' import Message from '@/components/alert/Message'
// 类型守卫,确定 EditUpdateTopicRequestData 含有 tid // 类型守卫,确定 EditUpdateTopicRequestData 含有 tid
const isEditUpdateTopicData = (data: any): data is EditUpdateTopicRequestData => const isEditUpdateTopicData = (data: any): data is EditUpdateTopicRequestData =>
@ -17,7 +17,7 @@ export const checkTopicPublish = (
if (isEditUpdateTopicData(topicData)) { if (isEditUpdateTopicData(topicData)) {
// 话题 id 为零,应该。。。。不存在吧( // 话题 id 为零,应该。。。。不存在吧(
if (!topicData.tid) { if (!topicData.tid) {
message('Failed to resolve topic', '未能解析话题 ID', 'error') Message('Failed to resolve topic', '未能解析话题 ID', 'error')
return false return false
} }
} }
@ -25,30 +25,30 @@ export const checkTopicPublish = (
// 检查标题 // 检查标题
if (!topicData.title.trim()) { if (!topicData.title.trim()) {
// 标题为空的话,警告 // 标题为空的话,警告
message('Title cannot be empty!', '标题不可为空!', 'warn') Message('Title cannot be empty!', '标题不可为空!', 'warn')
return false return false
} }
// 检查内容字数 // 检查内容字数
if (!textCount) { if (!textCount) {
// 内容为空的话,警告 // 内容为空的话,警告
message('Content cannot be empty!', '内容不可为空!', 'warn') Message('Content cannot be empty!', '内容不可为空!', 'warn')
return false return false
} }
if (textCount > 100007) { if (textCount > 100007) {
message('Content max length is 100007!', '内容最大长度为100007', 'warn') Message('Content max length is 100007!', '内容最大长度为100007', 'warn')
return false return false
} }
// 检查 tag // 检查 tag
if (!topicData.tags.length) { if (!topicData.tags.length) {
message('Please use at least one tag!', '请至少使用一个标签!', 'warn') Message('Please use at least one tag!', '请至少使用一个标签!', 'warn')
return false return false
} }
// 检查分类 // 检查分类
if (!topicData.category.length) { if (!topicData.category.length) {
message( Message(
'Please select at least one category!', 'Please select at least one category!',
'请至少选择一个分类!', '请至少选择一个分类!',
'warn' 'warn'

View file

@ -2,7 +2,7 @@
import { ref, computed, watch, onBeforeMount, onMounted } from 'vue' import { ref, computed, watch, onBeforeMount, onMounted } from 'vue'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
// //
import message from '@/components/alert/Message' import Message from '@/components/alert/Message'
// store // store
import { useKUNGalgameEditStore } from '@/store/modules/edit' import { useKUNGalgameEditStore } from '@/store/modules/edit'
import { useKUNGalgameTopicStore } from '@/store/modules/topic' import { useKUNGalgameTopicStore } from '@/store/modules/topic'
@ -96,7 +96,7 @@ const handleAddTag = () => {
// tag // tag
if (selectedTags.value.includes(tagName)) { if (selectedTags.value.includes(tagName)) {
message( Message(
'Tag already exists, please choose another one', 'Tag already exists, please choose another one',
'标签已存在,请更换', '标签已存在,请更换',
'warn' 'warn'

View file

@ -1,6 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue' import { ref } from 'vue'
import message from '@/components/alert/Message' import Message from '@/components/alert/Message'
// //
import { import {
checkImageValid, checkImageValid,
@ -51,7 +51,7 @@ const handleDragOver = (event: DragEvent) => {
// //
const handleChangeAvatar = () => { const handleChangeAvatar = () => {
message( Message(
'Image API is not yet completed, stay tuned for updates', 'Image API is not yet completed, stay tuned for updates',
'图片接口还未完成,敬请期待', '图片接口还未完成,敬请期待',
'warn' 'warn'

View file

@ -1,7 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, ref } from 'vue' import { computed, ref } from 'vue'
import Avatar from '../components/Avatar.vue' import Avatar from '../components/Avatar.vue'
import message from '@/components/alert/Message' import Message from '@/components/alert/Message'
// store // store
import { useKUNGalgameUserStore } from '@/store/modules/kungalgamer' import { useKUNGalgameUserStore } from '@/store/modules/kungalgamer'
@ -14,7 +14,7 @@ const bioValue = ref('')
const handleChangeBio = async () => { const handleChangeBio = async () => {
// //
if (bioValue.value.length > 107) { if (bioValue.value.length > 107) {
message( Message(
'Bio must not exceed a maximum length of 107 characters', 'Bio must not exceed a maximum length of 107 characters',
'签名的最大长度不可超过 107 个字符', '签名的最大长度不可超过 107 个字符',
'warn' 'warn'
@ -27,10 +27,10 @@ const handleChangeBio = async () => {
bioValue.value bioValue.value
) )
if (res.code === 200) { if (res.code === 200) {
message('Rewrite bio successfully!', 'Rewrite 签名成功', 'success') Message('Rewrite bio successfully!', 'Rewrite 签名成功', 'success')
bioValue.value = '' bioValue.value = ''
} else { } else {
message('Rewrite bio failed!', 'Rewrite 签名失败', 'error') Message('Rewrite bio failed!', 'Rewrite 签名失败', 'error')
} }
} }
</script> </script>

View file

@ -1,4 +1,4 @@
import message from '@/components/alert/Message' import Message from '@/components/alert/Message'
const dataURItoBlob = (dataURI: string) => { const dataURItoBlob = (dataURI: string) => {
const byteString = atob(dataURI.split(',')[1]) const byteString = atob(dataURI.split(',')[1])
@ -15,7 +15,7 @@ export const checkImageValid = (file: File) => {
if (file.type === 'image/jpeg' || file.type === 'image/png') { if (file.type === 'image/jpeg' || file.type === 'image/png') {
return true return true
} else { } else {
message( Message(
'Invalid file type. Please select a JPEG or PNG image.', 'Invalid file type. Please select a JPEG or PNG image.',
'非法的文件类型,请选择 JPG 或 PNG 图片!', '非法的文件类型,请选择 JPG 或 PNG 图片!',
'warn' 'warn'
@ -56,7 +56,7 @@ export const resizeImage = (file: File): Promise<Blob> => {
const resizedFile = dataURItoBlob(canvas.toDataURL('image/webp', 0.77)) const resizedFile = dataURItoBlob(canvas.toDataURL('image/webp', 0.77))
if (resizedFile.size > 1007 * 1024) { if (resizedFile.size > 1007 * 1024) {
message( Message(
'Image is too large. Please select an image smaller than 1007KB!', 'Image is too large. Please select an image smaller than 1007KB!',
'文件过大, 请选择小于 1007KB 的文件! ', '文件过大, 请选择小于 1007KB 的文件! ',
'warn' 'warn'

View file

@ -7,7 +7,7 @@ import { useKUNGalgameMessageStore } from '@/store/modules/message'
import { useKUNGalgameUserStore } from '@/store/modules/kungalgamer' import { useKUNGalgameUserStore } from '@/store/modules/kungalgamer'
import { storeToRefs } from 'pinia' import { storeToRefs } from 'pinia'
// //
import message from '@/components/alert/Message' import Message from '@/components/alert/Message'
// 使 // 使
import Settings from './Settings.vue' import Settings from './Settings.vue'
@ -45,13 +45,13 @@ const registerForm = reactive<Record<string, string>>({
// //
const isEmptyInput = () => { const isEmptyInput = () => {
if (!registerForm.name.trim()) { if (!registerForm.name.trim()) {
message('Username cannot be empty!', '用户名不可为空!', 'warn') Message('Username cannot be empty!', '用户名不可为空!', 'warn')
return false return false
} else if (!registerForm.email.trim()) { } else if (!registerForm.email.trim()) {
message('Email cannot be empty!', '邮箱不可为空!', 'warn') Message('Email cannot be empty!', '邮箱不可为空!', 'warn')
return false return false
} else if (!registerForm.password.trim()) { } else if (!registerForm.password.trim()) {
message('Password cannot be empty!', '密码不可为空!', 'warn') Message('Password cannot be empty!', '密码不可为空!', 'warn')
return false return false
} else { } else {
return true return true
@ -64,15 +64,15 @@ const isValidInput = (): boolean => {
return false return false
} }
if (!isValidName(registerForm.name)) { if (!isValidName(registerForm.name)) {
message('Invalid username format!', '非法的用户名格式!', 'warn') Message('Invalid username format!', '非法的用户名格式!', 'warn')
return false return false
} }
if (!isValidEmail(registerForm.email)) { if (!isValidEmail(registerForm.email)) {
message('Invalid email format!', '非法的邮箱格式!', 'warn') Message('Invalid email format!', '非法的邮箱格式!', 'warn')
return false return false
} }
if (!isValidPassword(registerForm.password)) { if (!isValidPassword(registerForm.password)) {
message('Invalid password format!', '非法的密码格式!', 'warn') Message('Invalid password format!', '非法的密码格式!', 'warn')
return false return false
} }
return true return true
@ -82,7 +82,7 @@ const isValidInput = (): boolean => {
const handleSendCode = () => { const handleSendCode = () => {
// //
if (!isValidInput()) { if (!isValidInput()) {
message('Form cannot be empty', '表单不可为空', 'warn') Message('Form cannot be empty', '表单不可为空', 'warn')
return return
} }
@ -99,7 +99,7 @@ const handleSendCode = () => {
const handleRegister = async () => { const handleRegister = async () => {
if (!isSendCode.value) { if (!isSendCode.value) {
message( Message(
'Need to send an email verification code', 'Need to send an email verification code',
'需要发送邮箱验证码', '需要发送邮箱验证码',
'warn' 'warn'
@ -108,7 +108,7 @@ const handleRegister = async () => {
} }
if (!registerForm.code.trim()) { if (!registerForm.code.trim()) {
message( Message(
'Email verification code cannot be empty', 'Email verification code cannot be empty',
'邮箱验证码不可为空', '邮箱验证码不可为空',
'warn' 'warn'
@ -117,7 +117,7 @@ const handleRegister = async () => {
} }
if (!isValidMailConfirmCode(registerForm.code)) { if (!isValidMailConfirmCode(registerForm.code)) {
message( Message(
'Invalid email verification code format!', 'Invalid email verification code format!',
'非法的邮箱验证码格式!', '非法的邮箱验证码格式!',
'warn' 'warn'
@ -136,10 +136,10 @@ const handleRegister = async () => {
// //
if (res.code === 200) { if (res.code === 200) {
router.push('/') router.push('/')
message('Register successfully!', '注册成功!', 'success') Message('Register successfully!', '注册成功!', 'success')
info.info(tm('AlertInfo.login.success')) info.info(tm('AlertInfo.login.success'))
} else { } else {
message('Register failed!', '注册失败!', 'error') Message('Register failed!', '注册失败!', 'error')
} }
} }
</script> </script>

View file

@ -11,7 +11,7 @@ import {
watch, watch,
} from 'vue' } from 'vue'
import { onBeforeRouteLeave, useRoute } from 'vue-router' import { onBeforeRouteLeave, useRoute } from 'vue-router'
import message from '@/components/alert/Message' import Message from '@/components/alert/Message'
// //
import { useKUNGalgameMessageStore } from '@/store/modules/message' import { useKUNGalgameMessageStore } from '@/store/modules/message'
@ -161,7 +161,7 @@ watch(
childElement.classList.remove('active') childElement.classList.remove('active')
// DOM // DOM
} else { } else {
message( Message(
'Unable to find the specified reply for now. Please scroll down.', 'Unable to find the specified reply for now. Please scroll down.',
'暂时找不到指定回复,请下滑', '暂时找不到指定回复,请下滑',
'info' 'info'

View file

@ -1,7 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue' import { ref } from 'vue'
// //
import message from '@/components/alert/Message' import Message from '@/components/alert/Message'
import { debounce } from '@/utils/debounce' import { debounce } from '@/utils/debounce'
import { TopicComment } from '@/api/index' import { TopicComment } from '@/api/index'
@ -42,13 +42,13 @@ const handleInputComment = () => {
const isValidComment = () => { const isValidComment = () => {
// //
if (!content.value.trim()) { if (!content.value.trim()) {
message('Comment content cannot be empty!', '评论内容不能为空!', 'warn') Message('Comment content cannot be empty!', '评论内容不能为空!', 'warn')
return false return false
} }
// //
if (content.value.trim().length > 1007) { if (content.value.trim().length > 1007) {
message( Message(
'The maximum length for comments should not exceed 1007 characters.', 'The maximum length for comments should not exceed 1007 characters.',
'评论最大长度不可超过1007个字符', '评论最大长度不可超过1007个字符',
'warn' 'warn'
@ -76,7 +76,7 @@ const handlePublishComment = async () => {
emits('getCommentEmits', newComment) emits('getCommentEmits', newComment)
// //
message('Comment publish successfully!', '评论发布成功', 'success') Message('Comment publish successfully!', '评论发布成功', 'success')
handleCloseCommentPanel() handleCloseCommentPanel()
} }

View file

@ -5,7 +5,7 @@
import { ref, watch } from 'vue' import { ref, watch } from 'vue'
import { Icon } from '@iconify/vue' import { Icon } from '@iconify/vue'
// //
import message from '@/components/alert/Message' import Message from '@/components/alert/Message'
// throttle // throttle
import { throttle } from '@/utils/throttle' import { throttle } from '@/utils/throttle'
@ -35,7 +35,7 @@ watch(
// throttle // throttle
const throttleCallback = () => { const throttleCallback = () => {
message( Message(
'You can only perform one operation within 1007 milliseconds', 'You can only perform one operation within 1007 milliseconds',
'您在 1007 毫秒内只能进行一次操作', '您在 1007 毫秒内只能进行一次操作',
'warn' 'warn'
@ -45,13 +45,13 @@ const throttleCallback = () => {
const dislikeComment = async () => { const dislikeComment = async () => {
// //
if (isDisliked.value) { if (isDisliked.value) {
message(`You've already disliked it`, '您已经点过踩了', 'warn') Message(`You've already disliked it`, '您已经点过踩了', 'warn')
return return
} }
// //
if (props.uid === props.toUid) { if (props.uid === props.toUid) {
message('You cannot dislike yourself', '您不可以给自己点踩', 'warn') Message('You cannot dislike yourself', '您不可以给自己点踩', 'warn')
return return
} }
@ -65,9 +65,9 @@ const dislikeComment = async () => {
if (res.code === 200) { if (res.code === 200) {
dislikesCount.value++ dislikesCount.value++
isDisliked.value = true isDisliked.value = true
message('Dislike successfully!', '点踩成功', 'success') Message('Dislike successfully!', '点踩成功', 'success')
} else { } else {
message('Dislike failed!', '点踩失败', 'error') Message('Dislike failed!', '点踩失败', 'error')
} }
} }

View file

@ -5,7 +5,7 @@
import { ref, watch } from 'vue' import { ref, watch } from 'vue'
import { Icon } from '@iconify/vue' import { Icon } from '@iconify/vue'
// //
import message from '@/components/alert/Message' import Message from '@/components/alert/Message'
// throttle // throttle
import { throttle } from '@/utils/throttle' import { throttle } from '@/utils/throttle'
@ -36,7 +36,7 @@ watch(
// throttle // throttle
const throttleCallback = () => { const throttleCallback = () => {
message( Message(
'You can only perform one operation within 1007 milliseconds', 'You can only perform one operation within 1007 milliseconds',
'您在 1007 毫秒内只能进行一次操作', '您在 1007 毫秒内只能进行一次操作',
'warn' 'warn'
@ -46,13 +46,13 @@ const throttleCallback = () => {
const likeComment = async () => { const likeComment = async () => {
// //
if (isLiked.value) { if (isLiked.value) {
message(`You've already liked it`, '您已经点过赞了', 'warn') Message(`You've already liked it`, '您已经点过赞了', 'warn')
return return
} }
// //
if (props.uid === props.toUid) { if (props.uid === props.toUid) {
message('You cannot like yourself', '您不可以给自己点赞', 'warn') Message('You cannot like yourself', '您不可以给自己点赞', 'warn')
return return
} }
@ -62,9 +62,9 @@ const likeComment = async () => {
if (res.code === 200) { if (res.code === 200) {
likesCount.value++ likesCount.value++
isLiked.value = true isLiked.value = true
message('Like successfully!', '点赞成功', 'success') Message('Like successfully!', '点赞成功', 'success')
} else { } else {
message('Like failed!', '点赞失败', 'error') Message('Like failed!', '点赞失败', 'error')
} }
} }

View file

@ -3,7 +3,7 @@
import { watch, ref } from 'vue' import { watch, ref } from 'vue'
import { Icon } from '@iconify/vue' import { Icon } from '@iconify/vue'
// //
import message from '@/components/alert/Message' import Message from '@/components/alert/Message'
// throttle // throttle
import { throttle } from '@/utils/throttle' import { throttle } from '@/utils/throttle'
@ -34,7 +34,7 @@ watch(
// throttle // throttle
const throttleCallback = () => { const throttleCallback = () => {
message( Message(
'You can only perform one operation within 1007 milliseconds', 'You can only perform one operation within 1007 milliseconds',
'您在 1007 毫秒内只能进行一次操作', '您在 1007 毫秒内只能进行一次操作',
'warn' 'warn'
@ -70,7 +70,7 @@ const dislikeOperation = async (
const toggleDislike = async () => { const toggleDislike = async () => {
// //
if (props.uid === props.toUid) { if (props.uid === props.toUid) {
message('You cannot dislike yourself', '您不可以给自己点踩', 'warn') Message('You cannot dislike yourself', '您不可以给自己点踩', 'warn')
return return
} }
@ -85,15 +85,15 @@ const toggleDislike = async () => {
dislikesCount.value += isPush ? 1 : -1 dislikesCount.value += isPush ? 1 : -1
if (isPush) { if (isPush) {
message('Dislike successfully!', '点踩成功!', 'success') Message('Dislike successfully!', '点踩成功!', 'success')
} else { } else {
message('Cancel dislike successfully!', '取消点踩成功!', 'success') Message('Cancel dislike successfully!', '取消点踩成功!', 'success')
} }
} else { } else {
if (isPush) { if (isPush) {
message('Dislike failed!', '点踩失败!', 'error') Message('Dislike failed!', '点踩失败!', 'error')
} else { } else {
message('Cancel dislike failed!', '取消点踩失败!', 'error') Message('Cancel dislike failed!', '取消点踩失败!', 'error')
} }
} }
} }

View file

@ -14,7 +14,7 @@ import Reply from './Reply.vue'
import Rewrite from './Rewrite.vue' import Rewrite from './Rewrite.vue'
// //
import message from '@/components/alert/Message' import Message from '@/components/alert/Message'
// store // store
import { useKUNGalgameUserStore } from '@/store/modules/kungalgamer' import { useKUNGalgameUserStore } from '@/store/modules/kungalgamer'
@ -83,10 +83,10 @@ Link: https://www.kungal.com/topic/${props.info.tid}`
navigator.clipboard navigator.clipboard
.writeText(shareLink.value) .writeText(shareLink.value)
.then(() => { .then(() => {
message('Share Link copied successfully!', '分享链接复制成功', 'success') Message('Share Link copied successfully!', '分享链接复制成功', 'success')
}) })
.catch((err) => { .catch((err) => {
message('Share Link copied failed!', '分享链接复制失败!', 'error') Message('Share Link copied failed!', '分享链接复制失败!', 'error')
}) })
} }
</script> </script>

View file

@ -3,7 +3,7 @@
import { watch, ref } from 'vue' import { watch, ref } from 'vue'
import { Icon } from '@iconify/vue' import { Icon } from '@iconify/vue'
// //
import message from '@/components/alert/Message' import Message from '@/components/alert/Message'
// throttle // throttle
import { throttle } from '@/utils/throttle' import { throttle } from '@/utils/throttle'
@ -34,7 +34,7 @@ watch(
// throttle // throttle
const throttleCallback = () => { const throttleCallback = () => {
message( Message(
'You can only perform one operation within 1007 milliseconds', 'You can only perform one operation within 1007 milliseconds',
'您在 1007 毫秒内只能进行一次操作', '您在 1007 毫秒内只能进行一次操作',
'warn' 'warn'
@ -66,7 +66,7 @@ const likeOperation = async (
const toggleLike = async () => { const toggleLike = async () => {
// //
if (props.uid === props.toUid) { if (props.uid === props.toUid) {
message('You cannot like yourself', '您不可以给自己点赞', 'warn') Message('You cannot like yourself', '您不可以给自己点赞', 'warn')
return return
} }
@ -81,15 +81,15 @@ const toggleLike = async () => {
likesCount.value += isPush ? 1 : -1 likesCount.value += isPush ? 1 : -1
if (isPush) { if (isPush) {
message('Like successfully!', '点赞成功!', 'success') Message('Like successfully!', '点赞成功!', 'success')
} else { } else {
message('Cancel like successfully!', '取消点赞成功!', 'success') Message('Cancel like successfully!', '取消点赞成功!', 'success')
} }
} else { } else {
if (isPush) { if (isPush) {
message('Like failed!', '点赞失败!', 'error') Message('Like failed!', '点赞失败!', 'error')
} else { } else {
message('Cancel like failed!', '取消点赞失败!', 'error') Message('Cancel like failed!', '取消点赞失败!', 'error')
} }
} }
} }

View file

@ -5,7 +5,7 @@ import { Icon } from '@iconify/vue'
// //
import { useKUNGalgameMessageStore } from '@/store/modules/message' import { useKUNGalgameMessageStore } from '@/store/modules/message'
// //
import message from '@/components/alert/Message' import Message from '@/components/alert/Message'
// store // store
import { useKUNGalgameTopicStore } from '@/store/modules/topic' import { useKUNGalgameTopicStore } from '@/store/modules/topic'
@ -49,9 +49,9 @@ const upvoteTopic = async () => {
upvoteCount.value++ upvoteCount.value++
isUpvote.value = true isUpvote.value = true
message('Topic upvote successfully', '推话题成功', 'success') Message('Topic upvote successfully', '推话题成功', 'success')
} else { } else {
message('Topic upvote failed!', '推话题失败', 'error') Message('Topic upvote failed!', '推话题失败', 'error')
} }
} }
} }
@ -79,9 +79,9 @@ const upvoteReply = async () => {
upvoteCount.value++ upvoteCount.value++
isUpvote.value = true isUpvote.value = true
message('Reply upvote successfully', '推回复成功', 'success') Message('Reply upvote successfully', '推回复成功', 'success')
} else { } else {
message('Reply upvote failed!', '推回复失败', 'error') Message('Reply upvote failed!', '推回复失败', 'error')
} }
} }
} }
@ -90,7 +90,7 @@ const upvoteReply = async () => {
const handleClickUpvote = async () => { const handleClickUpvote = async () => {
// //
if (props.uid === props.toUid) { if (props.uid === props.toUid) {
message('You cannot upvote your own topic', '您不可以推自己的话题', 'warn') Message('You cannot upvote your own topic', '您不可以推自己的话题', 'warn')
return return
} }

View file

@ -2,7 +2,7 @@
// //
import { useKUNGalgameMessageStore } from '@/store/modules/message' import { useKUNGalgameMessageStore } from '@/store/modules/message'
// //
import message from '@/components/alert/Message' import Message from '@/components/alert/Message'
// store // store
import { useKUNGalgameTopicStore } from '@/store/modules/topic' import { useKUNGalgameTopicStore } from '@/store/modules/topic'
// //
@ -43,12 +43,12 @@ const publishReply = async () => {
// //
isEdit.value = false isEdit.value = false
// //
message('Publish reply successfully!', '发布回复成功!', 'success') Message('Publish reply successfully!', '发布回复成功!', 'success')
} else { } else {
message('Publish reply failed!', '发布回复失败!', 'error') Message('Publish reply failed!', '发布回复失败!', 'error')
} }
} else { } else {
message('Reply content cannot be empty!', '回复内容不能为空!', 'warn') Message('Reply content cannot be empty!', '回复内容不能为空!', 'warn')
} }
} }
@ -60,7 +60,7 @@ const handlePublish = async () => {
publishReply() publishReply()
} else { } else {
// //
message('Cancel publish reply', '取消发布回复', 'info') Message('Cancel publish reply', '取消发布回复', 'info')
} }
} }
@ -83,7 +83,7 @@ const handleRewrite = async () => {
if (responseData.code === 200) { if (responseData.code === 200) {
// //
message('Reply rewrite successfully', '回复重新编辑成功', 'success') Message('Reply rewrite successfully', '回复重新编辑成功', 'success')
// 稿 // 稿
saveRewriteReply() saveRewriteReply()
@ -93,7 +93,7 @@ const handleRewrite = async () => {
isShowAdvance.value = false isShowAdvance.value = false
isEdit.value = false isEdit.value = false
} else { } else {
message('Reply rewrite failed!', '回复重新编辑失败!', 'error') Message('Reply rewrite failed!', '回复重新编辑失败!', 'error')
} }
} }
} }
@ -103,7 +103,7 @@ const handleSave = () => {
// true // true
replyDraft.value.isSaveReply = true replyDraft.value.isSaveReply = true
// //
message( Message(
'The draft has been saved successfully!', 'The draft has been saved successfully!',
'草稿已经保存成功', '草稿已经保存成功',
'success' 'success'