<template>
	<view class="selfEvaluation">
		<view class="title">自我评价</view>
		<u--textarea
			v-model="value"
			placeholder="请对自己做一个简短评价,吸引更多HR关注,为了保护个人隐私,请不要填写手机号QQ微信等联系方式。"
			border="bottom"
			height="200"
			maxlength="500"
		></u--textarea>
		<view class="footer">
			<u-button @click="submit" type="primary" shape="circle">保存</u-button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				value: '',
				userInfo: '',
			}
		},
		onLoad() {
			this.$http.get('/person/person/details', {}).then(res => {
				this.userInfo = res.data,
				this.value = res.data.selfEvaluation || ''
			})	
		},
		methods: {
			submit() {
				if (!this.value) {
					return uni.showToast({
						title: '请输入自我评价',
						icon: 'none'
					})
				}
				this.$http.post('/person/u', {
					...this.userInfo,
					selfEvaluation: this.value,
				}).then(res => {
					uni.showToast({
					  title: `修改成功`,
					  icon: 'none',
					});
					setTimeout(()=>{
						uni.navigateBack()
					},500)
				})
			}
		}
	}
</script>

<style lang="scss">
.selfEvaluation{
	padding: 30rpx;
	background-color: #fff;
	box-sizing: border-box;
	.title{
		font-size: 38rpx;
		font-weight: bold;
		margin-bottom: 20rpx;
	}
	.footer{
		position: fixed;
		bottom: calc(env(safe-area-inset-bottom) + 40rpx);
		width: 690rpx;
	}
}
</style>
