@@ -77,6 +77,7 @@ func (a *App) watchCoursePubCore(speed int, studentID string, password string, c
7777 // 创建浏览器实例
7878 browser , err := pw .Chromium .Launch (playwright.BrowserTypeLaunchOptions {
7979 Headless : playwright .Bool (headless ),
80+ SlowMo : playwright .Float (30 ),
8081 })
8182 if err != nil { ch <- err ; return }
8283 defer browser .Close ()
@@ -99,6 +100,10 @@ func (a *App) watchCoursePubCore(speed int, studentID string, password string, c
99100
100101 // 浏览器出现 confirm 时, 点击 "确定"
101102 page .On ("dialog" , func (dialog playwright.Dialog ) {
103+ runtime .EventsEmit (a .ctx , "currentStatus" , fmt .Sprintf ("课程 %s 页面出现 %s 弹窗: %s" , courseID , dialog .Type (), dialog .Message ()))
104+ runtime .EventsEmit (a .ctx , "currentStatus" , fmt .Sprintf ("已自动确认弹窗, 请手动确认课程 %s 选课结果" , courseID ))
105+ runtime .EventsEmit (a .ctx , "importantStatus" , fmt .Sprintf ("课程 %s 页面出现 %s 弹窗: %s" , courseID , dialog .Type (), dialog .Message ()))
106+ runtime .EventsEmit (a .ctx , "importantStatus" , fmt .Sprintf ("已自动确认弹窗, 请手动确认课程 %s 选课结果" , courseID ))
102107 dialog .Accept ()
103108 })
104109
@@ -281,6 +286,7 @@ func (a *App) watchCoursePubSyncCore(speed int, studentID string, password strin
281286 // 创建浏览器实例
282287 browser , err := pw .Chromium .Launch (playwright.BrowserTypeLaunchOptions {
283288 Headless : playwright .Bool (headless ),
289+ SlowMo : playwright .Float (30 ),
284290 })
285291 if err != nil { ch <- err ; return }
286292 defer browser .Close ()
@@ -292,6 +298,10 @@ func (a *App) watchCoursePubSyncCore(speed int, studentID string, password strin
292298
293299 // 浏览器出现 confirm 时, 点击 "确定"
294300 page .On ("dialog" , func (dialog playwright.Dialog ) {
301+ runtime .EventsEmit (a .ctx , "currentStatus" , fmt .Sprintf ("课程 %s 页面出现 %s 弹窗: %s" , courseID , dialog .Type (), dialog .Message ()))
302+ runtime .EventsEmit (a .ctx , "currentStatus" , fmt .Sprintf ("已自动确认弹窗, 请手动确认课程 %s 选课结果" , courseID ))
303+ runtime .EventsEmit (a .ctx , "importantStatus" , fmt .Sprintf ("课程 %s 页面出现 %s 弹窗: %s" , courseID , dialog .Type (), dialog .Message ()))
304+ runtime .EventsEmit (a .ctx , "importantStatus" , fmt .Sprintf ("已自动确认弹窗, 请手动确认课程 %s 选课结果" , courseID ))
295305 dialog .Accept ()
296306 })
297307
@@ -458,6 +468,7 @@ func (a *App) watchCourseMajCore(speed int, studentID string, password string, c
458468 // 创建浏览器实例
459469 browser , err := pw .Chromium .Launch (playwright.BrowserTypeLaunchOptions {
460470 Headless : playwright .Bool (headless ),
471+ SlowMo : playwright .Float (30 ),
461472 })
462473 if err != nil { ch <- err ; return }
463474 defer browser .Close ()
@@ -469,9 +480,10 @@ func (a *App) watchCourseMajCore(speed int, studentID string, password string, c
469480 // 专业课特殊处理
470481 page .On ("dialog" , func (dialog playwright.Dialog ) {
471482 runtime .EventsEmit (a .ctx , "currentStatus" , fmt .Sprintf ("课程 %s 页面出现 %s 弹窗: %s" , courseID , dialog .Type (), dialog .Message ()))
472- runtime .EventsEmit (a .ctx , "currentStatus" , fmt .Sprintf ("请手动确认课程 %s 选课结果" , courseID ))
483+ runtime .EventsEmit (a .ctx , "currentStatus" , fmt .Sprintf ("已自动确认弹窗, 请手动确认课程 %s 选课结果" , courseID ))
473484 runtime .EventsEmit (a .ctx , "importantStatus" , fmt .Sprintf ("课程 %s 页面出现 %s 弹窗: %s" , courseID , dialog .Type (), dialog .Message ()))
474- runtime .EventsEmit (a .ctx , "importantStatus" , fmt .Sprintf ("请手动确认课程 %s 选课结果" , courseID ))
485+ runtime .EventsEmit (a .ctx , "importantStatus" , fmt .Sprintf ("已自动确认弹窗, 请手动确认课程 %s 选课结果" , courseID ))
486+ dialog .Accept ()
475487 })
476488
477489 if * isClose {
0 commit comments