From 4662823a70e5d50e6836db234308353aa48d2b84 Mon Sep 17 00:00:00 2001 From: Menci Date: Tue, 6 Dec 2016 10:34:33 +0800 Subject: [PATCH] Add search problem to home page --- modules/api_v2.js | 2 +- views/index.ejs | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/modules/api_v2.js b/modules/api_v2.js index 833265f..a8fe357 100644 --- a/modules/api_v2.js +++ b/modules/api_v2.js @@ -43,7 +43,7 @@ app.get('/api/v2/search/problem/:keyword*?', async (req, res) => { } }); - result = result.map(x => ({ name: `#${x.id}. ${x.title}`, value: x.id })); + result = result.map(x => ({ name: `#${x.id}. ${x.title}`, value: x.id, url: syzoj.utils.makeUrl(['problem', x.id]) })); res.send({ success: true, results: result }); } catch (e) { syzoj.log(e); diff --git a/views/index.ejs b/views/index.ejs index 7c15e23..b25e90a 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -103,6 +103,16 @@ <% } %> +

搜索题目

+
+ +

近期比赛

<% if (!contests || !contests.length) { %> @@ -148,4 +158,18 @@
+ <% include footer %>