2020-12-16 15:49:15 +08:00
|
|
|
package userui
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"github.com/TeaOSLab/EdgeAdmin/internal/configloaders"
|
|
|
|
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
|
|
|
|
"github.com/iwind/TeaGo/actions"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type IndexAction struct {
|
|
|
|
|
actionutils.ParentAction
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (this *IndexAction) Init() {
|
|
|
|
|
this.Nav("", "", "")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (this *IndexAction) RunGet(params struct{}) {
|
|
|
|
|
config, err := configloaders.LoadUserUIConfig()
|
|
|
|
|
if err != nil {
|
|
|
|
|
this.ErrorPage(err)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
this.Data["config"] = config
|
|
|
|
|
|
|
|
|
|
this.Show()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (this *IndexAction) RunPost(params struct {
|
|
|
|
|
ProductName string
|
|
|
|
|
UserSystemName string
|
|
|
|
|
ShowOpenSourceInfo bool
|
|
|
|
|
ShowVersion bool
|
|
|
|
|
Version string
|
2021-01-13 17:50:03 +08:00
|
|
|
ShowFinance bool
|
2020-12-16 15:49:15 +08:00
|
|
|
|
|
|
|
|
Must *actions.Must
|
|
|
|
|
CSRF *actionutils.CSRF
|
|
|
|
|
}) {
|
|
|
|
|
params.Must.
|
|
|
|
|
Field("productName", params.ProductName).
|
|
|
|
|
Require("请输入产品名称").
|
|
|
|
|
Field("userSystemName", params.UserSystemName).
|
|
|
|
|
Require("请输入管理员系统名称")
|
|
|
|
|
|
|
|
|
|
config, err := configloaders.LoadUserUIConfig()
|
|
|
|
|
if err != nil {
|
|
|
|
|
this.ErrorPage(err)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
config.ProductName = params.ProductName
|
|
|
|
|
config.UserSystemName = params.UserSystemName
|
|
|
|
|
config.ShowOpenSourceInfo = params.ShowOpenSourceInfo
|
|
|
|
|
config.ShowVersion = params.ShowVersion
|
|
|
|
|
config.Version = params.Version
|
2021-01-13 17:50:03 +08:00
|
|
|
config.ShowFinance = params.ShowFinance
|
2020-12-16 15:49:15 +08:00
|
|
|
err = configloaders.UpdateUserUIConfig(config)
|
|
|
|
|
if err != nil {
|
|
|
|
|
this.ErrorPage(err)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.Success()
|
|
|
|
|
}
|