Browse Source

fix: 修复项目标签初始化bug

lanjianrong 5 years ago
parent
commit
42b7801168
2 changed files with 19 additions and 16 deletions
  1. 0 2
      app/controller/tender_controller.js
  2. 19 14
      app/middleware/session_auth.js

+ 0 - 2
app/controller/tender_controller.js

@@ -139,8 +139,6 @@ module.exports = app => {
             this.jsFiles = this.app.jsFiles.tender.list;
             const accountInfo = await this.ctx.service.projectAccount.getDataById(this.ctx.session.sessionUser.accountId);
             const userPermission = accountInfo !== undefined && accountInfo.permission !== '' ? JSON.parse(accountInfo.permission) : null;
-            const { path = 'list' } = await ctx.service.settingShow.getDefaultPath();
-            ctx.curListUrl = path;
             const renderData = {
                 accountInfo,
                 userPermission,

+ 19 - 14
app/middleware/session_auth.js

@@ -41,6 +41,11 @@ module.exports = options => {
             if (this.session === null) {
                 throw '系统维护中~';
             }
+
+            // 对sub_menu项目默认打开页进行配置
+            const record = yield this.service.settingShow.getDefaultPath();
+            this.curListUrl = record.path;
+
         } catch (error) {
             console.log(error);
             if (this.helper.isAjax(this.request)) {
@@ -53,22 +58,22 @@ module.exports = options => {
                 if (this.helper.isWap(this.request)) {
                     this.session.wapTenderID = this.params.id ? this.params.id : null;
                     return this.redirect('/wap/login?referer=' + this.url);
-                } else {
-                    return this.redirect('/login?referer=' + this.url);
-                }
-            } else {
-                if (this.helper.isWap(this.request)) {
-                    this.session.wapTenderID = this.params.id ? this.params.id : null;
-                    return this.redirect('/wap/login?referer=' + this.url);
-                } else {
-                    this.session.message = {
-                        type: messageType.ERROR,
-                        icon: 'exclamation-circle',
-                        message: '登录信息异常,请重新登录',
-                    };
-                    return this.redirect('/login?referer=' + this.url);
                 }
+                return this.redirect('/login?referer=' + this.url);
+
+            }
+            if (this.helper.isWap(this.request)) {
+                this.session.wapTenderID = this.params.id ? this.params.id : null;
+                return this.redirect('/wap/login?referer=' + this.url);
             }
+            this.session.message = {
+                type: messageType.ERROR,
+                icon: 'exclamation-circle',
+                message: '登录信息异常,请重新登录',
+            };
+            return this.redirect('/login?referer=' + this.url);
+
+
         }
         yield next;
     };