|
@@ -4,6 +4,7 @@ import { NButton, NSpace, useMessage } from 'naive-ui';
|
|
import { useCatchStore } from '/src/store/modules/catchData';
|
|
import { useCatchStore } from '/src/store/modules/catchData';
|
|
import iconSelect from '../../images/icon-select.png';
|
|
import iconSelect from '../../images/icon-select.png';
|
|
import { usePrepareStore } from '/src/store/modules/prepareLessons';
|
|
import { usePrepareStore } from '/src/store/modules/prepareLessons';
|
|
|
|
+import { PageEnum } from '/src/enums/pageEnum';
|
|
|
|
|
|
export default defineComponent({
|
|
export default defineComponent({
|
|
name: 'subject-sync',
|
|
name: 'subject-sync',
|
|
@@ -21,6 +22,24 @@ export default defineComponent({
|
|
const selectSubjectIds = ref([] as any);
|
|
const selectSubjectIds = ref([] as any);
|
|
const subjectList = ref([] as any);
|
|
const subjectList = ref([] as any);
|
|
|
|
|
|
|
|
+ const subjectImgs = {
|
|
|
|
+ Panpipes: 'https://oss.dayaedu.com/ktqy/17103860536976fd4a751.png',
|
|
|
|
+ Ocarina: 'https://oss.dayaedu.com/ktqy/171038605369851874b22.png',
|
|
|
|
+ Woodwind: 'https://oss.dayaedu.com/ktqy/17103860536966826c50d.png',
|
|
|
|
+ 'Tenor Recorder':
|
|
|
|
+ 'https://oss.dayaedu.com/ktqy/17103860536950592e357.png',
|
|
|
|
+ Nai: 'https://oss.dayaedu.com/ktqy/1710386053697af4aa985.png',
|
|
|
|
+ 'Baroque Recorder':
|
|
|
|
+ 'https://oss.dayaedu.com/ktqy/1710386053698031e847a.png'
|
|
|
|
+ } as any;
|
|
|
|
+ /*
|
|
|
|
+ https://oss.dayaedu.com/ktqy/17103860536950592e357.png
|
|
|
|
+ https://oss.dayaedu.com/ktqy/17103860536966826c50d.png
|
|
|
|
+ https://oss.dayaedu.com/ktqy/1710386053697af4aa985.png
|
|
|
|
+ https://oss.dayaedu.com/ktqy/17103860536976fd4a751.png
|
|
|
|
+ https://oss.dayaedu.com/ktqy/171038605369851874b22.png
|
|
|
|
+ https://oss.dayaedu.com/ktqy/1710386053698031e847a.png
|
|
|
|
+ */
|
|
const onSubmit = () => {
|
|
const onSubmit = () => {
|
|
if (selectSubjectIds.value.length <= 0) {
|
|
if (selectSubjectIds.value.length <= 0) {
|
|
message.error('至少选择一个声部进行同步');
|
|
message.error('至少选择一个声部进行同步');
|
|
@@ -30,7 +49,15 @@ export default defineComponent({
|
|
const subjectCode: any[] = [];
|
|
const subjectCode: any[] = [];
|
|
subjectList.value.forEach((subject: any) => {
|
|
subjectList.value.forEach((subject: any) => {
|
|
if (selectSubjectIds.value.includes(subject.id)) {
|
|
if (selectSubjectIds.value.includes(subject.id)) {
|
|
- subjectCode.push(subject.code);
|
|
|
|
|
|
+ subjectCode.push({
|
|
|
|
+ materialId: subject.id,
|
|
|
|
+ coverImg: subjectImgs[subject.code] || subjectImgs.Panpipes,
|
|
|
|
+ dataJson: null,
|
|
|
|
+ title: subject.name,
|
|
|
|
+ isCollect: false,
|
|
|
|
+ isSelected: false,
|
|
|
|
+ content: subject.code
|
|
|
|
+ });
|
|
}
|
|
}
|
|
});
|
|
});
|
|
emit('confirm', { subjectIds: selectSubjectIds.value, subjectCode });
|
|
emit('confirm', { subjectIds: selectSubjectIds.value, subjectCode });
|
|
@@ -39,19 +66,19 @@ export default defineComponent({
|
|
// 获取教材分类列表
|
|
// 获取教材分类列表
|
|
await catchStore.getSubjects();
|
|
await catchStore.getSubjects();
|
|
|
|
|
|
- const baseAllSubjectList = catchStore.getSubjectList;
|
|
|
|
- const teachingSubjectList = prepareStore.getSubjectList; // 教材自带声部;
|
|
|
|
- const tempSubjectList: any = [];
|
|
|
|
- baseAllSubjectList.forEach((subject: any) => {
|
|
|
|
- const index = teachingSubjectList.findIndex(
|
|
|
|
- (t: any) => t.id == subject.id
|
|
|
|
- );
|
|
|
|
- if (index != -1) {
|
|
|
|
- tempSubjectList.push(subject);
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
|
|
+ subjectList.value = catchStore.getSubjectList;
|
|
|
|
+ // const teachingSubjectList = prepareStore.getSubjectList; // 教材自带声部;
|
|
|
|
+ // const tempSubjectList: any = [];
|
|
|
|
+ // baseAllSubjectList.forEach((subject: any) => {
|
|
|
|
+ // const index = teachingSubjectList.findIndex(
|
|
|
|
+ // (t: any) => t.id == subject.id
|
|
|
|
+ // );
|
|
|
|
+ // if (index != -1) {
|
|
|
|
+ // tempSubjectList.push(subject);
|
|
|
|
+ // }
|
|
|
|
+ // });
|
|
|
|
|
|
- subjectList.value = tempSubjectList;
|
|
|
|
|
|
+ // subjectList.value = tempSubjectList;
|
|
if (props.subjectId) {
|
|
if (props.subjectId) {
|
|
selectSubjectIds.value = [Number(props.subjectId)];
|
|
selectSubjectIds.value = [Number(props.subjectId)];
|
|
}
|
|
}
|