38 lines
813 B
Go
38 lines
813 B
Go
package formview
|
|
|
|
import (
|
|
"go_dreamfactory/cmd/v2/model"
|
|
"go_dreamfactory/cmd/v2/service"
|
|
"go_dreamfactory/pb"
|
|
"strings"
|
|
|
|
"fyne.io/fyne/v2"
|
|
"fyne.io/fyne/v2/widget"
|
|
"github.com/sirupsen/logrus"
|
|
"github.com/spf13/cast"
|
|
)
|
|
|
|
type ReddotView struct {
|
|
BaseformView
|
|
}
|
|
|
|
func (this *ReddotView) CreateView(t *model.TestCase) fyne.CanvasObject {
|
|
reddotTypeEntry := widget.NewEntry()
|
|
|
|
this.form.AppendItem(widget.NewFormItem("红点类型", reddotTypeEntry))
|
|
this.form.OnSubmit = func() {
|
|
typesStr := strings.Split(reddotTypeEntry.Text, ",")
|
|
var rids []int32
|
|
for _, s := range typesStr {
|
|
rids = append(rids, cast.ToInt32(s))
|
|
}
|
|
if err := service.GetPttService().SendToClient(t.MainType, "get",
|
|
&pb.ReddotGetReq{
|
|
Rids: rids,
|
|
}); err != nil {
|
|
logrus.Error(err)
|
|
}
|
|
}
|
|
return this.form
|
|
}
|