<template>
	<view class="">
		<view class="navbar">
			<view class="back">
				<text class="iconfont icon-fanhui " @click="backLast()"></text>
			</view>
			<text>查看申报</text>
		</view>
		<view class="tabbar" v-if="msg.extra.total_time">
			<view @click="tabbar(0)" :class="index==0 ? 'active' : ''">
				<text>附件</text>
			</view>
			<view @click="tabbar(1)" :class="index==1 ? 'active' : ''">
				<text>证明材料</text>
			</view>
		</view>
		<div v-if="msg.extra.total_time" class="nav">
			<iframe :src="uploadPdf" frameborder="0" class="iframe"></iframe>
		</div>
		<div v-if="!msg.extra.total_time" class="nav1">
			<iframe :src="uploadPdf" frameborder="0" class="iframe"></iframe>
		</div>
	</view>
	</view>
</template>

<script>
	var app = getApp()
	import navBar from '../../components/navBar/navbar.vue';
	import configData from '../../config.js'
	export default {
		data() {
			return {
				msg:'',
				uploadPdf:'',
				index:0
			}
		},
		components: {
			navBar
		},
		onLoad(options) {
			if(options.id){
				app.request('/examine/examine-detail',{examine_question_id:options.id},'post').then(res=>{
					console.log(res)
					var msg = res.data.data
					if(msg instanceof Array){
						this.msg = res.data.data[0]
					}else{
						this.msg = res.data.data
					}
					console.log(this.msg)
					var obj = this.msg.extra.resource_ids[0]
					// var arr = Object.values(obj);
					this.uploadPdf = obj
				})
			}else{
					this.uploadPdf = options.url
			}
		},
		methods: {
			backLast(){
				uni.navigateBack()
			},
			tabbar(index){
				this.index = index
				console.log(index)
				if(index==0){
					this.uploadPdf = this.msg.extra.resource_ids[0]
				}else{
					this.uploadPdf = this.msg.extra.prove_files[0]
				}
			}
		}
	}
</script>

<style lang="scss">
.nav{
		width: 100%;
		height: 100%;
		position: fixed;
		z-index: 222;
		top: 200upx;
		left: 0;
		iframe{
			width: 100%;
			height: 100%;
		}
	}
	.nav1{
			width: 100%;
			height: 100%;
			position: fixed;
			z-index: 222;
			top: 100upx;
			left: 0;
			iframe{
				width: 100%;
				height: 100%;
			}
		}
	.tabbar{ 
		width: 100%;
		height: 100upx;
		position: fixed;
		z-index: 222;
		top: 100upx;
		left: 0;
		display: flex;
		align-items: center;
		border: 1upx solid #EFF1F6;
		view{
			width: 50%;
			display: flex;
			align-items: center;
			justify-content: center;
			height: 100%;
			color: black;
		}
		.active{
			color: blue;
		}
	}
	.navbar {
		font-size: 32upx;
		height: 100upx;
		line-height: 100upx;
		color: #888888;
		position: relative;
		position: fixed;
		top: 0;
		z-index: 9999999;
		width: 100%;
		background-color: #FFFFFF;
		text-align: center;
		border-bottom: solid 2upx #EFF1F6;
	
		.back {
			height: 100upx;
			width: 100upx;
			text-align: center;
			// background-color: #007AFF;
			position: absolute;
			float: left;
			left: 0upx;
			font-size: 32upx;
		}
	}
</style>
