Commit 14c314af by lijiabin

【需求 20331】 perf: 优化mesagebox组件

parent 95f8be7a
...@@ -29,6 +29,7 @@ import { uploadFile as uploadFileApi } from '@/api' ...@@ -29,6 +29,7 @@ import { uploadFile as uploadFileApi } from '@/api'
import type { UploadProps, UploadUserFile } from 'element-plus' import type { UploadProps, UploadUserFile } from 'element-plus'
import type { UploadFileProps } from './types' import type { UploadFileProps } from './types'
import { push } from 'notivue' import { push } from 'notivue'
import { useMessageBox } from '@/hooks'
const props = withDefaults(defineProps<UploadFileProps>(), { const props = withDefaults(defineProps<UploadFileProps>(), {
limit: 2, limit: 2,
...@@ -38,6 +39,7 @@ const props = withDefaults(defineProps<UploadFileProps>(), { ...@@ -38,6 +39,7 @@ const props = withDefaults(defineProps<UploadFileProps>(), {
const modelValue = defineModel<T>({ const modelValue = defineModel<T>({
required: true, required: true,
}) })
const { confirm } = useMessageBox()
const fileList = ref<UploadUserFile[]>([]) const fileList = ref<UploadUserFile[]>([])
const uploadRef = useTemplateRef('uploadRef') const uploadRef = useTemplateRef('uploadRef')
...@@ -171,10 +173,11 @@ const handleChange: UploadProps['onChange'] = async (uploadFile, uploadFiles) => ...@@ -171,10 +173,11 @@ const handleChange: UploadProps['onChange'] = async (uploadFile, uploadFiles) =>
} }
const handleBeforeRemove: UploadProps['beforeRemove'] = () => { const handleBeforeRemove: UploadProps['beforeRemove'] = () => {
return ElMessageBox.confirm('确定要删除这个文件吗?', '提示', { return confirm({
confirmButtonText: '确定', title: '确定要删除这个文件吗?',
cancelButtonText: '取消', confirmText: '确定',
type: 'warning', cancelText: '取消',
type: 'danger',
}) })
.then(() => true) .then(() => true)
.catch(() => false) .catch(() => false)
......
...@@ -191,8 +191,11 @@ import { ArticleTypeEnum, articleTypeListOptions } from '@/constants' ...@@ -191,8 +191,11 @@ import { ArticleTypeEnum, articleTypeListOptions } from '@/constants'
import { usePageSearch, useNavigation } from '@/hooks' import { usePageSearch, useNavigation } from '@/hooks'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import { push } from 'notivue' import { push } from 'notivue'
import { useMessageBox } from '@/hooks'
const router = useRouter() const router = useRouter()
const { jumpToArticleDetailPage } = useNavigation() const { jumpToArticleDetailPage } = useNavigation()
const { confirm } = useMessageBox()
// 列表数据 // 列表数据
const loading = ref(false) const loading = ref(false)
const list = ref<BackendCarouselListItemDto[]>([]) const list = ref<BackendCarouselListItemDto[]>([])
...@@ -254,13 +257,15 @@ const handleEdit = (row: BackendCarouselListItemDto) => { ...@@ -254,13 +257,15 @@ const handleEdit = (row: BackendCarouselListItemDto) => {
// 删除 // 删除
const handleDelete = async (row: BackendCarouselListItemDto) => { const handleDelete = async (row: BackendCarouselListItemDto) => {
try { await confirm({
await ElMessageBox.confirm('确定要删除该轮播吗?', '提示', { title: '提示',
confirmButtonText: '确定', message: '确定要删除该轮播吗?',
cancelButtonText: '取消', confirmText: '确定',
type: 'warning', cancelText: '取消',
}) type: 'danger',
})
try {
await editCarousel({ await editCarousel({
...row, ...row,
id: row.id, id: row.id,
......
...@@ -296,6 +296,9 @@ import dayjs from 'dayjs' ...@@ -296,6 +296,9 @@ import dayjs from 'dayjs'
import ErrorListDialog from './components/errorListDialog.vue' import ErrorListDialog from './components/errorListDialog.vue'
import EditDialog from './components/editDialog.vue' import EditDialog from './components/editDialog.vue'
import { push } from 'notivue' import { push } from 'notivue'
import { useMessageBox } from '@/hooks'
const { confirm } = useMessageBox()
const { loading, list, total, reset, goToPage, changePageSize, refresh, searchParams } = const { loading, list, total, reset, goToPage, changePageSize, refresh, searchParams } =
usePageSearch(getCaseList, { usePageSearch(getCaseList, {
defaultParams: {}, defaultParams: {},
...@@ -309,9 +312,11 @@ const handleEdit = async (row: BackendCaseListItemDto) => { ...@@ -309,9 +312,11 @@ const handleEdit = async (row: BackendCaseListItemDto) => {
if (row.isUse === UsageStatusEnum.USED) return push.warning('已使用的状态 不允许编辑') if (row.isUse === UsageStatusEnum.USED) return push.warning('已使用的状态 不允许编辑')
// 审核通过再编辑 // 审核通过再编辑
if (row.isAudit === AuditStatusEnum.AGREED) { if (row.isAudit === AuditStatusEnum.AGREED) {
await ElMessageBox.confirm('案例库已审核通过,修改后需重新审核,点击确定继续编辑', '提示', { await confirm({
confirmButtonText: '确定', title: '提示',
cancelButtonText: '取消', message: '案例库已审核通过,修改后需重新审核,点击确定继续编辑',
confirmText: '确定',
cancelText: '取消',
type: 'warning', type: 'warning',
}) })
} }
......
...@@ -132,6 +132,9 @@ import type { FormInstance, FormRules } from 'element-plus' ...@@ -132,6 +132,9 @@ import type { FormInstance, FormRules } from 'element-plus'
import type { BackendColumnListItemDto, AddOrUpdateColumnDto } from '@/api/backend' import type { BackendColumnListItemDto, AddOrUpdateColumnDto } from '@/api/backend'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import { push } from 'notivue' import { push } from 'notivue'
import { useMessageBox } from '@/hooks'
const { confirm } = useMessageBox()
const { loading, list, total, reset, goToPage, changePageSize, refresh, searchParams, search } = const { loading, list, total, reset, goToPage, changePageSize, refresh, searchParams, search } =
usePageSearch(listOfCultureColumn, { usePageSearch(listOfCultureColumn, {
defaultParams: { defaultParams: {
...@@ -187,13 +190,13 @@ const handleStatusChange = async (row: BackendColumnListItemDto) => { ...@@ -187,13 +190,13 @@ const handleStatusChange = async (row: BackendColumnListItemDto) => {
// 删除 // 删除
const handleDelete = async (row: BackendColumnListItemDto) => { const handleDelete = async (row: BackendColumnListItemDto) => {
try { await confirm({
await ElMessageBox.confirm(`确定要删除标签"${row.title}"吗?`, '提示', { title: '提示',
confirmButtonText: '确定', message: `确定要删除专栏"${row.title}"吗?`,
cancelButtonText: '取消', type: 'danger',
type: 'warning', })
})
try {
await deleteColumn([row.id]) await deleteColumn([row.id])
push.success('删除成功') push.success('删除成功')
......
...@@ -138,6 +138,9 @@ import type { FormInstance, FormRules } from 'element-plus' ...@@ -138,6 +138,9 @@ import type { FormInstance, FormRules } from 'element-plus'
import type { BackendColumnListItemDto, AddOrUpdateColumnDto } from '@/api/backend' import type { BackendColumnListItemDto, AddOrUpdateColumnDto } from '@/api/backend'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import { push } from 'notivue' import { push } from 'notivue'
import { useMessageBox } from '@/hooks'
const { confirm } = useMessageBox()
const { loading, list, total, reset, goToPage, changePageSize, refresh, searchParams, search } = const { loading, list, total, reset, goToPage, changePageSize, refresh, searchParams, search } =
usePageSearch(listOfCultureColumn, { usePageSearch(listOfCultureColumn, {
defaultParams: { defaultParams: {
...@@ -193,13 +196,12 @@ const handleStatusChange = async (row: BackendColumnListItemDto) => { ...@@ -193,13 +196,12 @@ const handleStatusChange = async (row: BackendColumnListItemDto) => {
// 删除 // 删除
const handleDelete = async (row: BackendColumnListItemDto) => { const handleDelete = async (row: BackendColumnListItemDto) => {
await confirm({
title: '提示',
message: `确定要删除专访"${row.title}"吗?`,
type: 'danger',
})
try { try {
await ElMessageBox.confirm(`确定要删除标签"${row.title}"吗?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
await deleteColumn([row.id]) await deleteColumn([row.id])
push.success('删除成功') push.success('删除成功')
......
...@@ -131,6 +131,9 @@ import type { FormInstance, FormRules } from 'element-plus' ...@@ -131,6 +131,9 @@ import type { FormInstance, FormRules } from 'element-plus'
import type { BackendColumnListItemDto, AddOrUpdateColumnDto } from '@/api/backend' import type { BackendColumnListItemDto, AddOrUpdateColumnDto } from '@/api/backend'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import { push } from 'notivue' import { push } from 'notivue'
import { useMessageBox } from '@/hooks'
const { confirm } = useMessageBox()
const { loading, list, total, reset, goToPage, changePageSize, refresh, searchParams, search } = const { loading, list, total, reset, goToPage, changePageSize, refresh, searchParams, search } =
usePageSearch(listOfCultureColumn, { usePageSearch(listOfCultureColumn, {
defaultParams: { defaultParams: {
...@@ -187,10 +190,10 @@ const handleStatusChange = async (row: BackendColumnListItemDto) => { ...@@ -187,10 +190,10 @@ const handleStatusChange = async (row: BackendColumnListItemDto) => {
// 删除 // 删除
const handleDelete = async (row: BackendColumnListItemDto) => { const handleDelete = async (row: BackendColumnListItemDto) => {
try { try {
await ElMessageBox.confirm(`确定要删除标签"${row.title}"吗?`, '提示', { await confirm({
confirmButtonText: '确定', title: '提示',
cancelButtonText: '取消', message: `确定要删除视频"${row.title}"吗?`,
type: 'warning', type: 'danger',
}) })
await deleteColumn([row.id]) await deleteColumn([row.id])
......
...@@ -175,6 +175,9 @@ import dayjs from 'dayjs' ...@@ -175,6 +175,9 @@ import dayjs from 'dayjs'
import ExportExcelBtn from '@/components/common/ExportExcelBtn/index.vue' import ExportExcelBtn from '@/components/common/ExportExcelBtn/index.vue'
import type { ExportColumn } from '@/utils' import type { ExportColumn } from '@/utils'
import { push } from 'notivue' import { push } from 'notivue'
import { useMessageBox } from '@/hooks'
const { confirm } = useMessageBox()
const { loading, list, total, reset, goToPage, changePageSize, refresh, searchParams, search } = const { loading, list, total, reset, goToPage, changePageSize, refresh, searchParams, search } =
usePageSearch(getBackendExchangeList, { usePageSearch(getBackendExchangeList, {
defaultParams: {}, defaultParams: {},
...@@ -265,9 +268,12 @@ const formRules: FormRules = { ...@@ -265,9 +268,12 @@ const formRules: FormRules = {
// 取消发放 // 取消发放
const handleCancelIssue = async (row: BackendColumnListItemDto) => { const handleCancelIssue = async (row: BackendColumnListItemDto) => {
await ElMessageBox.confirm('确定要取消发放吗?', '提示', { await confirm({
confirmButtonText: '确定', title: '提示',
cancelButtonText: '取消', message: '确定要取消发放吗?',
confirmText: '确定',
cancelText: '取消',
type: 'warning',
}) })
await issueProduct({ await issueProduct({
id: row.id, id: row.id,
......
...@@ -226,6 +226,9 @@ import UploadFile from '@/components/common/UploadFile/index.vue' ...@@ -226,6 +226,9 @@ import UploadFile from '@/components/common/UploadFile/index.vue'
import AuctionRecordDialog from './components/auctionRecordDialog.vue' import AuctionRecordDialog from './components/auctionRecordDialog.vue'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import { push } from 'notivue' import { push } from 'notivue'
import { useMessageBox } from '@/hooks'
const { confirm } = useMessageBox()
const { loading, list, total, reset, goToPage, changePageSize, refresh, searchParams, search } = const { loading, list, total, reset, goToPage, changePageSize, refresh, searchParams, search } =
usePageSearch(getBackendAuctionList) usePageSearch(getBackendAuctionList)
...@@ -301,13 +304,12 @@ const handleEdit = (row: BackendAddOrUpdateAuctionItemDto) => { ...@@ -301,13 +304,12 @@ const handleEdit = (row: BackendAddOrUpdateAuctionItemDto) => {
// 删除 // 删除
const handleDelete = async (row: BackendAuctionListItemDto) => { const handleDelete = async (row: BackendAuctionListItemDto) => {
await confirm({
title: '提示',
message: `确定要删除竞拍物品"${row.name}"吗?`,
type: 'danger',
})
try { try {
await ElMessageBox.confirm(`确定要删除竞拍物品"${row.name}"吗?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
await deleteAuction([row.id]) await deleteAuction([row.id])
refresh() refresh()
push.success('删除成功') push.success('删除成功')
...@@ -382,10 +384,10 @@ const handleBatchShow = async () => { ...@@ -382,10 +384,10 @@ const handleBatchShow = async () => {
} }
const handleBatchDelete = async () => { const handleBatchDelete = async () => {
await ElMessageBox.confirm('确定要删除这些竞拍物品吗?', '提示', { await confirm({
confirmButtonText: '确定', title: '提示',
cancelButtonText: '取消', message: '确定要删除这些竞拍物品吗?',
type: 'warning', type: 'danger',
}) })
await deleteAuction(selectedRows.value.map((item) => item.id)) await deleteAuction(selectedRows.value.map((item) => item.id))
......
...@@ -130,6 +130,9 @@ import UploadFile from '@/components/common/UploadFile/index.vue' ...@@ -130,6 +130,9 @@ import UploadFile from '@/components/common/UploadFile/index.vue'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import LotteryConfig from './components/lotteryConfigDialog.vue' import LotteryConfig from './components/lotteryConfigDialog.vue'
import { push } from 'notivue' import { push } from 'notivue'
import { useMessageBox } from '@/hooks'
const { confirm } = useMessageBox()
const { loading, list, total, reset, goToPage, changePageSize, refresh, searchParams, search } = const { loading, list, total, reset, goToPage, changePageSize, refresh, searchParams, search } =
usePageSearch(getLotteryPrizeList) usePageSearch(getLotteryPrizeList)
...@@ -172,13 +175,13 @@ const handleEdit = (row: BackendAddOrUpdateLotteryPrizeDto) => { ...@@ -172,13 +175,13 @@ const handleEdit = (row: BackendAddOrUpdateLotteryPrizeDto) => {
// //
const handleDelete = async (row: BackendAuctionListItemDto) => { const handleDelete = async (row: BackendAuctionListItemDto) => {
try { await confirm({
await ElMessageBox.confirm(`确定要删除竞拍物品"${row.name}"吗?`, '提示', { title: '提示',
confirmButtonText: '确定', message: `确定要删除奖品"${row.name}"吗?`,
cancelButtonText: '取消', type: 'danger',
type: 'warning', })
})
try {
await deleteLotteryPrize([row.id]) await deleteLotteryPrize([row.id])
refresh() refresh()
push.success('删除成功') push.success('删除成功')
......
...@@ -195,7 +195,9 @@ import { BooleanFlag, ShopGoodsTypeEnum, regionListOptions } from '@/constants' ...@@ -195,7 +195,9 @@ import { BooleanFlag, ShopGoodsTypeEnum, regionListOptions } from '@/constants'
import UploadFile from '@/components/common/UploadFile/index.vue' import UploadFile from '@/components/common/UploadFile/index.vue'
import type { BackendShopItemDto } from '@/api/backend' import type { BackendShopItemDto } from '@/api/backend'
import { push } from 'notivue' import { push } from 'notivue'
console.log('goodsManage', UploadFile) import { useMessageBox } from '@/hooks'
const { confirm } = useMessageBox()
const { loading, list, total, reset, goToPage, changePageSize, refresh, searchParams, search } = const { loading, list, total, reset, goToPage, changePageSize, refresh, searchParams, search } =
usePageSearch(getShopItemList) usePageSearch(getShopItemList)
...@@ -243,13 +245,13 @@ const handleEdit = (row: BackendColumnListItemDto) => { ...@@ -243,13 +245,13 @@ const handleEdit = (row: BackendColumnListItemDto) => {
// 删除 // 删除
const handleDelete = async (row: BackendColumnListItemDto) => { const handleDelete = async (row: BackendColumnListItemDto) => {
try { await confirm({
await ElMessageBox.confirm(`确定要删除商品"${row.name}"吗?`, '提示', { title: '提示',
confirmButtonText: '确定', message: `确定要删除商品"${row.name}"吗?`,
cancelButtonText: '取消', type: 'danger',
type: 'warning', })
})
try {
await deleteShopItem(row.id) await deleteShopItem(row.id)
refresh() refresh()
push.success('删除成功') push.success('删除成功')
...@@ -293,7 +295,6 @@ const handleSelectionChange = (selection: BackendColumnListItemDto[]) => { ...@@ -293,7 +295,6 @@ const handleSelectionChange = (selection: BackendColumnListItemDto[]) => {
} }
const handleEnableChange = async (row: BackendColumnListItemDto) => { const handleEnableChange = async (row: BackendColumnListItemDto) => {
console.log(row)
await addOrUpdateShopItem({ await addOrUpdateShopItem({
id: row.id, id: row.id,
enable: row.enable === BooleanFlag.YES ? BooleanFlag.NO : BooleanFlag.YES, enable: row.enable === BooleanFlag.YES ? BooleanFlag.NO : BooleanFlag.YES,
......
...@@ -127,6 +127,9 @@ import type { FormInstance, FormRules } from 'element-plus' ...@@ -127,6 +127,9 @@ import type { FormInstance, FormRules } from 'element-plus'
import type { BackendTagListItemDto, AddOrUpdateTagDto } from '@/api/backend' import type { BackendTagListItemDto, AddOrUpdateTagDto } from '@/api/backend'
import { push } from 'notivue' import { push } from 'notivue'
import { useMessageBox } from '@/hooks'
const { confirm } = useMessageBox()
const { loading, list, total, reset, goToPage, changePageSize, refresh, searchParams, search } = const { loading, list, total, reset, goToPage, changePageSize, refresh, searchParams, search } =
usePageSearch(getTagList) usePageSearch(getTagList)
...@@ -173,13 +176,13 @@ const handleEdit = (row: BackendTagListItemDto) => { ...@@ -173,13 +176,13 @@ const handleEdit = (row: BackendTagListItemDto) => {
// 删除 // 删除
const handleDelete = async (row: BackendTagListItemDto) => { const handleDelete = async (row: BackendTagListItemDto) => {
try { await confirm({
await ElMessageBox.confirm(`确定要删除标签"${row.title}"吗?`, '提示', { title: '提示',
confirmButtonText: '确定', message: `确定要删除标签"${row.title}"吗?`,
cancelButtonText: '取消', type: 'danger',
type: 'warning', })
})
try {
await deleteTag(row.id) await deleteTag(row.id)
push.success('删除成功') push.success('删除成功')
......
...@@ -132,6 +132,9 @@ import { storeToRefs } from 'pinia' ...@@ -132,6 +132,9 @@ import { storeToRefs } from 'pinia'
import type { ISelectDept } from '@/utils/wxUtil' import type { ISelectDept } from '@/utils/wxUtil'
import BackButton from '@/components/common/BackButton/index.vue' import BackButton from '@/components/common/BackButton/index.vue'
import { push } from 'notivue' import { push } from 'notivue'
import { useMessageBox } from '@/hooks'
const { confirm } = useMessageBox()
const router = useRouter() const router = useRouter()
const userStore = useUserStore() const userStore = useUserStore()
const { userInfo } = storeToRefs(userStore) const { userInfo } = storeToRefs(userStore)
...@@ -238,9 +241,9 @@ const handleSubmit = async (releaseStatus: ReleaseStatusTypeEnum) => { ...@@ -238,9 +241,9 @@ const handleSubmit = async (releaseStatus: ReleaseStatusTypeEnum) => {
await formRef.value?.validate() await formRef.value?.validate()
if (showSubmitGuide.value) { if (showSubmitGuide.value) {
await ElMessageBox.confirm('该案例库已审核通过,修改后需重新审核,确定提交吗?', '提示', { await confirm({
confirmButtonText: '确定', title: '提示',
cancelButtonText: '取消', message: '该案例库已审核通过,修改后需重新审核,确定提交吗?',
type: 'warning', type: 'warning',
}) })
} }
......
...@@ -117,6 +117,9 @@ import { ReleaseStatusTypeEnum, AuditStatusEnum, UsageStatusEnum } from '@/const ...@@ -117,6 +117,9 @@ import { ReleaseStatusTypeEnum, AuditStatusEnum, UsageStatusEnum } from '@/const
import type { TabPaneName } from 'element-plus' import type { TabPaneName } from 'element-plus'
import type { SelfCaseItemDto } from '@/api/user/types' import type { SelfCaseItemDto } from '@/api/user/types'
import { push } from 'notivue' import { push } from 'notivue'
import { useMessageBox } from '@/hooks'
const { confirm } = useMessageBox()
const router = useRouter() const router = useRouter()
const caseTypeListOptions = [ const caseTypeListOptions = [
...@@ -258,10 +261,10 @@ const handleEdit = async (item: SelfCaseItemDto) => { ...@@ -258,10 +261,10 @@ const handleEdit = async (item: SelfCaseItemDto) => {
} }
const handleDelete = async (item: SelfCaseItemDto) => { const handleDelete = async (item: SelfCaseItemDto) => {
await ElMessageBox.confirm('确定删除该案例吗?', '提示', { await confirm({
confirmButtonText: '确定', title: '提示',
cancelButtonText: '取消', message: '确定删除该案例吗?',
type: 'warning', type: 'danger',
}) })
await deleteCase(item.id) await deleteCase(item.id)
push.success('删除成功') push.success('删除成功')
......
...@@ -107,6 +107,9 @@ import type { TabPaneName } from 'element-plus' ...@@ -107,6 +107,9 @@ import type { TabPaneName } from 'element-plus'
import { IS_REAL_KEY } from '@/constants/symbolKey' import { IS_REAL_KEY } from '@/constants/symbolKey'
import { useNavigation } from '@/hooks' import { useNavigation } from '@/hooks'
import { push } from 'notivue' import { push } from 'notivue'
import { useMessageBox } from '@/hooks'
const { confirm } = useMessageBox()
const route = useRoute() const route = useRoute()
const isReal = inject(IS_REAL_KEY) const isReal = inject(IS_REAL_KEY)
...@@ -134,10 +137,10 @@ const { list, loading, searchParams, total, refresh, goToPage, changePageSize } ...@@ -134,10 +137,10 @@ const { list, loading, searchParams, total, refresh, goToPage, changePageSize }
) )
const { jumpToArticleDetailPage } = useNavigation() const { jumpToArticleDetailPage } = useNavigation()
const handleDelete = async (id: number) => { const handleDelete = async (id: number) => {
await ElMessageBox.confirm('确定删除该评论吗?', '提示', { await confirm({
confirmButtonText: '确定', title: '提示',
cancelButtonText: '取消', message: '确定删除该评论吗?',
type: 'warning', type: 'danger',
}) })
await deleteComment(id) await deleteComment(id)
push.success('删除成功') push.success('删除成功')
......
...@@ -89,6 +89,9 @@ import { ArticleTypeEnum } from '@/constants/enums' ...@@ -89,6 +89,9 @@ import { ArticleTypeEnum } from '@/constants/enums'
import type { TabPaneName } from 'element-plus' import type { TabPaneName } from 'element-plus'
import { IS_REAL_KEY } from '@/constants/symbolKey' import { IS_REAL_KEY } from '@/constants/symbolKey'
import { push } from 'notivue' import { push } from 'notivue'
import { useMessageBox } from '@/hooks'
const { confirm } = useMessageBox()
const router = useRouter() const router = useRouter()
const isReal = inject(IS_REAL_KEY) const isReal = inject(IS_REAL_KEY)
...@@ -125,11 +128,12 @@ const handleEdit = (item: any) => { ...@@ -125,11 +128,12 @@ const handleEdit = (item: any) => {
} }
const handleDelete = async (item: any) => { const handleDelete = async (item: any) => {
await ElMessageBox.confirm('确定删除该草稿吗?', '提示', { await confirm({
confirmButtonText: '确定', title: '提示',
cancelButtonText: '取消', message: '确定删除该草稿吗?',
type: 'warning', type: 'danger',
}) })
await deleteArticle(item.id) await deleteArticle(item.id)
refresh() refresh()
push.success('删除成功') push.success('删除成功')
......
...@@ -96,6 +96,9 @@ import type { TabPaneName } from 'element-plus' ...@@ -96,6 +96,9 @@ import type { TabPaneName } from 'element-plus'
import { IS_REAL_KEY } from '@/constants/symbolKey' import { IS_REAL_KEY } from '@/constants/symbolKey'
import { useNavigation } from '@/hooks' import { useNavigation } from '@/hooks'
import { push } from 'notivue' import { push } from 'notivue'
import { useMessageBox } from '@/hooks'
const { confirm } = useMessageBox()
const router = useRouter() const router = useRouter()
const isReal = inject(IS_REAL_KEY) const isReal = inject(IS_REAL_KEY)
...@@ -127,11 +130,12 @@ onActivated(() => { ...@@ -127,11 +130,12 @@ onActivated(() => {
}) })
const handleDelete = async (articleId: number) => { const handleDelete = async (articleId: number) => {
await ElMessageBox.confirm('确定删除该吗?', '提示', { await confirm({
confirmButtonText: '确定', title: '提示',
cancelButtonText: '取消', message: '确定删除该吗?',
type: 'warning', type: 'danger',
}) })
await deleteArticle(articleId) await deleteArticle(articleId)
refresh() refresh()
push.success('删除成功') push.success('删除成功')
......
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