From bd603eccfb4bf5cdeb7420a303cb6fb8def404a1 Mon Sep 17 00:00:00 2001 From: yoruponder <49467824@qq.com> Date: Wed, 17 Jul 2024 20:11:41 +0800 Subject: [PATCH] feat: errorInfo to pinia (#353) --- web/src/render/pages/ErrorPage.vue | 11 +++++++++-- web/src/render/store/actions.js | 23 ++++++++++++++++++++--- web/src/render/stores/errorInfo.js | 22 ++++++++++++++++++++++ 3 files changed, 51 insertions(+), 5 deletions(-) create mode 100644 web/src/render/stores/errorInfo.js diff --git a/web/src/render/pages/ErrorPage.vue b/web/src/render/pages/ErrorPage.vue index 88a209ce..47dfac44 100755 --- a/web/src/render/pages/ErrorPage.vue +++ b/web/src/render/pages/ErrorPage.vue @@ -14,13 +14,17 @@ import { computed } from 'vue' import { useStore } from 'vuex' // @ts-ignore import communalLoader from '@materials/communals/communalLoader.js' +import { useErrorInfo } from '../stores/errorInfo' const LogoIcon = communalLoader.loadComponent('LogoIcon') const store = useStore() +const {errorInfo} = useErrorInfo(); const errorImageUrl = computed(() => { - const errorType = store.state?.errorInfo?.errorType + // const errorType = store.state?.errorInfo?.errorType + const errorType = errorInfo?.errorType + const imageMap = { overTime: '/imgs/icons/overtime.webp', default: '/imgs/icons/error.webp' @@ -29,7 +33,10 @@ const errorImageUrl = computed(() => { return imageMap[errorType as 'overTime'] || imageMap.default }) -const errorMsg = computed(() => store.state?.errorInfo?.errorMsg || '提交失败') +// const errorMsg = computed(() => store.state?.errorInfo?.errorMsg || '提交失败') +const errorMsg = computed(() => { + return errorInfo?.errorMsg || '提交失败' +}) const logoConf = computed(() => store.state?.bottomConf || {})