Skip to content

Commit

Permalink
v2.6.6版本发布 (#1784)
Browse files Browse the repository at this point in the history
* 前端支持顶部菜单栏模式

* 自动化代码单条获取方法不再需要取data.xxx直接取用data

* 自动化代码支持选择索引

* 自动化代码回滚支持自行选择是否删除菜单、API、表

* 日志增加定期清理功能

* 权限配置API部分,支持根据API真实path进行筛选

* 修复了一些已知bug

* 修复了一个sql注入漏洞

---------

Co-authored-by: xuedinge <[email protected]>
Co-authored-by: Qing Liang <[email protected]>
Co-authored-by: wall-js <[email protected]>
Co-authored-by: Wall <[email protected]>
Co-authored-by: leooza <[email protected]>
Co-authored-by: piexlMax(奇淼 <[email protected]>
Co-authored-by: hxl <[email protected]>
Co-authored-by: zsc1003 <[email protected]>
  • Loading branch information
9 people authored Jun 15, 2024
1 parent b336529 commit 03e5bc5
Show file tree
Hide file tree
Showing 34 changed files with 870 additions and 548 deletions.
1 change: 1 addition & 0 deletions server/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ zap:
encode-level: LowercaseColorLevelEncoder
stacktrace-key: stacktrace
log-in-console: true
retention-day: -1

# redis configuration
redis:
Expand Down
1 change: 1 addition & 0 deletions server/config/zap.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ type Zap struct {
StacktraceKey string `mapstructure:"stacktrace-key" json:"stacktrace-key" yaml:"stacktrace-key"` // 栈名
ShowLine bool `mapstructure:"show-line" json:"show-line" yaml:"show-line"` // 显示行
LogInConsole bool `mapstructure:"log-in-console" json:"log-in-console" yaml:"log-in-console"` // 输出控制台
RetentionDay int `mapstructure:"retention-day" json:"retention-day" yaml:"retention-day"` // 日志保留天数
}

// Levels 根据字符串转化为 zapcore.Levels
Expand Down
46 changes: 36 additions & 10 deletions server/core/internal/cutter.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ import (
// Cutter 实现 io.Writer 接口
// 用于日志切割, strings.Join([]string{director,layout, formats..., level+".log"}, os.PathSeparator)
type Cutter struct {
level string // 日志级别(debug, info, warn, error, dpanic, panic, fatal)
layout string // 时间格式 2006-01-02 15:04:05
formats []string // 自定义参数([]string{Director,"2006-01-02", "business"(此参数可不写), level+".log"}
director string // 日志文件夹
file *os.File // 文件句柄
mutex *sync.RWMutex // 读写锁
level string // 日志级别(debug, info, warn, error, dpanic, panic, fatal)
layout string // 时间格式 2006-01-02 15:04:05
formats []string // 自定义参数([]string{Director,"2006-01-02", "business"(此参数可不写), level+".log"}
director string // 日志文件夹
retentionDay int //日志保留天数
file *os.File // 文件句柄
mutex *sync.RWMutex // 读写锁
}

type CutterOption func(*Cutter)
Expand All @@ -36,11 +37,12 @@ func CutterWithFormats(format ...string) CutterOption {
}
}

func NewCutter(director string, level string, options ...CutterOption) *Cutter {
func NewCutter(director string, level string, retentionDay int, options ...CutterOption) *Cutter {
rotate := &Cutter{
level: level,
director: director,
mutex: new(sync.RWMutex),
level: level,
director: director,
retentionDay: retentionDay,
mutex: new(sync.RWMutex),
}
for i := 0; i < len(options); i++ {
options[i](rotate)
Expand Down Expand Up @@ -77,6 +79,10 @@ func (c *Cutter) Write(bytes []byte) (n int, err error) {
if err != nil {
return 0, err
}
err = removeNDaysFolders(c.director, c.retentionDay)
if err != nil {
return 0, err
}
c.file, err = os.OpenFile(filename, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0644)
if err != nil {
return 0, err
Expand All @@ -93,3 +99,23 @@ func (c *Cutter) Sync() error {
}
return nil
}

// 增加日志目录文件清理 小于等于零的值默认忽略不再处理
func removeNDaysFolders(dir string, days int) error {
if days <= 0 {
return nil
}
cutoff := time.Now().AddDate(0, 0, -days)
return filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {
if err != nil {
return err
}
if info.IsDir() && info.ModTime().Before(cutoff) && path != dir {
err = os.RemoveAll(path)
if err != nil {
return err
}
}
return nil
})
}
1 change: 1 addition & 0 deletions server/core/internal/zap_core.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ func (z *ZapCore) WriteSyncer(formats ...string) zapcore.WriteSyncer {
cutter := NewCutter(
global.GVA_CONFIG.Zap.Director,
z.level.String(),
global.GVA_CONFIG.Zap.RetentionDay,
CutterWithLayout(time.DateOnly),
CutterWithFormats(formats...),
)
Expand Down
2 changes: 2 additions & 0 deletions server/model/system/request/sys_auto_history.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ type SysAutoHistory struct {
type RollBack struct {
ID int `json:"id" form:"id"` // 主键ID
DeleteTable bool `json:"deleteTable" form:"deleteTable"` // 是否删除表
DeleteApi bool `json:"deleteApi" form:"deleteApi"` // 是否删除接口
DeleteMenu bool `json:"deleteMenu" form:"deleteMenu"` // 是否删除菜单
}
1 change: 1 addition & 0 deletions server/model/system/sys_auto_code.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ type Field struct {
PrimaryKey bool `json:"primaryKey"` // 是否主键
DataSource *DataSource `json:"dataSource"` // 数据源
CheckDataSource bool `json:"checkDataSource"` // 是否检查数据源
FieldIndexType string `json:"fieldIndexType"` // 索引类型
}

type SysAutoCode struct {
Expand Down
2 changes: 1 addition & 1 deletion server/resource/autocode_template/server/api.go.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Find{{.StructName}}(c *gin.Conte
global.GVA_LOG.Error("查询失败!", zap.Error(err))
response.FailWithMessage("查询失败", c)
} else {
response.OkWithData(gin.H{"re{{.Abbreviation}}": re{{.Abbreviation}}}, c)
response.OkWithData(re{{.Abbreviation}}, c)
}
}

Expand Down
20 changes: 10 additions & 10 deletions server/resource/autocode_template/server/model.go.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,25 @@ type {{.StructName}} struct {
{{ if .GvaModel }} global.GVA_MODEL {{ end }}
{{- range .Fields}}
{{- if eq .FieldType "enum" }}
{{.FieldName}} string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};type:enum({{.DataTypeLong}});comment:{{.Comment}};" {{- if .Require }} binding:"required"{{- end -}}`
{{.FieldName}} string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};type:enum({{.DataTypeLong}});comment:{{.Comment}};" {{- if .Require }} binding:"required"{{- end -}}`
{{- else if eq .FieldType "picture" }}
{{.FieldName}} string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end -}}`
{{.FieldName}} string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end -}}`
{{- else if eq .FieldType "video" }}
{{.FieldName}} string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end -}}`
{{.FieldName}} string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end -}}`
{{- else if eq .FieldType "file" }}
{{.FieldName}} datatypes.JSON `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end -}} swaggertype:"array,object"`
{{.FieldName}} datatypes.JSON `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end -}} swaggertype:"array,object"`
{{- else if eq .FieldType "pictures" }}
{{.FieldName}} datatypes.JSON `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end -}} swaggertype:"array,object"`
{{.FieldName}} datatypes.JSON `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end -}} swaggertype:"array,object"`
{{- else if eq .FieldType "richtext" }}
{{.FieldName}} string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}type:text;" {{- if .Require }} binding:"required"{{- end -}}`
{{.FieldName}} string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}type:text;" {{- if .Require }} binding:"required"{{- end -}}`
{{- else if eq .FieldType "json" }}
{{.FieldName}} datatypes.JSON `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}type:text;" {{- if .Require }} binding:"required"{{- end -}} swaggertype:"object"`
{{.FieldName}} datatypes.JSON `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}type:text;" {{- if .Require }} binding:"required"{{- end -}} swaggertype:"object"`
{{- else if eq .FieldType "array" }}
{{.FieldName}} datatypes.JSON `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}type:text;" {{- if .Require }} binding:"required"{{- end -}} swaggertype:"array,object"`
{{.FieldName}} datatypes.JSON `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}type:text;" {{- if .Require }} binding:"required"{{- end -}} swaggertype:"array,object"`
{{- else if ne .FieldType "string" }}
{{.FieldName}} *{{.FieldType}} `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end -}}`
{{.FieldName}} *{{.FieldType}} `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end -}}`
{{- else }}
{{.FieldName}} {{.FieldType}} `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end -}}`
{{.FieldName}} {{.FieldType}} `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end -}}`
{{- end }} {{ if .FieldDesc }}//{{.FieldDesc}} {{ end }} {{- end }}
{{- if .AutoCreateResource }}
CreatedBy uint `gorm:"column:created_by;comment:创建者"`
Expand Down
2 changes: 1 addition & 1 deletion server/resource/autocode_template/web/form.vue.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ const formData = ref({
{{.FieldJson}}: '',
{{- end }}
{{- if eq .FieldType "int" }}
{{.FieldJson}}: {{- if .DictType }} undefined{{ else }} 0{{- end }},
{{.FieldJson}}: {{- if or .DictType .DataSource }} undefined{{ else }} 0{{- end }},
{{- end }}
{{- if eq .FieldType "time.Time" }}
{{.FieldJson}}: new Date(),
Expand Down
6 changes: 3 additions & 3 deletions server/resource/autocode_template/web/table.vue.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ const formData = ref({
{{.FieldJson}}: '',
{{- end }}
{{- if eq .FieldType "int" }}
{{.FieldJson}}: {{- if .DictType }} undefined{{ else }} 0{{- end }},
{{.FieldJson}}: {{- if or .DictType .DataSource}} undefined{{ else }} 0{{- end }},
{{- end }}
{{- if eq .FieldType "time.Time" }}
{{.FieldJson}}: new Date(),
Expand Down Expand Up @@ -659,7 +659,7 @@ const update{{.StructName}}Func = async(row) => {
const res = await find{{.StructName}}({ {{.PrimaryField.FieldJson}}: row.{{.PrimaryField.FieldJson}} })
type.value = 'update'
if (res.code === 0) {
formData.value = res.data.re{{.Abbreviation}}
formData.value = res.data
dialogFormVisible.value = true
}
}
Expand Down Expand Up @@ -704,7 +704,7 @@ const closeDialog = () => {
{{.FieldJson}}: '',
{{- end }}
{{- if eq .FieldType "int" }}
{{.FieldJson}}: {{- if .DictType }} undefined{{ else }} 0{{- end }},
{{.FieldJson}}: {{- if or .DictType .DataSource }} undefined{{ else }} 0{{- end }},
{{- end }}
{{- if eq .FieldType "time.Time" }}
{{.FieldJson}}: new Date(),
Expand Down
41 changes: 22 additions & 19 deletions server/service/system/sys_autocode_history.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ package system
import (
"errors"
"fmt"
systemReq "github.com/flipped-aurora/gin-vue-admin/server/model/system/request"
"github.com/flipped-aurora/gin-vue-admin/server/utils/ast"
"path/filepath"
"strconv"
"strings"
"time"

systemReq "github.com/flipped-aurora/gin-vue-admin/server/model/system/request"
"github.com/flipped-aurora/gin-vue-admin/server/utils/ast"

"github.com/flipped-aurora/gin-vue-admin/server/model/system/response"

"github.com/flipped-aurora/gin-vue-admin/server/global"
Expand Down Expand Up @@ -71,26 +72,28 @@ func (autoCodeHistoryService *AutoCodeHistoryService) RollBack(info *systemReq.R
return err
}
// 清除API表

ids := request.IdsReq{}
idsStr := strings.Split(md.ApiIDs, ";")
for i := range idsStr[0 : len(idsStr)-1] {
id, err := strconv.Atoi(idsStr[i])
var err error
if info.DeleteApi {
ids := request.IdsReq{}
idsStr := strings.Split(md.ApiIDs, ";")
for i := range idsStr[0 : len(idsStr)-1] {
id, err := strconv.Atoi(idsStr[i])
if err != nil {
return err
}
ids.Ids = append(ids.Ids, id)
}
err = ApiServiceApp.DeleteApisByIds(ids)
if err != nil {
return err
global.GVA_LOG.Error("ClearTag DeleteApiByIds:", zap.Error(err))
}
ids.Ids = append(ids.Ids, id)
}
err := ApiServiceApp.DeleteApisByIds(ids)

if err != nil {
global.GVA_LOG.Error("ClearTag DeleteApiByIds:", zap.Error(err))
}

err = BaseMenuServiceApp.DeleteBaseMenu(int(md.MenuID))

if err != nil {
global.GVA_LOG.Error("ClearTag DeleteBaseMenu:", zap.Error(err))
// 清除菜单表
if info.DeleteMenu {
err = BaseMenuServiceApp.DeleteBaseMenu(int(md.MenuID))
if err != nil {
global.GVA_LOG.Error("ClearTag DeleteBaseMenu:", zap.Error(err))
}
}

// 删除表
Expand Down
4 changes: 3 additions & 1 deletion web/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
node_modules/*
package-lock.json
yarn.lock
yarn.lock
bun.lockb
config.yaml
2 changes: 1 addition & 1 deletion web/src/components/warningBar/warningBar.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div
class="px-1.5 py-2 flex items-center bg-amber-50 gap-2 mb-3 text-amber-500 dark:bg-gray-900 dark:text-gray-200"
class="px-1.5 py-2 flex items-center rounded-sm mt-2 bg-amber-50 gap-2 mb-3 text-amber-500 dark:bg-amber-700 dark:text-gray-200"
:class="href&&'cursor-pointer'"
@click="open"
>
Expand Down
3 changes: 2 additions & 1 deletion web/src/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
"layout_side_width":200,
"layout_side_collapsed_width":60,
"layout_side_item_height":44,
"show_watermark":true}
"show_watermark":true,
"side_mode":"normal"}
10 changes: 8 additions & 2 deletions web/src/pinia/modules/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { setBodyPrimaryColor } from '@/utils/format'
export const useAppStore = defineStore('app', () => {
const theme = ref(localStorage.getItem('theme') || 'light')
const device = ref("")

const config = reactive({
weakness: false,
grey: false,
Expand All @@ -17,6 +16,8 @@ export const useAppStore = defineStore('app', () => {
layout_side_collapsed_width : 80,
layout_side_item_height : 48,
show_watermark: false,

side_mode : 'normal'
})

// 初始化配置
Expand Down Expand Up @@ -119,6 +120,10 @@ export const useAppStore = defineStore('app', () => {
config.show_watermark = e;
}

const toggleSideModel= (e) =>{
config.side_mode = e
}

if(config.darkMode === 'auto'){
toggleDarkModeAuto()
}
Expand All @@ -138,7 +143,8 @@ export const useAppStore = defineStore('app', () => {
toggleConfigSideWidth,
toggleConfigSideCollapsedWidth,
toggleConfigSideItemHeight,
toggleConfigWatermark
toggleConfigWatermark,
toggleSideModel
}

})
2 changes: 1 addition & 1 deletion web/src/style/element_visiable.scss
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
}

.el-sub-menu.is-active{
.el-sub-menu__title{
> .el-sub-menu__title{
color: var(--el-color-primary) !important;
}
}
Expand Down
6 changes: 3 additions & 3 deletions web/src/style/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
}

.gva-table-box {
@apply p-4 bg-white text-slate-700 dark:text-slate-400 dark:bg-slate-900 rounded m-2;
@apply p-4 bg-white text-slate-700 dark:text-slate-400 dark:bg-slate-900 rounded my-2;
.el-table{
@apply border-x border-t border-b-0 rounded border-table-border border-solid -mx-[1px];
}
Expand All @@ -34,11 +34,11 @@


.gva-search-box {
@apply p-4 bg-white text-slate-700 dark:text-slate-400 dark:bg-slate-900 rounded m-2;
@apply p-4 bg-white text-slate-700 dark:text-slate-400 dark:bg-slate-900 rounded my-2;
}

.gva-form-box {
@apply p-4 bg-white text-slate-700 dark:text-slate-400 dark:bg-slate-900 rounded m-2;
@apply p-4 bg-white text-slate-700 dark:text-slate-400 dark:bg-slate-900 rounded my-2;
}

.el-tree--highlight-current .el-tree-node.is-current > .el-tree-node__content{
Expand Down
2 changes: 1 addition & 1 deletion web/src/view/dashboard/index.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class="grid grid-cols-1 md:grid-cols-3 lg:grid-cols-7 p-2 gap-4 md:gap-2 gva-container2">
<div class="grid grid-cols-1 md:grid-cols-3 lg:grid-cols-7 py-2 gap-4 md:gap-2 gva-container2">
<gva-card custom-class="col-span-1 lg:col-span-2 h-32">
<gva-chart :type="1" title="访问人数" />
</gva-card>
Expand Down
6 changes: 4 additions & 2 deletions web/src/view/layout/aside/asideComponent/asyncSubmenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<el-sub-menu
ref="subMenu"
:index="routerInfo.name"
class="gva-sub-menu dark:text-slate-300"
class="gva-sub-menu dark:text-slate-300 relative"
>
<template #title>
<div
Expand Down Expand Up @@ -52,7 +52,9 @@ const isCollapse = inject('isCollapse', {
default: false,
})
const sideHeight = computed(() => config.value.layout_side_item_height + 'px')
const sideHeight = computed(() => {
return config.value.layout_side_item_height + 'px'
})
</script>

Expand Down
4 changes: 4 additions & 0 deletions web/src/view/layout/aside/asideComponent/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ const props = defineProps({
type: Object,
default: () => null,
},
mode :{
type : String,
default: "vertical"
}
})
Expand Down
Loading

0 comments on commit 03e5bc5

Please sign in to comment.