<template>
	<view>
		<view class="from">
			<view class="from-line">
				<span class="label-class">岗位名称:</span>
				<view><input v-model="release.name" placeholder="请输入岗位名称"/></view>
			</view>
			<view class="from-line">
				<span class="label-class">地址信息:</span>
				<view><input v-model="release.address" placeholder="请输入岗位地址"/></view>
			</view>
			<view class="from-line">
				<span class="label-class">招聘地区:</span>
				<view><input v-model="release.vsClass" placeholder="请输入招聘地区:长沙街/江华街/深圳街/广州街等 目前开发区域可发布"/></view>
			</view>
			<view class="from-line">
				<span class="label-class">招聘工资:</span>
				<view><input v-model="release.money" placeholder="请输入招聘工资"/></view>
			</view>
			<view class="from-line">
				<span class="label-class">工资单位:</span>
				<view><input v-model="release.unit" placeholder="请输入工资单位:月/天/小时"/></view>
			</view>
			<view class="from-line">
				<span class="label-class">开始时间:</span>
				<view><input v-model="release.startTime" placeholder="请输入开始时间 年/月/日"/></view>
			</view>
			<view class="from-line">
				<span class="label-class">结束时间:</span>
				<view><input v-model="release.endTime" placeholder="请输入结束时间 年/月/日"/></view>
			</view>
			<view class="from-line">
				<span class="label-class">联系方式:</span>
				<view><input v-model="release.phone" placeholder="请输入联系方式"/></view>
			</view>
			<view class="from-line">
				<span class="label-class">联系微信:</span>
				<view><input v-model="release.wx" placeholder="请输入联系微信"/></view>
			</view>
			<view class="from-line-box">
				<span class="label-class">招聘内容:</span>
				<u--textarea  height="482rpx" v-model="release.myValue" placeholder="请输入兼职信息" count confirmType="done" ></u--textarea>
			</view>
			
		</view>
		<view class="pay-btn" @click="fabujianzhi()">
			确认提交审核
		</view>
	</view>
</template>

<script>
	import userCard from '@/components/user-card/index.vue'
	export default{
		components:{
			userCard
		},
		data(){
			return{
				release:{
					name:"",
					address:"",
					vsClass:"",
					money:"",
					unit:"",
					startTime:"",
					endTime:"",
					phone:"",
					wx:"",
					myValue:""
				}
			}
		},
		onShow() {
			this.getmyInfo()
		},
		onLoad() {
			
		},
		onReady() {
			this.$com.displayNav()
		},
		methods:{
			getmyInfo(){
				this.$api('myInfo')
				.then(res=>{
					if(res.code == 200){
						this.role = res.result.role;
						this.userInfo = res.result;
						this.$store.commit('set_userInfo',res.result)
					}else{
						this.userInfo = null
					}
				})
			},
			fabujianzhi(){
				let that = this;
				if(that.release.name == ''){
					this.$Toast("姓名不能为空");
					return
				}
				if(that.release.address == null){
					this.$Toast("招聘地址不能为空")
					return
				}
				if(that.release.vsClass == ''){
					this.$Toast("招聘区域不能为空")
					return
				}
				if(that.release.money == null){
					this.$Toast("招聘工资不能为空")
					return
				}
				if(that.release.unit == null){
					this.$Toast("招聘单位不能为空")
					return
				}
				if(that.release.startTime == null){
					this.$Toast("开始时间不能为空")
					return
				}
				if(that.release.endTime == null){
					this.$Toast("结束时间不能为空")
					return
				}
				if(that.release.phone == null){
					this.$Toast("联系方式不能为空")
					return
				}
				if(that.release.myValue == null){
					this.$Toast("招聘内容不能为空")
					return
				}
				let params = {
					name:that.release.name,
					address:that.release.address,
					vsClass:that.release.vsClass,
					money:that.release.money,
					unit:that.release.unit,
					startTime:that.release.startTime,
					endTime:that.release.endTime,
					phone:that.release.phone,
					wx:that.release.wx,
					myValue:that.release.myValue,
				}
				that.$api('saveJobRelease',params).then(res=>{
					this.$Toast(res.message);
					setTimeout(()=>{
						uni.navigateTo({
							url:'/pages/my/my-fabujianzhi-list'
						})
					},1500)
					
					
					
				});
				
				
				
			},
		}
	}
</script>

<style lang="scss" scoped>
	.from {
		margin-top: 20rpx;
	}
	.from-line {
		height: 138rpx;
		display: flex;
		.label-class{
			text-align: justify;
			text-align-last: justify;
			line-height: 128rpx;
			width: 128rpx;
			padding: 0 24rpx;
		}
		input{
			padding-left: 10rpx;
			height: 128rpx;
			line-height: 128rpx;
		}	
	}
	.from-line-box {
		height: 328rpx;
		margin-right: 50rpx;
		display: flex;
		.label-class{
			text-align: justify;
			text-align-last: justify;
			line-height: 128rpx;
			width: 128rpx;
			padding: 0 24rpx;
		}
		input{
			padding-left: 20rpx;
			height: 228rpx;
			line-height: 128rpx;
		}	
	}
	.pay-btn{
		margin:190rpx auto;
		width: 387rpx;
		text-align: center;
		border-radius: 12rpx;
		height: 78rpx;
		line-height: 78rpx;
		background-color:  #00CCCC;
		color: #FFFFFF;
	}
	
</style>