<template>
	<select-template ref="select" title="请选择技能" slo="请选择最符合你能力的标签，标签会帮你定制个性化推荐任务信息" :list="skillLevel" search @submit="goAdd"></select-template>
</template>

<script>
	import {
		getWorktypes
	} from '@/api/resume.js'
	import selectTemplate from './selectTemplate.vue'

	export default {
		components: {
			selectTemplate
		},
		data() {
			return {
				skillLevel: [],
				tradeId: '',
				id: ''
			}
		},
		onLoad: function({
			id,
			tradeId
		}) {
			this.tradeId = tradeId
		},
		onShow: function() {
			this.getData()
		},
		mounted() {
			this.$refs.select.setActiveId(this.tradeId)
		},
		methods: {
			getData: function() {
				if (this.tradeId) {
					getWorktypes(this.tradeId).then(res => {
						this.skillLevel = res.data.data
					})
				}
			},
			goAdd(res) {
				uni.$emit('setworkTypes', res)
				uni.navigateBack()
			}
		}
	}
</script>

<style>
</style>
