فهرست منبع

Merge branch 'ktyq-classroom-work' into ktyq-online

lex 1 سال پیش
والد
کامیت
3aa24c4d7e
3فایلهای تغییر یافته به همراه28 افزوده شده و 70 حذف شده
  1. 9 0
      src/page-instrument/api.ts
  2. 7 37
      src/page-instrument/view-figner/change-subject/index.tsx
  3. 12 33
      src/page-instrument/view-figner/index.tsx

+ 9 - 0
src/page-instrument/api.ts

@@ -47,6 +47,15 @@ export const api_subjectList = (params: any) => {
     requestType: "json",
   });
 };
+
+/** 获取乐器列表 */
+export const api_musicalInstrumentList = (params: any) => {
+  return request.post("/musicalInstrument/list", {
+    data: params,
+    requestType: "json",
+  });
+};
+
 /** 获取曲谱列表 */
 export const api_musicSheetPage = (data: any) => {
   return request.post("/musicSheet/page", {

+ 7 - 37
src/page-instrument/view-figner/change-subject/index.tsx

@@ -25,19 +25,7 @@ export default defineComponent({
     //
     const selectItem = () => {
       const i: any = props.subjectList.find((item: any) => item.value === props.subject);
-      if (!i) {
-        props.subjectList.forEach((item: any) => {
-          if (item.children && item.children.length > 0) {
-            item.children.forEach((child: any) => {
-              if (child.value === props.subject) {
-                state.instrumentCode = child.value;
-                state.subjectValue = item.id;
-                state.selectList = item.children;
-              }
-            });
-          }
-        });
-      } else {
+      if (i) {
         state.subjectValue = i.id;
         state.instrumentCode = i.value;
         state.selectList = [];
@@ -50,43 +38,25 @@ export default defineComponent({
     return () => (
       <div class={styles.changeSubject}>
         <div class={styles.changeSubjectContainer}>
-          <div class={styles.title}>声部</div>
+          <div class={styles.title}>乐器</div>
 
           <div class={styles.subjectContainer}>
             {props.subjectList.map((item: any) => (
               <div
-                class={[styles.subjectItem, item.children.length > 0 && styles.arrow, item.id === state.subjectValue && styles.active]}
+                class={[styles.subjectItem, item.id === state.subjectValue && styles.active]}
                 onClick={() => {
-                  if (item.children.length <= 0) {
-                    state.instrumentCode = "";
-                  }
+                  // if (item.children.length <= 0) {
+                  //   state.instrumentCode = "";
+                  // }
                   state.subjectValue = item.id;
                   state.instrumentCode = item.value;
-                  state.selectList = item.children;
+                  // state.selectList = item.children;
                 }}
               >
                 {item.text}
               </div>
             ))}
           </div>
-
-          {state.selectList.length > 0 && (
-            <>
-              <div class={styles.title}>乐器</div>
-              <div class={styles.subjectContainer}>
-                {state.selectList.map((item: any) => (
-                  <div
-                    class={[styles.subjectItem, item.value === state.instrumentCode && styles.active]}
-                    onClick={() => {
-                      state.instrumentCode = item.value;
-                    }}
-                  >
-                    {item.text}
-                  </div>
-                ))}
-              </div>
-            </>
-          )}
         </div>
 
         <div class={styles.btnGroups}>

+ 12 - 33
src/page-instrument/view-figner/index.tsx

@@ -15,7 +15,7 @@ import { usePageVisibility } from "@vant/use";
 import { watch } from "vue";
 import icon_loading_img from "./image/icon_loading_img.png";
 import state, { IPlatform } from "/src/state";
-import { api_subjectList, getSubjectList } from "../api";
+import { api_musicalInstrumentList, api_subjectList, getSubjectList } from "../api";
 import ChangeSubject from "./change-subject";
 
 export default defineComponent({
@@ -110,7 +110,7 @@ export default defineComponent({
     const getAPPData = async (type: "top" | "left") => {
       const screenData = await isSpecialShapedScreen();
       if (screenData?.content) {
-        // console.log("🚀 ~ screenData:", screenData.content);
+        console.log("🚀 ~ screenData:", screenData.content);
         const { isSpecialShapedScreen, notchHeight } = screenData.content;
         if (isSpecialShapedScreen) {
           if (type === "top") {
@@ -124,10 +124,10 @@ export default defineComponent({
     };
 
     const getHeadTop = () => {
-      if (!browsInfo.ios && fingerData.fingeringInfo.orientation === 1) {
+      if (fingerData.fingeringInfo.orientation === 1) {
         getAPPData("top");
       }
-      if (!browsInfo.ios && fingerData.fingeringInfo.orientation === 0) {
+      if (fingerData.fingeringInfo.orientation === 0) {
         getAPPData("left");
       }
     };
@@ -254,7 +254,6 @@ export default defineComponent({
     const __init = async (loadSong = true) => {
       data.loadingDom = true;
       getNotes();
-
       // selectSubjectType(data.subject);
 
       if (data.fingeringMode === "fingeringMode") {
@@ -291,48 +290,28 @@ export default defineComponent({
     const getSubjects = async () => {
       try {
         // api_subjectList
-        const subjects = await api_subjectList({
+        const subjects = await api_musicalInstrumentList({
           enableFlag: true,
-          delFlag: 0,
-          page: 1,
-          rows: 999,
         });
 
         const rows = subjects.data || [];
         rows.forEach((row: any) => {
           const tempList: any = {
             text: row.name,
-            value: "", // mappingVoicePart(row.code, "INSTRUMENT"),
+            value: mappingVoicePart(row.code, "INSTRUMENT"), // mappingVoicePart(row.code, "INSTRUMENT"),
             id: row.id,
-            children: [] as any,
           };
-          if (row.instruments && row.instruments.length > 0) {
-            if (row.instruments.length > 1) {
-              row.instruments.forEach((i: any) => {
-                tempList.children.push({
-                  text: i.name,
-                  id: i.id,
-                  value: mappingVoicePart(i.code, "INSTRUMENT"),
-                });
-              });
-            } else {
-              const singleRow = row.instruments[0];
-              if (singleRow.code) {
-                tempList.value = mappingVoicePart(singleRow.code, "INSTRUMENT");
-                tempList.id = singleRow.id;
-              }
-            }
-          }
           data.subjects.push(tempList);
         });
 
-        data.subjects.forEach((item: any) => {
-          if (item.value === data.subject && item.children?.length > 1) {
-            data.subject = item.children[0].value;
-          }
-        });
+        // data.subjects.forEach((item: any) => {
+        //   if (item.value === data.subject && item.children?.length > 1) {
+        //     data.subject = item.children[0].value;
+        //   }
+        // });
       } catch (e) {
         //
+        console.log(e, "e");
       }
     };