<!-- 技能培训 -->
<template>
	<view class="training">

		<!-- banner -->
		<view class="training-banner">
			<image src="../../static/img/banner-skillsTraining.png" mode="aspectFill"></image>
		</view>

		<view class="training-total" @click="jumpPage('/pages/mine/skillsTraining/skillsTraining')">
			<view class="training-total-left">
				<view>我的技能培训</view>
				<view>学习时长：206小时</view>
			</view>
			<view class="training-total-right">
				<u-icon name="arrow-right" size="44" color="#fff"></u-icon>
			</view>
		</view>

		<!-- 报班通知 -->
		<view class="training-notice">
			<view class="training-notice-title">
				<view>报班通知</view>
				<view @click="jumpPage('pages/skillsTraining/registrationNotice/registrationNotice')">
					<text>更多</text>
					<u-icon name="arrow-right"></u-icon>
				</view>
			</view>
			<view class="training-notice-content">
				<swiper class="swiper" :indicator-dots="true" :autoplay="false" :interval="1000" :duration="500" indicator-color="#D8D8D8" indicator-active-color="#D8D8D8">
					<swiper-item v-for="(item, index) in enrollList" :key="index">
						<view class="swiper-item">
							<view class="left">
								<u-image :src="item.img" mode="aspectFill" border-radius="10" height="220"/>
							</view>
							<view class="right">
								<view>{{ item.name }}</view>
								<view>{{ item.school }}</view>
								<view>报名时间：{{ item.dateRange }}</view>
								<view class="btn" @click="jumpPage('/pages/skillsTraining/skillsPackage/skillsPackage')">报名</view>
							</view>
						</view>
					</swiper-item>
				</swiper>
			</view>
		</view>
		
		<!-- 技能包 -->
		<view class="training-package">
			<view class="training-package-title">
				<view>技能包</view>
				<view>
					<text>更多</text>
					<u-icon name="arrow-right"></u-icon>
				</view>
			</view>
			<view class="training-package-list">
				<view class="training-package-list-item" v-for="(item, index) in packageList" :key="index" @click="jumpPage('/pages/skillsTraining/skillsPackage/skillsPackage', { id: item.id })">
					<view>
						<u-image :src="item.img" height="190"mode="aspectFill" border-radius="10"/>
					</view>
					<view>{{ item.name }}</view>
					<view>{{ item.schoolName }}</view>
				</view>
			</view>
		</view>
		
		<!-- 问题咨询 -->
		<view class="training-bottom">
			问题咨询（0851-863789）
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				enrollList: [
					{
						id: 1,
						img: 'http://img.mp.itc.cn/upload/20161115/15c7309f1a074a08a2b9630651720c27_th.jpg',
						name: '汽车检测与维修',
						school: '贵州工业职业技术学院',
						dateRange: '2021.10.15-2021.11.24'
					},
					{
						id: 2,
						img: 'http://img.mp.itc.cn/upload/20161115/15c7309f1a074a08a2b9630651720c27_th.jpg',
						name: '汽车检测与维修',
						school: '贵州工业职业技术学院',
						dateRange: '2021.10.15-2021.11.24'
					},
					{
						id: 3,
						img: 'http://www.gzlis.edu.cn/uploadfile/201906/20190605152111236.jpg',
						name: '汽车检测与维修',
						school: '贵州工业职业技术学院',
						dateRange: '2021.10.15-2021.11.24'
					}
				],
				packageList: []
			}
		},
		onShow() {
			this.getPackageList();
		},
		methods: {
			getPackageList() {
				this.$u.api.skillTraining.getSkillPackageListApi().then(res => {
					if (res.code === 200) {
						this.packageList = res.rows
					}
				})
			},
			/**
			 * 跳转到指定页面
			 * @param { String } url
			 * @param {Object} parmas
			 */
			jumpPage(url, params) {
				this.$u.route({ url, params })
			}
		}
	}
</script>

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