<template>
	<div class="knowledge-Standard-container">
		<el-dialog title="知识编写规范" v-model="state.dialogVisible" draggable width="70%">
			<div>
				<h3 class="font18">{{ state.info.title }}</h3>
				<div v-html="state.info.content" class="mt20 lineHeight24"></div>
			</div>
			<template #footer>
				<span class="dialog-footer">
					<el-button @click="state.dialogVisible = 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>({
	dialogVisible: false,
	info: {
    title: '', // 标题
    content: '', // 内容
  },
});
// 打开弹窗
const openDialog = () => {
	standardInfoFn();
	state.dialogVisible = true;
};
// 关闭弹窗
const closeDialog = () => {
	state.dialogVisible = 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>
