Explorar el Código

Merge branch 'iteration-0901' into temp-register

lex hace 1 año
padre
commit
09296b6393

+ 7 - 0
src/views/natural-resources/api.ts

@@ -68,3 +68,10 @@ export const materialRemoveAll = (params: any): Promise<any> => {
     data: params
   });
 };
+
+/** 资源-批量删除-曲谱 */
+export const materialRemoveMusic = (params: any): Promise<any> => {
+  return request.post('/edu-app/material/removeMusic', {
+    data: params
+  });
+};

+ 7 - 29
src/views/natural-resources/components/my-collect/search-group-resources.tsx

@@ -83,13 +83,11 @@ export default defineComponent({
       await catchStore.getSubjects();
 
       // 这里开始
-      // musicCateRef
-      if (forms.type === 'MUSIC') {
-        orginHeight.value = collapseWrapRef.value.offsetHeight;
-        // hiddenHeight.value = collapseWrapRef.value.offsetHeight / line.value;
-        // 默认隐藏
-        getLive();
-      }
+      // if (forms.type === 'MUSIC') {
+      //   orginHeight.value = collapseWrapRef.value.offsetHeight;
+      //   // 默认隐藏
+      //   getLive();
+      // }
     });
     return () => (
       <div class={styles.searchGroup}>
@@ -124,7 +122,7 @@ export default defineComponent({
           </NSpace>
         </div>
         <NForm labelAlign="left" labelPlacement="left">
-          {forms.type === 'MUSIC' && (
+          {/* {forms.type === 'MUSIC' && (
             <div class={[styles.collapsSection]}>
               <NFormItem label="教材:">
                 <div
@@ -179,27 +177,7 @@ export default defineComponent({
                 </div>
               </NFormItem>
             </div>
-            // <NFormItem label="教材:">
-            //   <NSpace class={styles.spaceSection}>
-            //     {catchStore.getAllMusicCategories.map((music: any) => (
-            //       <NButton
-            //         secondary={forms.bookVersionId === music.id}
-            //         quaternary={forms.bookVersionId !== music.id}
-            //         strong
-            //         focusable={false}
-            //         type={
-            //           forms.bookVersionId === music.id ? 'primary' : 'default'
-            //         }
-            //         onClick={() => {
-            //           forms.bookVersionId = music.id;
-            //           onSearch();
-            //         }}>
-            //         {music.name}
-            //       </NButton>
-            //     ))}
-            //   </NSpace>
-            // </NFormItem>
-          )}
+          )} */}
           <NFormItem label="乐器:">
             <NSpace class={styles.spaceSection}>
               {catchStore.getSubjectAllList.map((subject: any) => (

+ 16 - 4
src/views/natural-resources/components/my-resources/index.tsx

@@ -7,7 +7,8 @@ import {
   favorite,
   materialQueryPage,
   materialRemove,
-  materialRemoveAll
+  materialRemoveAll,
+  materialRemoveMusic
 } from '../../api';
 import {
   NButton,
@@ -37,7 +38,7 @@ export default defineComponent({
         rows: 20
       },
       searchGroup: {
-        type: '', //
+        type: 'MUSIC', //
         name: '',
         bookVersionId: null,
         subjectId: null,
@@ -77,6 +78,7 @@ export default defineComponent({
             isSelected: row.sourceFrom === 'PLATFORM' ? true : false,
             content: row.content,
             subjectId: row.subjectIds,
+            sourceFrom: row.sourceFrom,
             enableFlag: row.enableFlag ? 1 : 0,
             openFlag: row.openFlag
           });
@@ -113,7 +115,11 @@ export default defineComponent({
     // 批量删除
     const onDelete = async () => {
       try {
-        await materialRemoveAll(state.editIds);
+        if (state.searchGroup.type === 'MUSIC') {
+          await materialRemoveMusic(state.editIds);
+        } else {
+          await materialRemoveAll(state.editIds);
+        }
         message.success('删除成功');
         onSearch(state.searchGroup);
         state.editIds = [];
@@ -125,7 +131,13 @@ export default defineComponent({
     // 单个删除
     const onRemove = async () => {
       try {
-        await materialRemove({ id: state.removeItem.id });
+        // 如果是乐谱类型则使用其它删除接口
+        if (state.searchGroup.type === 'MUSIC') {
+          await materialRemoveMusic([state.removeItem.id]);
+        } else {
+          await materialRemove({ id: state.removeItem.id });
+        }
+
         message.success('删除成功');
         onSearch(state.searchGroup);
       } catch {

+ 21 - 17
src/views/natural-resources/components/my-resources/search-group-resources.tsx

@@ -18,7 +18,7 @@ export default defineComponent({
     const resourceList = ref([] as any[]);
     const catchStore = useCatchStore();
     const forms = reactive({
-      type: '', //
+      type: 'MUSIC', //
       name: '',
       bookVersionId: null,
       subjectId: null
@@ -34,15 +34,15 @@ export default defineComponent({
 
     onMounted(async () => {
       resourceList.value = [
-        {
-          label: '全部',
-          value: ''
-        }
+        // {
+        //   label: '全部',
+        //   value: ''
+        // }
       ];
       resourceTypeArray.forEach((item: any) => {
-        if (item.value !== 'MUSIC') {
-          resourceList.value.push(item);
-        }
+        // if (item.value !== 'MUSIC') {
+        resourceList.value.push(item);
+        // }
       });
 
       // 获取声部列表
@@ -97,15 +97,18 @@ export default defineComponent({
                   <img src={iconDelete} class={styles.iconDelete} />
                   删除
                 </NButton>
-                <NButton
-                  type="primary"
-                  class={styles.addTrain}
-                  focusable={false}
-                  strong
-                  onClick={() => emit('update')}>
-                  <img src={iconPen} class={styles.iconPen} />
-                  修改
-                </NButton>
+                {forms.type !== 'MUSIC' && (
+                  <NButton
+                    type="primary"
+                    class={styles.addTrain}
+                    focusable={false}
+                    strong
+                    onClick={() => emit('update')}>
+                    <img src={iconPen} class={styles.iconPen} />
+                    修改
+                  </NButton>
+                )}
+
                 <NButton
                   type="primary"
                   class={styles.addTrain}
@@ -113,6 +116,7 @@ export default defineComponent({
                   strong
                   onClick={() => {
                     state.isEdit = false;
+                    state.isSelectAll = false;
                     emit('edit', state.isEdit);
                   }}>
                   完成编辑

+ 10 - 1
src/views/natural-resources/components/my-resources/upload-modal/index.tsx

@@ -142,13 +142,16 @@ export default defineComponent({
           coverImg: item.coverImg,
           name: item.title,
           type: item.type,
+          sourceFrom: item.sourceFrom,
           enableFlag: item.enableFlag,
           content: item.content,
+
           id: item.id
         });
       });
       uploadForms.list = temps || [];
 
+      console.log(temps, 'uploadForms');
       await catchStore.getSubjects();
     });
 
@@ -196,7 +199,13 @@ export default defineComponent({
 
                     <div class={styles.commonType}>
                       公开资源:
-                      <NSwitch size="small" v-model:value={item.openFlag} />
+                      <NSwitch
+                        size="small"
+                        v-model:value={item.openFlag}
+                        disabled={
+                          item.sourceFrom === 'TEACHER' && item.type === 'MUSIC'
+                        }
+                      />
                     </div>
                   </div>
                   <NFormItem

+ 19 - 18
src/views/notation/index.tsx

@@ -19,20 +19,20 @@ export default defineComponent({
       src: `${
         /(192|localhost)/.test(location.origin)
           ? // ?
-          // 'https://test.lexiaoya.cn'
-            'http://localhost:3050'
-          : location.origin
+            'https://test.lexiaoya.cn'
+          : // 'http://localhost:3050'
+            location.origin
       }/notation/#/create?Authorization=${Authorization}`
       //   src: `http://localhost:3050/#/create?Authorization=${Authorization}`
     });
-    const fscreen=()=> {
-      const el = document.documentElement as any
-        //进入全屏
-        (el.requestFullscreen && el.requestFullscreen()) ||
+    const fscreen = () => {
+      const el = document.documentElement as any;
+      //进入全屏
+      (el.requestFullscreen && el.requestFullscreen()) ||
         (el.mozRequestFullScreen && el.mozRequestFullScreen()) ||
         (el.webkitRequestFullscreen && el.webkitRequestFullscreen()) ||
-        (el.msRequestFullscreen && el.msRequestFullscreen())
-       }
+        (el.msRequestFullscreen && el.msRequestFullscreen());
+    };
     const handleOpen = (e: MessageEvent) => {
       console.log(e.data, 'data');
       if (e.data.api === 'notation_open') {
@@ -42,12 +42,12 @@ export default defineComponent({
           previewParams.value = {
             url: e.data.url
           };
-          fscreen()
+          fscreen();
         } else {
           window.open(e.data.url);
         }
       } else if (e.data.api === 'notation_exit') {
-        console.log('进来')
+        console.log('进来');
 
         removeVisiable.value = true;
       }
@@ -100,13 +100,14 @@ export default defineComponent({
                   );
                   if (state.application) {
                     document.exitFullscreen
-                    ? document.exitFullscreen()
-                    : document.mozCancelFullScreen
-                    ? document.mozCancelFullScreen()
-                    : document.webkitExitFullscreen
-                    ? document.webkitExitFullscreen()
-                    : ''
-                }}}>
+                      ? document.exitFullscreen()
+                      : document.mozCancelFullScreen
+                      ? document.mozCancelFullScreen()
+                      : document.webkitExitFullscreen
+                      ? document.webkitExitFullscreen()
+                      : '';
+                  }
+                }}>
                 确定
               </NButton>
               <NButton round onClick={() => (removeVisiable.value = false)}>

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

@@ -40,7 +40,10 @@ export default defineComponent({
         rows: 20
       },
       searchGroup: {
-        type: props.type === 'shareResources' ? 'MUSIC' : '', //
+        type:
+          props.type === 'shareResources' || props.type === 'myResources'
+            ? 'MUSIC'
+            : '', //
         name: '',
         bookVersionId: null,
         subjectId: null,
@@ -206,7 +209,10 @@ export default defineComponent({
         <NScrollbar
           class={[
             styles.listContainer,
-            state.searchGroup.type !== 'MUSIC' ? styles.listNoMusic : ''
+            state.searchGroup.type !== 'MUSIC' ||
+            ['myResources', 'myCollect'].includes(props.type)
+              ? styles.listNoMusic
+              : ''
           ]}
           onScroll={(e: any) => {
             const clientHeight = e.target?.clientHeight;

+ 7 - 7
src/views/prepare-lessons/components/resource-main/components/resource-item/resource-search-group/index.tsx

@@ -32,7 +32,7 @@ export default defineComponent({
     onMounted(async () => {
       // 获取教材分类列表
       await catchStore.getMusicSheetCategory();
-      if (props.type === 'myResources' || props.type === 'myCollect') {
+      if (props.type === 'myCollect') {
         resourceType.value.push({
           label: '全部',
           value: ''
@@ -40,11 +40,11 @@ export default defineComponent({
         forms.type = ''; // 默认全部
       }
       resourceTypeArray.forEach((item: any) => {
-        if (props.type === 'myResources') {
-          item.value !== 'MUSIC' && resourceType.value.push(item);
-        } else {
-          resourceType.value.push(item);
-        }
+        // if (props.type === 'myResources') {
+        //   item.value !== 'MUSIC' && resourceType.value.push(item);
+        // } else {
+        resourceType.value.push(item);
+        // }
       });
     });
     return () => (
@@ -67,7 +67,7 @@ export default defineComponent({
             ))}
           </NSpace>
 
-          {forms.type === 'MUSIC' && (
+          {forms.type === 'MUSIC' && props.type === 'shareResources' && (
             <div class={styles.searchSelect}>
               <NSelect
                 placeholder="全部教材"

+ 7 - 72
src/views/prepare-lessons/model/select-resources/index.module.less

@@ -1,5 +1,6 @@
 .selectMusic {
   padding-bottom: 10px;
+  height: 85vh;
 
   :global {
     .n-tabs-tab-pad {
@@ -7,7 +8,11 @@
     }
 
     .n-tabs-nav {
-      padding: 20px 20px 30px;
+      padding: 0 20px 0;
+
+      .n-tabs-nav-scroll-wrapper {
+        padding: 20px 0 30px;
+      }
     }
 
     .n-tabs-tab {
@@ -54,74 +59,4 @@
 .listContainer {
   margin-bottom: 20px;
   max-height: 50vh;
-}
-
-// .list {
-//   margin-top: 10px;
-//   padding: 0 40px 0;
-//   margin-bottom: 12px;
-//   display: flex;
-//   flex-flow: row wrap;
-//   justify-content: flex-start;
-//   gap: 22px;
-// }
-
-// .searchGroup {
-//   position: relative;
-//   padding: 0 40px;
-
-//   :global {
-//     .n-form {
-//       .n-form-item .n-form-item-label {
-//         font-size: 17px;
-//         font-weight: 600;
-//         color: #131415;
-//         line-height: 24px;
-//       }
-
-//       .n-button {
-//         height: 32px;
-//         font-size: 17px;
-//         border-radius: 8px;
-//         color: rgba(0, 0, 0, 0.6);
-//       }
-
-//       .n-button--primary-type {
-//         color: #131415;
-//       }
-
-//       .n-form-item-feedback-wrapper {
-//         min-height: 14px;
-//       }
-//     }
-//   }
-
-//   .inputSearch {
-//     position: absolute;
-//     top: 4px;
-//     right: 40px;
-//     width: 360px;
-//     height: 42px;
-//     font-size: 16px;
-
-//     img {
-//       width: 18px;
-//       height: 18px;
-//     }
-
-//     :global {
-//       .n-input-wrapper {
-//         padding-left: 12px;
-//         padding-right: 4px;
-//         height: 42px !important;
-//       }
-
-//       .n-button {
-//         height: 34px;
-//         font-size: 15px;
-//         font-weight: 500;
-//         width: auto;
-//       }
-//     }
-//   }
-// }
+}

+ 24 - 2
src/views/prepare-lessons/model/select-resources/index.tsx

@@ -1,7 +1,8 @@
 import { NTabPane, NTabs } from 'naive-ui';
-import { defineComponent, ref, toRefs } from 'vue';
+import { defineComponent, onMounted, ref, toRefs } from 'vue';
 import styles from './index.module.less';
 import SelectItem from './select-item';
+import { useResizeObserver } from '@vueuse/core';
 
 export default defineComponent({
   name: 'select-music',
@@ -15,8 +16,29 @@ export default defineComponent({
   setup(props) {
     const { type } = toRefs(props);
     const tabType = ref(type.value);
+
+    onMounted(() => {
+      console.log(
+        document.querySelector('.select-resource .n-tabs-nav--top'),
+        ''
+      );
+      useResizeObserver(
+        document.querySelector(
+          '.select-resource .n-tabs-nav--top'
+        ) as HTMLElement,
+        (entries: any) => {
+          const entry = entries[0];
+          const { height } = entry.contentRect;
+          console.log(height, 'height - 11');
+          document.documentElement.style.setProperty(
+            '--modal-lesson-tab-height',
+            height + 'px'
+          );
+        }
+      );
+    });
     return () => (
-      <div class={styles.selectMusic}>
+      <div class={[styles.selectMusic, 'select-resource']}>
         <NTabs
           animated
           value={tabType.value}

+ 6 - 6
src/views/prepare-lessons/model/select-resources/select-item/index.module.less

@@ -1,9 +1,9 @@
 .listContainer {
   margin: 0;
-  max-height: calc(var(--window-page-lesson-height) - 324px - 20px);
+  // max-height: calc(80vh - var(--modal-lesson-search-height) - 50px - 30Px);
 
   .listSection {
-    min-height: calc(var(--window-page-lesson-height) - 324px - 20px);
+    // min-height: calc(80vh - var(--modal-lesson-search-height) - 50px - 30Px);
   }
 
   .emptySection {
@@ -12,9 +12,9 @@
   }
 
   .list {
-    margin-top: 10px;
-    padding: 0 40px 0;
-    margin-bottom: 12px;
+    // margin-top: 10px;
+    padding: 10px 40px 0;
+    // margin-bottom: 12px;
     display: flex;
     flex-flow: row wrap;
     justify-content: flex-start;
@@ -26,7 +26,7 @@
     // text-align: center;
 
     &>div {
-      margin-bottom: 20px;
+      // margin-bottom: 20px;
 
       &:last-child {
         margin-bottom: 0;

+ 33 - 7
src/views/prepare-lessons/model/select-resources/select-item/index.tsx

@@ -14,7 +14,7 @@ import { materialQueryPage } from '/src/views/natural-resources/api';
 import TheEmpty from '/src/components/TheEmpty';
 import { usePrepareStore } from '/src/store/modules/prepareLessons';
 import { saveCourseware } from '../../../api';
-import { useDebounceFn } from '@vueuse/core';
+import { useDebounceFn, useResizeObserver } from '@vueuse/core';
 import CardPreview from '/src/components/card-preview';
 import { eventGlobal } from '/src/utils';
 
@@ -40,7 +40,9 @@ export default defineComponent({
     const prepareStore = usePrepareStore();
     const message = useMessage();
     const { type } = toRefs(props);
+    const className = 'resourceSearchGroup' + +new Date();
     const state = reactive({
+      searchHeight: '0px',
       loading: false,
       finshed: false, // 是否加载完
       pagination: {
@@ -48,7 +50,10 @@ export default defineComponent({
         rows: 20
       },
       searchGroup: {
-        type: type.value === 'shareResources' ? 'MUSIC' : '', //
+        type:
+          type.value === 'shareResources' || type.value === 'myResources'
+            ? 'MUSIC'
+            : '', //
         name: '',
         bookVersionId: null,
         subjectId: prepareStore.getSubjectId,
@@ -182,16 +187,34 @@ export default defineComponent({
 
     onMounted(() => {
       getList();
+
+      useResizeObserver(
+        document.querySelector('.' + className) as HTMLElement,
+        (entries: any) => {
+          const entry = entries[0];
+          const { height } = entry.contentRect;
+          // document.documentElement.style.setProperty(
+          //   '--modal-lesson-search-height',
+          //   height + 'px'
+          // );
+          state.searchHeight = height + 'px';
+        }
+      );
     });
     return () => (
       <div>
-        <ResourceSearchGroup
-          type={props.type}
-          subjectId={prepareStore.getSubjectId as any}
-          onSearch={(item: any) => throttledFnSearch(item)}
-        />
+        <div class={className}>
+          <ResourceSearchGroup
+            type={props.type}
+            subjectId={prepareStore.getSubjectId as any}
+            onSearch={(item: any) => throttledFnSearch(item)}
+          />
+        </div>
         <NScrollbar
           class={styles.listContainer}
+          style={{
+            'max-height': `calc(85vh - var(--modal-lesson-tab-height) - ${state.searchHeight} - 12px) `
+          }}
           onScroll={(e: any) => {
             const clientHeight = e.target?.clientHeight;
             const scrollTop = e.target?.scrollTop;
@@ -208,6 +231,9 @@ export default defineComponent({
           }}>
           <NSpin show={state.loading} size={'small'}>
             <div
+              style={{
+                'min-height': `calc(85vh - var(--modal-lesson-tab-height) - ${state.searchHeight} - 12px)`
+              }}
               class={[
                 styles.listSection,
                 !state.loading && state.tableList.length <= 0

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

@@ -131,7 +131,7 @@
 }
 
 .collapsSection {
-  padding-top: 10px;
+  // padding-top: 10px;
 }
 
 .isHidden {

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

@@ -66,7 +66,6 @@ export default defineComponent({
         divDomList.value = [...new Set(divDomList.value)];
         let offsetLeft = -1;
         divDomList.value.forEach((item: any, index: number) => {
-          console.log(item, 'item');
           if (index === 0) {
             line.value = 1;
             offsetLeft = item.offsetLeft;
@@ -93,7 +92,7 @@ export default defineComponent({
       }
     };
     onMounted(async () => {
-      if (props.type === 'myResources' || props.type === 'myCollect') {
+      if (props.type === 'myCollect') {
         resourceType.value.push({
           label: '全部',
           value: ''
@@ -101,11 +100,11 @@ export default defineComponent({
         forms.type = ''; // 默认全部
       }
       resourceTypeArray.forEach((item: any) => {
-        if (props.type === 'myResources') {
-          item.value !== 'MUSIC' && resourceType.value.push(item);
-        } else {
-          resourceType.value.push(item);
-        }
+        // if (props.type === 'myResources') {
+        //   item.value !== 'MUSIC' && resourceType.value.push(item);
+        // } else {
+        resourceType.value.push(item);
+        // }
       });
 
       // 获取教材分类列表
@@ -116,8 +115,8 @@ export default defineComponent({
       // 这里开始
       // musicCateRef
       if (forms.type === 'MUSIC') {
-        orginHeight.value = collapseWrapRef.value.offsetHeight;
-        hiddenHeight.value = collapseWrapRef.value.offsetHeight / line.value;
+        orginHeight.value = collapseWrapRef.value?.offsetHeight;
+        hiddenHeight.value = collapseWrapRef.value?.offsetHeight / line.value;
         // 默认隐藏
         getLive();
       }
@@ -168,7 +167,7 @@ export default defineComponent({
           />
         </div>
         <NForm labelAlign="left" labelPlacement="left">
-          {forms.type === 'MUSIC' && (
+          {forms.type === 'MUSIC' && props.type === 'shareResources' && (
             <div class={styles.collapsSection}>
               <NFormItem label="教材:">
                 <div