<template>
	<view class="site">
		<view class="site-hd">
			<view class="item" @click="openPage('/pages/users/yinsi/index')">
				<view class="a">隐私设置</view>
				<view class="b">
					<image src="@/static/icon-arrow.png"></image>
				</view>
			</view>
			<view class="item" @click="openPage('/pages/users/notice/index')">
				<view class="a">新消息通知</view>
				<view class="b">
					<image src="@/static/icon-arrow.png"></image>
				</view>
			</view>
			<view class="item" @click="openPage('/pages/users/qingshaonian/index')">
				<view class="a">青少年模式</view>
				<view class="b">{{userInfo.teenageMode == 0?'未开启':'已开启'}}
					<image src="@/static/icon-arrow.png"></image>
				</view>
			</view>
			<view class="item" @click="openPage('/pages/login/password')">
				<view class="a">修改密码</view>
				<view class="b">
					<image src="@/static/icon-arrow.png"></image>
				</view>
			</view>
			<view class="item" @click="openPage('/pages/users/dashan/index')">
				<view class="a">搭讪语设置</view>
				<view class="b">
					<image src="@/static/icon-arrow.png"></image>
				</view>
			</view>
		</view>
		<view class="site-hd">
			<view class="item" @click="openPage('/pages/xiaoxi/heimingdan')">
				<view class="a">黑名单</view>
				<view class="b">
					<image src="@/static/icon-arrow.png"></image>
				</view>
			</view>
		</view>
		<view class="site-hd">
			<view class="item" @click="openPage('/pages/users/about/index?type=CONFIG_ABOUT_AS')">
				<view class="a">关于我们</view>
				<view class="b">
					<image src="@/static/icon-arrow.png"></image>
				</view>
			</view>
			<view class="item" @click="openPage('/pages/users/about/index?type=CONFIG_PRIVACY_POLICY')">
				<view class="a">隐私协议</view>
				<view class="b">
					<image src="@/static/icon-arrow.png"></image>
				</view>
			</view>
			<view class="item" @click="openPage('/pages/users/about/index?type=CONFIG_USER_AGREEMENT')">
				<view class="a">用户协议</view>
				<view class="b">
					<image src="@/static/icon-arrow.png"></image>
				</view>
			</view>
			<view class="item" @click="openPage('/pages/users/zhuxiao/index')">
				<view class="a">注销账号</view>
				<view class="b">
					<image src="@/static/icon-arrow.png"></image>
				</view>
			</view>
		</view>
		<view class="site-fd">
			<view class="btn" @click="toLoginOut()">退出登录</view>
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				isPopup: false,
				userInfo: {},
			};
		},
		onShow() {
			this.getUserInfo();
		},
		methods: {
			//查询个人信息
			async getUserInfo() {
				const { code, data , msg } = await this.$api.findUserInfo({userId: uni.getStorageSync("userInfo").id});
				if(code == 200){
					this.userInfo = data;
					uni.setStorageSync("userInfo",data);
				}else{
					uni.showToast({
						title: msg,
						position: "bottom",
						icon: "none",
					})
				}
			},
			openPage(url){
				uni.navigateTo({
					url
				})
			},
			toLoginOut() {
				const that = this;
				uni.showModal({
					title: "温馨提示",
					content: "是否确认退出登录?",
					confirmColor: "#000",
					success(res){
						if(res.confirm){
							uni.clearStorageSync();
							uni.showToast({
								title: "退出成功"
							})
							uni.closeSocket();
							setTimeout(()=>{
								uni.reLaunch({
									url: "/pages/login/index"
								})
							},2000)
						}
					}
				})
			},
		}
	}
</script>

<style lang="scss">
.site{
	padding: 0 25rpx;
	overflow: hidden;
	padding-bottom: 110rpx;
	
	&-hd{
		width: 100%;
		background: #FFFFFF;
		border-radius: 20rpx;
		margin-top: 20rpx;
		padding: 0 30rpx;
		box-sizing: border-box;
		.item{
			padding: 40rpx 0;
			border-top: 1px solid #EAEAEA;
			display: flex;
			align-items: center;
			justify-content: space-between;
			&:first-child{
				border-top-color: #FFFFFF;
			}
			.a{
				font-weight: 500;
				font-size: 30rpx;
				color: #333333;
			}
			.b{
				flex: 1;
				text-align: right;
				font-weight: 500;
				font-size: 30rpx;
				color: #999999;
				display: flex;
				align-items: center;
				justify-content: flex-end;
				image{
					margin-left: 20rpx;
					width: 30rpx;
					height: 30rpx;
				}
			}
		}
	}
	&-fd{
		background-color: #F3F4F5;
		width: 100%;
		padding: 30rpx 25rpx;
		box-sizing: border-box;
		position: fixed;
		left: 0;
		bottom: 0;
		z-index: 22;
		.btn{
			width: 100%;
			line-height: 98rpx;
			background: linear-gradient(0deg, #000000, #3D3B38);
			box-shadow: 0px 4rpx 18rpx 0px rgba(42,41,39,0.34);
			border-radius: 98rpx;
			text-align: center;
			font-weight: 400;
			font-size: 30rpx;
			color: #FFFFFF;
			letter-spacing: 5rpx;
		}
	}
}
</style>
