2020-10-10 20:28:36 +08:00
|
|
|
package settingutils
|
|
|
|
|
|
|
|
|
|
import (
|
2020-12-03 11:03:12 +08:00
|
|
|
"github.com/TeaOSLab/EdgeAdmin/internal/configloaders"
|
2021-10-18 20:09:06 +08:00
|
|
|
teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const"
|
2020-10-10 20:28:36 +08:00
|
|
|
"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()
|
2020-12-03 11:03:12 +08:00
|
|
|
var session = action.Session()
|
|
|
|
|
var adminId = session.GetInt64("adminId")
|
|
|
|
|
if configloaders.AllowModule(adminId, configloaders.AdminModuleCodeSetting) {
|
|
|
|
|
tabbar.Add("Web服务", "", "/settings/server", "", this.tab == "server")
|
2020-12-16 15:49:15 +08:00
|
|
|
tabbar.Add("管理界面设置", "", "/settings/ui", "", this.tab == "ui")
|
2021-10-18 20:09:06 +08:00
|
|
|
if teaconst.IsPlus {
|
|
|
|
|
tabbar.Add("用户界面设置", "", "/settings/user-ui", "", this.tab == "userUI")
|
|
|
|
|
}
|
2020-12-03 11:03:12 +08:00
|
|
|
tabbar.Add("安全设置", "", "/settings/security", "", this.tab == "security")
|
2022-06-15 19:51:54 +08:00
|
|
|
//tabbar.Add("IP库", "", "/settings/ip-library", "", this.tab == "ipLibrary")
|
2021-12-15 20:13:10 +08:00
|
|
|
tabbar.Add("检查更新", "", "/settings/updates", "", this.tab == "updates")
|
2020-12-03 11:03:12 +08:00
|
|
|
}
|
2020-10-10 20:28:36 +08:00
|
|
|
tabbar.Add("个人资料", "", "/settings/profile", "", this.tab == "profile")
|
|
|
|
|
tabbar.Add("登录设置", "", "/settings/login", "", this.tab == "login")
|
|
|
|
|
actionutils.SetTabbar(actionPtr, tabbar)
|
|
|
|
|
|
|
|
|
|
return
|
|
|
|
|
}
|