<template>
	<view class="" v-if="meetingPlanList.length">
		<view class="evolve" v-for="(item,index) in meetingPlanList" :key="index" @click="download(item.filePath)">
			<view class="evolve_img">
				<image :src="changeImg(item.filePath)" mode=""></image>
			</view>
			<view class="evolve_information">
				<view class="fileName">{{item.fileName}}</view>
				<view>上传时间:{{item.createDate.slice(0,9)}}</view>
				<view>上传人:{{meetingUserName[item.createBy]}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	import uniNavBar from "@/components/uni-nav-bar/uni-nav-bar.vue";
	export default {
		props: ['meetingId'],
		data() {
			return {
				scrollTop: 0,
				meetingPlanList: {},
				meetingUserName: {},
			}
		},
		mounted() {
			this.getPlanList()
		},
		methods: {

			async getPlanList() {
				const res = await this.$myRequest({
					url: '/meeting/meetingPlan/findAppMeetingPlan',
					data: {
						meetingId: this.meetingId
					},
				});
				this.meetingPlanList = res.data.data
				this.meetingUserName = res.data.userNameMap
				// console.log(this.meetingPlanList.createBy)
				console.log(this.meetingUserName[1])
				// this.meetingPlanList.createDate = this.meetingPlanList[0].createDate.slice(0,9)
			},
			download(url) {
				console.log(url)
				uni.downloadFile({
					url: 'https://m.geidcp.com/api/file/pub/' + url,
					success: function(res) {
						var filePath = res.tempFilePath;
						uni.openDocument({
							filePath: filePath,
							success: function(res) {
								console.log('打开文档成功');
							}
						});
					}
				});
				console.log(url)
			},
			changeImg(src) {
				if (src.includes('pdf')) {
					return '../../static/img/conference/pdf.png'
				} else if (src.includes('doc')) {
					return '../../static/img/conference/doc.png'
				} else {
					return '../../static/img/conference/XLSX.png'
				}
			}
		},
		onLoad(option) {
			// this.meetingId = option.id
			this.getWorkList()
			this.changeImg()
			// this.getPlanList()
		}
	}
</script>

<style>
	page {
		background-color: #f2f2f2;
		/* padding-bottom: 100rpx; */
	}

	.evolve {
		width: 100%;
		height: 200rpx;
		margin-bottom: 10px;
	}

	.evolve_img {
		display: inline-block;
		width: 200rpx;
		height: 200rpx;
		/* border: 1px solid #000000; */
		border-radius: 12rpx;
		padding: 8rpx 18rpx 30rpx 40rpx;
		overflow: hidden;
	}

	.evolve_img image {
		width: 100%;
		height: 100%;
	}

	.evolve_information {
		display: inline-block;
		width: 440rpx;
		height: 100%;
		/* border: 1px solid #000000; */
		margin-left: 24rpx;
		overflow: hidden;
	}

	/* .evolve_information view{
		height: 100rpx;
	} */
	.fileName {
		font-size: 15px;
		font-weight: 700;
		color: #9d9d9d;
		overflow: hidden;
		height: 27px;
		text-overflow: ellipsis;
		white-space: nowrap;
		margin: 10rpx 0 20rpx 0;
	}
</style>
