123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- import { defineComponent, onMounted, reactive, ref, watch } from 'vue';
- import styles from './index.module.less';
- import {
- NButton,
- // NBreadcrumb,
- // NBreadcrumbItem,
- // NScrollbar,
- NSlider,
- NSpace,
- NSpin
- } from 'naive-ui';
- import iconT from '/src/views/content-information/images/icon-t.png';
- import iconAddT from '/src/views/content-information/images/icon-add-t.png';
- import iconPlusT from '/src/views/content-information/images/icon-plus-t.png';
- import {
- api_lessonCoursewareDetail_listKnowledge,
- api_lessonCoursewareKnowledgeDetail
- } from '/src/views/content-information/api';
- import TheEmpty from '/src/components/TheEmpty';
- import { PageEnum } from '/src/enums/pageEnum';
- export default defineComponent({
- name: 'cotnent-knowledge',
- props: {
- id: {
- type: String,
- default: ''
- },
- type: {
- type: String,
- default: ''
- },
- activeStatus: {
- type: Boolean,
- default: false
- }
- },
- emits: ['close', 'confirm'],
- setup(props, { emit }) {
- const content = ref(false);
- const musicContentRef = ref();
- const state = reactive({
- fontSize: 18,
- tableList: [] as any,
- selectKey: null,
- details: {} as any
- });
- const getDetail = async () => {
- content.value = true;
- try {
- const { data } = await api_lessonCoursewareKnowledgeDetail({
- id: props.id
- });
- state.details = data;
- } catch {
- //
- }
- content.value = false;
- };
- onMounted(() => {
- getDetail();
- });
- watch(
- () => props.activeStatus,
- () => {
- // if (!props.activeStatus) {
- // handleChangeAudio('pause');
- // }
- }
- );
- return () => (
- <div
- class={[
- styles.containerDetail,
- props.type === 'preview' && styles.detailPreview
- ]}>
- {/* <div class={styles.detail2}> */}
- <div class={styles.contentWrap}>
- <div class={styles.musicStaff}>
- <NSpin
- show={content.value}
- ref={musicContentRef}
- class={
- !content.value && !state.details?.desc ? styles.empty : ''
- }>
- {state.details?.desc ? (
- <div
- class={styles.musicContent}
- v-html={state.details?.desc}
- style={{ fontSize: state.fontSize + 'px' }}></div>
- ) : (
- ''
- )}
- {!content.value && !state.details?.desc && <TheEmpty />}
- </NSpin>
- </div>
- <div class={styles.changeSizeSection}>
- <img src={iconT} class={styles.iconT} />
- <img
- src={iconAddT}
- class={styles.iconAddT}
- onClick={() => {
- if (state.fontSize >= 32) return;
- state.fontSize += 1;
- }}
- />
- <NSlider
- v-model:value={state.fontSize}
- vertical
- min={12}
- placement="left"
- max={32}
- />
- <img
- src={iconPlusT}
- class={styles.iconPlusT}
- onClick={() => {
- if (state.fontSize <= 12) return;
- state.fontSize -= 1;
- }}
- />
- </div>
- </div>
- {/* </div> */}
- </div>
- );
- }
- });
|