|
@@ -144,17 +144,16 @@ async function chooseCampus() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const labels = CAMPUS_OPTIONS.map((item) => item.label);
|
|
const labels = CAMPUS_OPTIONS.map((item) => item.label);
|
|
|
- const defaultIndex = 1; // 默认白云校区
|
|
|
|
|
|
|
|
|
|
- const selectedIndex = await window.AndroidBridgePromise.showSingleSelection(
|
|
|
|
|
- "请选择校区",
|
|
|
|
|
- JSON.stringify(labels),
|
|
|
|
|
- defaultIndex
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ let selectedIndex = null;
|
|
|
|
|
+ do {
|
|
|
|
|
+ selectedIndex = await window.AndroidBridgePromise.showSingleSelection(
|
|
|
|
|
+ "校区检测失败,请选择校区",
|
|
|
|
|
+ JSON.stringify(labels),
|
|
|
|
|
+ -1
|
|
|
|
|
+ );
|
|
|
|
|
+ } while (selectedIndex == null || selectedIndex < 0 || selectedIndex >= CAMPUS_OPTIONS.length);
|
|
|
|
|
|
|
|
- if (selectedIndex == null || selectedIndex < 0 || selectedIndex >= CAMPUS_OPTIONS.length) {
|
|
|
|
|
- return "baiyun";
|
|
|
|
|
- }
|
|
|
|
|
return CAMPUS_OPTIONS[selectedIndex].id;
|
|
return CAMPUS_OPTIONS[selectedIndex].id;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -332,9 +331,6 @@ function parseCoursesFromIframeDocument(iframeDoc) {
|
|
|
const teacher = cleanText(teacherFont?.textContent ?? "");
|
|
const teacher = cleanText(teacherFont?.textContent ?? "");
|
|
|
let position = cleanText(locationFont?.textContent ?? "");
|
|
let position = cleanText(locationFont?.textContent ?? "");
|
|
|
|
|
|
|
|
- // 移除教室中的“(白)”“(白云)”“(白)实”等字样,该信息对于学生而言无意义
|
|
|
|
|
- position = position.replace(/[((]白云?[))]实?/g, "");
|
|
|
|
|
-
|
|
|
|
|
// 过滤空课程名、网络课和不存在的虚拟位置
|
|
// 过滤空课程名、网络课和不存在的虚拟位置
|
|
|
if (courseName === ""
|
|
if (courseName === ""
|
|
|
|| position.includes("网络学时,不排时间教室")
|
|
|| position.includes("网络学时,不排时间教室")
|
|
@@ -343,6 +339,18 @@ function parseCoursesFromIframeDocument(iframeDoc) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // 移除教室中的“(白)”“(白云)”“(白)实”等字样,该信息对于学生而言无意义
|
|
|
|
|
+ position = position.replace(/[((]白云?[))](?:实(?![A-Za-z]))?/g, "");
|
|
|
|
|
+
|
|
|
|
|
+ // 移除教室末尾的“xxxx实验室”字样,这个信息对于学生而言无意义
|
|
|
|
|
+ position = position.replace(/(?:(?<=\d|\d[A-Za-z])(?:[^A-Za-z\d))]|(?<!\d)[A-Za-z])*实验室(?:[((]?[\d一二三四五六七八九十甲乙丙丁]+[))]?|(物理实验室)|(机房))*)+$/, "");
|
|
|
|
|
+
|
|
|
|
|
+ // 补全开头的“英东楼”
|
|
|
|
|
+ position = position.replace(/^英\s*(\d{3,4})/, "英东楼$1");
|
|
|
|
|
+
|
|
|
|
|
+ // 移除掉生科楼的“实”
|
|
|
|
|
+ position = position.replace(/(?<=生科[AB])实/, "");
|
|
|
|
|
+
|
|
|
const parsed = parseWeeksAndSections(weekText);
|
|
const parsed = parseWeeksAndSections(weekText);
|
|
|
|
|
|
|
|
// 查重
|
|
// 查重
|