浏览代码

1. 更新缓存
2. 登录后,项目下只有1个子项目时,默认进入子项目

MaiXinRong 3 月之前
父节点
当前提交
0966ecb333
共有 2 个文件被更改,包括 5 次插入4 次删除
  1. 4 3
      app/controller/login_controller.js
  2. 1 1
      app/public/js/tender_list_manage.js

+ 4 - 3
app/controller/login_controller.js

@@ -177,9 +177,10 @@ module.exports = app => {
                     throw '用户名或密码错误';
                 }
 
+                // 查找项目数据
+                const projectData = await this.ctx.service.project.getProjectByCode(ctx.request.body.project.toString().trim());
+                const subProject = await ctx.service.subProject.getAllDataByCondition({ where: {project_id: projectData.id}});
                 if (result === 2) {
-                    // 查找项目数据
-                    const projectData = await this.ctx.service.project.getProjectByCode(ctx.request.body.project.toString().trim());
                     // 判断是否有设置停用提示,有则展示
                     const msg = await ctx.service.projectStopmsg.getMsg(projectData.id);
                     throw msg;
@@ -190,7 +191,7 @@ module.exports = app => {
 
                 // 判断是否已经有对应用户信息,没有则跳转初始化页面
                 const needBoot = await ctx.service.customer.isNeedBoot(ctx.request.body);
-                const url = needBoot ? '/boot' : '/dashboard';
+                const url = needBoot ? '/boot' : (subProject && subProject.length === 1 ? `/sp/${subProject[0].id}/dashboard` : '/dashboard');
 
                 const query = URL.parse(ctx.request.header.referer, true).query;
                 ctx.redirect(query.referer ? query.referer : url);

+ 1 - 1
app/public/js/tender_list_manage.js

@@ -52,7 +52,7 @@ const tenderListSpec = (function(){
             } else {
                 html.push('<button class="btn btn-outline-secondary btn-sm ml-1" data-toggle="tooltip" data-placement="top" title="请先删除所有期">删除</button>');
             }
-            if (cache) html.push(`<a href="/list/refreshCache?tid=${node.id}" class="btn btn-outline-primary btn-sm ml-1">更新缓存</a>`);
+            if (cache) html.push(`<a href="/sp/${spid}/list/refreshCache?tid=${node.id}" class="btn btn-outline-primary btn-sm ml-1">更新缓存</a>`);
             html.push(`<a href="javascript: void(0)" class="btn btn-outline-primary btn-sm ml-1" onclick="modStatus(${node.id});">修改状态</a>`);
         }
         html.push('</td>');