Przeglądaj źródła

Merge branch 'iteration-20250221-tags' into dev

lex-xin 3 miesięcy temu
rodzic
commit
5ace2f343b

+ 1 - 1
public/version.json

@@ -1 +1 @@
-{"version":1740452640934}
+{"version":1740635669456}

+ 14 - 10
src/components/CCascader/index.tsx

@@ -93,7 +93,11 @@ export default defineComponent({
       let columnName = '';
       if (subject.children) {
         children = [...subject.children];
-        let activeIndex = children.length > 0 ? children[0].id : '';
+        let activeIndex = subject.activeIndex
+          ? subject.activeIndex
+          : children.length > 0
+          ? children[0].id
+          : '';
         if (props.childShowAllCheck) {
           children.unshift({
             columnName: subject.children[0].columnName,
@@ -121,21 +125,22 @@ export default defineComponent({
       () => {
         if (!state.popoverShow || !props.value) return;
         let ids = formatParentId(props.value, props.options);
-        console.log(ids, 'ids');
-        state.tagActiveId = ids[0].id;
-        props.options.forEach((item: any) => {
-          if (item.id === state.tagActiveId) {
-            initParentSelect(item);
-          }
-        });
 
-        //
         const index = ids.findIndex((child: any) => child.id === props.value);
         ids = ids.slice(0, index + 1);
         const values = ids.map((item: any) => {
           return item.id;
         });
+        // 格式化数据
         formatParentCurrentValue(values, props.options);
+
+        // 初始化选中数据
+        state.tagActiveId = ids[0].id;
+        props.options.forEach((item: any) => {
+          if (item.id === state.tagActiveId) {
+            initParentSelect(item);
+          }
+        });
       }
     );
 
@@ -422,7 +427,6 @@ const ChildNodeSearch = defineComponent({
   setup(props, { emit }) {
     const { activeRow } = toRefs(props);
     const selectItem = ref({});
-
     watch(
       () => props.activeRow,
       () => {

+ 3 - 0
src/styles/index.less

@@ -22,6 +22,9 @@ body {
   background-color: #f1f5ff;
   overflow: hidden;
   --layoutTopHeight: 64px;
+  .n-form-item .n-form-item-feedback-wrapper {
+    --n-feedback-font-size: 12Px !important;
+  }
 }
 
 body > .n-drawer-container-relative {

+ 1 - 0
src/views/attend-class/model/select-class/index.tsx

@@ -59,6 +59,7 @@ export default defineComponent({
             name: item.name,
             coverImg: firstItem?.bizInfo.coverImg,
             type: firstItem?.bizInfo.type,
+            updateTime: item.updateTime,
             coursewareType: item.coursewareType
           });
         });

+ 4 - 4
src/views/attend-class/model/train-settings/index.tsx

@@ -95,9 +95,7 @@ export default defineComponent({
       if (trainingType === 'EVALUATION') {
         tList = [
           `${evaluateDifficult[configJson.evaluateDifficult]}`,
-          configJson.practiceChapterBegin || configJson.practiceChapterEnd
-            ? `${configJson.practiceChapterBegin}-${configJson.practiceChapterEnd}小节`
-            : '全部小节',
+          `${configJson.practiceChapterBegin || 0}-${configJson.practiceChapterEnd || 0}小节`,
           `速度${configJson.evaluateSpeed || 0}`,
           `${configJson.trainingTimes}分达标`
         ];
@@ -140,7 +138,9 @@ export default defineComponent({
 
       // 判断读取小节数
       if (xmlStatus == 'success') {
-        item.practiceChapterMax = firstMeasures.length;
+        // 标记xml是否是从0小节开始
+        item.firstMeasureIsZero = firstMeasures?.[0]?.getAttribute('number') === '0';
+        item.practiceChapterMax = item.firstMeasureIsZero ? firstMeasures.length - 1 : firstMeasures.length;
       } else {
         item.practiceChapterMax = 0;
       }

+ 32 - 19
src/views/attend-class/model/train-update/index.tsx

@@ -1,4 +1,11 @@
-import { PropType, defineComponent, onMounted, reactive, ref } from 'vue';
+import {
+  Fragment,
+  PropType,
+  defineComponent,
+  onMounted,
+  reactive,
+  ref
+} from 'vue';
 import styles from './index.module.less';
 import {
   NButton,
@@ -48,7 +55,8 @@ export default defineComponent({
       practiceTimes: null as any, // 练习时长
       difficulty: 'BEGINNER', // 评测难度
       evaluationSpeed: null as any, // 评测速度
-      evaluationScore: null as any // 评测分数
+      evaluationScore: null as any, // 评测分数
+      firstMeasureIsZero: false as boolean // 标记xml是否是从0小节开始
     });
     const formsRef = ref();
 
@@ -83,6 +91,8 @@ export default defineComponent({
             configJson.trainingTimes = forms.evaluationScore;
           }
           configJson.practiceChapterMax = forms.baseMaxScore;
+          // 添加是否从0小节开始的标记
+          configJson.firstMeasureIsZero = forms.firstMeasureIsZero;
           params.trainingConfigJson = configJson;
           // if (props.type === 'train') {
           // if (forms.id) {
@@ -105,6 +115,7 @@ export default defineComponent({
 
     onMounted(() => {
       const item = props.item;
+      const playSpeedFloor = Math.floor(item.playSpeed || 0);
       if (item.trainId) {
         forms.id = item.trainId;
         // forms.practiceSpeed = Number(item.practiceSpeed);
@@ -117,36 +128,38 @@ export default defineComponent({
 
           forms.practiceSpeed = item.practiceSpeed
             ? Number(item.practiceSpeed)
-            : item.playSpeed
-            ? item.playSpeed
+            : playSpeedFloor
+            ? playSpeedFloor
             : null;
           forms.evaluationSpeed = item.practiceSpeed
             ? Number(item.practiceSpeed)
-            : item.playSpeed
-            ? item.playSpeed
+            : playSpeedFloor
+            ? playSpeedFloor
             : null;
         } else {
           forms.evaluationScore = item.trainingTimes;
 
           forms.evaluationSpeed = item.evaluateSpeed
             ? Number(item.evaluateSpeed)
-            : item.playSpeed
-            ? item.playSpeed
+            : playSpeedFloor
+            ? playSpeedFloor
             : null;
           forms.practiceSpeed = item.evaluateSpeed
             ? Number(item.evaluateSpeed)
-            : item.playSpeed
-            ? item.playSpeed
+            : playSpeedFloor
+            ? playSpeedFloor
             : null;
         }
 
         // forms.evaluationSpeed = item.evaluateSpeed;
       } else {
-        forms.minScore = 1;
+        // xml小节从0开始,最小为0,否则为1
+        forms.minScore = item.firstMeasureIsZero ? 0 : 1;
         forms.maxScore = item.practiceChapterMax ? item.practiceChapterMax : 1;
-        forms.evaluationSpeed = item.playSpeed || null;
-        forms.practiceSpeed = item.playSpeed || null;
+        forms.evaluationSpeed = playSpeedFloor || null;
+        forms.practiceSpeed = playSpeedFloor || null;
       }
+      forms.firstMeasureIsZero = item.firstMeasureIsZero;
       forms.audioPlayTypeArray = item.audioPlayTypeArray || [];
       forms.containAccompaniment = item.containAccompaniment || null;
       forms.baseMaxScore = item.practiceChapterMax || 99;
@@ -217,7 +230,7 @@ export default defineComponent({
               <NInputNumber
                 v-model:value={forms.minScore}
                 showButton={false}
-                min={1}
+                min={forms.firstMeasureIsZero ? 0 : 1}
                 max={forms.baseMaxScore}
                 precision={0}
                 placeholder="最小练习小节"
@@ -251,7 +264,7 @@ export default defineComponent({
                 v-model:value={forms.maxScore}
                 showButton={false}
                 precision={0}
-                min={forms.minScore || 1}
+                min={forms.minScore || 0}
                 max={forms.baseMaxScore}
                 placeholder="最大练习小节"
                 clearable
@@ -259,7 +272,7 @@ export default defineComponent({
             </NFormItem>
           </div>
           {forms.type === 'PRACTICE' && (
-            <>
+            <Fragment key={'PRACTICE'}>
               <NFormItem
                 label="练习速度"
                 path="practiceSpeed"
@@ -321,11 +334,11 @@ export default defineComponent({
                   </NButton>
                 </NSpace>
               </NFormItem>
-            </>
+            </Fragment>
           )}
 
           {forms.type === 'EVALUATION' && (
-            <>
+            <Fragment key={'EVALUATION'}>
               <NFormItem
                 label="评测难度"
                 path="type"
@@ -411,7 +424,7 @@ export default defineComponent({
                   <NInputGroupLabel>分</NInputGroupLabel>
                 </NInputGroup>
               </NFormItem>
-            </>
+            </Fragment>
           )}
         </NForm>
 

+ 1 - 4
src/views/classList/components/afterWorkDetail.tsx

@@ -152,10 +152,7 @@ export default defineComponent({
               if (trainingContent) {
                 const tempList = [
                   `${evaluateDifficult[trainingContent.evaluateDifficult]}`,
-                  trainingContent.practiceChapterBegin ||
-                  trainingContent.practiceChapterEnd
-                    ? `${trainingContent.practiceChapterBegin}-${trainingContent.practiceChapterEnd}小节`
-                    : '全部小节',
+                  `${trainingContent.practiceChapterBegin || 0}-${trainingContent.practiceChapterEnd || 0}小节`,
                   `速度${trainingContent.evaluateSpeed || 0}`,
                   `${trainingContent.trainingTimes}分达标`
                 ];

+ 1 - 3
src/views/classList/modals/TrainingDetails.tsx

@@ -57,9 +57,7 @@ export default defineComponent({
       if (trainingType === 'EVALUATION') {
         tList = [
           `${evaluateDifficult[configJson.evaluateDifficult]}`,
-          configJson.practiceChapterBegin || configJson.practiceChapterEnd
-            ? `${configJson.practiceChapterBegin}-${configJson.practiceChapterEnd}小节`
-            : '全部小节',
+          `${configJson.practiceChapterBegin || 0}-${configJson.practiceChapterEnd || 0}小节`,
           `速度${configJson.evaluateSpeed || 0}`,
           `${configJson.trainingTimes}分达标`
         ];

+ 1 - 3
src/views/classList/modals/classTrainingDetails.tsx

@@ -52,9 +52,7 @@ export default defineComponent({
       if (trainingType === 'EVALUATION') {
         tList = [
           `${evaluateDifficult[configJson.evaluateDifficult]}`,
-          configJson.practiceChapterBegin || configJson.practiceChapterEnd
-            ? `${configJson.practiceChapterBegin}-${configJson.practiceChapterEnd}小节`
-            : '全部小节',
+          `${configJson.practiceChapterBegin || 0}-${configJson.practiceChapterEnd || 0}小节`,
           `速度${configJson.evaluateSpeed || 0}`,
           `${configJson.trainingTimes}分达标`
         ];

+ 1 - 4
src/views/homework-record/detail/index.tsx

@@ -131,10 +131,7 @@ export default defineComponent({
               if (trainingContent) {
                 const tempList = [
                   `${evaluateDifficult[trainingContent.evaluateDifficult]}`,
-                  trainingContent.practiceChapterBegin ||
-                  trainingContent.practiceChapterEnd
-                    ? `${trainingContent.practiceChapterBegin}-${trainingContent.practiceChapterEnd}小节`
-                    : '全部小节',
+                  `${trainingContent.practiceChapterBegin || 0}-${trainingContent.practiceChapterEnd || 0}小节`,
                   `速度${trainingContent.evaluateSpeed || 0}`,
                   `${trainingContent.trainingTimes}分达标`
                 ];

+ 1 - 4
src/views/homework-record/index.tsx

@@ -174,10 +174,7 @@ export default defineComponent({
                 if (trainingContent) {
                   const tempList = [
                     `${evaluateDifficult[trainingContent.evaluateDifficult]}`,
-                    trainingContent.practiceChapterBegin ||
-                    trainingContent.practiceChapterEnd
-                      ? `${trainingContent.practiceChapterBegin}-${trainingContent.practiceChapterEnd}小节`
-                      : '全部小节',
+                    `${trainingContent.practiceChapterBegin || 0}-${trainingContent.practiceChapterEnd || 0}小节`,
                     `速度${trainingContent.evaluateSpeed || 0}`,
                     `${trainingContent.trainingTimes}分达标`
                   ];

+ 1 - 0
src/views/natural-resources/components/my-collect/search-group-resources.tsx

@@ -163,6 +163,7 @@ export default defineComponent({
                 onClick={() => {
                   forms.type = item.value;
                   forms.audioPlayTypes = '';
+                  forms.materialTagId = null;
                   formatFirstSubject();
                   onSearch();
 

+ 2 - 1
src/views/natural-resources/components/my-resources/search-group-resources.tsx

@@ -117,8 +117,9 @@ export default defineComponent({
                   // forms.subjectId = null;
                   // state.tempSubjectId = null;
 
-                  forms.materialTagId = null
+                  forms.materialTagId = null;
                   // onSearch();
+
                   formatFirstSubject();
                 }}>
                 {item.label}

+ 1 - 0
src/views/natural-resources/components/share-resources/search-group-resources.tsx

@@ -305,6 +305,7 @@ export default defineComponent({
                   forms.audioPlayTypes = '';
                   data.tagActiveId = '';
                   data.childSelectId = null;
+                  forms.materialTagId = null;
                   data.selectParents = {};
 
                   formatFirstSubject();

+ 6 - 4
src/views/prepare-lessons/components/lesson-main/train/index.tsx

@@ -117,9 +117,9 @@ export default defineComponent({
           if (row.trainingType === 'EVALUATION') {
             tList = [
               `${evaluateDifficult[configJson.evaluateDifficult]}`,
-              configJson.practiceChapterBegin || configJson.practiceChapterEnd
-                ? `${configJson.practiceChapterBegin}-${configJson.practiceChapterEnd}小节`
-                : '全部小节',
+              `${configJson.practiceChapterBegin || 0}-${
+                configJson.practiceChapterEnd || 0
+              }小节`,
               `速度${configJson.evaluateSpeed || 0}`,
               `${configJson.trainingTimes}分达标`
             ];
@@ -132,7 +132,9 @@ export default defineComponent({
           }
           temp.push({
             typeList: tList || [],
-            audioPlayTypeArray: row.audioPlayTypes ? row.audioPlayTypes.split(',') : [],
+            audioPlayTypeArray: row.audioPlayTypes
+              ? row.audioPlayTypes.split(',')
+              : [],
             ...row
           });
         });

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

@@ -40,9 +40,7 @@ export const typeFormat = (trainingType: string, configJson: any) => {
   if (trainingType === 'EVALUATION') {
     tList = [
       `${evaluateDifficult[configJson.evaluateDifficult]}`,
-      configJson.practiceChapterBegin || configJson.practiceChapterEnd
-        ? `${configJson.practiceChapterBegin}-${configJson.practiceChapterEnd}小节`
-        : '全部小节',
+      `${configJson.practiceChapterBegin || 0}-${configJson.practiceChapterEnd || 0}小节`,
       `速度${configJson.evaluateSpeed || 0}`,
       `${configJson.trainingTimes}分达标`
     ];
@@ -221,7 +219,9 @@ export default defineComponent({
 
       // 判断读取小节数
       if (xmlStatus == 'success') {
-        item.practiceChapterMax = firstMeasures.length;
+        // 标记xml是否是从0小节开始
+        item.firstMeasureIsZero = firstMeasures?.[0]?.getAttribute('number') === '0';
+        item.practiceChapterMax = item.firstMeasureIsZero ? firstMeasures.length - 1 : firstMeasures.length;
       } else {
         item.practiceChapterMax = 0;
       }

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

@@ -75,7 +75,7 @@ export default defineComponent({
           childs.forEach((child: any) => {
             system?.removeChild(child);
           })
-        });  
+        });
         const parts = xmlParse.getElementsByTagName('part');
         firstMeasures = parts[0]?.getElementsByTagName('measure');
         xmlStatus = 'success';
@@ -85,7 +85,9 @@ export default defineComponent({
 
       // 判断读取小节数
       if (xmlStatus == 'success') {
-        item.practiceChapterMax = firstMeasures.length;
+        // 标记xml是否是从0小节开始
+        item.firstMeasureIsZero = firstMeasures?.[0]?.getAttribute('number') === '0';
+        item.practiceChapterMax = item.firstMeasureIsZero ? firstMeasures.length - 1 : firstMeasures.length;
       } else {
         item.practiceChapterMax = 0;
       }

+ 20 - 9
src/views/prepare-lessons/model/subject-sync/index.tsx

@@ -1,4 +1,4 @@
-import { defineComponent, onMounted, ref } from 'vue';
+import { defineComponent, onMounted, ref, shallowRef } from 'vue';
 import styles from './index.module.less';
 import {
   NButton,
@@ -10,9 +10,6 @@ import {
 } from 'naive-ui';
 import { useCatchStore } from '/src/store/modules/catchData';
 import iconSelect from '../../images/icon-select.png';
-import { usePrepareStore } from '/src/store/modules/prepareLessons';
-import { PageEnum } from '/src/enums/pageEnum';
-
 export default defineComponent({
   name: 'subject-sync',
   props: {
@@ -24,10 +21,10 @@ export default defineComponent({
   emits: ['close', 'confirm'],
   setup(props, { emit }) {
     const catchStore = useCatchStore();
-    const prepareStore = usePrepareStore();
     const tabId = ref('' as any);
     const message = useMessage();
     const selectSubjectIds = ref([] as any);
+    const subjectAllList = shallowRef<any[]>([]); // 所有乐器列表
     const subjectList = ref([] as any);
 
     const subjectImgs = {
@@ -63,10 +60,9 @@ export default defineComponent({
 
       const subjectCode: any[] = [];
       selectSubjectIds.value.forEach((id: any) => {
-        const item = subjectList.value.find(
+        const item = subjectAllList.value.find(
           (subject: any) => subject.id === id
         );
-        console.log(item, 'item', item.code);
 
         if (item) {
           const tempCode = item.code ? item.code.split(',')[0] : '';
@@ -102,10 +98,21 @@ export default defineComponent({
 
       subjectList.value = temp;
     };
+
+    const formatSubjectAll = () => {
+      const subjects: any[] = catchStore.getEnableSubjects;
+      const temp: any = [];
+      subjects.forEach((subject: any) => {
+        if (tabId.value === '' && subject.instruments) {
+          temp.push(...subject.instruments);
+        }
+      });
+      subjectAllList.value = temp;
+    };
     onMounted(async () => {
       // 获取教材分类列表
       await catchStore.getSubjects();
-
+      formatSubjectAll();
       formatSubjectList();
       if (props.subjectId) {
         selectSubjectIds.value = [Number(props.subjectId)];
@@ -173,7 +180,11 @@ export default defineComponent({
           <NButton round onClick={() => emit('close')}>
             取消
           </NButton>
-          <NButton round type="primary" onClick={onSubmit} disabled={selectSubjectIds.value.length <= 0}>
+          <NButton
+            round
+            type="primary"
+            onClick={onSubmit}
+            disabled={selectSubjectIds.value.length <= 0}>
             确定
           </NButton>
         </NSpace>

+ 1 - 3
src/views/studentList/modals/studentTraomomhDetails.tsx

@@ -56,9 +56,7 @@ export default defineComponent({
       if (trainingType === 'EVALUATION') {
         tList = [
           `${evaluateDifficult[configJson.evaluateDifficult]}`,
-          configJson.practiceChapterBegin || configJson.practiceChapterEnd
-            ? `${configJson.practiceChapterBegin}-${configJson.practiceChapterEnd}小节`
-            : '全部小节',
+          `${configJson.practiceChapterBegin || 0}-${configJson.practiceChapterEnd || 0}小节`,
           `速度${configJson.evaluateSpeed || 0}`,
           `${configJson.trainingTimes}分达标`
         ];

+ 1 - 1
vite.config.ts

@@ -23,7 +23,7 @@ function resolve(dir: string) {
 }
 // https://vitejs.dev/config/
 // https://github.com/vitejs/vite/issues/1930 .env
-const proxyUrl = 'https://dev.kt.colexiu.com/';
+const proxyUrl = 'https://test.kt.colexiu.com/';
 // const proxyUrl = 'https://test.kt.colexiu.com';
 // const proxyUrl = 'http://192.168.3.14:7989';
 const now = new Date().getTime();