|
@@ -9,7 +9,7 @@ import {
|
|
|
useMessage
|
|
|
} from 'naive-ui';
|
|
|
import { useRouter } from 'vue-router';
|
|
|
-import { getCourseChapter } from '../../classList/api';
|
|
|
+import { classGroupList, getCourseChapter } from '../../classList/api';
|
|
|
import {
|
|
|
bookVersionPage,
|
|
|
courseScheduleStart,
|
|
@@ -18,16 +18,20 @@ import {
|
|
|
} from '../../prepare-lessons/api';
|
|
|
import { useThrottleFn } from '@vueuse/core';
|
|
|
import { useCatchStore } from '/src/store/modules/catchData';
|
|
|
+import { gradeToCN } from '/src/utils/contants';
|
|
|
export default defineComponent({
|
|
|
name: 'train-update',
|
|
|
emits: ['close'],
|
|
|
setup(props, { emit }) {
|
|
|
const forms = reactive({
|
|
|
+ currentClass: null,
|
|
|
bookVersionId: null,
|
|
|
classGroupId: null,
|
|
|
category: null,
|
|
|
chapter: null,
|
|
|
subjectId: null,
|
|
|
+ gradeList: [] as any,
|
|
|
+ classList: [] as any,
|
|
|
musicTagList: [] as any,
|
|
|
loading: false,
|
|
|
list: [] as any,
|
|
@@ -42,31 +46,31 @@ export default defineComponent({
|
|
|
const gotoClassPage = () => {
|
|
|
formsRef.value.validate(async (error: any) => {
|
|
|
if (error) return;
|
|
|
- // const { data } = await queryCourseware({
|
|
|
- // coursewareDetailKnowledgeId: forms.chapter,
|
|
|
- // subjectId: forms.subjectId,
|
|
|
- // page: 1,
|
|
|
- // rows: 99
|
|
|
- // });
|
|
|
- // await courseScheduleStart({
|
|
|
- // lessonCoursewareKnowledgeDetailId: forms.chapter,
|
|
|
- // classGroupId: props.activeRow.id
|
|
|
- // });
|
|
|
- // if (data.rows && data.rows.length > 0) {
|
|
|
- // const { href } = router.resolve({
|
|
|
- // path: '/attend-class',
|
|
|
- // query: {
|
|
|
- // type: 'class',
|
|
|
- // classGroupId: props.activeRow.id,
|
|
|
- // subjectId: forms.subjectId,
|
|
|
- // detailId: forms.chapter
|
|
|
- // }
|
|
|
- // });
|
|
|
- // emit('close');
|
|
|
- // window.open(href, +new Date() + '', 'fullscreen=yes');
|
|
|
- // } else {
|
|
|
- // message.error('当前章节暂无课件,请重新选择');
|
|
|
- // }
|
|
|
+ const { data } = await queryCourseware({
|
|
|
+ coursewareDetailKnowledgeId: forms.chapter,
|
|
|
+ subjectId: forms.subjectId,
|
|
|
+ page: 1,
|
|
|
+ rows: 99
|
|
|
+ });
|
|
|
+ await courseScheduleStart({
|
|
|
+ lessonCoursewareKnowledgeDetailId: forms.chapter,
|
|
|
+ classGroupId: forms.currentClass
|
|
|
+ });
|
|
|
+ if (data.rows && data.rows.length > 0) {
|
|
|
+ const { href } = router.resolve({
|
|
|
+ path: '/attend-class',
|
|
|
+ query: {
|
|
|
+ type: 'class',
|
|
|
+ classGroupId: forms.currentClass,
|
|
|
+ subjectId: forms.subjectId,
|
|
|
+ detailId: forms.chapter
|
|
|
+ }
|
|
|
+ });
|
|
|
+ emit('close');
|
|
|
+ window.open(href, +new Date() + '', 'fullscreen=yes');
|
|
|
+ } else {
|
|
|
+ message.error('当前章节暂无课件,请重新选择');
|
|
|
+ }
|
|
|
});
|
|
|
};
|
|
|
|
|
@@ -160,52 +164,29 @@ export default defineComponent({
|
|
|
};
|
|
|
|
|
|
// 获取年级班级
|
|
|
- // const getClassList = async () => {
|
|
|
- // try {
|
|
|
- // const { data } = await classGroupList({ removeZeroClass: true });
|
|
|
- // const cList = data || [];
|
|
|
- // const gradeList: any = [];
|
|
|
- // const popSelectOptions: any = [];
|
|
|
- // cList.forEach((item: any, index: number) => {
|
|
|
- // if (index === 0) {
|
|
|
- // const temp = item.classGroupList[0];
|
|
|
- // forms.classSelect = {
|
|
|
- // currentGradeNum: item.currentGradeNum,
|
|
|
- // currentClass: temp.id,
|
|
|
- // name: temp.name
|
|
|
- // };
|
|
|
- // }
|
|
|
-
|
|
|
- // const classList: any = [];
|
|
|
- // item.classGroupList.forEach((i: any) => {
|
|
|
- // classList.push({
|
|
|
- // label: i.currentClass + '班',
|
|
|
- // value: i.id,
|
|
|
- // lastStudy: i.lastStudy
|
|
|
- // });
|
|
|
+ const getClassList = async () => {
|
|
|
+ try {
|
|
|
+ const { data } = await classGroupList({ removeZeroClass: true });
|
|
|
|
|
|
- // popSelectOptions.push({
|
|
|
- // label: i.name,
|
|
|
- // value: i.id,
|
|
|
- // currentGradeNum: item.currentGradeNum,
|
|
|
- // lastStudy: i.lastStudy
|
|
|
- // });
|
|
|
- // });
|
|
|
+ const cList = data.rows || [];
|
|
|
+ const gradeList: any = [];
|
|
|
+ cList.forEach((item: any) => {
|
|
|
+ gradeList.push({
|
|
|
+ label: item.name,
|
|
|
+ value: item.currentClass
|
|
|
+ });
|
|
|
+ });
|
|
|
+ forms.gradeList = gradeList;
|
|
|
|
|
|
- // gradeList.push({
|
|
|
- // label: gradeToCN[item.currentGradeNum],
|
|
|
- // value: item.currentGradeNum,
|
|
|
- // childrens: classList
|
|
|
- // });
|
|
|
- // });
|
|
|
- // forms.popSelectOptions = popSelectOptions;
|
|
|
- // forms.gradeList = gradeList;
|
|
|
- // } catch {
|
|
|
- // //
|
|
|
- // }
|
|
|
- // };
|
|
|
+ console.log(forms.gradeList, 'gradeList');
|
|
|
+ } catch (e: any) {
|
|
|
+ //
|
|
|
+ console.log(e, 'e');
|
|
|
+ }
|
|
|
+ };
|
|
|
|
|
|
onMounted(async () => {
|
|
|
+ await getClassList();
|
|
|
await catchStore.getSubjects();
|
|
|
forms.subjectList = catchStore.getSubjectList.map((item: any) => {
|
|
|
return {
|
|
@@ -223,20 +204,19 @@ export default defineComponent({
|
|
|
ref={formsRef}
|
|
|
model={forms}>
|
|
|
<NFormItem
|
|
|
- label="年级"
|
|
|
- path="currentGradeNum"
|
|
|
+ path="currentClass"
|
|
|
rule={[
|
|
|
{
|
|
|
required: true,
|
|
|
- message: '请选择年级',
|
|
|
+ message: '请选择班级',
|
|
|
trigger: 'change',
|
|
|
type: 'number'
|
|
|
}
|
|
|
]}>
|
|
|
<NSelect
|
|
|
- v-model:value={forms.currentGradeNum}
|
|
|
- placeholder="请选择年级"
|
|
|
- options={props.gradeList as any}
|
|
|
+ v-model:value={forms.currentClass}
|
|
|
+ placeholder="请选择班级"
|
|
|
+ options={forms.gradeList as any}
|
|
|
clearable
|
|
|
onUpdate:value={() => {
|
|
|
forms.classGroupId = null;
|
|
@@ -245,20 +225,6 @@ export default defineComponent({
|
|
|
/>
|
|
|
</NFormItem>
|
|
|
<NFormItem
|
|
|
- label="班级"
|
|
|
- path="classGroupId"
|
|
|
- rule={[
|
|
|
- { required: true, message: '请选择班级', trigger: 'change' }
|
|
|
- ]}>
|
|
|
- <NSelect
|
|
|
- v-model:value={forms.classGroupId}
|
|
|
- placeholder="请选择班级"
|
|
|
- clearable
|
|
|
- options={forms.classList}
|
|
|
- disabled={!forms.currentGradeNum}
|
|
|
- />
|
|
|
- </NFormItem>
|
|
|
- <NFormItem
|
|
|
path="bookVersionId"
|
|
|
rule={[{ required: true, message: '选择教材版本' }]}>
|
|
|
<NSelect
|