Browse Source

初始渲染页面,App.vue url路径无参数,一直显示loading,不进行后续处理

yunxing 4 years ago
parent
commit
a3df28f939
2 changed files with 17 additions and 2 deletions
  1. 16 1
      src/App.vue
  2. 1 1
      src/store/index.ts

+ 16 - 1
src/App.vue

@@ -86,12 +86,18 @@ export default {
             appName: '万达可视化系统',
             mapServerURL: `http://mapapp.wanda.cn/editor`,
             mapthemeUrl: `http://mapapp.wanda.cn/editor/webtheme`,
+            urlFlag: false,
         }
     },
     beforeMount() {},
     created() {
         // window.vm = this
         this.handleUrl()
+        // 路径无参数,不执行后续逻辑
+        if(!this.urlFlag){
+            // this.loadComplete = true
+            return
+        }
         // store.commit('SETSSOTOKEN', 'admin:liujiandong')
         // console.log(window.location.href)
         this.SETHAVEFENGMAP(false)
@@ -106,12 +112,16 @@ export default {
         this.getFloorList()
     },
     mounted() {
+        // 路径无参数,不执行后续逻辑
+        if(!this.urlFlag){
+            // this.loadComplete = true
+            return
+        }
         // console.log('环境变量', process.env.VUE_APP_RealEnv)
         if (this.plazaId) {
             this.getFengMap()
             store.dispatch('getBrand')
         } else {
-            console.log(111111)
             window.fengmapData = null
             this.loadComplete = true
         }
@@ -189,6 +199,10 @@ export default {
             // console.log('%c 路径参数:', 'color:blue')
             // console.log(params)
             let { username, plazaId } = params
+            if(! (username && plazaId)){
+                this.urlFlag =  false 
+                return
+            }
             if (username) {
                 this.SETSSOTOKEN(`admin:${username}`)
             }
@@ -196,6 +210,7 @@ export default {
                 //  设置广场
                 this.SETPLAZAID(plazaId)
             }
+            this.urlFlag =  true 
         },
         /**
          * 查询url参数

+ 1 - 1
src/store/index.ts

@@ -12,7 +12,7 @@ export default new Vuex.Store({
         ssoToken: 'admin:maohongru',
         appTitle: '管理说明书', //顶部标题
         // ssoToken: null,
-        plazaId: '1000772', //项目Id 北京通州
+        plazaId: '', // '1000772', //项目Id 北京通州
         // plazaId: '1001825', //项目Id 成都龙泉驿
         // plazaId: '1000423', //项目Id 大连高新
         fmapID: '',