<template>
	<view class="doc-page">
		<view class="doc-content">
			<view class="doc-file" v-for="item of docList" @click="downLoadFile(item)">
				<image src="/static/imgs/word.png" alt="" srcset="" class="doc-img"/>
				<view class="doc-name">{{item.name}}</view>
			</view>
		</view>
		
	</view>
</template>

<script>
	import {IMAGE_BASE_URL,BASE_URL} from '@/utils/config';
	 import {downloadPdfFiles} from '@/utils/download.js'
	export default{
		data(){
			return{
				docList:[],
				nameList:{
					'applyPdf':'申请表申请表申请表申请表申请表申请表申请表申请表申请表申请表',
					'covenantPdf':'协议书'
				}
			}
		},
		onLoad(option) {
			console.log(option);
			console.log(JSON.parse(option.files));
			
			const obj=JSON.parse(option.files)
			this.docList=[
				{name:'近山社区城市青年会客厅使用说明及申请表',url:BASE_URL+obj.covenantPdf},
				{name:`${JSON.parse(option.isSelfStudy)?'近山社区自习室个人使用承诺书':'近山社区城市青年会客厅安全使用承诺书'}`,url:BASE_URL+obj.applyPdf},
			]
		},
		methods:{
			async downLoadFile(fileUrl){
				  const result = await downloadPdfFiles(fileUrl);
				  	  if(result.success==true){
				  		  // uni.navigateTo({
				  		  // 	url: `/pages/meetingList/index`
				  		  // });
				  	  }
			}
		}
	}
</script>

<style scoped>
	.doc-page{
		width: 100vw;
		height: 100vh;
		/* margin: 10rpx; */
	}
	.doc-content{
		margin: 10px;
	}
	.doc-file{
		padding: 20rpx 10rpx;
		display: flex;
		align-items: center;
		/* margin: 10px; */
		/* border-bottom: 1px solid #c9c9c9; */
	}
	.doc-file:not(:last-child){
		border-bottom: 1px solid #c9c9c9;
	}
	.doc-img{
		width: 35px;
		height: 35px;
	}
	.doc-name{
		flex: 1;
		color: #666666;
		  overflow: hidden;
		  text-overflow: ellipsis;
		  white-space: nowrap;
	}
</style>