<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;
				this.hasLogin = false
			},
			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;
								this.hasLogin = false
							})
						} else if (res.cancel) {
							console.log('用户点击取消')
						}
					}
				})
			}
		}
	}
</script>

<style>

</style>