From f49d36fca1e8282de83464c77eeeb12094e89c59 Mon Sep 17 00:00:00 2001 From: Ye Tian <yetian@student.unimelb.edu.au> Date: Sun, 31 May 2020 15:01:27 +0800 Subject: [PATCH] little change on current person id cookie getting method --- web/js/Project/project_display.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/web/js/Project/project_display.js b/web/js/Project/project_display.js index 42f0f48..5bb5937 100644 --- a/web/js/Project/project_display.js +++ b/web/js/Project/project_display.js @@ -2,8 +2,11 @@ //全局变量:当前登录用户的id var strcookie = document.cookie; -var userIdStr = strcookie.split(";")[0]; -var userId = userIdStr.split("=")[1]; +var userId = 0; +if(strcookie.length > 0){ + var userIdStr = strcookie.split(";")[0]; + userId = userIdStr.split("=")[1]; +} //全局变量: 选中用户的id,可能为0 var url = window.location.href; -- GitLab