<template>
	<view class="picture-wrapper" @click="takePhotoMode">
		<view class="bg">
			<view class="">
				<view class="name"> {{ props.text && props.text.title ? props.text.title : text.title }} </view>
				<view class="value"> {{ props.text && props.text.tag1 ? props.text.tag1 : text.tag1 }} </view>
				<view class="tip">
					<view class="tip-value"> {{ props.text && props.text.tag2 ? props.text.tag2 : text.tag2 }} </view>
				</view>
			</view>
			<view class="image-out" :style="{'backgroundImage': `url(${$imgUrl}issuance/bg-border.png`}">
				<image v-if="props.img" class="icon" :src="getFullImageUrl(props.img)" mode="aspectFill"></image>
				<image v-else class="icon" :src="`${$imgUrl}${ props.text && props.text.img ? props.text.img : text.img}`" mode="aspectFill"></image>
			</view>
		</view>
	</view>
</template>

<script setup lang="ts">
	import { computed } from 'vue'
	import { getFullImageUrl } from "@/utils/utils";
	const emits = defineEmits(['click']);
	const props = defineProps({
		img: {
			type: String,
			default: "",
		},
		type: {
			type: Number,
			default: 1,
		},
		text: {
			type: Object,
			default: () => {}
		}
	})
	
	const takePhotoMode = () => {
		emits('click', props.type)
	}
	
	const text = computed(() => {
		if (props.type === 1) {
			return {
				title: '人像面',
				tag1: '上传身份证的人像面',
				tag2: '拍摄规范',
				img: 'issuance/sfz.png'
			}
		} else if (props.type === 2) {
			return {
				title: '国徽面',
				tag1: '上传身份证的国徽面',
				tag2: '拍摄规范',
				img: 'issuance/sff.png'
			}
		} else if (props.type === 3) {
			return {
				title: '行驶证主页',
				tag1: '上传行驶证的主页',
				tag2: '拍摄规范',
				img: 'applyCard/car-zhu.png'
			}
		} else if (props.type === 4) {
			return {
				title: '行驶证副页',
				tag1: '上传行驶证的副页',
				tag2: '拍摄规范',
				img: 'applyCard/car-fu.png'
			}
		} else if (props.type === 5) {
			return {
				title: '营业执照',
				tag1: '上传企业的营业执照',
				tag2: '拍摄规范',
				img: 'applyCard/zhizhao.png'
			}
		} else {
			return {
				title: '人像面',
				tag1: '上传身份证的人像面',
				tag2: '拍摄规范',
				img: 'issuance/sff.png'
			}
		}
	})
</script>

<style lang="scss" scoped>
	.picture-wrapper {
		margin-top: 30rpx;
	
		.bg {
			background: #F5F9FB;
			border-radius: 10rpx;
			padding: 40rpx 30rpx;
			display: flex;
			// align-items: center;
			justify-content: space-between;
			.title{
				color: #01243A;
			}
			.name {
				padding-top: 30rpx;
				font-size: 32rpx;
				font-family: SourceHanSansSC, SourceHanSansSC;
				font-weight: 500;
				color: #111;
				line-height: 34rpx;
			}
	
			.value {
				margin-top: 20rpx;
				font-size: 22rpx;
				font-family: SourceHanSansSC, SourceHanSansSC;
				font-weight: 400;
				color: #999999;
				line-height: 24rpx;
			}
	
			.tip {
				margin-top: 20rpx;
				text-align: center;
				width: 100rpx;
				height: 30rpx;
				border-radius: 6rpx;
				border: 1rpx solid #CCB375;
	
				.tip-value {
					font-size: 20rpx;
					font-family: Microsoft YaHei;
					font-weight: 400;
					color: #CCB375;
					line-height: 30rpx;
					opacity: 1;
				}
			}
		}
		.image-out{
			width: 304rpx;
			height: 190rpx;
			background-size: 100% 100%;
			background-repeat: no-repeat;
		}
		.icon {
			width: 304rpx;
			height: 190rpx;
		}
	}
</style>