<template>
	<view>
		<uni-popup ref="popupRef" type="dialog" :animation="false" :is-mask-click="false"
			mask-background-color="rgba(0, 0, 0, 0.4);">
			<uni-popup-dialog mode="input" class="phone-ksxz-dialog" title="身份确认" :duration="2000" :before-close="true"
				cancelText="修改" @close="handleClose" @confirm="handleConfirm">
				<view class="ksxz-content-box">
					<view class="phone-name-box">
						<!-- #ifdef H5 -->
							<img :src="data.icon" alt="">
						<!-- <image :src="data.icon" /> -->
						<!-- #endif -->
					</view>
					<view>姓名：{{data.realName}}</view>
					<view>电话：{{data.userName}}</view>
					<view>职业：{{data.zyName}}</view>
					<view>等级：{{data.zyLevelName}}</view>
					<view>身份证号(护照号)：{{data.idcard}}</view>
					<view>性别：{{data.gender == 0?'未知': data.gender == '2' ? '女': '男'}}</view>
				</view>
			</uni-popup-dialog>
		</uni-popup>
	</view>
</template>

<script setup>
	import {
		ref,
		reactive
	} from "vue"
	const popupRef = ref(null)
	const data = reactive({
		realName: '',
		userName: '',
		zyLevelName: '',
		zyName: '',
		idcard: '',
		icon: '',
		gender: '',
		userId: '',
	})

	const emits = defineEmits(['confirm', 'changeData'])

	function showDialog(options) {
		data.realName = options.realName;
		data.userName = options.userName;
		data.zyLevelName = options.zyLevelName;
		data.zyName = options.zyName;
		data.idcard = options.idcard;
		data.icon = options.icon;
		data.userId = options.userId;
		data.gender = options.gender; // 1男 2女 0未知

		popupRef.value.open()
	}

	function handleClose() {
		emits('changeData');
		popupRef.value.close()
	}

	function handleConfirm() {
		emits('confirm', data);
		popupRef.value.close()
	}

	defineExpose({
		showDialog
	})
</script>

<style lang="scss">

</style>