YaolongHan 4 anos atrás
pai
commit
f824545d57

+ 26 - 0
src/App.vue

@@ -5,6 +5,32 @@
 </template>
 
 <script>
+export default {
+  data(){
+    return {}
+  },
+  created() {
+    const href = window.location.href;
+    // 路由
+    // const route = href.split("?")[0];
+    // 参数处理
+    let params = href.split("?")[1];
+    if (!params) {
+      // 参数有问题
+      return false;
+    }
+    params = decodeURIComponent(params);
+    // params = "categoryId=NTXT&ProjectID=5&BuildingID=1&FloorID=1"; // mock 参数
+    const paramsArr = params.split("&");
+    const obj = {};
+    paramsArr.map(item => {
+      const arr = item.split("=");
+      obj[arr[0]] = arr[1];
+    });
+    this.urlMsg = obj;
+    this.$store.commit("SETSSOTOKEN", this.urlMsg.token);
+  }
+}
 </script>
 <style lang="less">
 #app {

+ 2 - 2
src/api/httputils.js

@@ -20,10 +20,10 @@ const axiosservice = axios.create({
 axiosservice.interceptors.request.use(
     (config) => {
         config.withCredentials = true // 允许携带token ,这个是解决跨域产生的相关问题
-        const token = store.getters["token"]
+        const token = store.getters["token"] ? store.getters["token"]:'admin:lengqiang'
         if (config.url.indexOf('mapapp') < 0) {
             config.headers = {
-                'sso-token': 'admin:lengqiang',
+                'sso-token': token,
                 isPreview: false, //默认false,当预览开启的时候是true
             }
         }

+ 10 - 2
src/components/baseEditer.vue

@@ -495,9 +495,17 @@ export default {
         loadings.close();
         if (res.Result == "success") {
           this.$message.success("发布成功");
-          this
           setTimeout(() => {
-            this.$router.push({ path: 'drafts', query: { categoryId: this.urlMsg.categoryId, projectId:this.urlMsg.projectId,BuildingID:this.urlMsg.BuildingID,FloorID:this.urlMsg.FloorID,fmapID:this.urlMsg.fmapID}})
+             const token = this.$store.getters["token"];
+             const data = `categoryId=${this.urlMsg.categoryId}&projectId=${this.urlMsg.projectId}&BuildingID=${this.urlMsg.BuildingID}&FloorID=${this.urlMsg.FloorID}&fmapID=${this.urlMsg.fmapID}$token=${token}`;
+            const url =
+              window.location.origin +
+              "/wandaEditer/drafts?" +
+              encodeURIComponent(data);
+            window.open(url, true);
+            // // 发布成功跳转草稿箱
+            // const token = this.$store.getters["token"];
+            // this.$router.push({ path: 'drafts', query: { projectId:this.urlMsg.projectId,BuildingID:this.urlMsg.BuildingID,fmapID:this.urlMsg.fmapID,token:token}})
           }, 1000);
         } else {
           this.$message.error(res.Message);

+ 1 - 0
src/router/index.ts

@@ -27,4 +27,5 @@ const router = new VueRouter({
   routes
 })
 
+
 export default router

+ 11 - 4
src/store/index.ts

@@ -7,25 +7,32 @@ Vue.use(Vuex)
 export default new Vuex.Store({
   state: {
     GraphCategoryIds: ['NTXT'], //系统类型
-    TypeIdToGraphElement:{}, //typeid到图例元素的映射
+    TypeIdToGraphElement: {}, //typeid到图例元素的映射
+    token: null,
   },
   mutations: {
-    TypeIdToGraphElement(state,data){
+    TypeIdToGraphElement(state, data) {
       if (data.length) {
         state.TypeIdToGraphElement = {}
         data.forEach(t => {
           state.TypeIdToGraphElement[t.Id] = t;
         })
       }
-    }
+    },
+    SETSSOTOKEN(state, data) {
+      state.token = data
+    },
   },
   actions: {
     getElementType({ commit }, params) {
       getGraphElementType(params).then(res => {
-        commit('TypeIdToGraphElement',res.Content)
+        commit('TypeIdToGraphElement', res.Content)
       })
     }
   },
+  getters: {
+    token: (state) => state.token,
+  },
   modules: {
   }
 })

+ 14 - 0
src/utils/query.ts

@@ -0,0 +1,14 @@
+function query(search) {
+    const obj = {}
+    const _search = search || location.search.split('?')[1]
+    if (_search) {
+        _search.split('&').forEach((i) => {
+            const key = i.split('=')[0]
+            const value = i.split('=')[1]
+            obj[key] = value
+        })
+    }
+    return obj
+}
+
+export { query }

+ 24 - 7
src/views/drafts.vue

@@ -412,12 +412,29 @@ export default {
      * @description t跳转editer编辑器
      */
     goToEditer() {
-      const data = `categoryId=${this.categoryId}&projectId=${this.projectId}&BuildingID=1&FloorID=${this.floorId}&FloorName=${this.floorName}&fmapID=${this.fmapID}`;
-      const url =
-        window.location.origin +
-        "/wandaEditer/editer?" +
-        encodeURIComponent(data);
-      window.open(url, true);
+      setTimeout(() => {
+        const token = this.$store.getters["token"];
+        const data = `categoryId=${this.categoryId}&projectId=${this.projectId}&BuildingID=1&FloorID=${this.floorId}&FloorName=${this.floorName}&fmapID=${this.fmapID}&token=${token}`;
+        const url =
+          window.location.origin +
+          "/wandaEditer/editer?" +
+          encodeURIComponent(data);
+        window.open(url, true);
+        // 发布成功跳转草稿箱
+        // const token = this.$store.getters["token"];
+        // this.$router.push({
+        //   path: "editer",
+        //   query: {
+        //     categoryId: this.categoryId,
+        //     projectId: this.projectId,
+        //     BuildingID: 1,
+        //     FloorName: this.floorName,
+        //     FloorID: this.floorId,
+        //     fmapID: this.fmapID,
+        //     token:token
+        //   }
+        // });
+      }, 1000);
     },
     // 切换草稿箱楼层
     checkFloor(floorid) {
@@ -470,7 +487,7 @@ export default {
             this.getLegend();
           }
         });
-      },100);
+      }, 100);
     }
   },
   mounted() {

+ 4 - 4
vue.config.js

@@ -15,9 +15,9 @@ module.exports = {
                 },
             },
             '/serve': {
-                target: 'http://192.168.200.87:8088/',
+                // target: 'http://192.168.200.87:8088/',
                 // target: 'http://192.168.200.83:8085/',
-                // target: 'http://60.205.177.43:8080', //阿里云
+                target: 'http://60.205.177.43:8080', //阿里云
                 changeOrigin: true,
                 secure: false,
                 pathRewrite: {
@@ -25,8 +25,8 @@ module.exports = {
                 },
             },
             '/data': {
-                target: 'http://192.168.200.87:9003',
-                // target: 'http://60.205.177.43:9903', //阿里云
+                // target: 'http://192.168.200.87:9003',
+                target: 'http://60.205.177.43:9903', //阿里云
                 changeOrigin: true,
                 secure: false,
                 pathRewrite: {