<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"
				@close="handleClose"
				@confirm="handleConfirm">
				<view class="ksxz-content-box">
					<view v-if="data.ksName">考试名称：{{data.ksName}}</view>
					<view v-if="data.zyName">职业：{{data.zyName}}</view>
					<view v-if="data.zyLevelName">等级：{{data.zyLevelName}}</view>
					<view v-if="data.ksScore">总分：{{data.ksScore}}</view>
					<view v-if="data.okScore">及格分：{{data.okScore}}</view>
					<view>
						<view v-if="data.intro" class="ksms-row">考试描述：</view>
						<rich-text v-if="data.intro" :nodes="data.intro" class="ksms-intro"></rich-text>
					</view>
				</view>
			</uni-popup-dialog>
		</uni-popup>
	</view>
</template>

<script setup>
	import {
		ref,reactive
	} from "vue";
	const popupRef = ref(null)
	const data = reactive({
		intro: '',
		ksName: '',
		ksScore: '',
		okScore: '',
		zyLevelName: '',
		zyName: '',
	})
	
	const emits = defineEmits(['confirm', 'cancel'])

	function showDialog(options) {
		data.intro = options.intro;
		data.ksName = options.ksName;
		data.ksScore = options.ksScore;
		data.okScore = options.okScore;
		data.zyName = options.zyName;
		data.zyLevelName = options.zyLevelName;
		data.ksId = options.ksId;
		
		popupRef.value.open()
	}

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

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

	defineExpose({
		showDialog
	})
</script>

<style lang="scss">

</style>