<template>
	<view class="page">
		<view class="feedback-top">
			请如实填写个人信息
		</view>
		<!-- 反馈内容 -->
		<view class="feedback-data">
			<view class="titleall-box">
				<view class="titleall-left">
					<view class="titleall-left-line"></view>填写个人信息
				</view>
			</view>
			<view class="feedback-type">
				<view class="title">
					<text>姓名</text>
				</view>
				<view class="more">
					<view class="contact-way">
						<input type="text" v-model="form.name" placeholder="请输入姓名">
					</view>
				</view>
			</view>
			<view class="feedback-line"></view>
			<view class="feedback-type">
				<view class="title">
					<text>性别</text>
				</view>
				<view class="more">
					<view class="contact-way">
						<picker @change="bindPickerChange" :value="form.sex" :range="array" v-model="form.sex" style="margin-right: 5px;">
							<view class="uni-input">{{array[form.sex]}}</view>
						</picker>
						<!-- <input type="text" v-model="form.sex" placeholder="请选择性别"> -->
					</view>
				</view>
			</view>
			<view class="feedback-line"></view>
			<view class="feedback-type">
				<view class="title">
					<text>年龄</text>
				</view>
				<view class="more">
					<view class="contact-way">
						<input type="text" v-model="form.age" placeholder="请输入年龄">
					</view>
				</view>
			</view>
			<view class="feedback-line"></view>
			<view class="feedback-type">
				<view class="title">
					<text>联系电话</text>
				</view>
				<view class="more">
					<view class="contact-way">
						<input type="text" v-model="form.phone" placeholder="请输入联系电话">
					</view>
				</view>
			</view>
			<view class="feedback-line"></view>
			<view class="feedback-type">
				<view class="title">
					<text>地址</text>
				</view>
				<view class="more">
					<view class="contact-way">
						<input type="text" v-model="form.expect" placeholder="请输入常驻地址">
					</view>
				</view>
			</view>
			<view class="feedback-line"></view>
			<view class="feedback-type">
				<view class="title">
					<text>擅长职位</text>
				</view>
				<view class="more">
					<view class="contact-way">
						<input type="text" v-model="form.educationExperience" placeholder="可输入多个职位">
					</view>
				</view>
			</view>
			<view class="feedback-line"></view>
			<view class="feedback-data-title">履历简介</view>
			<view class="content">
				<textarea value="" v-model="form.workExperience" placeholder="请描述公司的主营业务及您需要的工种类型详情" />
			</view>
		</view>
		<view class="my-phone">
			<view>客服电话：654564</view>
			<view>彭州市人社局监督电话：541516</view>
			<view>备案号：6556121212</view>
		</view>
		<!-- 提交 -->
		<view class="submit-btn" @click="submit">
			<text>提交</text>
		</view>
	</view>
</template>

<script>
	import BASE_URL from '@/common/config.js'
	import robbyImageUpload from '@/components/robby-image-upload/robby-image-upload.vue'
	export default {
		components: {
			robbyImageUpload
		},
		data() {
			return {
				BASE_URL,
				TypeIndex: 0,
				imageData: [],
				form: {
					id: undefined,
					name: undefined,
					age: 0,
					sex: 0,
					phone: undefined,
					advantage: undefined,
					expect: undefined,
					industry: undefined,
					educationExperience: undefined,
					workExperience: undefined,
					projectExperience: undefined,
				},
				index: 0,
				array: ['女', '男'],
			};
		},
		onLoad() {
			this.API.GettbresumeOne().then(res => {
				if (res.code == 200 && res.data != null) {
					this.form = res.data;
				}
			});
		},
		methods: {
			bindPickerChange: function(e) {
				this.form.sex = e.detail.value
			},
			addImage(e) {
				this.form.post = e.allImages.filter(res => {
					if (!res.url) {
						return false;
					}
					return true;
				});
			},
			addImagebusiness(e) {
				this.form.business = e.allImages.filter(res => {
					if (!res.url) {
						return false;
					}
					return true;
				});
			},
			submit() {
				console.log(this.form);
				this.API.CreateRres(this.form).then(res => {
					if (res.code == 200) {
						uni.showToast({
							title: '保存简历成功！',
							icon: 'none'
						});
					}
				});
			},
			/**
			 * 反馈类型
			 * @param {Object} val
			 */
			FeedbackTypeCh(val) {
				console.log(val);
				this.TypeIndex = val.detail.value;
			}
		}
	}
</script>

<style scoped lang="scss">
	@import 'FindWord.scss';
</style>
