Переглянути джерело

管乐团,学生端云教练效验会员,后台曲谱小节选择

liushengqiang 2 роки тому
батько
коміт
e1bec5d1fb

+ 6 - 2
src/page-orchestra/api.ts

@@ -6,11 +6,11 @@ export const studentQueryUserInfo = async () => {
 };
 /** 获取老师信息 */
 export const teacherQueryUserInfo = () => {
-	return request.get(`/student/queryUserInfo`);
+	return request.get(`/user/getUserInfo`);
 };
 /** 后台用户信息 */
 export const employeeQueryUserInfo = () => {
-	return request.get(`/employee/queryUserInfo`);
+	return request.get(`/user/getUserInfo`);
 };
 
 /** 获取曲谱信息 */
@@ -22,3 +22,7 @@ export const sysMusicScoreAccompanimentQueryPage = (sysMusicScoreId: string) =>
 export const musicPracticeRecordSave = (data: any) => {
 	return request.post("/musicPracticeRecord/save", {requestType: 'json', data });
 };
+/** 记录训练时长 */
+export const studentMember = () => {
+	return request.get("/student/member");
+};

+ 34 - 0
src/page-orchestra/custom-plugins/after-class-training/index.tsx

@@ -0,0 +1,34 @@
+import { defineComponent, onMounted, watch } from "vue";
+import state from "/src/state";
+
+export default defineComponent({
+	name: "afterClassTraining",
+	setup() {
+		const postSelectMessage = (list: any[], change = false) => {
+			window.parent.postMessage(
+				{
+					api: "admin-selectMusicMeasure",
+					start: list[0]?.MeasureNumberXML,
+					end: list[list.length - 1]?.MeasureNumberXML,
+					speed: state.speed,
+					change,
+				},
+				"*"
+			);
+		};
+		onMounted(() => {
+			if (state.times.length) {
+				postSelectMessage(state.times);
+			}
+		});
+		watch(
+			() => state.section.length,
+			() => {
+				if (state.section.length === 2) {
+					postSelectMessage(state.section, true);
+				}
+			}
+		);
+		return () => "";
+	},
+});

+ 59 - 0
src/page-orchestra/custom-plugins/check-student-vip/index.tsx

@@ -0,0 +1,59 @@
+import { defineComponent, onMounted } from "vue";
+import { api_back, api_openWebView } from "/src/helpers/communication";
+import { storeData } from "/src/store";
+import { studentMember } from "../../api";
+import { showDialog } from "vant";
+
+export default defineComponent({
+	name: "check-student-vip",
+	setup() {
+		/** 去会员中心 */
+		const gotoMemberCenter = () => {
+			const url = import.meta.env.DEV ? `https://test.lexiaoya.cn/orchestra-student/#/memberCenter` : `${location.origin}/orchestra-student/#/memberCenter`;
+			// console.log("🚀 ~ url:", url)
+			api_back();
+			api_openWebView({
+				url: url,
+				orientation: 1,
+			});
+		};
+		/** 检测学生是否会员 */
+		const checkStudentIsVip = async () => {
+			// 学生端验证
+			if (storeData.platformType === "STUDENT") {
+				let student: any = "";
+				try {
+					const res: any = await studentMember();
+					student = res?.data;
+				} catch (error) {}
+				if (!student) return;
+				//学生有待激活会员
+				if (!student.membershipDays && student.purchaseMemberRecord) {
+					showDialog({
+						title: "温馨提示",
+						message: "您的团练宝暂未激活,请激活后使用",
+						className: "noVip",
+					}).then(() => {
+						gotoMemberCenter();
+					});
+					return;
+				}
+				//学生没有会员
+				if (!student.vipMember) {
+					showDialog({
+						title: "温馨提示",
+						message: "您暂未开通团练宝,请开通后使用",
+						className: "noVip",
+					}).then(() => {
+						gotoMemberCenter();
+					});
+					return;
+				}
+			}
+		};
+		onMounted(() => {
+			checkStudentIsVip();
+		});
+		return () => <div></div>;
+	},
+});

+ 14 - 6
src/page-orchestra/detail/index.tsx

@@ -1,6 +1,5 @@
 import { Skeleton } from "vant";
 import { computed, defineComponent, nextTick, onBeforeMount, onBeforeUnmount, onMounted, reactive, Transition, watch, watchEffect } from "vue";
-import { useRoute } from "vue-router";
 import { formateTimes } from "../../helpers/formateMusic";
 import Metronome, { metronomeData } from "../../helpers/metronome";
 import state, { isRhythmicExercises, musicscoresettingKey } from "../../state";
@@ -12,7 +11,7 @@ import { sysMusicScoreAccompanimentQueryPage } from "../api";
 import EvaluatModel from "../evaluat-model";
 import HeaderTop from "../header-top";
 import styles from "./index.module.less";
-import { api_cloudLoading, api_openCamera, api_setStatusBarVisibility, isSpecialShapedScreen } from "/src/helpers/communication";
+import {  api_cloudLoading, api_openCamera, api_setStatusBarVisibility, isSpecialShapedScreen } from "/src/helpers/communication";
 import { getQuery } from "/src/utils/queryString";
 import Evaluating, { evaluatingData } from "/src/view/evaluating";
 import MeasureSpeed from "/src/view/plugins/measure-speed";
