Browse Source

表头title显示问题bug修复

ellisran 3 months ago
parent
commit
65dfb646af
2 changed files with 2 additions and 2 deletions
  1. 1 1
      app/base/base_controller.js
  2. 1 1
      app/view/layout/layout.ejs

+ 1 - 1
app/base/base_controller.js

@@ -20,7 +20,7 @@ class BaseController extends Controller {
         const menuList = ctx.isProjectController
             ? JSON.parse(JSON.stringify(this.app.menu.projectMenu))
             : JSON.parse(JSON.stringify(this.app.menu.menu));
-        ctx.menu = menuList[ctx.controllerName] || {};
+        ctx.menu = menuList[ctx.controllerName] || Object.values(menuList).find(menu => menu.controllers && menu.controllers.indexOf(ctx.controllerName) >= 0) || {};
         ctx.title = ctx.menu.name || '';
         if (ctx.menu && ctx.menu.children) {
             if (ctx.menu.children[ctx.actionName]) ctx.title = ctx.menu.children[ctx.actionName].name;

+ 1 - 1
app/view/layout/layout.ejs

@@ -4,7 +4,7 @@
 <head>
     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
-    <title><%= ctx.menu.name === undefined ? '主页' : ctx.menu.name %>-计量支付</title>
+    <title><%= ctx.menu.name === undefined ? (ctx.controllerName === 'setting' ? (ctx.isProjectController ? '平台' : '项目') + '设置' : '主页') : ctx.menu.name %>-计量支付</title>
     <link rel="stylesheet" href="/public/css/bootstrap/bootstrap.min.css">
     <link rel="stylesheet" href="/public/css/main.css?<%- ctx.app.config.version %>">
     <% if (ctx.request.host.indexOf('jlqa') !== -1 || ctx.request.host.indexOf('jluat') !== -1 || ctx.request.host === '127.0.0.1:7002') { %>