diff --git a/App.vue b/App.vue
index ff6781c..1b36693 100644
--- a/App.vue
+++ b/App.vue
@@ -1,7 +1,7 @@
diff --git a/pages/profile/profile.vue b/pages/profile/profile.vue
index 2d67788..42e55c6 100644
--- a/pages/profile/profile.vue
+++ b/pages/profile/profile.vue
@@ -3,7 +3,10 @@
@@ -73,26 +76,19 @@
ℹ️
- 关于喝酒了么
+ 关于喝了么
›
-
-
-
- 🏠
- 首页
-
-
-
- +
-
-
-
- 👤
- 我的
-
+
+
+
+
@@ -124,7 +120,8 @@ export default {
stats: {},
achievementList: [],
showDetail: false,
- detailAchievement: {}
+ detailAchievement: {},
+ isGuest: false
}
},
computed: {
@@ -135,6 +132,7 @@ export default {
}
},
onShow() {
+ this.checkLoginState()
this.loadData()
},
methods: {
@@ -152,13 +150,38 @@ export default {
uni.showToast({ title: `${name}即将上线`, icon: 'none' })
},
goHome() {
- uni.reLaunch({ url: '/pages/index/index' })
+ uni.switchTab({ url: '/pages/index/index' })
},
goRecord() {
uni.navigateTo({ url: '/pages/record/record' })
},
- goProfile() {
- // 已在个人页面
+ checkLoginState() {
+ const isLoggedIn = uni.getStorageSync('is_logged_in')
+ const isGuest = uni.getStorageSync('is_guest')
+ if (!isLoggedIn || isLoggedIn !== 'true') {
+ uni.reLaunch({ url: '/pages/login/login' })
+ return
+ }
+ this.isGuest = isGuest === 'true'
+ },
+ handleLogout() {
+ uni.showModal({
+ title: '退出登录',
+ content: '退出后本地数据将保留,重新登录后可同步',
+ confirmText: '退出',
+ confirmColor: '#FF6B6B',
+ success: (res) => {
+ if (res.confirm) {
+ uni.removeStorageSync('is_logged_in')
+ uni.removeStorageSync('is_guest')
+ uni.removeStorageSync('user_info')
+ uni.reLaunch({ url: '/pages/login/login' })
+ }
+ }
+ })
+ },
+ goLogin() {
+ uni.navigateTo({ url: '/pages/login/login' })
}
}
}
@@ -167,7 +190,7 @@ export default {