1
0
mirror of https://gitee.com/bookshelfplus/bookshelfplus synced 2025-09-02 23:23:28 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee

所有页面的网页标题和页内标题区分开;搜索页允许查询空字符串(列出所有)

This commit is contained in:
2022-04-02 22:51:25 +08:00
parent 26c4e1c55f
commit 4446720adb
14 changed files with 39 additions and 36 deletions

View File

@@ -2,15 +2,20 @@
var express = require('express');
var router = express.Router();
function getPageTitle(title) {
return `${title} | ${site.title}`
}
router.get('/', function (req, res) {
res.render('index', {
title: site.title
title: site.title,
headText: "书栖网"
});
});
router.get('/search', function (req, res) {
res.render('search', {
title: "搜一下"
title: getPageTitle("搜一下"),
headText: "搜一下"
});
});
@@ -18,37 +23,43 @@ router.get('/category', function (req, res) {
if (req.query.id) {
// 分类详情页
res.render('category-details', {
title: "书籍分类"
title: getPageTitle("书籍分类"),
headText: "书籍分类"
});
} else {
// 分类首页
res.render('category', {
title: "书籍分类"
title: getPageTitle("书籍分类"),
headText: "书籍分类"
});
}
});
router.get('/book', function (req, res) {
res.render('book', {
title: "书籍详情"
title: getPageTitle("书籍详情"),
headText: "书籍详情"
});
});
router.get('/about', function (req, res) {
res.render('about', {
title: "关于"
title: getPageTitle("关于"),
headText: "关于"
});
});
router.get('/login', function (req, res) {
res.render('login', {
title: "用户登录"
title: getPageTitle("用户登录"),
headText: "用户登录"
});
});
router.get('/register', function (req, res) {
res.render('register', {
title: "用户注册"
title: getPageTitle("用户注册"),
headText: "用户注册"
});
});
@@ -88,7 +99,8 @@ router.get('/dashboard/:group/:page', function (req, res) {
// 仪表盘
if (req.params.page == "index") {
res.render(`dashboard/${req.params.group}/index`, {
title: "后台管理",
title: getPageTitle(req.params.group === "admin" ? "后台管理" : "用户中心"),
headText: req.params.group === "admin" ? "后台管理" : "用户中心",
links: navbarLinks,
group: req.params.group,
page: req.params.page,
@@ -100,7 +112,8 @@ router.get('/dashboard/:group/:page', function (req, res) {
if ((req.params.group === "admin" && ["UserManage", "BookManage", "CategoryManage"].indexOf(req.params.page) > -1) ||
(req.params.group === "user" && ["myBookshelf", "myCollection"].indexOf(req.params.page) > -1)) {
res.render(`dashboard/${req.params.group}/manage`, {
title: req.params.group === "admin" ? "后台管理" : "用户中心",
title: getPageTitle(req.params.group === "admin" ? "后台管理" : "用户中心"),
headText: req.params.group === "admin" ? "后台管理" : "用户中心",
links: navbarLinks,
group: req.params.group,
page: req.params.page,
@@ -112,7 +125,8 @@ router.get('/dashboard/:group/:page', function (req, res) {
router.get('/status', function (req, res) {
res.render('status', {
title: "网站状态检测"
title: getPageTitle("网站状态检测"),
headText: "网站状态检测"
});
});

View File

@@ -4,18 +4,5 @@
"_prefix": "http://bookshelf.plus/api",
"prefix": "/api"
},
"title": "张小弟之家电子书分享(测试中)",
"footer": {
"link": [
{
"text": "张小弟之家",
"url": "https://www.only4.work/",
"target": "_blank"
},
{
"text": "加入张小弟之家QQ群链接待更新",
"url": ""
}
]
}
"title": "书栖网(测试中)"
}

View File

@@ -13,6 +13,7 @@
height: auto;
max-height: 300px;
margin-bottom: 20px;
margin-top: 60px;
}
</style>
</head>

View File

@@ -43,7 +43,7 @@
<body>
<%- include("./component/navbar.html"); %>
<main class="main">
<h1><%= title %></h1>
<h1><%= headText %></h1>
<div id="container">
<table id="result-table"></table>
</div>

View File

@@ -32,7 +32,7 @@
<%- include("../component/navbar.html"); %>
<main class="main">
<h1>
<%= title %>
<%= headText %>
</h1>
<div id="container">
<% links.forEach(item=> { %>

View File

@@ -35,7 +35,7 @@
<body>
<%- include("../component/navbar.html"); %>
<main class="main">
<h1><%= title %></h1>
<h1><%= headText %></h1>
<p><%= page %></p>
<div id="container">
<div id="container-controls">页面加载中,请稍候 ...</div>

View File

@@ -7,7 +7,7 @@
<body>
<%- include("../component/navbar.html"); %>
<main class="main">
<h1><%= title %></h1>
<h1><%= headText %></h1>
<div id="container">
</div>

View File

@@ -7,7 +7,7 @@
<body>
<%- include("../component/navbar.html"); %>
<main class="main">
<h1><%= title %></h1>
<h1><%= headText %></h1>
<div id="container">
<div>
<%= typeof title !=='undefined' ? page : "出错啦"; %>

View File

@@ -7,7 +7,7 @@
<%- include("./component/navbar.html"); %>
<div class="main">
<div class="siteTitle">
<h1>书栖网</h1>
<h1><%=headText%></h1>
</div>
<%- include("./component/searchbox.html"); %>
<div class="sloganBox">

View File

@@ -40,7 +40,7 @@
<body>
<%- include("./component/navbar.html"); %>
<main class="main">
<h1><%= title %></h1>
<h1><%= headText %></h1>
<div id="container">
<div>
<!-- 用户登录 输入用户名和密码的文本框 -->

View File

@@ -19,7 +19,7 @@
<body>
<%- include("./component/navbar.html"); %>
<main class="main">
<h1><%= title %></h1>
<h1><%= headText %></h1>
<div id="container">
<div>
<!-- 用户登录 输入用户名和密码的文本框 -->

View File

@@ -28,7 +28,7 @@
<body>
<%- include("./component/navbar.html"); %>
<div class="main">
<h1><%= title %></h1>
<h1><%= headText %></h1>
<%- include("./component/searchbox.html"); %>
<div id="container">
<table id="result-table"></table>
@@ -47,6 +47,7 @@
var keyword = (requestParams["keyword"] || "").trim();
searchbox.value = keyword;
if (keyword === "") {
search('');
searchbox.focus();
} else {
search(keyword);

View File

@@ -20,7 +20,7 @@
<%- include("./component/navbar.html"); %>
<main class="main">
<h1>
<%= title %>
<%= headText %>
</h1>
<div class="removeAfterScriptLoaded">

View File

@@ -12,7 +12,7 @@ public class BookModel {
Integer id;
// 书名
@NotBlank(message = "书籍名称不能为空")
// @NotBlank(message = "书籍名称不能为空")
String bookName;
// 书籍简介