Commit 1eca796d by lijiabin

【需求 20331】 perf: 用notivue替代elemenplus 的toast

parent 97fd95f2
......@@ -33,6 +33,7 @@
"dayjs": "^1.11.19",
"element-plus": "^2.11.5",
"inquirer": "^13.0.2",
"notivue": "^2.4.5",
"pinia": "^3.0.3",
"ssh2": "^1.17.0",
"vue": "^3.5.22",
......
......@@ -41,6 +41,9 @@ importers:
inquirer:
specifier: ^13.0.2
version: 13.0.2(@types/node@22.18.12)
notivue:
specifier: ^2.4.5
version: 2.4.5(defu@6.1.4)
pinia:
specifier: ^3.0.3
version: 3.0.3(typescript@5.9.3)(vue@3.5.22(typescript@5.9.3))
......@@ -2879,6 +2882,20 @@ packages:
normalize-wheel-es@1.2.0:
resolution: {integrity: sha512-Wj7+EJQ8mSuXr2iWfnujrimU35R2W4FAErEyTmJoJ7ucwTn2hOUSsRehMb5RSYkxXGTM7Y9QpvPmp++w5ftoJw==}
notivue@2.4.5:
resolution: {integrity: sha512-7yBdaKesUZIwdcQP3nv1oWYyisI2bURkZ+D9KfLgeNqguHUzkQ1WdhGcTj59PBZa8mqa1/K5Mh8YsphSToMKcQ==}
peerDependencies:
'@nuxt/kit': '>=3.5.0'
'@nuxt/schema': '>=3.5.0'
defu: '>=6'
peerDependenciesMeta:
'@nuxt/kit':
optional: true
'@nuxt/schema':
optional: true
defu:
optional: true
npm-normalize-package-bin@4.0.0:
resolution: {integrity: sha512-TZKxPvItzai9kN9H/TkmCtx/ZN/hvr3vUycjlfmH0ootY9yFBzNOpiXAdIn1Iteqsvk4lQn6B5PTrt+n6h8k/w==}
engines: {node: ^18.17.0 || >=20.5.0}
......@@ -6941,6 +6958,10 @@ snapshots:
normalize-wheel-es@1.2.0: {}
notivue@2.4.5(defu@6.1.4):
optionalDependencies:
defu: 6.1.4
npm-normalize-package-bin@4.0.0: {}
npm-run-all2@8.0.4:
......
<template>
<Notivue v-slot="item">
<NotivueSwipe :item="item">
<Notification :item="item">
<NotificationProgress :item="item" />
</Notification>
</NotivueSwipe>
</Notivue>
<el-config-provider :locale="locale">
<router-view v-slot="{ Component }">
<component :is="Component" />
......@@ -8,6 +15,7 @@
<script setup lang="ts">
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import { initWxConfig } from '@/utils/wxUtil/initWXConfig'
import { Notivue, NotivueSwipe, Notification, NotificationProgress } from 'notivue'
const locale = ref(zhCn)
......
......@@ -12,6 +12,7 @@
<script setup lang="ts">
import { addComplaint } from '@/api'
import type { ArticleItemDto } from '@/api/article/types'
import { push } from 'notivue'
const { articleDetail } = defineProps<{
articleDetail: ArticleItemDto
......@@ -27,7 +28,7 @@ const handleMore = async (command: string) => {
inputErrorMessage: '举报原因不能为空',
})
addComplaint({ articleId: articleDetail.id, reason: value })
ElMessage.success('举报成功')
push.success('举报成功')
}
}
</script>
......@@ -365,6 +365,7 @@ import { useNavigation } from '@/hooks'
import { parseEmoji } from '@/utils/emoji'
import CommentBox from '../CommentBox/index.vue'
import dayjs from 'dayjs'
import { push } from 'notivue'
const { jumpToUserHomePage } = useNavigation()
const {
......@@ -474,11 +475,11 @@ const currentCommentId = ref(-1)
const handleLickComment = async (item: CommentItemDto) => {
await addOrCancelCommentLike(item.id)
if (item.hasPraise === BooleanFlag.YES) {
ElMessage.success('取消点赞成功')
push.success('取消点赞成功')
item.postPriseCount--
item.hasPraise = BooleanFlag.NO
} else {
ElMessage.success('点赞成功')
push.success('点赞成功')
item.postPriseCount++
item.hasPraise = BooleanFlag.YES
}
......@@ -508,7 +509,7 @@ const handleMyComment = async () => {
...(commentId ? { pid: commentId } : {}),
imgUrl: myCommentImgStr.value,
})
ElMessage.success('发表评论成功')
push.success('发表评论成功')
refresh()
myComment.value = ''
myCommentImgStr.value = ''
......@@ -530,7 +531,7 @@ const handleComment = async (index: number) => {
...(currentCommentId.value ? { pid: currentCommentId.value } : {}),
imgUrl: commentToOtherImgStr.value,
})
ElMessage.success('发表评论成功')
push.success('发表评论成功')
commentToOther.value = ''
commentToOtherImgStr.value = ''
total.value++
......
......@@ -36,6 +36,8 @@ import { useUserStore } from '@/stores'
import { storeToRefs } from 'pinia'
import { addComment } from '@/api'
import CommentBox from '../CommentBox/index.vue'
import { push } from 'notivue'
const emit = defineEmits<{
(e: 'commentSuccess'): void
}>()
......@@ -79,7 +81,7 @@ const handleSubmit = async () => {
imgUrl: commentImgStr.value,
})
console.log('评论内容:', commentStr.value)
ElMessage.success('评论发表成功')
push.success('评论发表成功')
handleClose()
emit('commentSuccess')
} catch (error) {
......
......@@ -236,6 +236,7 @@ import { usePageSearch } from '@/hooks'
import { parseEmoji } from '@/utils/emoji'
import CommentBox from '../CommentBox/index.vue'
import dayjs from 'dayjs'
import { push } from 'notivue'
const { articleId, pid } = defineProps<{
articleId: number
......@@ -339,7 +340,7 @@ const submitReply = async (targetId: number | undefined) => {
imgUrl: imgStr,
})
ElMessage.success('回复成功')
push.success('回复成功')
// 清空输入框
if (isBottom) {
......
<!-- 导入excel按钮组件 前端传二进制文件 -->
<script setup lang="tsx" generic="T">
import type { BackendServiceResult } from '@/utils/request/types'
import { push } from 'notivue'
const props = defineProps<{
api: (file: File, onProgress?: (progress: number) => void) => Promise<BackendServiceResult<T[]>>
}>()
......@@ -38,7 +40,7 @@ const handleChange = async (e: Event) => {
uploadProgress.value = progress
})
setTimeout(() => {
ElMessage.success('上传成功')
push.success('上传成功')
}, 1000)
emit('success')
} catch (error: any) {
......
......@@ -137,6 +137,7 @@ import type { ElButton } from 'element-plus'
import { useAnimate } from '@vueuse/core'
import RichTextarea from '../RichTextarea/index.vue'
import UploadImgIcon from '../UploadImgIcon/index.vue'
import { push } from 'notivue'
// 暂时只有 问吧 和 实践 需要发布框 这俩都需要实名
type ArticleType = ArticleTypeEnum.QUESTION | ArticleTypeEnum.PRACTICE
......@@ -237,7 +238,7 @@ const handleAddTag = () => {
const validateForm = () => {
if (!form.value.mainTagId) {
ElMessage.warning({
push.warning({
message: '请选择主标签',
offset: 200,
})
......@@ -269,7 +270,7 @@ const handlePublish = async (releaseStatus: ReleaseStatusTypeEnum) => {
try {
await textMap[type].api(transformForm(releaseStatus))
loading.value = false
ElMessage.success(releaseStatus === ReleaseStatusTypeEnum.PUBLISH ? '发布成功' : '存草稿成功')
push.success(releaseStatus === ReleaseStatusTypeEnum.PUBLISH ? '发布成功' : '存草稿成功')
resetForm()
} catch (error) {
console.error(error)
......
......@@ -5,6 +5,7 @@ import { storeToRefs } from 'pinia'
import type { TagItemDto } from '@/api/tag/types'
import type { SelectTagProps } from './types'
import { TagTypeEnum } from '@/constants'
import { push } from 'notivue'
const {
maxSelectedTags = 1,
......@@ -92,10 +93,10 @@ const filteredRecommendedTags = computed(() => {
const addTag = (tagId: number) => {
if (arryrOfModelValue.value.length >= maxSelectedTags)
return ElMessage.warning({ message: `最多只能选择 ${maxSelectedTags} 个标签`, plain: true })
return push.warning(`最多只能选择 ${maxSelectedTags} 个标签`)
// 不能直接push 触发不了computed 的 set
arryrOfModelValue.value = [...arryrOfModelValue.value, tagId]
ElMessage.success({ message: '标签添加成功', plain: true })
push.success('标签添加成功')
emit('selected', filterTags.value.find((tag) => tag.id === tagId)!)
}
......
......@@ -28,6 +28,7 @@ import { Plus } from '@element-plus/icons-vue'
import { uploadFile as uploadFileApi } from '@/api'
import type { UploadProps, UploadUserFile } from 'element-plus'
import type { UploadFileProps } from './types'
import { push } from 'notivue'
const props = withDefaults(defineProps<UploadFileProps>(), {
limit: 2,
......@@ -104,7 +105,7 @@ watch(
const handleExceed: UploadProps['onExceed'] = (uploadFiles) => {
console.log('uploadFiles', uploadFiles)
if (uploadFiles.length > props.limit) {
ElMessage.error(`最多上传 ${props.limit} 个文件`)
push.error(`最多上传 ${props.limit} 个文件`)
return
}
}
......@@ -112,7 +113,7 @@ const handleExceed: UploadProps['onExceed'] = (uploadFiles) => {
const handleChange: UploadProps['onChange'] = async (uploadFile, uploadFiles) => {
console.log('uploadFiles', uploadFiles)
if (uploadFiles.length > props.limit) {
ElMessage.error(`最多上传 ${props.limit} 个文件`)
push.error(`最多上传 ${props.limit} 个文件`)
const index = fileList.value.findIndex((file) => file.uid === uploadFile.uid)
if (index !== -1) {
fileList.value.splice(index, 1)
......@@ -151,13 +152,13 @@ const handleChange: UploadProps['onChange'] = async (uploadFile, uploadFiles) =>
name,
status: 'success',
}
ElMessage.success('上传成功')
push.success('上传成功')
} else {
console.warn('找不到对应的文件,uid:', uid)
}
} catch (error) {
console.error('上传失败:', error)
ElMessage.error('上传失败,请重试')
push.error('上传失败,请重试')
const fileIndex = fileList.value.findIndex((file) => file.uid === uid)
if (fileIndex !== -1) {
......
......@@ -75,6 +75,7 @@ import { uploadFile as uploadFileApi } from '@/api/common'
import type { UploadFile } from 'element-plus'
import type { UploadVideoProps } from './types'
import { getVideoMetadata } from '@/utils'
import { push } from 'notivue'
interface VideoInfo {
url: string
......@@ -194,11 +195,11 @@ const startUpload = async () => {
url: videoData.url,
videoDuration: videoData.duration,
})
ElMessage.success('视频上传成功!')
push.success('视频上传成功!')
} catch (error) {
uploading.value = false
uploadError.value = error instanceof Error ? error.message : '上传失败,请重试'
ElMessage.error(uploadError.value)
push.error(uploadError.value)
}
}
......@@ -207,7 +208,7 @@ const cancelUpload = () => {
cancelUploadController()
uploading.value = false
uploadProgress.value = 0
ElMessage.info('已取消上传')
push.info('已取消上传')
}
// 重新选择视频
......
import { uploadFile } from '@/api'
import { push } from 'notivue'
// 类型定义
type BaseReturn = {
......@@ -38,7 +39,7 @@ export function useUploadImg(imgs: Ref<string> | Ref<string[]>) {
}
} catch (error) {
console.error('上传失败:', error)
ElMessage.error('上传失败,请重试')
push.error('上传失败,请重试')
} finally {
uploadPercent.value = 0
// 重置input的value
......
......@@ -8,6 +8,7 @@ import { useColumnStore } from '@/stores/column'
import { storeToRefs } from 'pinia'
import SelectTags from '@/components/common/SelectTags/index.vue'
import type { AddOrUpdateColumnForm, AddOrUpdateColumnDto } from '@/api/article/types'
import { push } from 'notivue'
export default defineComponent((_, { expose }) => {
const columnStore = useColumnStore()
......@@ -64,7 +65,7 @@ export default defineComponent((_, { expose }) => {
return transformForm(releaseStatus)
} catch (error) {
console.log(error)
ElMessage.warning('请检查输入内容')
push.warning('请检查输入内容')
return null
}
}
......
......@@ -7,6 +7,7 @@ import { useInterviewStore } from '@/stores/interview'
import { storeToRefs } from 'pinia'
import type { AddOrUpdateInterviewDto, AddOrUpdateInterviewForm } from '@/api/article/types'
import type { TagItemDto } from '@/api/tag/types'
import { push } from 'notivue'
export default defineComponent((_, { expose }) => {
const interviewStore = useInterviewStore()
......@@ -61,7 +62,7 @@ export default defineComponent((_, { expose }) => {
return transformForm(releaseStatus)
} catch (error) {
console.log(error)
ElMessage.warning('请检查输入内容')
push.warning('请检查输入内容')
return null
}
}
......
......@@ -2,6 +2,7 @@ import { ArticleTypeEnum, ReleaseStatusTypeEnum, SendTypeEnum } from '@/constant
import UploadFile from '@/components/common/UploadFile/index.vue'
import { useResetData } from '@/hooks'
import type { AddOrUpdatePostDto } from '@/api'
import { push } from 'notivue'
export default defineComponent(
(_, { expose }) => {
......@@ -37,7 +38,7 @@ export default defineComponent(
return transformForm(releaseStatus)
} catch (error) {
console.log(error)
ElMessage.warning('请检查输入内容')
push.warning('请检查输入内容')
return null
}
}
......
......@@ -6,6 +6,7 @@ import SelectTags from '@/components/common/SelectTags/index.vue'
import { useResetData } from '@/hooks'
import type { TagItemDto } from '@/api/tag/types'
import type { AddOrUpdatePracticeDto } from '@/api/practice/types'
import { push } from 'notivue'
export default defineComponent((_, { expose }) => {
const [form, resetForm] = useResetData<AddOrUpdatePracticeDto>({
......@@ -50,7 +51,7 @@ export default defineComponent((_, { expose }) => {
return transformForm(releaseStatus)
} catch (error) {
console.log(error)
ElMessage.warning('请检查输入内容')
push.warning('请检查输入内容')
return null
}
}
......
......@@ -41,6 +41,7 @@ import type { Component } from 'vue'
import { addOrUpdateArticle, addOrUpdatePractice } from '@/api'
import { ArticleTypeEnum, ReleaseStatusTypeEnum } from '@/constants'
import LoadingComponent from '@/components/common/LoadingComponent/index.vue'
import { push } from 'notivue'
interface ApiMap {
[ArticleTypeEnum.VIDEO]: typeof addOrUpdateArticle
......@@ -168,7 +169,7 @@ const handleSubmit = async (releaseStatus: ReleaseStatusTypeEnum) => {
await typeMap[articleType.value].api?.({
...formData,
})
ElMessage.success('发布成功')
push.success('发布成功')
// 这里可以添加发布逻辑
close()
} catch (error) {
......
......@@ -11,11 +11,25 @@ import 'virtual:uno.css'
import 'virtual:svg-icons-register'
import SvgIcon from '@/components/common/SvgIcon/svgIcon.vue'
// 注册notivue
import { createNotivue } from 'notivue'
import 'notivue/notification.css'
import 'notivue/animations.css'
if (import.meta.env.MODE === 'production') {
import('@/utils/version').then(({ loopGetVersion }) => loopGetVersion())
}
const notivue = createNotivue({
notifications: {
global: {
duration: 2500,
},
},
})
const app = createApp(App)
app.use(notivue)
app.use(createPinia())
app.use(router)
......
@import './reset.css';
@import './element.scss';
@import './uiLib.scss';
/* 解决弹窗滚轮 */
// 重置 element-plus 样式
:root {
--el-color-primary: #3b82f6;
--nv-z: 99999;
--nv-root-top: 4rem;
}
.el-message.is-plain {
border: 1px solid rgb(238, 238, 238) !important;
......
import * as XLSX from 'xlsx'
import { push } from 'notivue'
/**
* 导出 Excel
* @param {Object[]} data 数据源
......@@ -27,7 +27,7 @@ export function exportExcel<T>({
fileName = '导出数据',
sheetName = 'Sheet1',
}: ExportOptions<T>) {
if (!data || !data.length) return ElMessage.warning('没有可导出的数据')
if (!data || !data.length) return push.warning('没有可导出的数据')
const header = columns.map((col) => col.title)
......
......@@ -10,9 +10,9 @@ import {
import type { BackendServiceResult, RequestServiceError } from './types'
import { showErrorMsg } from '@/utils/toast'
import type { AxiosError, AxiosRequestConfig, AxiosResponse } from 'axios'
import type { MessageHandler } from 'element-plus'
import service from './index'
import { useUserStore } from '@/stores/user'
import { push, type PushClearMethods } from 'notivue'
/**
* 后端逻辑code报错处理
......@@ -81,20 +81,16 @@ export function handleRequestError<T>(axiosError: AxiosError<BackendServiceResul
if (axiosError.response?.data.code === 501) {
const message = axiosError.response?.data.message
if (message && JSON.parse(message)) {
ElMessage({
showClose: true,
push.error({
message: `敏感词不可出现:${JSON.parse(message).join(',')}`,
type: 'error',
duration: 0,
})
}
}
if (axiosError.response?.data.code === 502) {
// 502 企业微信登录错误
ElMessage({
showClose: true,
message: `当前链接有问题,请从同事吧入口进入登录后,再点击该连接,如果有其他问题,请联系 张惠忠 解决`,
type: 'error',
push.error({
message: `请从YA文件入口进入登录后,再点击该连接,如果有其他问题,请联系 李家彬 解决`,
duration: 0,
})
} else if (error.code === 401) {
......@@ -144,13 +140,12 @@ async function handleUnAuthorized(axiosError: AxiosError) {
}
}
let msgIns: MessageHandler | null = null
let msgIns: PushClearMethods | null = null
function create401ErrorMsg() {
if (!msgIns) {
msgIns = ElMessage({
msgIns = push.error({
message: '重新获取token失败,请关闭标签页,重新打开',
type: 'error',
duration: 0,
})
}
......
import 'element-plus/es/components/message/style/css'
import type { RequestServiceError } from '@/utils/request/types'
import { NO_ERROR_MSG_CODE, ERROR_MSG_DURATION } from '@/utils/request/service'
import { push } from 'notivue'
/** 错误消息栈,防止同一错误同时出现 */
const errorMsgStack = new Map<string | number, string>([])
......@@ -24,7 +24,7 @@ export function showErrorMsg(error: RequestServiceError) {
if (!hasErrorMsg(error)) {
addErrorMsg(error)
if (error.msg) {
ElMessage.error(error.msg)
push.error(error.msg)
}
setTimeout(() => {
removeErrorMsg(error)
......
......@@ -35,7 +35,7 @@ import type { ArticleItemDto } from '@/api'
import type { Component } from 'vue'
import { useScrollTop } from '@/hooks'
import { addOrCanceArticlelCollect, addOrCanceArticlelLike } from '@/api'
import { push } from 'notivue'
const modelValue = defineModel<ArticleItemDto>('modelValue', { required: true })
const emit = defineEmits<{
......@@ -72,7 +72,7 @@ const stats = computed(() => {
? modelValue.value.praiseCount + 1
: modelValue.value.praiseCount - 1
ElMessage.success(isAdd ? '点赞成功' : '取消点赞成功')
push.success(isAdd ? '点赞成功' : '取消点赞成功')
},
},
{
......@@ -91,7 +91,7 @@ const stats = computed(() => {
modelValue.value.collectionCount = isAdd
? modelValue.value.collectionCount + 1
: modelValue.value.collectionCount - 1
ElMessage.success(isAdd ? '收藏成功' : '取消收藏成功')
push.success(isAdd ? '收藏成功' : '取消收藏成功')
},
},
{
......
......@@ -9,6 +9,7 @@ import type { AuctionItemDto } from '@/api'
import { useYaBiStore } from '@/stores'
import { storeToRefs } from 'pinia'
import BackButton from '@/components/common/BackButton/index.vue'
import { push } from 'notivue'
const yabiStore = useYaBiStore()
const { yabiData } = storeToRefs(yabiStore)
......@@ -172,10 +173,10 @@ const onBid = async (item: AuctionItemDto) => {
if (action !== 'confirm') {
done()
} else {
if (val.value > yabiData.value.currentValue) return ElMessage.error('您的YA币余额不足')
if (val.value > yabiData.value.currentValue) return push.error('您的YA币余额不足')
if (val.value < data.minIncrement + (data.currentPrice || data.startingPrice))
return ElMessage.error('出价必须大于等于前最高出价+最低加价幅度')
return push.error('出价必须大于等于前最高出价+最低加价幅度')
instance.confirmButtonLoading = true
instance.confirmButtonText = 'Loading...'
......
......@@ -31,6 +31,7 @@ import { type ArticleItemDto } from '@/api'
import { getArticleDetail, auditArticle } from '@/api'
import { AuditStatusEnum } from '@/constants/enums'
import type { AuditArticleDto } from '@/api'
import { push } from 'notivue'
const route = useRoute()
const router = useRouter()
const id = route.params.id as string
......@@ -54,7 +55,7 @@ const handleAudit = async (auditStatus: AuditStatusEnum) => {
auditData.auditRemark = value
}
await auditArticle(auditData)
ElMessage.success('审核成功')
push.success('审核成功')
router.replace('/')
}
......
......@@ -190,7 +190,7 @@ import type {
import { ArticleTypeEnum, articleTypeListOptions } from '@/constants'
import { usePageSearch, useNavigation } from '@/hooks'
import dayjs from 'dayjs'
import { push } from 'notivue'
const router = useRouter()
const { jumpToArticleDetailPage } = useNavigation()
// 列表数据
......@@ -267,11 +267,11 @@ const handleDelete = async (row: BackendCarouselListItemDto) => {
isRelease: 0, // 状态设置为0
})
ElMessage.success('删除成功')
push.success('删除成功')
getList()
} catch (error) {
if (error !== 'cancel') {
ElMessage.error('删除失败')
push.error('删除失败')
}
}
}
......@@ -288,7 +288,7 @@ const handleSubmit = async () => {
await addCarousel(form.value)
}
ElMessage.success(form.value.id ? '编辑成功' : '新增成功')
push.success(form.value.id ? '编辑成功' : '新增成功')
dialogVisible.value = false
getList()
} catch (error) {
......
......@@ -6,7 +6,7 @@ import type { TagItemDto } from '@/api/tag/types'
import { TagLevelEnum, TagTypeEnum } from '@/constants'
import { selectDepOrUser } from '@/utils'
import { backendEditCase } from '@/api/backend'
import { push } from 'notivue'
const emit = defineEmits<{
refresh: []
}>()
......@@ -97,7 +97,7 @@ const selcetDept = async () => {
selectedDepartmentIds: form.value.departmentList.map((i) => i.id),
})
if (departmentList.length > 3) {
return ElMessage.warning('最多只能选择3个部门,请重新选择')
return push.warning('最多只能选择3个部门,请重新选择')
}
form.value.departmentList = departmentList
}
......@@ -186,7 +186,7 @@ const handleSave = async () => {
const data = transformData()
const res = await backendEditCase(data)
if (res.code === 200) {
ElMessage.success('编辑成功')
push.success('编辑成功')
visible.value = false
}
visible.value = false
......
......@@ -295,7 +295,7 @@ import ImportExcelBtn from '@/components/common/ImportExcelBtn/index.vue'
import dayjs from 'dayjs'
import ErrorListDialog from './components/errorListDialog.vue'
import EditDialog from './components/editDialog.vue'
import { push } from 'notivue'
const { loading, list, total, reset, goToPage, changePageSize, refresh, searchParams } =
usePageSearch(getCaseList, {
defaultParams: {},
......@@ -306,7 +306,7 @@ const editDialogRef = useTemplateRef<InstanceType<typeof EditDialog>>('editDialo
// 编辑
const handleEdit = async (row: BackendCaseListItemDto) => {
// 已使用的状态 不允许编辑
if (row.isUse === UsageStatusEnum.USED) return ElMessage.warning('已使用的状态 不允许编辑')
if (row.isUse === UsageStatusEnum.USED) return push.warning('已使用的状态 不允许编辑')
// 审核通过再编辑
if (row.isAudit === AuditStatusEnum.AGREED) {
await ElMessageBox.confirm('案例库已审核通过,修改后需重新审核,点击确定继续编辑', '提示', {
......@@ -330,7 +330,7 @@ const handleBatchPublish = async () => {
await hideColumn(selectedRows.value.map((item) => item.id))
refresh()
selectedRows.value = []
ElMessage.success('发布/隐藏成功')
push.success('发布/隐藏成功')
}
// 批量删除
......@@ -338,7 +338,7 @@ const handleBatchDelete = async () => {
await deleteColumn(selectedRows.value.map((item) => item.id))
refresh()
selectedRows.value = []
ElMessage.success('删除成功')
push.success('删除成功')
}
const handleContent = (row: BackendCaseListItemDto) => {
......@@ -352,7 +352,7 @@ const handleAuditStatusChange = async (row: BackendCaseListItemDto, value: numbe
id: row.id,
isAudit: value,
})
ElMessage.success('审核成功')
push.success('审核成功')
row.isAudit = value
}
......@@ -361,7 +361,7 @@ const handleUsageStatusChange = async (row: BackendCaseListItemDto, value: numbe
id: row.id,
isUse: value,
})
ElMessage.success('使用状态修改成功')
push.success('使用状态修改成功')
refresh()
row.isUse = value
}
......
......@@ -131,7 +131,7 @@ import { listOfCultureColumn, addOrUpdateColumn, deleteColumn, hideColumn } from
import type { FormInstance, FormRules } from 'element-plus'
import type { BackendColumnListItemDto, AddOrUpdateColumnDto } from '@/api/backend'
import dayjs from 'dayjs'
import { push } from 'notivue'
const { loading, list, total, reset, goToPage, changePageSize, refresh, searchParams, search } =
usePageSearch(listOfCultureColumn, {
defaultParams: {
......@@ -196,11 +196,11 @@ const handleDelete = async (row: BackendColumnListItemDto) => {
await deleteColumn([row.id])
ElMessage.success('删除成功')
push.success('删除成功')
refresh()
} catch (error) {
if (error !== 'cancel') {
ElMessage.error('删除失败')
push.error('删除失败')
}
}
}
......@@ -218,7 +218,7 @@ const handleSubmit = async () => {
await addOrUpdateColumn(form.value)
}
ElMessage.success(form.value.id ? '编辑成功' : '新增成功')
push.success(form.value.id ? '编辑成功' : '新增成功')
dialogVisible.value = false
if (form.value.id) {
search()
......@@ -241,7 +241,7 @@ const handleBatchPublish = async () => {
await hideColumn(selectedRows.value.map((item) => item.id))
refresh()
selectedRows.value = []
ElMessage.success('发布/隐藏成功')
push.success('发布/隐藏成功')
}
// 批量删除
......@@ -249,7 +249,7 @@ const handleBatchDelete = async () => {
await deleteColumn(selectedRows.value.map((item) => item.id))
refresh()
selectedRows.value = []
ElMessage.success('删除成功')
push.success('删除成功')
}
</script>
......
......@@ -137,7 +137,7 @@ import { listOfCultureColumn, addOrUpdateColumn, deleteColumn, hideColumn } from
import type { FormInstance, FormRules } from 'element-plus'
import type { BackendColumnListItemDto, AddOrUpdateColumnDto } from '@/api/backend'
import dayjs from 'dayjs'
import { push } from 'notivue'
const { loading, list, total, reset, goToPage, changePageSize, refresh, searchParams, search } =
usePageSearch(listOfCultureColumn, {
defaultParams: {
......@@ -202,11 +202,11 @@ const handleDelete = async (row: BackendColumnListItemDto) => {
await deleteColumn([row.id])
ElMessage.success('删除成功')
push.success('删除成功')
refresh()
} catch (error) {
if (error !== 'cancel') {
ElMessage.error('删除失败')
push.error('删除失败')
}
}
}
......@@ -224,7 +224,7 @@ const handleSubmit = async () => {
await addOrUpdateColumn(form.value)
}
ElMessage.success(form.value.id ? '编辑成功' : '新增成功')
push.success(form.value.id ? '编辑成功' : '新增成功')
dialogVisible.value = false
if (form.value.id) {
search()
......@@ -247,7 +247,7 @@ const handleBatchPublish = async () => {
await hideColumn(selectedRows.value.map((item) => item.id))
refresh()
selectedRows.value = []
ElMessage.success('发布/隐藏成功')
push.success('发布/隐藏成功')
}
// 批量删除
......@@ -255,7 +255,7 @@ const handleBatchDelete = async () => {
await deleteColumn(selectedRows.value.map((item) => item.id))
refresh()
selectedRows.value = []
ElMessage.success('删除成功')
push.success('删除成功')
}
</script>
......
......@@ -130,7 +130,7 @@ import { listOfCultureColumn, addOrUpdateColumn, deleteColumn, hideColumn } from
import type { FormInstance, FormRules } from 'element-plus'
import type { BackendColumnListItemDto, AddOrUpdateColumnDto } from '@/api/backend'
import dayjs from 'dayjs'
import { push } from 'notivue'
const { loading, list, total, reset, goToPage, changePageSize, refresh, searchParams, search } =
usePageSearch(listOfCultureColumn, {
defaultParams: {
......@@ -195,11 +195,11 @@ const handleDelete = async (row: BackendColumnListItemDto) => {
await deleteColumn([row.id])
ElMessage.success('删除成功')
push.success('删除成功')
refresh()
} catch (error) {
if (error !== 'cancel') {
ElMessage.error('删除失败')
push.error('删除失败')
}
}
}
......@@ -217,7 +217,7 @@ const handleSubmit = async () => {
await addOrUpdateColumn(form.value)
}
ElMessage.success(form.value.id ? '编辑成功' : '新增成功')
push.success(form.value.id ? '编辑成功' : '新增成功')
dialogVisible.value = false
if (form.value.id) {
search()
......@@ -240,7 +240,7 @@ const handleBatchPublish = async () => {
await hideColumn(selectedRows.value.map((item) => item.id))
refresh()
selectedRows.value = []
ElMessage.success('发布/隐藏成功')
push.success('发布/隐藏成功')
}
// 批量删除
......@@ -248,7 +248,7 @@ const handleBatchDelete = async () => {
await deleteColumn(selectedRows.value.map((item) => item.id))
refresh()
selectedRows.value = []
ElMessage.success('删除成功')
push.success('删除成功')
}
</script>
......
......@@ -8,7 +8,7 @@ import type { BackendColumnListItemDto, AddOrUpdateColumnDto } from '@/api/backe
import dayjs from 'dayjs'
import { ArticleTypeEnum, BooleanFlag } from '@/constants'
import type { ArticleItemDto } from '@/api/article/types'
import { push } from 'notivue'
const { loading, list, total, reset, goToPage, changePageSize, refresh, searchParams, search } =
usePageSearch(getArticleList, {
defaultParams: {
......@@ -44,7 +44,7 @@ const handleIsRecommendChange = async (val: BooleanFlag, row: ArticleItemDto) =>
recommendSort: 0, // 默认传 0
isRecommend: val,
})
ElMessage.success('修改成功')
push.success('修改成功')
refresh()
}
......@@ -62,7 +62,7 @@ const handleEditSort = async (row: ArticleItemDto) => {
recommendSort: Number(value),
isRecommend: BooleanFlag.YES,
})
ElMessage.success('修改成功')
push.success('修改成功')
refresh()
}
......@@ -79,7 +79,7 @@ const handleSubmit = async () => {
await addOrUpdateColumn(form.value)
}
ElMessage.success(form.value.id ? '编辑成功' : '新增成功')
push.success(form.value.id ? '编辑成功' : '新增成功')
dialogVisible.value = false
if (form.value.id) {
search()
......
......@@ -8,7 +8,7 @@ import type { BackendColumnListItemDto, AddOrUpdateColumnDto } from '@/api/backe
import dayjs from 'dayjs'
import { ArticleTypeEnum, BooleanFlag } from '@/constants'
import type { ArticleItemDto } from '@/api/article/types'
import { push } from 'notivue'
const { loading, list, total, reset, goToPage, changePageSize, refresh, searchParams, search } =
usePageSearch(getArticleList, {
defaultParams: {
......@@ -44,7 +44,7 @@ const handleIsRecommendChange = async (val: BooleanFlag, row: ArticleItemDto) =>
recommendSort: 0, // 默认传 0
isRecommend: val,
})
ElMessage.success('修改成功')
push.success('修改成功')
refresh()
}
......@@ -62,7 +62,7 @@ const handleEditSort = async (row: ArticleItemDto) => {
recommendSort: Number(value),
isRecommend: BooleanFlag.YES,
})
ElMessage.success('修改成功')
push.success('修改成功')
refresh()
}
......@@ -79,7 +79,7 @@ const handleSubmit = async () => {
await addOrUpdateColumn(form.value)
}
ElMessage.success(form.value.id ? '编辑成功' : '新增成功')
push.success(form.value.id ? '编辑成功' : '新增成功')
dialogVisible.value = false
if (form.value.id) {
search()
......
......@@ -8,7 +8,7 @@ import type { BackendColumnListItemDto, AddOrUpdateColumnDto } from '@/api/backe
import dayjs from 'dayjs'
import { ArticleTypeEnum, BooleanFlag } from '@/constants'
import type { ArticleItemDto } from '@/api/article/types'
import { push } from 'notivue'
const { loading, list, total, reset, goToPage, changePageSize, refresh, searchParams, search } =
usePageSearch(getArticleList, {
defaultParams: {
......@@ -44,7 +44,7 @@ const handleIsRecommendChange = async (val: BooleanFlag, row: ArticleItemDto) =>
recommendSort: 0, // 默认传 0
isRecommend: val,
})
ElMessage.success('修改成功')
push.success('修改成功')
refresh()
}
......@@ -62,7 +62,7 @@ const handleEditSort = async (row: ArticleItemDto) => {
recommendSort: Number(value),
isRecommend: BooleanFlag.YES,
})
ElMessage.success('修改成功')
push.success('修改成功')
refresh()
}
......@@ -79,7 +79,7 @@ const handleSubmit = async () => {
await addOrUpdateColumn(form.value)
}
ElMessage.success(form.value.id ? '编辑成功' : '新增成功')
push.success(form.value.id ? '编辑成功' : '新增成功')
dialogVisible.value = false
if (form.value.id) {
search()
......
......@@ -8,7 +8,7 @@ import type { BackendColumnListItemDto, AddOrUpdateColumnDto } from '@/api/backe
import dayjs from 'dayjs'
import { ArticleTypeEnum, BooleanFlag } from '@/constants'
import type { ArticleItemDto } from '@/api/article/types'
import { push } from 'notivue'
const { loading, list, total, reset, goToPage, changePageSize, refresh, searchParams, search } =
usePageSearch(getArticleList, {
defaultParams: {
......@@ -44,7 +44,7 @@ const handleIsRecommendChange = async (val: BooleanFlag, row: ArticleItemDto) =>
recommendSort: 0, // 默认传 0
isRecommend: val,
})
ElMessage.success('修改成功')
push.success('修改成功')
refresh()
}
......@@ -62,7 +62,7 @@ const handleEditSort = async (row: ArticleItemDto) => {
recommendSort: Number(value),
isRecommend: BooleanFlag.YES,
})
ElMessage.success('修改成功')
push.success('修改成功')
refresh()
}
......@@ -79,7 +79,7 @@ const handleSubmit = async () => {
await addOrUpdateColumn(form.value)
}
ElMessage.success(form.value.id ? '编辑成功' : '新增成功')
push.success(form.value.id ? '编辑成功' : '新增成功')
dialogVisible.value = false
if (form.value.id) {
search()
......
......@@ -174,7 +174,7 @@ import type {
import dayjs from 'dayjs'
import ExportExcelBtn from '@/components/common/ExportExcelBtn/index.vue'
import type { ExportColumn } from '@/utils'
import { push } from 'notivue'
const { loading, list, total, reset, goToPage, changePageSize, refresh, searchParams, search } =
usePageSearch(getBackendExchangeList, {
defaultParams: {},
......@@ -273,7 +273,7 @@ const handleCancelIssue = async (row: BackendColumnListItemDto) => {
id: row.id,
status: 0,
})
ElMessage.success('取消发放成功')
push.success('取消发放成功')
refresh()
}
......@@ -289,7 +289,7 @@ const handleIssue = async (row: BackendColumnListItemDto) => {
memo: memo.value,
status: 1,
})
ElMessage.success('发放成功')
push.success('发放成功')
refresh()
}
......@@ -306,7 +306,7 @@ const handleSubmit = async () => {
await addOrUpdateColumn(form.value)
}
ElMessage.success(form.value.id ? '编辑成功' : '新增成功')
push.success(form.value.id ? '编辑成功' : '新增成功')
dialogVisible.value = false
if (form.value.id) {
search()
......
......@@ -225,7 +225,7 @@ import { auctionStatusListOptions } from '@/constants'
import UploadFile from '@/components/common/UploadFile/index.vue'
import AuctionRecordDialog from './components/auctionRecordDialog.vue'
import dayjs from 'dayjs'
import { push } from 'notivue'
const { loading, list, total, reset, goToPage, changePageSize, refresh, searchParams, search } =
usePageSearch(getBackendAuctionList)
......@@ -310,11 +310,11 @@ const handleDelete = async (row: BackendAuctionListItemDto) => {
await deleteAuction([row.id])
refresh()
ElMessage.success('删除成功')
push.success('删除成功')
refresh()
} catch (error) {
if (error !== 'cancel') {
ElMessage.error('删除失败')
push.error('删除失败')
}
}
}
......@@ -333,7 +333,7 @@ const handleSubmit = async () => {
await addOrUpdateAuctionItem(form.value)
}
ElMessage.success(form.value.id ? '编辑成功' : '新增成功')
push.success(form.value.id ? '编辑成功' : '新增成功')
dialogVisible.value = false
if (form.value.id) {
search()
......@@ -366,7 +366,7 @@ const handleBatchShow = async () => {
idList: selectedRows.value.map((item) => item.id),
isDisplay: show.value,
})
ElMessage.success('批量修改展示竞拍成功')
push.success('批量修改展示竞拍成功')
refresh()
done()
} catch (error) {
......@@ -390,7 +390,7 @@ const handleBatchDelete = async () => {
await deleteAuction(selectedRows.value.map((item) => item.id))
refresh()
ElMessage.success('删除成功')
push.success('删除成功')
}
const selectedRows = ref<BackendAuctionListItemDto[]>([])
......
......@@ -129,6 +129,7 @@ import type { BackendAuctionListItemDto, BackendAddOrUpdateLotteryPrizeDto } fro
import UploadFile from '@/components/common/UploadFile/index.vue'
import dayjs from 'dayjs'
import LotteryConfig from './components/lotteryConfigDialog.vue'
import { push } from 'notivue'
const { loading, list, total, reset, goToPage, changePageSize, refresh, searchParams, search } =
usePageSearch(getLotteryPrizeList)
......@@ -180,11 +181,11 @@ const handleDelete = async (row: BackendAuctionListItemDto) => {
await deleteLotteryPrize([row.id])
refresh()
ElMessage.success('删除成功')
push.success('删除成功')
refresh()
} catch (error) {
if (error !== 'cancel') {
ElMessage.error('删除失败')
push.error('删除失败')
}
}
}
......@@ -203,7 +204,7 @@ const handleSubmit = async () => {
await addOrUpdateLotteryPrize(form.value)
}
ElMessage.success(form.value.id ? '编辑成功' : '新增成功')
push.success(form.value.id ? '编辑成功' : '新增成功')
dialogVisible.value = false
if (form.value.id) {
search()
......
......@@ -194,6 +194,7 @@ import dayjs from 'dayjs'
import { BooleanFlag, ShopGoodsTypeEnum, regionListOptions } from '@/constants'
import UploadFile from '@/components/common/UploadFile/index.vue'
import type { BackendShopItemDto } from '@/api/backend'
import { push } from 'notivue'
console.log('goodsManage', UploadFile)
const { loading, list, total, reset, goToPage, changePageSize, refresh, searchParams, search } =
usePageSearch(getShopItemList)
......@@ -251,11 +252,11 @@ const handleDelete = async (row: BackendColumnListItemDto) => {
await deleteShopItem(row.id)
refresh()
ElMessage.success('删除成功')
push.success('删除成功')
refresh()
} catch (error) {
if (error !== 'cancel') {
ElMessage.error('删除失败')
push.error('删除失败')
}
}
}
......@@ -273,7 +274,7 @@ const handleSubmit = async () => {
await addOrUpdateShopItem(form.value)
}
ElMessage.success(form.value.id ? '编辑成功' : '新增成功')
push.success(form.value.id ? '编辑成功' : '新增成功')
dialogVisible.value = false
if (form.value.id) {
search()
......@@ -297,7 +298,7 @@ const handleEnableChange = async (row: BackendColumnListItemDto) => {
id: row.id,
enable: row.enable === BooleanFlag.YES ? BooleanFlag.NO : BooleanFlag.YES,
})
ElMessage.success('修改成功')
push.success('修改成功')
refresh()
}
</script>
......
......@@ -126,7 +126,7 @@ import { getTagList, addOrUpdateTag, deleteTag } from '@/api/backend'
import type { FormInstance, FormRules } from 'element-plus'
import type { BackendTagListItemDto, AddOrUpdateTagDto } from '@/api/backend'
import { push } from 'notivue'
const { loading, list, total, reset, goToPage, changePageSize, refresh, searchParams, search } =
usePageSearch(getTagList)
......@@ -182,11 +182,11 @@ const handleDelete = async (row: BackendTagListItemDto) => {
await deleteTag(row.id)
ElMessage.success('删除成功')
push.success('删除成功')
refresh()
} catch (error) {
if (error !== 'cancel') {
ElMessage.error('删除失败')
push.error('删除失败')
}
}
}
......@@ -204,7 +204,7 @@ const handleSubmit = async () => {
await addOrUpdateTag(form.value)
}
ElMessage.success(form.value.id ? '编辑成功' : '新增成功')
push.success(form.value.id ? '编辑成功' : '新增成功')
dialogVisible.value = false
if (form.value.id) {
search()
......
......@@ -210,7 +210,7 @@ import { useQuestionStore } from '@/stores/question'
import ActionMore from '@/components/common/ActionMore/index.vue'
import CommentDialog from '@/components/common/CommentDialog/index.vue'
import { parseEmoji } from '@/utils/emoji'
import { push } from 'notivue'
const { fetchUserQestionNum } = useQuestionStore()
const route = useRoute()
......@@ -249,7 +249,7 @@ const handleCollect = async (item: ArticleItemDto) => {
await addOrCanceArticlelCollect(item.id)
item.hasCollect = !item.hasCollect
item.collectionCount = item.hasCollect ? item.collectionCount + 1 : item.collectionCount - 1
ElMessage.success(item.hasCollect ? '收藏成功' : '取消收藏')
push.success(item.hasCollect ? '收藏成功' : '取消收藏')
refresh()
}
......@@ -282,7 +282,7 @@ const handleAddQuestion = async (item: ArticleItemDto) => {
await addOrCancelToAnswerList({ articleId: item.id })
item.hasAddQuestion = !item.hasAddQuestion
fetchUserQestionNum()
ElMessage.success(item.hasAddQuestion ? '添加成功' : '取消添加')
push.success(item.hasAddQuestion ? '添加成功' : '取消添加')
}
const handleRefresh = () => {
......
......@@ -96,18 +96,23 @@
</div>
</div>
<div class="flex flex-col sm:flex-row gap-2">
<div ref="dailySignBtnRef">
<div ref="dailySignBtnRef" class="relative">
<el-button
class="bg-[linear-gradient(to_right,#FFD06A_0%,#FFB143_100%)] shadow-[0px_1px_8px_0_rgba(255,173,91,0.25)] border-none hover:-translate-y-1 hover:shadow-[0px_4px_10px_0_rgba(255,173,91,0.4)] hover:scale-105 active:scale-95 active:translate-y-0 transition-all duration-200 flex-1 text-xs sm:text-sm"
type="primary"
@click="onDailySign"
v-if="!userRecordData.isSign"
>
<!-- v-if="!userRecordData.isSign" -->
<svg-icon name="sign_in" size="24" class="mr-2 mb-1" />
<span class="text-#333 text-xs sm:text-sm">立即签到</span>
</el-button>
<!-- 双倍亚币角标 -->
<div
v-if="activityStore.isDoubleYabi && !userRecordData.isSign"
class="absolute -top-2.5 -right-2 px-1.5 py-0.5 rounded-full bg-gradient-to-r from-red-500 to-pink-500 text-white text-[10px] font-bold leading-none shadow-sm animate-bounce whitespace-nowrap z-1"
>
双倍亚币
</div>
</div>
<el-button
class="bg-[linear-gradient(to_right,#ABB0FF_0%,#7495FF_100%)] shadow-[0_1px_8px_0_rgba(0,36,237,0.25)] border-none hover:-translate-y-1 transition-all duration-200 flex-1 text-xs sm:text-sm w-116px"
......@@ -364,7 +369,9 @@ import type {
import { TABS_REF_KEY, levelListOptions } from '@/constants'
import { useScrollTop } from '@/hooks'
import { useQuestionStore } from '@/stores/question'
import { useActivityStore } from '@/stores/activity'
import { storeToRefs } from 'pinia'
import { push } from 'notivue'
// import LuckyWheel from '@/components/common/LuckyWheel/index.vue'
const route = useRoute()
......@@ -377,6 +384,7 @@ const { handleBackTop } = useScrollTop(levelContainerRef)
const questionStore = useQuestionStore()
const { userQestionNum } = storeToRefs(questionStore)
const activityStore = useActivityStore()
const getThirdLevelKey = (route: RouteLocationNormalizedLoadedGeneric) => {
// console.log(route.fullPath, '三级路由首页')
......@@ -468,7 +476,7 @@ const onDailySign = async () => {
await dailySign()
refreshTaskData(true)
refreshUserAccountData()
ElMessage.success('签到成功')
push.success(activityStore.isDoubleYabi ? '签到成功!活动期间双倍亚币已到账 🎉' : '签到成功')
open.value = false
}
......@@ -482,11 +490,11 @@ const getLotteryPrizesDetail = async () => {
// 参与抽奖
const handleLottery = async () => {
if (!lotteryPrizesDetail.value?.inRegistrationTime)
return ElMessage.error(`抽奖通道将于${lotteryPrizesDetail.value?.registrationTimeDesc}开启`)
return push.error(`抽奖通道将于${lotteryPrizesDetail.value?.registrationTimeDesc}开启`)
await userJoinLottery()
getLotteryPrizesDetail()
refreshUserAccountData()
ElMessage.success('参与每日抽奖成功!')
push.success('参与每日抽奖成功!')
}
const handleTask = async (item: TaskItemDto) => {
......@@ -499,7 +507,7 @@ const handleTask = async (item: TaskItemDto) => {
open.value = true
} else if (item.svgName === 'valid_comments') {
// 发布评论
ElMessage.info('快去文章评论区去发表评论吧~')
push.info('快去文章评论区去发表评论吧~')
} else if (item.svgName === 'topic_publish') {
if (route.path.includes('/homePage/askTab')) {
// 同一个页面 需要加事件触发 watch
......
......@@ -243,7 +243,7 @@ import ExchangeYabiRecordDialog from './components/exchangeYabiRecordDilaog.vue'
import { useYaBiStore } from '@/stores'
import { storeToRefs } from 'pinia'
import BackButton from '@/components/common/BackButton/index.vue'
import { push } from 'notivue'
const yabiStore = useYaBiStore()
const { yabiData } = storeToRefs(yabiStore)
......@@ -321,13 +321,13 @@ const onExchangeGoods = async (item: BackendShopItemDto) => {
beforeClose: async (action, instance, done) => {
if (action === 'cancel') return done()
if (yabiData.value.currentValue < item.price * form.value.num)
return ElMessage.error(
return push.error(
`您的YA币不足,兑换所需${item.price * form.value.num}YA币,当前YA币${yabiData.value.currentValue}`,
)
try {
instance.confirmButtonLoading = true
await exchangeGoods(form.value)
ElMessage.success('兑换成功')
push.success('兑换成功')
yabiStore.fetchYaBiData()
item.stock -= form.value.num
done()
......
......@@ -131,7 +131,7 @@ import { useUserStore } from '@/stores'
import { storeToRefs } from 'pinia'
import type { ISelectDept } from '@/utils/wxUtil'
import BackButton from '@/components/common/BackButton/index.vue'
import { push } from 'notivue'
const router = useRouter()
const userStore = useUserStore()
const { userInfo } = storeToRefs(userStore)
......@@ -163,7 +163,7 @@ const selcetDept = async () => {
selectedDepartmentIds: form.value.departmentList.map((i) => i.id),
})
if (departmentList.length > 3) {
return ElMessage.warning('最多只能选择3个部门,请重新选择')
return push.warning('最多只能选择3个部门,请重新选择')
}
console.log('选中的部门等等', departmentList)
form.value.departmentList = departmentList
......@@ -248,7 +248,7 @@ const handleSubmit = async (releaseStatus: ReleaseStatusTypeEnum) => {
loading.value = true
try {
await addOrUpdateCase({ ...transformData(releaseStatus) })
ElMessage.success('提交成功')
push.success('提交成功')
resetForm()
router.back()
} catch (error) {
......
......@@ -267,7 +267,7 @@ import { useRouter, useRoute } from 'vue-router'
import { useUserStore } from '@/stores/user'
import { selectDepOrUser } from '@/utils'
import type { FormItemRule } from 'element-plus'
import { push } from 'notivue'
const columnStore = useColumnStore()
const { columnList } = storeToRefs(columnStore)
const interviewStore = useInterviewStore()
......@@ -450,7 +450,7 @@ const handleSubmit = async (releaseStatus: ReleaseStatusTypeEnum) => {
: await addOrUpdateArticle(transFormData(releaseStatus))
console.log(res)
drawerVisible.value = false
ElMessage.success(releaseStatus === ReleaseStatusTypeEnum.PUBLISH ? '发布成功' : '存草稿成功')
push.success(releaseStatus === ReleaseStatusTypeEnum.PUBLISH ? '发布成功' : '存草稿成功')
resetForm()
router.back()
// 发布成功后的逻辑...
......
......@@ -354,7 +354,7 @@ import { useVideoStore, useUserStore } from '@/stores'
import { storeToRefs } from 'pinia'
import { selectDepOrUser } from '@/utils'
import BackButton from '@/components/common/BackButton/index.vue'
import { push } from 'notivue'
const videoStore = useVideoStore()
const { videoList } = storeToRefs(videoStore)
......@@ -429,7 +429,7 @@ const videoDuration = ref(0)
const currentTime = ref(0)
const handleOpenCoverDialog = () => {
if (!locationVideoBlolUrl.value) return ElMessage.warning('请先上传视频')
if (!locationVideoBlolUrl.value) return push.warning('请先上传视频')
showCoverDialog.value = true
}
// 视频加载完成
......@@ -478,7 +478,7 @@ const captureFrame = () => {
const { promise } = uploadFile(new File([blob], `video${Date.now()}.jpg`))
const data = await promise
form.value.faceUrl = data.filePath
ElMessage.success('封面截取成功')
push.success('封面截取成功')
}
},
'image/jpeg',
......@@ -492,7 +492,7 @@ const confirmCover = async () => {
if (!form.value.faceUrl) return
showCoverDialog.value = false
ElMessage.success('封面设置成功')
push.success('封面设置成功')
}
// 格式化时间
......@@ -557,7 +557,7 @@ const handleSubmit = async (releaseStatus: ReleaseStatusTypeEnum) => {
loading.value = true
try {
addOrUpdateArticle(tansformData(releaseStatus))
ElMessage.success(releaseStatus === ReleaseStatusTypeEnum.PUBLISH ? '发布成功' : '存草稿成功')
push.success(releaseStatus === ReleaseStatusTypeEnum.PUBLISH ? '发布成功' : '存草稿成功')
resetPageData()
router.push('/')
// 重置数据
......
......@@ -400,7 +400,7 @@ import { storeToRefs } from 'pinia'
import { useNavigation } from '@/hooks'
import { parseEmoji } from '@/utils/emoji'
import { ArticleTypeEnum } from '@/constants'
import { push } from 'notivue'
const userStore = useUserStore()
const { userInfo } = storeToRefs(userStore)
const { jumpToUserHomePage } = useNavigation()
......@@ -464,7 +464,7 @@ const handleLikeArticle = async () => {
questionDetail.value.praiseCount = questionDetail.value.hasPraised
? questionDetail.value.praiseCount + 1
: questionDetail.value.praiseCount - 1
ElMessage.success(`${questionDetail.value.hasPraised ? '点赞该问题' : '取消点赞该问题'}`)
push.success(`${questionDetail.value.hasPraised ? '点赞该问题' : '取消点赞该问题'}`)
}
const handleCollectArticle = async () => {
......@@ -473,14 +473,14 @@ const handleCollectArticle = async () => {
questionDetail.value.collectionCount = questionDetail.value.hasCollect
? questionDetail.value.collectionCount + 1
: questionDetail.value.collectionCount - 1
ElMessage.success(`${questionDetail.value.hasCollect ? '收藏成功' : '取消收藏成功'}`)
push.success(`${questionDetail.value.hasCollect ? '收藏成功' : '取消收藏成功'}`)
}
const handleLikeAnswer = async (answer: any) => {
await addOrCancelCommentLike(answer.id)
answer.hasPraise = !answer.hasPraise
answer.postPriseCount = answer.hasPraise ? answer.postPriseCount + 1 : answer.postPriseCount - 1
ElMessage.success(`${answer.hasPraise ? '点赞该回答' : '取消点赞该回答'}`)
push.success(`${answer.hasPraise ? '点赞该回答' : '取消点赞该回答'}`)
}
const handleComment = (answer: any, index: number) => {
......
......@@ -127,7 +127,7 @@ import { AuditStatusEnum } from '@/constants'
import type { AuditComplaintDto } from '@/api'
import type { TabPaneName } from 'element-plus'
import { useNavigation } from '@/hooks'
import { push } from 'notivue'
const toggleTab = (key: TabPaneName) => {
searchParams.value.status = key as AuditStatusEnum
refresh()
......@@ -156,7 +156,7 @@ const handleAudit = async (data: AuditComplaintDto) => {
}
await auditComplaint(data)
ElMessage.success('审核成功')
push.success('审核成功')
refresh()
}
......
......@@ -48,7 +48,7 @@ import UploadFile from '@/components/common/UploadFile/index.vue'
import { updateUserInfo } from '@/api'
import type { UpdateUserInfoDto } from '@/api'
import { useResetData } from '@/hooks'
import { push } from 'notivue'
const dialogVisible = ref(false)
const loading = ref(false)
const formRef = useTemplateRef<FormInstance>('formRef')
......@@ -99,7 +99,7 @@ const handleConfirm = async () => {
await updateUserInfo(form.value)
close()
ElMessage.success('保存成功')
push.success('保存成功')
} catch (error) {
console.error('表单验证失败:', error)
} finally {
......
......@@ -137,8 +137,9 @@ import { auditTypeListOptions, articleTypeListOptions } from '@/constants/option
import { AuditStatusEnum } from '@/constants'
import type { AuditArticleDto } from '@/api'
import type { TabPaneName } from 'element-plus'
import dayjs from 'dayjs'
import { push } from 'notivue'
const router = useRouter()
const { jumpToArticleDetailPage } = useNavigation()
const toggleTab = (key: TabPaneName) => {
......@@ -187,7 +188,7 @@ const handleAudit = async (data: AuditArticleDto) => {
}
await auditArticle(data)
ElMessage.success('审核成功')
push.success('审核成功')
refresh()
}
......
......@@ -116,6 +116,7 @@ import dayjs from 'dayjs'
import { ReleaseStatusTypeEnum, AuditStatusEnum, UsageStatusEnum } from '@/constants'
import type { TabPaneName } from 'element-plus'
import type { SelfCaseItemDto } from '@/api/user/types'
import { push } from 'notivue'
const router = useRouter()
const caseTypeListOptions = [
......@@ -251,7 +252,7 @@ const handleView = async (item: SelfCaseItemDto) => {
const handleEdit = async (item: SelfCaseItemDto) => {
if (item.isAudit === AuditStatusEnum.AGREED && item.isUse === UsageStatusEnum.USED)
return ElMessage.warning('案例已使用,无法编辑')
return push.warning('案例已使用,无法编辑')
router.push(`/publishCase?id=${item.id}`)
}
......@@ -263,7 +264,7 @@ const handleDelete = async (item: SelfCaseItemDto) => {
type: 'warning',
})
await deleteCase(item.id)
ElMessage.success('删除成功')
push.success('删除成功')
refresh()
}
......
......@@ -106,7 +106,7 @@ import { CommentTypeEnum, ArticleTypeEnum } from '@/constants/enums'
import type { TabPaneName } from 'element-plus'
import { IS_REAL_KEY } from '@/constants/symbolKey'
import { useNavigation } from '@/hooks'
import { push } from 'notivue'
const route = useRoute()
const isReal = inject(IS_REAL_KEY)
......@@ -140,7 +140,7 @@ const handleDelete = async (id: number) => {
type: 'warning',
})
await deleteComment(id)
ElMessage.success('删除成功')
push.success('删除成功')
refresh()
}
......
......@@ -88,7 +88,7 @@ import dayjs from 'dayjs'
import { ArticleTypeEnum } from '@/constants/enums'
import type { TabPaneName } from 'element-plus'
import { IS_REAL_KEY } from '@/constants/symbolKey'
import { push } from 'notivue'
const router = useRouter()
const isReal = inject(IS_REAL_KEY)
......@@ -118,7 +118,7 @@ const { list, loading, searchParams, total, refresh, goToPage, changePageSize }
const handleEdit = (item: any) => {
if (item.type === ArticleTypeEnum.VIDEO) {
// router.push(`/publishVideo/${item.id}`)
ElMessage.warning('视频编辑功能暂未开放')
push.warning('视频编辑功能暂未开放')
} else {
router.push(`/publishLongArticle/${item.type}?id=${item.id}`)
}
......@@ -132,7 +132,7 @@ const handleDelete = async (item: any) => {
})
await deleteArticle(item.id)
refresh()
ElMessage.success('删除成功')
push.success('删除成功')
}
onActivated(() => {
......
......@@ -95,7 +95,7 @@ import { ArticleTypeEnum } from '@/constants/enums'
import type { TabPaneName } from 'element-plus'
import { IS_REAL_KEY } from '@/constants/symbolKey'
import { useNavigation } from '@/hooks'
import { push } from 'notivue'
const router = useRouter()
const isReal = inject(IS_REAL_KEY)
......@@ -134,7 +134,7 @@ const handleDelete = async (articleId: number) => {
})
await deleteArticle(articleId)
refresh()
ElMessage.success('删除成功')
push.success('删除成功')
}
const jumpToEditPage = (item: { type: ArticleTypeEnum; id: number }) => {
......
......@@ -90,7 +90,7 @@ import type { TabPaneName } from 'element-plus'
import { TaskDateLimitTypeText } from '@/constants'
import type { TaskItemDto } from '@/api'
import { useRouter } from 'vue-router'
import { push } from 'notivue'
const router = useRouter()
const toggleTab = (key: TabPaneName) => {
searchParams.value.taskType = key as TaskTypeEnum
......@@ -112,7 +112,7 @@ const handleTask = async (item: TaskItemDto) => {
router.push(`/homePage/homeTab#levelContainerRef`)
} else if (item.svgName === 'valid_comments') {
// 发布评论
ElMessage.info('快去文章评论区去发表评论吧~')
push.info('快去文章评论区去发表评论吧~')
} else if (item.svgName === 'topic_publish') {
router.push(`/homePage/askTab#tabsRef`)
} else if (item.svgName === 'answer_ask') {
......
......@@ -167,6 +167,7 @@ import type { TabPaneName } from 'element-plus'
import { IS_REAL_KEY } from '@/constants/symbolKey'
import { useOnlineTimeStore, useUserStore } from '@/stores'
import BackButton from '@/components/common/BackButton/index.vue'
import { push } from 'notivue'
const { showOnlineTime } = storeToRefs(useOnlineTimeStore())
const router = useRouter()
......@@ -361,7 +362,7 @@ const handleSwitchAccount = async () => {
customClass: 'min-w-740px',
beforeClose: async (action, instance, done) => {
if (action === 'confirm') {
if (!selectedEmail.value) return ElMessage.warning('请选择要切换的账号')
if (!selectedEmail.value) return push.warning('请选择要切换的账号')
instance.confirmButtonLoading = true
try {
const { data } = await generateLoginKey({
......
......@@ -64,7 +64,7 @@
import { addOrCancelArticleReward } from '@/api'
import { useYaBiStore } from '@/stores'
import { storeToRefs } from 'pinia'
import { push } from 'notivue'
const yabiStore = useYaBiStore()
const { yabiData } = storeToRefs(yabiStore)
......@@ -103,7 +103,7 @@ const selectAmount = (amount: number) => {
// 确认打赏
const handleConfirm = async () => {
if (yabiData.value.currentValue < selectedAmount.value) {
ElMessage.warning('余额不足,请先充值')
push.warning('余额不足,请先充值')
return
}
......@@ -111,7 +111,7 @@ const handleConfirm = async () => {
articleId: articleId,
ayabi: selectedAmount.value,
})
ElMessage.success('打赏成功!')
push.success('打赏成功!')
dialogVisible.value = false
rewardNum.value += selectedAmount.value
yabiStore.fetchYaBiData()
......
......@@ -325,7 +325,7 @@ import ActionMore from '@/components/common/ActionMore/index.vue'
import BackButton from '@/components/common/BackButton/index.vue'
import { useNavigation } from '@/hooks'
import { ArticleTypeEnum } from '@/constants'
import { push } from 'notivue'
const route = useRoute()
const videoId = Number(route.params.id)
const { jumpToUserHomePage } = useNavigation()
......@@ -360,7 +360,7 @@ const handleLike = async (item: ArticleItemDto) => {
await addOrCanceArticlelLike(item.id)
item.hasPraised = !item.hasPraised
item.praiseCount = item.hasPraised ? item.praiseCount + 1 : item.praiseCount - 1
ElMessage.success(item.hasPraised ? '点赞成功' : '取消点赞')
push.success(item.hasPraised ? '点赞成功' : '取消点赞')
}
// 收藏
......@@ -368,7 +368,7 @@ const handleCollect = async (item: ArticleItemDto) => {
await addOrCanceArticlelCollect(item.id)
item.hasCollect = !item.hasCollect
item.collectionCount = item.hasCollect ? item.collectionCount + 1 : item.collectionCount - 1
ElMessage.success(item.hasCollect ? '收藏成功' : '取消收藏')
push.success(item.hasCollect ? '收藏成功' : '取消收藏')
}
// 打赏
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment