From 3891588096f2a23812b2c2d5068aa87fb39546b9 Mon Sep 17 00:00:00 2001 From: ppambler Date: Tue, 28 Dec 2021 17:22:21 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=99=BB=E5=BD=95=20-=20?= =?UTF-8?q?=E5=88=A4=E6=96=AD=E7=94=A8=E6=88=B7=E7=99=BB=E5=BD=95=E7=8A=B6?= =?UTF-8?q?=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- project/imooc-blog/modules/user.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/project/imooc-blog/modules/user.js b/project/imooc-blog/modules/user.js index b22fa56..caa5ad8 100644 --- a/project/imooc-blog/modules/user.js +++ b/project/imooc-blog/modules/user.js @@ -98,5 +98,13 @@ export default { this.commit("user/removeToken"); this.commit("user/removeUserInfo"); }, + /** + * 进行登录判定 + */ + isLogin(context) { + if (context.state.token) return true; + // TODO: 如果用户未登录,则引导用户进入登录页面 + return false; + }, }, };