<template>
	<view class="page_body">
		<!-- 头部 -->
		<nav-bar height="96" :title="state.honorName" :onlyTitle="true" :showHeaderborder="true" @GoBack="GoBack"></nav-bar>
		<view class="page_content">
			<view class="row_item">
				<view class="row_label">荣誉类型：</view>
				<view class="row_value">{{state.detail?.honorTypeName}}</view>
			</view>
			<view class="row_item" v-for="item in (state.detail?.honorDataList || [])" :key="item.id">
				<view class="row_label">{{item?.honorDictLibName ?? ''}}：</view>
				<view class="row_value">{{item?.honorDictLibValue ?? ''}}</view>
			</view>
			<view class="row_item">
				<view class="row_label">荣誉证书：</view>
				<view class="row_value img_list">
					<!-- <view class="img_item" v-for="item in (state.detail?.honorDataCertList || [])" :key="item.id">
						<image class="pic" mode="aspectFit" :src="item.picUrl"></image>
					</view> -->
					<uv-upload :maxCount="state.detail?.honorDataCertList?.length || 0" :deletable="false" :fileList="state.detail?.honorDataCertList" width="240rpx" height="140rpx" multiple :previewFullImage="true">
					</uv-upload>
				</view>
			</view>
			<view class="row_item">
				<view class="row_label">佐证材料：</view>
				<view class="row_value document_list">
					<view class="document_item" v-for="item in (state.detail?.supportDocumentList || [])" :key="item.id">
						<image class="file" src="@/static/image/icon/file.png"></image>
						<view class="file_name">
							<view class="name">{{item.documentName}}</view>
							<view class="file_size_date">
								<view class="file_size">{{item.fileSize}}</view>
								<view class="file_date">{{item.createdAt}}</view>
							</view>
						</view>
						<view class="preview_btn">预览</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script setup>
	import navBar from '@/components/navBar.vue';
	import uvUpload from '@/uni_modules/uv-upload/components/uv-upload/uv-upload.vue';
	import {queryHonorTeacherDetail} from '@/reqApi/teacherHonor.js';
	import {
		reactive,
		ref,
		nextTick
	} from 'vue';
	import { onLoad } from '@dcloudio/uni-app';
	const state = reactive({
		id:'',//id
		honorName:'',
		loading:false,
		detail:{}
	})
	const popupDelDialogRef = ref(null);
	onLoad((option) => {
		state.id = option.id;
		state.honorName = decodeURIComponent(option.honorName);
		GetHonorTeacherDetail();
	})
	//查询荣誉审核资质信息详情数据接口
	const GetHonorTeacherDetail = () => {
		queryHonorTeacherDetail(state.id).then(res=>{
			if(res.code == 200){
				const resdata = res.data || null;
				const honorDataCertList = resdata?.honorDataCertList || [];
				resdata.honorDataCertList = honorDataCertList.map(item=>({
					...item,
					url:item.picUrl
				}))
				state.detail = resdata;
			}
		})
	}
	const GoBack = () => {
		uni.navigateBack({
			delta: 1
		});
	}
</script>

<style lang="scss" scoped>
	.page_body{
		height: 100%;
		min-height: auto;
	}
	.page_content{
		height: calc(100% - 96rpx);
		flex-direction: column;
		flex-wrap: initial;
		overflow: auto;
		.row_item{
			display: flex;
			width: 100%;
			padding: 32rpx 0;
			border-bottom: 2rpx solid #F3F3F3;
			.row_label{
				font-weight: 400;
				font-size: 28rpx;
				color: #666666;
				flex-shrink: 0;
				margin-right: 10rpx;
			}
			.row_value{
				flex: 1;
				font-weight: 400;
				font-size: 28rpx;
				color: #333333;
				text-align: right;
				display: flex;
				justify-content: flex-end;
				word-break: break-all;
				flex-wrap: wrap;
				&.img_list{
					gap: 32rpx 24rpx;
					.img_item{
						width: 240rpx;
						height: 140rpx;
						background-color: #FFFFFF;
						border-radius: 12rpx;
						border: 2rpx solid #CED1D8;
						display: inline-flex;
						align-items: center;
						justify-content: center;
						.pic{
							width: 240rpx;
							height: 140rpx;
						}
					}
				}
				&.document_list{
					gap: 24rpx;
					.document_item{
						width: 100%;
						padding: 20rpx 0 18rpx 15rpx;
						display: flex;
						background-color: #FFFFFF;
						border-radius: 20rpx;
						border: 2rpx solid #EBEEF5;
						.file{
							width: 80rpx;
							height: 80rpx;
							margin-right: 16rpx;
						}
						.file_name{
							flex: 1;
							display: flex;
							flex-direction: column;
							.name{
								font-weight: 500;
								font-size: 28rpx;
								text-align: left;
								color: #333333;
							}
							.file_size_date{
								display: flex;
								width: 100%;
								text-align: left;
								font-weight: 400;
								font-size: 24rpx;
								color: #999999;
								margin-top: 8rpx;
								gap: 20rpx;
								.file_size{
									white-space: nowrap;
								}
								.file_date{
									white-space: nowrap;
								}
							}
						}
						.preview_btn{
							width: 96rpx;
							box-sizing: border-box;
							text-align: left;
							font-weight: 400;
							font-size: 28rpx;
							color: #2E64FA;
							padding:20rpx 0 0 16rpx;
						}
					}
				}
			}
		}
	}
</style>