<template>
	<view class="default_page" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
		<cus-header title='报告详情'></cus-header>
		<div class="pdf"></div>
		<div class="bottom">
			<div class="zt_btn" @click="askReport">对报告提问</div>
		</div>
	</view>
</template>

<script>
	export default {
		data(){
			return {
				pdfUrl:'',
				fileName:''
			}
		},
		onLoad(options) {
			this.pdfUrl = options.pdfUrl;
			this.fileName = options.fileName;
			this.showPdf(this.pdfUrl)
		},
		methods:{
			showPdf(url){
				wx.downloadFile({
				  url,
				  success: function (res) {
				    const filePath = res.tempFilePath
				    wx.openDocument({
				      filePath: filePath,
				      success: function (res) {
				        console.log('打开文档成功')
				      }
				    })
				  }
				})
			},
			askReport(){
				uni.navigateTo({
					url:`/pages/reportAsk?pdfUrl=${this.pdfUrl}&fileName=${this.fileName}`
				})
			}
		}
	}
</script>

<style scoped lang="less">
	.default_page{
		padding: 0 0 212rpx;
		box-sizing: border-box;
		
		.bottom{
			width: 100%;
			height: 172rpx;
			padding: 20rpx 50rpx 0;
			box-sizing: border-box;
			position: fixed;
			left: 0;
			bottom: 0;
			background: #FFFFFF;
		}
	}
</style>