Skip to content

Commit 03e5bc5

Browse files
pixelmaxQmxue-ding-ewall-jswall-jsleooza
authored
v2.6.6版本发布 (#1784)
* 前端支持顶部菜单栏模式 * 自动化代码单条获取方法不再需要取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]>
1 parent b336529 commit 03e5bc5

File tree

34 files changed

+870
-548
lines changed

34 files changed

+870
-548
lines changed

server/config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ zap:
1616
encode-level: LowercaseColorLevelEncoder
1717
stacktrace-key: stacktrace
1818
log-in-console: true
19+
retention-day: -1
1920

2021
# redis configuration
2122
redis:

server/config/zap.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ type Zap struct {
1414
StacktraceKey string `mapstructure:"stacktrace-key" json:"stacktrace-key" yaml:"stacktrace-key"` // 栈名
1515
ShowLine bool `mapstructure:"show-line" json:"show-line" yaml:"show-line"` // 显示行
1616
LogInConsole bool `mapstructure:"log-in-console" json:"log-in-console" yaml:"log-in-console"` // 输出控制台
17+
RetentionDay int `mapstructure:"retention-day" json:"retention-day" yaml:"retention-day"` // 日志保留天数
1718
}
1819

1920
// Levels 根据字符串转化为 zapcore.Levels

server/core/internal/cutter.go

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ import (
1010
// Cutter 实现 io.Writer 接口
1111
// 用于日志切割, strings.Join([]string{director,layout, formats..., level+".log"}, os.PathSeparator)
1212
type Cutter struct {
13-
level string // 日志级别(debug, info, warn, error, dpanic, panic, fatal)
14-
layout string // 时间格式 2006-01-02 15:04:05
15-
formats []string // 自定义参数([]string{Director,"2006-01-02", "business"(此参数可不写), level+".log"}
16-
director string // 日志文件夹
17-
file *os.File // 文件句柄
18-
mutex *sync.RWMutex // 读写锁
13+
level string // 日志级别(debug, info, warn, error, dpanic, panic, fatal)
14+
layout string // 时间格式 2006-01-02 15:04:05
15+
formats []string // 自定义参数([]string{Director,"2006-01-02", "business"(此参数可不写), level+".log"}
16+
director string // 日志文件夹
17+
retentionDay int //日志保留天数
18+
file *os.File // 文件句柄
19+
mutex *sync.RWMutex // 读写锁
1920
}
2021

2122
type CutterOption func(*Cutter)
@@ -36,11 +37,12 @@ func CutterWithFormats(format ...string) CutterOption {
3637
}
3738
}
3839

