<template>
	<view class="setting">
		<view class="setting-box">
			<view class="setting-row u-flex u-row-between" @click="tochangetel">
				<text class="text">手机号</text>
				<input class="input" type="text" placeholder="" :value="mobile.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2')" :disabled="true">
				<u-icon name="arrow-right" color="rgba(76, 76, 76, 0.6)"></u-icon>
			</view>
			<view class="setting-row u-flex u-row-between" @click="tochangepwd">
				<text class="text">修改密码</text>
				<u-icon name="arrow-right" color="rgba(76, 76, 76, 0.6)"></u-icon>
			</view>
		</view>
		<u-gap height="20"></u-gap>
		<view class="setting-box">
			<view class="setting-row u-flex u-row-between" @click="toxiaoxi">
				<text class="text">消息通知</text>
				<u-icon name="arrow-right" color="rgba(76, 76, 76, 0.6)"></u-icon>
			</view>
			<view class="setting-row u-flex u-row-between" @click="tozhaohu">
				<text class="text">打招呼语</text>
				<u-icon name="arrow-right" color="rgba(76, 76, 76, 0.6)"></u-icon>
			</view>
		</view>
		<u-gap height="20"></u-gap>
		<view class="setting-box">
			<view class="setting-row u-flex u-row-between" @click="toxieyi(1)">
				<text class="text">用户协议</text>
				<u-icon name="arrow-right" color="rgba(76, 76, 76, 0.6)"></u-icon>
			</view>
			<view class="setting-row u-flex u-row-between" @click="toxieyi(2)">
				<text class="text">隐私政策</text>
				<u-icon name="arrow-right" color="rgba(76, 76, 76, 0.6)"></u-icon>
			</view>
		</view>
		<u-gap height="20"></u-gap>
		<view class="login-out" @click="outlogin">
			退出登录
		</view>
	</view>
</template>

<script>
	import {index} from "@/units/inquire.js"
	export default {
		data() {
			return {
				mobile: '',
			}
		},
		onShow() {
			this.getuser()
		},
		methods: {
			toxieyi(type) {
				uni.navigateTo({
					url: "/pagesA/xieyi?type=" + type
				})
			},
			outlogin() {
				uni.showModal({
					title: "提示",
					content: "确认退出吗？",
					success: (e) => {
						if (e.confirm) {
							uni.clearStorageSync()
							uni.reLaunch({
								url: "/pages/login/login"
							})
						}
					}
				})
			},
			getuser() {
				index().then(res => {
					this.mobile = res.data.mobile
				})
			},
			tozhaohu() {
				uni.navigateTo({
					url: "/pagesD/zhaohu"
				})
			},
			toxiaoxi() {
				uni.navigateTo({
					url: "/pagesD/xiaoxi"
				})
			},
			tochangetel() {
				uni.navigateTo({
					url: "/pagesD/change-tel"
				})
			},
			tochangepwd() {
				uni.navigateTo({
					url: "/pagesD/change-pwd"
				})
			}
		}
	}
</script>

<style lang="scss">
	.setting {
		.login-out {
			line-height: 92rpx;
			background: #FFFFFF;
			text-align: center;
			font-size: 32rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			font-weight: 400;
			color: #FF3F3F;
		}

		.setting-box {
			background-color: #fff;
			padding: 0 32rpx;

			.setting-row {
				height: 124rpx;
				border-bottom: 2rpx solid #F0F0F0;

				.text {
					font-size: 32rpx;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;
					color: #222222;
				}

				.input {
					flex: 1;
					text-align: right;
					font-size: 32rpx;
					margin: 0 8rpx;
				}
			}
		}
	}

	page {
		background-color: #F3F3F3;
	}
</style>