66 lines
1.6 KiB
Go
66 lines
1.6 KiB
Go
package formview
|
|
|
|
import (
|
|
"go_dreamfactory/cmd/v2/lib/common"
|
|
"go_dreamfactory/cmd/v2/model"
|
|
"go_dreamfactory/cmd/v2/service"
|
|
"go_dreamfactory/pb"
|
|
|
|
"fyne.io/fyne/v2"
|
|
"fyne.io/fyne/v2/container"
|
|
"fyne.io/fyne/v2/widget"
|
|
"github.com/sirupsen/logrus"
|
|
"github.com/spf13/cast"
|
|
)
|
|
|
|
type HeroStrengthenUplvView struct {
|
|
BaseformView
|
|
}
|
|
|
|
func (this *HeroStrengthenUplvView) CreateView(t *model.TestCase) fyne.CanvasObject {
|
|
|
|
heroObjID := widget.NewEntry()
|
|
|
|
key := widget.NewEntry()
|
|
key.PlaceHolder = common.APP_TESTCASE_FORM_LABEL_OID
|
|
val := widget.NewEntry()
|
|
val.PlaceHolder = common.APP_TESTCASE_FORM_LABEL_NUM
|
|
|
|
key2 := widget.NewEntry()
|
|
key2.PlaceHolder = common.APP_TESTCASE_OPTIONS
|
|
val2 := widget.NewEntry()
|
|
val2.PlaceHolder = common.APP_TESTCASE_OPTIONS
|
|
|
|
expCards := container.NewGridWithColumns(2, key, val, key2, val2)
|
|
|
|
this.form.AppendItem(widget.NewFormItem(common.APP_TESTCASE_FORM_LABEL_HEROOBJID, heroObjID))
|
|
this.form.AppendItem(widget.NewFormItem(common.APP_TESTCASE_FORM_LABEL_EXPCARDS, expCards))
|
|
|
|
this.form.OnSubmit = func() {
|
|
var cards []*pb.MapStringInt32
|
|
|
|
if key.Text != "" && val.Text != "" {
|
|
cards = append(cards, &pb.MapStringInt32{
|
|
Key: key.Text,
|
|
Value: cast.ToInt32(val.Text),
|
|
})
|
|
}
|
|
|
|
if key2.Text != "" && val2.Text != "" {
|
|
cards = append(cards, &pb.MapStringInt32{
|
|
Key: key2.Text,
|
|
Value: cast.ToInt32(val2.Text),
|
|
})
|
|
}
|
|
|
|
if err := service.GetPttService().SendToClient(t.MainType, t.SubType,
|
|
&pb.HeroStrengthenUplvReq{
|
|
HeroObjID: heroObjID.Text}); err != nil {
|
|
logrus.Error(err)
|
|
return
|
|
}
|
|
|
|
}
|
|
return this.form
|
|
}
|