<template>
	<view class="setlist">
		<view @click="gouserzl">
			<view>个人资料</view>
			<view>
				<!-- <view>123</view> -->
				<image src="../../static/youshou.png"></image>
			</view>
		</view>
		<view @click="gorealname">
			<view>实名认证</view>
			<view>
				<view v-if="sfsmrz">已认证</view>
				<view v-if="!sfsmrz">未认证</view>
				<image src="../../static/youshou.png"></image>
			</view>
		</view>
		<view @click="goxieyi">
			<view>用户协议</view>
			<view>
				<!-- <view>123</view> -->
				<image src="../../static/youshou.png"></image>
			</view>
		</view>
		<view @click="goyinshi">
			<view>隐私政策</view>
			<view>
				<!-- <view>123</view> -->
				<image src="../../static/youshou.png"></image>
			</view>
		</view>
<!-- 		<view @click="zhuxiao">
			<view>注销账户</view>
			<view>
				<image src="../../static/youshou.png"></image>
			</view>
		</view> -->
		<view @click="tuichu">
			<view>退出登录</view>
			<view>
				<!-- <view>123</view> -->
				<image src="../../static/youshou.png"></image>
			</view>
		</view>
	</view>
</template>

<script>
	import {ref} from 'vue'
	export default {
		onShow() {
			this.sfsmrz=uni.getStorageSync('users').realNameState
		},
		setup() {
			console.log(uni.getStorageSync('users'));
			let sfsmrz = ref('')
			sfsmrz.value=uni.getStorageSync('users').realNameState
			function gouserzl() {
				uni.navigateTo({
					url: '../userzhiliao/userzhiliao'
				})
			}

			function gorealname() {
				if (sfsmrz.value) {
					uni.navigateTo({
						url: '../realname/realname?issm=true'
					})
				} else {
					uni.navigateTo({
						url: '../realname/realname?issm=false'
					})
				}
			}

			function tuichu() {
				uni.showModal({
					title: '提示',
					content: '确认退出登录？',
					success: function (res) {
						if (res.confirm) {
							uni.removeStorageSync('users')
							uni.removeStorageSync('token')
							uni.removeStorageSync('createToken')
							uni.showToast({
								title:'退出成功',
								icon:'success',
								duration:2000
							})
							setTimeout(()=>{
								uni.navigateTo({
									url:'../index/index'
								})
							},2000)
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					}
				});
				
			}

			function goxieyi() {
				uni.navigateTo({
					url: '../yhxy/yhxy'
				})
			}

			function goyinshi() {
				uni.navigateTo({
					url: '../ysxy/ysxy'
				})
			}
			return {
				gouserzl,
				gorealname,
				tuichu,
				goyinshi,
				goxieyi,
				sfsmrz
			}
		}
	}
</script>

<style lang="scss">
	.setlist {
		width: 100%;
		// height: 772upx;
		// background: #23262F;
		border-radius: 12upx;
		// padding: 32upx;
		box-sizing: border-box;
		display: flex;
		flex-direction: column;
		align-items: center;
		// justify-content: space-between;
		margin: auto;

		>view {
			width: 672upx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			color: #ffffff;
			font-size: 28upx;
			font-weight: 400;
			color: #FFFFFF;
			padding-top: 44upx;
			padding-bottom: 44upx;
			border-bottom: 1upx solid #373737;

			&:nth-of-type(1) {
				padding-top: 12upx;
			}

			&:nth-last-child(1) {
				border-bottom: none;
				padding-bottom: 24upx;
			}

			>view {
				display: flex;
				align-items: center;
				box-sizing: border-box;

				>image {
					width: 36upx;
					height: 36upx;
					margin-left: 8upx;
				}

				>view {
					font-size: 24upx !important;
				}
			}
		}
	}

	page {
		padding-top: 50upx;
		background-color: #141417;
	}
</style>
