Skip to content

Commit

Permalink
fix: 一键预览新增确认
Browse files Browse the repository at this point in the history
  • Loading branch information
terwer committed Nov 13, 2023
1 parent 0f8e5a2 commit 1d6997b
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions src/components/publish/SinglePublishSelectPlatform.vue
Expand Up @@ -24,7 +24,7 @@
-->

<script setup lang="ts">
import { onMounted, reactive, ref } from "vue"
import { markRaw, onMounted, reactive, ref } from "vue"
import { useVueI18n } from "~/src/composables/useVueI18n.ts"
import { useRouter } from "vue-router"
import { createAppLogger } from "~/src/utils/appLogger.ts"
Expand All @@ -38,6 +38,8 @@ import Adaptors from "~/src/adaptors"
import { Utils } from "~/src/utils/utils.ts"
import { usePublish } from "~/src/composables/usePublish.ts"
import { PublisherAppInstance } from "~/src/publisherAppInstance.ts"
import { ElMessage, ElMessageBox } from "element-plus"
import { Warning } from "@element-plus/icons-vue"
const logger = createAppLogger("single-publish-select-platform")
// appInstance
Expand Down Expand Up @@ -107,9 +109,27 @@ const handlePreview = async (event: any, key: string) => {
}
const handlePreviewAll = async (event: any) => {
for (const enabledCfg of formData.enabledConfigArray) {
await handlePreview(event, enabledCfg.platformKey)
if (formData.enabledConfigArray.length == 0) {
ElMessage.error("文章未发布过,请至少发布到一个平台!")
return
}
ElMessageBox.confirm(
`将在默认浏览器打开所有已发布平台的文章预览页面,是否继续?`,
"温馨提示",
{
type: "error",
icon: markRaw(Warning),
confirmButtonText: t("main.opt.ok"),
cancelButtonText: t("main.opt.cancel"),
}
)
.then(async () => {
for (const enabledCfg of formData.enabledConfigArray) {
await handlePreview(event, enabledCfg.platformKey)
}
})
.catch(() => {})
}
const initPage = async () => {
Expand Down

0 comments on commit 1d6997b

Please sign in to comment.