39-
func NewCutter(director string, level string, options ...CutterOption) *Cutter {
40+
func NewCutter(director string, level string, retentionDay int, options ...CutterOption) *Cutter {
4041
rotate := &Cutter{
41-
level: level,
42-
director: director,
43-
mutex: new(sync.RWMutex),
42+
level: level,
43+
director: director,
44+
retentionDay: retentionDay,
45+
mutex: new(sync.RWMutex),
4446
}
4547
for i := 0; i < len(options); i++ {
4648
options[i](rotate)
@@ -77,6 +79,10 @@ func (c *Cutter) Write(bytes []byte) (n int, err error) {
7779
if err != nil {
7880
return 0, err
7981
}
82+
err = removeNDaysFolders(c.director, c.retentionDay)
83+
if err != nil {
84+
return 0, err
85+
}
8086
c.file, err = os.OpenFile(filename, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0644)
8187
if err != nil {
8288
return 0, err
@@ -93,3 +99,23 @@ func (c *Cutter) Sync() error {
9399
}
94100
return nil
95101
}
102+
103+
// 增加日志目录文件清理 小于等于零的值默认忽略不再处理
104+
func removeNDaysFolders(dir string, days int) error {
105+
if days <= 0 {
106+
return nil
107+
}
108+
cutoff := time.Now().AddDate(0, 0, -days)
109+
return filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {
110+
if err != nil {
111+
return err
112+
}
113+
if info.IsDir() && info.ModTime().Before(cutoff) && path != dir {
114+
err = os.RemoveAll(path)
115+
if err != nil {
116+
return err
117+
}
118+
}
119+
return nil
120+
})
121+
}

server/core/internal/zap_core.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ func (z *ZapCore) WriteSyncer(formats ...string) zapcore.WriteSyncer {
2727
cutter := NewCutter(
2828
global.GVA_CONFIG.Zap.Director,
2929
z.level.String(),
30+
global.GVA_CONFIG.Zap.RetentionDay,
3031
CutterWithLayout(time.DateOnly),
3132
CutterWithFormats(formats...),
3233
)

server/model/system/request/sys_auto_history.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,6 @@ type SysAutoHistory struct {
1010
type RollBack struct {
1111
ID int `json:"id" form:"id"` // 主键ID
1212
DeleteTable bool `json:"deleteTable" form:"deleteTable"` // 是否删除表
13+
DeleteApi bool `json:"deleteApi" form:"deleteApi"` // 是否删除接口
14+
DeleteMenu bool `json:"deleteMenu" form:"deleteMenu"` // 是否删除菜单
1315
}

server/model/system/sys_auto_code.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ type Field struct {
8585
PrimaryKey bool `json:"primaryKey"` // 是否主键
8686
DataSource *DataSource `json:"dataSource"` // 数据源
8787
CheckDataSource bool `json:"checkDataSource"` // 是否检查数据源
88+
FieldIndexType string `json:"fieldIndexType"` // 索引类型
8889
}
8990

9091
type SysAutoCode struct {

server/resource/autocode_template/server/api.go.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Find{{.StructName}}(c *gin.Conte
133133
global.GVA_LOG.Error("查询失败!", zap.Error(err))
134134
response.FailWithMessage("查询失败", c)
135135
} else {
136-
response.OkWithData(gin.H{"re{{.Abbreviation}}": re{{.Abbreviation}}}, c)
136+
response.OkWithData(re{{.Abbreviation}}, c)
137137
}
138138
}
139139

server/resource/autocode_template/server/model.go.tpl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,25 @@ type {{.StructName}} struct {
1212
{{ if .GvaModel }} global.GVA_MODEL {{ end }}
1313
{{- range .Fields}}
1414
{{- if eq .FieldType "enum" }}
15-
{{.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 -}}`
15+
{{.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 -}}`
1616
{{- else if eq .FieldType "picture" }}
17-
{{.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 -}}`
17+
{{.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 -}}`
1818
{{- else if eq .FieldType "video" }}
19-
{{.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 -}}`
19+
{{.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 -}}`
2020
{{- else if eq .FieldType "file" }}
21-
{{.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"`
21+
{{.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"`
2222
{{- else if eq .FieldType "pictures" }}
23-
{{.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"`
23+
{{.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"`
2424
{{- else if eq .FieldType "richtext" }}
25-
{{.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 -}}`
25+
{{.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 -}}`
2626
{{- else if eq .FieldType "json" }}
27-
{{.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"`
27+
{{.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"`
2828
{{- else if eq .FieldType "array" }}
29-
{{.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"`
29+
{{.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"`
3030
{{- else if ne .FieldType "string" }}
31-
{{.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 -}}`
31+
{{.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 -}}`
3232
{{- else }}
33-
{{.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 -}}`
33+
{{.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 -}}`
3434
{{- end }} {{ if .FieldDesc }}//{{.FieldDesc}} {{ end }} {{- end }}
3535
{{- if .AutoCreateResource }}
3636
CreatedBy uint `gorm:"column:created_by;comment:创建者"`

server/resource/autocode_template/web/form.vue.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ const formData = ref({
116116
{{.FieldJson}}: '',
117117
{{- end }}
118118
{{- if eq .FieldType "int" }}
119-
{{.FieldJson}}: {{- if .DictType }} undefined{{ else }} 0{{- end }},
119+
{{.FieldJson}}: {{- if or .DictType .DataSource }} undefined{{ else }} 0{{- end }},
120120
{{- end }}
121121
{{- if eq .FieldType "time.Time" }}
122122
{{.FieldJson}}: new Date(),

server/resource/autocode_template/web/table.vue.tpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ const formData = ref({
412412
{{.FieldJson}}: '',
413413
{{- end }}
414414
{{- if eq .FieldType "int" }}
415-
{{.FieldJson}}: {{- if .DictType }} undefined{{ else }} 0{{- end }},
415+
{{.FieldJson}}: {{- if or .DictType .DataSource}} undefined{{ else }} 0{{- end }},
416416
{{- end }}
417417
{{- if eq .FieldType "time.Time" }}
418418
{{.FieldJson}}: new Date(),
@@ -659,7 +659,7 @@ const update{{.StructName}}Func = async(row) => {
659659
const res = await find{{.StructName}}({ {{.PrimaryField.FieldJson}}: row.{{.PrimaryField.FieldJson}} })
660660
type.value = 'update'
661661
if (res.code === 0) {
662-
formData.value = res.data.re{{.Abbreviation}}
662+
formData.value = res.data
663663
dialogFormVisible.value = true
664664
}
665665
}
@@ -704,7 +704,7 @@ const closeDialog = () => {
704704
{{.FieldJson}}: '',
705705
{{- end }}
706706
{{- if eq .FieldType "int" }}
707-
{{.FieldJson}}: {{- if .DictType }} undefined{{ else }} 0{{- end }},
707+
{{.FieldJson}}: {{- if or .DictType .DataSource }} undefined{{ else }} 0{{- end }},
708708
{{- end }}
709709
{{- if eq .FieldType "time.Time" }}
710710
{{.FieldJson}}: new Date(),

server/service/system/sys_autocode_history.go

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ package system
33
import (
44
"errors"
55
"fmt"
6-
systemReq "github.com/flipped-aurora/gin-vue-admin/server/model/system/request"
7-
"github.com/flipped-aurora/gin-vue-admin/server/utils/ast"
86
"path/filepath"
97
"strconv"
108
"strings"
119
"time"
1210

11+
systemReq "github.com/flipped-aurora/gin-vue-admin/server/model/system/request"
12+
"github.com/flipped-aurora/gin-vue-admin/server/utils/ast"
13+
1314
"github.com/flipped-aurora/gin-vue-admin/server/model/system/response"
1415

1516
"github.com/flipped-aurora/gin-vue-admin/server/global"
@@ -71,26 +72,28 @@ func (autoCodeHistoryService *AutoCodeHistoryService) RollBack(info *systemReq.R
7172
return err
7273
}
7374
// 清除API表
74-
75-
ids := request.IdsReq{}
76-
idsStr := strings.Split(md.ApiIDs, ";")
77-
for i := range idsStr[0 : len(idsStr)-1] {
78-
id, err := strconv.Atoi(idsStr[i])
75+
var err error
76+
if info.DeleteApi {
77+
ids := request.IdsReq{}
78+
idsStr := strings.Split(md.ApiIDs, ";")
79+
for i := range idsStr[0 : len(idsStr)-1] {
80+
id, err := strconv.Atoi(idsStr[i])
81+
if err != nil {
82+
return err
83+
}
84+
ids.Ids = append(ids.Ids, id)
85+
}
86+
err = ApiServiceApp.DeleteApisByIds(ids)
7987
if err != nil {
80-
return err
88+
global.GVA_LOG.Error("ClearTag DeleteApiByIds:", zap.Error(err))
8189
}
82-
ids.Ids = append(ids.Ids, id)
8390
}
84-
err := ApiServiceApp.DeleteApisByIds(ids)
85-
86-
if err != nil {
87-
global.GVA_LOG.Error("ClearTag DeleteApiByIds:", zap.Error(err))
88-
}
89-
90-
err = BaseMenuServiceApp.DeleteBaseMenu(int(md.MenuID))
91-
92-
if err != nil {
93-
global.GVA_LOG.Error("ClearTag DeleteBaseMenu:", zap.Error(err))
91+
// 清除菜单表
92+
if info.DeleteMenu {
93+
err = BaseMenuServiceApp.DeleteBaseMenu(int(md.MenuID))
94+
if err != nil {
95+
global.GVA_LOG.Error("ClearTag DeleteBaseMenu:", zap.Error(err))
96+
}
9497
}
9598

9699
// 删除表

web/.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
node_modules/*
22
package-lock.json
3-
yarn.lock
3+
yarn.lock
4+
bun.lockb
5+
config.yaml

web/src/components/warningBar/warningBar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div
3-
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"
3+
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"
44
:class="href&&'cursor-pointer'"
55
@click="open"
66
>

web/src/config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@
66
"layout_side_width":200,
77
"layout_side_collapsed_width":60,
88
"layout_side_item_height":44,
9-
"show_watermark":true}
9+
"show_watermark":true,
10+
"side_mode":"normal"}

web/src/pinia/modules/app.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { setBodyPrimaryColor } from '@/utils/format'
66
export const useAppStore = defineStore('app', () => {
77
const theme = ref(localStorage.getItem('theme') || 'light')
88
const device = ref("")
9-
109
const config = reactive({
1110
weakness: false,
1211
grey: false,
@@ -17,6 +16,8 @@ export const useAppStore = defineStore('app', () => {
1716
layout_side_collapsed_width : 80,
1817
layout_side_item_height : 48,
1918
show_watermark: false,
19+
20+
side_mode : 'normal'
2021
})
2122

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

123+
const toggleSideModel= (e) =>{
124+
config.side_mode = e
125+
}
126+
122127
if(config.darkMode === 'auto'){
123128
toggleDarkModeAuto()
124129
}
@@ -138,7 +143,8 @@ export const useAppStore = defineStore('app', () => {
138143
toggleConfigSideWidth,
139144
toggleConfigSideCollapsedWidth,
140145
toggleConfigSideItemHeight,
141-
toggleConfigWatermark
146+
toggleConfigWatermark,
147+
toggleSideModel
142148
}
143149

144150
})

web/src/style/element_visiable.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
}
107107

108108
.el-sub-menu.is-active{
109-
.el-sub-menu__title{
109+
> .el-sub-menu__title{
110110
color: var(--el-color-primary) !important;
111111
}
112112
}

web/src/style/main.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
}
1111

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

3535

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

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

4444
.el-tree--highlight-current .el-tree-node.is-current > .el-tree-node__content{

web/src/view/dashboard/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div class="grid grid-cols-1 md:grid-cols-3 lg:grid-cols-7 p-2 gap-4 md:gap-2 gva-container2">
2+
<div class="grid grid-cols-1 md:grid-cols-3 lg:grid-cols-7 py-2 gap-4 md:gap-2 gva-container2">
33
<gva-card custom-class="col-span-1 lg:col-span-2 h-32">
44
<gva-chart :type="1" title="访问人数" />
55
</gva-card>

web/src/view/layout/aside/asideComponent/asyncSubmenu.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<el-sub-menu
33
ref="subMenu"
44
:index="routerInfo.name"
5-
class="gva-sub-menu dark:text-slate-300"
5+
class="gva-sub-menu dark:text-slate-300 relative"
66
>
77
<template #title>
88
<div
@@ -52,7 +52,9 @@ const isCollapse = inject('isCollapse', {
5252
default: false,
5353
})
5454
55-
const sideHeight = computed(() => config.value.layout_side_item_height + 'px')
55+
const sideHeight = computed(() => {
56+
return config.value.layout_side_item_height + 'px'
57+
})
5658
5759
</script>
5860

web/src/view/layout/aside/asideComponent/index.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ const props = defineProps({
2929
type: Object,
3030
default: () => null,
3131
},
32+
mode :{
33+
type : String,
34+
default: "vertical"
35+
}
3236
})
3337
3438

0 commit comments

Comments
 (0)