<template>
	<view class="uni-page">
		<u-navbar title="设置" autoBack placeholder bg-color="#fff0e7"></u-navbar>
		
		<u-button class="v-btn" type="warning" plain shape="circle"  @click="logout">退出登录</u-button>
		<u-modal
			showCancelButton
			:show="show" 
			:title="title" 
			:content="content" 
			:cancelText="cancelText" 
			:confirmText="confirmText"
			confirmColor="#E08745"
			@cancel="show = false"
			@confirm="confirmLogout"
		>
		</u-modal>
	</view>
</template>

<script>
	import { onLogout } from '@/request/yyf.js';
	export default {
		data() {
			return {
				show: false, // 弹窗状态
				title: "警告",
				content: "确认退出登录吗？",
				confirmText: "确认",
				cancelText: "取消",
			}
		},
		methods: {
			logout() {
				this.show = true;
			},
			async confirmLogout() {
				await onLogout();
				uni.clearStorageSync();
				this.$Router.replace('/pages/index/index');
			}
		}
	}
</script>

<style lang="scss" scoped>
.v-btn {
	margin-top: 200rpx;
	background-color: transparent;
	color: #000 !important;
}
</style>
