package formview import ( "go_dreamfactory/cmd/v2/model" "go_dreamfactory/cmd/v2/service" "go_dreamfactory/comm" "go_dreamfactory/modules/sociaty" "go_dreamfactory/pb" "fyne.io/fyne/v2" "fyne.io/fyne/v2/widget" "github.com/sirupsen/logrus" "github.com/spf13/cast" ) type SociatyCreateView struct { BaseformView } func (this *SociatyCreateView) CreateView(t *model.TestCase) fyne.CanvasObject { sociatyName := widget.NewEntry() notice := widget.NewMultiLineEntry() icon := widget.NewEntry() isApplyCheck := widget.NewCheck("审批", nil) applyLv := widget.NewEntry() applyLv.Text = "1" //默认 this.form.AppendItem(widget.NewFormItem("公会名称", sociatyName)) this.form.AppendItem(widget.NewFormItem("公告", notice)) this.form.AppendItem(widget.NewFormItem("图标", icon)) this.form.AppendItem(widget.NewFormItem("审批", isApplyCheck)) this.form.AppendItem(widget.NewFormItem("入会等级", applyLv)) this.form.OnSubmit = func() { if err := service.GetPttService().SendToClient( string(comm.ModuleSociaty), sociaty.SociatySubTypeCreate, &pb.SociatyCreateReq{ Name: sociatyName.Text, Icon: icon.Text, Notice: notice.Text, IsApplyCheck: isApplyCheck.Checked, ApplyLv: cast.ToInt32(applyLv.Text), }); err != nil { logrus.Error(err) } } this.form.SubmitText = "创建" return this.form }