<template>
	<view>
		<view class="tab">
			<view class="tab_item" :class="active == 1?'active':''" @click="click_item(1)">基本信息</view>
			<view class="tab_item" :class="active == 2?'active':''" @click="click_item(2)">初始学历</view>
			<view class="tab_item" :class="active == 3?'active':''" @click="click_item(3)">最高学历</view>
		</view>
		<view class="content">
			<view v-if="active == 1" class="inner">
				<view class="item">
					<view class="item_left">个人照片</view>
					<view class="item_right" @click="upload()">
						<image src="./icon/user_img.png" mode=""></image>
					</view>
				</view>
				<view class="item">
					<view class="item_left">绑定手机号</view>
					<view class="item_right" @click="setPhone()">
						<uni-icons type="phone"></uni-icons>
					</view>
				</view>
				<view class="item">
					<view class="item_left">姓名</view>
					<view class="item_right">翟文</view>
				</view>
				<view class="item">
					<view class="item_left">员工编号</view>
					<view class="item_right">15035144</view>
				</view>
				<view class="item">
					<view class="item_left">部门</view>
					<view class="item_right">矿领导</view>
				</view>
				<view class="item">
					<view class="item_left">岗位分类</view>
					<view class="item_right">行政领导</view>
				</view>
				<view class="item">
					<view class="item_left">岗位</view>
					<view class="item_right">矿长</view>
				</view>
				<view class="item">
					<view class="item_left">职级（职务码）</view>
					<view class="item_right">矿领导</view>
				</view>
				<view class="item">
					<view class="item_left">性别</view>
					<view class="item_right">男</view>
				</view>
				<view class="item">
					<view class="item_left">员工组</view>
					<view class="item_right">长期合同工</view>
				</view>
				<view class="item">
					<view class="item_left">员工子组</view>
					<view class="item_right">三级单位领导层</view>
				</view>
			</view>
			<view v-if="active == 2" class="inner">
				<view class="item">
					<view class="item_left">初始学历</view>
					<view class="item_right"></view>
				</view>
				<view class="item">
					<view class="item_left">初始学历-毕业学校</view>
					<view class="item_right"></view>
				</view>
				<view class="item">
					<view class="item_left">初始学历-专业</view>
					<view class="item_right"></view>
				</view>
				<view class="item">
					<view class="item_left">初始学历-毕业时间</view>
					<view class="item_right"></view>
				</view>
			</view>
			<view v-if="active == 3" class="inner">
				<view class="item">
					<view class="item_left">最高学历</view>
					<view class="item_right"></view>
				</view>
				<view class="item">
					<view class="item_left">最高学历-毕业学校</view>
					<view class="item_right"></view>
				</view>
				<view class="item">
					<view class="item_left">最高学历-专业</view>
					<view class="item_right"></view>
				</view>
				<view class="item">
					<view class="item_left">最高学历-毕业时间</view>
					<view class="item_right"></view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				active:1,
				
			};
		},
		methods:{
			click_item(item){
				this.active = item
			},
			upload(){
				uni.chooseImage({
				    count: 1, //默认9
				    sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
				    sourceType: ['album'], //从相册选择
				    success: function (res) {
				        console.log(JSON.stringify(res.tempFilePaths));
						
						
						this.upload_img(JSON.stringify(res.tempFilePaths))
						
						// const tempFilePaths = res.tempFilePaths;
						// uni.uploadFile({
						// 	url: 'https://www.example.com/upload', //上传的接口地址
						// 	filePath: tempFilePaths,
							
						// 	success: (uploadFileRes) => {
						// 		console.log(uploadFileRes.data);
						// 	}
						// });
					}
				});
			},
			setPhone(){
				uni.navigateTo({
					url:"./m-p-setPhone/m-p-setPhone",
					
				})
			},
			async upload_img(avatar){
				const res = await this.$myRequest({
					method:"POST",
					url:'/user/avatar/upload',
					header:{
						"Content-Type":"multipart/form-data",
						Authorization : uni.getStorageSync('token_type') +' '+uni.getStorageSync('Authorization')
					},
					data:{
						avatar:avatar
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.tab{
		display: flex;
		border-bottom: 1px solid #f3f3f3;
		.tab_item{
			width: 250rpx;
			text-align: center;
			font-size: 36rpx;
			font-family: PingFangSC-Medium, PingFang SC;
			font-weight: 500;
			color: #333333;
			line-height: 80rpx;
		}
		.active{
			border-bottom: 2rpx solid #009FE8;
		}
	}
	.content{
		.inner{
			.item{
				box-sizing: border-box;
				padding: 15rpx;
				display: flex;
				justify-content: space-between;
				align-items: center;
				
				font-size: 31rpx;
				font-family: PingFangSC-Medium, PingFang SC;
				font-weight: 500;
				color: #333333;
				border-bottom: 1rpx solid #f3f3f3;
				.item_left{}
				.item_right{
					color: #999;
					image{
						width: 132rpx;
						height: 132rpx;
					}
				}
			}
		}
	}
</style>
