mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-11 01:50:27 +08:00
[系统设置]增加界面设置,可以定制系统名称等
This commit is contained in:
101
internal/uimanager/ui_config.go
Normal file
101
internal/uimanager/ui_config.go
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
package uimanager
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"github.com/TeaOSLab/EdgeAdmin/internal/rpc"
|
||||||
|
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||||
|
"github.com/iwind/TeaGo/logs"
|
||||||
|
"reflect"
|
||||||
|
"sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
var sharedUIConfig *UIConfig = nil
|
||||||
|
var locker sync.Mutex
|
||||||
|
|
||||||
|
const (
|
||||||
|
UISettingName = "adminUIConfig"
|
||||||
|
)
|
||||||
|
|
||||||
|
type UIConfig struct {
|
||||||
|
ProductName string `json:"productName"` // 产品名
|
||||||
|
AdminSystemName string `json:"adminSystemName"` // 管理员系统名称
|
||||||
|
ShowOpenSourceInfo bool `json:"showOpenSourceInfo"` // 是否显示开源信息
|
||||||
|
ShowVersion bool `json:"showVersion"` // 是否显示版本号
|
||||||
|
Version string `json:"version"` // 显示的版本号
|
||||||
|
}
|
||||||
|
|
||||||
|
func LoadUIConfig() (*UIConfig, error) {
|
||||||
|
locker.Lock()
|
||||||
|
defer locker.Unlock()
|
||||||
|
|
||||||
|
config, err := loadUIConfig()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
v := reflect.Indirect(reflect.ValueOf(config)).Interface().(UIConfig)
|
||||||
|
return &v, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func UpdateUIConfig(uiConfig *UIConfig) error {
|
||||||
|
locker.Lock()
|
||||||
|
defer locker.Unlock()
|
||||||
|
|
||||||
|
var rpcClient, err = rpc.SharedRPC()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
valueJSON, err := json.Marshal(uiConfig)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
_, err = rpcClient.SysSettingRPC().UpdateSysSetting(rpcClient.Context(0), &pb.UpdateSysSettingRequest{
|
||||||
|
Code: UISettingName,
|
||||||
|
ValueJSON: valueJSON,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
sharedUIConfig = uiConfig
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func loadUIConfig() (*UIConfig, error) {
|
||||||
|
if sharedUIConfig != nil {
|
||||||
|
return sharedUIConfig, nil
|
||||||
|
}
|
||||||
|
var rpcClient, err = rpc.SharedRPC()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
resp, err := rpcClient.SysSettingRPC().ReadSysSetting(rpcClient.Context(0), &pb.ReadSysSettingRequest{
|
||||||
|
Code: UISettingName,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if len(resp.ValueJSON) == 0 {
|
||||||
|
sharedUIConfig = defaultUIConfig()
|
||||||
|
return sharedUIConfig, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
config := &UIConfig{}
|
||||||
|
err = json.Unmarshal(resp.ValueJSON, config)
|
||||||
|
if err != nil {
|
||||||
|
logs.Println("[UI_MANAGER]" + err.Error())
|
||||||
|
sharedUIConfig = defaultUIConfig()
|
||||||
|
return sharedUIConfig, nil
|
||||||
|
}
|
||||||
|
sharedUIConfig = config
|
||||||
|
return sharedUIConfig, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func defaultUIConfig() *UIConfig {
|
||||||
|
return &UIConfig{
|
||||||
|
ProductName: "GoEdge",
|
||||||
|
AdminSystemName: "GoEdge管理员系统",
|
||||||
|
ShowOpenSourceInfo: true,
|
||||||
|
ShowVersion: true,
|
||||||
|
}
|
||||||
|
}
|
||||||
29
internal/uimanager/ui_config_test.go
Normal file
29
internal/uimanager/ui_config_test.go
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
package uimanager
|
||||||
|
|
||||||
|
import (
|
||||||
|
_ "github.com/iwind/TeaGo/bootstrap"
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestLoadSecurityConfig(t *testing.T) {
|
||||||
|
for i := 0; i < 10; i++ {
|
||||||
|
before := time.Now()
|
||||||
|
config, err := LoadUIConfig()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
t.Log(time.Since(before).Seconds()*1000, "ms")
|
||||||
|
t.Logf("%p", config)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestLoadUIConfig2(t *testing.T) {
|
||||||
|
for i := 0; i < 10; i++ {
|
||||||
|
config, err := LoadUIConfig()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
t.Log(config)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
|
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
|
||||||
"github.com/TeaOSLab/EdgeAdmin/internal/rpc"
|
"github.com/TeaOSLab/EdgeAdmin/internal/rpc"
|
||||||
"github.com/TeaOSLab/EdgeAdmin/internal/setup"
|
"github.com/TeaOSLab/EdgeAdmin/internal/setup"
|
||||||
|
"github.com/TeaOSLab/EdgeAdmin/internal/uimanager"
|
||||||
"github.com/TeaOSLab/EdgeAdmin/internal/utils"
|
"github.com/TeaOSLab/EdgeAdmin/internal/utils"
|
||||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
|
||||||
@@ -48,6 +49,13 @@ func (this *IndexAction) RunGet(params struct {
|
|||||||
this.Data["token"] = stringutil.Md5(TokenSalt+timestamp) + timestamp
|
this.Data["token"] = stringutil.Md5(TokenSalt+timestamp) + timestamp
|
||||||
this.Data["from"] = params.From
|
this.Data["from"] = params.From
|
||||||
|
|
||||||
|
config, err := uimanager.LoadUIConfig()
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.Data["systemName"] = config.AdminSystemName
|
||||||
|
|
||||||
this.Show()
|
this.Show()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,5 +13,5 @@ func (this *IndexAction) Init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *IndexAction) RunGet(params struct{}) {
|
func (this *IndexAction) RunGet(params struct{}) {
|
||||||
this.RedirectURL("/settings/ui")
|
this.RedirectURL("/settings/server")
|
||||||
}
|
}
|
||||||
|
|||||||
27
internal/web/actions/default/settings/server/index.go
Normal file
27
internal/web/actions/default/settings/server/index.go
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
package server
|
||||||
|
|
||||||
|
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.Data["serverIsChanged"] = serverConfigIsChanged
|
||||||
|
|
||||||
|
serverConfig, err := loadServerConfig()
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.Data["serverConfig"] = serverConfig
|
||||||
|
|
||||||
|
this.Show()
|
||||||
|
}
|
||||||
20
internal/web/actions/default/settings/server/init.go
Normal file
20
internal/web/actions/default/settings/server/init.go
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
package server
|
||||||
|
|
||||||
|
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("server")).
|
||||||
|
Prefix("/settings/server").
|
||||||
|
Get("", new(IndexAction)).
|
||||||
|
GetPost("/updateHTTPPopup", new(UpdateHTTPPopupAction)).
|
||||||
|
GetPost("/updateHTTPSPopup", new(UpdateHTTPSPopupAction)).
|
||||||
|
EndAll()
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package ui
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/TeaOSLab/EdgeAdmin/internal/utils"
|
"github.com/TeaOSLab/EdgeAdmin/internal/utils"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package ui
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package ui
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/iwind/TeaGo"
|
"github.com/iwind/TeaGo"
|
||||||
@@ -25,7 +25,8 @@ func (this *Helper) BeforeAction(actionPtr actions.ActionWrapper) (goNext bool)
|
|||||||
|
|
||||||
// 标签栏
|
// 标签栏
|
||||||
tabbar := actionutils.NewTabbar()
|
tabbar := actionutils.NewTabbar()
|
||||||
tabbar.Add("管理界面", "", "/settings", "", this.tab == "ui")
|
tabbar.Add("Web服务", "", "/settings/server", "", this.tab == "server")
|
||||||
|
tabbar.Add("界面设置", "", "/settings/ui", "", this.tab == "ui")
|
||||||
tabbar.Add("安全设置", "", "/settings/security", "", this.tab == "security")
|
tabbar.Add("安全设置", "", "/settings/security", "", this.tab == "security")
|
||||||
tabbar.Add("数据库", "", "/settings/database", "", this.tab == "database")
|
tabbar.Add("数据库", "", "/settings/database", "", this.tab == "database")
|
||||||
tabbar.Add("API节点", "", "/api", "", this.tab == "apiNodes")
|
tabbar.Add("API节点", "", "/api", "", this.tab == "apiNodes")
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
package ui
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/TeaOSLab/EdgeAdmin/internal/uimanager"
|
||||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||||
|
"github.com/iwind/TeaGo/actions"
|
||||||
)
|
)
|
||||||
|
|
||||||
type IndexAction struct {
|
type IndexAction struct {
|
||||||
@@ -13,15 +15,47 @@ func (this *IndexAction) Init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *IndexAction) RunGet(params struct{}) {
|
func (this *IndexAction) RunGet(params struct{}) {
|
||||||
this.Data["serverIsChanged"] = serverConfigIsChanged
|
config, err := uimanager.LoadUIConfig()
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.Data["config"] = config
|
||||||
|
|
||||||
serverConfig, err := loadServerConfig()
|
this.Show()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *IndexAction) RunPost(params struct {
|
||||||
|
ProductName string
|
||||||
|
AdminSystemName string
|
||||||
|
ShowOpenSourceInfo bool
|
||||||
|
ShowVersion bool
|
||||||
|
Version string
|
||||||
|
|
||||||
|
Must *actions.Must
|
||||||
|
CSRF *actionutils.CSRF
|
||||||
|
}) {
|
||||||
|
params.Must.
|
||||||
|
Field("productName", params.ProductName).
|
||||||
|
Require("请输入产品名称").
|
||||||
|
Field("adminSystemName", params.AdminSystemName).
|
||||||
|
Require("请输入管理员系统名称")
|
||||||
|
|
||||||
|
config, err := uimanager.LoadUIConfig()
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
config.ProductName = params.ProductName
|
||||||
|
config.AdminSystemName = params.AdminSystemName
|
||||||
|
config.ShowOpenSourceInfo = params.ShowOpenSourceInfo
|
||||||
|
config.ShowVersion = params.ShowVersion
|
||||||
|
config.Version = params.Version
|
||||||
|
err = uimanager.UpdateUIConfig(config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
this.ErrorPage(err)
|
this.ErrorPage(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
this.Data["serverConfig"] = serverConfig
|
this.Success()
|
||||||
|
|
||||||
this.Show()
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package ui
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/settings/settingutils"
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/settings/settingutils"
|
||||||
@@ -12,9 +12,7 @@ func init() {
|
|||||||
Helper(helpers.NewUserMustAuth()).
|
Helper(helpers.NewUserMustAuth()).
|
||||||
Helper(settingutils.NewHelper("ui")).
|
Helper(settingutils.NewHelper("ui")).
|
||||||
Prefix("/settings/ui").
|
Prefix("/settings/ui").
|
||||||
Get("", new(IndexAction)).
|
GetPost("", new(IndexAction)).
|
||||||
GetPost("/updateHTTPPopup", new(UpdateHTTPPopupAction)).
|
|
||||||
GetPost("/updateHTTPSPopup", new(UpdateHTTPSPopupAction)).
|
|
||||||
EndAll()
|
EndAll()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
nodes "github.com/TeaOSLab/EdgeAdmin/internal/rpc"
|
nodes "github.com/TeaOSLab/EdgeAdmin/internal/rpc"
|
||||||
"github.com/TeaOSLab/EdgeAdmin/internal/securitymanager"
|
"github.com/TeaOSLab/EdgeAdmin/internal/securitymanager"
|
||||||
"github.com/TeaOSLab/EdgeAdmin/internal/setup"
|
"github.com/TeaOSLab/EdgeAdmin/internal/setup"
|
||||||
|
"github.com/TeaOSLab/EdgeAdmin/internal/uimanager"
|
||||||
"github.com/TeaOSLab/EdgeAdmin/internal/utils"
|
"github.com/TeaOSLab/EdgeAdmin/internal/utils"
|
||||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||||
"github.com/iwind/TeaGo/actions"
|
"github.com/iwind/TeaGo/actions"
|
||||||
@@ -83,13 +84,20 @@ func (this *UserMustAuth) BeforeAction(actionPtr actions.ActionWrapper, paramNam
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
config, err := uimanager.LoadUIConfig()
|
||||||
|
if err != nil {
|
||||||
|
action.WriteString(err.Error())
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
// 初始化内置方法
|
// 初始化内置方法
|
||||||
action.ViewFunc("teaTitle", func() string {
|
action.ViewFunc("teaTitle", func() string {
|
||||||
return action.Data["teaTitle"].(string)
|
return action.Data["teaTitle"].(string)
|
||||||
})
|
})
|
||||||
|
|
||||||
action.Data["teaTitle"] = teaconst.ProductNameZH
|
action.Data["teaShowVersion"] = config.ShowVersion
|
||||||
action.Data["teaName"] = teaconst.ProductNameZH
|
action.Data["teaTitle"] = config.AdminSystemName
|
||||||
|
action.Data["teaName"] = config.ProductName
|
||||||
|
|
||||||
resp, err := rpc.AdminRPC().FindAdminFullname(rpc.Context(0), &pb.FindAdminFullnameRequest{AdminId: int64(this.AdminId)})
|
resp, err := rpc.AdminRPC().FindAdminFullname(rpc.Context(0), &pb.FindAdminFullnameRequest{AdminId: int64(this.AdminId)})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -105,7 +113,12 @@ func (this *UserMustAuth) BeforeAction(actionPtr actions.ActionWrapper, paramNam
|
|||||||
action.Data["teaModules"] = this.modules()
|
action.Data["teaModules"] = this.modules()
|
||||||
action.Data["teaSubMenus"] = []map[string]interface{}{}
|
action.Data["teaSubMenus"] = []map[string]interface{}{}
|
||||||
action.Data["teaTabbar"] = []map[string]interface{}{}
|
action.Data["teaTabbar"] = []map[string]interface{}{}
|
||||||
|
if len(config.Version) == 0 {
|
||||||
action.Data["teaVersion"] = teaconst.Version
|
action.Data["teaVersion"] = teaconst.Version
|
||||||
|
} else {
|
||||||
|
action.Data["teaVersion"] = config.Version
|
||||||
|
}
|
||||||
|
action.Data["teaShowOpenSourceInfo"] = config.ShowOpenSourceInfo
|
||||||
action.Data["teaIsSuper"] = false
|
action.Data["teaIsSuper"] = false
|
||||||
action.Data["teaDemoEnabled"] = teaconst.IsDemo
|
action.Data["teaDemoEnabled"] = teaconst.IsDemo
|
||||||
if !action.Data.Has("teaSubMenu") {
|
if !action.Data.Has("teaSubMenu") {
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ import (
|
|||||||
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/settings/login"
|
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/settings/login"
|
||||||
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/settings/profile"
|
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/settings/profile"
|
||||||
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/settings/security"
|
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/settings/security"
|
||||||
|
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/settings/server"
|
||||||
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/settings/ui"
|
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/settings/ui"
|
||||||
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/settings/upgrade"
|
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/settings/upgrade"
|
||||||
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/setup"
|
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/setup"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="zh">
|
<html lang="zh">
|
||||||
<head>
|
<head>
|
||||||
<title>{$.teaTitle}管理员系统</title>
|
<title>{$.teaTitle}</title>
|
||||||
<meta charset="UTF-8"/>
|
<meta charset="UTF-8"/>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0">
|
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0">
|
||||||
<link rel="shortcut icon" href="/images/favicon.png"/>
|
<link rel="shortcut icon" href="/images/favicon.png"/>
|
||||||
@@ -23,12 +23,12 @@
|
|||||||
<!-- 顶部导航 -->
|
<!-- 顶部导航 -->
|
||||||
<div class="ui menu top-nav blue inverted small borderless" v-cloak="">
|
<div class="ui menu top-nav blue inverted small borderless" v-cloak="">
|
||||||
<a href="/" class="item">
|
<a href="/" class="item">
|
||||||
<i class="ui icon leaf"></i> {{teaName}}管理员系统 <sup>v{{teaVersion}}</sup>
|
<i class="ui icon leaf"></i> {{teaTitle}} <sup v-if="teaShowVersion">v{{teaVersion}}</sup>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<div class="right menu">
|
<div class="right menu">
|
||||||
<a href="/messages" class="item" :class="{active:teaMenu == 'message'}"><span :class="{'blink':globalMessageBadge > 0}"><i class="icon bell"></i>消息({{globalMessageBadge}}) </span></a>
|
<a href="/messages" class="item" :class="{active:teaMenu == 'message'}"><span :class="{'blink':globalMessageBadge > 0}"><i class="icon bell"></i>消息({{globalMessageBadge}}) </span></a>
|
||||||
<a href="/settings/profile" class="item" :class="{active: teaMenu == 'settings'}">
|
<a href="/settings/profile" class="item">
|
||||||
<i class="icon user" v-if="teaUserAvatar.length == 0"></i>
|
<i class="icon user" v-if="teaUserAvatar.length == 0"></i>
|
||||||
<img class="avatar" alt="" :src="teaUserAvatar" v-if="teaUserAvatar.length > 0"/>
|
<img class="avatar" alt="" :src="teaUserAvatar" v-if="teaUserAvatar.length > 0"/>
|
||||||
{{teaUsername}}
|
{{teaUsername}}
|
||||||
@@ -76,7 +76,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 底部 -->
|
<!-- 底部 -->
|
||||||
<div id="footer" class="ui menu inverted light-blue borderless small">
|
<div id="footer" class="ui menu inverted light-blue borderless small" v-if="teaShowOpenSourceInfo">
|
||||||
<a href="/settings/upgrade" class="item" title="点击进入检查版本更新页面">{{teaName}} v{{teaVersion}}</a>
|
<a href="/settings/upgrade" class="item" title="点击进入检查版本更新页面">{{teaName}} v{{teaVersion}}</a>
|
||||||
<a href="https://github.com/TeaOSLab/EdgeAdmin" target="_blank" class="item">GitHub</a>
|
<a href="https://github.com/TeaOSLab/EdgeAdmin" target="_blank" class="item">GitHub</a>
|
||||||
<!--<a href="http://teaos.cn" target="_blank" class="item">官网</a>
|
<!--<a href="http://teaos.cn" target="_blank" class="item">官网</a>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||||
<link rel="shortcut icon" href="/images/favicon.png"/>
|
<link rel="shortcut icon" href="/images/favicon.png"/>
|
||||||
<title>登录Edge管理员系统</title>
|
<title>登录{$.systemName}</title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0">
|
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0">
|
||||||
{$TEA.VUE}
|
{$TEA.VUE}
|
||||||
{$TEA.SEMANTIC}
|
{$TEA.SEMANTIC}
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
<input type="hidden" name="token" v-model="token"/>
|
<input type="hidden" name="token" v-model="token"/>
|
||||||
<div class="ui segment stacked">
|
<div class="ui segment stacked">
|
||||||
<div class="ui header">
|
<div class="ui header">
|
||||||
登录Edge管理员系统
|
登录{$.systemName}
|
||||||
</div>
|
</div>
|
||||||
<div class="ui field">
|
<div class="ui field">
|
||||||
<div class="ui left icon input">
|
<div class="ui left icon input">
|
||||||
|
|||||||
54
web/views/@default/settings/server/index.html
Normal file
54
web/views/@default/settings/server/index.html
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
{$layout}
|
||||||
|
|
||||||
|
<div class="ui message warning" v-if="serverIsChanged">服务配置已修改,请在命令行下重启后生效。</div>
|
||||||
|
|
||||||
|
<h3>HTTP <a href="/settings/server/http" v-if="!teaDemoEnabled" @click.prevent="updateHTTP()">修改</a><a v-if="teaDemoEnabled">[演示版无法修改]</a></h3>
|
||||||
|
|
||||||
|
<table class="ui table definition selectable">
|
||||||
|
<tr>
|
||||||
|
<td>状态</td>
|
||||||
|
<td>
|
||||||
|
<label-on :v-is-on="serverConfig.http.on"></label-on>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="title">绑定地址</td>
|
||||||
|
<td>
|
||||||
|
<span v-for="listen in serverConfig.http.listen" class="ui label tiny basic">{{listen}}</span>
|
||||||
|
<p class="ui comment">如果地址中的IP是0.0.0.0,表示服务器的所有IP都可以用来使用访问此服务。</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div class="ui divider"></div>
|
||||||
|
|
||||||
|
<h3>HTTPS <a href="" v-if="!teaDemoEnabled" @click.prevent="updateHTTPS()">修改</a><a v-if="teaDemoEnabled">[演示版无法修改]</a></h3>
|
||||||
|
<table class="ui table definition selectable">
|
||||||
|
<tr>
|
||||||
|
<td>状态</td>
|
||||||
|
<td>
|
||||||
|
<label-on :v-is-on="serverConfig.https.on"></label-on>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="title">绑定地址</td>
|
||||||
|
<td>
|
||||||
|
<span v-for="listen in serverConfig.https.listen" class="ui label tiny basic">{{listen}}</span>
|
||||||
|
<p class="ui comment">如果地址中的IP是0.0.0.0,表示服务器的所有IP都可以用来使用访问此服务。</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>证书文件<span class="small">(Cert)</span></td>
|
||||||
|
<td>
|
||||||
|
<span v-if="serverConfig.https.cert.length > 0">{{serverConfig.https.cert}}</span>
|
||||||
|
<span class="disabled" v-else>还没有设置证书</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>私钥文件<span class="small">(Key)</span></td>
|
||||||
|
<td>
|
||||||
|
<span v-if="serverConfig.https.key.length > 0">{{serverConfig.https.key}}</span>
|
||||||
|
<span class="disabled" v-else>还没有设置私钥</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
19
web/views/@default/settings/server/index.js
Normal file
19
web/views/@default/settings/server/index.js
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
Tea.context(function () {
|
||||||
|
this.updateHTTP = function () {
|
||||||
|
teaweb.popup("/settings/server/updateHTTPPopup", {
|
||||||
|
callback: function () {
|
||||||
|
teaweb.success("保存成功", teaweb.reload)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
this.updateHTTPS = function () {
|
||||||
|
teaweb.popup("/settings/server/updateHTTPSPopup", {
|
||||||
|
height: "26em",
|
||||||
|
width:"50em",
|
||||||
|
callback: function () {
|
||||||
|
teaweb.success("保存成功", teaweb.reload)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
@@ -1,54 +1,41 @@
|
|||||||
{$layout}
|
{$layout}
|
||||||
|
|
||||||
<div class="ui message warning" v-if="serverIsChanged">服务配置已修改,请在命令行下重启后生效。</div>
|
<form class="ui form" method="post" data-tea-action="$" data-tea-success="success">
|
||||||
|
<csrf-token></csrf-token>
|
||||||
|
|
||||||
<h3>HTTP <a href="/settings/server/http" v-if="!teaDemoEnabled" @click.prevent="updateHTTP()">修改</a><a v-if="teaDemoEnabled">[演示版无法修改]</a></h3>
|
<table class="ui table definition selectable">
|
||||||
|
<tr>
|
||||||
|
<td class="title">产品名称 *</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" name="productName" v-model="config.productName" maxlength="100"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>管理员系统名称 *</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" name="adminSystemName" v-model="config.adminSystemName" maxlength="100"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>是否显示底部开源信息</td>
|
||||||
|
<td>
|
||||||
|
<checkbox name="showOpenSourceInfo" v-model="config.showOpenSourceInfo"></checkbox>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>是否显示版本号</td>
|
||||||
|
<td>
|
||||||
|
<checkbox name="showVersion" v-model="config.showVersion"></checkbox>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr v-show="config.showVersion">
|
||||||
|
<td>定制版本号</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" name="version" v-model="config.version" maxlength="100"/>
|
||||||
|
<p class="comment">定制自己的版本号,留空表示使用系统自带的版本号。</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
<table class="ui table definition selectable">
|
<submit-btn></submit-btn>
|
||||||
<tr>
|
</form>
|
||||||
<td>状态</td>
|
|
||||||
<td>
|
|
||||||
<label-on :v-is-on="serverConfig.http.on"></label-on>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="title">绑定地址</td>
|
|
||||||
<td>
|
|
||||||
<span v-for="listen in serverConfig.http.listen" class="ui label tiny basic">{{listen}}</span>
|
|
||||||
<p class="ui comment">如果地址中的IP是0.0.0.0,表示服务器的所有IP都可以用来使用访问此服务。</p>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<div class="ui divider"></div>
|
|
||||||
|
|
||||||
<h3>HTTPS <a href="" v-if="!teaDemoEnabled" @click.prevent="updateHTTPS()">修改</a><a v-if="teaDemoEnabled">[演示版无法修改]</a></h3>
|
|
||||||
<table class="ui table definition selectable">
|
|
||||||
<tr>
|
|
||||||
<td>状态</td>
|
|
||||||
<td>
|
|
||||||
<label-on :v-is-on="serverConfig.https.on"></label-on>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="title">绑定地址</td>
|
|
||||||
<td>
|
|
||||||
<span v-for="listen in serverConfig.https.listen" class="ui label tiny basic">{{listen}}</span>
|
|
||||||
<p class="ui comment">如果地址中的IP是0.0.0.0,表示服务器的所有IP都可以用来使用访问此服务。</p>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>证书文件<span class="small">(Cert)</span></td>
|
|
||||||
<td>
|
|
||||||
<span v-if="serverConfig.https.cert.length > 0">{{serverConfig.https.cert}}</span>
|
|
||||||
<span class="disabled" v-else>还没有设置证书</span>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>私钥文件<span class="small">(Key)</span></td>
|
|
||||||
<td>
|
|
||||||
<span v-if="serverConfig.https.key.length > 0">{{serverConfig.https.key}}</span>
|
|
||||||
<span class="disabled" v-else>还没有设置私钥</span>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
@@ -1,19 +1,3 @@
|
|||||||
Tea.context(function () {
|
Tea.context(function () {
|
||||||
this.updateHTTP = function () {
|
this.success = NotifyReloadSuccess("保存成功")
|
||||||
teaweb.popup("/settings/ui/updateHTTPPopup", {
|
|
||||||
callback: function () {
|
|
||||||
teaweb.success("保存成功", teaweb.reload)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
this.updateHTTPS = function () {
|
|
||||||
teaweb.popup("/settings/ui/updateHTTPSPopup", {
|
|
||||||
height: "26em",
|
|
||||||
width:"50em",
|
|
||||||
callback: function () {
|
|
||||||
teaweb.success("保存成功", teaweb.reload)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
Reference in New Issue
Block a user