|
@@ -14,7 +14,7 @@ import { materialQueryPage } from '/src/views/natural-resources/api';
|
|
import TheEmpty from '/src/components/TheEmpty';
|
|
import TheEmpty from '/src/components/TheEmpty';
|
|
import { usePrepareStore } from '/src/store/modules/prepareLessons';
|
|
import { usePrepareStore } from '/src/store/modules/prepareLessons';
|
|
import { saveCourseware } from '../../../api';
|
|
import { saveCourseware } from '../../../api';
|
|
-import { useDebounceFn } from '@vueuse/core';
|
|
|
|
|
|
+import { useDebounceFn, useResizeObserver } from '@vueuse/core';
|
|
import CardPreview from '/src/components/card-preview';
|
|
import CardPreview from '/src/components/card-preview';
|
|
import { eventGlobal } from '/src/utils';
|
|
import { eventGlobal } from '/src/utils';
|
|
|
|
|
|
@@ -40,7 +40,9 @@ export default defineComponent({
|
|
const prepareStore = usePrepareStore();
|
|
const prepareStore = usePrepareStore();
|
|
const message = useMessage();
|
|
const message = useMessage();
|
|
const { type } = toRefs(props);
|
|
const { type } = toRefs(props);
|
|
|
|
+ const className = 'resourceSearchGroup' + +new Date();
|
|
const state = reactive({
|
|
const state = reactive({
|
|
|
|
+ searchHeight: '0px',
|
|
loading: false,
|
|
loading: false,
|
|
finshed: false, // 是否加载完
|
|
finshed: false, // 是否加载完
|
|
pagination: {
|
|
pagination: {
|
|
@@ -185,16 +187,34 @@ export default defineComponent({
|
|
|
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
getList();
|
|
getList();
|
|
|
|
+
|
|
|
|
+ useResizeObserver(
|
|
|
|
+ document.querySelector('.' + className) as HTMLElement,
|
|
|
|
+ (entries: any) => {
|
|
|
|
+ const entry = entries[0];
|
|
|
|
+ const { height } = entry.contentRect;
|
|
|
|
+ // document.documentElement.style.setProperty(
|
|
|
|
+ // '--modal-lesson-search-height',
|
|
|
|
+ // height + 'px'
|
|
|
|
+ // );
|
|
|
|
+ state.searchHeight = height + 'px';
|
|
|
|
+ }
|
|
|
|
+ );
|
|
});
|
|
});
|
|
return () => (
|
|
return () => (
|
|
<div>
|
|
<div>
|
|
- <ResourceSearchGroup
|
|
|
|
- type={props.type}
|
|
|
|
- subjectId={prepareStore.getSubjectId as any}
|
|
|
|
- onSearch={(item: any) => throttledFnSearch(item)}
|
|
|
|
- />
|
|
|
|
|
|
+ <div class={className}>
|
|
|
|
+ <ResourceSearchGroup
|
|
|
|
+ type={props.type}
|
|
|
|
+ subjectId={prepareStore.getSubjectId as any}
|
|
|
|
+ onSearch={(item: any) => throttledFnSearch(item)}
|
|
|
|
+ />
|
|
|
|
+ </div>
|
|
<NScrollbar
|
|
<NScrollbar
|
|
class={styles.listContainer}
|
|
class={styles.listContainer}
|
|
|
|
+ style={{
|
|
|
|
+ 'max-height': `calc(85vh - var(--modal-lesson-tab-height) - ${state.searchHeight} - 12px) `
|
|
|
|
+ }}
|
|
onScroll={(e: any) => {
|
|
onScroll={(e: any) => {
|
|
const clientHeight = e.target?.clientHeight;
|
|
const clientHeight = e.target?.clientHeight;
|
|
const scrollTop = e.target?.scrollTop;
|
|
const scrollTop = e.target?.scrollTop;
|
|
@@ -211,6 +231,9 @@ export default defineComponent({
|
|
}}>
|
|
}}>
|
|
<NSpin show={state.loading} size={'small'}>
|
|
<NSpin show={state.loading} size={'small'}>
|
|
<div
|
|
<div
|
|
|
|
+ style={{
|
|
|
|
+ 'min-height': `calc(85vh - var(--modal-lesson-tab-height) - ${state.searchHeight} - 12px)`
|
|
|
|
+ }}
|
|
class={[
|
|
class={[
|
|
styles.listSection,
|
|
styles.listSection,
|
|
!state.loading && state.tableList.length <= 0
|
|
!state.loading && state.tableList.length <= 0
|