<template>
	<div class="knowledge-knowledge-Standard-container">
		<el-dialog title="知识编写规范" v-model="state.isShowDialog" draggable width="70%">
			<div>
				<h3 style="text-align: center">{{ state.info.title }}</h3>
				<div v-html="state.info.content" class="mt20"></div>
			</div>
			<template #footer>
				<span class="dialog-footer">
					<el-button @click="state.isShowDialog = false" class="default-button">关 闭</el-button>
				</span>
			</template>
		</el-dialog>
	</div>
</template>

<script setup lang="ts" name="knowledgeStandardInfo">
import { reactive } from 'vue';
import { standardInfo } from '/@/api/knowledge/standard';

// 定义变量内容
const state = reactive<any>({
	isShowDialog: false,
	info: {},
});
// 打开弹窗
const openDialog = () => {
	standardInfoFn();
	state.isShowDialog = true;
};
// 关闭弹窗
const closeDialog = () => {
	state.isShowDialog = false;
};
// 查询规范详情
const standardInfoFn = async () => {
	try {
		state.loading = true;
		const res: any = await standardInfo();
		state.info = res.result ?? {};
		state.loading = false;
	} catch (error) {
		state.loading = false;
	}
};
// 暴露变量
defineExpose({
	openDialog,
	closeDialog,
});
</script>
