Skip to content

Commit

Permalink
feat:更新登录状态检测
Browse files Browse the repository at this point in the history
  • Loading branch information
mason369 committed Jan 18, 2023
1 parent f92d863 commit 92f796b
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 14 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "knock-ding-yanxuan",
"version": "1.3.0",
"version": "1.0.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
Expand Down
16 changes: 8 additions & 8 deletions src/components/Footer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,15 @@ img {
line-height: 24px;
}
.footer-phone p {
font-family: MicrosoftYaHei;
font-size: 14px;
font-weight: normal;
font-stretch: normal;
letter-spacing: 0px;
color: #7d879a;
font-family: MicrosoftYaHei;
font-size: 14px;
font-weight: normal;
font-stretch: normal;
letter-spacing: 0px;
color: #7d879a;
}
.footer-relation {
flex: 1;
margin-top: 86px;
flex: 1;
margin-top: 86px;
}
</style>
17 changes: 14 additions & 3 deletions src/components/TopBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,21 @@
import { mapMutations, mapState } from "vuex";
import { reqQrcodeLogin } from "@/request/api";
export default {
name: "TopBar",
data() {
return { cartTotal: 0 };
},
name : "TopBar",
watch: {
"$route.path": {
deep: true,
handler(newVal, oldVal) {
let sessionToken = sessionStorage.getItem("token");
this.setLoginStatus(Boolean(sessionToken));
console.log("路由变化了");
console.log(newVal, oldVal);
}
}
},
methods: {
...mapMutations({
setIsShowLoginModal: "isShowLoginModal/setIsShowLoginModal",
Expand All @@ -61,12 +72,12 @@ export default {
}
else if (res.code === 400) {
this.$message.error(res.msg);
setIsShowLoginModal(true);
this.setIsShowLoginModal(true);
}
else if (res.code === 407) {
this.$message.warning("请使用手机号绑定登录微信");
sessionStorage.setItem("loginUuid", res.uuid);
setIsShowLoginModal(true);
this.setIsShowLoginModal(true);
}
}
}, 100);
Expand Down
1 change: 1 addition & 0 deletions src/store/loginStatus/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export default {
namespaced: true,
actions : {},
mutations : {
//登录状态
setLoginStatus(state, payload) {
state.isLogined = payload;
}
Expand Down

0 comments on commit 92f796b

Please sign in to comment.