diff --git a/README.md b/README.md index 60d30ad..a55ca49 100644 --- a/README.md +++ b/README.md @@ -113,7 +113,15 @@ this.$store.commit('setToken') this.$store.commit('setLoginOut') // 获取登录的用户信息 this.$store.state.userInfo -// 是否需要登录拦截 -this.$isLoginValidate(); + +// 登录拦截 +// 示例:点击购买课程前需要判断当前用户是否登录 +function onPurchaseCourse() { + if (!this.$isLoginValidate()) { + return; + } + // 此处省略其他业务代码... +} + ``` diff --git a/components/BsLogin.vue b/components/BsLogin.vue index 18896fc..04f2469 100644 --- a/components/BsLogin.vue +++ b/components/BsLogin.vue @@ -147,7 +147,11 @@ export default { Message.error("请勾选同意《用户协议》和《隐私协议》"); return; } - const { result } = await ApiPostLogin({ ...this.form }); + const { result } = await ApiPostLogin({ + ...this.form, + clientId: 1, + systemId: 1, + }); if (result) { this.dialogTableVisible = false; this.$store.commit("setToken", result.token); diff --git a/layouts/module/header/HeaderInfoBar.vue b/layouts/module/header/HeaderInfoBar.vue index a62300b..aef98a2 100644 --- a/layouts/module/header/HeaderInfoBar.vue +++ b/layouts/module/header/HeaderInfoBar.vue @@ -6,33 +6,42 @@