liushengqiang 2 年 前
コミット
8f5e847783
2 ファイル変更23 行追加11 行削除
  1. 11 1
      src/helpers/communication.ts
  2. 12 10
      src/page-instrument/view-detail/index.tsx

+ 11 - 1
src/helpers/communication.ts

@@ -248,4 +248,14 @@ export const api_toggleTune = (state: "start" | "stop" | "finishTune", count?: n
 export const api_createMusicPlayer = (content: any) => {
 	if (!storeData.isApp) return Promise.resolve({} as any);
 	return promisefiyPostMessage({ api: "createMusicPlayer", content });
-};
+};
+
+/** 进入页面设置常量 */
+export const api_keepScreenLongLight = () => {
+	postMessage({
+		api: "keepScreenLongLight",
+		content: {
+			isOpenLight: true,
+		},
+	});
+};

+ 12 - 10
src/page-instrument/view-detail/index.tsx

@@ -30,6 +30,7 @@ import HeaderTop from "../header-top";
 import styles from "./index.module.less";
 import {
 	api_cloudLoading,
+	api_keepScreenLongLight,
 	api_openCamera,
 	api_setEventTracking,
 	api_setStatusBarVisibility,
@@ -51,16 +52,16 @@ import TheMusicList from "../component/the-music-list";
 /** 需要处理频率的乐器
  * 120: 竖笛
  */
-const instrumentSubject = [120]
-const resetFrequency =(list: any[]) => {
-	if (!instrumentSubject.includes(state.subjectId)) return list
-	for(let i = 0; i < list.length; i++){
-		if (list[i].prevFrequency) list[i].prevFrequency = list[i].prevFrequency * 2
-		if (list[i].frequency) list[i].frequency = list[i].frequency * 2
-		if (list[i].nextFrequency) list[i].nextFrequency = list[i].nextFrequency * 2
+const instrumentSubject = [120];
+const resetFrequency = (list: any[]) => {
+	if (!instrumentSubject.includes(state.subjectId)) return list;
+	for (let i = 0; i < list.length; i++) {
+		if (list[i].prevFrequency) list[i].prevFrequency = list[i].prevFrequency * 2;
+		if (list[i].frequency) list[i].frequency = list[i].frequency * 2;
+		if (list[i].nextFrequency) list[i].nextFrequency = list[i].nextFrequency * 2;
 	}
-	return list
-}
+	return list;
+};
 
 export default defineComponent({
 	name: "music-list",
@@ -84,6 +85,7 @@ export default defineComponent({
 			}
 		};
 		onBeforeMount(() => {
+			api_keepScreenLongLight();
 			getAPPData();
 			api_setStatusBarVisibility();
 			const settting = store.get("musicscoresetting");
@@ -206,7 +208,7 @@ export default defineComponent({
 				handleSetSpeed(saveSpeed);
 			}
 			state.times = formateTimes(osmd);
-			state.times = resetFrequency(state.times)
+			state.times = resetFrequency(state.times);
 			console.log("🚀 ~ state.times:", state.times, state.subjectId);
 			try {
 				metronomeData.metro = new Metronome();