fix: 提交答案时出现滑块的问题,昨完一个项目后会关闭当前tab
This commit is contained in:
parent
e6c80e8567
commit
024568d5de
|
@ -24,6 +24,7 @@ import (
|
|||
"github.com/mxschmitt/playwright-go"
|
||||
"github.com/nfnt/resize"
|
||||
log "github.com/sirupsen/logrus"
|
||||
goqrcode "github.com/skip2/go-qrcode"
|
||||
"golang.org/x/image/bmp"
|
||||
)
|
||||
|
||||
|
@ -111,6 +112,14 @@ func (c *Core) L() ([]Cookie, error) {
|
|||
log.Infoln(g.Result)
|
||||
codeURL := fmt.Sprintf("https://login.xuexi.cn/login/qrcommit?showmenu=false&code=%v&appId=dingoankubyrfkttorhpou", g.Result)
|
||||
|
||||
err = goqrcode.WriteFile(codeURL, goqrcode.Medium, 128, "qrcode.png")
|
||||
if err != nil {
|
||||
log.Errorln("图片生成错误" + err.Error())
|
||||
err = nil
|
||||
} else {
|
||||
log.Infoln("二维码已生成到目录下的qrcode.png")
|
||||
}
|
||||
|
||||
qrCodeString := qrcodeTerminal.New2(qrcodeTerminal.ConsoleColors.BrightBlack, qrcodeTerminal.ConsoleColors.BrightWhite, qrcodeTerminal.QRCodeRecoveryLevels.Low).Get(codeURL)
|
||||
qrCodeString.Print()
|
||||
c.Push("text", "https://johlanse.github.io/study_xxqg/scheme.html?"+url.QueryEscape(codeURL))
|
||||
|
|
|
@ -48,6 +48,9 @@ func (c *Core) RespondDaily(cookies []Cookie, model string) {
|
|||
|
||||
return
|
||||
}
|
||||
defer func() {
|
||||
page.Close()
|
||||
}()
|
||||
page.Goto("https://pc.xuexi.cn/points/my-points.html")
|
||||
err = (*c.context).AddCookies(cookieToParam(cookies)...)
|
||||
if err != nil {
|
||||
|
@ -160,9 +163,15 @@ func (c *Core) RespondDaily(cookies []Cookie, model string) {
|
|||
return
|
||||
}
|
||||
if en {
|
||||
page.Mouse().Move(496, 422)
|
||||
time.Sleep(1 * time.Second)
|
||||
page.Mouse().Down()
|
||||
|
||||
page.Mouse().Move(772, 416, playwright.MouseMoveOptions{})
|
||||
page.Mouse().Up()
|
||||
time.Sleep(10 * time.Second)
|
||||
log.Infoln("可能存在滑块")
|
||||
c.Push("text", "答题过程出现滑块")
|
||||
return
|
||||
c.Push("text", "答题过程出现滑块,正在尝试滑动")
|
||||
}
|
||||
}
|
||||
switch model {
|
||||
|
|
|
@ -116,6 +116,9 @@ func (c *Core) LearnArticle(cookies []Cookie) {
|
|||
if err != nil {
|
||||
return
|
||||
}
|
||||
defer func() {
|
||||
page.Close()
|
||||
}()
|
||||
|
||||
err = (*c.context).AddCookies(cookieToParam(cookies)...)
|
||||
if err != nil {
|
||||
|
@ -208,7 +211,9 @@ func (c *Core) LearnVideo(cookies []Cookie) {
|
|||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
defer func() {
|
||||
page.Close()
|
||||
}()
|
||||
var resp string
|
||||
err = gout.GET("http://1.15.144.22/stealth.min.js").BindBody(&resp).Do()
|
||||
if err != nil {
|
||||
|
|
|
@ -21,6 +21,7 @@ func cookieToJar(cookies []Cookie) []*http.Cookie {
|
|||
Domain: c.Domain,
|
||||
Secure: c.Secure,
|
||||
HttpOnly: c.HTTPOnly,
|
||||
SameSite: http.SameSiteDefaultMode,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue