浏览代码

修复编辑器打开空白页情况

ming 1 年之前
父节点
当前提交
5fd2af9004
共有 1 个文件被更改,包括 7 次插入6 次删除
  1. 7 6
      assets/js/commonVue.js

+ 7 - 6
assets/js/commonVue.js

@@ -108,7 +108,7 @@ const App = {
     //获取栏目数据
     getColumnData() {
       var _this = this;
-      if (!localStorage.getItem('storeColumnList') || window.location.pathname == '/') {
+      if (!localStorage.getItem('storeColumnList') || window.location.pathname == '/'||window.location.pathname == '/index.html') {
         $.ajax({
           type: 'get',
           dataType: 'json',
@@ -138,7 +138,7 @@ const App = {
 
 
     handleColumnData() {
-      this.currentPath = window.location.pathname;
+            this.currentPath = window.location.pathname;
       this.columnList = JSON.parse(localStorage.getItem('storeColumnList')).data;
 
       // 读取并检查是否过期
@@ -155,7 +155,7 @@ const App = {
         //栏目处理  
 
         //进入首页
-        if (_this.columnList[i].sname == '/index.html' && (window.location.pathname == '/'||window.location.pathname == '')) {
+        if (_this.columnList[i].sname == '/' && (window.location.pathname == '/'||window.location.pathname == ''||window.location.pathname == '/index.html')) {
           getSeoCommon()
 
           this.requestParams.categoryid = this.columnList[0].id
@@ -171,15 +171,16 @@ const App = {
         }
 
         //进入其他栏目页
-        if ((_this.columnList[i].sname == window.location.pathname)) {
+        
+        if ((_this.columnList[i].sname == window.location.pathname)||(_this.columnList[i].sname == window.location.pathname.replace('index.html', ''))) {
           getSeoCommon()
-
+          
           _this.columnTypes = _this.columnList[i].children
           _this.colL = _this.columnTypes.childten;
           if (_this.columnList[i].children.length > 0) {
             _this.requestParams.categoryid = (_this.getQuery('isUrlId') == 1) ? _this.getQuery('categoryid') : _this.columnTypes[0].id;
           } else {
-                        var objData = _this.columnList.filter(obj => obj.sname == window.location.pathname);
+            var objData = _this.columnList.filter(obj => obj.sname == window.location.pathname.replace('index.html', ''));
             _this.requestParams.categoryid = objData[0].id
 
           }