35 lines
838 B
Go
35 lines
838 B
Go
package formview
|
|
|
|
import (
|
|
"go_dreamfactory/cmd/v2/model"
|
|
"go_dreamfactory/cmd/v2/service"
|
|
"go_dreamfactory/pb"
|
|
|
|
"fyne.io/fyne/v2"
|
|
"fyne.io/fyne/v2/widget"
|
|
"github.com/sirupsen/logrus"
|
|
"github.com/spf13/cast"
|
|
)
|
|
|
|
type MainlineChallengeView struct {
|
|
BaseformView
|
|
}
|
|
|
|
func (this *MainlineChallengeView) CreateView(t *model.TestCase) fyne.CanvasObject {
|
|
chapterId := widget.NewEntry()
|
|
this.form.AppendItem(widget.NewFormItem("关卡ID", chapterId))
|
|
|
|
subChapterId := widget.NewEntry()
|
|
this.form.AppendItem(widget.NewFormItem("小关卡ID", subChapterId))
|
|
|
|
this.form.OnSubmit = func() {
|
|
if err := service.GetPttService().SendToClient(t.MainType, t.SubType, &pb.MainlineChallengeReq{
|
|
ChapterObj: chapterId.Text,
|
|
MainlineId: cast.ToUint32(subChapterId.Text),
|
|
}); err != nil {
|
|
logrus.Error(err)
|
|
}
|
|
}
|
|
return this.form
|
|
}
|