<template>
	<view class="center plr-25">
		<view class="overflow-y">
			<scroll-view scroll-y style="height: 100%;">
				<view class="flex-column br-12 fs-28 mt-30" style="background: #FFFFFF;">
					<text class="fs-32 fw-700 pad-30" style="text-align: left;">基本信息</text>
					<view class="flex-row-between pad-30" style="border-bottom: 1rpx solid #E9E9E9;">
						<text>姓名</text>
						<text>{{userInfo.accountName}}</text>
					</view>
					<view class="flex-row-between pad-30" style="border-bottom: 1rpx solid #E9E9E9;" @click="open">
						<text>性别</text>
						<view class="flex v-center">
							<text>{{userInfo.sex=='0'?"男":userInfo.sex=='1'?"女":"请选择"}}</text>
							<image class="w-25 h-30 ml-10" src="/static/icon_r.png"></image>
						</view>
					</view>
					<view class="flex-row-between pad-30" style="border-bottom: 1rpx solid #E9E9E9;">
						<text>手机号</text>
						<text>{{userInfo.mobile}}</text>
					</view>

				</view>
				<u-picker :show="show" :columns="columns" closeOnClickOverlay="true" @cancel="close" @close="close"
					@confirm="confirm"></u-picker>
			</scroll-view>
		</view>
		<view class="h-140 pt-20">
			<view class="fullscreen-btn" @click="onClick()">
				确定
			</view>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				show: false,
				columns: [
					['男', '女']
				],
				userInfo: ''

			};
		},
		onLoad(options) {
			this.userInfo = uni.getStorageSync('userInfo')
		},
		methods: {
			open() {
				this.show = true
			},
			close() {
				this.show = false
			},
			confirm(e) {
				this.show = false
				this.userInfo.sex = e.value[0] == "男" ? '0' : '1'
				this.setSex(this.userInfo.sex)
			},
			onClick() {
				this.$wskj.goBack(1)
			},
			setSex(e) {
				const params = {
					url: '/api/login/updateUserSex/' + e,
				}
				this.$request(params).then(res => {

				})
			},

		}
	};
</script>

<style>
	.center {
		height: 100vh;
		display: flex;
		flex-direction: column;
		background: #F2F2F2;
	}

	.item {
		width: 100%;
		height: 200rpx;
		margin-top: 20rpx;
	}

	.item2 {
		width: 100%;
		height: 150rpx;
		margin-top: 20rpx;
	}
</style>