This commit is contained in:
Daniel 2025-06-09 22:30:00 +08:00
parent 5df063fbec
commit c145cd2a95
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
3 changed files with 33 additions and 1 deletions

View file

@ -24,7 +24,7 @@ type LayoutGallery struct {
CoverFrom CoverFrom `json:"coverFrom"` // 封面来源01内容图2资源字段
CoverFromAssetKeyID string `json:"coverFromAssetKeyId,omitempty"` // 资源字段 IDCoverFrom 为 2 时有效
CardSize CardSize `json:"cardSize"` // 卡片大小
CardSize CardSize `json:"cardSize"` // 卡片大小0小卡片1中卡片2大卡片
FitImage bool `json:"fitImage"` // 是否适应图片大小
ShowIcon bool `json:"showIcon"` // 是否显示图标
WrapField bool `json:"wrapField"` // 是否换行字段

View file

@ -44,6 +44,36 @@ import (
"github.com/xrash/smetrics"
)
func (tx *Transaction) doSetAttrViewCardSize(operation *Operation) (ret *TxErr) {
err := setAttrViewCardSize(operation)
if err != nil {
return &TxErr{code: TxErrWriteAttributeView, id: operation.AvID, msg: err.Error()}
}
return
}
func setAttrViewCardSize(operation *Operation) (err error) {
attrView, err := av.ParseAttributeView(operation.AvID)
if err != nil {
return
}
view, err := getAttrViewViewByBlockID(attrView, operation.BlockID)
if err != nil {
return
}
switch view.LayoutType {
case av.LayoutTypeTable:
return
case av.LayoutTypeGallery:
view.Gallery.CardSize = av.CardSize(operation.Data.(float64))
}
err = av.SaveAttributeView(attrView)
return
}
func (tx *Transaction) doSetAttrViewCoverFromAssetKeyID(operation *Operation) (ret *TxErr) {
err := setAttrViewCoverFromAssetKeyID(operation)
if err != nil {

View file

@ -282,6 +282,8 @@ func performTx(tx *Transaction) (ret *TxErr) {
ret = tx.doSetAttrViewCoverFrom(op)
case "setAttrViewCoverFromAssetKeyID":
ret = tx.doSetAttrViewCoverFromAssetKeyID(op)
case "setAttrViewCardSize":
ret = tx.doSetAttrViewCardSize(op)
}
if nil != ret {