更改前端部分
This commit is contained in:
parent
8647e5a150
commit
918db70cad
|
@ -51,7 +51,6 @@ type Config struct {
|
|||
Cron string `json:"cron" yaml:"cron" mapstructure:"cron"`
|
||||
CronRandomWait int `json:"cron_random_wait" yaml:"cron_random_wait" mapstructure:"cron_random_wait"`
|
||||
EdgePath string `json:"edge_path" yaml:"edge_path" mapstructure:"edge_path"`
|
||||
QrCOde bool `json:"qr_code" yaml:"qr_code" mapstructure:"qr_code"`
|
||||
StartWait int `json:"start_wait" yaml:"start_wait" mapstructure:"start_wait"`
|
||||
// cookie强制过期时间,单位为h
|
||||
ForceExpiration int `json:"force_expiration" yaml:"force_expiration" mapstructure:"force_expiration"`
|
||||
|
|
|
@ -108,9 +108,6 @@ cron_random_wait: 0
|
|||
#windows环境自定义浏览器路径,仅支持chromium系列
|
||||
edge_path: ""
|
||||
|
||||
# 是否推送二维码
|
||||
qr_code: false
|
||||
|
||||
# 启动时等待时间,为了防止代理启动比软件慢而报错,默认不等待,单位秒
|
||||
start_wait: 0
|
||||
|
||||
|
@ -131,6 +128,8 @@ custom_message: "自定义消息$$$https://www.baidu.com"
|
|||
# 自定义消息推送定时
|
||||
custom_cron: ""
|
||||
|
||||
pool_size: 1
|
||||
|
||||
weekly_min_score:
|
||||
|
||||
ji_guang_push:
|
||||
|
|
|
@ -106,12 +106,9 @@ cron: "0 0 * * *"
|
|||
# 定时任务随机等待时间,单位:分钟
|
||||
cron_random_wait: 0
|
||||
|
||||
#windows环境自定义浏览器路径,仅支持chromium系列
|
||||
#windows环境自定义浏览器路径,仅支持chromium系列,需要将\替换为/或者\\
|
||||
edge_path: ""
|
||||
|
||||
# 是否推送二维码
|
||||
qr_code: false
|
||||
|
||||
# 启动时等待时间,为了防止代理启动比软件慢而报错,默认不等待,单位秒
|
||||
start_wait: 0
|
||||
|
||||
|
|
5
go.mod
5
go.mod
|
@ -19,10 +19,10 @@ require (
|
|||
github.com/klauspost/compress v1.15.10
|
||||
github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible
|
||||
github.com/mitchellh/mapstructure v1.5.0
|
||||
github.com/panjf2000/ants/v2 v2.5.0
|
||||
github.com/playwright-community/playwright-go v0.2000.1
|
||||
github.com/robfig/cron/v3 v3.0.0
|
||||
github.com/sirupsen/logrus v1.9.0
|
||||
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e
|
||||
github.com/spf13/viper v1.12.0
|
||||
github.com/tidwall/gjson v1.12.1
|
||||
gopkg.in/yaml.v3 v3.0.1
|
||||
|
@ -31,6 +31,7 @@ require (
|
|||
|
||||
require (
|
||||
github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 // indirect
|
||||
github.com/gin-contrib/gzip v0.0.6 // indirect
|
||||
github.com/gin-contrib/sse v0.1.0 // indirect
|
||||
github.com/go-playground/locales v0.14.0 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.0 // indirect
|
||||
|
@ -50,11 +51,11 @@ require (
|
|||
github.com/mattn/go-isatty v0.0.16 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/panjf2000/ants/v2 v2.5.0 // indirect
|
||||
github.com/pelletier/go-toml v1.9.5 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.0.5 // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // indirect
|
||||
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e // indirect
|
||||
github.com/spf13/afero v1.8.2 // indirect
|
||||
github.com/spf13/cast v1.5.0 // indirect
|
||||
github.com/spf13/jwalterweatherman v1.1.0 // indirect
|
||||
|
|
7
go.sum
7
go.sum
|
@ -67,6 +67,8 @@ github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7
|
|||
github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE=
|
||||
github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI=
|
||||
github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU=
|
||||
github.com/gin-contrib/gzip v0.0.6 h1:NjcunTcGAj5CO1gn4N8jHOSIeRFHIbn51z6K+xaN4d4=
|
||||
github.com/gin-contrib/gzip v0.0.6/go.mod h1:QOJlmV2xmayAjkNS2Y8NQsMneuRShOU/kjovCXNuzzk=
|
||||
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
|
||||
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
|
||||
github.com/gin-gonic/gin v1.8.1 h1:4+fr/el88TOO3ewCmQr8cx/CtZ/umlIRIs5M4NTNjf8=
|
||||
|
@ -80,12 +82,14 @@ github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb
|
|||
github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs=
|
||||
github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho=
|
||||
github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA=
|
||||
github.com/go-playground/validator/v10 v10.10.0/go.mod h1:74x4gJWsvQexRdW8Pn3dXSGrTK4nAUsbPlLADvpJkos=
|
||||
github.com/go-playground/validator/v10 v10.11.0 h1:0W+xRM511GY47Yy3bZUbJVitCNg2BOGlCyvTqsp/xIw=
|
||||
github.com/go-playground/validator/v10 v10.11.0/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU=
|
||||
github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw=
|
||||
github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4=
|
||||
github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.4.0-beta.0 h1:mbEDV1g6RBzKd4sFjOWuyZdxItw4CWu5Kq4KaBAJbHM=
|
||||
github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.4.0-beta.0/go.mod h1:5+h9c5l1Z/+Pi+5boa1Fmr4Q+FImsXYnifor92ljaVs=
|
||||
github.com/goccy/go-json v0.9.7/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
|
||||
github.com/goccy/go-json v0.9.11 h1:/pAaQDLHEoCq/5FFmSKBswWmK6H0e8g4159Kc/X/nqk=
|
||||
github.com/goccy/go-json v0.9.11/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||
|
@ -218,6 +222,7 @@ github.com/panjf2000/ants/v2 v2.5.0 h1:1rWGWSnxCsQBga+nQbA4/iY6VMeNoOIAM0ZWh9u3q
|
|||
github.com/panjf2000/ants/v2 v2.5.0/go.mod h1:cU93usDlihJZ5CfRGNDYsiBYvoilLvBF5Qp/BT2GNRE=
|
||||
github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8=
|
||||
github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
|
||||
github.com/pelletier/go-toml/v2 v2.0.1/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo=
|
||||
github.com/pelletier/go-toml/v2 v2.0.5 h1:ipoSadvV8oGUjnUbMub59IDPPwfxF694nG/jwbMiyQg=
|
||||
github.com/pelletier/go-toml/v2 v2.0.5/go.mod h1:OMHamSCAODeSsVrwwvcJOaoN0LIUIaFVNZzmWyNfXas=
|
||||
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
|
||||
|
@ -290,6 +295,7 @@ golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8U
|
|||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
|
||||
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||
golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 h1:Y/gsMcFOcR+6S6f3YeMKl5g+dZMEWqcz5Czj/GWYbkM=
|
||||
|
@ -586,6 +592,7 @@ google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpAD
|
|||
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
|
||||
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
|
||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||
google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||
google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w=
|
||||
google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
|
|
18
lib/core.go
18
lib/core.go
|
@ -1,7 +1,6 @@
|
|||
package lib
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/url"
|
||||
|
@ -14,7 +13,6 @@ import (
|
|||
"github.com/google/uuid"
|
||||
"github.com/playwright-community/playwright-go"
|
||||
log "github.com/sirupsen/logrus"
|
||||
goqrcode "github.com/skip2/go-qrcode"
|
||||
|
||||
"github.com/johlanse/study_xxqg/conf"
|
||||
"github.com/johlanse/study_xxqg/model"
|
||||
|
@ -134,22 +132,10 @@ func (c *Core) GenerateCode(pushID string) (string, string, 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")
|
||||
}
|
||||
if conf.GetConfig().QrCOde {
|
||||
data, _ := os.ReadFile("qrcode.png")
|
||||
c.Push(pushID, "image", base64.StdEncoding.EncodeToString(data))
|
||||
}
|
||||
|
||||
qrCodeString := qrcodeTerminal.New2(qrcodeTerminal.ConsoleColors.BrightBlack, qrcodeTerminal.ConsoleColors.BrightWhite, qrcodeTerminal.QRCodeRecoveryLevels.Low).Get(codeURL)
|
||||
qrCodeString.Print()
|
||||
c.Push(pushID, "flush", conf.GetConfig().Scheme+url.QueryEscape(codeURL))
|
||||
c.Push(pushID, "flush", "请点击链接登录")
|
||||
c.Push(pushID, "flush", "请在一分钟内点击链接登录")
|
||||
return codeURL, g.Result, err
|
||||
}
|
||||
|
||||
|
@ -220,7 +206,7 @@ func (c *Core) L(retryTimes int, pushID string) (*model.User, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for i := 0; i < 150; i++ {
|
||||
for i := 0; i < 30; i++ {
|
||||
user, b, err := c.CheckQrCode(codeData, pushID)
|
||||
if b && err == nil {
|
||||
return user, err
|
||||
|
|
125
lib/respond.go
125
lib/respond.go
|
@ -8,6 +8,7 @@ import (
|
|||
rand2 "math/rand"
|
||||
"net/http"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
|
@ -18,6 +19,7 @@ import (
|
|||
|
||||
"github.com/johlanse/study_xxqg/conf"
|
||||
"github.com/johlanse/study_xxqg/model"
|
||||
"github.com/johlanse/study_xxqg/utils"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -803,3 +805,126 @@ func getweekID(cookies []*http.Cookie) (int, error) {
|
|||
log.Warningln("你已不存在未答的每周答题了")
|
||||
return 0, errors.New("未找到每周答题")
|
||||
}
|
||||
|
||||
func GetSpecialContent(cookies []*http.Cookie, id int) *SpecialContent {
|
||||
response, err := utils.GetClient().R().SetCookies(cookies...).SetQueryParams(map[string]string{
|
||||
"type": "2",
|
||||
"id": strconv.Itoa(id),
|
||||
"forced": "true",
|
||||
}).Get("https://pc-proxy-api.xuexi.cn/api/exam/service/detail/queryV3")
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
data, _ := base64.StdEncoding.DecodeString(gjson.GetBytes(response.Bytes(), "data_str").String())
|
||||
log.Println(string(data))
|
||||
content := new(SpecialContent)
|
||||
_ = json.Unmarshal(data, content)
|
||||
return content
|
||||
}
|
||||
|
||||
func getweekIDs(cookies []*http.Cookie) []int {
|
||||
c := req.C()
|
||||
c.SetCommonCookies(cookies...)
|
||||
repo, err := c.R().SetQueryParams(map[string]string{"pageSize": "500", "pageNo": "1"}).Get(queryWeekList)
|
||||
if err != nil {
|
||||
log.Errorln("获取每周答题列表错误" + err.Error())
|
||||
return nil
|
||||
}
|
||||
dataB64, err := repo.ToString()
|
||||
if err != nil {
|
||||
log.Errorln("获取每周答题列表获取string错误" + err.Error())
|
||||
return nil
|
||||
}
|
||||
data, err := base64.StdEncoding.DecodeString(gjson.Get(dataB64, "data_str").String())
|
||||
if err != nil {
|
||||
log.Errorln("获取每周答题列表转换b64错误" + err.Error())
|
||||
return nil
|
||||
}
|
||||
list := new(WeekList)
|
||||
err = json.Unmarshal(data, list)
|
||||
if err != nil {
|
||||
log.Errorln("获取每周答题列表转换json错误" + err.Error())
|
||||
return nil
|
||||
}
|
||||
log.Infoln(fmt.Sprintf("共获取到每周答题%d个", list.TotalCount))
|
||||
var ids []int
|
||||
for _, l := range list.List {
|
||||
for _, practice := range l.Practices {
|
||||
ids = append(ids, practice.Id)
|
||||
}
|
||||
}
|
||||
return ids
|
||||
}
|
||||
func getSpecialIDs(cookies []*http.Cookie) []int {
|
||||
c := req.C()
|
||||
|
||||
c.SetCommonCookies(cookies...)
|
||||
// 获取专项答题列表
|
||||
repo, err := c.R().SetQueryParams(map[string]string{"pageSize": "1000", "pageNo": "1"}).Get(querySpecialList)
|
||||
if err != nil {
|
||||
log.Errorln("获取专项答题列表错误" + err.Error())
|
||||
return nil
|
||||
}
|
||||
dataB64, err := repo.ToString()
|
||||
if err != nil {
|
||||
log.Errorln("获取专项答题列表获取string错误" + err.Error())
|
||||
return nil
|
||||
}
|
||||
// 因为返回内容使用base64编码,所以需要对内容进行转码
|
||||
data, err := base64.StdEncoding.DecodeString(gjson.Get(dataB64, "data_str").String())
|
||||
if err != nil {
|
||||
log.Errorln("获取专项答题列表转换b64错误" + err.Error())
|
||||
return nil
|
||||
}
|
||||
// 创建实例对象
|
||||
list := new(SpecialList)
|
||||
// json序列号
|
||||
err = json.Unmarshal(data, list)
|
||||
if err != nil {
|
||||
log.Errorln("获取专项答题列表转换json错误" + err.Error())
|
||||
return nil
|
||||
}
|
||||
log.Infoln(fmt.Sprintf("共获取到专项答题%d个", list.TotalCount))
|
||||
var ids []int
|
||||
for _, l := range list.List {
|
||||
ids = append(ids, l.Id)
|
||||
}
|
||||
return ids
|
||||
}
|
||||
|
||||
type SpecialContent struct {
|
||||
Perfect bool `json:"perfect"`
|
||||
TotalTime int `json:"totalTime"`
|
||||
Questions []struct {
|
||||
HasDescribe bool `json:"hasDescribe"`
|
||||
// 提示信息
|
||||
QuestionDesc string `json:"questionDesc"`
|
||||
QuestionId int `json:"questionId"`
|
||||
Origin string `json:"origin"`
|
||||
// 答案
|
||||
Answers []struct {
|
||||
AnswerId int `json:"answerId"`
|
||||
Label string `json:"label"`
|
||||
Content string `json:"content"`
|
||||
} `json:"answers"`
|
||||
QuestionScore int `json:"questionScore"`
|
||||
// 题目呢偶然
|
||||
Body string `json:"body"`
|
||||
OriginTitle string `json:"originTitle"`
|
||||
AllCorrect bool `json:"allCorrect"`
|
||||
Supplier string `json:"supplier"`
|
||||
QuestionDescOrigin string `json:"questionDescOrigin"`
|
||||
QuestionDisplay int `json:"questionDisplay"`
|
||||
Recommender string `json:"recommender"`
|
||||
} `json:"questions"`
|
||||
Type int `json:"type"`
|
||||
TotalScore int `json:"totalScore"`
|
||||
PassScore int `json:"passScore"`
|
||||
FinishedNum int `json:"finishedNum"`
|
||||
UsedTime int `json:"usedTime"`
|
||||
Name string `json:"name"`
|
||||
QuestionNum int `json:"questionNum"`
|
||||
Id int `json:"id"`
|
||||
UniqueId string `json:"uniqueId"`
|
||||
TipScoreReasonType int `json:"tipScoreReasonType"`
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import (
|
|||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/gin-contrib/gzip"
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
"github.com/johlanse/study_xxqg/conf"
|
||||
|
@ -25,6 +26,7 @@ func RouterInit() *gin.Engine {
|
|||
router := gin.Default()
|
||||
router.RemoveExtraSlash = true
|
||||
router.Use(cors())
|
||||
router.Use(gzip.Gzip(1, gzip.WithExcludedExtensions([]string{"js", "css", "map", "png", "ico"})))
|
||||
|
||||
// 挂载静态文件
|
||||
router.StaticFS("/static", http.FS(static))
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"files": {
|
||||
"main.css": "/static/xxqg/build/static/css/main.fc31f0e5.css",
|
||||
"main.js": "/static/xxqg/build/static/js/main.bd279fde.js",
|
||||
"main.js": "/static/xxqg/build/static/js/main.8e16deea.js",
|
||||
"static/js/312.600b1c1c.chunk.js": "/static/xxqg/build/static/js/312.600b1c1c.chunk.js",
|
||||
"static/js/4877.63f2a077.chunk.js": "/static/xxqg/build/static/js/4877.63f2a077.chunk.js",
|
||||
"static/js/1074.4c2739c5.chunk.js": "/static/xxqg/build/static/js/1074.4c2739c5.chunk.js",
|
||||
|
@ -88,7 +88,7 @@
|
|||
"static/media/codicon.ttf": "/static/xxqg/build/static/media/codicon.b797181c93b3755f4fa1.ttf",
|
||||
"index.html": "/static/xxqg/build/index.html",
|
||||
"main.fc31f0e5.css.map": "/static/xxqg/build/static/css/main.fc31f0e5.css.map",
|
||||
"main.bd279fde.js.map": "/static/xxqg/build/static/js/main.bd279fde.js.map",
|
||||
"main.8e16deea.js.map": "/static/xxqg/build/static/js/main.8e16deea.js.map",
|
||||
"312.600b1c1c.chunk.js.map": "/static/xxqg/build/static/js/312.600b1c1c.chunk.js.map",
|
||||
"4877.63f2a077.chunk.js.map": "/static/xxqg/build/static/js/4877.63f2a077.chunk.js.map",
|
||||
"1074.4c2739c5.chunk.js.map": "/static/xxqg/build/static/js/1074.4c2739c5.chunk.js.map",
|
||||
|
@ -175,6 +175,6 @@
|
|||
},
|
||||
"entrypoints": [
|
||||
"static/css/main.fc31f0e5.css",
|
||||
"static/js/main.bd279fde.js"
|
||||
"static/js/main.8e16deea.js"
|
||||
]
|
||||
}
|
|
@ -1 +1 @@
|
|||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/static/xxqg/build/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/static/xxqg/build/logo192.png"/><link rel="manifest" href="/static/xxqg/build/manifest.json"/><title>Study XXQG</title><script defer="defer" src="/static/xxqg/build/static/js/main.bd279fde.js"></script><link href="/static/xxqg/build/static/css/main.fc31f0e5.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|
||||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/static/xxqg/build/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/static/xxqg/build/logo192.png"/><link rel="manifest" href="/static/xxqg/build/manifest.json"/><title>Study XXQG</title><script defer="defer" src="/static/xxqg/build/static/js/main.8e16deea.js"></script><link href="/static/xxqg/build/static/css/main.fc31f0e5.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|
File diff suppressed because one or more lines are too long
|
@ -19,12 +19,6 @@ object-assign
|
|||
* https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @license qrcode.react
|
||||
* Copyright (c) Paul O'Shannessy
|
||||
* SPDX-License-Identifier: ISC
|
||||
*/
|
||||
|
||||
/**
|
||||
* @remix-run/router v1.0.1
|
||||
*
|
File diff suppressed because one or more lines are too long
|
@ -15,7 +15,6 @@
|
|||
"http-proxy-middleware": "^2.0.5",
|
||||
"monaco-editor": "^0.34.0",
|
||||
"monaco-yaml": "^4.0.2",
|
||||
"qrcode.react": "^3.0.1",
|
||||
"react": "17.x",
|
||||
"react-dom": "17.x",
|
||||
"react-monaco-editor": "^0.50.1",
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import React, {Component} from "react";
|
||||
import {Button, Toast} from "antd-mobile";
|
||||
import QrCode from "qrcode.react";
|
||||
import {Button, Dialog, Toast} from "antd-mobile";
|
||||
import {checkQrCode, getLink, getToken} from "../../utils/api";
|
||||
|
||||
class AddUser extends Component<any, any>{
|
||||
|
@ -9,7 +8,8 @@ class AddUser extends Component<any, any>{
|
|||
constructor(props: any) {
|
||||
super(props);
|
||||
this.state = {
|
||||
img : "你还未获取登录链接"
|
||||
img : "你还未获取登录链接",
|
||||
link: "",
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,9 @@ class AddUser extends Component<any, any>{
|
|||
}
|
||||
|
||||
}
|
||||
isMobile = ()=> {
|
||||
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(window.navigator.userAgent);
|
||||
}
|
||||
|
||||
isWechat = ()=> {
|
||||
if (/MicroMessenger/i.test(window.navigator.userAgent)){
|
||||
|
@ -29,10 +32,21 @@ class AddUser extends Component<any, any>{
|
|||
}
|
||||
|
||||
click = async () => {
|
||||
console.log(this.isMobile())
|
||||
if (!this.isMobile()){
|
||||
Dialog.show({
|
||||
title:"提醒",
|
||||
content:"网页端不再生成二维码,请在移动端访问该网页,会自动跳转到xxqg",
|
||||
closeOnAction:true,
|
||||
closeOnMaskClick:true,
|
||||
})
|
||||
return
|
||||
}
|
||||
let data = await getLink()
|
||||
|
||||
this.setState({
|
||||
img: data.url
|
||||
img: data.url,
|
||||
link: data.code
|
||||
})
|
||||
let check = setInterval(async ()=>{
|
||||
let resp = await checkQrCode(data.code);
|
||||
|
@ -44,9 +58,9 @@ class AddUser extends Component<any, any>{
|
|||
let token = await getToken(resp.data.split("=")[1],data.sign)
|
||||
console.log(token)
|
||||
if (token.success){
|
||||
Toast.show("登录成功")
|
||||
Toast.show("登录成功\n该软件为免费软件,若你正在付费使用,请速度举报管理员")
|
||||
this.setState({
|
||||
img : "你还未获取登录链接"
|
||||
link : ""
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -62,13 +76,14 @@ class AddUser extends Component<any, any>{
|
|||
let element = document.createElement("a");
|
||||
element.href = "dtxuexi://appclient/page/study_feeds?url="+escape(data.url)
|
||||
element.click()
|
||||
|
||||
}
|
||||
|
||||
render() {
|
||||
return <div style={{width:"100%",height:"50%"}}>
|
||||
<h2 style={{margin:10,color:"red",display:this.isWechat()}}>当前环境为微信环境,请点击右上角在浏览器中打开</h2>
|
||||
<Button onClick={this.click} color={"primary"} style={{marginRight:10,marginTop:10,marginBottom:10}} block>生成链接</Button>
|
||||
<QrCode style={{marginLeft:10,display:this.state.img === "你还未获取登录链接" ? "none":"block"}} fgColor={"#000000"} size={200} value={this.state.img} />
|
||||
<span>{this.state.link}</span>
|
||||
</div>;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,12 +14,14 @@ class Help extends Component<any, any> {
|
|||
getAbout().then((value)=>{
|
||||
this.setState({
|
||||
about:value.data
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
}
|
||||
render() {
|
||||
return <>
|
||||
<h1 style={{color:"red",margin:10}}>该软件为免费软件,若你目前正在付费使用,请速度举报管理员</h1><br/>
|
||||
<h2 style={{margin:10}}>项目地址:<a href="https://github.com/johlanse/study_xxqg">https://github.com/johlanse/study_xxqg</a></h2>
|
||||
<br/><h2 style={{margin:10}}>{this.state.about}</h2>
|
||||
</>
|
||||
|
|
|
@ -7103,11 +7103,6 @@ q@^1.1.2:
|
|||
resolved "https://registry.yarnpkg.com/q/-/q-1.5.1.tgz#7e32f75b41381291d04611f1bf14109ac00651d7"
|
||||
integrity sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=
|
||||
|
||||
qrcode.react@^3.0.1:
|
||||
version "3.0.1"
|
||||
resolved "https://registry.yarnpkg.com/qrcode.react/-/qrcode.react-3.0.1.tgz#0cb1d7cfdf3955737fbd3509c193985795ca0612"
|
||||
integrity sha512-uCNm16ClMCrdM2R20c/zqmdwHcbMQf3K7ey39EiK/UgEKbqWeM0iH2QxW3iDVFzjQKFzH23ICgOyG4gNsJ0/gw==
|
||||
|
||||
qs@6.9.7:
|
||||
version "6.9.7"
|
||||
resolved "https://registry.yarnpkg.com/qs/-/qs-6.9.7.tgz#4610846871485e1e048f44ae3b94033f0e675afe"
|
||||
|
|
Loading…
Reference in New Issue