调整界面

This commit is contained in:
刘祥超
2020-10-10 20:28:36 +08:00
parent 1a47606c5f
commit 0f571cad57
35 changed files with 276 additions and 49 deletions

View File

@@ -0,0 +1,15 @@
package backup
import "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
type IndexAction struct {
actionutils.ParentAction
}
func (this *IndexAction) Init() {
this.Nav("", "", "")
}
func (this *IndexAction) RunGet(params struct{}) {
this.Show()
}

View File

@@ -0,0 +1,18 @@
package backup
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/settings/settingutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
"github.com/iwind/TeaGo"
)
func init() {
TeaGo.BeforeStart(func(server *TeaGo.Server) {
server.
Helper(helpers.NewUserMustAuth()).
Helper(settingutils.NewHelper("backup")).
Prefix("/settings/backup").
Get("", new(IndexAction)).
EndAll()
})
}

View File

@@ -1,6 +1,7 @@
package settings
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/settings/settingutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
"github.com/iwind/TeaGo"
)
@@ -10,6 +11,7 @@ func init() {
server.
Helper(helpers.NewUserMustAuth()).
Helper(NewHelper()).
Helper(settingutils.NewHelper("console")).
Prefix("/settings").
Get("", new(IndexAction)).
EndAll()

View File

@@ -0,0 +1,15 @@
package login
import "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
type IndexAction struct {
actionutils.ParentAction
}
func (this *IndexAction) Init() {
this.Nav("", "", "")
}
func (this *IndexAction) RunGet(params struct{}) {
this.Show()
}

View File

@@ -0,0 +1,18 @@
package login
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/settings/settingutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
"github.com/iwind/TeaGo"
)
func init() {
TeaGo.BeforeStart(func(server *TeaGo.Server) {
server.
Helper(helpers.NewUserMustAuth()).
Helper(settingutils.NewHelper("login")).
Prefix("/settings/login").
Get("", new(IndexAction)).
EndAll()
})
}

View File

@@ -0,0 +1,15 @@
package profile
import "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
type IndexAction struct {
actionutils.ParentAction
}
func (this *IndexAction) Init() {
this.Nav("", "", "")
}
func (this *IndexAction) RunGet(params struct{}) {
this.Show()
}

View File

@@ -0,0 +1,18 @@
package profile
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/settings/settingutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
"github.com/iwind/TeaGo"
)
func init() {
TeaGo.BeforeStart(func(server *TeaGo.Server) {
server.
Helper(helpers.NewUserMustAuth()).
Helper(settingutils.NewHelper("profile")).
Prefix("/settings/profile").
Get("", new(IndexAction)).
EndAll()
})
}

View File

@@ -0,0 +1,15 @@
package security
import "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
type IndexAction struct {
actionutils.ParentAction
}
func (this *IndexAction) Init() {
this.Nav("", "", "")
}
func (this *IndexAction) RunGet(params struct{}) {
this.Show()
}

View File

@@ -0,0 +1,18 @@
package security
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/settings/settingutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
"github.com/iwind/TeaGo"
)
func init() {
TeaGo.BeforeStart(func(server *TeaGo.Server) {
server.
Helper(helpers.NewUserMustAuth()).
Helper(settingutils.NewHelper("security")).
Prefix("/settings/security").
Get("", new(IndexAction)).
EndAll()
})
}

View File

@@ -0,0 +1,39 @@
package settingutils
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/iwind/TeaGo/actions"
)
type Helper struct {
tab string
}
func NewHelper(tab string) *Helper {
return &Helper{
tab: tab,
}
}
func (this *Helper) BeforeAction(actionPtr actions.ActionWrapper) (goNext bool) {
goNext = true
action := actionPtr.Object()
// 左侧菜单
action.Data["teaMenu"] = "settings"
// 标签栏
tabbar := actionutils.NewTabbar()
tabbar.Add("管理界面", "", "/settings", "", this.tab == "console")
tabbar.Add("安全设置", "", "/settings/security", "", this.tab == "security")
tabbar.Add("API节点", "", "/api", "exchange", this.tab == "api")
tabbar.Add("日志数据库节点", "", "/db", "database", this.tab == "db")
tabbar.Add("备份", "", "/settings/backup", "", this.tab == "backup")
tabbar.Add("个人资料", "", "/settings/profile", "", this.tab == "profile")
tabbar.Add("登录设置", "", "/settings/login", "", this.tab == "login")
tabbar.Add("检查版本更新", "", "/settings/upgrade", "", this.tab == "upgrade")
actionutils.SetTabbar(actionPtr, tabbar)
return
}

View File

@@ -0,0 +1,15 @@
package upgrade
import "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
type IndexAction struct {
actionutils.ParentAction
}
func (this *IndexAction) Init() {
this.Nav("", "", "")
}
func (this *IndexAction) RunGet(params struct{}) {
this.Show()
}

View File

@@ -0,0 +1,18 @@
package upgrade
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/settings/settingutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
"github.com/iwind/TeaGo"
)
func init() {
TeaGo.BeforeStart(func(server *TeaGo.Server) {
server.
Helper(helpers.NewUserMustAuth()).
Helper(settingutils.NewHelper("upgrade")).
Prefix("/settings/upgrade").
Get("", new(IndexAction)).
EndAll()
})
}