liushengqiang 2 rokov pred
rodič
commit
b0ac991c19

+ 1 - 2
src/page-orchestra/evaluat-model/index.tsx

@@ -37,7 +37,6 @@ export default defineComponent({
 		const evaluatModel = reactive({
 			tips: true,
 			evaluatUpdateAudio: false,
-			isSaveVideo: state.setting.camera && state.setting.saveToAlbum,
 			shareMode: false,
 		});
 		const browserInfo = browser();
@@ -190,7 +189,7 @@ export default defineComponent({
 				return;
 			}
 			let res = null;
-			if (evaluatModel.isSaveVideo) {
+			if (state.setting.camera && state.setting.saveToAlbum) {
 				res = await api_videoUpdate();
 			}
 			api_proxyServiceMessage({

+ 5 - 4
src/page-orchestra/header-top/index.tsx

@@ -1,6 +1,6 @@
 import { computed, defineComponent, onBeforeUnmount, onMounted, reactive, ref, watch } from "vue";
 import styles from "./index.module.less";
-import store from 'store'
+import store from "store";
 
 import Title from "./title";
 import icons from "./image/headerTop.json";
@@ -33,7 +33,6 @@ export const handleCloseModeMode = (type = false) => {
 export default defineComponent({
 	name: "header-top",
 	setup() {
-
 		/** 切换模式 */
 		const handleChangeModeType = (value: "practise" | "follow" | "evaluating") => {
 			if (value === "evaluating") {
@@ -166,9 +165,11 @@ export default defineComponent({
 			if (headData.modeMode) return { display: false, disabled: false };
 			// 评测模式 不显示,跟练模式 不显示
 			if (["evaluating", "follow"].includes(state.modeType)) return { display: false, disabled: true };
-			// 播放进度为0 不显示, 不是暂停状态不显示
+			// 播放状态 不显示
+			if (state.playState === "play") return { display: false, disabled: true };
+			// 播放进度为0 不显示
 			const currentTime = getAudioCurrentTime();
-			if (currentTime === 0 || state.playState !== "paused") return { display: false, disabled: true };
+			if (currentTime === 0) return { display: false, disabled: true };
 
 			return {
 				display: true,

+ 2 - 0
src/state.ts

@@ -371,6 +371,8 @@ export const getNote = (currentTime: number) => {
 /** 重播 */
 export const handleResetPlay = () => {
 	resetPlaybackToStart();
+	// 如果是暂停, 直接播放
+	togglePlay('play')
 };
 /** 设置速度 */
 export const handleSetSpeed = (speed: number) => {

+ 49 - 29
src/view/evaluating/index.tsx

@@ -69,31 +69,31 @@ export const handleStartEvaluat = () => {
 };
 
 const check_currentTime = () => {
-	let preTime = 0
+	let preTime = 0;
 	// 选段评测模式
 	if (state.isSelectMeasureMode) {
 		preTime = state.section[0].time * 1000;
 	}
-	const currentTime = getAudioCurrentTime() * 1000 - preTime
-	
-	if (currentTime >= 500){
-		sendEvaluatingOffsetTime(500)
-		return
+	const currentTime = getAudioCurrentTime() * 1000 - preTime;
+
+	if (currentTime >= 500) {
+		sendEvaluatingOffsetTime(500);
+		return;
 	}
 	setTimeout(() => {
-		check_currentTime()
-	}, 10)
-}
+		check_currentTime();
+	}, 10);
+};
 
 /** 开始播放发送延迟时间 */
 export const sendEvaluatingOffsetTime = async (currentTime: number) => {
-	console.log("🚀 ~ currentTime:", currentTime)
+	console.log("🚀 ~ currentTime:", currentTime);
 	// 没有开始时间点, 不处理
 	if (!evaluatingData.backtime) return;
 	const nowTime = Date.now();
-	const delayTime = nowTime - evaluatingData.backtime - currentTime
-	evaluatingData.backtime = 0
-	console.log("真正播放延迟", delayTime, 'currentTime:', currentTime);
+	const delayTime = nowTime - evaluatingData.backtime - currentTime;
+	evaluatingData.backtime = 0;
+	console.log("真正播放延迟", delayTime, "currentTime:", currentTime);
 	await api_proxyServiceMessage({
 		header: {
 			commond: "audioPlayStart",
@@ -224,9 +224,9 @@ export const handleStartBegin = async () => {
 
 /** 播放音乐 */
 const playMusic = async () => {
-	console.time('真正播放开始的延迟')
+	console.time("真正播放开始的延迟");
 	const playState = await togglePlay("play");
-	console.timeEnd('真正播放开始的延迟')
+	console.timeEnd("真正播放开始的延迟");
 	// 取消播放,停止播放
 	if (!playState) {
 		evaluatingData.startBegin = false;
@@ -234,23 +234,23 @@ const playMusic = async () => {
 		return;
 	}
 	// 检测播放进度, 计算延迟
-	check_currentTime()
+	check_currentTime();
 	// 如果开启了摄像头, 开启录制视频
-	if (state.setting.camera && state.setting.saveToAlbum){
-		console.log('开始录制视频')
-		api_startCapture()
+	if (state.setting.camera && state.setting.saveToAlbum) {
+		console.log("开始录制视频");
+		api_startCapture();
 	}
-}
+};
 
 /** 录音开始,记录开始时间点 */
 const recordStartTimePoint = async (res?: IPostMessage) => {
 	// 没有开始评测,不处理
-	if (!evaluatingData.startBegin) return
+	if (!evaluatingData.startBegin) return;
 	let inteveral = res?.content?.inteveral || 0;
 	if (browserInfo.ios) {
 		inteveral *= 1000;
 	}
-	console.log("🚀 ~ 开始时间点:", inteveral, '已经录的时间:', Date.now() - inteveral)
+	console.log("🚀 ~ 开始时间点:", inteveral, "已经录的时间:", Date.now() - inteveral);
 	evaluatingData.backtime = inteveral || Date.now();
 	// 开始播放
 	playMusic();
@@ -278,9 +278,9 @@ export const handleEndEvaluat = (isComplete = false) => {
 	});
 	evaluatingData.isComplete = isComplete;
 	// 如果开启了摄像头, 结束录制视频
-	if (state.setting.camera && state.setting.saveToAlbum){
-		console.log('结束录制视频')
-		api_endCapture()
+	if (state.setting.camera && state.setting.saveToAlbum) {
+		console.log("结束录制视频");
+		api_endCapture();
 	}
 };
 
@@ -338,14 +338,31 @@ export const handleViewReport = (key: "recordId" | "recordIdStr", type: "gym" |
 	});
 	setTimeout(() => {
 		evaluatingData.resulstMode = false;
-	}, 1000)
+	}, 1000);
 };
 
-
 export default defineComponent({
 	name: "evaluating",
 	setup() {
 		const pageVisibility = usePageVisibility();
+		// 需要记录的数据
+		const record_old_data = reactive({
+			/** 指法 */
+			finger: false,
+		});
+		/** 记录状态 */
+		const hanlde_record = () => {
+			// 取消指法
+			record_old_data.finger = state.setting.displayFingering;
+			state.setting.displayFingering = false;
+			// 切换为伴奏
+			// if (state.)
+		};
+		/** 还原状态 */
+		const handle_reduction = () => {
+			// 还原指法
+			state.setting.displayFingering = record_old_data.finger;
+		};
 
 		watch(pageVisibility, (value) => {
 			if (value == "hidden" && evaluatingData.startBegin) {
@@ -353,6 +370,7 @@ export default defineComponent({
 			}
 		});
 		onMounted(() => {
+			hanlde_record();
 			evaluatingData.resultData = {};
 			// evaluatingData.resultData = {...getLeveByScore(90), score: 30, intonation: 10, cadence: 30, integrity: 40}
 			// console.log("🚀 ~ evaluatingData.resultData:", evaluatingData.resultData)
@@ -362,15 +380,17 @@ export default defineComponent({
 			evaluatingData.rendered = true;
 			sendResult(handleScoreResult);
 			api_recordStartTime(recordStartTimePoint);
+			// 不是选段模式评测, 就清空已选段
 			if (!state.isSelectMeasureMode) {
 				clearSelection();
 			}
-			console.log('加载评测模块成功')
+			console.log("加载评测模块成功");
 		});
 		onUnmounted(() => {
 			removeResult(handleScoreResult);
 			api_remove_recordStartTime(recordStartTimePoint);
-			console.log('卸载评测模块成功')
+			handle_reduction();
+			console.log("卸载评测模块成功");
 		});
 		return () => <div></div>;
 	},