<template>

	<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.lxName">练习名称：{{data.lxName}}</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>

</template>

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

	function showDialog(options) {
		data.intro = options.intro;
		data.lxName = options.lxName;
		data.ksScore = options.ksScore;
		data.okScore = options.okScore;
		data.zyName = options.zyName;
		data.zyLevelName = options.zyLevelName;
		data.lxId = options.lxId;
		
		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>