<template>
	<view class="m_right">
		<img src="../../assets/home/topImg.jpg" class="s_logo" mode=""></img>
		<view class="m_right_container">
			<table style="width: 100%;border: 1px solid #DDDDDD;border-collapse: collapse">
				<thead class="m-table-hander">
					<tr>
						<th>项目</th>
						<th>名称</th>
						<th>类型</th>
						<th>创建人</th>
						<th>查看</th>
						<th>是否为公共</th>
					</tr>
				</thead>
				<tbody>
					<tr v-for="(item,index) in tabledata" :key="index">
						<th>{{item.Id}}</th>
						<th>{{item.ProjectName}}</th>
						<th>{{item.Type}}</th>
						<th>{{item.CreateUserName}}</th>
						<th style="position: relative;"><button type="default" @click="find(item,index)" size="mini" class="m_delete">查看</button></th>
						<th>
							<checkbox-group>
								<label>
									<checkbox :checked="Boolean(item.IsPublic)" disabled="false"/>
								</label>
							</checkbox-group>
						</th>
					</tr>
				</tbody>
			</table>
		</view>
	</view>
</template>

<script>
	export default {
		name: "student_table",
		data() {
			return {
				index: 1,
				tabledata: []
			}
		},
		methods: {
			paging(obj) {
				this.index = obj;
			},
			getList() {
				uni.request({
					url: mydata_api + "/project/getprojects",
					data: {
						"UserID": mydata_userInfo.UserID
					},
					method: "POST",
					dataType: "json",
					success: res => {
			
						this.tabledata = res.data.Projects
						console.log('tabledata=',this.tabledata)
						// let aData = {
						// 	"CreateTime": "2020-01-01 00:00:00",
						// 	"CreateUserID": "59458299-3b84-4895-98f6-b990cdaedc72",
						// 	"CreateUserName": "朱峰",
						// 	"Describe": '“实验以振兴国产科技电影”和“实现中国航天强国梦”的宏大蓝图为背景，以我国首次登陆火星计划为现实脚本，运用现场实时特效技术手段，对火星地面、外太空等场景进行“经典学习”和“实践创兴”并通过持续开发和学生在实验过程中的资源上传不断扩大现场创作的实景和虚拟资产库，使学生再学习过程中，即是资源学习者和方案讨论者，也是资源建设者',
						// 	"Id": 30,
						// 	"ProjectName": "《火星计划》",
						// 	"ProjectReviewImage": "../../../assets/studentAndTeacher/table/marsPlanReviewImage.png",
						// 	"ReviewImageOss": "../../../assets/studentAndTeacher/table/marsPlanMainCover.png",
						// 	"Type": "科幻",
						// }
						// this.tabledata.unshift(aData);
						// console.log('res=',this.tabledata)
						this.$forceUpdate();//强制刷新页面
					}
				})
			},
			find(obj,index){
				this.$emit('viewProject',obj,index);
			}
		}
	}
</script>

<style lang="scss">
	.m_right {
		width: 100%;
		margin-top: 5rpx;
		// padding: 0 150rpx;
		background-color: #fff;
		box-shadow: 3px 0px 6px 0px rgba(0, 0, 0, 0.1);

		.m_right_container {
			padding: 150rpx;
		}

		.s_logo {
			width: 100%;
			// height: 800rpx;
			// object-fit: cover;
		}

		.m_right_hander {
			text-align: right;
			height: 250rpx;
			position: relative;

			.m_btn_red {
				position: absolute;
				height: 80rpx;
				line-height: 80rpx;
				padding: 0 40rpx;
				right: 0;
				top: 50%;
				transform: translateY(-50%);
				background: #EA252C;
				color: #fff;
			}
		}

	}

	tbody tr {
		border-top: 2rpx solid #DDDDDD !important;

	}

	tbody tr th:first-child {
		position: relative;
	}

	tbody tr th {
		font-weight: 400 !important;
		height: 140rpx;
		line-height: 140rpx;
	}

	tbody tr:hover {
		// color: #fff;
		background: #FDEBEC;
		// opacity: 0.08;
	}

	.m-table-hander {
		background-color: #FFF8F7;
		height: 140rpx;
		line-height: 140rpx;
		font-family: MicrosoftYaHei-Bold, MicrosoftYaHei;
		font-weight: bold;
	}

	.m_edit {
		position: absolute;
		top: 50%;
		left: 50%;
		transform: translate(-50%, -50%);
		background: rgb(67, 127, 250);
		color: rgb(255, 255, 255);
		min-width: 130rpx;
	}

	.m_delete {
		position: absolute;
		top: 50%;
		left: 50%;
		min-width: 130rpx;
		transform: translate(-50%, -50%);
		background: rgb(234, 37, 44);
		color: rgb(255, 255, 255);
		z-index: 100;
	}

	.m_right_footer {
		margin-top: 80rpx;
	}

	.m_logoimg {
		width: 80rpx;
		height: 80rpx;
		position: absolute;
		top: 50%;
		left: 50%;
		transform: translate(-50%, -50%);
	}

	.m_paging {
		text-align: right;

		.m_paging_item {
			padding: 10rpx 18rpx;
			border: 1rpx solid #DDDDDD;
			border-radius: 8rpx;
			margin-right: 10rpx;
		}

		.p_act {
			background: #EA252C;
			color: #fff;
			border: inherit;
		}
	}

	.m_paging_item:hover {
		background: #EA252C;
		color: #fff;
		border: inherit;
	}

	.m_act1 {
		color: #FF0019;
	}
</style>
