소스 검색

修改乐器接口

lex 1 년 전
부모
커밋
658c8f9d81
5개의 변경된 파일117개의 추가작업 그리고 147개의 파일을 삭제
  1. 1 1
      osmd-extended
  2. 9 0
      src/page-instrument/api.ts
  3. 7 37
      src/page-instrument/view-figner/change-subject/index.tsx
  4. 28 37
      src/page-instrument/view-figner/index.tsx
  5. 72 72
      vite.config.ts

+ 1 - 1
osmd-extended

@@ -1 +1 @@
-Subproject commit 4f276b25710d8d92e5985647329c152c9390b65c
+Subproject commit c61975028e8f71a7448a92ba440fc9297a17a2ed

+ 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}>

+ 28 - 37
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({
@@ -109,7 +109,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") {
@@ -123,10 +123,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");
       }
     };
@@ -252,7 +252,6 @@ export default defineComponent({
     const __init = async (loadSong = true) => {
       data.loadingDom = true;
       getNotes();
-
       // selectSubjectType(data.subject);
 
       if (data.fingeringMode === "fingeringMode") {
@@ -289,48 +288,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");
       }
     };
 
@@ -930,8 +909,8 @@ export default defineComponent({
           <div
             class={styles.head}
             style={{
-              paddingTop: data.paddingTop ? data.paddingTop : "",
-              paddingLeft: data.paddingLeft ? data.paddingLeft : "",
+              paddingTop: data.paddingTop && !browser().ios ? data.paddingTop : "",
+              paddingLeft: data.paddingLeft && !browser().ios ? data.paddingLeft : "",
             }}
           >
             <div class={styles.left}>
@@ -966,7 +945,13 @@ export default defineComponent({
             </div>
             {/*  */}
           </div>
-          <div class={styles.fingerContent}>
+          <div
+            class={styles.fingerContent}
+            style={{
+              paddingTop: data.paddingTop ? data.paddingTop : "",
+              paddingLeft: data.paddingLeft ? data.paddingLeft : "",
+            }}
+          >
             <div class={styles.wrapFinger}>
               <div
                 id="fingeringContainer"
@@ -1142,7 +1127,13 @@ export default defineComponent({
               </div>
             )}
           </div>
-          <div class={styles.fixedRightBtns}>
+          <div
+            class={styles.fixedRightBtns}
+            style={{
+              paddingTop: data.paddingTop ? data.paddingTop : "",
+              paddingLeft: data.paddingLeft ? data.paddingLeft : "",
+            }}
+          >
             <div class={styles.rightBtn}>
               {data.subject !== "melodica" && data.fingeringMode === "scaleMode" && (
                 <div

+ 72 - 72
vite.config.ts

@@ -7,77 +7,77 @@ import postCssPxToRem from "postcss-pxtorem";
 
 // https://vitejs.dev/config/
 export default defineConfig({
-	base: "./",
-	resolve: {},
-	plugins: [
-		// mkcert(), // 本地https
-		legacy({
-			targets: ['Chrome 63'],
-			additionalLegacyPolyfills: ['regenerator-runtime/runtime'],
-			modernPolyfills: true
-		  }),
-		vue(),
-		vueJsx(),
-	],
-	css: {
-		postcss: {
-			plugins: [
-				postCssPxToRem({
-					rootValue: 37.5,
-					propList: ["*"],
-					selectorBlackList: [".norem"],
-				}),
-			],
-		},
-	},
-	build: {
-		rollupOptions: {
-			input: {
-				gym: resolve(__dirname, "index.html"),
-				colexiu: resolve(__dirname, "colexiu.html"),
-				orchestra: resolve(__dirname, "orchestra.html"),
-				"report-share": resolve(__dirname, "report-share.html"),
-				instrument: resolve(__dirname, "instrument.html"),
-			},
-		},
-	},
-	server: {
-		cors: true,
-		port: 3000,
-		// https: true,
-		proxy: {
-			"^/gym/.*": {
-				target: "https://mstutest.dayaedu.com",
-				// target: "https://online.dayaedu.com",
-				changeOrigin: true,
-				rewrite: (path) => path.replace(/^\/gym/, ""),
-			},
-			"^/colexiu/.*": {
-				target: "https://dev.colexiu.com",
-				// target: "https://online.colexiu.com",
-				changeOrigin: true,
-				rewrite: (path) => path.replace(/^\/colexiu/, ""),
-			},
-			"^/orchestra/.*": {
-				target: "https://test.lexiaoya.cn",
-				changeOrigin: true,
-				rewrite: (path) => path.replace(/^\/orchestra/, ""),
-			},
-			"^/instrument/.*": {
-				// target: "https://kt.colexiu.com",
-				// target: "https://test.lexiaoya.cn",
-				// target: "https://dev.kt.colexiu.com",
-				// target: "https://test.resource.colexiu.com", // 内容平台开发环境,内容平台开发,需在url链接上加上isCbs=true
-				target: "https://test.resource.colexiu.com",
-				// target: "https://test.kt.colexiu.com",
-				changeOrigin: true,
-				rewrite: (path) => path.replace(/^\/instrument/, ""),
-			},
-		},
-	},
-	preview:{
-		port: 3000,
-		host: '192.168.3.114'
-	}
+  base: "./",
+  resolve: {},
+  plugins: [
+    // mkcert(), // 本地https
+    legacy({
+      targets: ["Chrome 63"],
+      additionalLegacyPolyfills: ["regenerator-runtime/runtime"],
+      modernPolyfills: true,
+    }),
+    vue(),
+    vueJsx(),
+  ],
+  css: {
+    postcss: {
+      plugins: [
+        postCssPxToRem({
+          rootValue: 37.5,
+          propList: ["*"],
+          selectorBlackList: [".norem"],
+        }),
+      ],
+    },
+  },
+  build: {
+    rollupOptions: {
+      input: {
+        gym: resolve(__dirname, "index.html"),
+        colexiu: resolve(__dirname, "colexiu.html"),
+        orchestra: resolve(__dirname, "orchestra.html"),
+        "report-share": resolve(__dirname, "report-share.html"),
+        instrument: resolve(__dirname, "instrument.html"),
+      },
+    },
+  },
+  server: {
+    cors: true,
+    port: 3000,
+    // https: true,
+    proxy: {
+      "^/gym/.*": {
+        target: "https://mstutest.dayaedu.com",
+        // target: "https://online.dayaedu.com",
+        changeOrigin: true,
+        rewrite: (path) => path.replace(/^\/gym/, ""),
+      },
+      "^/colexiu/.*": {
+        target: "https://dev.colexiu.com",
+        // target: "https://online.colexiu.com",
+        changeOrigin: true,
+        rewrite: (path) => path.replace(/^\/colexiu/, ""),
+      },
+      "^/orchestra/.*": {
+        target: "https://test.lexiaoya.cn",
+        changeOrigin: true,
+        rewrite: (path) => path.replace(/^\/orchestra/, ""),
+      },
+      "^/instrument/.*": {
+        // target: "https://kt.colexiu.com",
+        // target: "https://test.lexiaoya.cn",
+        // target: "https://dev.kt.colexiu.com",
+        // target: "https://test.resource.colexiu.com", // 内容平台开发环境,内容平台开发,需在url链接上加上isCbs=true
+        // target: "https://test.resource.colexiu.com",
+        target: "https://test.kt.colexiu.com",
+        changeOrigin: true,
+        rewrite: (path) => path.replace(/^\/instrument/, ""),
+      },
+    },
+  },
+  preview: {
+    port: 3000,
+    host: "192.168.3.114",
+  },
 });
 // vite.config.js