<template>
	<view>
		<view class="noComment">
			<view class="textview">
				<textarea v-model.trim="skill" placeholder="请输入18字以内" placeholder-class="textClass" maxlength="18" />
				</view>
			<view class="btn" v-if="btnShow">
				<view class="bottombtn" @click="sendCom">确认</view>
				<!-- <view v-else class="bottombtn disabledBtn">确认</view> -->
			</view>
		</view>
	</view>
</template>

<script>
	import{mySkills} from '@/api/resume.js';
	import {submitApplication} from '@/api/newIndex.js'
	import {mapGetters} from 'vuex'
	export default {
		data() {
			return {
				skill:'',
				submitType:2,//申请类型：1 法律咨询 2技能提升
				btnShow:true,
			}
		},
		onLoad(option) {
			if(option.data && option.type){
				this.skill=decodeURIComponent(option.data);
				this.btnShow=false;
			}
		},
		computed:{
			...mapGetters(['authInfo'])
		},
		methods: {
			settext:function(e){
				this.skill = e.detail.value;
			},
			getWantSkill(){
				mySkills().then(res=>{
					console.log(res,'skill')
				})
			},
			sendCom:function(){
				if(!this.skill){
					uni.showToast({
						icon:'none',
						title:'请输入想学习的技能',
						duration:3000
					})
					return;
				}
				uni.showLoading({
					title:'请求中'
				})
				let uid=this.authInfo.userId;
				let uname=this.authInfo.realName;
				let tel=this.authInfo.telphone;
				submitApplication(uid,uname,tel,this.submitType,this.skill).then(res=>{
							this.loading=false;
							uni.hideLoading()
							setTimeout(() => {
								uni.showToast({
									title: '提交成功',
									icon: 'none'
								});
							}, 1000)
							uni.switchTab({
								url:'/pages/index/index'
							})
				})
			}
		}
	}
</script>

<style>
	.bottombtn {
		background-color: #1b66ff;
		color: #fff;
		text-align: center;
		border-radius: 10rpx;
		font-family: PingFangSC-Medium;
		font-size: 32rpx;
		height: 90rpx;
		line-height: 90rpx;
	}
	.disabledBtn {
		background-color: #c8c9cc;
	}
	.btn {
		background-color: #fefefe;
		width: 690rpx;
		padding: 30rpx;
		padding-bottom: 80rpx;
		position: fixed;
		bottom: 0;
		left: 0;
	}
	.textview{
		padding: 20rpx;
	}
	textarea{
		font-family: PingFangSC-Regular;
		font-size: 32rpx;
		color: #666;
		
	}
	.textClass{
		font-family: PingFangSC-Regular;
		font-size: 32rpx;
		color: #CCCCCC;
	}
	.start image:first-child{
		margin-left: 20rpx;
	}
	.start image{
		width: 40rpx;
		height: 40rpx;
	}
	.start{
		padding: 20rpx;
		border-bottom: 1rpx solid #f6f6f6;
		font-family: PingFangSC-Regular;
		font-size: 32rpx;
		color: #333333;
		display: flex;
		align-items: center;
		justify-content: flex-start;
	}
page{background-color: #fefefe;}
</style>
