Browse Source

Merge remote-tracking branch 'origin/ktyq-classroom-work' into ktyq-online-1.8.7

TIANYONG 11 months ago
parent
commit
5d9b3067b2

+ 15 - 3
src/page-instrument/App.tsx

@@ -18,7 +18,7 @@ export default defineComponent({
     };
     };
     const setUser = async () => {
     const setUser = async () => {
       try {
       try {
-        const res = query.isCbs ? {code:200,data:{}} : await getUserInfo();
+        const res = query.isCbs ? { code: 200, data: {} } : await getUserInfo();
         if (res?.code === 5000) {
         if (res?.code === 5000) {
           const browserInfo = browser();
           const browserInfo = browser();
           showToast(res.message);
           showToast(res.message);
@@ -36,8 +36,8 @@ export default defineComponent({
               "*"
               "*"
             );
             );
             setTimeout(() => {
             setTimeout(() => {
-              window.location.href = `${location.origin}/classroom`
-            }, 500)
+              window.location.href = `${location.origin}/classroom`;
+            }, 500);
           }
           }
           return;
           return;
         }
         }
@@ -94,6 +94,18 @@ export default defineComponent({
       _loading && document.body.removeChild(_loading);
       _loading && document.body.removeChild(_loading);
       // console.log(query);
       // console.log(query);
       if (query.platform == "pc") document.body.addEventListener("keyup", (e: KeyboardEvent) => onKeyBoard(e));
       if (query.platform == "pc") document.body.addEventListener("keyup", (e: KeyboardEvent) => onKeyBoard(e));
+
+      // 禁用右键菜单
+      document.addEventListener("contextmenu", function (event) {
+        event.preventDefault();
+      });
+      // 禁用浏览器快捷键
+      document.addEventListener("keydown", function (event) {
+        // 屏蔽 F12 和 Ctrl+Shift+I
+        if (event.key === "F12" || (event.ctrlKey && event.shiftKey && event.key === "I") || (event.metaKey && event.altKey && event.key === "I")) {
+          event.preventDefault();
+        }
+      });
     });
     });
 
 
     onUnmounted(() => {
     onUnmounted(() => {

+ 81 - 96
src/page-instrument/component/mode-type-mode/index.tsx

@@ -12,102 +12,87 @@ import { usePageVisibility } from "@vant/use";
 import GuideIndex from "../../view-figner/guide/guide-index";
 import GuideIndex from "../../view-figner/guide/guide-index";
 import { getQuery } from "/src/utils/queryString";
 import { getQuery } from "/src/utils/queryString";
 export default defineComponent({
 export default defineComponent({
-	name: "modelWraper",
+  name: "modelWraper",
 
 
-	setup() {
-		const query = getQuery();
-		const data = reactive({
-			showPC: false,
-			showStudent: false,
-			showVip: false,
-			showTip: false,
-		});
-		const openGuid = () => {
-			// 加载后 判断 端口号 加载对应的引导
-			if (storeData.platformType !== "STUDENT" || storeData.user.clientType !== "STUDENT") {
-				// PC
-				data.showPC = true;
-			} else {
-				if (storeData.user.vipMember) {
-					// 学生端
-					data.showStudent = true;
-				} else {
-					// vip
-					data.showVip = true;
-				}
-			}
-		};
+  setup() {
+    const query = getQuery();
+    const data = reactive({
+      showPC: false,
+      showStudent: false,
+      showVip: false,
+      showTip: false,
+    });
+    const openGuid = () => {
+      // 加载后 判断 端口号 加载对应的引导
+      if (storeData.platformType !== "STUDENT" || storeData.user.clientType !== "STUDENT") {
+        // PC
+        data.showPC = true;
+      } else {
+        // 添加学校上设置【课件解锁】,判断逻辑
+        const schoolInfos = storeData.user.schoolInfos;
+        const schoolLock = schoolInfos && schoolInfos.length > 0 ? schoolInfos[0].needVipLock : true;
+        if (storeData.user.vipMember || !schoolLock) {
+          // 学生端
+          data.showStudent = true;
+        } else {
+          // vip
+          data.showVip = true;
+        }
+      }
+    };
 
 
-		const getUserInfo = async () => {
-			const res = await studentQueryUserInfo();
-			const student = res?.data || {};
-			storeData.user.vipMember = student.vipMember;
-			// console.log("🚀 ~ student:", student);
-			if (storeData.user.vipMember) {
-				data.showVip = false;
-				openGuid();
-			}
-		};
-		const pageVisible = usePageVisibility();
-		watch(
-			() => pageVisible.value,
-			(val) => {
-				if (val === "visible") {
-					if (storeData.user.vipMember) return;
-					console.log("页面显示");
-					getUserInfo();
-				}
-			}
-		);
-		watch(
-			() => headTopData.modeType,
-			(val) => {
-				if (val === "init") {
-					nextTick(() => {
-						nextTick(() => {
-							setTimeout(() => {
-								data.showTip = true;
-							}, 500);
-						});
-					});
-				}
-			}
-		);
-		onMounted(() => {
-			openGuid();
-		});
-		return () => (
-			<>
-				<div class={[styles.wrap, headTopData.modeType === "init" ? "" : styles.hidden]}>
-					<div id="modeType-box" class={styles.infoWrap}>
-						<img
-							id="modeType-0"
-							onClick={() => headTopData.handleChangeModeType("practise")}
-							src={icons.icon_1}
-						/>
-						<img
-							id="modeType-1"
-							style={{ cursor: state.isPercussion ? "not-allowed" : "pointer" }}
-							onClick={() => headTopData.handleChangeModeType("follow")}
-							src={state.isPercussion ? icons.icon_5 : icons.icon_2}
-						/>
-						<img
-							id="modeType-2"
-							style={{ cursor: state.enableEvaluation ? "pointer" : "not-allowed" }}
-							onClick={() => headTopData.handleChangeModeType("evaluating")}
-							src={state.enableEvaluation ? icons.icon_3 : icons.icon_4}
-						/>
-					</div>
-					{data.showPC && data.showTip && !query.isCbs ? <TeacherBootom></TeacherBootom> : null}
-					{data.showStudent && data.showTip && !query.isCbs ? <StudentBottom></StudentBottom> : null}
-					{data.showVip && <TheVip />}
-				</div>
-				{headTopData.modeType &&
-					headTopData.modeType !== "init" &&
-					state.modeType == "practise" &&
-					state.fingeringInfo?.name &&
-					state.setting.displayFingering && <GuideIndex list={["detail"]} />}
-			</>
-		);
-	},
+    const getUserInfo = async () => {
+      const res = await studentQueryUserInfo();
+      const student = res?.data || {};
+      storeData.user.vipMember = student.vipMember;
+      // console.log("🚀 ~ student:", student);
+      if (storeData.user.vipMember) {
+        data.showVip = false;
+        openGuid();
+      }
+    };
+    const pageVisible = usePageVisibility();
+    watch(
+      () => pageVisible.value,
+      (val) => {
+        if (val === "visible") {
+          if (storeData.user.vipMember) return;
+          console.log("页面显示");
+          getUserInfo();
+        }
+      }
+    );
+    watch(
+      () => headTopData.modeType,
+      (val) => {
+        if (val === "init") {
+          nextTick(() => {
+            nextTick(() => {
+              setTimeout(() => {
+                data.showTip = true;
+              }, 500);
+            });
+          });
+        }
+      }
+    );
+    onMounted(() => {
+      openGuid();
+    });
+    return () => (
+      <>
+        <div class={[styles.wrap, headTopData.modeType === "init" ? "" : styles.hidden]}>
+          <div id="modeType-box" class={styles.infoWrap}>
+            <img id="modeType-0" onClick={() => headTopData.handleChangeModeType("practise")} src={icons.icon_1} />
+            <img id="modeType-1" style={{ cursor: state.isPercussion ? "not-allowed" : "pointer" }} onClick={() => headTopData.handleChangeModeType("follow")} src={state.isPercussion ? icons.icon_5 : icons.icon_2} />
+            <img id="modeType-2" style={{ cursor: state.enableEvaluation ? "pointer" : "not-allowed" }} onClick={() => headTopData.handleChangeModeType("evaluating")} src={state.enableEvaluation ? icons.icon_3 : icons.icon_4} />
+          </div>
+          {data.showPC && data.showTip && !query.isCbs ? <TeacherBootom></TeacherBootom> : null}
+          {data.showStudent && data.showTip && !query.isCbs ? <StudentBottom></StudentBottom> : null}
+          {data.showVip && <TheVip />}
+        </div>
+        {headTopData.modeType && headTopData.modeType !== "init" && state.modeType == "practise" && state.fingeringInfo?.name && state.setting.displayFingering && <GuideIndex list={["detail"]} />}
+      </>
+    );
+  },
 });
 });

+ 2 - 2
src/page-instrument/custom-plugins/the-vip/index.module.less

@@ -26,10 +26,10 @@
 .content {
 .content {
     position: relative;
     position: relative;
     padding: 33px 13px 20px 13px;
     padding: 33px 13px 20px 13px;
-    font-size: 13px;
+    font-size: 14px;
     font-weight: 400;
     font-weight: 400;
     color: #333333;
     color: #333333;
-    line-height: 18px;
+    line-height: 22px;
     z-index: 10;
     z-index: 10;
 }
 }
 
 

+ 1 - 0
src/store.ts

@@ -20,6 +20,7 @@ type IUser = {
   /** 是否是VIP */
   /** 是否是VIP */
   vipMember?: boolean;
   vipMember?: boolean;
   phone?: string;
   phone?: string;
+  schoolInfos?: any[];
 };
 };
 type IStatus = "init" | "login" | "logout" | "error";
 type IStatus = "init" | "login" | "logout" | "error";
 type IPlatformType = "STUDENT" | "TEACHER" | "WEB" | "";
 type IPlatformType = "STUDENT" | "TEACHER" | "WEB" | "";