<template>
	<view>
		<cu-custom bgColor="bg-white" :isBack="true">
			<block slot="content">
				我的账号
			</block>
		</cu-custom>

		<view class="flex  align-center justify-between" style="margin-top: 15rpx; background-color: white;"
			@tap="chooseImage()">
			<view class=""
				style="border-bottom: #EEEEEE 1rpx; padding-left: 40rpx;padding-top: 30rpx; padding-bottom: 30rpx;font-size: 30rpx;">
				头像
			</view>
			<view class="flex align-center">
				<view class="">
					<image :src="userInfo.avatar" mode="" v-if="userInfo.avatar"
						style="border-radius: 100rpx;width: 80rpx;height: 80rpx;margin-right: 10rpx;"></image>
					<image src="../../../static/dq1.png" mode="" v-else
						style="border-radius: 100rpx;width: 80rpx;height: 80rpx;margin-right: 10rpx;"></image>
				</view>
				<view class="">
					<u-icon name='arrow-right' class="right_icon" style="margin-right: 20rpx;"> </u-icon>
				</view>
			</view>
		</view>

		<view class="flex  align-center justify-between" style="background-color: white; ">
			<view class=""
				style="border-bottom: #EEEEEE 1rpx;padding-left: 40rpx;padding-top: 30rpx;padding-bottom: 30rpx; font-size: 30rpx;">
				用户名
			</view>
			<view class="flex align-center" @tap="jumpUpdateUserName()">
				<view class="">
					{{userInfo.nikeName}}
				</view>
				<view class="">
					<u-icon name='arrow-right' class="right_icon" style="margin-right: 20rpx;"> </u-icon>
				</view>
			</view>
		</view>

		<view class="flex  align-center justify-between" style="background-color: white; ">
			<view class=""
				style="border-bottom: #EEEEEE 1rpx;padding-left: 40rpx;padding-top: 30rpx;padding-bottom: 30rpx;font-size: 30rpx;">
				手机号
			</view>
			<view class="flex align-center">
				<view class="">
					{{userInfo.phone}}
				</view>
				<view class="">
					<u-icon class="" style="margin-right: 20rpx;"> </u-icon>
				</view>
			</view>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				userInfo: {},
				memberId: uni.getStorageSync('userInfo').memberId
			}
		},
		onShow() {
			this.getUserInfo()
		},
		methods: {
			getUserInfo() {
				this.$u.api.getUserInfo(this.memberId).then(res => {
					console.log(res)
					if (res.code === 200) {
						this.userInfo = res.data
					}
				})
			},
			///1.底部弹出相机和相册
			chooseImage() {
				var _this = this
				uni.chooseImage({
					count: 1, //默认9
					sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
					sourceType: ['album', 'camera'], //从相册选择、摄像头
					success: function(res) {
						_this.imgShow = res.tempFilePaths[0]
					}
				});
				// ass()
			},
			///2.进入修改用户名称页面
			jumpUpdateUserName() {
				uni.navigateTo({
					url: "/pages/mine/minePage/updateUserName?name="+this.userInfo.nikeName,
				});
			}
		}
	}
</script>

<style>

</style>
