|
@@ -1,10 +1,11 @@
|
|
|
-import { defineComponent, onMounted, reactive, watch } from 'vue';
|
|
|
+import { defineComponent, onMounted, onUnmounted, reactive, watch } from 'vue';
|
|
|
import styles from './index.module.less';
|
|
|
import { NInput, NScrollbar, NSelect, NSpin } from 'naive-ui';
|
|
|
import { useThrottleFn } from '@vueuse/core';
|
|
|
import CoursewareType from '../courseware-type';
|
|
|
import TheEmpty from '/src/components/TheEmpty';
|
|
|
import { api_queryOpenCoursewareByPage } from '../../api';
|
|
|
+import { eventGlobal } from '/src/utils';
|
|
|
|
|
|
export default defineComponent({
|
|
|
name: 'related-class',
|
|
@@ -37,7 +38,7 @@ export default defineComponent({
|
|
|
},
|
|
|
tableList: [] as any,
|
|
|
searchGroup: {
|
|
|
- subjectId: props.subjectId,
|
|
|
+ subjectId: props.subjectId ? Number(props.subjectId) : '',
|
|
|
keyword: null
|
|
|
}
|
|
|
});
|
|
@@ -98,12 +99,18 @@ export default defineComponent({
|
|
|
// );
|
|
|
|
|
|
const throttleFn = useThrottleFn(() => {
|
|
|
+ forms.pagination.page = 1;
|
|
|
forms.tableList = [];
|
|
|
getList();
|
|
|
}, 500);
|
|
|
|
|
|
onMounted(() => {
|
|
|
getList();
|
|
|
+ eventGlobal.on('openCoursewareChanged', throttleFn);
|
|
|
+ });
|
|
|
+
|
|
|
+ onUnmounted(() => {
|
|
|
+ eventGlobal.off('openCoursewareChanged', throttleFn);
|
|
|
});
|
|
|
return () => (
|
|
|
<div class={styles.relatedClass}>
|