Procházet zdrojové kódy

Merge branch 'new-feature-tianyong' into ktyq-online

TIANYONG před 1 rokem
rodič
revize
36cb0be92f

+ 1 - 0
src/helpers/formateMusic.ts

@@ -970,6 +970,7 @@ export const formateTimes = (osmd: OpenSheetMusicDisplay) => {
 
 			// console.log(note.tie)
 			// console.log(relaEndtime, fixtime, '时间',measureLength)
+			console.log('频率',note?.pitch?.frequency,i)
 			const nodeDetail = {
 				isStaccato: note.voiceEntry.isStaccato(),
 				isRestFlag: note.isRestFlag,

+ 8 - 1
src/page-instrument/custom-plugins/helper-model/screen-model/index.tsx

@@ -7,7 +7,14 @@ export default defineComponent({
 	name: "screenModel",
 	emits: ["close"],
 	setup(props, { emit }) {
-		const origin = /(localhost|192)/.test(location.host) ? "https://test.lexiaoya.cn" : location.origin;
+		const apiUrls = {
+			'dev': 'https://dev.kt.colexiu.com',
+			'test': 'https://test.lexiaoya.cn',
+			'online': 'https://kt.colexiu.com',
+		}
+		let environment: 'dev' | 'test' | 'test2' | 'online' = location.origin.includes('//dev') ? 'dev' : location.origin.includes('//test') ? 'test' : (location.origin.includes('//online') || location.origin.includes('//kt') || location.origin.includes('//mec')) ? 'online' : 'dev'
+		const origin = /(localhost|192)/.test(location.host) ? "https://test.lexiaoya.cn" : apiUrls[environment];
+		
 		return () => (
 			<>
 				<img class={styles.closeBtn} src={iconBack} onClick={() => emit("close")} />

+ 6 - 1
src/page-instrument/evaluat-model/evaluat-result/index.tsx

@@ -16,6 +16,7 @@ import { getQuery } from "/src/utils/queryString";
 import { browser, getBehaviorId } from "/src/utils";
 import { api_musicPracticeRecordSave } from "../../api";
 import { getAudioDuration } from "/src/view/audio-list";
+import { debounce } from "/src/utils"
 
 export default defineComponent({
 	name: "evaluatResult",
@@ -56,6 +57,10 @@ export default defineComponent({
 			data.saveLoading = false;
 		};
 
+		const saveResult = () => {
+			emit("close", "update")
+		}
+
 		onMounted(() => {
 			if (!evaluatingData.isErrorState) {
 				handleAddRecord();
@@ -81,7 +86,7 @@ export default defineComponent({
 				{
 				!state.isHideEvaluatReportSaveBtn &&
 				<div class={styles.headerButton}>
-					<div class={[styles.headBtn, evaluatingData.resultData.recordId ? '' : styles.disabled]} onClick={() => emit("close", "update")}>
+					<div class={[styles.headBtn, evaluatingData.resultData.recordId ? '' : styles.disabled]} onClick={debounce(saveResult,300)}>
 						保存演奏
 					</div>
 				</div>

+ 2 - 2
src/page-instrument/evaluat-model/index.tsx

@@ -221,7 +221,7 @@ export default defineComponent({
     };
     /** 连接websocket */
     const handleConnect = async () => {
-      const behaviorId = localStorage.getItem("behaviorId") || undefined;
+      const behaviorId = localStorage.getItem("behaviorId") || localStorage.getItem("BEHAVIORID") || undefined;
       const rate = state.speed / state.originSpeed;
       calculateInfo = formatTimes()
       const content = {
@@ -235,7 +235,7 @@ export default defineComponent({
         platform: browserInfo.ios ? "IOS" : browserInfo.android ? "ANDROID" : "WEB",
         clientId: storeData.platformType === "STUDENT" ? "student" : storeData.platformType === "TEACHER" ? "teacher" : "education",
         hertz: state.setting.frequency,
-        reactionTimeMs: state.setting.reactionTimeMs,
+        reactionTimeMs: state.setting.reactionTimeMs ? Number(state.setting.reactionTimeMs) : 0,
         speed: state.speed,
         heardLevel: state.setting.evaluationDifficulty,
         // beatLength: Math.round((state.fixtime * 1000) / rate),

+ 1 - 0
src/page-instrument/view-detail/index.tsx

@@ -36,6 +36,7 @@ import { usePageVisibility } from "@vant/use";
 export const classids = [1, 2, 6, 7, 8, 9, 3, 10, 11, 12, 13, 4, 14, 15, 16, 17, 30, 31, 35, 36, 46, 108]; // 大雅金唐, 竖笛教程, 声部训练展开的分类ID
 
 const calcCeilFrequency = (frequency: number) => {
+  if (frequency < 0) return frequency;
   if (frequency) return (frequency * 1000 * 2) / 1000;
   return 0;
 };

+ 1 - 1
src/state.ts

@@ -1056,7 +1056,7 @@ const setState = (data: any, index: number) => {
   }
   let musicalRenderType = ''
   if (pitchTrack?.defaultScore) {
-    musicalRenderType = pitchTrack?.defaultScore === 'STAVE' ? 'staff' : pitchTrack?.defaultScore === 'JIAN' ? 'firstTone' : pitchTrack?.defaultScore === 'FIRST' ? 'fixedTone' : ''
+    musicalRenderType = pitchTrack?.defaultScore === 'STAVE' ? 'staff' : pitchTrack?.defaultScore === 'JIAN' ? 'fixedTone' : pitchTrack?.defaultScore === 'FIRST' ? 'firstTone' : ''
   }
   state.musicRenderType = query.musicRenderType || musicalRenderType || EnumMusicRenderType.firstTone;
   state.enableNotation = pitchTrack ? data.isConvertibleScore && pitchTrack.transferFlag : data.isConvertibleScore

+ 11 - 1
src/utils/index.ts

@@ -132,7 +132,7 @@ export const matchProductApiUrl = () => {
 			// 'online': 'https://resource.colexiu.com'
 		}
 	}
-	let environment: 'dev' | 'test' | 'test2' | 'online' = location.origin.includes('//dev') ? 'dev' : location.origin.includes('//test') ? 'test' : (location.origin.includes('//online') || location.origin.includes('//mec')) ? 'online' : 'dev'
+	let environment: 'dev' | 'test' | 'test2' | 'online' = location.origin.includes('//dev') ? 'dev' : location.origin.includes('//test') ? 'test' : (location.origin.includes('//online') || location.origin.includes('//kt') || location.origin.includes('//mec')) ? 'online' : 'dev'
 	if (query.isCbs) {
 		return apiUrls.cbs[environment] + '/cbs-app'
 	} else {
@@ -143,4 +143,14 @@ export const matchProductApiUrl = () => {
 		}
 		return apiUrls[pathName][environment] + '/edu-app'
 	}
+}
+
+/** debounce */
+export const debounce = (fn: Function, ms = 0) => {
+	let timeoutId: number | undefined;
+	return function(...args: any[]) {
+	  clearTimeout(timeoutId)
+	  // @ts-ignore
+	  timeoutId = setTimeout(() => fn.apply(this, args), ms);
+	}
 }