|
@@ -1,21 +1,24 @@
|
|
|
import { defineComponent, onMounted, reactive, watch } from 'vue';
|
|
|
import styles from './index.module.less';
|
|
|
-import { NButton, NModal, NScrollbar, NSpace, NSpin } from 'naive-ui';
|
|
|
+import { NButton, NModal, NScrollbar, NSelect, NSpace, NSpin } from 'naive-ui';
|
|
|
import CardType from '/src/components/card-type';
|
|
|
import AttendClass from '/src/views/prepare-lessons/model/attend-class';
|
|
|
import { usePrepareStore } from '/src/store/modules/prepareLessons';
|
|
|
+import { useCatchStore } from '/src/store/modules/catchData';
|
|
|
import TheEmpty from '/src/components/TheEmpty';
|
|
|
import { queryCourseware } from '../../../api';
|
|
|
|
|
|
export default defineComponent({
|
|
|
name: 'courseware-modal',
|
|
|
setup() {
|
|
|
+ const catchStore = useCatchStore();
|
|
|
const prepareStore = usePrepareStore();
|
|
|
const forms = reactive({
|
|
|
loadingStatus: false,
|
|
|
showAttendClass: false
|
|
|
});
|
|
|
|
|
|
+ // 获取列表
|
|
|
const getList = async () => {
|
|
|
forms.loadingStatus = true;
|
|
|
try {
|
|
@@ -23,8 +26,7 @@ export default defineComponent({
|
|
|
if (!prepareStore.getSelectKey) return;
|
|
|
const { data } = await queryCourseware({
|
|
|
coursewareDetailKnowledgeId: prepareStore.getSelectKey,
|
|
|
- lessonCoursewareId: prepareStore.getLessonCoursewareId,
|
|
|
- lessonCoursewareDetailId: prepareStore.getLessonCoursewareDetailId,
|
|
|
+ subjectId: prepareStore.getSubjectId,
|
|
|
pag: 1,
|
|
|
rows: 99
|
|
|
});
|
|
@@ -49,7 +51,7 @@ export default defineComponent({
|
|
|
forms.loadingStatus = false;
|
|
|
};
|
|
|
|
|
|
- // 监听选择的key
|
|
|
+ // 监听选择的key 左侧选择了其它的课
|
|
|
watch(
|
|
|
() => prepareStore.getSelectKey,
|
|
|
() => {
|
|
@@ -57,13 +59,34 @@ export default defineComponent({
|
|
|
}
|
|
|
);
|
|
|
|
|
|
- onMounted(() => {
|
|
|
- getList();
|
|
|
+ onMounted(async () => {
|
|
|
+ // 获取教材分类列表
|
|
|
+ await catchStore.getSubjects();
|
|
|
+
|
|
|
+ const subjectList = catchStore.getSubjectList;
|
|
|
+ if (subjectList.length > 0) {
|
|
|
+ prepareStore.setSubjectId(subjectList[0].id);
|
|
|
+ }
|
|
|
+
|
|
|
+ await getList();
|
|
|
});
|
|
|
return () => (
|
|
|
<div class={styles.coursewareModal}>
|
|
|
<div class={styles.btnGroup}>
|
|
|
<NSpace>
|
|
|
+ <NSelect
|
|
|
+ class={styles.selectSubject}
|
|
|
+ placeholder="选择声部"
|
|
|
+ options={catchStore.getSubjectList}
|
|
|
+ clearable
|
|
|
+ labelField="name"
|
|
|
+ valueField="id"
|
|
|
+ value={prepareStore.getSubjectId}
|
|
|
+ onUpdate:value={(val: any) => {
|
|
|
+ prepareStore.setSubjectId(val);
|
|
|
+ getList();
|
|
|
+ }}
|
|
|
+ />
|
|
|
<NButton type="default">编辑</NButton>
|
|
|
</NSpace>
|
|
|
|