<template>
	<view class="page">
		<uni-nav-bar  :fixed="true" background-color="#FFE05C" :border="false" :statusBar="true"  left-icon="left" title="个人信息" @clickLeft="back" />

		<view class="outView">

			<form>

				<view class="flex-row justify-between bordBot" >
					<view class="key flex-col justify-center ">
						<text>头像</text>
					</view>
					<view class="photoView">
						<image class="photoImage" :src="userInfo.avatarUrl || '/static/ud4.png'"></image>
					</view>
				</view>

				<view class="flex-row justify-between bordBot" >
					<view class="key flex-col justify-center ">
						<text>姓名</text>
					</view>
					<view class="nikeName flex-col justify-center">
						<input disabled type="nickname" name="nickname" v-model="userInfo.name"   placeholder="请输入昵称"/>
					</view>
				</view>

				<view class="flex-row justify-between bordBot" >
					<view class="key flex-col justify-center ">
						<text>性别</text>
					</view>
						<view class="flex-row justify-end groupItemContent">
							<text v-if="userInfo.sex == 0">男</text>
							<text v-else-if="userInfo.sex == 1">女</text>
							<text v-else>未知</text>
<!--							<u-icon name="arrow-right" color="#666" size="18"></u-icon>-->
						</view>
				</view>

				<view class="flex-row justify-between bordBot" >
					<view class="key flex-col justify-center ">
						<text>手机号</text>
					</view>
					<view class="flex-row justify-end groupItemContent" @click="settingTelphone">
						<text>{{userInfo.phonenumber? userInfo.phonenumber : '' }}</text>
<!--						<u-icon name="arrow-right" color="#666" size="18"></u-icon>-->
					</view>
				</view>
				<view class="flex-row justify-between bordBot" >
					<view class="key flex-col justify-center ">
						<text>修改密码</text>
					</view>
					<view class="flex-row justify-end groupItemContent " @click="updatePassword">
						<text>点击修改</text>
						<u-icon name="arrow-right" color="#666" size="18"></u-icon>
					</view>
				</view>
			</form>
		</view>

		<view  class="logoutButton">
			<u-button type="error" text="退出登录" @click="logout"></u-button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				photoUrl:'',
				userInfo: {},
				genderIndex:0,
				genderList: [{gender:'男',id:'0'},
					{gender:'女',id:'1'},
					{gender:'未知',id:'2'}],
			};
		},
		mounted() {
		},
		onShow() {


			// 用户信息
			this.userInfo = uni.getStorageSync('userInfo')

			console.log(this.userInfo)


		},
		methods: {

			updatePassword(){

				uni.navigateTo({
					url:'/pages/updatePassword/updatePassword'
				})

			},
			back() {
				uni.navigateBack({
					delta: 1
				})
			},
			logout(){
				this.$api.login.logout().then(res=>{
					uni.clearStorageSync();
					uni.navigateTo({
						url:'/pages/login/login'
					})
				})
			}

		}
	};
</script>

<style lang="scss">
	@import './index.rpx.css';
</style>
