<template>
	<view class="page">
		<navbar title="在线简历"
		leftClick 
		@leftClick="$utils.navigateBack"/>
		
		
		<view class="box">
			<view class="list">
				<view class="item" 
				v-for="(item, index) in list" 
				:key="index">
					<view class="title">
						{{ item.title }}
					</view>
					<view class="tagList">
						<view :class="{act : i == item.index}" 
						@click="clickTag(item, i)" v-for="(t, i) in item.tag"
							:key="t.id">
							{{ t.name || t.adress }}
						</view>
					</view>
				</view>
			</view>
			
			<view class="form-sheet-cell">
				<view class="label">
					您的年龄
				</view>
				<input placeholder="请输入年龄" 
				type="number"
				v-model="form.age" />
			</view>
			
			<view class="form-sheet-cell">
				<view class="label">
					您的性别
				</view>
				<uv-radio-group v-model="form.sex">
					<view class="price">
						<uv-radio
							:customStyle="{margin: '8px'}" 
							v-for="(item, index) in sexList" 
							:key="index" 
							iconSize="30rpx"
							size="40rpx"
							labelSize="26rpx"
							:label="item.name" 
							:name="item.id">
						</uv-radio>
					</view>
				</uv-radio-group>
			</view>
			
			<uv-textarea
			v-model="form.content" 
			count 
			:maxlength="300" 
			autoHeight
			placeholder="请输入详细介绍"></uv-textarea>
			
			
			<view class="uni-color-btn">
				发布
			</view>
		</view>
		
	</view>
</template>

<script>
	import { mapState } from 'vuex'
	export default {
		data() {
			return {
				list: [
					{
						title: '您希望从事的工种',
						tag: [],
						index: 0,
					},
					{
						title: '您希望从事的工作区域',
						tag: [],
						index: 0,
					},
					{
						title: '您希望从事的工作性质',
						tag: [],
						index: 0,
					},
				],
				form : {
					sex : '男',
				},
				sexList : [
					{
						name : '男',
					},
					{
						name : '女',
					},
				],
			}
		},
		computed : {
			...mapState(['natureList', 'jobTypeList', 'addressList']),
		},
		onLoad() {
			this.list[0].tag = this.jobTypeList
			this.list[1].tag = this.addressList
			this.list[2].tag = this.natureList
		},
		methods: {
			clickTag(item, index){
				item.index = index
			},
		},
	}
</script>

<style scoped lang="scss">
	.page{
		background-color: #fff;
		min-height: 100vh;
		.box{
			padding: 30rpx;
			.list {
				.item {
					margin-top: 20rpx;
			
					.title {
						font-weight: 900;
						font-size: 30rpx;
					}
			
					.tagList {
						display: flex;
						flex-wrap: wrap;
						padding: 10rpx 0;
			
						view {
							background: rgba($uni-color, 0.1);
							padding: 10rpx 20rpx;
							margin: 10rpx;
							border-radius: 10rpx;
							font-size: 26rpx;
						}
			
						.act {
							color: #fff;
							background: $uni-color;
						}
					}
				}
			}
			
			.form-sheet-cell{
				display: flex;
				background-color: #fff;
				padding: 20rpx;
				align-items: center;
				.label{
					width: 160rpx;
				}
				input{
					flex: 1;
					background-color: rgba($uni-color, 0.1);
					padding: 10rpx 20rpx;
					border-radius: 10rpx;
				}
				.right-icon{
					margin-left: auto;
				}
			}
		
			/deep/ .uv-textarea{
				background-color: rgba($uni-color, 0.1) !important;
				min-height: 400rpx;
			}
		}
	}
</style>