Browse Source

fix:增加来源

liushengqiang 2 years ago
parent
commit
e74016aa80

+ 2 - 2
src/page-instrument/header-top/index.tsx

@@ -8,7 +8,7 @@ import { Badge, Circle, Popover, Popup, showConfirmDialog } from "vant";
 import Speed from "./speed";
 import { evaluatingData, handleStartEvaluat } from "/src/view/evaluating";
 import Settting from "./settting";
-import state, { handleChangeSection, handleResetPlay, handleRessetState, togglePlay } from "/src/state";
+import state, { IPlatform, handleChangeSection, handleResetPlay, handleRessetState, togglePlay } from "/src/state";
 import { getAudioCurrentTime } from "/src/view/audio-list";
 import { followData, toggleFollow } from "/src/view/follow-practice";
 import { api_back } from "/src/helpers/communication";
@@ -28,7 +28,7 @@ export const headTopData = reactive({
 	handleChangeModeType(value: "practise" | "follow" | "evaluating") {
 		if (value === "evaluating") {
 			console.log(state.platform)
-			if (state.platform?.toLocaleUpperCase() === "PC"){
+			if (state.platform === IPlatform.PC){
 				showConfirmDialog({
 					title: '温馨提示',
 					message: '该功能暂未开发,敬请期待',

+ 3 - 3
src/page-instrument/view-detail/index.tsx

@@ -13,7 +13,7 @@ import {
 } from "vue";
 import { formateTimes } from "../../helpers/formateMusic";
 import Metronome, { metronomeData } from "../../helpers/metronome";
-import state, { IAudioState, isRhythmicExercises } from "/src/state";
+import state, { IAudioState, IPlatform, isRhythmicExercises } from "/src/state";
 import { setGlobalData } from "../../utils";
 import AudioList from "../../view/audio-list";
 import MusicScore, { resetMusicScore } from "../../view/music-score";
@@ -140,10 +140,10 @@ export default defineComponent({
 			}
 
 			// 如果是PC端,放大曲谱
-			if (query.platform === "pc") {
+			state.platform = query.platform?.toLocaleUpperCase() || "";
+			if (state.platform === IPlatform.PC) {
 				state.zoom = 1.5;
 			}
-			state.platform = query.platform
 		};
 
 		const setCustom = () => {

+ 6 - 1
src/state.ts

@@ -19,10 +19,15 @@ export type IPlayState = "music" | "background"
 /** 播放状态 */
 export type IAudioState = "play" | "paused"
 
+/** 来源 */
+export enum IPlatform {
+	APP = "APP",
+	PC = "PC"
+}
 
 const state = reactive({
 	/** 来源 : PC , app */
-	platform: '' as 'APP' | "PC",
+	platform: '' as IPlatform,
 	appName: "" as "GYM" | "COLEXIU",
 	musicRenderType: "staff" as IMusicRenderType,
 	/**曲谱是否渲染完成 */