Browse Source

refactor(common): 退出登录功能优化

- 重命名 logout函数为 loginOut,更符合中文命名习惯
- 在设置页面添加 loginOut 方法,实现退出登录功能
- 更新修改密码页面,使用新的 loginOut 方法
master
liutong 1 year ago
parent
commit
c6f795d710
  1. 6
      common/util.js
  2. 7
      pages/student/my/set_up.vue
  3. 2
      pages/student/my/update_pass.vue

6
common/util.js

@ -169,8 +169,8 @@ function openHomeView() {
})
}
//退出登陆
function logout() {
//退出登陆-清空缓存数据
function loginOut() {
//清除token
uni.removeStorageSync('token')
//清除用户信息
@ -185,7 +185,7 @@ function logout() {
module.exports = {
logout,
loginOut,
openHomeView,
formatTime,
formatDateTime,

7
pages/student/my/set_up.vue

@ -7,7 +7,7 @@
<view class="option">清空缓存</view>
<view style="width:90%;margin: 60rpx auto;">
<fui-button background="#29d3b4">退出账号</fui-button>
<fui-button background="#29d3b4" @click="loginOut()">退出账号</fui-button>
</view>
</view>
</template>
@ -20,6 +20,11 @@
}
},
methods: {
//退
loginOut(){
this.$util.loginOut()
},
privacy_agreement(type){
uni.navigateTo({
url: '/pages/common/privacy_agreement?type='+type

2
pages/student/my/update_pass.vue

@ -75,7 +75,7 @@
old_password: this.old_password,
}).then(res => {
if (res.code == 1) {
this.$util.logout();
this.$util.loginOut();
} else {
uni.showToast({
title: res.msg,

Loading…
Cancel
Save