|
@@ -16,13 +16,14 @@ import { usePrepareStore } from '/src/store/modules/prepareLessons';
|
|
import { useCatchStore } from '/src/store/modules/catchData';
|
|
import { useCatchStore } from '/src/store/modules/catchData';
|
|
import TheEmpty from '/src/components/TheEmpty';
|
|
import TheEmpty from '/src/components/TheEmpty';
|
|
import {
|
|
import {
|
|
|
|
+ courseScheduleStart,
|
|
queryCourseware,
|
|
queryCourseware,
|
|
saveCourseware,
|
|
saveCourseware,
|
|
teacherKnowledgeMaterialDelete
|
|
teacherKnowledgeMaterialDelete
|
|
} from '../../../api';
|
|
} from '../../../api';
|
|
import Draggable from 'vuedraggable';
|
|
import Draggable from 'vuedraggable';
|
|
import iconDelete from '../../../images/icon-delete.png';
|
|
import iconDelete from '../../../images/icon-delete.png';
|
|
-import { useRoute, useRouter } from 'vue-router';
|
|
|
|
|
|
+import { onBeforeRouteUpdate, useRoute, useRouter } from 'vue-router';
|
|
import deepClone from '/src/helpers/deep-clone';
|
|
import deepClone from '/src/helpers/deep-clone';
|
|
import CardPreview from '/src/components/card-preview';
|
|
import CardPreview from '/src/components/card-preview';
|
|
import PreviewWindow from '/src/views/preview-window';
|
|
import PreviewWindow from '/src/views/preview-window';
|
|
@@ -173,10 +174,10 @@ export default defineComponent({
|
|
forms.drag = false;
|
|
forms.drag = false;
|
|
message.success('编辑成功');
|
|
message.success('编辑成功');
|
|
forms.removeVisiable = false;
|
|
forms.removeVisiable = false;
|
|
- prepareStore.setCoursewareList(deepClone(forms.coursewareList));
|
|
|
|
prepareStore.setIsEditResource(false);
|
|
prepareStore.setIsEditResource(false);
|
|
// 重置临时删除编号
|
|
// 重置临时删除编号
|
|
forms.removeIds = [];
|
|
forms.removeIds = [];
|
|
|
|
+ await getList();
|
|
} catch {
|
|
} catch {
|
|
//
|
|
//
|
|
}
|
|
}
|
|
@@ -253,21 +254,49 @@ export default defineComponent({
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
- onMounted(async () => {
|
|
|
|
- // 获取教材分类列表
|
|
|
|
- await catchStore.getSubjects();
|
|
|
|
|
|
+ watch(
|
|
|
|
+ () => prepareStore.getSubjectList,
|
|
|
|
+ () => {
|
|
|
|
+ checkSubjectIds();
|
|
|
|
+ }
|
|
|
|
+ );
|
|
|
|
|
|
- const subjectList = catchStore.getSubjectList;
|
|
|
|
|
|
+ const checkSubjectIds = () => {
|
|
|
|
+ const subjectList = prepareStore.getSubjectList;
|
|
|
|
+ // console.log(subjectList, 'subjectList');
|
|
// 并且没有声部时才会更新
|
|
// 并且没有声部时才会更新
|
|
if (subjectList.length > 0) {
|
|
if (subjectList.length > 0) {
|
|
// 判断浏览器上面是否有
|
|
// 判断浏览器上面是否有
|
|
- if (forms.subjectId) {
|
|
|
|
|
|
+ const index = subjectList.findIndex(
|
|
|
|
+ (subject: any) => subject.id == forms.subjectId
|
|
|
|
+ );
|
|
|
|
+ // 并且声部在列表中
|
|
|
|
+ if (forms.subjectId && index >= 0) {
|
|
prepareStore.setSubjectId(forms.subjectId);
|
|
prepareStore.setSubjectId(forms.subjectId);
|
|
} else if (!prepareStore.getSubjectId) {
|
|
} else if (!prepareStore.getSubjectId) {
|
|
// 判断是否有缓存
|
|
// 判断是否有缓存
|
|
prepareStore.setSubjectId(subjectList[0].id);
|
|
prepareStore.setSubjectId(subjectList[0].id);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ watch(
|
|
|
|
+ () => route.query,
|
|
|
|
+ async () => {
|
|
|
|
+ forms.className = route.query.name as any;
|
|
|
|
+ forms.classGroupId = route.query.classGroupId as any;
|
|
|
|
+ forms.subjectId = route.query.subjectId
|
|
|
|
+ ? Number(route.query.subjectId)
|
|
|
|
+ : null;
|
|
|
|
+
|
|
|
|
+ checkSubjectIds();
|
|
|
|
+ await getList();
|
|
|
|
+ }
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ onMounted(async () => {
|
|
|
|
+ // 获取教材分类列表
|
|
|
|
+ checkSubjectIds();
|
|
|
|
|
|
await getList();
|
|
await getList();
|
|
|
|
|
|
@@ -300,6 +329,7 @@ export default defineComponent({
|
|
type="error"
|
|
type="error"
|
|
onClick={() => {
|
|
onClick={() => {
|
|
forms.drag = false;
|
|
forms.drag = false;
|
|
|
|
+ forms.isEdit = false;
|
|
prepareStore.setIsEditResource(false);
|
|
prepareStore.setIsEditResource(false);
|
|
forms.removeIds = [];
|
|
forms.removeIds = [];
|
|
getList();
|
|
getList();
|
|
@@ -310,6 +340,7 @@ export default defineComponent({
|
|
type="error"
|
|
type="error"
|
|
onClick={() => {
|
|
onClick={() => {
|
|
forms.removeVisiable1 = true;
|
|
forms.removeVisiable1 = true;
|
|
|
|
+ forms.isEdit = true;
|
|
}}>
|
|
}}>
|
|
清空资源
|
|
清空资源
|
|
</NButton>
|
|
</NButton>
|
|
@@ -342,7 +373,7 @@ export default defineComponent({
|
|
<NSelect
|
|
<NSelect
|
|
placeholder="选择声部"
|
|
placeholder="选择声部"
|
|
class={styles.btnSubjectList}
|
|
class={styles.btnSubjectList}
|
|
- options={catchStore.getSubjectList}
|
|
|
|
|
|
+ options={prepareStore.getSubjectList}
|
|
labelField="name"
|
|
labelField="name"
|
|
valueField="id"
|
|
valueField="id"
|
|
value={prepareStore.getSubjectId}
|
|
value={prepareStore.getSubjectId}
|
|
@@ -426,7 +457,7 @@ export default defineComponent({
|
|
</Draggable>
|
|
</Draggable>
|
|
) : (
|
|
) : (
|
|
<div class={styles.list}>
|
|
<div class={styles.list}>
|
|
- {forms.coursewareList.map((item: any, index: number) => (
|
|
|
|
|
|
+ {forms.coursewareList.map((item: any) => (
|
|
<CardType
|
|
<CardType
|
|
class={[styles.itemContent, 'handle']}
|
|
class={[styles.itemContent, 'handle']}
|
|
isShowCollect={false}
|
|
isShowCollect={false}
|
|
@@ -462,7 +493,7 @@ export default defineComponent({
|
|
{...{ id: 'lessons-3' }}
|
|
{...{ id: 'lessons-3' }}
|
|
type="primary"
|
|
type="primary"
|
|
class={styles.btnClassStart}
|
|
class={styles.btnClassStart}
|
|
- onClick={() => {
|
|
|
|
|
|
+ onClick={async () => {
|
|
let count = 0;
|
|
let count = 0;
|
|
forms.coursewareList.forEach((item: any) => {
|
|
forms.coursewareList.forEach((item: any) => {
|
|
if (!item.removeFlag) {
|
|
if (!item.removeFlag) {
|
|
@@ -473,8 +504,40 @@ export default defineComponent({
|
|
message.error('课件不能为空');
|
|
message.error('课件不能为空');
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- forms.showAttendClass = true;
|
|
|
|
- forms.attendClassType = 'select';
|
|
|
|
|
|
+
|
|
|
|
+ if (forms.classGroupId) {
|
|
|
|
+ // 开始上课
|
|
|
|
+ await courseScheduleStart({
|
|
|
|
+ lessonCoursewareKnowledgeDetailId: prepareStore.selectKey,
|
|
|
|
+ classGroupId: forms.classGroupId
|
|
|
|
+ });
|
|
|
|
+ if (window.matchMedia('(display-mode: standalone)').matches) {
|
|
|
|
+ state.application = window.matchMedia(
|
|
|
|
+ '(display-mode: standalone)'
|
|
|
|
+ ).matches;
|
|
|
|
+ forms.previewModal = true;
|
|
|
|
+ forms.previewParams = {
|
|
|
|
+ type: 'class',
|
|
|
|
+ classGroupId: forms.classGroupId,
|
|
|
|
+ subjectId: prepareStore.getSubjectId,
|
|
|
|
+ detailId: prepareStore.getSelectKey
|
|
|
|
+ };
|
|
|
|
+ } else {
|
|
|
|
+ const { href } = router.resolve({
|
|
|
|
+ path: '/attend-class',
|
|
|
|
+ query: {
|
|
|
|
+ type: 'class',
|
|
|
|
+ classGroupId: forms.classGroupId,
|
|
|
|
+ subjectId: prepareStore.getSubjectId,
|
|
|
|
+ detailId: prepareStore.getSelectKey
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ window.open(href, +new Date() + '');
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ forms.showAttendClass = true;
|
|
|
|
+ forms.attendClassType = 'select';
|
|
|
|
+ }
|
|
}}>
|
|
}}>
|
|
开始上课
|
|
开始上课
|
|
</NButton>
|
|
</NButton>
|
|
@@ -514,7 +577,15 @@ export default defineComponent({
|
|
console.log(item, 'confirm');
|
|
console.log(item, 'confirm');
|
|
forms.className = item.name;
|
|
forms.className = item.name;
|
|
forms.classGroupId = item.classGroupId;
|
|
forms.classGroupId = item.classGroupId;
|
|
|
|
+ forms.subjectId = item.subjectId;
|
|
forms.showAttendClass = false;
|
|
forms.showAttendClass = false;
|
|
|
|
+
|
|
|
|
+ checkSubjectIds();
|
|
|
|
+ // 声部切换时
|
|
|
|
+ eventGlobal.emit('onChangeClass', {
|
|
|
|
+ lastUseCoursewareId: item.lastUseCoursewareId,
|
|
|
|
+ unit: item.unit
|
|
|
|
+ });
|
|
}}
|
|
}}
|
|
/>
|
|
/>
|
|
</NModal>
|
|
</NModal>
|
|
@@ -590,11 +661,15 @@ export default defineComponent({
|
|
<SubjectSync
|
|
<SubjectSync
|
|
subjectId={prepareStore.getSubjectId as any}
|
|
subjectId={prepareStore.getSubjectId as any}
|
|
onClose={() => (forms.subjectSyncVisiable = false)}
|
|
onClose={() => (forms.subjectSyncVisiable = false)}
|
|
- onConfirm={(subjectIds: any) => {
|
|
|
|
|
|
+ onConfirm={async (subjectIds: any) => {
|
|
//
|
|
//
|
|
- console.log(subjectIds, 'subjectIds');
|
|
|
|
- forms.editSubjectIds = subjectIds.join(',');
|
|
|
|
- onOverEdit();
|
|
|
|
|
|
+ try {
|
|
|
|
+ forms.editSubjectIds = subjectIds.join(',');
|
|
|
|
+ await onOverEdit();
|
|
|
|
+ forms.subjectSyncVisiable = false;
|
|
|
|
+ } catch {
|
|
|
|
+ //
|
|
|
|
+ }
|
|
}}
|
|
}}
|
|
/>
|
|
/>
|
|
</NModal>
|
|
</NModal>
|