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 HeroZhaomuView struct { BaseformView } func (this *HeroZhaomuView) CreateView(t *model.TestCase) fyne.CanvasObject { var ckType, ckCount string // 抽卡类型 0 1 2 3 4 ckTypeSelect := widget.NewSelect([]string{"0", "1", "2", "3", "4"}, func(s string) { ckType = s }) //数量 ckCountSelect := widget.NewSelect([]string{"1", "10"}, func(s string) { ckCount = s }) this.form.AppendItem(widget.NewFormItem("抽卡类型", ckTypeSelect)) this.form.AppendItem(widget.NewFormItem("数量", ckCountSelect)) this.form.OnSubmit = func() { if err := service.GetPttService().SendToClient(t.MainType, t.SubType, &pb.HeroDrawCardReq{ DrawType: cast.ToInt32(ckType), DrawCount: cast.ToInt32(ckCount), }); err != nil { logrus.Error(err) } } return this.form }