Skip to content
This repository was archived by the owner on May 22, 2021. It is now read-only.

Commit 2d1d261

Browse files
committed
update: 1. Update icon 2. Add bat script
1 parent 1aec5d0 commit 2d1d261

File tree

4 files changed

+41
-19
lines changed

4 files changed

+41
-19
lines changed

AutoCheckIn.bat

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
rem AutoCheckIn
2+
setlocal EnableDelayedExpansion
3+
cd %~dp0
4+
python ./index.py
5+
echo "若想使本页面自动关闭的话,编辑 AutoCheckIn.bat 文件,删除或注释 pause 即可"
6+
pause

icon.ico

99.1 KB
Binary file not shown.

icon.png

-2.17 KB
Binary file not shown.

index.py

Lines changed: 35 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,38 +8,54 @@ def toast(title, info):
88
if title is not None:
99
toaster.show_toast(title,
1010
info,
11-
icon_path="icon.png",
12-
duration=10,
11+
icon_path="icon.ico",
12+
duration=3,
1313
threaded=True)
1414

1515

16+
def task(code):
17+
if code is None:
18+
print('code could not be None...')
19+
return
20+
if code == 0:
21+
info = {
22+
"filename": "./checkIn.js",
23+
"tip": "自动签到",
24+
"msg": "msg"
25+
}
26+
elif code == 1:
27+
info = {
28+
"filename": "./index.js",
29+
"tip": "调查问卷",
30+
"msg": "msg1"
31+
}
32+
else:
33+
print('No such code')
34+
return
35+
driver.execute_script(open(info.get("filename"), encoding='utf-8').read())
36+
time.sleep(2)
37+
msg = driver.find_element_by_class_name('foot').get_attribute(info.get("msg"))
38+
print(msg)
39+
msg = json.loads(msg)
40+
toast(info.get("tip"), msg.get('msg'))
41+
42+
1643
toaster = ToastNotifier()
1744
driver = webdriver.Chrome()
1845
loginInfo = {
1946
"loginName": "学号",
2047
"yzxx": "姓名",
21-
"loginType": 0 #身份,默认为0,其他请详查网页代码
48+
"loginType": 0 # 身份,默认为0,其他请详查网页代码
2249
}
2350
# try:
2451
driver.get("https://fxgl.jx.edu.cn/4136010406/public/homeQd?loginName="
2552
+ loginInfo.__getitem__('loginName')
2653
+ "&loginType=" + str(loginInfo.__getitem__('loginType')))
2754
time.sleep(1)
28-
print("自动签到...")
29-
driver.execute_script(open('./checkIn.js', encoding='utf-8').read())
30-
time.sleep(2)
31-
msg = driver.find_element_by_class_name('foot').get_attribute('msg')
32-
print(msg)
33-
msg = json.loads(msg)
34-
toast("自动签到", msg['msg'])
35-
36-
print("调查问卷...")
37-
driver.execute_script(open("./index.js", encoding='utf-8').read())
38-
time.sleep(2)
39-
msg1 = driver.find_element_by_class_name('foot').get_attribute('msg1')
40-
msg1 = json.loads(msg1)
41-
print(msg1)
42-
toast("调查问卷", msg1['msg'])
43-
print("10s 后自动退出...")
55+
task(0)
56+
time.sleep(3)
57+
task(1)
58+
print("10s 后关闭浏览器...")
4459
time.sleep(10)
60+
print("浏览器已关闭")
4561
driver.quit()

0 commit comments

Comments
 (0)