<template>
	<view>
		<view class="width100 backcorfff height100p mart10">
			<view class="width94 fcor333 font16 paddtop10">{{userInfo.secUser.loginName}}</view>
			<!-- <view class="width94 fcor999 font14 paddtop10">xxx</view> -->
			<view class="width94 fcor999 font14  paddtop10">{{userInfo.secUser.userName}}｜{{userInfo.secRole.roleName}}</view>
		</view>
		<!-- <view class="width100 backcorfff mart15" @click="jumpbankjs">
			<view class="notes">
				<view class="fcor666 width90p">结算银行账户</view>
				<image src="../../../static/img/jtg.png" mode="widthFix" class="iconw"></image>
			</view>
		</view> -->
		<wButton class="mart60" text="退 出 登 录" bgColor="#089bf5" :rotate="isRotate" @click="exitLogin"></wButton>
	</view>
</template>
<script>
	import wButton from '../../../components/watch-login/watch-button.vue' //button
	import {
		logout
	} from '../../../Utils/Api.js';
	let app = getApp();
	export default {
		components: {
			wButton
		},
		data() {
			return {
				isRotate: false, //是否加载旋转
				userInfo: app.globalData.userInfo //用户信息
			}
		},
		onLoad() {

		},
		methods: {
			//退出登录
			exitLogin() {
				uni.showModal({
					title: '退出登录',
					content: '是否确认退出当前账号',
					success: (res) => {
						if (res.confirm) {
							uni.showLoading({
								title: '退出中...'
							})
							this.isRotate = true;
							logout().then(res => {
								uni.hideLoading();
								if (res.return_code == '000000') {
									this.isRotate = false;
									app.globalData.userInfo = '';
									app.globalData.token = '';
									uni.removeStorage({
										key: "payuser"
									})
									uni.removeStorage({
										key: "paytoken"
									})
									uni.removeStorage({
										key: "clientId"
									})
									uni.reLaunch({
										url: '../../login/login'
									})
								}
							})
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					}
				});
			},
			//跳转结算银行账户
			jumpbankjs() {
				uni.showToast({
					title: '暂未开通',
					duration: 2000,
					icon: 'none'
				})
			}
		}
	}
</script>
<style lang="scss">
	page {
		background-color: #f6f6f6;
	}

	.notes {
		width: calc(100% - 40rpx);
		display: flex;
		align-items: center;
		padding: 30rpx 0 30rpx 20rpx;
		border-bottom: 1px solid #f6f6f6;
	}
</style>
