Browse Source

指法横竖屏

liushengqiang 2 years ago
parent
commit
9e0b8c5d79
1 changed files with 12 additions and 2 deletions
  1. 12 2
      src/page-instrument/view-figner/index.tsx

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

@@ -21,7 +21,7 @@ import {
 } from "/src/view/fingering/fingering-config";
 import { Howl } from "howler";
 import { storeData } from "/src/store";
-import { api_back } from "/src/helpers/communication";
+import { api_back, api_setRequestedOrientation } from "/src/helpers/communication";
 import Hammer from "hammerjs";
 import { Button, Icon, Loading, Popup, Space } from "vant";
 import GuideIndex from "./guide/guide-index";
@@ -52,7 +52,7 @@ export default defineComponent({
 		const subject = props.isComponent ? props.subject || "pan-flute" : code || "pan-flute";
 		const data = reactive({
 			loading: true,
-			subject: subject,
+			subject: subject as any,
 			realKey: 0,
 			notes: [] as IFIGNER_INSTRUMENT_Note[],
 			tones: [] as IFIGNER_INSTRUMENT_Note[],
@@ -84,6 +84,12 @@ export default defineComponent({
 			subject: null as unknown as ITypeFingering,
 			fingeringInfo: subjectFingering(data.subject),
 		});
+		if (!props.isComponent){
+			console.log(fingerData.fingeringInfo.orientation)
+			if (fingerData.fingeringInfo.orientation === 0){
+				api_setRequestedOrientation(fingerData.fingeringInfo.orientation);
+			}
+		}
 		const getNotes = () => {
 			const fignerData = FIGNER_INSTRUMENT_DATA[data.subject as keyof typeof FIGNER_INSTRUMENT_DATA];
 			if (fignerData) {
@@ -171,6 +177,10 @@ export default defineComponent({
 				console.log("关闭");
 				emit("close");
 				return;
+			} else {
+				if (fingerData.fingeringInfo.orientation === 0){
+					api_setRequestedOrientation(1);
+				}
 			}
 			// 不在APP中,
 			if (!storeData.isApp) {