hookehuyr

🐞 fix(用户登录): 如果丢失token,我的信息页面需要重新登录

1 <!-- 1 <!--
2 * @Date: 2024-10-18 18:00:47 2 * @Date: 2024-10-18 18:00:47
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-12-11 17:36:43 4 + * @LastEditTime: 2024-12-16 14:21:04
5 * @FilePath: /hager/src/views/user/info.vue 5 * @FilePath: /hager/src/views/user/info.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -87,6 +87,11 @@ export default { ...@@ -87,6 +87,11 @@ export default {
87 async getUserInfo () { 87 async getUserInfo () {
88 const { code, data } = await getUserInfoAPI(); 88 const { code, data } = await getUserInfoAPI();
89 if (code === 1) { // 已登录 89 if (code === 1) { // 已登录
90 + if (data === null) {
91 + this.$router.push({
92 + path: '/user/login',
93 + })
94 + }
90 this.email = data.email; 95 this.email = data.email;
91 this.username = data.username; 96 this.username = data.username;
92 this.tel = data.mobile; 97 this.tel = data.mobile;
...@@ -95,6 +100,8 @@ export default { ...@@ -95,6 +100,8 @@ export default {
95 } 100 }
96 }, 101 },
97 onHandle () { 102 onHandle () {
103 + // 获取用户信息
104 + this.getUserInfo();
98 this.status = 'edit'; 105 this.status = 'edit';
99 }, 106 },
100 async onSubmit () { 107 async onSubmit () {
......