<template>
	<view class="setting">
		<!-- 占位元素 -->
		<view style="height: 24rpx;"></view>
		<!-- 列表 -->
		<view class="cell">
			<view class="cell_item" @click="goPrivacy">
				<text>隐私政策</text>
				<image src="/static/icon/right.png"></image>
			</view>
			<view class="cell_item" @click="goUser">
				<text>用户协议</text>
				<image src="/static/icon/right.png"></image>
			</view>
			<view class="cell_item" @click="goVerfication">
				<text>核销中心</text>
				<image src="/static/icon/right.png"></image>
			</view>
		</view>
		<!-- 按钮 -->
		<view class="btn" @click="loginOut">
			<text>退出登录</text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {

			}
		},
		methods: {
			// 跳转隐私政策
			goPrivacy() {
				uni.navigateTo({
					url: '/pages/my/protocol/PrivacyPolicy'
				})
			},
			// 跳转用户协议
			goUser() {
				uni.navigateTo({
					url: '/pages/my/protocol/UserAgreement'
				})
			},
			// 跳转核销中心
			goVerfication() {
				uni.navigateTo({
					url: '/pages/my/verification/verification'
				})
			},
			// 退出登录
			loginOut() {
				if (this.$store.getters.token) {
					//记录用户曾经登录过
					this.$store.getters.userInfo.isLoginOff = true
					this.$store.dispatch("user/info", this.$store.getters.userInfo)
					// this.$store.dispatch("user/token", null)
					// uni.removeStorageSync('auth_token')
					// uni.removeStorageSync('userInfo')
					uni.reLaunch({
						url:'/pages/login/login'
					})
				} else {
					uni.showToast({
						title: '请先登录!',
						icon: 'error'
					})
				}

			}
		}
	}
</script>

<style lang="scss" scoped>
	$pageColor:#F9F9F9;
	$bgColor:#FFFFFF;

	@mixin flexlayout {
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.setting {
		height: 100%;
		background: $pageColor;
	}

	.cell {
		width: 750rpx;
		height: 336rpx;
		border-radius: 16rpx;
		padding: 0 30rpx;
		background: $bgColor;
		margin-bottom: 48rpx;

		.cell_item {
			box-sizing: border-box;
			height: 110rpx;
			width: 690rpx;
			border-bottom: solid 2rpx #F0F0F0;
			display: flex;
			align-items: center;
			position: relative;

			text {
				font-size: 30rpx;
				font-family: PingFang-SC-Medium, PingFang-SC;
				font-weight: 500;
				color: #000000;
			}

			image {
				width: 12rpx;
				height: 20rpx;
				position: absolute;
				right: 0rpx;
				top: 46rpx;
			}
		}

		.cell_item:nth-last-child(1) {
			box-sizing: border-box;
			height: 110rpx;
			width: 690rpx;
			border-bottom: solid 0rpx #F0F0F0;
			display: flex;
			align-items: center;
			position: relative;

			text {
				font-size: 30rpx;
				font-family: PingFang-SC-Medium, PingFang-SC;
				font-weight: 500;
				color: #000000;
			}

			image {
				width: 12rpx;
				height: 20rpx;
				position: absolute;
				right: 0rpx;
				top: 46rpx;
			}
		}

	}

	.btn {
		width: 690rpx;
		height: 92rpx;
		background: $bgColor;
		border-radius: 16rpx;
		margin-left: 30rpx;

		@include flexlayout() text {
			font-size: 28rpx;
			font-family: PingFang-SC-Medium, PingFang-SC;
			font-weight: 500;
			color: #333333;
		}
	}
</style>
