lex 1 éve
szülő
commit
43f1aa37a1

+ 1 - 1
public/version.json

@@ -1 +1 @@
-{"version":1713776975640}
+{"version":1713952776726}

BIN
src/images/subject-bg.png


+ 25 - 1
src/store/modules/catchData.ts

@@ -46,6 +46,30 @@ export const useCatchStore = defineStore('catch-store', {
         ...this.subjectList
       ];
     },
+    /**
+     * 获取所有启用的声部
+     */
+    getEnableSubjects(): any[] {
+      const temp: any[] = [];
+      this.subjectList.forEach((subject: any) => {
+        // if (subject.enableFlag) {
+        const { instruments, ...r } = subject;
+
+        if (instruments && instruments.length > 0) {
+          const tempChild: any[] = [];
+          instruments?.forEach((instrument: any) => {
+            if (instrument.enableFlag) {
+              tempChild.push(instrument);
+            }
+          });
+
+          temp.push({ ...r, instruments: tempChild });
+        }
+
+        // }
+      });
+      return temp;
+    },
     getSubjectInstruments(): any[] {
       return [
         {
@@ -85,7 +109,7 @@ export const useCatchStore = defineStore('catch-store', {
           return Promise.resolve();
         }
         const { data } = await getSubjectList2({
-          enableFlag: true,
+          // enableFlag: true,
           delFlag: 0,
           page: 1,
           rows: 999

+ 1 - 0
src/utils/request.ts

@@ -99,6 +99,7 @@ request.interceptors.response.use(
       throw new Error(msg);
     }
     const data = await res.clone().json();
+
     if (
       data.code === 401 ||
       data.code === 4001 ||

+ 9 - 0
src/views/classList/index.module.less

@@ -5,6 +5,8 @@
   padding: 32px;
   background-color: #fff;
   border-radius: 20px;
+
+
 }
 
 .infoListWrap {
@@ -378,6 +380,13 @@
       }
     }
   }
+
+  :global {
+    .n-cascader {
+      width: 100% !important;
+      min-width: 180px !important;
+    }
+  }
 }
 
 .indDot,

+ 41 - 17
src/views/classList/index.tsx

@@ -2,6 +2,7 @@ import { defineComponent, reactive, onMounted, ref } from 'vue';
 import styles from './index.module.less';
 import {
   NButton,
+  NCascader,
   NDataTable,
   NForm,
   NFormItem,
@@ -29,9 +30,11 @@ import { getGradeLevelList, getGradeYearList } from '../home/api';
 import { initCache, setCache } from '/src/hooks/use-async';
 import AddStudentModel from '../studentList/modals/addStudentModel';
 import { useUserStore } from '/src/store/modules/users';
+import { useCatchStore } from '/src/store/modules/catchData';
 export default defineComponent({
   name: 'class-classList',
   setup() {
+    const catchData = useCatchStore();
     const users = useUserStore();
     const state = reactive({
       searchForm: {
@@ -62,7 +65,7 @@ export default defineComponent({
       previewParams: {} as any,
       lastCourse: null as any,
       groupBtnLoading: false, // 按钮是否在请求中
-      subjectList: [] as any,
+      // subjectList: [] as any,
       showResetClass: false,
       showSubjectClass: false,
       groupVisiable: false,
@@ -129,16 +132,16 @@ export default defineComponent({
         console.log(e);
       }
     };
-    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: '', label: '全部声部' });
-    };
+    // 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: '', label: '全部声部' });
+    // };
     const columns = () => {
       return [
         {
@@ -157,7 +160,7 @@ export default defineComponent({
           }
         },
         {
-          title: '班级声部',
+          title: '班级乐器',
           key: 'subjectName'
         },
         {
@@ -439,7 +442,9 @@ export default defineComponent({
 
     onMounted(async () => {
       state.loading = true;
-      getSubjectList();
+      await catchData.getSubjects();
+
+      // getSubjectList();
       await getYearList();
       await getLevelList();
       await getList();
@@ -505,14 +510,33 @@ export default defineComponent({
                 v-model:value={state.searchForm.currentClass}></CSelect>
             </NFormItem>
             <NFormItem>
-              <CSelect
+              {/* <CSelect
                 {...({
-                  options: state.subjectList,
-                  placeholder: '选择声部',
+                  options: [
+                    { value: '', label: '全部声部' },
+                    ...catchData.getSubjectList
+                  ],
+                  placeholder: '选择乐器',
                   clearable: true,
                   inline: true
                 } as any)}
-                v-model:value={state.searchForm.subjectId}></CSelect>
+                v-model:value={state.searchForm.subjectId}></CSelect> */}
+              <NCascader
+                to="body"
+                placeholder="选择乐器"
+                options={[
+                  { value: '', label: '全部声部' },
+                  ...catchData.getSubjectList
+                ]}
+                childrenField="instruments"
+                checkStrategy="child"
+                expandTrigger="hover"
+                showPath={false}
+                v-model:value={state.searchForm.subjectId}
+                onUpdate:value={(val: any, option: any, pathValues: any) => {
+                  console.log(val, option, pathValues);
+                }}
+              />
             </NFormItem>
             <NFormItem>
               <NSpace justify="end">

+ 1 - 1
src/views/classList/modals/updateSubject.tsx

@@ -57,7 +57,7 @@ export default defineComponent({
       // subjectList.value = [
       //   { id: null, name: '选择声部' },
       //   ...catchStore.getSubjectList
-      console.log(props.activeRow, ' props.activeRow');
+      // console.log(props.activeRow, ' props.activeRow');
       // ];
 
       createClassForm.gradeYear = props.activeRow.gradeYear;

+ 1 - 1
src/views/home/modals/class-modal/index.tsx

@@ -218,7 +218,7 @@ export default defineComponent({
               ' | ' +
               lessonCourseware.lessonCoursewareKnowledgeDetailName +
               ' | ' +
-              lessonCourseware.useChapterLessonCoursewareName,
+              (lessonCourseware.useChapterLessonCoursewareName || ''),
             image: item.teacherAvatar,
             subjectName: item.subjectName
           });

+ 50 - 1
src/views/home/modals/subject-modal/index.module.less

@@ -7,11 +7,51 @@
       min-width: 156px;
     }
   }
+
+
 }
 
 
 .subjectSync {
-  padding-top: 25px;
+  padding-top: 6px;
+
+  :global {
+    .n-tabs-tab-pad {
+      width: 64px !important;
+    }
+
+    .n-tabs-nav {
+      padding: 12px 36px 20px;
+    }
+
+    .n-tabs-tab {
+      color: #8B8D98;
+      font-size: max(20px, 14Px);
+      padding-top: 12px;
+      padding-bottom: 8px;
+      line-height: 28px;
+
+      &.n-tabs-tab--active {
+        font-weight: 600 !important;
+        color: #131415 !important;
+      }
+    }
+
+    .n-tabs-tab__label {
+      z-index: 10;
+    }
+
+    .n-tabs-bar {
+      height: 10px;
+      background: linear-gradient(90deg, #77BBFF 0%, rgba(163, 231, 255, 0.22) 100%);
+      z-index: 0;
+      bottom: 8px;
+    }
+
+    .n-tab-pane {
+      padding-top: 4px !important;
+    }
+  }
 }
 
 .subjectList {
@@ -32,6 +72,13 @@
     border-radius: 24px;
     line-height: 0;
     overflow: hidden;
+
+    &::before {
+      content: '';
+      background: url('@/images/subject-bg.png') no-repeat center;
+      position: absolute;
+      inset: 0;
+    }
   }
 
   img {
@@ -40,6 +87,7 @@
     width: 127px;
     height: 127px;
     object-fit: contain;
+    position: relative;
   }
 
   .iconSelect {
@@ -52,6 +100,7 @@
   }
 
   .subjectName {
+    padding-top: 7px;
     text-align: center;
     color: #777777;
   }

+ 48 - 12
src/views/home/modals/subject-modal/index.tsx

@@ -1,6 +1,6 @@
 import { defineComponent, onMounted, ref } from 'vue';
 import styles from './index.module.less';
-import { NButton, NScrollbar, NSpace } from 'naive-ui';
+import { NButton, NScrollbar, NSpace, NTabPane, NTabs } from 'naive-ui';
 import { useCatchStore } from '/src/store/modules/catchData';
 import iconSelect from '../../../prepare-lessons/images/icon-select.png';
 
@@ -10,6 +10,7 @@ export default defineComponent({
   setup(props, { emit }) {
     const catchStore = useCatchStore();
 
+    const tabId = ref('' as any);
     const selectSubjectId = ref(null as any);
     const subjectList = ref([] as any);
 
@@ -20,22 +21,57 @@ export default defineComponent({
 
       emit('confirm', item);
     };
+
+    const formatSubjectList = () => {
+      const subjects = catchStore.getEnableSubjects;
+      const temp: any = [];
+      subjects.forEach((subject: any) => {
+        console.log(
+          subject.id,
+          subject.instruments,
+          tabId.value && subject.instruments && tabId.value === subject.id
+        );
+        if (tabId.value === '' && subject.instruments) {
+          temp.push(...subject.instruments);
+        } else if (
+          tabId.value &&
+          subject.instruments &&
+          Number(tabId.value) === subject.id
+        ) {
+          temp.push(...subject.instruments);
+        }
+      });
+
+      subjectList.value = temp;
+    };
     onMounted(async () => {
       // await catchStore.getSubjects();
-      await catchStore.getMusicInstrument();
-      subjectList.value = catchStore.getMusicInstruments;
-      if (subjectList.value.length > 0) {
-        selectSubjectId.value = subjectList.value[0].id;
-      }
+      await catchStore.getSubjects();
+
+      formatSubjectList();
     });
     return () => (
       <div class={styles.subjectSync}>
-        {/* <div class={styles.tips}>
-          请选择当前课件可使用的乐器
-          <span>(勾选后则对应乐器下的课件内容将被当前课件内容全部替换)</span>
-        </div> */}
-
-        <NScrollbar style={{ maxHeight: '60vh' }}>
+        <NTabs
+          defaultValue=""
+          paneClass={styles.paneTitle}
+          justifyContent="start"
+          paneWrapperClass={styles.paneWrapperContainer}
+          value={tabId.value}
+          onUpdate:value={(val: any) => {
+            tabId.value = val;
+            formatSubjectList();
+          }}>
+          {[{ name: '全部声部', id: '' }, ...catchStore.getEnableSubjects].map(
+            (item: any) => (
+              <NTabPane
+                name={`${item.id}`}
+                tab={item.name}
+                displayDirective="if"></NTabPane>
+            )
+          )}
+        </NTabs>
+        <NScrollbar style={{ maxHeight: '50vh', minHeight: '50vh' }}>
           <div class={styles.subjectList}>
             {subjectList.value.map((subject: any) => (
               <div

+ 49 - 1
src/views/prepare-lessons/model/subject-sync/index.module.less

@@ -22,13 +22,53 @@
       color: #F20606;
     }
   }
+
+  padding-top: 6px;
+
+  :global {
+    .n-tabs-tab-pad {
+      width: 64px !important;
+    }
+
+    .n-tabs-nav {
+      padding: 12px 36px 20px;
+    }
+
+    .n-tabs-tab {
+      color: #8B8D98;
+      font-size: max(20px, 14Px);
+      padding-top: 12px;
+      padding-bottom: 8px;
+      line-height: 28px;
+
+      &.n-tabs-tab--active {
+        font-weight: 600 !important;
+        color: #131415 !important;
+      }
+    }
+
+    .n-tabs-tab__label {
+      z-index: 10;
+    }
+
+    .n-tabs-bar {
+      height: 10px;
+      background: linear-gradient(90deg, #77BBFF 0%, rgba(163, 231, 255, 0.22) 100%);
+      z-index: 0;
+      bottom: 8px;
+    }
+
+    .n-tab-pane {
+      padding-top: 4px !important;
+    }
+  }
 }
 
 .subjectList {
   display: flex;
   align-items: center;
   flex-wrap: wrap;
-  padding: 40px 30px 0;
+  padding: 0 30px 0;
   gap: 20px 40px;
 }
 
@@ -40,6 +80,13 @@
     border-radius: 24px;
     line-height: 0;
     overflow: hidden;
+
+    &::before {
+      content: '';
+      background: url('@/images/subject-bg.png') no-repeat center;
+      position: absolute;
+      inset: 0;
+    }
   }
 
   img {
@@ -48,6 +95,7 @@
     width: 127px;
     height: 127px;
     object-fit: contain;
+    position: relative;
   }
 
   .iconSelect {

+ 57 - 4
src/views/prepare-lessons/model/subject-sync/index.tsx

@@ -1,6 +1,13 @@
 import { defineComponent, onMounted, ref } from 'vue';
 import styles from './index.module.less';
-import { NButton, NScrollbar, NSpace, useMessage } from 'naive-ui';
+import {
+  NButton,
+  NScrollbar,
+  NSpace,
+  NTabPane,
+  NTabs,
+  useMessage
+} from 'naive-ui';
 import { useCatchStore } from '/src/store/modules/catchData';
 import iconSelect from '../../images/icon-select.png';
 import { usePrepareStore } from '/src/store/modules/prepareLessons';
@@ -18,6 +25,7 @@ export default defineComponent({
   setup(props, { emit }) {
     const catchStore = useCatchStore();
     const prepareStore = usePrepareStore();
+    const tabId = ref('' as any);
     const message = useMessage();
     const selectSubjectIds = ref([] as any);
     const subjectList = ref([] as any);
@@ -78,10 +86,36 @@ export default defineComponent({
       });
       emit('confirm', { subjectIds: selectSubjectIds.value, subjectCode });
     };
+
+    const formatSubjectList = () => {
+      const subjects = catchStore.getEnableSubjects;
+      const temp: any = [];
+      subjects.forEach((subject: any) => {
+        console.log(
+          subject.id,
+          subject.instruments,
+          tabId.value && subject.instruments && tabId.value === subject.id
+        );
+        if (tabId.value === '' && subject.instruments) {
+          temp.push(...subject.instruments);
+        } else if (
+          tabId.value &&
+          subject.instruments &&
+          Number(tabId.value) === subject.id
+        ) {
+          temp.push(...subject.instruments);
+        }
+      });
+
+      subjectList.value = temp;
+    };
     onMounted(async () => {
       // 获取教材分类列表
-      await catchStore.getMusicInstrument();
-      subjectList.value = catchStore.getMusicInstruments;
+      // await catchStore.getMusicInstrument();
+      // subjectList.value = catchStore.getMusicInstruments;
+      await catchStore.getSubjects();
+
+      formatSubjectList();
       // const teachingSubjectList = prepareStore.getSubjectList; // 教材自带声部;
       // const tempSubjectList: any = [];
       // baseAllSubjectList.forEach((subject: any) => {
@@ -105,7 +139,26 @@ export default defineComponent({
           <span>(勾选后则对应乐器下的课件内容将被当前课件内容全部替换)</span>
         </div> */}
 
-        <NScrollbar style={{ maxHeight: '60vh' }}>
+        <NTabs
+          defaultValue=""
+          paneClass={styles.paneTitle}
+          justifyContent="start"
+          paneWrapperClass={styles.paneWrapperContainer}
+          value={tabId.value}
+          onUpdate:value={(val: any) => {
+            tabId.value = val;
+            formatSubjectList();
+          }}>
+          {[{ name: '全部声部', id: '' }, ...catchStore.getEnableSubjects].map(
+            (item: any) => (
+              <NTabPane
+                name={`${item.id}`}
+                tab={item.name}
+                displayDirective="if"></NTabPane>
+            )
+          )}
+        </NTabs>
+        <NScrollbar style={{ maxHeight: '50vh', minHeight: '50vh' }}>
           <div class={styles.subjectList}>
             {subjectList.value.map((subject: any) => (
               <div

+ 8 - 10
src/views/studentList/components/baseInfo.tsx

@@ -12,18 +12,16 @@ import {
   NSpace,
   SelectOption,
   useMessage,
-  NModal,
-  NCalendar,
-  NCascader
+  NModal
 } from 'naive-ui';
-import headerD from '../images/headerD.png';
-import defultHeade from '@/components/layout/images/teacherIcon.png';
-import maleIcon from '../images/maleIcon.png';
-import femaleIcon from '../images/femaleIcon.png';
-import { useUserStore } from '/src/store/modules/users';
-import { api_teacherUpdate } from '/src/api/user';
+// import headerD from '../images/headerD.png';
+// import defultHeade from '@/components/layout/images/teacherIcon.png';
+// import maleIcon from '../images/maleIcon.png';
+// import femaleIcon from '../images/femaleIcon.png';
+// import { useUserStore } from '/src/store/modules/users';
+// import { api_teacherUpdate } from '/src/api/user';
 import { api_getCurrentGradeYear, resetStudentInfo } from '../api';
-import UploadFile from '/src/components/upload-file';
+// import UploadFile from '/src/components/upload-file';
 import { getgradeNumList, classArray } from '@/views/classList/contants';
 import { useRoute } from 'vue-router';
 export default defineComponent({