Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 04d66346dc | |||
| f858295af1 | |||
| cd6c899388 | |||
| 1038a86aff | |||
| 15ea47dd07 | |||
| 829a8440ad | |||
| 389ac885d3 |
@@ -91,7 +91,7 @@ class AutoLib(MsgBase):
|
|||||||
self.__driver = webdriver.Firefox(service=service, options=edge_options)
|
self.__driver = webdriver.Firefox(service=service, options=edge_options)
|
||||||
case _:
|
case _:
|
||||||
raise Exception(f"不支持的浏览器驱动类型: {self.__driver_type}")
|
raise Exception(f"不支持的浏览器驱动类型: {self.__driver_type}")
|
||||||
self.__driver.implicitly_wait(10)
|
self.__driver.implicitly_wait(1)
|
||||||
self.__driver.execute_script(
|
self.__driver.execute_script(
|
||||||
"Object.defineProperty(navigator, 'webdriver', {get: () => undefined})"
|
"Object.defineProperty(navigator, 'webdriver', {get: () => undefined})"
|
||||||
)
|
)
|
||||||
@@ -122,7 +122,7 @@ class AutoLib(MsgBase):
|
|||||||
|
|
||||||
# wait for page load
|
# wait for page load
|
||||||
try:
|
try:
|
||||||
WebDriverWait(self.__driver, 5).until( # title contains "首页"
|
WebDriverWait(self.__driver, 2).until( # title contains "首页"
|
||||||
EC.title_contains("首页")
|
EC.title_contains("首页")
|
||||||
)
|
)
|
||||||
WebDriverWait(self.__driver, 2).until( # username field presence
|
WebDriverWait(self.__driver, 2).until( # username field presence
|
||||||
@@ -147,7 +147,9 @@ class AutoLib(MsgBase):
|
|||||||
self,
|
self,
|
||||||
) -> bool:
|
) -> bool:
|
||||||
|
|
||||||
self.__driver.get(self.__system_config_reader.get("library/host_url"))
|
url = self.__system_config_reader.get("library/host_url")
|
||||||
|
url += self.__system_config_reader.get("library/login_url")
|
||||||
|
self.__driver.get(url)
|
||||||
if not self.__waitResponseLoad():
|
if not self.__waitResponseLoad():
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|||||||
@@ -44,9 +44,9 @@ class LibChecker(LibOperator):
|
|||||||
seconds: float
|
seconds: float
|
||||||
) -> str:
|
) -> str:
|
||||||
|
|
||||||
hours = int(seconds // 3600)
|
hours = int(seconds//3600)
|
||||||
minutes = int(seconds % 3600 // 60)
|
minutes = int(seconds%3600//60)
|
||||||
seconds = int(seconds % 60)
|
seconds = int(seconds%60)
|
||||||
return f"{hours} 时 {minutes} 分 {seconds} 秒"
|
return f"{hours} 时 {minutes} 分 {seconds} 秒"
|
||||||
|
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ class LibChecker(LibOperator):
|
|||||||
) -> bool:
|
) -> bool:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
WebDriverWait(self.__driver, 5).until(
|
WebDriverWait(self.__driver, 2).until(
|
||||||
EC.element_to_be_clickable((By.XPATH, "//a[@href='/history?type=SEAT']"))
|
EC.element_to_be_clickable((By.XPATH, "//a[@href='/history?type=SEAT']"))
|
||||||
).click()
|
).click()
|
||||||
WebDriverWait(self.__driver, 2).until(
|
WebDriverWait(self.__driver, 2).until(
|
||||||
@@ -67,6 +67,44 @@ class LibChecker(LibOperator):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def __decodeReserveTime(
|
||||||
|
self,
|
||||||
|
time_element
|
||||||
|
) -> dict:
|
||||||
|
|
||||||
|
time_str = time_element.text.strip()
|
||||||
|
today = datetime.now().date()
|
||||||
|
if "明天" in time_str:
|
||||||
|
target_date = today + timedelta(days=1)
|
||||||
|
date = target_date.strftime("%Y-%m-%d")
|
||||||
|
elif "今天" in time_str:
|
||||||
|
target_date = today
|
||||||
|
date = target_date.strftime("%Y-%m-%d")
|
||||||
|
elif "昨天" in time_str:
|
||||||
|
target_date = today - timedelta(days=1)
|
||||||
|
date = target_date.strftime("%Y-%m-%d")
|
||||||
|
else:
|
||||||
|
date_match = re.search(r"(\d{4}-\d{1,2}-\d{1,2})", time_str)
|
||||||
|
if date_match:
|
||||||
|
date = date_match.group(1)
|
||||||
|
else:
|
||||||
|
date = ""
|
||||||
|
time_match = re.search(r"(\d{1,2}:\d{2}) -- (\d{1,2}:\d{2})", time_str)
|
||||||
|
if time_match:
|
||||||
|
begin_time = time_match.group(1)
|
||||||
|
end_time = time_match.group(2)
|
||||||
|
else:
|
||||||
|
begin_time = ""
|
||||||
|
end_time = ""
|
||||||
|
return {
|
||||||
|
"date": date,
|
||||||
|
"time": {
|
||||||
|
"begin": begin_time,
|
||||||
|
"end": end_time
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def __decodeReserveInfo(
|
def __decodeReserveInfo(
|
||||||
self,
|
self,
|
||||||
info_elements
|
info_elements
|
||||||
@@ -108,42 +146,80 @@ class LibChecker(LibOperator):
|
|||||||
By.CSS_SELECTOR, "a"
|
By.CSS_SELECTOR, "a"
|
||||||
)
|
)
|
||||||
except:
|
except:
|
||||||
return None
|
return {
|
||||||
# process time element to get the date string
|
"date": "",
|
||||||
time_str = time_element.text.strip()
|
"time": {"begin": "", "end": ""},
|
||||||
today = datetime.now().date()
|
"info": {"location": "", "status": ""}
|
||||||
if "明天" in time_str:
|
}
|
||||||
target_date = today + timedelta(days=1)
|
time = self.__decodeReserveTime(time_element)
|
||||||
date_str = target_date.strftime("%Y-%m-%d")
|
|
||||||
elif "今天" in time_str:
|
|
||||||
target_date = today
|
|
||||||
date_str = target_date.strftime("%Y-%m-%d")
|
|
||||||
elif "昨天" in time_str:
|
|
||||||
target_date = today - timedelta(days=1)
|
|
||||||
date_str = target_date.strftime("%Y-%m-%d")
|
|
||||||
else:
|
|
||||||
date_match = re.search(r"(\d{4}-\d{1,2}-\d{1,2})", time_str)
|
|
||||||
if date_match:
|
|
||||||
date_str = date_match.group(1)
|
|
||||||
else:
|
|
||||||
date_str = ""
|
|
||||||
time_match = re.search(r"(\d{1,2}:\d{2}) -- (\d{1,2}:\d{2})", time_str)
|
|
||||||
if time_match:
|
|
||||||
begin_time = time_match.group(1)
|
|
||||||
end_time = time_match.group(2)
|
|
||||||
else:
|
|
||||||
time_str = ""
|
|
||||||
info = self.__decodeReserveInfo(info_elements)
|
info = self.__decodeReserveInfo(info_elements)
|
||||||
return {
|
return {
|
||||||
"date": date_str,
|
"date": time["date"],
|
||||||
"time": {
|
"time": time["time"],
|
||||||
"begin": begin_time,
|
|
||||||
"end": end_time,
|
|
||||||
},
|
|
||||||
"info": info
|
"info": info
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def __decodeReserveRecords(
|
||||||
|
self,
|
||||||
|
reservations
|
||||||
|
) -> list:
|
||||||
|
|
||||||
|
records = []
|
||||||
|
|
||||||
|
for reservation in reservations:
|
||||||
|
record = self.__decodeReserveRecord(reservation)
|
||||||
|
if record["date"] == "":
|
||||||
|
record = None
|
||||||
|
if record["time"] == {"begin": "", "end": ""}:
|
||||||
|
record = None
|
||||||
|
records.append(record)
|
||||||
|
return records
|
||||||
|
|
||||||
|
|
||||||
|
def __loadReserveRecords(
|
||||||
|
self
|
||||||
|
) -> list:
|
||||||
|
try:
|
||||||
|
# check if there's any reservation on the date
|
||||||
|
WebDriverWait(self.__driver, 2).until(
|
||||||
|
EC.presence_of_element_located((By.CSS_SELECTOR, ".myReserveList > dl"))
|
||||||
|
)
|
||||||
|
reservations = self.__driver.find_elements(
|
||||||
|
By.CSS_SELECTOR, ".myReserveList > dl:not(#moreBlock)"
|
||||||
|
)
|
||||||
|
return reservations
|
||||||
|
except:
|
||||||
|
self._showTrace("加载预约记录失败 !")
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def __showMoreReserveRecords(
|
||||||
|
self
|
||||||
|
) -> bool:
|
||||||
|
|
||||||
|
# load new reservations if still not sure
|
||||||
|
try:
|
||||||
|
WebDriverWait(self.__driver, 0.1).until(
|
||||||
|
EC.element_to_be_clickable((By.ID, "moreBtn"))
|
||||||
|
)
|
||||||
|
except:
|
||||||
|
# the reservation is the last one
|
||||||
|
return False
|
||||||
|
try:
|
||||||
|
more_btn = self.__driver.find_element(By.ID, "moreBtn")
|
||||||
|
if more_btn.is_displayed() and more_btn.is_enabled():
|
||||||
|
self.__driver.execute_script("arguments[0].scrollIntoView(true);", more_btn)
|
||||||
|
self.__driver.execute_script("arguments[0].click();", more_btn)
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
self._showTrace("用户无法加载更多预约记录")
|
||||||
|
return False
|
||||||
|
except:
|
||||||
|
self._showTrace("加载更多预约记录失败 !")
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
def __getReserveRecord(
|
def __getReserveRecord(
|
||||||
self,
|
self,
|
||||||
wanted_date: str,
|
wanted_date: str,
|
||||||
@@ -154,7 +230,6 @@ class LibChecker(LibOperator):
|
|||||||
self._showTrace("日期未指定, 无法检查当前预约状态")
|
self._showTrace("日期未指定, 无法检查当前预约状态")
|
||||||
return None
|
return None
|
||||||
self._showTrace(f"正在检查用户在 {wanted_date} 是否有预约状态为 {wanted_status} 的预约记录......")
|
self._showTrace(f"正在检查用户在 {wanted_date} 是否有预约状态为 {wanted_status} 的预约记录......")
|
||||||
date_obj = datetime.strptime(wanted_date, "%Y-%m-%d").date()
|
|
||||||
|
|
||||||
checked_count = 0
|
checked_count = 0
|
||||||
max_check_times = 6 # we only check (4*(6-1)=)20 reservations, the last time cant be checked
|
max_check_times = 6 # we only check (4*(6-1)=)20 reservations, the last time cant be checked
|
||||||
@@ -162,59 +237,30 @@ class LibChecker(LibOperator):
|
|||||||
if not self.__navigateToReserveRecordPage():
|
if not self.__navigateToReserveRecordPage():
|
||||||
return None
|
return None
|
||||||
for _ in range(max_check_times):
|
for _ in range(max_check_times):
|
||||||
try:
|
reservations = self.__loadReserveRecords()
|
||||||
# check if there's any reservation on the date
|
if reservations is None:
|
||||||
WebDriverWait(self.__driver, 2).until(
|
|
||||||
EC.presence_of_element_located((By.CSS_SELECTOR, ".myReserveList > dl"))
|
|
||||||
)
|
|
||||||
reservations = self.__driver.find_elements(
|
|
||||||
By.CSS_SELECTOR, ".myReserveList > dl:not(#moreBlock)"
|
|
||||||
)
|
|
||||||
except:
|
|
||||||
self._showTrace("加载预约记录失败 !")
|
|
||||||
return None
|
return None
|
||||||
for i in range(checked_count, len(reservations)): # the last one is load button
|
records = self.__decodeReserveRecords(reservations[checked_count:])
|
||||||
reservation = reservations[i]
|
for record in records:
|
||||||
record = self.__decodeReserveRecord(reservation)
|
checked_count += 1
|
||||||
if record is None:
|
if record is None:
|
||||||
continue
|
continue
|
||||||
record_date = record["date"]
|
# record date is later than the given date, check the next one
|
||||||
record_time = record["time"]
|
if datetime.strptime(record["date"], "%Y-%m-%d").date() >\
|
||||||
status = record["info"]["status"]
|
datetime.strptime(wanted_date, "%Y-%m-%d").date():
|
||||||
location = record["info"]["location"]
|
|
||||||
if record_date == "" or record_time == {"begin": "", "end": ""}:
|
|
||||||
continue
|
continue
|
||||||
is_wanted = (status == wanted_status)
|
# record date is earlier than the given date, so there is no wanted record
|
||||||
# reservation is later than the given date, check the next one
|
if datetime.strptime(record["date"], "%Y-%m-%d").date() <\
|
||||||
if datetime.strptime(record_date, "%Y-%m-%d").date() > date_obj:
|
datetime.strptime(wanted_date, "%Y-%m-%d").date():
|
||||||
continue
|
|
||||||
# reservation is earlier than the given date, can reserve
|
|
||||||
if datetime.strptime(record_date, "%Y-%m-%d").date() < date_obj:
|
|
||||||
return None
|
return None
|
||||||
# query the wanted status
|
if record["info"]["status"] == wanted_status:
|
||||||
if is_wanted:
|
|
||||||
self._showTrace(
|
self._showTrace(
|
||||||
f"寻找到用户第 {i + 1} 条状态为 {wanted_status} 的预约记录, "
|
f"寻找到用户第 {checked_count} 条状态为 {wanted_status} 的预约记录, "
|
||||||
f"详细信息: {record_date} {record_time['begin']} - {record_time['end']} {location}"
|
f"详细信息: {record["date"]} "
|
||||||
|
f"{record["time"]["begin"]} - {record["time"]["end"]} {record["info"]["location"]}"
|
||||||
)
|
)
|
||||||
return {
|
return record
|
||||||
"index": i,
|
if not self.__showMoreReserveRecords():
|
||||||
"date": record_date,
|
|
||||||
"time": record_time,
|
|
||||||
"status": wanted_status
|
|
||||||
}
|
|
||||||
checked_count = len(reservations)
|
|
||||||
# load new reservations if still not sure
|
|
||||||
try:
|
|
||||||
more_btn = self.__driver.find_element(By.ID, "moreBtn")
|
|
||||||
if more_btn.is_displayed() and more_btn.is_enabled():
|
|
||||||
self.__driver.execute_script("arguments[0].scrollIntoView(true);", more_btn)
|
|
||||||
self.__driver.execute_script("arguments[0].click();", more_btn)
|
|
||||||
else:
|
|
||||||
self._showTrace("用户无法加载更多预约记录")
|
|
||||||
break
|
|
||||||
except:
|
|
||||||
self._showTrace("加载更多预约记录失败 !")
|
|
||||||
break
|
break
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@@ -252,21 +298,21 @@ class LibChecker(LibOperator):
|
|||||||
if time_diff_seconds < -30*60:
|
if time_diff_seconds < -30*60:
|
||||||
self._showTrace(
|
self._showTrace(
|
||||||
f"用户在 {date} 的预约开始时间为 {begin_time}, "
|
f"用户在 {date} 的预约开始时间为 {begin_time}, "
|
||||||
f"距离当前时间还有 {self.__formatDiffTime(abs(time_diff_seconds))}, 无法签到"
|
f"当前距离预约开始时间还有 {self.__formatDiffTime(abs(time_diff_seconds))}, 无法签到"
|
||||||
)
|
)
|
||||||
return False
|
return False
|
||||||
# before in 30 minutes, can checkin
|
# before in 30 minutes, can checkin
|
||||||
elif -30*60 <= time_diff_seconds < 0:
|
elif -30*60 <= time_diff_seconds < 0:
|
||||||
self._showTrace(
|
self._showTrace(
|
||||||
f"用户在 {date} 的预约开始时间为 {begin_time}, "
|
f"用户在 {date} 的预约开始时间为 {begin_time}, "
|
||||||
f"距离当前时间还有 {self.__formatDiffTime(abs(time_diff_seconds))}, 可以签到"
|
f"当前距离预约开始时间还有 {self.__formatDiffTime(abs(time_diff_seconds))}, 可以签到"
|
||||||
)
|
)
|
||||||
return True
|
return True
|
||||||
# past less than 30 minutes, can checkin
|
# past less than 30 minutes, can checkin
|
||||||
elif 0 <= time_diff_seconds < 30*60:
|
elif 0 <= time_diff_seconds < 30*60 - 5: # spare 5 seconds for the checkin process
|
||||||
self._showTrace(
|
self._showTrace(
|
||||||
f"用户在 {date} 的预约开始时间为 {begin_time}, "
|
f"用户在 {date} 的预约开始时间为 {begin_time}, "
|
||||||
f"当前时间已经 {self.__formatDiffTime(abs(time_diff_seconds))}, 可以签到"
|
f"当前距离预约开始时间已经过去 {self.__formatDiffTime(abs(time_diff_seconds))}, 可以签到"
|
||||||
)
|
)
|
||||||
return True
|
return True
|
||||||
self._showTrace(f"用户在 {date} 没有有效预约记录, 无法签到")
|
self._showTrace(f"用户在 {date} 没有有效预约记录, 无法签到")
|
||||||
@@ -286,17 +332,15 @@ class LibChecker(LibOperator):
|
|||||||
time_diff = end_time - datetime.now()
|
time_diff = end_time - datetime.now()
|
||||||
time_diff_seconds = time_diff.total_seconds()
|
time_diff_seconds = time_diff.total_seconds()
|
||||||
# a using record is definitely after the begin time
|
# a using record is definitely after the begin time
|
||||||
if abs(time_diff_seconds) < 120*60:
|
trace_msg = (
|
||||||
self._showTrace(
|
|
||||||
f"用户在 {date} 的预约结束时间为 {end_time}, "
|
f"用户在 {date} 的预约结束时间为 {end_time}, "
|
||||||
f"距离当前时间还有 {self.__formatDiffTime(abs(time_diff_seconds))}, 可以续约"
|
f"当前距离预约结束时间还有 {self.__formatDiffTime(abs(time_diff_seconds))}"
|
||||||
)
|
)
|
||||||
|
if abs(time_diff_seconds) < 120*60:
|
||||||
|
self._showTrace(f"{trace_msg}, 可以续约")
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
self._showTrace(
|
self._showTrace(f"{trace_msg}, 无法续约")
|
||||||
f"用户在 {date} 的预约结束时间为 {end_time}, "
|
|
||||||
f"距离当前时间还有 {self.__formatDiffTime(abs(time_diff_seconds))}, 无法续约"
|
|
||||||
)
|
|
||||||
return False
|
return False
|
||||||
self._showTrace(f"用户在 {date} 没有有效预约记录, 无法续约")
|
self._showTrace(f"用户在 {date} 没有有效预约记录, 无法续约")
|
||||||
return False
|
return False
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class LibCheckin(LibOperator):
|
|||||||
) -> bool:
|
) -> bool:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
WebDriverWait(self.__driver, 5).until(
|
WebDriverWait(self.__driver, 2).until(
|
||||||
EC.presence_of_element_located((By.CLASS_NAME, "ui_dialog"))
|
EC.presence_of_element_located((By.CLASS_NAME, "ui_dialog"))
|
||||||
)
|
)
|
||||||
WebDriverWait(self.__driver, 2).until(
|
WebDriverWait(self.__driver, 2).until(
|
||||||
|
|||||||
@@ -41,13 +41,13 @@ class LibLogin(LibOperator):
|
|||||||
|
|
||||||
# wait to verify login success
|
# wait to verify login success
|
||||||
try:
|
try:
|
||||||
WebDriverWait(self.__driver, 5).until( # title contains "自选座位 :: 座位预约系统"
|
WebDriverWait(self.__driver, 2).until( # title contains "自选座位 :: 座位预约系统"
|
||||||
EC.title_contains("自选座位 :: 座位预约系统")
|
EC.title_contains("自选座位 :: 座位预约系统")
|
||||||
)
|
)
|
||||||
WebDriverWait(self.__driver, 3).until( # search button presence
|
WebDriverWait(self.__driver, 2).until( # search button presence
|
||||||
EC.presence_of_element_located((By.ID, "search"))
|
EC.presence_of_element_located((By.ID, "search"))
|
||||||
)
|
)
|
||||||
WebDriverWait(self.__driver, 3).until( # select content presence
|
WebDriverWait(self.__driver, 2).until( # select content presence
|
||||||
EC.presence_of_element_located((By.CLASS_NAME, "selectContent"))
|
EC.presence_of_element_located((By.CLASS_NAME, "selectContent"))
|
||||||
)
|
)
|
||||||
return True
|
return True
|
||||||
|
|||||||
@@ -55,13 +55,13 @@ class LibReserve(LibOperator):
|
|||||||
) -> bool:
|
) -> bool:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
WebDriverWait(self.__driver, 5).until(
|
WebDriverWait(self.__driver, 2).until(
|
||||||
EC.presence_of_element_located((By.CLASS_NAME, "layoutSeat"))
|
EC.presence_of_element_located((By.CLASS_NAME, "layoutSeat"))
|
||||||
)
|
)
|
||||||
title_elements = []
|
title_elements = []
|
||||||
# reserve failed without title elements, so we need to try
|
# reserve failed without title elements, so we need to try
|
||||||
try:
|
try:
|
||||||
WebDriverWait(self.__driver, 1).until(
|
WebDriverWait(self.__driver, 2).until(
|
||||||
EC.presence_of_element_located((By.CSS_SELECTOR, ".layoutSeat dt"))
|
EC.presence_of_element_located((By.CSS_SELECTOR, ".layoutSeat dt"))
|
||||||
)
|
)
|
||||||
title_elements = self.__driver.find_elements(
|
title_elements = self.__driver.find_elements(
|
||||||
@@ -309,12 +309,12 @@ class LibReserve(LibOperator):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
# click the trigger element
|
# click the trigger element
|
||||||
WebDriverWait(self.__driver, 5).until(
|
WebDriverWait(self.__driver, 2).until(
|
||||||
EC.element_to_be_clickable(trigger_locator)
|
EC.element_to_be_clickable(trigger_locator)
|
||||||
).click()
|
).click()
|
||||||
if option_locator:
|
if option_locator:
|
||||||
# select the option element if specified
|
# select the option element if specified
|
||||||
WebDriverWait(self.__driver, 5).until(
|
WebDriverWait(self.__driver, 2).until(
|
||||||
EC.element_to_be_clickable(option_locator)
|
EC.element_to_be_clickable(option_locator)
|
||||||
).click()
|
).click()
|
||||||
self._showTrace(success_msg)
|
self._showTrace(success_msg)
|
||||||
@@ -386,9 +386,16 @@ class LibReserve(LibOperator):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
# wait fot seat layout element to load
|
# wait fot seat layout element to load
|
||||||
WebDriverWait(self.__driver, 5).until(
|
WebDriverWait(self.__driver, 2).until(
|
||||||
EC.presence_of_element_located((By.ID, "seatLayout"))
|
EC.presence_of_element_located((By.ID, "seatLayout"))
|
||||||
)
|
)
|
||||||
|
WebDriverWait(self.__driver, 2).until(
|
||||||
|
EC.presence_of_all_elements_located((By.CSS_SELECTOR, "li[id^='seat_']"))
|
||||||
|
)
|
||||||
|
except:
|
||||||
|
self._showTrace(f"座位加载失败 !")
|
||||||
|
return False
|
||||||
|
try:
|
||||||
all_seats = self.__driver.find_elements(
|
all_seats = self.__driver.find_elements(
|
||||||
By.CSS_SELECTOR, "li[id^='seat_']"
|
By.CSS_SELECTOR, "li[id^='seat_']"
|
||||||
)
|
)
|
||||||
@@ -397,7 +404,7 @@ class LibReserve(LibOperator):
|
|||||||
if not seat_id_upper == seat.text.lstrip('0'):
|
if not seat_id_upper == seat.text.lstrip('0'):
|
||||||
continue
|
continue
|
||||||
seat_link = seat.find_element(By.TAG_NAME, "a")
|
seat_link = seat.find_element(By.TAG_NAME, "a")
|
||||||
WebDriverWait(self.__driver, 5).until(
|
WebDriverWait(self.__driver, 2).until(
|
||||||
EC.element_to_be_clickable(seat_link)
|
EC.element_to_be_clickable(seat_link)
|
||||||
)
|
)
|
||||||
seat_link.click()
|
seat_link.click()
|
||||||
@@ -419,6 +426,15 @@ class LibReserve(LibOperator):
|
|||||||
prefer_earlier: bool = True
|
prefer_earlier: bool = True
|
||||||
) -> int:
|
) -> int:
|
||||||
|
|
||||||
|
try:
|
||||||
|
WebDriverWait(self.__driver, 2).until(
|
||||||
|
EC.presence_of_all_elements_located(
|
||||||
|
(By.CSS_SELECTOR, f"#{time_id} ul li a")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
except:
|
||||||
|
self._showTrace(f"{time_type} 选择失败 ! : 当前未查询到可用时间")
|
||||||
|
return -1
|
||||||
try:
|
try:
|
||||||
all_time_opts = self.__driver.find_elements(
|
all_time_opts = self.__driver.find_elements(
|
||||||
By.CSS_SELECTOR,
|
By.CSS_SELECTOR,
|
||||||
@@ -429,6 +445,9 @@ class LibReserve(LibOperator):
|
|||||||
best_actual_diff = None
|
best_actual_diff = None
|
||||||
best_time_opt = None
|
best_time_opt = None
|
||||||
|
|
||||||
|
if not all_time_opts:
|
||||||
|
self._showTrace(f"{time_type} 选择失败 ! : 当前未查询到可用时间")
|
||||||
|
return -1
|
||||||
for time_opt in all_time_opts:
|
for time_opt in all_time_opts:
|
||||||
time_attr = time_opt.get_attribute("time")
|
time_attr = time_opt.get_attribute("time")
|
||||||
if time_attr == "now":
|
if time_attr == "now":
|
||||||
@@ -544,7 +563,7 @@ class LibReserve(LibOperator):
|
|||||||
return False
|
return False
|
||||||
# map page
|
# map page
|
||||||
try:
|
try:
|
||||||
WebDriverWait(self.__driver, 5).until(
|
WebDriverWait(self.__driver, 2).until(
|
||||||
EC.element_to_be_clickable((By.XPATH, "//a[@href='/map']"))
|
EC.element_to_be_clickable((By.XPATH, "//a[@href='/map']"))
|
||||||
).click()
|
).click()
|
||||||
WebDriverWait(self.__driver, 2).until(
|
WebDriverWait(self.__driver, 2).until(
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 785 KiB |
@@ -1,964 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="zh-CN">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<link rel="icon" href="./AutoLibrary.ico" type="image/x-icon">
|
|
||||||
<title>AutoLibrary 操作手册</title>
|
|
||||||
<style>
|
|
||||||
* {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
box-sizing: border-box;
|
|
||||||
font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
:root {
|
|
||||||
--primary: #2c3e50;
|
|
||||||
--secondary: #3498db;
|
|
||||||
--accent: #e74c3c;
|
|
||||||
--light: #f8f9fa;
|
|
||||||
--dark: #2c3e50;
|
|
||||||
--gray: #6c757d;
|
|
||||||
--border: #dee2e6;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
background-color: #c0c0c0a4;
|
|
||||||
color: #333;
|
|
||||||
line-height: 1.6;
|
|
||||||
}
|
|
||||||
|
|
||||||
.manual-container {
|
|
||||||
display: flex;
|
|
||||||
max-width: 1400px;
|
|
||||||
margin: 0 auto;
|
|
||||||
box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
|
|
||||||
min-height: 100vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar {
|
|
||||||
width: 280px;
|
|
||||||
background: var(--primary);
|
|
||||||
color: rgba(255, 255, 255, 0.7);
|
|
||||||
padding: 2rem 1rem;
|
|
||||||
position: sticky;
|
|
||||||
top: 0;
|
|
||||||
height: 100vh;
|
|
||||||
overflow-y: auto;
|
|
||||||
}
|
|
||||||
.sidebar-header {
|
|
||||||
padding-bottom: 1.5rem;
|
|
||||||
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
|
|
||||||
margin-bottom: 1.5rem;
|
|
||||||
transition: all 0.2s ease;
|
|
||||||
}
|
|
||||||
.sidebar-header:hover {
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
.sidebar h1 {
|
|
||||||
font-size: 1.5rem;
|
|
||||||
margin-bottom: 0.5rem;
|
|
||||||
}
|
|
||||||
.sidebar-nav {
|
|
||||||
list-style: none;
|
|
||||||
}
|
|
||||||
.sidebar-nav li {
|
|
||||||
margin-bottom: 0.5rem;
|
|
||||||
}
|
|
||||||
.sidebar-nav a {
|
|
||||||
color: rgba(255, 255, 255, 0.8);
|
|
||||||
text-decoration: none;
|
|
||||||
display: block;
|
|
||||||
padding: 0.7rem 1rem;
|
|
||||||
border-radius: 5px;
|
|
||||||
transition: all 0.2s ease;
|
|
||||||
}
|
|
||||||
.sidebar-nav a:hover,
|
|
||||||
.sidebar-nav a.active {
|
|
||||||
background: rgba(255, 255, 255, 0.1);
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
.content {
|
|
||||||
flex: 1;
|
|
||||||
background: rgb(245, 245, 245);
|
|
||||||
padding: 2rem 3rem;
|
|
||||||
overflow-y: auto;
|
|
||||||
max-height: 100vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
.section {
|
|
||||||
margin-bottom: 1rem;
|
|
||||||
padding-bottom: 2rem;
|
|
||||||
border-bottom: 1px solid var(--border);
|
|
||||||
}
|
|
||||||
|
|
||||||
h2 {
|
|
||||||
color: var(--primary);
|
|
||||||
margin-bottom: 1.5rem;
|
|
||||||
padding-bottom: 0.5rem;
|
|
||||||
border-bottom: 2px solid var(--secondary);
|
|
||||||
}
|
|
||||||
|
|
||||||
h3 {
|
|
||||||
color: var(--dark);
|
|
||||||
margin: 1.5rem 0 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.step-container {
|
|
||||||
counter-reset: step-counter;
|
|
||||||
}
|
|
||||||
|
|
||||||
.step {
|
|
||||||
display: flex;
|
|
||||||
margin-bottom: 2rem;
|
|
||||||
background: var(--light);
|
|
||||||
border-radius: 8px;
|
|
||||||
padding: 1.5rem;
|
|
||||||
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.step-number {
|
|
||||||
counter-increment: step-counter;
|
|
||||||
background: var(--secondary);
|
|
||||||
color: white;
|
|
||||||
width: 36px;
|
|
||||||
height: 36px;
|
|
||||||
border-radius: 50%;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
font-weight: bold;
|
|
||||||
margin-right: 1.5rem;
|
|
||||||
flex-shrink: 0;
|
|
||||||
font-size: 1.1rem;
|
|
||||||
}
|
|
||||||
.step-number::before {
|
|
||||||
content: counter(step-counter);
|
|
||||||
}
|
|
||||||
|
|
||||||
.step-content {
|
|
||||||
flex: 1;
|
|
||||||
}
|
|
||||||
.step-content ol {
|
|
||||||
padding-left: 1em;
|
|
||||||
}
|
|
||||||
.step-content ul {
|
|
||||||
padding-left: 1em;
|
|
||||||
}
|
|
||||||
.step-content li {
|
|
||||||
line-height: 1.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
.step-image {
|
|
||||||
background: #f0f0f0;
|
|
||||||
border-radius: 5px;
|
|
||||||
padding: 15px;
|
|
||||||
margin: 1rem 0;
|
|
||||||
display: inline-block;
|
|
||||||
text-align: center;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
max-width: 100%;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
.step-image img {
|
|
||||||
max-width: 60%;
|
|
||||||
height: auto;
|
|
||||||
border-radius: 3px;
|
|
||||||
display: block;
|
|
||||||
margin: 0 auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.intro-box {
|
|
||||||
background: #e3f2fd;
|
|
||||||
border-left: 4px solid var(--secondary);
|
|
||||||
padding: 1.5rem;
|
|
||||||
margin-bottom: 2rem;
|
|
||||||
border-radius: 0 5px 5px 0;
|
|
||||||
}
|
|
||||||
.info {
|
|
||||||
background: #e3f2fd;
|
|
||||||
border-left: 4px solid #0783ff;
|
|
||||||
padding: 1rem;
|
|
||||||
margin: 1rem 0;
|
|
||||||
border-radius: 0 5px 5px 0;
|
|
||||||
}
|
|
||||||
.important {
|
|
||||||
background: #fff3cd;
|
|
||||||
border-left: 4px solid #ffc107;
|
|
||||||
padding: 1rem;
|
|
||||||
margin: 1rem 0;
|
|
||||||
border-radius: 0 5px 5px 0;
|
|
||||||
}
|
|
||||||
.warning {
|
|
||||||
background: #f8d7da;
|
|
||||||
border-left: 4px solid #dc3545;
|
|
||||||
padding: 1rem;
|
|
||||||
margin: 1rem 0;
|
|
||||||
border-radius: 0 5px 5px 0;
|
|
||||||
}
|
|
||||||
.highlight {
|
|
||||||
background: #e3f2fd;
|
|
||||||
color: #3498db;
|
|
||||||
padding: 3px 6px;
|
|
||||||
border-radius: 3px;
|
|
||||||
font-size: 0.9rem;
|
|
||||||
font-family: 'Consolas', monospace;
|
|
||||||
}
|
|
||||||
|
|
||||||
.code-block {
|
|
||||||
background: #2d2d2d;
|
|
||||||
color: #f8f8f2;
|
|
||||||
border: 1px solid #444;
|
|
||||||
border-left: 4px solid var(--secondary);
|
|
||||||
padding: 1rem;
|
|
||||||
margin: 1rem 0;
|
|
||||||
font-family: 'Consolas', monospace;
|
|
||||||
white-space: pre-wrap;
|
|
||||||
border-radius: 15px 15px 5px 5px;
|
|
||||||
font-size: 0.9rem;
|
|
||||||
overflow-x: auto;
|
|
||||||
line-height: 1.4;
|
|
||||||
}
|
|
||||||
.code-block .bool { color: #569CD6; }
|
|
||||||
.code-block .string { color: #CE9178; }
|
|
||||||
.code-block .number { color: #B5CEA8; }
|
|
||||||
.code-block .boolean { color: #569CD6; }
|
|
||||||
.code-block .null { color: #569CD6; }
|
|
||||||
.code-block .property { color: #9CDCFE; }
|
|
||||||
.code-block .punctuation { color: #D4D4D4; }
|
|
||||||
|
|
||||||
.feature-grid {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
|
||||||
gap: 1.5rem;
|
|
||||||
margin-top: 1.5rem;
|
|
||||||
}
|
|
||||||
.feature-card {
|
|
||||||
background: white;
|
|
||||||
border: 1px solid var(--border);
|
|
||||||
border-radius: 8px;
|
|
||||||
padding: 1.5rem;
|
|
||||||
transition: transform 0.3s ease, box-shadow 0.3s ease;
|
|
||||||
}
|
|
||||||
.feature-card:hover {
|
|
||||||
transform: translateY(-5px);
|
|
||||||
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
.feature-icon {
|
|
||||||
font-size: 2rem;
|
|
||||||
color: var(--secondary);
|
|
||||||
margin-bottom: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.download-section {
|
|
||||||
text-align: center;
|
|
||||||
padding: 2rem;
|
|
||||||
background: var(--light);
|
|
||||||
border-radius: 8px;
|
|
||||||
margin-top: 2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tabs-container {
|
|
||||||
margin-top: 0.5rem;
|
|
||||||
margin-bottom: 1rem;
|
|
||||||
}
|
|
||||||
.tab-buttons {
|
|
||||||
display: flex;
|
|
||||||
margin-bottom: 0;
|
|
||||||
border-bottom: 1px solid var(--border);
|
|
||||||
}
|
|
||||||
.tab-button {
|
|
||||||
padding: 0.8rem 1.5rem;
|
|
||||||
cursor: pointer;
|
|
||||||
border: none;
|
|
||||||
background: none;
|
|
||||||
font-size: 1rem;
|
|
||||||
color: var(--gray);
|
|
||||||
border-bottom: 3px solid transparent;
|
|
||||||
transition: all 0.3s ease;
|
|
||||||
}
|
|
||||||
.tab-button.active {
|
|
||||||
color: var(--secondary);
|
|
||||||
border-bottom: 3px solid var(--secondary);
|
|
||||||
}
|
|
||||||
.tab-content {
|
|
||||||
background: white;
|
|
||||||
border-radius: 0 5px 5px 5px;
|
|
||||||
padding: 1.5rem;
|
|
||||||
border: 1px solid var(--border);
|
|
||||||
border-top: none;
|
|
||||||
min-height: 300px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
.tab-pane {
|
|
||||||
display: none;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
.tab-pane.active {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
/* align-items: center;
|
|
||||||
justify-content: center; */
|
|
||||||
}
|
|
||||||
.tab-pane img {
|
|
||||||
max-width: 60%;
|
|
||||||
max-height: 60%;
|
|
||||||
border-radius: 5px;
|
|
||||||
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn {
|
|
||||||
display: inline-block;
|
|
||||||
background: var(--secondary);
|
|
||||||
color: white;
|
|
||||||
padding: 0.8rem 1.5rem;
|
|
||||||
border-radius: 3px;
|
|
||||||
text-decoration: none;
|
|
||||||
font-weight: bold;
|
|
||||||
transition: all 0.3s ease;
|
|
||||||
border: none;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
.btn:hover {
|
|
||||||
background: #2980b9;
|
|
||||||
transform: translateY(-2px);
|
|
||||||
}
|
|
||||||
|
|
||||||
.faq-item {
|
|
||||||
margin-bottom: 1.5rem;
|
|
||||||
border: 1px solid var(--border);
|
|
||||||
border-radius: 5px;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
.faq-question {
|
|
||||||
padding: 1rem 1.5rem;
|
|
||||||
background: var(--light);
|
|
||||||
font-weight: bold;
|
|
||||||
cursor: pointer;
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
.faq-answer {
|
|
||||||
padding: 1rem 1.5rem;
|
|
||||||
background: rgb(220, 220, 220);
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
.faq-item.active .faq-answer {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.browser-drivers {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
|
|
||||||
justify-content: space-between;
|
|
||||||
gap: 1.5rem;
|
|
||||||
margin: 1.5rem 0;
|
|
||||||
}
|
|
||||||
.browser-card {
|
|
||||||
flex: 1;
|
|
||||||
background: white;
|
|
||||||
border: 1px solid var(--border);
|
|
||||||
border-radius: 8px;
|
|
||||||
padding: 1.5rem;
|
|
||||||
text-align: center;
|
|
||||||
transition: transform 0.3s ease, box-shadow 0.3s ease;
|
|
||||||
}
|
|
||||||
.browser-card:hover {
|
|
||||||
transform: translateY(-5px);
|
|
||||||
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
.browser-logo {
|
|
||||||
width: 80px;
|
|
||||||
height: 80px;
|
|
||||||
margin: 0 auto 1rem;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
border-radius: 8px;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
.browser-logo img {
|
|
||||||
max-width: 100%;
|
|
||||||
max-height: 100%;
|
|
||||||
}
|
|
||||||
.browser-card h4 {
|
|
||||||
margin-bottom: 1rem;
|
|
||||||
color: var(--primary);
|
|
||||||
}
|
|
||||||
.browser-card .btn {
|
|
||||||
margin-top: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 992px) {
|
|
||||||
.manual-container {
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar {
|
|
||||||
width: 100%;
|
|
||||||
height: auto;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.content {
|
|
||||||
padding: 1.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.feature-grid {
|
|
||||||
grid-template-columns: 1fr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="manual-container">
|
|
||||||
<aside class="sidebar">
|
|
||||||
<div class="sidebar-header">
|
|
||||||
<h1>AutoLibrary</h1>
|
|
||||||
<p>操作手册 alpha-v0.03</p>
|
|
||||||
</div>
|
|
||||||
<ul class="sidebar-nav">
|
|
||||||
<li><a href="#intro" class="active">工具简介</a></li>
|
|
||||||
<li><a href="#preparation">准备工作</a></li>
|
|
||||||
<li><a href="#usage">使用步骤</a></li>
|
|
||||||
<li><a href="#features">功能介绍</a></li>
|
|
||||||
<li><a href="#troubleshooting">故障排除</a></li>
|
|
||||||
<li><a href="#faq">常见问题</a></li>
|
|
||||||
<li><a href="#download">下载安装</a></li>
|
|
||||||
</ul>
|
|
||||||
</aside>
|
|
||||||
|
|
||||||
<main class="content">
|
|
||||||
<section id="name" class="section" style="display: flex; align-items: center; gap: 10px;">
|
|
||||||
<img src="./AutoLibrary.ico" alt="AutoLibrary" style="width: 80px; height: 80px;">
|
|
||||||
<h1>AutoLibrary</h1>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section id="intro" class="section">
|
|
||||||
<h2>工具简介</h2>
|
|
||||||
<div class="step">
|
|
||||||
<div class="step-content">
|
|
||||||
<div class="intro-box">
|
|
||||||
<p>AutoLibrary 是一款专为北京建筑大学图书馆设计的自动化工具,旨在帮助学生简化图书馆座位操作流程,节省宝贵时间。</p>
|
|
||||||
</div>
|
|
||||||
<p>本工具模拟人工操作,通过简单的界面配置并交互使用。</p>
|
|
||||||
|
|
||||||
<h3>工具特点</h3>
|
|
||||||
<ul>
|
|
||||||
<p>模拟人工操作,不干扰图书馆系统正常运行</p>
|
|
||||||
<p>支持多种预约模式,满足不同使用场景</p>
|
|
||||||
<p>支持多账号批量预约</p>
|
|
||||||
<p>自动处理验证码,减少人工干预</p>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section id="preparation" class="section">
|
|
||||||
<h2>准备工作</h2>
|
|
||||||
<div class="step-container">
|
|
||||||
<div class="step">
|
|
||||||
<div class="step-number"></div>
|
|
||||||
<div class="step-content">
|
|
||||||
<h3>下载浏览器驱动</h3>
|
|
||||||
<p>工具需要通过浏览器驱动来控制浏览器,请根据您使用的浏览器下载对应版本的驱动:</p>
|
|
||||||
|
|
||||||
<div class="browser-drivers">
|
|
||||||
<div class="browser-card">
|
|
||||||
<div class="browser-logo">
|
|
||||||
<img src="https://edgestatic.azureedge.net/welcome/static/favicon.png" alt="Microsoft Edge">
|
|
||||||
</div>
|
|
||||||
<h4>Microsoft Edge</h4>
|
|
||||||
<p>适用于Windows 10/11系统</p>
|
|
||||||
<a href="https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/" target="_blank" class="btn">下载驱动</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="browser-card">
|
|
||||||
<div class="browser-logo">
|
|
||||||
<img src="https://www.gstatic.cn/devrel-devsite/prod/v154b6c17f7870ab2939b3d571919274f806798dc59971188e1f4183601ea7775/chrome/images/touchicon-180.png" alt="Google Chrome">
|
|
||||||
</div>
|
|
||||||
<h4>Google Chrome</h4>
|
|
||||||
<p>最常用的浏览器</p>
|
|
||||||
<a href="https://developer.chrome.google.cn/docs/chromedriver/downloads" target="_blank" class="btn">下载驱动</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="browser-card">
|
|
||||||
<div class="browser-logo">
|
|
||||||
<img src="https://www.firefox.com/media/img/favicons/firefox/browser/favicon-196x196.59e3822720be.png" alt="Mozilla Firefox">
|
|
||||||
</div>
|
|
||||||
<h4>Mozilla Firefox</h4>
|
|
||||||
<p>开源浏览器</p>
|
|
||||||
<a href="https://github.com/mozilla/geckodriver/releases" target="_blank" class="btn">下载驱动</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="info">
|
|
||||||
<strong>提示:</strong> 浏览器驱动版本必须与您的浏览器版本兼容,否则本工具将无法正常工作。
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="step">
|
|
||||||
<div class="step-number"></div>
|
|
||||||
<div class="step-content">
|
|
||||||
<h3>确认驱动路径</h3>
|
|
||||||
<p>下载驱动后,将浏览器驱动程序的路径通过配置窗口加载到AutoLibrary中。</p>
|
|
||||||
|
|
||||||
<p>例如:<span class="highlight">C:\Users\Administrator\Downloads\msedgedriver.exe</span></p>
|
|
||||||
<div class="step-image">
|
|
||||||
<img src="./配置窗口-系统配置-浏览器路径选择.png" alt="浏览器驱动路径示意图">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section id="usage" class="section">
|
|
||||||
<h2>使用步骤</h2>
|
|
||||||
<div class="step-container">
|
|
||||||
<div class="step">
|
|
||||||
<div class="step-number"></div>
|
|
||||||
<div class="step-content">
|
|
||||||
<h3>启动工具</h3>
|
|
||||||
<p>双击运行AutoLibrary.exe文件,工具将启动主界面。</p>
|
|
||||||
<div class="info">
|
|
||||||
<strong>提示:</strong>软件首次启动,未初始化配置文件,直接运行脚本会提示失败。
|
|
||||||
</div>
|
|
||||||
<div class="step-image">
|
|
||||||
<img src="./运行主界面.png" alt="运行主界面">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="step">
|
|
||||||
<div class="step-number"></div>
|
|
||||||
<div class="step-content">
|
|
||||||
<h3>配置工具</h3>
|
|
||||||
<p>对于不同用户的需求,你可以使用两种不同的方式来配置工具</p>
|
|
||||||
<p>1. 使用界面配置:点击主界面窗口右上角的配置按钮,打开配置窗口。</p>
|
|
||||||
<div id="use-ui" class="tabs-container">
|
|
||||||
<div class="tab-buttons">
|
|
||||||
<button class="tab-button active" data-tab="user-config">用户配置</button>
|
|
||||||
<button class="tab-button" data-tab="system-config">系统配置</button>
|
|
||||||
<button class="tab-button" data-tab="other-config">其它</button>
|
|
||||||
</div>
|
|
||||||
<div class="tab-content">
|
|
||||||
<div id="user-config" class="tab-pane active">
|
|
||||||
<div class="step-image">
|
|
||||||
<img src="./配置窗口-用户配置.png" alt="配置窗口-用户配置">
|
|
||||||
</div>
|
|
||||||
<div class="info">
|
|
||||||
<strong>提示:</strong>初次运行软件时,用户配置默认为空,需要手动添加。
|
|
||||||
</div>
|
|
||||||
<h4>用户列表</h4>
|
|
||||||
<p>用户列表显示当前配置文件中的所有用户,你可以添加、删除用户。选中用户项以进行详细的配置。</p>
|
|
||||||
<h4>用户信息</h4>
|
|
||||||
<ol>
|
|
||||||
<p><i>-学号:</i>用户的学号。</p>
|
|
||||||
<p><i>-密码:</i>用户的密码,用户默认密码为000000。</p>
|
|
||||||
</ol>
|
|
||||||
<h4>预约信息</h4>
|
|
||||||
<ol>
|
|
||||||
<p><i>-日期(YYYY-MM-DD):</i>座位预约日期,默认显示当前日期,无法更改(图书馆19:00-23:00可以预约第二天座位,软件将在18:00-23:00允许用户选择第二天的日期)。</p>
|
|
||||||
<p><i>-地点:</i>预约座位的地点,默认值为“图书馆”。</p>
|
|
||||||
<p><i>-楼层:</i>预约座位的楼层,默认值为“二层”。</p>
|
|
||||||
<p><i>-区域:</i>预约座位的区域,默认值为“二层内环”。</p>
|
|
||||||
<p><i>-座位号:</i>预约座位的座位号。</p>
|
|
||||||
<p><i>-开始时间(HH:mm):</i>预约座位的开始时间,默认值为当前时间,可选时间范围为7:30-23:30。</p>
|
|
||||||
<p><i>-结束时间(HH:mm):</i>预约座位的结束时间,默认值为当前时间加上两个小时,可选时间范围与开始时间相同。</p>
|
|
||||||
<p><i>-最大时间偏差(分钟):</i>选择的开始/结束时间不可用时,会按照该时间偏差范围寻找最近的可用时间。选择0则表示严格按照选择的时间预约,可选范围为0-120分钟。</p>
|
|
||||||
<p><i>-优先选择最早/晚:</i>当预约时间列表中存在多个相距最近的可用时间时,选择最早(开始时间)/最晚(结束时间)的时间,不勾选将会按照脚本默认行为选择。</p>
|
|
||||||
<p><i>-期望时长(小时):</i>预约座位的期望时长,默认值为“2小时”,可选范围为0-8小时。</p>
|
|
||||||
<p><i>-优先满足期望时长:</i>勾选此项,会优先满足预约时长限制,当座位紧张时可能会导致预约失败。</p>
|
|
||||||
</ol>
|
|
||||||
</div>
|
|
||||||
<div id="system-config" class="tab-pane">
|
|
||||||
<div class="step-image">
|
|
||||||
<img src="./配置窗口-系统配置.png" alt="配置窗口-系统配置">
|
|
||||||
</div>
|
|
||||||
<h4>图书馆设置</h4>
|
|
||||||
<p>这里主要包含了关于图书馆的访问网址设置,不需要更改。</p>
|
|
||||||
<h4>浏览器设置</h4>
|
|
||||||
<p>主要包含浏览器类别选择(当前支持Edge Chromium和Mozilla Firefox),浏览器驱动路径选择以及无头模式设置。</p>
|
|
||||||
<ol>
|
|
||||||
<p><i>-浏览器类别:</i>选择您使用的浏览器类别(Edge Chromium或Mozilla Firefox)。</p>
|
|
||||||
<p><i>-浏览器驱动路径:</i>点击浏览按钮选择对应浏览器类型和版本的浏览器驱动程序的路径。</p>
|
|
||||||
<p><i>-无头模式:</i>如果您不希望看到浏览器窗口自动操作,可将无头模式设置为true。</p>
|
|
||||||
</ol>
|
|
||||||
<h4>登录设置</h4>
|
|
||||||
<ol>
|
|
||||||
<p><i>-自动识别验证码:</i>默认勾选。</p>
|
|
||||||
<p><i>-登录尝试次数:</i>设置登录尝试的最大次数,默认值为3次。</p>
|
|
||||||
</ol>
|
|
||||||
<h4>运行模式</h4>
|
|
||||||
<ol>
|
|
||||||
<p><i>-自动预约:</i>脚本按照配置中起始时间和预期时长进行预约,用户如果当天存在有效预约,将自动跳过预约步骤。</p>
|
|
||||||
<p><i>-自动签到:</i>如果用户在脚本启动时满足图书馆预约条件,将自动签到,如果用户当天无有效预约或不在可签到时间内,则自动跳过。</p>
|
|
||||||
<p><i>-自动续约:</i>如果用户在脚本启动时满足图书馆预约条件,将自动续约,如果用户当天无有效预约或不在可续约时间内,则自动跳过。</p>
|
|
||||||
</ol>
|
|
||||||
</div>
|
|
||||||
<div id="other-config" class="tab-pane">
|
|
||||||
<div class="step-image">
|
|
||||||
<img src="./配置窗口-其它.png" alt="配置窗口-其它">
|
|
||||||
</div>
|
|
||||||
<h4>当前配置:</h4>
|
|
||||||
<p>这里主要显示脚本当前使用的系统配置文件和用户配置文件的路径。你可以使用右侧浏览按钮选择新的配置文件路径。</p>
|
|
||||||
<h4>导出配置:</h4>
|
|
||||||
<p>选择导出配置文件的目标路径和文件名,点击‘导出配置文件’按钮,将当前的配置项导出。</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<p>2. 使用配置文件:在脚本可执行文件的根目录创建系统配置文件system.json和用户配置文件users.json。</p>
|
|
||||||
<div id="use-file" class="tabs-container">
|
|
||||||
<div class="tab-buttons">
|
|
||||||
<div class="tab-button active" data-tab="system.config">系统配置文件</div>
|
|
||||||
<div class="tab-button" data-tab="users.config">用户配置文件</div>
|
|
||||||
</div>
|
|
||||||
<div class="tab-content">
|
|
||||||
<div id="system.config" class="tab-pane active">
|
|
||||||
<p>system.json文件控制工具的基本运行参数:</p>
|
|
||||||
<div class="code-block">
|
|
||||||
{
|
|
||||||
<span class="property">"library"</span>: {
|
|
||||||
<span class="property">"host_url"</span>: <span class="string">"http://10.1.20.7"</span>,
|
|
||||||
<span class="property">"login_url"</span>: <span class="string">"/login"</span>
|
|
||||||
},
|
|
||||||
<span class="property">"mode"</span>: {
|
|
||||||
<span class="property">"run_mode"</span>: <span class="number">1</span>
|
|
||||||
},
|
|
||||||
<span class="property">"login"</span>: {
|
|
||||||
<span class="property">"auto_captcha"</span>: <span class="bool">true</span>,
|
|
||||||
<span class="property">"max_attempt"</span>: <span class="number">3</span>
|
|
||||||
},
|
|
||||||
<span class="property">"web_driver"</span>: {
|
|
||||||
<span class="property">"driver_type"</span>: <span class="string">"edge"</span>,
|
|
||||||
<span class="property">"driver_path"</span>: <span class="string">"msedgedriver.exe"</span>,
|
|
||||||
<span class="property">"headless"</span>: <span class="bool">false</span>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<h4>参数说明</h4>
|
|
||||||
<ol>
|
|
||||||
<p><strong>library/host_url</strong>: 图书馆主机URL,无需更改。</p>
|
|
||||||
<p><strong>library/login_url</strong>: 登录页面URL,无需更改。</p>
|
|
||||||
<p><strong>mode/run_mode</strong>: 运行模式,可组合使用(+1:自动预约/+2:自动签到/+4:自动续约)</p>
|
|
||||||
<p><strong>login/auto_captcha</strong>: 自动验证码识别,建议保持true</p>
|
|
||||||
<p><strong>login/max_attempt</strong>: 登录尝试次数,默认3次</p>
|
|
||||||
<p><strong>web_driver/driver_type</strong>: 浏览器类型(edge/chrome/firefox)</p>
|
|
||||||
<p><strong>web_driver/driver_path</strong>: 驱动文件路径</p>
|
|
||||||
<p><strong>web_driver/headless</strong>: 无头模式,默认false运行时显示浏览器窗口</p>
|
|
||||||
</ol>
|
|
||||||
</div>
|
|
||||||
<div id="users.config" class="tab-pane">
|
|
||||||
<p>users.json文件控制用户的预约和签到参数:</p>
|
|
||||||
<div class="code-block">
|
|
||||||
{
|
|
||||||
<span class="property">"users"</span>: [
|
|
||||||
{
|
|
||||||
<span class="property">"username"</span>: <span class="string">"您的学号"</span>,
|
|
||||||
<span class="property">"password"</span>: <span class="string">"您的密码"</span>,
|
|
||||||
<span class="property">"reserve_info"</span>: {
|
|
||||||
<span class="property">"date"</span>: <span class="string">"2025-10-30"</span>,
|
|
||||||
<span class="property">"place"</span>: <span class="string">"1"</span>,
|
|
||||||
<span class="property">"floor"</span>: <span class="string">"4"</span>,
|
|
||||||
<span class="property">"room"</span>: <span class="string">"5"</span>,
|
|
||||||
<span class="property">"begin_time"</span>: {
|
|
||||||
<span class="property">"time"</span>: <span class="string">"09:30"</span>,
|
|
||||||
<span class="property">"max_diff"</span>: <span class="number">30</span>,
|
|
||||||
<span class="property">"prefer_early"</span>: <span class="bool">true</span>
|
|
||||||
},
|
|
||||||
<span class="property">"end_time"</span>: {
|
|
||||||
<span class="property">"time"</span>: <span class="string">"21:23"</span>,
|
|
||||||
<span class="property">"max_diff"</span>: <span class="number">30</span>,
|
|
||||||
<span class="property">"prefer_early"</span>: <span class="bool">false</span>
|
|
||||||
},
|
|
||||||
<span class="property">"seat_id"</span>: <span class="string">"31A"</span>,
|
|
||||||
<span class="property">"expect_duration"</span>: <span class="number">6</span>
|
|
||||||
<span class="property">"satisfy_duration"</span>: <span class="bool">true</span>
|
|
||||||
}
|
|
||||||
},
|
|
||||||
/* 可以添加多个上述的配置块,每个用户预约信息独立配置 */
|
|
||||||
]
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<h4>参数说明</h4>
|
|
||||||
<ol>
|
|
||||||
<p><strong>username</strong>: 学号</p>
|
|
||||||
<p><strong>password</strong>: 密码</p>
|
|
||||||
<p><strong>reserve_info/date</strong>: 预约日期(格式:YYYY-MM-DD)</p>
|
|
||||||
<p><strong>reserve_info/place</strong>: 图书馆或者字符“1”</p>
|
|
||||||
<p><strong>reserve_info/floor</strong>: 预约楼层(“2”:二层,“3”:三层,“4”:四层,“5”:五层)</p>
|
|
||||||
<p><strong>reserve_info/room</strong>: 预约房间()</p>
|
|
||||||
<p><strong>reserve_info/seat_id</strong>: 座位编号(例如:“12A/12a/012A/012a”)</p>
|
|
||||||
<p><strong>reserve_info/begin_time</strong>: 预约开始时间(格式:HH:mm)</p>
|
|
||||||
<p><strong>reserve_info/begin_time/max_diff</strong>: 最大时间差(分钟)</p>
|
|
||||||
<p><strong>reserve_info/begin_time/prefer_early</strong>: 是否优先预约较早时间(默认true)</p>
|
|
||||||
<p><strong>reserve_info/end_time</strong>: 预约结束时间(格式:HH:mm)</p>
|
|
||||||
<p><strong>reserve_info/end_time/max_diff</strong>: 最大时间差(分钟)</p>
|
|
||||||
<p><strong>reserve_info/end_time/prefer_early</strong>: 是否优先预约较早时间(默认true)</p>
|
|
||||||
<p><strong>reserve_info/expect_duration</strong>: 期望使用时长(小时)</p>
|
|
||||||
<p><strong>reserve_info/satisfy_duration</strong>: 是否满足期望时长(默认true)</p>
|
|
||||||
</ol>
|
|
||||||
<div class="info">
|
|
||||||
<strong>提示:</strong> 可以添加多个用户,工具会按顺序处理每个用户的预约请求。
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="step">
|
|
||||||
<div class="step-number"></div>
|
|
||||||
<div class="step-content">
|
|
||||||
<h3>监控运行状态</h3>
|
|
||||||
<p>如果系统设置中没有勾选浏览器无头模式运行,工具会在运行过程中打开浏览器窗口,显示自动运行过程。</p>
|
|
||||||
<p>除此之外,你还可以通过软件的运行日志输出区域查看详细的运行状态和错误信息。</p>
|
|
||||||
<div class="step-image">
|
|
||||||
<img src="./监控运行状态-运行图.png" alt="监控运行状态">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="step">
|
|
||||||
<div class="step-number"></div>
|
|
||||||
<div class="step-content">
|
|
||||||
<h3>查看运行结果</h3>
|
|
||||||
<p>软件运行结束后日志会显示本次运行结果:“处理完成, 共计 n 个用户, 成功 n 个用户, 失败 m 个用户”。</p>
|
|
||||||
<div class="step-image">
|
|
||||||
<img src="./监控运行状态-运行结果.png" alt="查看运行结果">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section id="features" class="section">
|
|
||||||
<h2>功能介绍</h2>
|
|
||||||
<div class="feature-grid">
|
|
||||||
<div class="feature-card">
|
|
||||||
<div class="feature-icon">⏰</div>
|
|
||||||
<h3>自动预约</h3>
|
|
||||||
<p>如果用户当前没有有效预约时,工具会自动为您预约指定座位。</p>
|
|
||||||
<div class="info">
|
|
||||||
<strong>适用场景:</strong> 提前预约第二天的座位
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="feature-card">
|
|
||||||
<div class="feature-icon">✅</div>
|
|
||||||
<h3>自动签到</h3>
|
|
||||||
<p>如果用户当前已有预约,且在可签到时间范围(开始时间的前后30分钟)内,工具会自动完成签到。</p>
|
|
||||||
<div class="info">
|
|
||||||
<strong>适用场景:</strong> 因忘记签到而导致失约,影响正常使用
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="feature-card">
|
|
||||||
<div class="feature-icon">🔄</div>
|
|
||||||
<h3>自动续约</h3>
|
|
||||||
<p>如果用户当前正在使用座位,且到达可续约时间(结束时间前的120分钟),工具会自动延长使用时间。</p>
|
|
||||||
<div class="info">
|
|
||||||
<strong>适用场景:</strong> 需要长时间使用座位
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<h3>模式组合使用</h3>
|
|
||||||
<p>运行模式可以组合使用,只需在配置窗口中勾选对应模式即可:</p>
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<ol><strong>自动预约 + 自动签到 + 自动续约(推荐)</strong></ol>
|
|
||||||
<ol>自动预约</ol>
|
|
||||||
<ol>自动预约 + 自动签到</ol>
|
|
||||||
</ul>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section id="troubleshooting" class="section">
|
|
||||||
<h2>故障排除</h2>
|
|
||||||
<h3>常见问题及解决方法</h3>
|
|
||||||
|
|
||||||
<div class="faq-item">
|
|
||||||
<div class="faq-question">工具启动时报错"无法找到驱动/Unable to obtain driver"等类似报错信息</div>
|
|
||||||
<div class="faq-answer">
|
|
||||||
<p>这是大概率是因为浏览器驱动未正确安装或版本不匹配。</p>
|
|
||||||
<ul>
|
|
||||||
<ol>1,检查驱动文件是否放置在正确位置</ol>
|
|
||||||
<ol>2,确认驱动版本与浏览器版本完全匹配,例如:Chrome浏览器需要对应版本的chromedriver.exe,切勿混用</ol>
|
|
||||||
<ol>3,尝试重新下载并安装驱动</ol>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="faq-item">
|
|
||||||
<div class="faq-question">登录失败,提示账号密码错误</div>
|
|
||||||
<div class="faq-answer">
|
|
||||||
<p>请检查配置界面中的账号密码是否正确。</p>
|
|
||||||
<ul>
|
|
||||||
<ol>1,确认学号和密码无误</ol>
|
|
||||||
<ol>2,检查是否有不支持的特殊字符需要转义</ol>
|
|
||||||
<ol>3,尝试手动登录图书馆系统确认账号可用</ol>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="faq-item">
|
|
||||||
<div class="faq-question">预约失败,提示座位不可用</div>
|
|
||||||
<div class="faq-answer">
|
|
||||||
<p>目标座位可能已被他人预约或不在可预约时间。</p>
|
|
||||||
<ul>
|
|
||||||
<ol>1,确认座位编号是否正确,是否在该楼层指定区域</ol>
|
|
||||||
<ol>2,尝试预约其它座位或调整预约时间,例如调整允许的开始或结束时间的最大偏差,位置紧张情况下可以让脚本根据允许的时间范围选择最佳起始时间</ol>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section id="faq" class="section">
|
|
||||||
<h2>常见问题</h2>
|
|
||||||
|
|
||||||
<div class="faq-item">
|
|
||||||
<div class="faq-question">使用AutoLibrary是否安全?</div>
|
|
||||||
<div class="faq-answer">
|
|
||||||
<p>AutoLibrary完全模拟人工操作,不干扰图书馆系统正常运行。工具不会收集或上传您的个人信息,所有数据仅保存在本地配置文件中。</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="faq-item">
|
|
||||||
<div class="faq-question">可以同时预约多个座位吗?</div>
|
|
||||||
<div class="faq-answer">
|
|
||||||
<p>根据图书馆规定,每个账号同一时间段只能预约一个座位。但您可以在配置界面中添加多个账号,工具会依次处理每个账号的预约请求。</p>
|
|
||||||
<div class="important">
|
|
||||||
<p><strong>重要:</strong>本工具软件旨在简化并辅助用户正常使用时的图书馆服务流程,请勿滥用影响他人及图书馆正常运行。</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="faq-item">
|
|
||||||
<div class="faq-question">工具运行期间可以操作电脑吗?</div>
|
|
||||||
<div class="faq-answer">
|
|
||||||
<p>可以正常使用电脑,但请勿操作工具自动打开的浏览器窗口,否则可能会干扰工具的正常运行。</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section id="download" class="section">
|
|
||||||
<h2>下载安装</h2>
|
|
||||||
<div class="download-section">
|
|
||||||
<h3>获取AutoLibrary</h3>
|
|
||||||
<p>点击下方按钮下载最新版本的AutoLibrary压缩包:</p>
|
|
||||||
<a href="#" class="btn">下载 AutoLibrary alpha-v0.03</a>
|
|
||||||
<div class="info" style="margin-top: 1.5rem;">
|
|
||||||
<p>文件大小:约98MB</p>
|
|
||||||
<p>系统要求:Windows 10/11,支持Edge/Chrome/Firefox浏览器</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<h3>安装步骤</h3>
|
|
||||||
<ol>
|
|
||||||
<ol>下载压缩包并解压到任意文件夹</ol>
|
|
||||||
<ol>根据您使用的浏览器下载对应版本的驱动</ol>
|
|
||||||
<ol>按照本手册说明配置账号密码等参数</ol>
|
|
||||||
<ol>点击启动脚本,即可开始自动预约和使用座位</ol>
|
|
||||||
</ol>
|
|
||||||
</section>
|
|
||||||
</main>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
|
||||||
document.querySelectorAll('.sidebar-nav a').forEach(link => {
|
|
||||||
link.addEventListener('click', function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
document.querySelectorAll('.sidebar-nav a').forEach(a => {
|
|
||||||
a.classList.remove('active');
|
|
||||||
});
|
|
||||||
this.classList.add('active');
|
|
||||||
|
|
||||||
const targetId = this.getAttribute('href');
|
|
||||||
const targetSection = document.querySelector(targetId);
|
|
||||||
|
|
||||||
if (targetSection) {
|
|
||||||
targetSection.scrollIntoView({
|
|
||||||
behavior: 'smooth',
|
|
||||||
block: 'start'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
document.querySelectorAll('.tabs-container').forEach(container => {
|
|
||||||
const tabButtons = container.querySelectorAll('.tab-button');
|
|
||||||
const tabPanes = container.querySelectorAll('.tab-pane');
|
|
||||||
|
|
||||||
tabButtons.forEach(button => {
|
|
||||||
button.addEventListener('click', function() {
|
|
||||||
const containerButtons = this.closest('.tabs-container').querySelectorAll('.tab-button');
|
|
||||||
const containerPanes = this.closest('.tabs-container').querySelectorAll('.tab-pane');
|
|
||||||
|
|
||||||
containerButtons.forEach(btn => {
|
|
||||||
btn.classList.remove('active');
|
|
||||||
});
|
|
||||||
this.classList.add('active');
|
|
||||||
|
|
||||||
const tabId = this.getAttribute('data-tab');
|
|
||||||
|
|
||||||
containerPanes.forEach(pane => {
|
|
||||||
pane.classList.remove('active');
|
|
||||||
});
|
|
||||||
|
|
||||||
document.getElementById(tabId).classList.add('active');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
document.querySelectorAll('.faq-question').forEach(question => {
|
|
||||||
question.addEventListener('click', function() {
|
|
||||||
const faqItem = this.parentElement;
|
|
||||||
faqItem.classList.toggle('active');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
const sections = document.querySelectorAll('.section');
|
|
||||||
const navLinks = document.querySelectorAll('.sidebar-nav a');
|
|
||||||
|
|
||||||
const observerOptions = {
|
|
||||||
root: null,
|
|
||||||
rootMargin: '-45% 0px -45% 0px',
|
|
||||||
threshold: 0
|
|
||||||
};
|
|
||||||
|
|
||||||
const observer = new IntersectionObserver((entries) => {
|
|
||||||
entries.forEach(entry => {
|
|
||||||
if (entry.isIntersecting) {
|
|
||||||
const id = entry.target.getAttribute('id');
|
|
||||||
|
|
||||||
navLinks.forEach(link => {
|
|
||||||
link.classList.remove('active');
|
|
||||||
});
|
|
||||||
|
|
||||||
const activeLink = document.querySelector(`.sidebar-nav a[href="#${id}"]`);
|
|
||||||
if (activeLink) {
|
|
||||||
activeLink.classList.add('active');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}, observerOptions);
|
|
||||||
|
|
||||||
sections.forEach(section => {
|
|
||||||
observer.observe(section);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
For more infomation, please visit our website: https://www.autolibrary.cv
|
||||||
|
Before Width: | Height: | Size: 852 KiB |
|
Before Width: | Height: | Size: 1.1 MiB |
|
Before Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 42 KiB |
|
Before Width: | Height: | Size: 64 KiB |
|
Before Width: | Height: | Size: 51 KiB |
|
Before Width: | Height: | Size: 49 KiB |
@@ -261,21 +261,18 @@ class ALConfigWidget(QWidget, Ui_ALConfigWidget):
|
|||||||
self.UsernameEdit.setText("")
|
self.UsernameEdit.setText("")
|
||||||
self.PasswordEdit.setText("")
|
self.PasswordEdit.setText("")
|
||||||
self.UserListWidget.setSortingEnabled(True)
|
self.UserListWidget.setSortingEnabled(True)
|
||||||
self.PasswordEdit.setEchoMode(QLineEdit.Password)
|
self.PasswordEdit.setEchoMode(QLineEdit.EchoMode.Password)
|
||||||
self.ShowPasswordCheckBox.setChecked(False)
|
self.ShowPasswordCheckBox.setChecked(False)
|
||||||
self.FloorComboBox.setCurrentIndex(1) # use for the '__init__' to effect the signal
|
|
||||||
self.FloorComboBox.setCurrentIndex(0)
|
self.FloorComboBox.setCurrentIndex(0)
|
||||||
|
self.onFloorComboBoxCurrentIndexChanged()
|
||||||
self.DateEdit.setDate(QDate.currentDate())
|
self.DateEdit.setDate(QDate.currentDate())
|
||||||
self.DateEdit.setMinimumDate(QDate.currentDate())
|
self.DateEdit.setMinimumDate(QDate.currentDate())
|
||||||
self.DateEdit.setMaximumDate(QDate.currentDate())
|
|
||||||
if QTime.currentTime() > QTime(18, 0, 0) and QTime.currentTime() < QTime(23, 0, 0):
|
|
||||||
self.DateEdit.setMaximumDate(QDate.currentDate().addDays(1))
|
|
||||||
self.BeginTimeEdit.setTime(QTime.currentTime())
|
self.BeginTimeEdit.setTime(QTime.currentTime())
|
||||||
self.PreferEarlyBeginTimeCheckBox.setChecked(False)
|
self.PreferEarlyBeginTimeCheckBox.setChecked(False)
|
||||||
self.MaxBeginTimeDiffSpinBox.setValue(10)
|
self.MaxBeginTimeDiffSpinBox.setValue(30)
|
||||||
self.EndTimeEdit.setTime(QTime.currentTime().addSecs(120*60))
|
self.EndTimeEdit.setTime(QTime.currentTime().addSecs(120*60))
|
||||||
self.PreferLateEndTimeCheckBox.setChecked(False)
|
self.PreferLateEndTimeCheckBox.setChecked(False)
|
||||||
self.MaxEndTimeDiffSpinBox.setValue(10)
|
self.MaxEndTimeDiffSpinBox.setValue(30)
|
||||||
self.ExpectDurationSpinBox.setValue(self.BeginTimeEdit.time().secsTo(self.EndTimeEdit.time())/3600)
|
self.ExpectDurationSpinBox.setValue(self.BeginTimeEdit.time().secsTo(self.EndTimeEdit.time())/3600)
|
||||||
self.SatisfyDurationCheckBox.setChecked(False)
|
self.SatisfyDurationCheckBox.setChecked(False)
|
||||||
|
|
||||||
@@ -528,12 +525,12 @@ class ALConfigWidget(QWidget, Ui_ALConfigWidget):
|
|||||||
"seat_id": "",
|
"seat_id": "",
|
||||||
"begin_time": {
|
"begin_time": {
|
||||||
"time": f"{QTime.currentTime().toString("hh:mm")}",
|
"time": f"{QTime.currentTime().toString("hh:mm")}",
|
||||||
"max_diff": 0,
|
"max_diff": 30,
|
||||||
"prefer_early": False
|
"prefer_early": False
|
||||||
},
|
},
|
||||||
"end_time": {
|
"end_time": {
|
||||||
"time": f"{QTime.currentTime().addSecs(2*3600).toString("hh:mm")}",
|
"time": f"{QTime.currentTime().addSecs(2*3600).toString("hh:mm")}",
|
||||||
"max_diff": 0,
|
"max_diff": 30,
|
||||||
"prefer_early": True
|
"prefer_early": True
|
||||||
},
|
},
|
||||||
"expect_duration": 2.0,
|
"expect_duration": 2.0,
|
||||||
@@ -621,7 +618,7 @@ class ALConfigWidget(QWidget, Ui_ALConfigWidget):
|
|||||||
browser_driver_path = QFileDialog.getOpenFileName(
|
browser_driver_path = QFileDialog.getOpenFileName(
|
||||||
self,
|
self,
|
||||||
"选择浏览器驱动 - AutoLibrary",
|
"选择浏览器驱动 - AutoLibrary",
|
||||||
self.CurrentSystemConfigEdit.text(),
|
self.BrowseBrowserDriverEdit.text(),
|
||||||
"可执行文件 (*.exe);;所有文件 (*)"
|
"可执行文件 (*.exe);;所有文件 (*)"
|
||||||
)[0]
|
)[0]
|
||||||
if browser_driver_path:
|
if browser_driver_path:
|
||||||
@@ -700,10 +697,11 @@ class ALConfigWidget(QWidget, Ui_ALConfigWidget):
|
|||||||
users_config_path = self.ExportUserConfigEdit.text()
|
users_config_path = self.ExportUserConfigEdit.text()
|
||||||
if system_config_path:
|
if system_config_path:
|
||||||
if self.saveConfigs(
|
if self.saveConfigs(
|
||||||
system_config_path,
|
system_config_path, ""
|
||||||
users_config_path=""
|
|
||||||
):
|
):
|
||||||
msg += f"系统配置文件已导出到: \n'{system_config_path}'\n"
|
msg += f"系统配置文件已导出到: \n'{system_config_path}'\n"
|
||||||
|
else:
|
||||||
|
msg += f"系统配置文件导出失败: \n'{system_config_path}'\n"
|
||||||
if users_config_path:
|
if users_config_path:
|
||||||
if self.saveConfigs(
|
if self.saveConfigs(
|
||||||
"", users_config_path
|
"", users_config_path
|
||||||
@@ -712,7 +710,7 @@ class ALConfigWidget(QWidget, Ui_ALConfigWidget):
|
|||||||
if msg:
|
if msg:
|
||||||
QMessageBox.information(
|
QMessageBox.information(
|
||||||
self,
|
self,
|
||||||
"信息 - AutoLibrary",
|
"提示 - AutoLibrary",
|
||||||
msg
|
msg
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -232,8 +232,8 @@
|
|||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>5</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="2" column="0">
|
||||||
<widget class="QLabel" name="UsernameKabel">
|
<widget class="QLabel" name="PasswordLabel">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>100</width>
|
<width>100</width>
|
||||||
@@ -247,7 +247,7 @@
|
|||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>用户名:</string>
|
<string>密码:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -299,25 +299,6 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QLabel" name="PasswordLabel">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>100</width>
|
|
||||||
<height>25</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>100</width>
|
|
||||||
<height>25</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>密码:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QLineEdit" name="UsernameEdit">
|
<widget class="QLineEdit" name="UsernameEdit">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
@@ -340,6 +321,25 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="UsernameKabel">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>25</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>25</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>用户名:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -376,8 +376,65 @@
|
|||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>5</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="4" column="4">
|
<item row="0" column="1">
|
||||||
<widget class="QLineEdit" name="SeatIDEdit">
|
<widget class="QLabel" name="DateLabel">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>25</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>25</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>日期:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="7" column="1">
|
||||||
|
<widget class="QLabel" name="MaxBeginTimeDiffLabel">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>25</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>25</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>最大时长偏差:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QLabel" name="PlaceLabel">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>25</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>25</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>地点:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="12" column="4">
|
||||||
|
<widget class="QDoubleSpinBox" name="ExpectDurationSpinBox">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>0</width>
|
||||||
@@ -390,6 +447,40 @@
|
|||||||
<height>25</height>
|
<height>25</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p><br/></p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<double>8.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="stepType">
|
||||||
|
<enum>QAbstractSpinBox::StepType::AdaptiveDecimalStepType</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="11" column="4">
|
||||||
|
<widget class="QCheckBox" name="PreferLateEndTimeCheckBox">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>25</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>25</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>勾选此项,如果有多个与目标<span style=" font-weight:700; font-style:italic;">结束时间</span>相近的可选时间,选择时间最晚项</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>优先选择最晚</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="9" column="1">
|
<item row="9" column="1">
|
||||||
@@ -411,11 +502,27 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="4">
|
<item row="5" column="1">
|
||||||
<widget class="QComboBox" name="PlaceComboBox">
|
<widget class="QLabel" name="BeginTimeLabel">
|
||||||
<property name="enabled">
|
<property name="minimumSize">
|
||||||
<bool>false</bool>
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>25</height>
|
||||||
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>25</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>开始时间:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="4">
|
||||||
|
<widget class="QComboBox" name="FloorComboBox">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>0</width>
|
||||||
@@ -430,13 +537,28 @@
|
|||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>图书馆</string>
|
<string>二层</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>三层</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>四层</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>五层</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="12" column="1">
|
<item row="10" column="1">
|
||||||
<widget class="QLabel" name="ExpectDurationLabel">
|
<widget class="QLabel" name="MaxEndTimeDiffLabel">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>100</width>
|
<width>100</width>
|
||||||
@@ -450,7 +572,7 @@
|
|||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>期望时长:</string>
|
<string>最大时长偏差:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -487,8 +609,34 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="0" column="4">
|
||||||
<widget class="QLabel" name="DateLabel">
|
<widget class="QDateEdit" name="DateEdit">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>25</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>25</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="calendarPopup">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="date">
|
||||||
|
<date>
|
||||||
|
<year>2025</year>
|
||||||
|
<month>11</month>
|
||||||
|
<day>1</day>
|
||||||
|
</date>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="12" column="1">
|
||||||
|
<widget class="QLabel" name="ExpectDurationLabel">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>100</width>
|
<width>100</width>
|
||||||
@@ -502,7 +650,26 @@
|
|||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>日期:</string>
|
<string>期望时长:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QLabel" name="RoomLabel">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>25</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>25</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>区域:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -546,6 +713,99 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="13" column="4">
|
||||||
|
<widget class="QCheckBox" name="SatisfyDurationCheckBox">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>25</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>25</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>勾选此项,会优先满足预约时长限制,当座位紧张时可能会导致<span style=" font-weight:700; font-style:italic;">预约失败</span></p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>优先满足时长要求</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="7" column="4">
|
||||||
|
<widget class="QSpinBox" name="MaxBeginTimeDiffSpinBox">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>25</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>25</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>期望的<span style=" font-weight:700; font-style:italic;">开始时间</span>不可用时,按照该偏差范围寻找最近可选时间</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>120</number>
|
||||||
|
</property>
|
||||||
|
<property name="stepType">
|
||||||
|
<enum>QAbstractSpinBox::StepType::AdaptiveDecimalStepType</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QLabel" name="FloorLabel">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>25</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>25</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>楼层:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="4">
|
||||||
|
<widget class="QComboBox" name="PlaceComboBox">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>25</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>25</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>图书馆</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="8" column="4">
|
<item row="8" column="4">
|
||||||
<widget class="QCheckBox" name="PreferEarlyBeginTimeCheckBox">
|
<widget class="QCheckBox" name="PreferEarlyBeginTimeCheckBox">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
@@ -571,25 +831,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="10" column="1">
|
|
||||||
<widget class="QLabel" name="MaxEndTimeDiffLabel">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>100</width>
|
|
||||||
<height>25</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>100</width>
|
|
||||||
<height>25</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>最大时长偏差:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="10" column="4">
|
<item row="10" column="4">
|
||||||
<widget class="QSpinBox" name="MaxEndTimeDiffSpinBox">
|
<widget class="QSpinBox" name="MaxEndTimeDiffSpinBox">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
@@ -610,61 +851,9 @@
|
|||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<number>120</number>
|
<number>120</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
<property name="stepType">
|
||||||
</item>
|
<enum>QAbstractSpinBox::StepType::AdaptiveDecimalStepType</enum>
|
||||||
<item row="3" column="1">
|
|
||||||
<widget class="QLabel" name="RoomLabel">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>100</width>
|
|
||||||
<height>25</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>100</width>
|
|
||||||
<height>25</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>区域:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="4">
|
|
||||||
<widget class="QComboBox" name="FloorComboBox">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>25</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>16777215</width>
|
|
||||||
<height>25</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>二层</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>三层</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>四层</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>五层</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="4">
|
<item row="3" column="4">
|
||||||
@@ -683,91 +872,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="4">
|
|
||||||
<widget class="QSpinBox" name="MaxBeginTimeDiffSpinBox">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>100</width>
|
|
||||||
<height>25</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>16777215</width>
|
|
||||||
<height>25</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string><html><head/><body><p>期望的<span style=" font-weight:700; font-style:italic;">开始时间</span>不可用时,按照该偏差范围寻找最近可选时间</p></body></html></string>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>120</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="11" column="4">
|
|
||||||
<widget class="QCheckBox" name="PreferLateEndTimeCheckBox">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>25</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>16777215</width>
|
|
||||||
<height>25</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string><html><head/><body><p>勾选此项,如果有多个与目标<span style=" font-weight:700; font-style:italic;">结束时间</span>相近的可选时间,选择时间最晚项</p></body></html></string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>优先选择最晚</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="1">
|
|
||||||
<widget class="QLabel" name="BeginTimeLabel">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>100</width>
|
|
||||||
<height>25</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>100</width>
|
|
||||||
<height>25</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>开始时间:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QLabel" name="FloorLabel">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>100</width>
|
|
||||||
<height>25</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>100</width>
|
|
||||||
<height>25</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>楼层:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="1">
|
<item row="4" column="1">
|
||||||
<widget class="QLabel" name="SeatIDLabel">
|
<widget class="QLabel" name="SeatIDLabel">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
@@ -787,8 +891,10 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="12" column="4">
|
<item row="4" column="4">
|
||||||
<widget class="QDoubleSpinBox" name="ExpectDurationSpinBox">
|
<layout class="QHBoxLayout" name="SeatIDLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="SeatIDEdit">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>0</width>
|
||||||
@@ -797,103 +903,38 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>16777215</width>
|
<width>130</width>
|
||||||
|
<height>25</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="SelectSeatsButton">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>25</width>
|
||||||
|
<height>25</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>25</width>
|
||||||
<height>25</height>
|
<height>25</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p>期望的预约时长,脚本会尽量满足</p></body></html></string>
|
<string><html><head/><body><p>查询座位布局</p></body></html></string>
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<double>8.000000000000000</double>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="4">
|
|
||||||
<widget class="QDateEdit" name="DateEdit">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>25</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>16777215</width>
|
|
||||||
<height>25</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="date">
|
|
||||||
<date>
|
|
||||||
<year>2025</year>
|
|
||||||
<month>11</month>
|
|
||||||
<day>1</day>
|
|
||||||
</date>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="7" column="1">
|
|
||||||
<widget class="QLabel" name="MaxBeginTimeDiffLabel">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>100</width>
|
|
||||||
<height>25</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>100</width>
|
|
||||||
<height>25</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>最大时长偏差:</string>
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="edit-find"/>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
</layout>
|
||||||
<widget class="QLabel" name="PlaceLabel">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>100</width>
|
|
||||||
<height>25</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>100</width>
|
|
||||||
<height>25</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>地点:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="13" column="4">
|
|
||||||
<widget class="QCheckBox" name="SatisfyDurationCheckBox">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>25</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>16777215</width>
|
|
||||||
<height>25</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string><html><head/><body><p>勾选此项,会优先满足预约时长限制,当座位紧张时可能会导致<span style=" font-weight:700; font-style:italic;">预约失败</span></p></body></html></string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>优先满足时长要求</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
@@ -1138,7 +1179,7 @@
|
|||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p>详情请参阅根目录中的 manual.html</p></body></html></string>
|
<string><html><head/><body><p>详情请参阅 <a href="https://www.autolibrary.cv/docs/manual_lists.html"><span style=" text-decoration: underline; color:#69fcff;">用户手册</span></a></p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="whatsThis">
|
<property name="whatsThis">
|
||||||
<string><html><head/><body><p><br/></p></body></html></string>
|
<string><html><head/><body><p><br/></p></body></html></string>
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ class AutoLibWorker(QThread):
|
|||||||
self
|
self
|
||||||
):
|
):
|
||||||
|
|
||||||
|
auto_lib = None
|
||||||
try:
|
try:
|
||||||
if not self.checkTimeAvailable():
|
if not self.checkTimeAvailable():
|
||||||
self.showTraceSignal.emit(
|
self.showTraceSignal.emit(
|
||||||
@@ -98,13 +99,14 @@ class AutoLibWorker(QThread):
|
|||||||
ConfigReader(self.__config_paths["system"]),
|
ConfigReader(self.__config_paths["system"]),
|
||||||
ConfigReader(self.__config_paths["users"]),
|
ConfigReader(self.__config_paths["users"]),
|
||||||
)
|
)
|
||||||
auto_lib.close()
|
|
||||||
self.showTraceSignal.emit("AutoLibrary 运行结束")
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.showTraceSignal.emit(
|
self.showTraceSignal.emit(
|
||||||
f"AutoLibrary 运行时发生异常 : {e}"
|
f"AutoLibrary 运行时发生异常 : {e}"
|
||||||
)
|
)
|
||||||
finally:
|
finally:
|
||||||
|
if auto_lib:
|
||||||
|
auto_lib.close()
|
||||||
|
self.showTraceSignal.emit("AutoLibrary 运行结束")
|
||||||
self.finishedSignal.emit()
|
self.finishedSignal.emit()
|
||||||
|
|
||||||
|
|
||||||
@@ -242,6 +244,9 @@ class ALMainWindow(QMainWindow, Ui_ALMainWindow):
|
|||||||
config_paths: dict
|
config_paths: dict
|
||||||
):
|
):
|
||||||
|
|
||||||
|
if self.__alConfigWidget:
|
||||||
|
self.__alConfigWidget.configWidgetCloseSingal.disconnect(self.onConfigWidgetClosed)
|
||||||
|
self.__alConfigWidget.deleteLater()
|
||||||
self.__alConfigWidget = None
|
self.__alConfigWidget = None
|
||||||
self.ConfigButton.setEnabled(True)
|
self.ConfigButton.setEnabled(True)
|
||||||
self.StartButton.setEnabled(True)
|
self.StartButton.setEnabled(True)
|
||||||
@@ -272,6 +277,7 @@ class ALMainWindow(QMainWindow, Ui_ALMainWindow):
|
|||||||
):
|
):
|
||||||
|
|
||||||
self.setControlButtons(False, False, True)
|
self.setControlButtons(False, False, True)
|
||||||
|
if self.__auto_lib_thread is None:
|
||||||
self.__auto_lib_thread = AutoLibWorker(
|
self.__auto_lib_thread = AutoLibWorker(
|
||||||
self.__input_queue,
|
self.__input_queue,
|
||||||
self.__output_queue,
|
self.__output_queue,
|
||||||
@@ -287,9 +293,16 @@ class ALMainWindow(QMainWindow, Ui_ALMainWindow):
|
|||||||
self
|
self
|
||||||
):
|
):
|
||||||
|
|
||||||
if self.__auto_lib_thread and self.__auto_lib_thread.isRunning():
|
if self.__auto_lib_thread:
|
||||||
self.__auto_lib_thread.stop()
|
|
||||||
self.showTrace("正在停止操作......")
|
self.showTrace("正在停止操作......")
|
||||||
|
self.__auto_lib_thread.stop()
|
||||||
|
self.__auto_lib_thread.wait()
|
||||||
|
self.showTrace("操作已停止")
|
||||||
|
self.__auto_lib_thread.showMsgSignal.disconnect(self.showMsg)
|
||||||
|
self.__auto_lib_thread.showTraceSignal.disconnect(self.showTrace)
|
||||||
|
self.__auto_lib_thread.finishedSignal.disconnect(self.onStopButtonClicked)
|
||||||
|
self.__auto_lib_thread.deleteLater()
|
||||||
|
self.__auto_lib_thread = None
|
||||||
self.setControlButtons(True, True, False)
|
self.setControlButtons(True, True, False)
|
||||||
|
|
||||||
@Slot()
|
@Slot()
|
||||||
|
|||||||