Lashtw commited on
Commit
c7f8731
·
verified ·
1 Parent(s): 9be9caa

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +17 -5
index.html CHANGED
@@ -279,13 +279,13 @@
279
  },
280
  {
281
  id: 103, q: "6y^2 - 2y",
282
- a: ["2y(3y-1)", "(3y-1)2y", "2y(-1+3y)", "(-1+3y)2y", "-2y(1-3y)", "(1-3y)(-2y)", "y(6y-2)", "(6y-2)y"],
283
- h: "係數 6 和 2 都有公因數 2 或者 簡單提出公因式 y"
284
  },
285
  {
286
  id: 104, q: "4x^2 - 8x",
287
  a: ["4x(x-2)", "x(4x-8)", "4(x^2-2x)", "2x(2x-4)", "2(2x^2-4x)", "4x(-2+x)", "(-2+x)4x", "(4x-8)x", "(x-2)4x", "-4x(2-x)"],
288
- h: "提出 4x 或者 簡單提出公因式 x"
289
  },
290
  {
291
  id: 105, q: "ax + bx",
@@ -854,8 +854,8 @@
854
  </div>
855
  </div>
856
  </div>
857
- );
858
- };
859
 
860
  // Teacher Login Modal
861
  const TeacherLoginModal = ({ onClose, onLogin }) => {
@@ -1086,6 +1086,18 @@
1086
  }
1087
  }, []);
1088
 
 
 
 
 
 
 
 
 
 
 
 
 
1089
  // Save Data
1090
  useEffect(() => {
1091
  localStorage.setItem('factoring_game_data_v5', JSON.stringify(userData));
 
279
  },
280
  {
281
  id: 103, q: "6y^2 - 2y",
282
+ a: ["2y(3y-1)", "(3y-1)2y", "2y(-1+3y)", "(-1+3y)2y", "-2y(1-3y)", "(1-3y)(-2y)"],
283
+ h: "係數 6 和 2 都有公因數 2"
284
  },
285
  {
286
  id: 104, q: "4x^2 - 8x",
287
  a: ["4x(x-2)", "x(4x-8)", "4(x^2-2x)", "2x(2x-4)", "2(2x^2-4x)", "4x(-2+x)", "(-2+x)4x", "(4x-8)x", "(x-2)4x", "-4x(2-x)"],
288
+ h: "提出 4x"
289
  },
290
  {
291
  id: 105, q: "ax + bx",
 
854
  </div>
855
  </div>
856
  </div>
857
+ );
858
+ };
859
 
860
  // Teacher Login Modal
861
  const TeacherLoginModal = ({ onClose, onLogin }) => {
 
1086
  }
1087
  }, []);
1088
 
1089
+ // ★★★ 新增:檢查網址是否帶有新的房間代碼 (解決共用載具問題) ★★★
1090
+ useEffect(() => {
1091
+ const params = new URLSearchParams(window.location.search);
1092
+ const roomParam = params.get('room');
1093
+
1094
+ // 如果網址有房間代碼,且跟目前儲存的不一樣,就更新它
1095
+ if (roomParam && roomParam !== userData.roomId) {
1096
+ setUserData(prev => ({ ...prev, roomId: roomParam }));
1097
+ showNotification(`已加入房間:${roomParam}`, "success");
1098
+ }
1099
+ }, []);
1100
+
1101
  // Save Data
1102
  useEffect(() => {
1103
  localStorage.setItem('factoring_game_data_v5', JSON.stringify(userData));