From 09418df3cda890e43b91ba6dafe6089f9ed534e3 Mon Sep 17 00:00:00 2001 From: zhanghao Date: Thu, 30 Jul 2020 18:55:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=99=BA=E8=83=BD=E5=88=B6=E5=9B=BE=E9=80=9A?= =?UTF-8?q?=E8=BF=87vuex=E5=AD=98=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/workbench/intelligent_drawing.vue | 33 +++++++++++++++++++-- src/store/index.js | 8 +++++ 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/src/pages/workbench/intelligent_drawing.vue b/src/pages/workbench/intelligent_drawing.vue index 4e3c24c..2fac737 100644 --- a/src/pages/workbench/intelligent_drawing.vue +++ b/src/pages/workbench/intelligent_drawing.vue @@ -8,7 +8,7 @@
- +
@@ -17,20 +17,49 @@ export default { data() { return { - url:'https://apaasgis.wodcloud.com/portal/apaasplat/viewer/mapViewer.html' + url:'https://zhangh.wodcloud.com/portal/apaasplat/viewer/mapViewer.html', }; }, + computed:{ + getZnztParams() { + return this.$store.state.znztParams; + }, + getAppBuilderParams() { + return this.$store.state.appBuilderParams; + }, + znztUrl(){ + return this.url+this.urlParams + }, + urlParams(){ + if(this.$store.state.znztParams){ + return `?webmap=${this.$store.state.znztParams.id}`; + }else{ + return '' + } + }, + }, + watch: { + getZnztParams(newVal) { + this.urlParams = `?webmap=${newVal.id}` + console.log('智能制图参数'+newVal) + }, + getAppBuilderParams(newVal) { + console.log('智能制图应用程序参数'+newVal) + }, + }, mounted() { window.addEventListener('message',event =>{ let data = event.data; // 智能制图发布服务 if (data.cmd == 'mapviewmsg'){ console.log(data); + this.$store.commit("setZnztParams", data.params); this.$router.push(`/fwzc/fwcs`); } // App Builder发布服务 if (data.cmd == 'appbuildermsg'){ console.log(data); + this.$store.commit("setAppBuilderParams", data.params); this.$router.push(`/fwzc/fwcs`); } }) diff --git a/src/store/index.js b/src/store/index.js index 0f8ec87..446c95d 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -19,6 +19,8 @@ const store = new Vuex.Store({ ], // 应用管理列表,onlyRead shoppingCart: [], //购物车 menuCartState: 0, //购物车操作都要修改这个值,menu监听这个值的变化实时获取购物车列表 + znztParams: null, //智能制图传入过来的数据 + appBuilderParams: null, //应用程序传入过来的数据 }, getters: { // 1:超管 2:组织管理员 3:普通用户 4:开发者 @@ -52,6 +54,12 @@ const store = new Vuex.Store({ setMenuCartState(state) { state.menuCartState++; }, + setZnztParams(state, newValue) { + state.znztParams = newValue; + }, + setAppBuilderParams(state, newValue) { + state.appBuilderParams = newValue; + }, }, }); -- 2.26.0