瀏覽代碼

添加声部选择

lex 1 年之前
父節點
當前提交
ef2116caba

+ 3 - 3
src/components/card-type/index.module.less

@@ -142,8 +142,8 @@
     font-weight: 600;
     height: 32px;
     border-radius: 8px;
-    display: none;
-    opacity: 0;
+    // display: none;
+    // opacity: 0;
     z-index: 99;
     transition: all .3s ease-in-out;
 
@@ -188,4 +188,4 @@
       min-width: 124px;
     }
   }
-}
+}

+ 4 - 2
src/components/layout/index.module.less

@@ -452,7 +452,9 @@
 
 
 .showClass {
-  width: 520px;
+  width: 800px;
+  border-radius: 16px;
+  overflow: hidden;
 }
 
 
@@ -474,4 +476,4 @@
     }
   }
 
-}
+}

+ 10 - 20
src/components/layout/index.tsx

@@ -30,6 +30,7 @@ import PlaceholderTone from './modals/placeholderTone';
 import { state } from '/src/state';
 import PreviewWindow from '/src/views/preview-window';
 import { fscreen } from '@/utils/index';
+import AttendClass from '/src/views/prepare-lessons/model/attend-class';
 export default defineComponent({
   name: 'layoutView',
   setup() {
@@ -400,7 +401,6 @@ export default defineComponent({
           }
         }
         rate(target, 0);
-
       });
       target.addEventListener('mouseout', () => {
         if (wrapInfo.isBoundary) {
@@ -680,27 +680,17 @@ export default defineComponent({
           class={['modalTitle background', styles.showClass]}
           preset="card"
           title={'开始上课'}>
-          <ChioseModal
+          <AttendClass
             onClose={() => (showClass.value = false)}
-            onPreview={(item: any) => {
-              if (window.matchMedia('(display-mode: standalone)').matches) {
-                previewModal.value = true;
-                previewItem.value = {
+            type="change"
+            onConfirm={(item: any) => {
+              showClass.value = false;
+              router.push({
+                path: '/prepare-lessons',
+                query: {
                   ...item
-                };
-                state.application = window.matchMedia(
-                  '(display-mode: standalone)'
-                ).matches;
-                fscreen();
-              } else {
-                const { href } = router.resolve({
-                  path: '/attend-class',
-                  query: {
-                    ...item
-                  }
-                });
-                window.open(href, +new Date() + '');
-              }
+                }
+              });
             }}
           />
         </NModal>

+ 8 - 0
src/views/classList/api.ts

@@ -186,3 +186,11 @@ export const resetClass = (params: any) => {
     data: params
   });
 };
+/**
+ * 修改声部
+ */
+export const updateSubject = (params: any) => {
+  return request.post('/edu-app/classGroup/updateSubject', {
+    data: params
+  });
+};

+ 82 - 77
src/views/classList/index.tsx

@@ -15,7 +15,7 @@ import {
 import SearchInput from '@/components/searchInput';
 import CSelect from '@/components/CSelect';
 import Pagination from '@/components/pagination';
-import { classGroupList, deleteClass,getSubject } from './api';
+import { classGroupList, deleteClass, getSubject } from './api';
 
 import CreateClass from './modals/createClass';
 import RestStudentBox from './modals/restStudentBox';
@@ -29,9 +29,10 @@ import TheEmpty from '/src/components/TheEmpty';
 import TheTooltip from '/src/components/TheTooltip';
 import PreviewWindow from '../preview-window';
 import { state as globalState } from '/src/state';
-import {courseSchedulePage} from '../home/api'
-import ResetSubject from './modals/resetSubject'
+import { courseSchedulePage } from '../home/api';
+import ResetSubject from './modals/resetSubject';
 import { fscreen } from '/src/utils';
+import UpdateSubject from './modals/updateSubject';
 export default defineComponent({
   name: 'class-classList',
   setup(props, { emit }) {
@@ -40,7 +41,7 @@ export default defineComponent({
         keyword: null as any,
         currentClass: null,
         currentGradeNum: null,
-        subjectId:null
+        subjectId: null
       },
       orchestraType: null,
       courseTypeCode: null,
@@ -60,9 +61,10 @@ export default defineComponent({
       removeRow: {} as any,
       previewModal: false,
       previewParams: {} as any,
-      lastCourse:null as any,
-      subjectList:[] as any,
-      showResetClass:false
+      lastCourse: null as any,
+      subjectList: [] as any,
+      showResetClass: false,
+      showSubjectClass: false
     });
     const formRef = ref();
     const dialog = useDialog();
@@ -80,7 +82,7 @@ export default defineComponent({
         keyword: null as any,
         currentClass: null,
         currentGradeNum: null,
-        subjectId:null
+        subjectId: null
       };
       getList();
     };
@@ -118,16 +120,16 @@ export default defineComponent({
       }
       console.log('getList');
     };
-    const getSubjectList = async()=>{
-      const res = await getSubject({page:1,rows:9999})
-      state.subjectList = res.data.rows.map((item:any)=>{
+    const getSubjectList = async () => {
+      const res = await getSubject({ page: 1, rows: 9999 });
+      state.subjectList = res.data.rows.map((item: any) => {
         return {
-          value:item.id,
-          label:item.name
-        }
-      })
-      state.subjectList.unshift( { value: null, label: '选择声部' },)
-    }
+          value: item.id,
+          label: item.name
+        };
+      });
+      state.subjectList.unshift({ value: null, label: '选择声部' });
+    };
     const columns = () => {
       return [
         {
@@ -196,12 +198,12 @@ export default defineComponent({
                       详情
                     </NButton>
                   )}
-                     <NButton
-                      type="primary"
-                      text
-                      onClick={() => resetClassSubject(row)}>
-                      修改声部
-                    </NButton>
+                  <NButton
+                    type="primary"
+                    text
+                    onClick={() => resetClassSubject(row)}>
+                    修改声部
+                  </NButton>
                   {index == 0 ? (
                     <NButton
                       type="primary"
@@ -264,31 +266,36 @@ export default defineComponent({
       state.studentVisible = true;
     };
 
-    const classesBegin = async(row: any) => {
-       try{
-        const res = await courseSchedulePage({"classGroupId": row.id})
-      if(res.data.rows.length>0){
-        state.lastCourse = res.data.rows[0]
-        console.log(state.lastCourse,'state.lastCourse')
-      }else{
-        state.lastCourse = null
+    const classesBegin = async (row: any) => {
+      try {
+        console.log(row, 'row');
+        // 判断是否有声部
+        if (row.subjectId) {
+          //
+          router.push({
+            path: '/prepare-lessons',
+            query: {
+              lastUseCoursewareId: row.lessonCoursewareId,
+              unit: row.lessonCoursewareKnowledgeDetailId,
+              subjectId: row.subjectId
+            }
+          });
+        } else {
+          state.showSubjectClass = true;
+          state.activeRow = row;
+        }
+      } catch (e) {
+        console.log(e);
       }
-        console.log(res)
-        // const lastCorse =
-       }catch(e){
-        console.log(e)
-       }
-      state.activeRow = row;
-      state.goCourseVisiable = true;
     };
 
-    const resetClassSubject = (row:any)=>{
+    const resetClassSubject = (row: any) => {
       state.activeRow = row;
-      state.showResetClass = true
-    }
+      state.showResetClass = true;
+    };
     onMounted(() => {
       getList();
-      getSubjectList()
+      getSubjectList();
     });
     return () => (
       <div class={styles.listWrap}>
@@ -399,14 +406,15 @@ export default defineComponent({
           preset="card"
           class={['modalTitle background']}
           title={'创建班级'}>
-            {state.showaddClass?    <CreateClass
-            gradeNumList={state.gradeNumList}
-            classArray={classArray}
-            subjectList = {state.subjectList}
-            onGetList={() => getList()}
-            onClose={() => (state.showaddClass = false)}
-          />:null}
-
+          {state.showaddClass ? (
+            <CreateClass
+              gradeNumList={state.gradeNumList}
+              classArray={classArray}
+              subjectList={state.subjectList}
+              onGetList={() => getList()}
+              onClose={() => (state.showaddClass = false)}
+            />
+          ) : null}
         </NModal>
         <NModal
           v-model:show={state.showResetClass}
@@ -414,41 +422,38 @@ export default defineComponent({
           preset="card"
           class={['modalTitle background']}
           title={'修改声部'}>
-            {state.showResetClass?    <ResetSubject
-            activeRow={state.activeRow}
-            subjectList = {state.subjectList}
-            onGetList={() => getList()}
-            onClose={() => (state.showResetClass = false)}
-          />:null}
-
+          {state.showResetClass ? (
+            <ResetSubject
+              activeRow={state.activeRow}
+              subjectList={state.subjectList}
+              onGetList={() => getList()}
+              onClose={() => (state.showResetClass = false)}
+            />
+          ) : null}
         </NModal>
 
         <NModal
-          v-model:show={state.goCourseVisiable}
+          v-model:show={state.showSubjectClass}
+          style={{ width: '500px' }}
           preset="card"
-          class={['modalTitle background', styles.chioseModel]}
-          title={'选择课件'}>
-          <TrainDetail
-            activeRow={state.activeRow}
-            onClose={() => (state.goCourseVisiable = false)}
-            onPreview={(item: any) => {
-              if (globalState.application) {
-                state.previewModal = true;
-                state.previewParams = {
-                  ...item
-                };
-                globalState.application= window.matchMedia('(display-mode: standalone)').matches
-                fscreen()
-              } else {
-                const { href } = router.resolve({
-                  path: '/attend-class',
+          class={['modalTitle background']}
+          title={'修改声部'}>
+          {state.showSubjectClass ? (
+            <UpdateSubject
+              activeRow={state.activeRow}
+              onGetList={() => getList()}
+              onConfirm={(item: any) => {
+                //
+                router.push({
+                  path: '/prepare-lessons',
                   query: {
                     ...item
                   }
                 });
-                window.open(href, +new Date() + '');
-              }
-            }}></TrainDetail>
+              }}
+              onClose={() => (state.showSubjectClass = false)}
+            />
+          ) : null}
         </NModal>
 
         {/* 上课弹窗 */}

+ 13 - 13
src/views/classList/modals/resetSubject.tsx

@@ -24,10 +24,10 @@ export default defineComponent({
       type: Array,
       default: () => []
     },
-    subjectList:{
+    subjectList: {
       type: Array,
       default: () => []
-    },
+    }
   },
   name: 'resetStudent',
   emits: ['close', 'getList'],
@@ -40,17 +40,17 @@ export default defineComponent({
     const createClassForm = reactive({
       currentGradeNum: null,
       currentClass: null,
-      subjectId:null,
-      id:null
+      subjectId: null,
+      id: null
+    });
+    onMounted(() => {
+      createClassForm.currentGradeNum = props.activeRow.currentGradeNum;
+      createClassForm.currentClass = props.activeRow.currentClass;
+      createClassForm.subjectId = props.activeRow.subjectId;
+      createClassForm.id = props.activeRow.id;
     });
-    onMounted(()=>{
-      createClassForm.currentGradeNum = props.activeRow.currentGradeNum
-      createClassForm.currentClass = props.activeRow.currentClass
-      createClassForm.subjectId = props.activeRow.subjectId
-      createClassForm.id = props.activeRow.id
-    })
     const submitForms = () => {
-      data.uploading = true
+      data.uploading = true;
       foemsRef.value.validate(async (error: any) => {
         if (error) {
           return;
@@ -60,9 +60,9 @@ export default defineComponent({
           message.success('修改成功');
           emit('close');
           emit('getList');
-          data.uploading = false
+          data.uploading = false;
         } catch (e) {
-          data.uploading = false
+          data.uploading = false;
           console.log(e);
         }
       });

+ 108 - 0
src/views/classList/modals/updateSubject.tsx

@@ -0,0 +1,108 @@
+import { NButton, NSpace, useMessage, NForm, NFormItem } from 'naive-ui';
+import { defineComponent, onMounted, reactive, ref } from 'vue';
+import styles from '../index.module.less';
+import CSelect from '/src/components/CSelect';
+import { resetClass } from '../api';
+import { useCatchStore } from '/src/store/modules/catchData';
+export default defineComponent({
+  props: {
+    activeRow: {
+      type: Object,
+      default: () => ({ id: '' })
+    },
+    subjectList: {
+      type: Array,
+      default: () => []
+    }
+  },
+  name: 'resetStudent',
+  emits: ['close', 'getList', 'confirm'],
+  setup(props, { emit }) {
+    const catchStore = useCatchStore();
+    const data = reactive({
+      uploading: false
+    });
+    const message = useMessage();
+    const subjectList = ref([] as any);
+    const foemsRef = ref();
+    const createClassForm = reactive({
+      currentGradeNum: null,
+      currentClass: null,
+      subjectId: null,
+      id: null
+    });
+    onMounted(async () => {
+      // 获取教材分类列表
+      await catchStore.getSubjects();
+      subjectList.value = [
+        { id: null, name: '选择声部' },
+        ...catchStore.getSubjectList
+      ];
+
+      createClassForm.currentGradeNum = props.activeRow.currentGradeNum;
+      createClassForm.currentClass = props.activeRow.currentClass;
+      createClassForm.subjectId = props.activeRow.subjectId;
+      createClassForm.id = props.activeRow.id;
+    });
+    const submitForms = () => {
+      data.uploading = true;
+      foemsRef.value.validate(async (error: any) => {
+        if (error) {
+          return;
+        }
+        try {
+          await resetClass({ ...createClassForm });
+          message.success('修改成功');
+          emit('close');
+          emit('confirm', {
+            lastUseCoursewareId: props.activeRow.lessonCoursewareId,
+            unit: props.activeRow.lessonCoursewareKnowledgeDetailId,
+            subjectId: createClassForm.subjectId
+          });
+          emit('getList');
+          data.uploading = false;
+        } catch (e) {
+          data.uploading = false;
+          console.log(e);
+        }
+      });
+    };
+    return () => (
+      <div class={[styles.addClass]}>
+        <NForm label-placement="left" model={createClassForm} ref={foemsRef}>
+          <NFormItem
+            path="subjectId"
+            rule={[
+              {
+                required: true,
+                message: '请选择声部'
+              }
+            ]}>
+            <CSelect
+              {...({
+                style: { width: '400px' },
+                options: subjectList.value,
+                placeholder: '选择声部',
+                labelField: 'name',
+                valueField: 'id',
+                clearable: true
+              } as any)}
+              v-model:value={createClassForm.subjectId}></CSelect>
+          </NFormItem>
+        </NForm>
+        <NSpace class={styles.btnGroup} justify="center">
+          <NButton round onClick={() => emit('close')}>
+            取消
+          </NButton>
+          <NButton
+            round
+            loading={data.uploading}
+            onClick={() => submitForms()}
+            type="primary">
+            确定
+          </NButton>
+        </NSpace>
+      </div>
+    );
+  }
+});

+ 20 - 89
src/views/home/index.module.less

@@ -144,6 +144,7 @@
   display: flex;
   align-items: center;
   justify-content: space-between;
+  margin-top: -45px;
   // padding: 24px 0;
 
 
@@ -161,11 +162,25 @@
     }
 
     .applyBtn {
+      display: flex;
+      align-items: center;
+      justify-content: center;
       margin: 19px auto 0;
       width: 158px;
       height: 40px;
       background: #FFFFFF;
       border-radius: 10px;
+      cursor: pointer;
+    }
+
+    .applyBtn1 img {
+      width: 58px;
+      height: 20px;
+    }
+
+    .applyBtn2 img {
+      width: 77px;
+      height: 19px;
     }
   }
 
@@ -179,94 +194,6 @@
     background-size: contain;
   }
 
-  // .applyTitle {
-  //   display: flex;
-  //   align-items: center;
-  //   justify-content: space-between;
-  //   height: 42px;
-
-  //   .className {
-  //     font-size: 26px;
-  //     font-family: Alibaba-PuHuiTi-B, Alibaba-PuHuiTi;
-  //     font-weight: bold;
-  //     color: #323DC5;
-  //     line-height: 35px;
-
-
-  //     &::after {
-  //       content: ' ';
-  //       margin-left: 8px;
-  //       display: inline-block;
-  //       width: 16px;
-  //       height: 16px;
-  //       background: url('./images/icon-right-arrow.png') no-repeat center;
-  //       background-size: contain;
-  //     }
-  //   }
-  // }
-
-  .informations {
-    line-height: 40px;
-    height: 40px;
-    font-size: 14px;
-    color: #6AA1E0;
-    display: flex;
-  }
-
-  .selectContainer {
-    display: flex;
-    align-items: center;
-    width: 100%;
-    background-color: #fff;
-    border-radius: 10px;
-
-    img {
-      position: absolute;
-      left: 20px;
-      top: 10px;
-      width: 32px;
-      height: 32px;
-      z-index: 9;
-    }
-  }
-
-  .startClass,
-  .beforClass {
-    --n-height: 60px !important;
-    min-width: 182px !important;
-    --n-font-size: max(20px, 16px) !important;
-    font-weight: bold !important;
-  }
-
-  .btnGroup {
-    margin-top: 10px;
-    width: 100%;
-  }
-
-  :global {
-    .n-avatar {
-      --n-merged-size: 42px !important;
-      --n-merged-color: #3E9FFF !important;
-    }
-
-    .n-base-selection {
-      --n-height: 52px !important;
-      --n-border: none !important;
-      --n-border-radius: 10px !important;
-      --n-padding-single: 0 26px 0 0px !important;
-      // --n-placeholder-color: #626264 !important;
-      padding-left: 70px;
-    }
-
-    .n-form-item {
-      --n-feedback-height: 20px !important;
-    }
-
-    .n-base-selection.n-base-selection--disabled {
-      background-color: var(--n-color-disabled);
-      cursor: not-allowed;
-    }
-  }
 }
 
 .toolContainer {
@@ -887,7 +814,6 @@
   margin-top: 40px;
 }
 
-
 .showModalTone {
   width: 500px;
 
@@ -905,7 +831,12 @@
       }
     }
   }
+}
 
+.attendClassModal {
+  width: 800px;
+  border-radius: 16px;
+  overflow: hidden;
 }
 
 .showUpdatePassword {

+ 95 - 360
src/views/home/index.tsx

@@ -1,22 +1,10 @@
-import {
-  defineComponent,
-  onBeforeUnmount,
-  onMounted,
-  reactive,
-  ref
-} from 'vue';
+import { defineComponent, onMounted, reactive, ref } from 'vue';
 import styles from './index.module.less';
 import {
   NImage,
   NButton,
-  NAvatarGroup,
-  NForm,
-  NFormItem,
-  NSelect,
   NPopselect,
-  NSpace,
   NModal,
-  NCascader,
   useMessage,
   NSpin
 } from 'naive-ui';
@@ -25,10 +13,9 @@ import defultHeade from '@/components/layout/images/teacherIcon.png';
 import blackBoardBg from './images/blackboard_bg.png';
 import teacherMan from './images/teacher_man.png';
 import teacherWoman from './images/teacher_woman.png';
-import iconLession from './images/icon-lession.png';
-import iconBook from './images/icon-book.png';
-import iconDetail from './images/icon-detail.png';
-import iconSubject from './images/icon-subject.png';
+
+import homeText1 from './images/home/home-text-1.png';
+import homeText2 from './images/home/home-text-2.png';
 import iconTo from './images/icon-to.png';
 import t1 from './images/t1.png';
 import t2 from './images/t2.png';
@@ -38,31 +25,19 @@ import { useUserStore } from '/src/store/modules/users';
 import SelectClass from './modals/selectClass';
 import dayjs from 'dayjs';
 import { gradeToCN, weekToCN } from '/src/utils/contants';
-import { getCLassStudent, getCourseChapter } from '../classList/api';
 import { useCatchStore } from '/src/store/modules/catchData';
-import { useThrottleFn } from '@vueuse/core';
-import {
-  bookVersionPage,
-  courseScheduleStart,
-  lessonCoursewarePage,
-  queryCourseware
-} from '../prepare-lessons/api';
-import TheNoticeBar from '/src/components/TheNoticeBar';
 import TeachGroup from './modals/teachGroup';
 import { classGroupList, courseSchedulePage } from './api';
 import TheEmpty from '/src/components/TheEmpty';
-import { setTabsCaches } from '/src/hooks/use-async';
 import HomeGuide from '/src/custom-plugins/guide-page/home-guide';
 import TimerMeter from '/src/components/timerMeter';
 import { vaildUrl } from '/src/utils/urlUtils';
-import toneImage from '@/components/layout/images/toneImage.png';
 import { px2vw } from '/src/utils';
 import PlaceholderTone from '@/components/layout/modals/placeholderTone';
-import { state } from '/src/state';
-import { fscreen } from '@/utils/index';
 import PreviewWindow from '../preview-window';
 import UpdatePassword from '/src/components/layout/modals/update-password';
-import { state as globalState } from '/src/state';
+import AttendClass from '../prepare-lessons/model/attend-class';
+import { state } from '/src/state';
 export const formatDateToDay = () => {
   const hours = dayjs().hour();
   if (hours < 12) {
@@ -86,8 +61,7 @@ export default defineComponent({
     const showModalTone = ref(false);
     const showModalTime = ref(false);
     const forms = reactive({
-      applyClassItem: {} as any, // 选择的内容
-      applyStatus: false,
+      showAttendClass: false,
       useStatus: false,
       studentList: [] as any,
       bookVersionId: null,
@@ -117,28 +91,6 @@ export default defineComponent({
 
     // 学生列表
     // getStdentList
-    // 应用选择年级班级
-    const onApplyConfirm = async (item: any) => {
-      try {
-        //
-        const { data } = await getCLassStudent({
-          page: 1,
-          rows: 999,
-          classGroupId: item.classGroupId
-        });
-
-        const temps = data.rows || [];
-        temps.forEach((row: any) => {
-          forms.studentList.push({
-            name: row.nickname,
-            src: row.avatar
-          });
-        });
-        forms.applyClassItem = item;
-      } catch {
-        //
-      }
-    };
 
     const onUseConfirm = (item: any) => {
       forms.classSelect = {
@@ -149,71 +101,6 @@ export default defineComponent({
 
       getCourseSchedulePage();
     };
-    const throttledFn = useThrottleFn(() => getLessonCourseware(), 500);
-    const getLessonCourseware = async () => {
-      forms.category = null;
-      forms.unit = null;
-      forms.category = null;
-      forms.loading = true;
-
-      try {
-        const { data } = await lessonCoursewarePage({
-          bookVersionId: forms.bookVersionId,
-          enableFlag: 1,
-          page: 1,
-          rows: 99,
-          type: 'COURSEWARE'
-          // currentGradeNum: forms.applyClassItem.currentGradeNum
-        });
-
-        forms.list = data.rows.map((item: any) => {
-          return {
-            label: item.name,
-            value: item.id
-          };
-        });
-      } catch {
-        //
-      }
-
-      forms.loading = false;
-    };
-
-    const getunitList = async () => {
-      forms.unit = null;
-      try {
-        if (forms.category) {
-          const res = await getCourseChapter(forms.category);
-          forms.unitList = res.data.lessonList.map((item: any) => {
-            return { ...item, label: item.name, value: item.id };
-          });
-        } else {
-          forms.unitList = [];
-        }
-      } catch (e) {
-        console.log(e);
-      }
-    };
-    const getVersion = async () => {
-      forms.unit = null;
-
-      try {
-        const { data } = await bookVersionPage({
-          page: 1,
-          rows: 99,
-          type: 'COURSEWARE'
-        });
-        const temp = data.rows || [];
-        temp.forEach((item: any) => {
-          forms.musicTagList.push({
-            id: item.id,
-            name: item.name
-          });
-        });
-      } catch {
-        //
-      }
-    };
 
     // 获取年级班级
     const getClassList = async () => {
@@ -317,7 +204,6 @@ export default defineComponent({
           value: item.id
         };
       });
-      getVersion();
 
       if (!userStore.getUserInfo.account.updatePasswordFlag) {
         showUpdatePassword.value = true;
@@ -326,56 +212,56 @@ export default defineComponent({
       }
     });
 
-    const formsRef = ref();
-    const gotoClassPage = () => {
-      formsRef.value.validate(async (error: any) => {
-        if (error) return;
-        try {
-          const { data } = await queryCourseware({
-            coursewareDetailKnowledgeId: forms.unit,
-            subjectId: forms.subjectId,
-            page: 1,
-            rows: 99
-          });
-          if (data.rows && data.rows.length > 0) {
-            await courseScheduleStart({
-              lessonCoursewareKnowledgeDetailId: forms.unit,
-              classGroupId: forms.applyClassItem?.classGroupId
-            });
-
-            if (window.matchMedia('(display-mode: standalone)').matches) {
-              forms.showPreview = true;
-              forms.itemPreview = {
-                type: 'class',
-                classGroupId: forms.applyClassItem?.classGroupId,
-                subjectId: forms.subjectId,
-                detailId: forms.unit
-              };
-              globalState.application = window.matchMedia(
-                '(display-mode: standalone)'
-              ).matches;
-              // 加全屏
-              fscreen();
-            } else {
-              const { href } = router.resolve({
-                path: '/attend-class',
-                query: {
-                  type: 'class',
-                  classGroupId: forms.applyClassItem?.classGroupId,
-                  subjectId: forms.subjectId,
-                  detailId: forms.unit
-                }
-              });
-              window.open(href, +new Date() + '');
-            }
-          } else {
-            message.error('当前章节暂无课件,请重新选择');
-          }
-        } catch {
-          //
-        }
-      });
-    };
+    // const formsRef = ref();
+    // const gotoClassPage = () => {
+    //   formsRef.value.validate(async (error: any) => {
+    //     if (error) return;
+    //     try {
+    //       const { data } = await queryCourseware({
+    //         coursewareDetailKnowledgeId: forms.unit,
+    //         subjectId: forms.subjectId,
+    //         page: 1,
+    //         rows: 99
+    //       });
+    //       if (data.rows && data.rows.length > 0) {
+    //         await courseScheduleStart({
+    //           lessonCoursewareKnowledgeDetailId: forms.unit,
+    //           classGroupId: forms.applyClassItem?.classGroupId
+    //         });
+
+    //         if (window.matchMedia('(display-mode: standalone)').matches) {
+    //           forms.showPreview = true;
+    //           forms.itemPreview = {
+    //             type: 'class',
+    //             classGroupId: forms.applyClassItem?.classGroupId,
+    //             subjectId: forms.subjectId,
+    //             detailId: forms.unit
+    //           };
+    //           globalState.application = window.matchMedia(
+    //             '(display-mode: standalone)'
+    //           ).matches;
+    //           // 加全屏
+    //           fscreen();
+    //         } else {
+    //           const { href } = router.resolve({
+    //             path: '/attend-class',
+    //             query: {
+    //               type: 'class',
+    //               classGroupId: forms.applyClassItem?.classGroupId,
+    //               subjectId: forms.subjectId,
+    //               detailId: forms.unit
+    //             }
+    //           });
+    //           window.open(href, +new Date() + '');
+    //         }
+    //       } else {
+    //         message.error('当前章节暂无课件,请重新选择');
+    //       }
+    //     } catch {
+    //       //
+    //     }
+    //   });
+    // };
     const clearStorng = () => {
       localStorage.removeItem('teacher-guideInfo');
       forms.showGuide = false;
@@ -388,23 +274,6 @@ export default defineComponent({
       <div class={styles.homeWrap}>
         <div class={styles.homeInfoLeft}>
           <div class={styles.homeBanner}>
-            {/* <div class={styles.welcomeInfo}>
-              <div class={styles.userInfo}>
-                <div class={styles.userName}>
-                  Hi,{userStore.getUserInfo?.nickname} {formatDateToDay()}~
-                </div>
-                <div class={styles.userTime}>
-                  {dayjs().format('MM月DD日')},{weekToCN[dayjs().day()]}
-                </div>
-              </div>
-              <div class={styles.userTips}>
-                <span>欢迎您使用酷乐秀课堂乐器数字化教学平台!</span>
-                <NButton color="#40A1FF" round class={styles.guide_btn} {...{id:'home-1'}}  onClick={()=>clearStorng()}>
-                  功能引导
-                  <i></i>
-                </NButton>
-              </div>
-            </div> */}
             <div class={styles.applyInfo} id="home-1">
               <div class={styles.centerInfo} id="home-0"></div>
 
@@ -412,9 +281,6 @@ export default defineComponent({
                 <div class={styles.userName}>
                   Hi,{userStore.getUserInfo?.nickname} {formatDateToDay()}~
                 </div>
-                {/* <div class={styles.userTime}>
-                  {dayjs().format('MM月DD日')},{weekToCN[dayjs().day()]}
-                </div> */}
               </div>
               {userStore.getUserInfo.gender === 1 ? (
                 <img src={teacherMan} class={styles.teacherMan} />
@@ -428,160 +294,27 @@ export default defineComponent({
               <div class={styles.applyContainer}>
                 <div class={[styles.applyItem, styles.applyItem1]}>
                   <p>可根据声部进行备课,更好的规划教学哦~</p>
-                  <div class={styles.applyBtn}></div>
+                  <div
+                    class={[styles.applyBtn, styles.applyBtn1]}
+                    onClick={() => {
+                      // 备课
+                      router.push({
+                        path: '/prepare-lessons'
+                      });
+                    }}>
+                    <img src={homeText1} />
+                  </div>
                 </div>
                 <div class={[styles.applyItem, styles.applyItem2]}>
                   <p>点击这里,选择班级快速进入备课区域</p>
-                  <div class={styles.applyBtn}></div>
-                </div>
-                {/* <div class={styles.applyTitle}>
-                  <span
-                    class={styles.className}
-                    onClick={() => (forms.applyStatus = true)}>
-                    {forms.applyClassItem.name || '请选择班级'}
-                  </span>
-                  <NAvatarGroup options={forms.studentList} max={5} />
-                </div>
-                <div class={styles.informations}>
-                  {forms.applyClassItem.lastStudy ? (
-                    <>
-                      <span style="flex-shrink: 0;">上次课程:</span>
-                      <TheNoticeBar text={forms.applyClassItem.lastStudy} />
-                    </>
-                  ) : (
-                    ''
-                  )}
+                  <div
+                    class={[styles.applyBtn, styles.applyBtn2]}
+                    onClick={() => {
+                      forms.showAttendClass = true;
+                    }}>
+                    <img src={homeText2} />
+                  </div>
                 </div>
-
-                <NForm showLabel={false} ref={formsRef} model={forms}>
-                  <NFormItem
-                    path="bookVersionId"
-                    rule={[
-                      {
-                        required: true,
-                        message: '',
-                        trigger: ['blur', 'change']
-                      }
-                    ]}>
-                    <div class={styles.selectContainer}>
-                      <img src={iconLession} />
-                      <NSelect
-                        placeholder="请选择教材版本"
-                        disabled={
-                          forms.applyClassItem?.currentGradeNum ? false : true
-                        }
-                        clearable
-                        options={[...forms.musicTagList]}
-                        labelField="name"
-                        valueField="id"
-                        v-model:value={forms.bookVersionId}
-                        onUpdate:value={() => throttledFn()}
-                      />
-                    </div>
-                  </NFormItem>
-                  <NFormItem
-                    path="category"
-                    rule={[
-                      {
-                        required: true,
-                        message: '',
-                        trigger: ['blur', 'change']
-                      }
-                    ]}>
-                    <div class={styles.selectContainer}>
-                      <img src={iconBook} />
-                      <NSelect
-                        placeholder="请选择册别"
-                        options={[...forms.list]}
-                        clearable
-                        disabled={!forms.bookVersionId}
-                        v-model:value={forms.category}
-                        onUpdate:value={() => getunitList()}
-                      />
-                    </div>
-                  </NFormItem>
-                  <NFormItem
-                    path="unit"
-                    rule={[
-                      {
-                        required: true,
-                        message: '',
-                        trigger: ['blur', 'change']
-                      }
-                    ]}>
-                    <div class={styles.selectContainer}>
-                      <img src={iconDetail} />
-                      <NCascader
-                        disabled={!forms.category}
-                        {...({
-                          options: [...forms.unitList],
-                          placeholder: '选择章节',
-                          clearable: true
-                        } as any)}
-                        childrenField="knowledgeList"
-                        valueField="id"
-                        labelField="name"
-                        v-model:value={forms.unit}
-                        checkStrategy="child"
-                        expandTrigger="hover"
-                      />
-                    </div>
-                  </NFormItem>
-                  <NFormItem
-                    path="subjectId"
-                    rule={[
-                      {
-                        required: true,
-                        message: '',
-                        trigger: ['blur', 'change'],
-                        type: 'number'
-                      }
-                    ]}>
-                    <div class={styles.selectContainer}>
-                      <img src={iconSubject} />
-                      <NSelect
-                        {...({
-                          options: [...forms.subjectList],
-                          placeholder: '选择乐器',
-                          clearable: true
-                        } as any)}
-                        v-model:value={forms.subjectId}
-                      />
-                    </div>
-                  </NFormItem>
-                  <NSpace class={styles.btnGroup} justify="center">
-                    <NButton
-                      round
-                      block
-                      class={styles.startClass}
-                      color="#FF6E4C"
-                      onClick={gotoClassPage}>
-                      开始上课
-                    </NButton>
-                    <NButton
-                      round
-                      block
-                      class={styles.beforClass}
-                      color="#5B64D1"
-                      onClick={() => {
-                        // 携带默认数据显示
-                        formsRef.value.validate(async (error: any) => {
-                          if (error) return;
-
-                          router.push({
-                            path: '/prepare-lessons',
-                            query: {
-                              lastUseCoursewareId: forms.category,
-                              unit: forms.unit,
-                              subjectId: forms.subjectId
-                            }
-                          });
-                        });
-                      }}>
-                      去备课
-                    </NButton>
-                  </NSpace>
-                </NForm> */}
               </div>
             </div>
           </div>
@@ -731,25 +464,6 @@ export default defineComponent({
           </div>
         </div>
 
-        {/* 添加自定义教材 */}
-        <NModal
-          v-model:show={forms.applyStatus}
-          preset="card"
-          showIcon={false}
-          class={['modalTitle background', styles.assignHomework]}
-          title={'选择班级'}
-          blockScroll={false}>
-          <SelectClass
-            useDetail={{
-              currentGradeNum: forms.applyClassItem.currentGradeNum,
-              classGroupId: forms.applyClassItem.classGroupId
-            }}
-            gradeList={forms.gradeList}
-            onConfirm={(item: any) => onApplyConfirm(item)}
-            onClose={() => (forms.applyStatus = false)}
-          />
-        </NModal>
-
         <NModal
           v-model:show={forms.useStatus}
           preset="card"
@@ -839,6 +553,27 @@ export default defineComponent({
             }}
           />
         </NModal>
+
+        <NModal
+          v-model:show={forms.showAttendClass}
+          preset="card"
+          showIcon={false}
+          class={['modalTitle background', styles.attendClassModal]}
+          title={'选择班级'}
+          blockScroll={false}>
+          <AttendClass
+            onClose={() => (forms.showAttendClass = false)}
+            type="change"
+            onConfirm={(item: any) => {
+              router.push({
+                path: '/prepare-lessons',
+                query: {
+                  ...item
+                }
+              });
+            }}
+          />
+        </NModal>
       </div>
     );
   }

+ 40 - 4
src/views/natural-resources/model/add-teaching/index.tsx

@@ -30,6 +30,7 @@ import btnUp from '../../images/btn-up.png';
 import btnDown from '../../images/btn-down.png';
 import btnRemove from '../../images/btn-remove.png';
 import { lessonCoursewareDetail } from '/src/views/prepare-lessons/api';
+import { useCatchStore } from '/src/store/modules/catchData';
 export const BOOK_DATA = {
   grades: [
     { label: '一年级', value: 1 },
@@ -65,7 +66,8 @@ const createLesson = () => {
 const initState = () => ({
   id: null, // 教材id
   name: '',
-  currentGradeNum: null,
+  currentGradeNum: null as any,
+  subjectIds: null as any,
   // bookType: null, // 上下册
   coverImg: '', // 封面
   enableFlag: true, // 状态
@@ -83,6 +85,7 @@ export default defineComponent({
   },
   emits: ['close', 'confirm'],
   setup(props, { emit }) {
+    const catchStore = useCatchStore();
     const message = useMessage();
     const data = reactive({
       uploading: false
@@ -101,7 +104,12 @@ export default defineComponent({
     const handleSubmit = async () => {
       data.uploading = true;
       try {
-        await api_lessonCoursewareSave(form);
+        const { currentGradeNum, subjectIds, ...more } = form;
+        await api_lessonCoursewareSave({
+          currentGradeNum: currentGradeNum.join(','),
+          subjectIds: subjectIds.join(','),
+          ...more
+        });
         Object.assign(form, initState());
         message.success(props.item.id ? '保存成功' : '添加成功');
         emit('close', true);
@@ -113,11 +121,17 @@ export default defineComponent({
     };
 
     onMounted(async () => {
+      await catchStore.getSubjects();
       if (props.item.id) {
         const { data } = await lessonCoursewareDetail({ id: props.item.id });
         form.id = data.id;
         form.name = data.name;
-        form.currentGradeNum = data.currentGradeNum;
+        form.currentGradeNum = data.currentGradeNum
+          ? data.currentGradeNum.split(',').map((item: any) => Number(item))
+          : null;
+        form.subjectIds = data.subjectIds
+          ? data.subjectIds.split(',').map((item: any) => Number(item))
+          : null;
         // form.bookType = data.bookType;
         form.coverImg = data.coverImg;
         form.lessonList = [];
@@ -210,7 +224,7 @@ export default defineComponent({
                     required: true,
                     message: '请选择年级',
                     trigger: 'change',
-                    type: 'number'
+                    type: 'array'
                   }}>
                   <NSelect
                     style={{ minWidth: '360px' }}
@@ -218,7 +232,29 @@ export default defineComponent({
                     options={BOOK_DATA.grades}
                     v-model:value={form.currentGradeNum}
                     clearable
+                    multiple
                     filterable
+                    maxTagCount={3}
+                  />
+                </NFormItem>
+                <NFormItem
+                  path="subjectIds"
+                  style={{ width: '360px' }}
+                  rule={{
+                    required: true,
+                    message: '请选择声部',
+                    trigger: 'change',
+                    type: 'array'
+                  }}>
+                  <NSelect
+                    placeholder="请选择声部"
+                    options={catchStore.getSubjectList}
+                    v-model:value={form.subjectIds}
+                    clearable
+                    valueField="id"
+                    labelField="name"
+                    multiple
+                    maxTagCount={3}
                   />
                 </NFormItem>
                 {/* <NFormItem

+ 6 - 2
src/views/prepare-lessons/components/directory-main/index.tsx

@@ -22,8 +22,8 @@ export default defineComponent({
     const forms = reactive({
       lastUseCoursewareId: route.query.lastUseCoursewareId
         ? route.query.lastUseCoursewareId + ''
-        : null,
-      unit: route.query.unit ? route.query.unit + '' : null,
+        : null, // 专辑编号
+      unit: route.query.unit ? route.query.unit + '' : null, // 声部
       showSelectBookStatus: false,
       coursewareStatus: false
     });
@@ -50,9 +50,13 @@ export default defineComponent({
           if (selectItem) {
             prepareStore.setBaseCourseware(selectItem);
             id = selectItem.id;
+
+            console.log(selectItem, 'selectItem');
           } else {
             prepareStore.setBaseCourseware(result[0]);
             id = result[0]?.id;
+
+            console.log(selectItem, 'selectItem');
           }
           setLastUseCoursewareId(id);
         }

+ 37 - 3
src/views/prepare-lessons/components/lesson-main/courseware/index.module.less

@@ -11,6 +11,14 @@
     line-height: 38px;
   }
 
+  .btnClassList {
+    :global {
+      .n-base-selection {
+        width: 200px;
+      }
+    }
+  }
+
   :global {
     .n-base-selection {
       --n-height: 38px !important;
@@ -55,15 +63,41 @@
       }
     }
   }
+
+  .btnClassStart {
+    background: #F44541 !important;
+    color: #fff !important;
+
+    :global {
+      .n-button__border {
+        border: 1px solid #F44541;
+      }
+    }
+  }
+
+  .btnItem {
+    display: flex;
+    align-items: center;
+
+    .btnTitle {
+      flex-shrink: 0;
+      font-size: 18px;
+      font-weight: 600;
+    }
+
+    &:last-child {
+      margin-left: 12px;
+    }
+  }
 }
 
 .listContainer {
   margin-top: 12px;
-  // // 52 + 28 + 38
-  max-height: calc(var(--window-page-lesson-height) - 148px);
+  // // 52 + 28 + 38 + 38
+  max-height: calc(var(--window-page-lesson-height) - 186px);
 
   .listSection {
-    min-height: calc(var(--window-page-lesson-height) - 148px);
+    min-height: calc(var(--window-page-lesson-height) - 186px);
   }
 
   .emptySection {

+ 80 - 48
src/views/prepare-lessons/components/lesson-main/courseware/index.tsx

@@ -193,16 +193,16 @@ export default defineComponent({
       }
       // 判断是否在应用里面
       if (window.matchMedia('(display-mode: standalone)').matches) {
-        state.application = window.matchMedia('(display-mode: standalone)').matches
+        state.application = window.matchMedia(
+          '(display-mode: standalone)'
+        ).matches;
         forms.previewModal = true;
-        fscreen()
+        fscreen();
         forms.previewParams = {
           type: 'preview',
           subjectId: prepareStore.getSubjectId,
           detailId: prepareStore.getSelectKey
         };
-
-
       } else {
         const { href } = router.resolve({
           path: '/attend-class',
@@ -215,16 +215,20 @@ export default defineComponent({
         window.open(href, +new Date() + '');
       }
     };
-    const fscreen=()=> {
-      const el = document.documentElement
-      const isFullscreen = document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen
+    const fscreen = () => {
+      const el = document.documentElement;
+      const isFullscreen =
+        document.fullScreen ||
+        document.mozFullScreen ||
+        document.webkitIsFullScreen;
       if (!isFullscreen) {
         //进入全屏
         (el.requestFullscreen && el.requestFullscreen()) ||
-        (el.mozRequestFullScreen && el.mozRequestFullScreen()) ||
-        (el.webkitRequestFullscreen && el.webkitRequestFullscreen()) ||
-        (el.msRequestFullscreen && el.msRequestFullscreen())
-      } }
+          (el.mozRequestFullScreen && el.mozRequestFullScreen()) ||
+          (el.webkitRequestFullscreen && el.webkitRequestFullscreen()) ||
+          (el.msRequestFullscreen && el.msRequestFullscreen());
+      }
+    };
     // 单个删除
     const onRemove = async (item: any) => {
       try {
@@ -251,7 +255,6 @@ export default defineComponent({
 
       const subjectList = catchStore.getSubjectList;
       // 并且没有声部时才会更新
-      console.log(forms.subjectId, subjectList, 'forms.subjectId');
       if (subjectList.length > 0) {
         // 判断浏览器上面是否有
         if (forms.subjectId) {
@@ -298,17 +301,41 @@ export default defineComponent({
             </NSpace>
           ) : (
             <NSpace>
-              <NSelect
-                placeholder="选择声部"
-                options={catchStore.getSubjectList}
-                labelField="name"
-                valueField="id"
-                value={prepareStore.getSubjectId}
-                onUpdate:value={(val: any) => {
-                  prepareStore.setSubjectId(val);
-                  getList();
-                }}
-              />
+              <div class={styles.btnItem}>
+                <span class={styles.btnTitle}>上课班级:</span>
+                <NSelect
+                  placeholder="选择声部"
+                  options={catchStore.getSubjectList}
+                  labelField="name"
+                  valueField="id"
+                  class={styles.btnClassList}
+                  value={prepareStore.getSubjectId}
+                  onUpdate:value={(val: any) => {
+                    prepareStore.setSubjectId(val);
+                    getList();
+                  }}
+                />
+              </div>
+              <div class={styles.btnItem}>
+                <span class={styles.btnTitle}>声部:</span>
+                <NSelect
+                  placeholder="选择声部"
+                  options={catchStore.getSubjectList}
+                  labelField="name"
+                  valueField="id"
+                  value={prepareStore.getSubjectId}
+                  onUpdate:value={(val: any) => {
+                    prepareStore.setSubjectId(val);
+                    getList();
+                  }}
+                />
+              </div>
+            </NSpace>
+          )}
+
+          {/* 编辑 */}
+          {!forms.drag && (
+            <NSpace>
               <NButton
                 type="default"
                 onClick={() => {
@@ -319,30 +346,6 @@ export default defineComponent({
               </NButton>
             </NSpace>
           )}
-
-          <NSpace>
-            <NButton type="default" onClick={onPreviewAttend}>
-              预览
-            </NButton>
-            <NButton
-              {...{ id: 'lessons-3' }}
-              type="primary"
-              onClick={() => {
-                let count = 0;
-                forms.coursewareList.forEach((item: any) => {
-                  if (!item.removeFlag) {
-                    count++;
-                  }
-                });
-                if (count <= 0) {
-                  message.error('课件不能为空');
-                  return;
-                }
-                forms.showAttendClass = true;
-              }}>
-              开始上课
-            </NButton>
-          </NSpace>
         </div>
 
         <NScrollbar class={styles.listContainer} {...{ id: 'lessons-2' }}>
@@ -426,6 +429,33 @@ export default defineComponent({
           </NSpin>
         </NScrollbar>
 
+        <div class={styles.btnGroup} style={{ justifyContent: 'flex-end' }}>
+          <NSpace justify="end">
+            <NButton type="primary" onClick={onPreviewAttend}>
+              预览课件
+            </NButton>
+            <NButton
+              {...{ id: 'lessons-3' }}
+              type="primary"
+              class={styles.btnClassStart}
+              onClick={() => {
+                let count = 0;
+                forms.coursewareList.forEach((item: any) => {
+                  if (!item.removeFlag) {
+                    count++;
+                  }
+                });
+                if (count <= 0) {
+                  message.error('课件不能为空');
+                  return;
+                }
+                forms.showAttendClass = true;
+              }}>
+              开始上课
+            </NButton>
+          </NSpace>
+        </div>
+
         <NModal
           v-model:show={forms.showAttendClass}
           preset="card"
@@ -437,7 +467,9 @@ export default defineComponent({
             onClose={() => (forms.showAttendClass = false)}
             onPreview={(item: any) => {
               if (window.matchMedia('(display-mode: standalone)').matches) {
-                state.application = window.matchMedia('(display-mode: standalone)').matches
+                state.application = window.matchMedia(
+                  '(display-mode: standalone)'
+                ).matches;
                 forms.previewModal = true;
                 forms.previewParams = {
                   ...item

+ 1 - 1
src/views/prepare-lessons/components/resource-main/components/resource-item/index.tsx

@@ -222,7 +222,7 @@ export default defineComponent({
                         state.show = true;
                         state.item = item;
                       }}
-                      isShowAddDisabled={prepareStore.getIsEditResource}
+                      isShowAddDisabled={!prepareStore.getIsEditResource}
                       onAdd={(item: any) => onAdd(item)}
                     />
                   ))}

+ 1 - 1
src/views/prepare-lessons/components/resource-main/components/select-music/index.tsx

@@ -154,7 +154,7 @@ export default defineComponent({
                       isShowAdd
                       isShowCollect={false}
                       item={item}
-                      isShowAddDisabled={prepareStore.getIsEditTrain}
+                      isShowAddDisabled={!prepareStore.getIsEditTrain}
                       disabledMouseHover={false}
                       onClick={() => {
                         if (item.type === 'IMG') return;

+ 53 - 7
src/views/prepare-lessons/model/attend-class/index.tsx

@@ -1,6 +1,6 @@
-import { defineComponent, onMounted, reactive, ref } from 'vue';
+import { defineComponent, onMounted, reactive, ref, toRef } from 'vue';
 import styles from './index.module.less';
-import { NInput, NScrollbar, NSelect, NSpin, NThing } from 'naive-ui';
+import { NInput, NModal, NScrollbar, NSelect, NSpin, NThing } from 'naive-ui';
 import { useRouter } from 'vue-router';
 import { BOOK_DATA } from '/src/views/natural-resources/model/add-teaching';
 import { classGroupPage, courseScheduleStart } from '../../api';
@@ -9,6 +9,7 @@ import TheEmpty from '/src/components/TheEmpty';
 import { usePrepareStore } from '/src/store/modules/prepareLessons';
 import { state } from '/src/state';
 import { nextTick } from 'process';
+import UpdateSubject from '/src/views/classList/modals/updateSubject';
 const classList: any = [];
 for (let i = 1; i <= 40; i++) {
   classList.push({ label: i + '班', value: i });
@@ -16,11 +17,21 @@ for (let i = 1; i <= 40; i++) {
 
 export default defineComponent({
   name: 'attend-class',
-  emits: ['close', 'preview'],
+  props: {
+    // change select
+    type: {
+      type: String,
+      default: 'change'
+    }
+  },
+  emits: ['close', 'preview', 'confirm'],
   setup(props, { emit }) {
+    // const { type } = toRef(props);
     const prepareStore = usePrepareStore();
     const router = useRouter();
     const forms = reactive({
+      showSubjectClass: false,
+      activeRow: {} as any,
       keyword: null,
       currentGradeNum: null,
       currentClass: null
@@ -31,13 +42,27 @@ export default defineComponent({
     // 开始上课
     const onAttendClass = async (item: any) => {
       try {
+        // 判断是否是切换班级
+        if (props.type == 'change') {
+          if (item.subjectId) {
+            emit('confirm', {
+              lastUseCoursewareId: item.lessonCoursewareId,
+              unit: item.lessonCoursewareKnowledgeDetailId,
+              subjectId: item.subjectId
+            });
+          } else {
+            forms.showSubjectClass = true;
+            forms.activeRow = item;
+          }
+          return;
+        }
+
         await courseScheduleStart({
           lessonCoursewareKnowledgeDetailId: prepareStore.selectKey,
           classGroupId: item.id
         });
 
         emit('close');
-
         emit('preview', {
           type: 'class',
           classGroupId: item.id,
@@ -45,7 +70,9 @@ export default defineComponent({
           detailId: prepareStore.getSelectKey
         });
         if (window.matchMedia('(display-mode: standalone)').matches) {
-          state.application = window.matchMedia('(display-mode: standalone)').matches
+          state.application = window.matchMedia(
+            '(display-mode: standalone)'
+          ).matches;
           setTimeout(() => {
             fscreen();
           }, 200);
@@ -55,8 +82,8 @@ export default defineComponent({
       }
     };
     const fscreen = () => {
-      var el = document.documentElement;
-      var isFullscreen =
+      const el = document.documentElement;
+      const isFullscreen =
         document.fullScreen ||
         document.mozFullScreen ||
         document.webkitIsFullScreen;
@@ -172,6 +199,25 @@ export default defineComponent({
             </div>
           </NSpin>
         </NScrollbar>
+
+        <NModal
+          v-model:show={forms.showSubjectClass}
+          style={{ width: '500px' }}
+          preset="card"
+          class={['modalTitle background']}
+          title={'修改声部'}>
+          {forms.showSubjectClass ? (
+            <UpdateSubject
+              activeRow={forms.activeRow}
+              onGetList={() => getList()}
+              onConfirm={(item: any) => {
+                //
+                emit('confirm', item);
+              }}
+              onClose={() => (forms.showSubjectClass = false)}
+            />
+          ) : null}
+        </NModal>
       </div>
     );
   }

+ 1 - 1
src/views/prepare-lessons/model/select-music/index.tsx

@@ -125,7 +125,7 @@ export default defineComponent({
                           isShowAdd
                           isShowCollect={false}
                           item={item}
-                          isShowAddDisabled={prepareStore.getIsEditTrain}
+                          isShowAddDisabled={!prepareStore.getIsEditTrain}
                           onAdd={() => emit('add', item)}
                           disabledMouseHover={false}
                           onClick={() => {

+ 4 - 3
src/views/prepare-lessons/model/select-resources/select-item/index.tsx

@@ -67,8 +67,8 @@ export default defineComponent({
         }
         const { data } = await materialQueryPage({
           ...state.searchGroup,
-          ...state.pagination,
-          subjectId: prepareStore.getSubjectId
+          ...state.pagination
+          // subjectId: prepareStore.getSubjectId
         });
         state.loading = false;
         const tempRows = data.rows || [];
@@ -176,6 +176,7 @@ export default defineComponent({
       <div>
         <ResourceSearchGroup
           type={props.type}
+          subjectId={prepareStore.getSubjectId}
           onSearch={(item: any) => throttledFnSearch(item)}
         />
         <NScrollbar
@@ -209,7 +210,7 @@ export default defineComponent({
                       isShowAdd
                       item={item}
                       isShowCollect={false}
-                      isShowAddDisabled={prepareStore.getIsEditResource}
+                      isShowAddDisabled={!prepareStore.getIsEditResource}
                       onAdd={(item: any) => onAdd(item)}
                       disabledMouseHover={false}
                       onClick={() => {

+ 29 - 1
src/views/prepare-lessons/model/select-resources/select-item/resource-search-group/index.tsx

@@ -4,7 +4,8 @@ import {
   nextTick,
   onMounted,
   reactive,
-  ref
+  ref,
+  toRef
 } from 'vue';
 import styles from './index.module.less';
 import { NButton, NForm, NFormItem, NImage, NSpace } from 'naive-ui';
@@ -20,14 +21,20 @@ export default defineComponent({
     type: {
       type: String as PropType<'shareResources' | 'myResources' | 'myCollect'>,
       default: 'shareResources'
+    },
+    subjectId: {
+      type: String,
+      default: ''
     }
   },
   emits: ['search'],
   setup(props, { emit }) {
+    const subjectId = toRef(props.subjectId);
     const catchStore = useCatchStore();
     const forms = reactive({
       type: 'MUSIC', //
       name: '',
+      subjectId: subjectId.value as any,
       bookVersionId: null
     });
     const resourceType = ref([] as any);
@@ -103,6 +110,8 @@ export default defineComponent({
 
       // 获取教材分类列表
       await catchStore.getMusicSheetCategory();
+      // 获取声部
+      await catchStore.getSubjects();
 
       // 这里开始
       // musicCateRef
@@ -214,6 +223,25 @@ export default defineComponent({
               </NFormItem>
             </div>
           )}
+
+          <NFormItem label="声部:">
+            <NSpace class={styles.spaceSection}>
+              {catchStore.getSubjectAllList.map((music: any) => (
+                <NButton
+                  secondary={forms.subjectId === music.id}
+                  quaternary={forms.subjectId !== music.id}
+                  strong
+                  focusable={false}
+                  type={forms.subjectId === music.id ? 'primary' : 'default'}
+                  onClick={() => {
+                    forms.subjectId = music.id;
+                    onSearch();
+                  }}>
+                  {music.name}
+                </NButton>
+              ))}
+            </NSpace>
+          </NFormItem>
         </NForm>
       </div>
     );

+ 31 - 0
src/views/xiaoku-ai/index.tsx

@@ -5,14 +5,17 @@ import { NButton, NImage, NSpace, NSpin } from 'naive-ui';
 import { useRouter } from 'vue-router';
 import { api_musicSheetCategoriesPage, api_musicTagTree } from './api';
 import TheEmpty from '/src/components/TheEmpty';
+import { useCatchStore } from '/src/store/modules/catchData';
 
 export default defineComponent({
   name: 'XiaokuAi',
   setup() {
+    const catchStore = useCatchStore();
     const router = useRouter();
     const forms = reactive({
       musicTagIds: [] as any[],
       enable: true,
+      subjectId: null,
       keyword: '',
       page: 1,
       rows: 9999
@@ -80,6 +83,8 @@ export default defineComponent({
       try {
         await getTags();
         await getList();
+        // 获取教材分类列表
+        await catchStore.getSubjects();
       } catch {
         //
       }
@@ -176,6 +181,32 @@ export default defineComponent({
                 </div>
               );
             })}
+            <div class={styles.tags}>
+              <NSpace size={[24, 12]}>
+                <span class={styles.firstButton}>声部</span>
+
+                {catchStore.getSubjectAllList.map(
+                  (item: any, index: number) => {
+                    return (
+                      <>
+                        <NButton
+                          round
+                          secondary={item.id === forms.subjectId ? false : true}
+                          type={
+                            item.id === forms.subjectId ? 'primary' : 'default'
+                          }
+                          onClick={() => {
+                            forms.subjectId = item.id;
+                            getList();
+                          }}>
+                          {item.name}
+                        </NButton>
+                      </>
+                    );
+                  }
+                )}
+              </NSpace>
+            </div>
           </div>
           <TheSearch
             round