<template>
	<div class="fileDetail">
		<headNav
		@backPage="backPage"
		:title="'文件详情'"></headNav>
		
		<div class="info">
			<van-cell title="文件编号" :value="fileInfo.docNum" />
			<van-cell title="文件名称" :value="fileInfo.fileName" />
			<van-cell title="更新时间" :value="fileInfo.createTime" />
		</div>
		
		<div class="fileImg df jfc mt10">
			<van-image :src="getImgSrc" @click="showImageDetails"></van-image>
		</div>
		
		<!-- 遮罩层 -->
		<v-mask :showOverLay="showOverLay"></v-mask>
	</div>
</template>

<script>
	import headNav from '@/components/headNav.vue'
	import mask_overLay from '@/components/overLay_xy.vue'
	import { get, post, imgBaseUrl } from '@/utils/http.js'
	import { ImagePreview } from 'vant'
	
	export default {
		name: 'fileDetail',
		components: {
			headNav,
			'v-mask': mask_overLay
		},
		data() {
			return {
				showOverLay: false,
				fileInfo: ''
			}
		},
		mounted() {
			this.init();
		},
		computed: {
			getImgSrc() {
				return imgBaseUrl + this.fileInfo.imgAddress;
			},
		},
		methods: {
			// 初始化
			async init() {
				this.showOverLay = true;
				await this.getFileInfoApi();
				this.showOverLay = false;
			},
			
			async getFileInfoApi() {
				await get('/cdenforceobjI/listByCondition', {
					enforceObjId: this.$route.params.ID
				}).then(res => {
					if (res.success === true) {
						this.fileInfo = res.data[0];
					} else {
						this.$toast.fail(`${ res.msg }`);
					}
				});
			},
			
			backPage() {
				this.$router.go(-1);
			},
			
			showImageDetails() {
				ImagePreview([imgBaseUrl + this.fileInfo.imgAddress]);
			},
		},
	}
</script>

<style lang="scss" scoped>
	.fileDetail {
		font-size: 14px;
		
		.info {
			margin-top: 57px;
		}
		
		.fileImg {
			width: 100%;
			// height: 421px;
			background-color: #fff;
		}
	}
	
</style>

<style lang="scss">
	.fileDetail {
		
		.van-cell {
			font-size: 12px;
			
			.van-cell__title {
				color: #4f4f4f;
			}
			
			&::after {
				border-bottom: 1px solid #f5f5f5;
			}
		}
		
	}
</style>
