From dc47758f3b7cc8e0586639bae30909bee0319daa Mon Sep 17 00:00:00 2001
From: liutong <836164388@qq.com>
Date: Fri, 21 Mar 2025 10:44:22 +0800
Subject: [PATCH] =?UTF-8?q?feat(login):=20=E4=BC=98=E5=8C=96=E7=94=A8?=
=?UTF-8?q?=E6=88=B7=E7=99=BB=E5=BD=95=E6=B5=81=E7=A8=8B=E5=92=8C=E7=BC=93?=
=?UTF-8?q?=E5=AD=98=E5=A4=84=E7=90=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 清除用户类型和底部菜单选中状态
- 修复教练登录后跳转至学生首页的问题
- 优化退出账号功能
-调整 AQTabber 组件初始化逻辑
---
common/util.js | 3 +++
components/AQ/AQTabber.vue | 4 +---
pages/coach/my/set_up.vue | 12 +++++++++++-
pages/student/login/login.vue | 11 +++++++++--
4 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/common/util.js b/common/util.js
index df1039b..ae2e464 100644
--- a/common/util.js
+++ b/common/util.js
@@ -178,6 +178,9 @@ function loginOut() {
//清除用户类型
uni.removeStorageSync('userType')
+ //底部菜单选中
+ uni.removeStorageSync('tabBerIndex')
+
uni.navigateTo({
url: '/pages/student/login/login'
})
diff --git a/components/AQ/AQTabber.vue b/components/AQ/AQTabber.vue
index a902e08..e313ffa 100644
--- a/components/AQ/AQTabber.vue
+++ b/components/AQ/AQTabber.vue
@@ -50,12 +50,10 @@
methods: {
async init() {
- uni.setStorageSync('userType', '3')
-
let userType = uni.getStorageSync('userType')
this.userType = userType
+ let tabBerIndex = uni.getStorageSync('tabBerIndex')// tabBerIndex=0|从左数第1个按钮
- let tabBerIndex = uni.getStorageSync('tabBerIndex')
if (tabBerIndex) {
this.tabBerIndex = String(tabBerIndex)
} else {
diff --git a/pages/coach/my/set_up.vue b/pages/coach/my/set_up.vue
index 31e3566..6132536 100644
--- a/pages/coach/my/set_up.vue
+++ b/pages/coach/my/set_up.vue
@@ -8,7 +8,7 @@
清空缓存
- 退出账号
+ 退出账号
@@ -21,6 +21,16 @@
}
},
methods: {
+ //退出登陆
+ logOut(){
+ //清空用户缓存数据
+ uni.removeStorageSync('userInfo');
+ //跳转登陆页面
+ uni.navigateTo({
+ url: '/pages/student/login/login'
+ })
+ },
+
privacy_agreement(type){
uni.navigateTo({
url: '/pages/common/privacy_agreement?type='+type
diff --git a/pages/student/login/login.vue b/pages/student/login/login.vue
index b04cd22..6a7bdbc 100644
--- a/pages/student/login/login.vue
+++ b/pages/student/login/login.vue
@@ -71,9 +71,16 @@
memberApi.login(item).then(res => {
if (res.code == 1) {
uni.setStorageSync('token', res.data.token);
- uni.setStorageSync('userType', res.data.userType);
+ let userType = res.data.userType
+
+ userType = 1
+
+ uni.setStorageSync('userType', userType);
+ uni.setStorageSync('tabBerIndex', 0);
+
+ // uni.setStorageSync('userType', res.data.userType);
let url_path = ''
- switch (String(res.data.userType)) {
+ switch (String(userType)) {
case '1': //教练
url_path = '/pages/coach/home/index'
break;