分类概述

dev
truthhun 1 year ago
parent a7f7c28646
commit 91a6250c6d

@ -35,16 +35,19 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// 文档分类
type Category struct {
Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
ParentId int32 `protobuf:"varint,2,opt,name=parent_id,json=parentId,proto3" json:"parent_id,omitempty"`
Title string `protobuf:"bytes,3,opt,name=title,proto3" json:"title,omitempty" validate:"required"`
DocCount int32 `protobuf:"varint,4,opt,name=doc_count,json=docCount,proto3" json:"doc_count,omitempty"`
Sort int32 `protobuf:"varint,5,opt,name=sort,proto3" json:"sort,omitempty"`
Enable bool `protobuf:"varint,6,opt,name=enable,proto3" json:"enable,omitempty"`
Cover string `protobuf:"bytes,9,opt,name=cover,proto3" json:"cover,omitempty"`
CreatedAt *time.Time `protobuf:"bytes,7,opt,name=created_at,json=createdAt,proto3,stdtime" json:"created_at,omitempty"`
UpdatedAt *time.Time `protobuf:"bytes,8,opt,name=updated_at,json=updatedAt,proto3,stdtime" json:"updated_at,omitempty"`
Icon string `protobuf:"bytes,10,opt,name=icon,proto3" json:"icon,omitempty"`
Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
ParentId int32 `protobuf:"varint,2,opt,name=parent_id,json=parentId,proto3" json:"parent_id,omitempty"`
Title string `protobuf:"bytes,3,opt,name=title,proto3" json:"title,omitempty" validate:"required"`
DocCount int32 `protobuf:"varint,4,opt,name=doc_count,json=docCount,proto3" json:"doc_count,omitempty"`
Sort int32 `protobuf:"varint,5,opt,name=sort,proto3" json:"sort,omitempty"`
Enable bool `protobuf:"varint,6,opt,name=enable,proto3" json:"enable,omitempty"`
Cover string `protobuf:"bytes,9,opt,name=cover,proto3" json:"cover,omitempty"`
CreatedAt *time.Time `protobuf:"bytes,7,opt,name=created_at,json=createdAt,proto3,stdtime" json:"created_at,omitempty"`
UpdatedAt *time.Time `protobuf:"bytes,8,opt,name=updated_at,json=updatedAt,proto3,stdtime" json:"updated_at,omitempty"`
Icon string `protobuf:"bytes,10,opt,name=icon,proto3" json:"icon,omitempty"`
Description string `protobuf:"bytes,11,opt,name=description,proto3" json:"description,omitempty"`
ShowDescription bool `protobuf:"varint,12,opt,name=show_description,json=showDescription,proto3" json:"show_description,omitempty"`
ShowOnNav bool `protobuf:"varint,13,opt,name=show_on_nav,json=showOnNav,proto3" json:"show_on_nav,omitempty"`
}
func (m *Category) Reset() { *m = Category{} }
@ -150,6 +153,27 @@ func (m *Category) GetIcon() string {
return ""
}
func (m *Category) GetDescription() string {
if m != nil {
return m.Description
}
return ""
}
func (m *Category) GetShowDescription() bool {
if m != nil {
return m.ShowDescription
}
return false
}
func (m *Category) GetShowOnNav() bool {
if m != nil {
return m.ShowOnNav
}
return false
}
// 分类列表请求
type ListCategoryRequest struct {
Page int64 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"`
@ -389,48 +413,52 @@ func init() {
func init() { proto.RegisterFile("api/v1/category.proto", fileDescriptor_1f1bb9165c79c987) }
var fileDescriptor_1f1bb9165c79c987 = []byte{
// 653 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xc1, 0x6a, 0xdb, 0x4c,
0x10, 0xce, 0x4a, 0xb1, 0x7f, 0x7b, 0xfd, 0x63, 0x92, 0x4d, 0x9c, 0x6c, 0xe5, 0xc6, 0x11, 0xa2,
0x50, 0x13, 0x5a, 0x89, 0xa4, 0xf4, 0x92, 0x1e, 0x4a, 0x92, 0x96, 0x12, 0xe8, 0x21, 0x88, 0x86,
0x40, 0x2f, 0x61, 0xa3, 0x9d, 0x98, 0x05, 0x59, 0xab, 0xc8, 0x6b, 0x87, 0xf4, 0xd8, 0x27, 0x08,
0xf4, 0xd2, 0x47, 0xea, 0x31, 0xd0, 0x4b, 0xa1, 0xd0, 0x86, 0xa4, 0x4f, 0xd0, 0x27, 0x28, 0x5a,
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 0x86, 0x17, 0xa3, 0xcd, 0x93, 0xaa, 0x96, 0xe7, 0xd9, 0x9f,
0x00, 0x00, 0x00, 0xff, 0xff, 0xb9, 0xbb, 0x2c, 0x93, 0x54, 0x05, 0x00, 0x00,
// 708 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xcd, 0x4e, 0xdb, 0x4a,
0x14, 0xc6, 0x36, 0xc9, 0x4d, 0x26, 0xdc, 0x5c, 0x18, 0x08, 0xcc, 0x75, 0x2e, 0xc1, 0xb2, 0xae,
0xd4, 0x14, 0xb5, 0xb6, 0xa0, 0xea, 0x86, 0x2e, 0x2a, 0x7e, 0xaa, 0x0a, 0xa9, 0x6a, 0x91, 0x55,
0x84, 0xd4, 0x4d, 0x34, 0x78, 0x86, 0x74, 0x24, 0xc7, 0x63, 0xec, 0x89, 0x11, 0x5d, 0xf6, 0x09,
0x90, 0xba, 0xe9, 0x23, 0xb1, 0x44, 0xea, 0xa6, 0xab, 0x16, 0x41, 0x9f, 0xa0, 0x4f, 0x50, 0xcd,
0xd8, 0x46, 0xce, 0x0f, 0x52, 0xd5, 0xdd, 0x99, 0xe3, 0xef, 0x7c, 0xe7, 0xe7, 0x3b, 0xc7, 0xa0,
0x85, 0x23, 0xe6, 0xa6, 0x1b, 0xae, 0x8f, 0x05, 0xed, 0xf3, 0xf8, 0xdc, 0x89, 0x62, 0x2e, 0x38,
0xac, 0xe2, 0x88, 0x39, 0xe9, 0x86, 0xb9, 0xd6, 0xe7, 0xbc, 0x1f, 0x50, 0x57, 0x79, 0x8f, 0x87,
0x27, 0xae, 0x60, 0x03, 0x9a, 0x08, 0x3c, 0x88, 0x32, 0xa0, 0xb9, 0xd4, 0xe7, 0x7d, 0xae, 0x4c,
0x57, 0x5a, 0xb9, 0xf7, 0xbf, 0x3c, 0x4c, 0x92, 0xe3, 0x30, 0xe4, 0x02, 0x0b, 0xc6, 0x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, 0xda, 0x00, 0x8d, 0x02, 0xb3, 0x7d, 0xb0, 0x0f, 0x8f, 0x40, 0x73, 0x57, 0x6d, 0xc8,
0xdd, 0x89, 0x4c, 0x14, 0x63, 0x2e, 0x4f, 0x2c, 0xc9, 0x0b, 0x79, 0x5f, 0x76, 0xfb, 0xe3, 0x97,
0x1f, 0x9f, 0xf4, 0x96, 0x3d, 0xef, 0x8e, 0xdd, 0xfc, 0x96, 0xb6, 0x2e, 0x89, 0x0f, 0xd5, 0xe6,
0xfc, 0x39, 0xb1, 0x39, 0x95, 0x18, 0x83, 0xe6, 0xe8, 0x40, 0xe0, 0x6a, 0x41, 0x3c, 0x75, 0x50,
0xf7, 0x66, 0x41, 0x2a, 0x0b, 0x5c, 0x9f, 0xc8, 0x02, 0x0f, 0x41, 0xa3, 0x34, 0x4a, 0x68, 0x16,
0xfc, 0x93, 0xf3, 0x35, 0x27, 0x9a, 0x2a, 0x68, 0xe1, 0x24, 0x2d, 0x05, 0x73, 0xe5, 0x1d, 0x81,
0xed, 0x22, 0x76, 0xca, 0x4e, 0x9b, 0xff, 0x4e, 0xff, 0x18, 0x05, 0xe7, 0xf6, 0xaa, 0xca, 0xb0,
0x02, 0x5b, 0xe3, 0x19, 0xdc, 0x80, 0x25, 0x62, 0xe7, 0xe9, 0xe5, 0x4d, 0x47, 0xbb, 0xba, 0xe9,
0x68, 0xd7, 0x37, 0x1d, 0xed, 0xe2, 0xb6, 0x33, 0x73, 0x75, 0xdb, 0x99, 0xf9, 0x7a, 0xdb, 0x99,
0x01, 0xf9, 0x4f, 0xf8, 0x40, 0x7b, 0xb7, 0x30, 0xe0, 0x31, 0x25, 0xdc, 0xcf, 0x19, 0x9e, 0xa5,
0x1b, 0xc7, 0x55, 0x35, 0x9e, 0x27, 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0x29, 0x47, 0xe2, 0xd2,
0xc1, 0x05, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@ -687,6 +715,33 @@ func (m *Category) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
if m.ShowOnNav {
i--
if m.ShowOnNav {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x68
}
if m.ShowDescription {
i--
if m.ShowDescription {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x60
}
if len(m.Description) > 0 {
i -= len(m.Description)
copy(dAtA[i:], m.Description)
i = encodeVarintCategory(dAtA, i, uint64(len(m.Description)))
i--
dAtA[i] = 0x5a
}
if len(m.Icon) > 0 {
i -= len(m.Icon)
copy(dAtA[i:], m.Icon)
@ -1006,6 +1061,16 @@ func (m *Category) Size() (n int) {
if l > 0 {
n += 1 + l + sovCategory(uint64(l))
}
l = len(m.Description)
if l > 0 {
n += 1 + l + sovCategory(uint64(l))
}
if m.ShowDescription {
n += 2
}
if m.ShowOnNav {
n += 2
}
return n
}
@ -1389,6 +1454,78 @@ func (m *Category) Unmarshal(dAtA []byte) error {
}
m.Icon = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 11:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCategory
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthCategory
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthCategory
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Description = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 12:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ShowDescription", wireType)
}
var v int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCategory
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
m.ShowDescription = bool(v != 0)
case 13:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ShowOnNav", wireType)
}
var v int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCategory
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
m.ShowOnNav = bool(v != 0)
default:
iNdEx = preIndex
skippy, err := skipCategory(dAtA[iNdEx:])

@ -27,6 +27,9 @@ message Category {
google.protobuf.Timestamp updated_at = 8
[ (gogoproto.stdtime) = true ]; //
string icon = 10; //
string description = 11; //
bool show_description = 12; //
bool show_on_nav = 13; //
}
//

@ -8,16 +8,19 @@ import (
)
type Category struct {
Id int64 `form:"id" json:"id,omitempty" gorm:"primaryKey;autoIncrement;column:id;comment:;"`
Icon string `form:"icon" json:"icon,omitempty" gorm:"column:icon;comment:分类图标;type:varchar(255);size:255;"`
Cover string `form:"cover" json:"cover,omitempty" gorm:"column:cover;comment:分类封面;type:varchar(255);size:255;"`
ParentId int `form:"parent_id" json:"parent_id,omitempty" gorm:"column:parent_id;type:int(11);size:11;default:0;index:parent_id_title,unique;index:parent_id;comment:上级ID;"`
Title string `form:"title" json:"title,omitempty" gorm:"column:title;type:varchar(64);size:64;index:parent_id_title,unique;comment:分类名称;"`
DocCount int `form:"doc_count" json:"doc_count,omitempty" gorm:"column:doc_count;type:int(11);size:11;default:0;comment:文档统计;"`
Sort int `form:"sort" json:"sort,omitempty" gorm:"column:sort;type:int(11);size:11;default:0;index:idx_sort;comment:排序,值越大越靠前;"`
Enable bool `form:"enable" json:"enable,omitempty" gorm:"column:enable;type:tinyint(1);size:1;index:idx_enable;default:1;"`
CreatedAt *time.Time `form:"created_at" json:"created_at,omitempty" gorm:"column:created_at;type:datetime;comment:创建时间;"`
UpdatedAt *time.Time `form:"updated_at" json:"updated_at,omitempty" gorm:"column:updated_at;type:datetime;comment:更新时间;"`
Id int64 `form:"id" json:"id,omitempty" gorm:"primaryKey;autoIncrement;column:id;comment:;"`
Icon string `form:"icon" json:"icon,omitempty" gorm:"column:icon;comment:分类图标;type:varchar(255);size:255;"`
Cover string `form:"cover" json:"cover,omitempty" gorm:"column:cover;comment:分类封面;type:varchar(255);size:255;"`
ParentId int `form:"parent_id" json:"parent_id,omitempty" gorm:"column:parent_id;type:int(11);size:11;default:0;index:parent_id_title,unique;index:parent_id;comment:上级ID;"`
Title string `form:"title" json:"title,omitempty" gorm:"column:title;type:varchar(64);size:64;index:parent_id_title,unique;comment:分类名称;"`
DocCount int `form:"doc_count" json:"doc_count,omitempty" gorm:"column:doc_count;type:int(11);size:11;default:0;comment:文档统计;"`
Sort int `form:"sort" json:"sort,omitempty" gorm:"column:sort;type:int(11);size:11;default:0;index:idx_sort;comment:排序,值越大越靠前;"`
Enable bool `form:"enable" json:"enable,omitempty" gorm:"column:enable;type:tinyint(1);size:1;index:idx_enable;default:1;"`
Description string `form:"description" json:"description,omitempty" gorm:"column:description;type:text;comment:分类描述;"`
ShowDescription bool `form:"show_description" json:"show_description,omitempty" gorm:"column:show_description;type:tinyint(1);size:1;default:0;comment:是否显示描述;"`
ShowOnNav bool `form:"show_on_nav" json:"show_on_nav,omitempty" gorm:"column:show_on_nav;type:tinyint(1);size:1;default:0;comment:是否显示在导航;"`
CreatedAt *time.Time `form:"created_at" json:"created_at,omitempty" gorm:"column:created_at;type:datetime;comment:创建时间;"`
UpdatedAt *time.Time `form:"updated_at" json:"updated_at,omitempty" gorm:"column:updated_at;type:datetime;comment:更新时间;"`
}
func (Category) TableName() string {

@ -56,25 +56,29 @@
@success="successUpload"
/>
</el-form-item>
<el-form-item
label="名称"
prop="title"
:rules="[{ required: true, trigger: 'blur', message: '请输入名称' }]"
>
<el-input
v-model="category.title"
:placeholder="
category.id > 0
? ''
: '...'
"
:type="category.id > 0 ? 'text' : 'textarea'"
:rows="5"
clearable
></el-input>
</el-form-item>
<el-row :gutter="20">
<el-col :span="12">
<el-col :span="16">
<el-form-item
label="名称"
prop="title"
:rules="[
{ required: true, trigger: 'blur', message: '' },
]"
>
<el-input
v-model="category.title"
:placeholder="
category.id > 0
? ''
: '...'
"
:type="category.id > 0 ? 'text' : 'textarea'"
:rows="5"
clearable
></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="排序(值越大越靠前)">
<el-input-number
v-model.number="category.sort"
@ -85,7 +89,19 @@
></el-input-number>
</el-form-item>
</el-col>
<el-col :span="12">
</el-row>
<el-form-item label="描述" prop="description">
<el-input
v-model="category.description"
:type="'textarea'"
description="请输入描述,支持换行"
:rows="5"
clearable
></el-input>
</el-form-item>
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="是否启用">
<el-switch
v-model="category.enable"
@ -97,6 +113,30 @@
>
</el-switch> </el-form-item
></el-col>
<el-col :span="8">
<el-form-item label="是否显示在导航栏">
<el-switch
v-model="category.show_on_nav"
style="display: block"
active-color="#13ce66"
inactive-color="#ff4949"
active-text="是"
inactive-text="否"
>
</el-switch> </el-form-item
></el-col>
<el-col :span="8">
<el-form-item label="是否显示分类描述">
<el-switch
v-model="category.show_description"
style="display: block"
active-color="#13ce66"
inactive-color="#ff4949"
active-text="是"
inactive-text="否"
>
</el-switch> </el-form-item
></el-col>
</el-row>
<el-form-item>
<el-button

@ -237,6 +237,18 @@ export default {
width: 80,
type: 'bool',
},
{
prop: 'show_on_nav',
label: '',
width: 80,
type: 'bool',
},
{
prop: 'show_description',
label: '',
width: 80,
type: 'bool',
},
{
prop: 'sort',
label: '',
@ -246,6 +258,7 @@ export default {
{ prop: 'cover', label: '', width: 100, type: 'image' },
{ prop: 'doc_count', label: '', width: 80, type: 'number' },
{ prop: 'id', label: 'ID', width: 80, type: 'number' },
{ prop: 'description', label: '', width: 200 },
{ prop: 'created_at', label: '', width: 160, type: 'datetime' },
{ prop: 'updated_at', label: '', width: 160, type: 'datetime' },
]

Loading…
Cancel
Save