🐛 修复下发的菜单数据前端无法使用的BUG

This commit is contained in:
李寻欢 2024-02-01 17:59:59 +08:00
parent 735d4d1f27
commit 79fa7196af
3 changed files with 8 additions and 5 deletions

View File

@ -7,8 +7,9 @@ import "wechat-robot/pkg/types"
type Menu struct { type Menu struct {
types.BaseDbModel types.BaseDbModel
Type types.MenuType `json:"type" gorm:"type:enum('MENU','BUTTON'); default:'MENU'; not null; comment:'菜单类型(菜单或按钮)'"` Type types.MenuType `json:"type" gorm:"type:enum('MENU','BUTTON'); default:'MENU'; not null; comment:'菜单类型(菜单或按钮)'"`
Name string `json:"name" gorm:"type:varchar(255);not null;comment:'菜单名称'"` Name string `json:"name" gorm:"type:varchar(255);not null;comment:'页面组件名称'"`
Path string `json:"path" gorm:"type:varchar(255);comment:'路径'"` Path string `json:"path" gorm:"type:varchar(255);comment:'路径'"`
Title string `json:"title" gorm:"type:varchar(255);not null;comment:'菜单标题'"`
Icon string `json:"icon" gorm:"type:varchar(255);comment:'菜单图标'"` Icon string `json:"icon" gorm:"type:varchar(255);comment:'菜单图标'"`
Sort int `json:"sort" gorm:"type:int(3);not null;comment:'排序值(数字越小约靠前)'"` Sort int `json:"sort" gorm:"type:int(3);not null;comment:'排序值(数字越小约靠前)'"`
ParentId *string `json:"parentId" gorm:"type:varchar(32);comment:'父级菜单ID(0表示顶级菜单)'"` ParentId *string `json:"parentId" gorm:"type:varchar(32);comment:'父级菜单ID(0表示顶级菜单)'"`

View File

@ -5,8 +5,9 @@ package menu
type Item struct { type Item struct {
Id string `json:"id"` // 菜单Id Id string `json:"id"` // 菜单Id
Path string `json:"path"` // 访问路径 Path string `json:"path"` // 访问路径
Name string `json:"name"` // 路由名字对应不要重复和页面组件的name保持一致必填
Meta ItemMeta `json:"meta"` // 元数据 Meta ItemMeta `json:"meta"` // 元数据
Children []Item `json:"children"` // 子菜单 Children []Item `json:"children,omitempty"` // 子菜单
} }
// ItemMeta // ItemMeta

View File

@ -14,6 +14,7 @@ type menuRecordItem struct {
Type types.MenuType Type types.MenuType
Name string Name string
Path string Path string
Title string
Icon string Icon string
Sort int Sort int
ParentId *string ParentId *string