From abc4d97d9d8a9ca43b7ee9631eaa81f1ec3d2d6f Mon Sep 17 00:00:00 2001 From: zjz1993 <1429595365@qq.com> Date: Wed, 31 Jul 2019 14:27:14 +0800 Subject: [PATCH] =?UTF-8?q?bugfix:=20=E7=A6=81=E6=AD=A2=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E7=9A=84=E6=97=B6=E5=80=99=E4=BB=A5=E7=A9=BA=E6=A0=BC=E4=BD=9C?= =?UTF-8?q?=E4=B8=BA=E6=98=B5=E7=A7=B0=EF=BC=8C=E5=9C=A8=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E9=A1=B5=E6=97=A0=E6=98=B5=E7=A7=B0=E7=9A=84=E6=97=B6=E5=80=99?= =?UTF-8?q?=E4=BB=A5=E7=94=A8=E6=88=B7=E5=90=8D=E6=9B=BF=E4=BB=A3=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/api.js | 2 +- views/ranklist.ejs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/api.js b/modules/api.js index 0ece71e..962f776 100644 --- a/modules/api.js +++ b/modules/api.js @@ -72,7 +72,7 @@ app.post('/api/sign_up', async (req, res) => { user = await User.findOne({ where: { email: req.body.email } }); if (user) throw 2009; - if (!req.body.nickname) { + if (!req.body.nickname.trim()) { res.send({ error_code: 2300, message : "昵称不能为空" diff --git a/views/ranklist.ejs b/views/ranklist.ejs index 1fd1afa..d461995 100644 --- a/views/ranklist.ejs +++ b/views/ranklist.ejs @@ -39,7 +39,7 @@ %> <%= i %> - <%= user.nickname %><% if (user.nameplate) { %><%- user.nameplate %><% } %> + <% if(!user.nickname || user.nickname.trim() === '') { %> <%= user.username %> <% } else { %> <%= user.nickname %> <% } %><% if (user.nameplate) { %><%- user.nameplate %><% } %> <%= user.ac_num %> <%= user.submit_num %> <%= user.ac_num && user.submit_num ? Math.round(user.ac_num / user.submit_num * 10000) / 100.00 + "%" : 0%>