| | |
| | | <view class="flex align-center justify-between solid-bottom margin-left-sm"> |
| | | <view class="title">退出登录</view> |
| | | <view class="flex align-center"> |
| | | <view class="desc">提问的艺术</view> |
| | | <u-icon name="error" color="#848B9E" size="16"></u-icon> |
| | | </view> |
| | | </view> |
| | |
| | | }) |
| | | }, |
| | | logout() { |
| | | uni.removeStorageSync('userInfo') |
| | | uni.removeStorageSync('token') |
| | | this.$store.commit('logout') |
| | | uni.navigateTo({ |
| | | url: this.tabbar.list[0].pagePath |
| | | }) |
| | | uni.showModal({ |
| | | title: '提示', |
| | | content: '确定退出登录吗?', |
| | | success: function (res) { |
| | | if (res.confirm) { |
| | | uni.removeStorageSync('userInfo') |
| | | uni.removeStorageSync('token') |
| | | this.$store.commit('logout') |
| | | uni.navigateTo({ |
| | | url: this.tabbar.list[0].pagePath |
| | | }) |
| | | } else if (res.cancel) { |
| | | console.log('用户点击取消'); |
| | | } |
| | | }.bind(this)//可处理uni.shuowModal的异步(即拿不到data里面数据的解决办法) |
| | | }); |
| | | |
| | | } |
| | | }, |
| | | }; |