Ver Fonte

重新登录

liushengqiang há 1 ano atrás
pai
commit
1828039a67
1 ficheiros alterados com 36 adições e 4 exclusões
  1. 36 4
      src/pc/home/index.tsx

+ 36 - 4
src/pc/home/index.tsx

@@ -1402,9 +1402,13 @@ export default defineComponent({
 		/** 移调 */
 		const handleMoveKey = async (item: (typeof ABC_DATA.key)[0]) => {
 			console.log(item);
-			console.log(abcData.abc.visualKey || abcData.abc.key, "=>", item.value)
-			const moveData = getKeyStep(item.value, abcData.abc.visualKey || abcData.abc.key, data.moveKeyType);
-			console.log("🚀 ~ item:",  moveData);
+			console.log(abcData.abc.visualKey || abcData.abc.key, "=>", item.value);
+			const moveData = getKeyStep(
+				item.value,
+				abcData.abc.visualKey || abcData.abc.key,
+				data.moveKeyType
+			);
+			console.log("🚀 ~ item:", moveData);
 			(window as any).visual_Key = item.value.split(":")[1];
 			abcData.abc.visualTranspose = moveData.step;
 			abcData.abc.visualKey = item.value;
@@ -1521,6 +1525,13 @@ export default defineComponent({
 				}
 			}
 			data.loading = false;
+			// 重新登录
+			if (res.code === 5000) {
+				window.location.href = `${
+					/(192|localhost)/.test(location.origin) ? "https://test.lexiaoya.cn" : location.origin
+				}/classroom`;
+				return;
+			}
 			return res;
 		};
 		const setSaveLoading = (tips: boolean) => {
@@ -1540,7 +1551,7 @@ export default defineComponent({
 			console.log("🚀 ~ pngUrl:", pngUrl);
 			try {
 				if (query.id) {
-					await api_musicSheetCreationUpdate({
+					const res = await api_musicSheetCreationUpdate({
 						name: data.musicName || "未命名乐谱",
 						creator: data.creator || "未命名乐谱",
 						creationConfig: renderMeasures(abcData.abc, {
@@ -1554,6 +1565,13 @@ export default defineComponent({
 						filePath: wavUrl,
 						coverImg: pngUrl,
 					});
+					// 重新登录
+					if (res.code === 5000) {
+						window.location.href = `${
+							/(192|localhost)/.test(location.origin) ? "https://test.lexiaoya.cn" : location.origin
+						}/classroom`;
+						return;
+					}
 				} else {
 					const res = await api_musicSheetCreationSave({
 						name: data.musicName || "未命名乐谱",
@@ -1579,6 +1597,13 @@ export default defineComponent({
 						}
 						location.hash = hash[0] + "?" + qs.stringify(qs_data);
 					}
+					// 重新登录
+					if (res.code === 5000) {
+						window.location.href = `${
+							/(192|localhost)/.test(location.origin) ? "https://test.lexiaoya.cn" : location.origin
+						}/classroom`;
+						return;
+					}
 				}
 			} catch (error) {
 				console.log(error);
@@ -1939,6 +1964,13 @@ export default defineComponent({
 					message.info("已是最新版本");
 				}
 			}
+			// 重新登录
+			if (res.code === 5000) {
+				window.location.href = `${
+					/(192|localhost)/.test(location.origin) ? "https://test.lexiaoya.cn" : location.origin
+				}/classroom`;
+				return;
+			}
 		};
 
 		return () => (