<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 style="margin-top: 20px;">
				<u-button  shape="circle" type="primary" @click="reback()" >返回</u-button>
			</view>
		</view>
		<u-modal :show="show" title="提示"  @confirm="show=false">
			<view>预约完成，请致电社区，并关注预约记录留意审核状态，谢谢！</view>
		</u-modal>
	</view>
</template>

<script>
	import {IMAGE_BASE_URL,BASE_URL} from '@/utils/config';
	 import {downloadPdfFiles} from '@/utils/download.js'
	export default{
		data(){
			return{
				docList:[],
				content:'预约完成，请致电社区，并关注预约记录留意审核状态，谢谢！',
				show:false,
				nameList:{
					'applyPdf':'申请表申请表申请表申请表申请表申请表申请表申请表申请表申请表',
					'covenantPdf':'协议书'
				}
			}
		},
		onLoad(option) {
			this.show=true
			const obj=JSON.parse(option.files)
			this.docList=[
				{name:obj.applyPdfName,url:BASE_URL+obj.covenantPdf},
				{name:obj.covenantPdfName,url:BASE_URL+obj.applyPdf},
			]
		},
		methods:{
			handleBack() {
				// 固定跳转首页
				uni.redirectTo({
					 	url: `/pages/meetingList/index`
				})
			},
			async downLoadFile(fileUrl){
				  const result = await downloadPdfFiles(fileUrl);
				  	  if(result.success==true){
				  		  // uni.navigateTo({
				  		  // 	url: `/pages/meetingList/index`
				  		  // });
				  	  }
			},
			reback(){
				uni.reLaunch({
					 	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;
	}
	.nav-bar {
		display: flex;
		align-items: center;
		padding: 15px;
		// background-color: #fff;
		border-bottom: 1px solid #f5f5f5;
		margin-top: 84rpx;
	}
	
	.nav-left {
		display: flex;
		align-items: center;
		margin-right: 10px;
	}
	
	.nav-title {
		flex: 1;
		text-align: center;
		// font-weight: bold;
		width: 100%;
	}
</style>