Browse Source

'添加编辑器返回草稿箱'

zhangyu 4 years ago
parent
commit
45fc40ddf4
1 changed files with 33 additions and 2 deletions
  1. 33 2
      src/components/edit/top_toolbar.vue

+ 33 - 2
src/components/edit/top_toolbar.vue

@@ -2,7 +2,7 @@
   <div id="top_toolbar">
     <!-- 顶部编辑器 -->
     <div class="tit">
-      <!-- <a-icon type="left" /> -->
+      <a-icon style="cursor: pointer;" type="left" @click="goDrafts" />
       {{this.urlMsg.floorName}}
     </div>
     <div class="tool">
@@ -200,7 +200,8 @@ export default {
       scale: 0.5, //底图缩放比例
       initScale: 0.5, //初始 底图缩放比例
       baseScale: 1.0, //底图基础缩放比例,由底图加载完成后,传入进来
-      scaleStep: 0.05 // +-缩放步进
+      scaleStep: 0.05, // +-缩放步进
+      locationQuery: null
     };
   },
   computed: {
@@ -296,6 +297,35 @@ export default {
       //   this.$message.error("请选择指定对象!", 1);
       // }
     },
+    // 返回草稿箱
+    goDrafts() {
+      if (this.locationQuery.projectId && this.locationQuery.BuildingID && this.locationQuery.fmapID && this.locationQuery.token) {
+        this.$router.push({
+          path: 'drafts',
+          query: {
+            projectId: this.locationQuery.projectId,
+            BuildingID: this.locationQuery.BuildingID,
+            FloorID: this.locationQuery.FloorID,
+            fmapID: this.locationQuery.fmapID,
+            token: this.locationQuery.token
+          }
+        })
+      } else {
+        if (!this.locationQuery.projectId) {
+          console.log("暂无projectId!");
+        }
+        if (!this.locationQuery.BuildingID) {
+          console.log("暂无BuildingID!");
+        }
+        if (!this.locationQuery.fmapID) {
+          console.log("暂无fmapID!");
+        }
+        if (!this.locationQuery.token) {
+          console.log("暂无token!");
+        }
+        this.$message.error("参数缺失,无法跳转!");
+      }
+    },
     // 发布图例
     publishMap() {
       MessageBox.confirm("确认后即发布到平台?", "提示", {
@@ -336,6 +366,7 @@ export default {
     this.getMouseScale();
   },
   created() {
+    this.locationQuery = this.$route.query;
     const href = window.location.href;
     // 路由
     // const route = href.split("?")[0];