1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <template>
- <view>
- <button @click="loginOut">退出登录</button>
- <button @click="logOff">注销</button>
- </view>
- </template>
- <script>
- import {
- logOffApi
- } from "@/api/user.js"
- export default {
- data() {
- return {
- }
- },
- methods: {
- loginOut() {
- wx.removeStorageSync('userInfo')
- wx.removeStorageSync('userId')
- wx.removeStorageSync('token')
- getApp().globalData.hasLogin = false;
- wx.switchTab({
- url: '/pages/mine/mine'
- })
- },
- logOff() {
- wx.showModal({
- title: '确认注销账号?',
- content: '注销账号后xxxxx',
- success: (res) => {
- if (res.confirm) {
- console.log('用户点击确定')
- logOffApi().then(res => {
- wx.removeStorageSync('userInfo')
- wx.removeStorageSync('userId')
- wx.removeStorageSync('token')
- getApp().globalData.hasLogin = false;
- wx.switchTab({
- url: '/pages/mine/mine'
- })
- })
- } else if (res.cancel) {
- console.log('用户点击取消')
- }
- }
- })
- }
- }
- }
- </script>
- <style>
- </style>
|