<template>
	<view class="main-content">
		<headers :showBack="true" :themeType="true">
			<view class="headerName">
				培训计划
			</view>
		</headers>
		<view class="list-box">
			<view class="list-box-item" @click="toDetail(item)" v-for="(item,index) in dataList" :key="index">
				<view class="item-flex">
					<text>培训计划名称: </text>
					<text>{{item.name}}</text>
				</view>
				<view class="item-flex">
					<text>科目类型: </text>
					<text>{{item.subjectName}}</text>
				</view>
				<view class="item-flex">
					<text>课件名称: </text>
					<text>{{item.courseName}}</text>
				</view>
				<view class="item-flex">
					<text>教育主题: </text>
					<text>{{item.title}}</text>
				</view>
				<view class="item-flex">
					<text>考试试卷: </text>
					<text>{{item.paperName}}</text>
				</view>
				<view class="item-flex">
					<text>培训有效时间: </text>
					<text style="font-size: 24rpx;">{{item.trainBeginTime}}-{{item.trainEndTime}}</text>
				</view>
			</view>
		</view>
		<view class="btn-operate" @click="toAdd">
			<button type="primary"
				>创建培训计划</button>
		</view>
		<levitatedsphere :x="100" :y="80"></levitatedsphere>
	</view>
</template>

<script>
	import levitatedsphere from "@/components/levitatedsphere/levitatedsphere.vue"
	export default {
		data() {
			return {
				dataList: [],
				projectSn:""
			}
		},
		onLoad(options) {
			this.projectSn = JSON.parse(uni.getStorageSync("userInfo")).sn
			this.getDataList();
		},
		methods: {
			//获取列表数据
			getDataList() {
				let that = this;
				this.sendRequest({
					url: 'exam/train/list',
					method: 'post',
					data: {
						projectSn: this.projectSn
					},
					success: res => {
						if (res.code == 200) {
							that.dataList = res.result
						}
					}
				})
			},
			toDetail(obj){
				uni.navigateTo({
					url: './details?obj=' + JSON.stringify(obj)
				})
			},
			toAdd(){
				uni.navigateTo({
					url: './addPlan'
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.main-content {
		.list-box {
			padding: 60rpx 18rpx 0rpx 18rpx;

			&-item {
				background: linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, rgba(198, 220, 255, 0.2) 100%);
				box-shadow: 0px 8rpx 30rpx -8rpx rgba(42, 60, 106, 0.24);
				border-radius: 34rpx;
				margin-bottom: 30rpx;
				padding: 26rpx 30rpx;

				.item-flex {
					display: flex;
					align-items: center;

					text {
						font-family: Source Han Sans CN, Source Han Sans CN;
						font-weight: 400;
						font-size: 28rpx;
						color: #000000;
					}
					text:nth-child(1){
						margin-right: 10rpx;
					}
				}

				.item-flex:not(:last-child) {
					margin-bottom: 14rpx;
				}
			}
		}
	}
	.btn-operate{
		width: 90%;
		position: fixed;
		bottom: 5%;
		left: 5%;
		z-index: 10;
	}
</style>