From fd6585d80cbff6a0b6dcd6f92d07f01a3a940f14 Mon Sep 17 00:00:00 2001 From: alwayrun Date: Mon, 27 May 2024 16:18:08 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E9=87=8D=E6=9E=84=20management/pag?= =?UTF-8?q?es/publishResult=20=E7=9B=AE=E5=BD=95=E4=B8=8B=E7=BB=84?= =?UTF-8?q?=E4=BB=B6,=20=E4=BD=BF=E7=94=A8=20Vue3=20=E7=BB=84=E5=90=88?= =?UTF-8?q?=E5=BC=8F=20API=20=E5=86=99=E6=B3=95=20(#167)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/package.json | 1 + web/src/management/components/LeftMenu.vue | 2 +- .../modules/contentModule/PublishPanel.vue | 4 +- .../pages/list/components/ToolBar.vue | 2 +- .../PublishPage.vue} | 95 ++++++++----------- .../components/ChannelRow.vue | 67 ++++++------- .../components/QRCode.vue | 66 ++++++------- web/src/management/router/index.ts | 6 +- 8 files changed, 114 insertions(+), 129 deletions(-) rename web/src/management/pages/{publishResult/PublishResultPage.vue => publish/PublishPage.vue} (64%) rename web/src/management/pages/{publishResult => publish}/components/ChannelRow.vue (67%) rename web/src/management/pages/{publishResult => publish}/components/QRCode.vue (63%) diff --git a/web/package.json b/web/package.json index 1b879af2..c2a6226b 100644 --- a/web/package.json +++ b/web/package.json @@ -38,6 +38,7 @@ "@rushstack/eslint-patch": "^1.10.2", "@tsconfig/node20": "^20.1.2", "@types/node": "^20.11.19", + "@types/qrcode": "^1.5.5", "@vitejs/plugin-vue": "^5.0.3", "@vitejs/plugin-vue-jsx": "^3.1.0", "@vue/eslint-config-prettier": "^8.0.0", diff --git a/web/src/management/components/LeftMenu.vue b/web/src/management/components/LeftMenu.vue index 4c861ef0..12bb3b52 100644 --- a/web/src/management/components/LeftMenu.vue +++ b/web/src/management/components/LeftMenu.vue @@ -25,7 +25,7 @@ const tabs = [ text: '投放问卷', icon: 'icon-toufang', to: { - name: 'publishResultPage' + name: 'publish' } }, { diff --git a/web/src/management/pages/edit/modules/contentModule/PublishPanel.vue b/web/src/management/pages/edit/modules/contentModule/PublishPanel.vue index 2560b018..b78638c5 100644 --- a/web/src/management/pages/edit/modules/contentModule/PublishPanel.vue +++ b/web/src/management/pages/edit/modules/contentModule/PublishPanel.vue @@ -53,9 +53,7 @@ export default { if (publishRes.code === 200) { ElMessage.success('发布成功') this.$store.dispatch('edit/getSchemaFromRemote') - this.$router.push({ - name: 'publishResultPage' - }) + this.$router.push({ name: 'publish' }) } else { ElMessage.error(`发布失败 ${publishRes.errmsg}`) } diff --git a/web/src/management/pages/list/components/ToolBar.vue b/web/src/management/pages/list/components/ToolBar.vue index 95f4f336..0247c38e 100644 --- a/web/src/management/pages/list/components/ToolBar.vue +++ b/web/src/management/pages/list/components/ToolBar.vue @@ -48,7 +48,7 @@ export default { return case 'release': this.$router.push({ - name: 'publishResultPage', + name: 'publish', params: { id: this.data._id } diff --git a/web/src/management/pages/publishResult/PublishResultPage.vue b/web/src/management/pages/publish/PublishPage.vue similarity index 64% rename from web/src/management/pages/publishResult/PublishResultPage.vue rename to web/src/management/pages/publish/PublishPage.vue index c7e48f5e..4cd31798 100644 --- a/web/src/management/pages/publishResult/PublishResultPage.vue +++ b/web/src/management/pages/publish/PublishPage.vue @@ -3,7 +3,7 @@
- +
- - +const store = useStore() +const metaData = computed(() => _get(store.state, 'edit.schema.metaData')) +const curStatus = computed(() => _get(metaData.value, 'curStatus.status', 'new')) +const mainChannel = computed(() => { + let fullUrl = '' + + if (metaData.value) { + fullUrl = `${location.origin}/render/${metaData.value.surveyPath}` + } + + return { fullUrl } +}) + +const route = useRoute() +const router = useRouter() +onMounted(async () => { + store.commit('edit/setSurveyId', route.params.id) + + try { + await store.dispatch('edit/init') + } catch (err: any) { + ElMessage.error(err.message) + setTimeout(() => { + router.replace({ name: 'survey' }) + }, 1000) + } +}) +