<template>
	<view class="setting">
		<view class="item u-flex u-row-between" @click="totext(1)">
			<text class="text">用户协议</text>
			<u-icon name="arrow-right" color="#CCCCCC"></u-icon>
		</view>
		<view class="item u-flex u-row-between" @click="totext(2)">
			<text class="text">隐私政策</text>
			<u-icon name="arrow-right" color="#CCCCCC"></u-icon>
		</view>
		<view class="item u-flex u-row-between" @click="showtocall = true">
			<text class="text">退出登录</text>
			<u-icon name="arrow-right" color="#CCCCCC"></u-icon>
		</view>
		<u-popup v-model="showtocall" mode="center" background="rgba(0,0,0,0)">
			<view class="tocall-box u-flex-col u-col-center">
				<image class="tocall-img" src="../../static/images/popup1-1.png" mode=""></image>
				<view class="u-flex-col u-col-center tocall-text">确定退出登录？</view>
				<view class="u-flex u-row-between tocall-btn">
					<text @click="showtocall = false">取消</text>
					<text @click="logout">确定</text>
				</view>
			</view>
		</u-popup>
	</view>
</template>

<script>
	export default {
		data(){
			return{
				showtocall:false
			}
		},
		onLoad() {
			
		},
		methods:{
			logout(){
				uni.clearStorageSync()
				this.$WebIM.conn.close()
				this.$u.toast("退出成功")
				setTimeout(() => {
					uni.navigateBack()
				},800)
			},
			totext(type){
				uni.navigateTo({
					url:"./xieyi?type=" + type
				})
			}
		}
	}
</script>

<style lang="scss">
	.setting{
		padding: 24rpx;
		.tocall-box {
			position: relative;
		
			.tocall-img {
				width: 650rpx;
				height: 476rpx;
			}
		
			.tocall-btn {
				position: absolute;
				bottom: 70rpx;
				left: 0;
				width: 100%;
				padding: 0 48rpx;
		
				text:first-child {
					width: 254rpx;
					line-height: 80rpx;
					background: rgba(31, 126, 255, 1);
					border-radius: 20rpx;
					text-align: center;
					font-size: 34rpx;
					font-family: PingFangSC-Medium, PingFang SC;
					font-weight: 500;
					color: #FFFFFF;
				}
		
				text:last-child {
					width: 254rpx;
					line-height: 80rpx;
					background: rgba(204, 204, 204, 1);
					border-radius: 20rpx;
					text-align: center;
					font-size: 34rpx;
					font-family: PingFangSC-Medium, PingFang SC;
					font-weight: 500;
					color: #FFFFFF;
					text-decoration: none;
				}
			}
		
			.tocall-text {
				text-align: center;
				font-size: 24rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #999999;
				position: absolute;
				top: 244rpx;
				left: 0;
				z-index: 10;
				width: 100%;
			}
		}
		.item{
			padding: 24rpx 0;
			border-bottom: 2rpx solid rgba(245, 245, 245, 1);
			.text{
				font-size: 24rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #333333;
			}
		}
	}
</style>