pref: replace message to Message
This commit is contained in:
parent
233dd4a5d2
commit
c425aac9b2
|
@ -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()
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, computed } from 'vue'
|
||||
// 全局消息组件(顶部)
|
||||
import message from '@/components/alert/Message'
|
||||
import Message from '@/components/alert/Message'
|
||||
|
||||
// 导入路由
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
|
@ -42,7 +42,7 @@ const handleClickHelp = () => {
|
|||
<p>网站的代码是手写的,错误在所难免</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>
|
||||
|
|
|
@ -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')
|
||||
}
|
||||
}
|
||||
// 恢复空白背景
|
||||
|
|
|
@ -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')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -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')
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import message from '@/components/alert/Message'
|
||||
import Message from '@/components/alert/Message'
|
||||
// 上传头像的函数
|
||||
import {
|
||||
checkImageValid,
|
||||
|
@ -51,7 +51,7 @@ const handleDragOver = (event: DragEvent) => {
|
|||
|
||||
// 更改头像
|
||||
const handleChangeAvatar = () => {
|
||||
message(
|
||||
Message(
|
||||
'Image API is not yet completed, stay tuned for updates',
|
||||
'图片接口还未完成,敬请期待',
|
||||
'warn'
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue'
|
||||
import Avatar from '../components/Avatar.vue'
|
||||
import message from '@/components/alert/Message'
|
||||
import Message from '@/components/alert/Message'
|
||||
// 导入用户 store
|
||||
import { useKUNGalgameUserStore } from '@/store/modules/kungalgamer'
|
||||
|
||||
|
@ -14,7 +14,7 @@ const bioValue = ref('')
|
|||
const handleChangeBio = async () => {
|
||||
// 签名超过最大长度
|
||||
if (bioValue.value.length > 107) {
|
||||
message(
|
||||
Message(
|
||||
'Bio must not exceed a maximum length of 107 characters',
|
||||
'签名的最大长度不可超过 107 个字符',
|
||||
'warn'
|
||||
|
@ -27,10 +27,10 @@ const handleChangeBio = async () => {
|
|||
bioValue.value
|
||||
)
|
||||
if (res.code === 200) {
|
||||
message('Rewrite bio successfully!', 'Rewrite 签名成功', 'success')
|
||||
Message('Rewrite bio successfully!', 'Rewrite 签名成功', 'success')
|
||||
bioValue.value = ''
|
||||
} else {
|
||||
message('Rewrite bio failed!', 'Rewrite 签名失败', 'error')
|
||||
Message('Rewrite bio failed!', 'Rewrite 签名失败', 'error')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -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<Blob> => {
|
|||
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'
|
||||
|
|
|
@ -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<Record<string, string>>({
|
|||
// 验证表单是否为空
|
||||
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')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
// 全局消息组件(顶部)
|
||||
import message from '@/components/alert/Message'
|
||||
import Message from '@/components/alert/Message'
|
||||
import { debounce } from '@/utils/debounce'
|
||||
|
||||
import { TopicComment } from '@/api/index'
|
||||
|
@ -42,13 +42,13 @@ const handleInputComment = () => {
|
|||
const isValidComment = () => {
|
||||
// 评论内容为空警告
|
||||
if (!content.value.trim()) {
|
||||
message('Comment content cannot be empty!', '评论内容不能为空!', 'warn')
|
||||
Message('Comment content cannot be empty!', '评论内容不能为空!', 'warn')
|
||||
return false
|
||||
}
|
||||
|
||||
// 评论内容超出限制警告
|
||||
if (content.value.trim().length > 1007) {
|
||||
message(
|
||||
Message(
|
||||
'The maximum length for comments should not exceed 1007 characters.',
|
||||
'评论最大长度不可超过1007个字符',
|
||||
'warn'
|
||||
|
@ -76,7 +76,7 @@ const handlePublishComment = async () => {
|
|||
emits('getCommentEmits', newComment)
|
||||
|
||||
// 提醒用户
|
||||
message('Comment publish successfully!', '评论发布成功', 'success')
|
||||
Message('Comment publish successfully!', '评论发布成功', 'success')
|
||||
|
||||
handleCloseCommentPanel()
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
import { ref, watch } 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'
|
||||
|
||||
|
@ -35,7 +35,7 @@ watch(
|
|||
|
||||
// throttle 回调函数
|
||||
const throttleCallback = () => {
|
||||
message(
|
||||
Message(
|
||||
'You can only perform one operation within 1007 milliseconds',
|
||||
'您在 1007 毫秒内只能进行一次操作',
|
||||
'warn'
|
||||
|
@ -45,13 +45,13 @@ const throttleCallback = () => {
|
|||
const dislikeComment = async () => {
|
||||
// 已经点踩
|
||||
if (isDisliked.value) {
|
||||
message(`You've already disliked it`, '您已经点过踩了', 'warn')
|
||||
Message(`You've already disliked it`, '您已经点过踩了', 'warn')
|
||||
return
|
||||
}
|
||||
|
||||
// 当前用户不可以给自己点赞
|
||||
if (props.uid === props.toUid) {
|
||||
message('You cannot dislike yourself', '您不可以给自己点踩', 'warn')
|
||||
Message('You cannot dislike yourself', '您不可以给自己点踩', 'warn')
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -65,9 +65,9 @@ const dislikeComment = async () => {
|
|||
if (res.code === 200) {
|
||||
dislikesCount.value++
|
||||
isDisliked.value = true
|
||||
message('Dislike successfully!', '点踩成功', 'success')
|
||||
Message('Dislike successfully!', '点踩成功', 'success')
|
||||
} else {
|
||||
message('Dislike failed!', '点踩失败', 'error')
|
||||
Message('Dislike failed!', '点踩失败', 'error')
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
import { ref, watch } 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'
|
||||
|
||||
|
@ -36,7 +36,7 @@ watch(
|
|||
|
||||
// throttle 回调函数
|
||||
const throttleCallback = () => {
|
||||
message(
|
||||
Message(
|
||||
'You can only perform one operation within 1007 milliseconds',
|
||||
'您在 1007 毫秒内只能进行一次操作',
|
||||
'warn'
|
||||
|
@ -46,13 +46,13 @@ const throttleCallback = () => {
|
|||
const likeComment = async () => {
|
||||
// 已经点赞
|
||||
if (isLiked.value) {
|
||||
message(`You've already liked it`, '您已经点过赞了', 'warn')
|
||||
Message(`You've already liked it`, '您已经点过赞了', 'warn')
|
||||
return
|
||||
}
|
||||
|
||||
// 当前用户不可以给自己点赞
|
||||
if (props.uid === props.toUid) {
|
||||
message('You cannot like yourself', '您不可以给自己点赞', 'warn')
|
||||
Message('You cannot like yourself', '您不可以给自己点赞', 'warn')
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -62,9 +62,9 @@ const likeComment = async () => {
|
|||
if (res.code === 200) {
|
||||
likesCount.value++
|
||||
isLiked.value = true
|
||||
message('Like successfully!', '点赞成功', 'success')
|
||||
Message('Like successfully!', '点赞成功', 'success')
|
||||
} else {
|
||||
message('Like failed!', '点赞失败', 'error')
|
||||
Message('Like failed!', '点赞失败', 'error')
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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'
|
||||
|
@ -70,7 +70,7 @@ const dislikeOperation = async (
|
|||
const toggleDislike = async () => {
|
||||
// 当前用户不可以给自己点赞
|
||||
if (props.uid === props.toUid) {
|
||||
message('You cannot dislike yourself', '您不可以给自己点踩', 'warn')
|
||||
Message('You cannot dislike yourself', '您不可以给自己点踩', 'warn')
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -85,15 +85,15 @@ const toggleDislike = async () => {
|
|||
dislikesCount.value += isPush ? 1 : -1
|
||||
|
||||
if (isPush) {
|
||||
message('Dislike successfully!', '点踩成功!', 'success')
|
||||
Message('Dislike successfully!', '点踩成功!', 'success')
|
||||
} else {
|
||||
message('Cancel dislike successfully!', '取消点踩成功!', 'success')
|
||||
Message('Cancel dislike successfully!', '取消点踩成功!', 'success')
|
||||
}
|
||||
} else {
|
||||
if (isPush) {
|
||||
message('Dislike failed!', '点踩失败!', 'error')
|
||||
Message('Dislike failed!', '点踩失败!', 'error')
|
||||
} else {
|
||||
message('Cancel dislike failed!', '取消点踩失败!', 'error')
|
||||
Message('Cancel dislike failed!', '取消点踩失败!', 'error')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ import Reply from './Reply.vue'
|
|||
import Rewrite from './Rewrite.vue'
|
||||
|
||||
// 全局消息组件(顶部)
|
||||
import message from '@/components/alert/Message'
|
||||
import Message from '@/components/alert/Message'
|
||||
|
||||
// 导入用户的 store
|
||||
import { useKUNGalgameUserStore } from '@/store/modules/kungalgamer'
|
||||
|
@ -83,10 +83,10 @@ Link: https://www.kungal.com/topic/${props.info.tid}`
|
|||
navigator.clipboard
|
||||
.writeText(shareLink.value)
|
||||
.then(() => {
|
||||
message('Share Link copied successfully!', '分享链接复制成功', 'success')
|
||||
Message('Share Link copied successfully!', '分享链接复制成功', 'success')
|
||||
})
|
||||
.catch((err) => {
|
||||
message('Share Link copied failed!', '分享链接复制失败!', 'error')
|
||||
Message('Share Link copied failed!', '分享链接复制失败!', 'error')
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -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')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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'
|
||||
|
|
Loading…
Reference in a new issue