@@ -24,6 +23,8 @@ import FollowPractice from "/src/view/follow-practice";
 import FollowModel from "../follow-model";
 import RecordingTime from "../custom-plugins/recording-time";
 import UnitTest from "../custom-plugins/unitTest";
+import CheckStudentVip from "../custom-plugins/check-student-vip";
+import AfterClassTraining from "../custom-plugins/after-class-training";
 
 export default defineComponent({
 	name: "music-list",
@@ -105,7 +106,7 @@ export default defineComponent({
 
 			// 映射声部ID
 			state.subjectId = mappingVoicePart(state.subjectId as any, "ORCHESTRA");
-			console.log("🚀 ~ state.subjectId:", state.subjectId);
+			// console.log("🚀 ~ state.subjectId:", state.subjectId);
 			// 是否打击乐
 			state.isPercussion = state.subjectId == 23 || state.subjectId == 113 || state.subjectId == 121 || isRhythmicExercises();
 
@@ -120,6 +121,8 @@ export default defineComponent({
 			}
 		};
 
+		
+
 		onMounted(() => {
 			(window as any).appName = "colexiu";
 			Promise.all([sysMusicScoreAccompanimentQueryPage(query.id)]).then((values) => {
@@ -260,15 +263,20 @@ export default defineComponent({
 					</div>
 				)}
 
-				{/* 公用的插件 */}
+				{/* 插件 */}
 				<div class="plugins-box">
 					{state.musicRendered && (
 						<>
+							{/* 设置选段小节速度 */}
 							<MeasureSpeed />
 							{/* 统计训练时长 */}
-							{storeData.platformType === 'STUDENT' && <RecordingTime />}
+							{storeData.platformType === "STUDENT" && <RecordingTime />}
 							{/* 单元测验 和 课后训练 */}
-							{storeData.platformType === 'STUDENT' && <UnitTest />}
+							{storeData.platformType === "STUDENT" && <UnitTest />}
+							{/* 学生端检测是否是会员 */}
+							{storeData.platformType === "STUDENT" && <CheckStudentVip />}
+							{/* 后台课后训练小节选择 */}
+							{storeData.platformType === "WEB" && <AfterClassTraining />}
 						</>
 					)}
 				</div>

+ 9 - 1
src/page-orchestra/header-top/index.tsx

@@ -1,4 +1,4 @@
-import { computed, defineComponent, onMounted, reactive, ref } from "vue";
+import { computed, defineComponent, onBeforeUnmount, onMounted, reactive, ref } from "vue";
 import styles from "./index.module.less";
 
 import Title from "./title";
@@ -33,6 +33,7 @@ export default defineComponent({
 	setup() {
 		const headerData = reactive({
 			settingMode: false,
+			fingeringDisplay: state.setting.displayFingering
 		});
 		const headRef = ref();
 
@@ -76,6 +77,13 @@ export default defineComponent({
 			api_back();
 		};
 
+		onMounted(() => {
+			state.setting.displayFingering = false
+		})
+		onBeforeUnmount(() => {
+			state.setting.displayFingering = headerData.fingeringDisplay
+		})
+
 		return () => (
 			<div ref={headRef} class={styles.headerTop}>
 				<div class={styles.back} onClick={handleBack}>

+ 2 - 2
src/page-orchestra/main.ts

@@ -14,8 +14,8 @@ import "./theme.css";
 	const u = navigator.userAgent;
 	setStoreData({
 		isApp: u.includes("ORCHESTRAAPPI") || u.includes("ORCHESTRAAPPA"),
-		platformApi: u.includes("ORCHESTRATEACHER") ? "/api-teacher" : "/api-student",// u.includes("ORCHESTRASTUDENT") ? "/api-student" : "/api-backend",
-		platformType: u.includes("ORCHESTRATEACHER") ? "TEACHER" : "STUDENT",
+		platformApi: u.includes("ORCHESTRATEACHER") ? "/api-teacher" : u.includes("ORCHESTRASTUDENT") ? "/api-student" : "/api-backend",
+		platformType: u.includes("ORCHESTRATEACHER") ? "TEACHER" : u.includes("ORCHESTRASTUDENT") ? "STUDENT" : "WEB",
 		proxy: import.meta.env.DEV ? "/orchestra" : ""
 	});
 })();

+ 3 - 1
src/view/evaluating/index.tsx

@@ -1,6 +1,6 @@
 import { Snackbar } from "@varlet/ui";
 import { closeToast, showLoadingToast } from "vant";
-import { defineComponent, onBeforeMount, onBeforeUnmount, onMounted, reactive, ref } from "vue";
+import { defineComponent, onBeforeMount, onBeforeUnmount, onMounted, reactive, ref, watch } from "vue";
 import { getLeveByScore, getLeveByScoreMeasure, IEvaluatings } from "./evaluatResult";
 import {
 	cancelEvaluating,
@@ -205,6 +205,8 @@ export const handleStartBegin = async () => {
  * @param isEnd 是否是自动播放停止, 默认: false
  */
 export const handleEndBegin = (isEnd = false) => {
+	// 没有开始评测,不评分
+	if (!evaluatingData.startBegin) return
 	evaluatingData.startBegin = false;
 	endEvaluating({
 		musicScoreId: state.examSongId,