From 722eb3b9fb694c5e619d52a2862af0fefda86f7c Mon Sep 17 00:00:00 2001 From: liweiyi <190785909@qq.com> Date: Sun, 23 Feb 2025 20:02:58 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E6=A0=87=E8=AE=B0=E9=A1=B5=E9=9D=A2=E7=9F=AD/=E5=89=AF?= =?UTF-8?q?=E6=A0=87=E9=A2=98=E8=A1=A8=E5=8D=95Label=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ContentController.java | 8 +++ .../contentcore/domain/vo/ContentVO.java | 4 ++ .../properties/ShortTitleLabelProperty.java | 60 +++++++++++++++++++ .../properties/SubTitleLabelProperty.java | 60 +++++++++++++++++++ .../staticize/func/impl/GroupByFunction.java | 8 +-- chestnut-ui/src/i18n/lang/en.js | 2 + chestnut-ui/src/i18n/lang/zh-CN.js | 2 + chestnut-ui/src/i18n/lang/zh-TW.js | 2 + .../views/cms/contentcore/catalogExtend.vue | 27 +++++++++ .../views/cms/contentcore/contentEditor.vue | 14 ++++- 10 files changed, 178 insertions(+), 9 deletions(-) create mode 100644 chestnut-cms/chestnut-cms-contentcore/src/main/java/com/chestnut/contentcore/properties/ShortTitleLabelProperty.java create mode 100644 chestnut-cms/chestnut-cms-contentcore/src/main/java/com/chestnut/contentcore/properties/SubTitleLabelProperty.java diff --git a/chestnut-cms/chestnut-cms-contentcore/src/main/java/com/chestnut/contentcore/controller/ContentController.java b/chestnut-cms/chestnut-cms-contentcore/src/main/java/com/chestnut/contentcore/controller/ContentController.java index 49ba70ea..da9fda05 100644 --- a/chestnut-cms/chestnut-cms-contentcore/src/main/java/com/chestnut/contentcore/controller/ContentController.java +++ b/chestnut-cms/chestnut-cms-contentcore/src/main/java/com/chestnut/contentcore/controller/ContentController.java @@ -41,6 +41,8 @@ import com.chestnut.contentcore.domain.vo.ListContentVO; import com.chestnut.contentcore.fixed.dict.ContentAttribute; import com.chestnut.contentcore.listener.event.AfterContentEditorInitEvent; import com.chestnut.contentcore.perms.CatalogPermissionType.CatalogPrivItem; +import com.chestnut.contentcore.properties.ShortTitleLabelProperty; +import com.chestnut.contentcore.properties.SubTitleLabelProperty; import com.chestnut.contentcore.service.ICatalogService; import com.chestnut.contentcore.service.IContentService; import com.chestnut.contentcore.service.IPublishService; @@ -147,6 +149,12 @@ public class ContentController extends BaseRestController { // 获取初始化数据 ContentVO vo = ct.initEditor(catalogId, contentId); vo.setShowSubTitle(ShowContentSubTitlePreference.getValue(StpAdminUtil.getLoginUser())); + CmsCatalog catalog = catalogService.getCatalog(catalogId); + CmsSite site = siteService.getSite(catalog.getSiteId()); + String shortTitleLabel = ShortTitleLabelProperty.getValue(catalog.getConfigProps(), site.getConfigProps()); + String subTitleLabel = SubTitleLabelProperty.getValue(catalog.getConfigProps(), site.getConfigProps()); + vo.setShortTitleLabel(shortTitleLabel); + vo.setSubTitleLabel(subTitleLabel); // 事件扩展 this.applicationContext.publishEvent(new AfterContentEditorInitEvent(this, vo)); return R.ok(vo); diff --git a/chestnut-cms/chestnut-cms-contentcore/src/main/java/com/chestnut/contentcore/domain/vo/ContentVO.java b/chestnut-cms/chestnut-cms-contentcore/src/main/java/com/chestnut/contentcore/domain/vo/ContentVO.java index a8e8f88e..fbf071d7 100644 --- a/chestnut-cms/chestnut-cms-contentcore/src/main/java/com/chestnut/contentcore/domain/vo/ContentVO.java +++ b/chestnut-cms/chestnut-cms-contentcore/src/main/java/com/chestnut/contentcore/domain/vo/ContentVO.java @@ -60,11 +60,15 @@ public class ContentVO implements InitByContent { */ private String subTitle; + private String subTitleLabel; + /** * 短标题 */ private String shortTitle; + private String shortTitleLabel; + /** * 标题样式 */ diff --git a/chestnut-cms/chestnut-cms-contentcore/src/main/java/com/chestnut/contentcore/properties/ShortTitleLabelProperty.java b/chestnut-cms/chestnut-cms-contentcore/src/main/java/com/chestnut/contentcore/properties/ShortTitleLabelProperty.java new file mode 100644 index 00000000..f0e76cd6 --- /dev/null +++ b/chestnut-cms/chestnut-cms-contentcore/src/main/java/com/chestnut/contentcore/properties/ShortTitleLabelProperty.java @@ -0,0 +1,60 @@ +/* + * Copyright 2022-2024 兮玥(190785909@qq.com) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.chestnut.contentcore.properties; + +import com.chestnut.common.utils.StringUtils; +import com.chestnut.contentcore.core.IProperty; +import com.chestnut.contentcore.util.ConfigPropertyUtils; +import org.springframework.stereotype.Component; + +import java.util.Map; + +/** + * 内容短标题Label自定义配置 + * + * @author 兮玥 + * @email 190785909@qq.com + */ +@Component(IProperty.BEAN_NAME_PREFIX + ShortTitleLabelProperty.ID) +public class ShortTitleLabelProperty implements IProperty { + + public final static String ID = "ShortTitleLabel"; + + static UseType[] UseTypes = new UseType[] { UseType.Site, UseType.Catalog }; + + @Override + public UseType[] getUseTypes() { + return UseTypes; + } + + @Override + public String getId() { + return ID; + } + + @Override + public String getName() { + return "内容短标题Label自定义配置"; + } + + public static String getValue(Map catalogProps, Map siteProps) { + String label = ConfigPropertyUtils.getStringValue(ID, catalogProps); + if (StringUtils.isBlank(label)) { + label = ConfigPropertyUtils.getStringValue(ID, siteProps); + } + return label; + } +} \ No newline at end of file diff --git a/chestnut-cms/chestnut-cms-contentcore/src/main/java/com/chestnut/contentcore/properties/SubTitleLabelProperty.java b/chestnut-cms/chestnut-cms-contentcore/src/main/java/com/chestnut/contentcore/properties/SubTitleLabelProperty.java new file mode 100644 index 00000000..728ec714 --- /dev/null +++ b/chestnut-cms/chestnut-cms-contentcore/src/main/java/com/chestnut/contentcore/properties/SubTitleLabelProperty.java @@ -0,0 +1,60 @@ +/* + * Copyright 2022-2024 兮玥(190785909@qq.com) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.chestnut.contentcore.properties; + +import com.chestnut.common.utils.StringUtils; +import com.chestnut.contentcore.core.IProperty; +import com.chestnut.contentcore.util.ConfigPropertyUtils; +import org.springframework.stereotype.Component; + +import java.util.Map; + +/** + * 内容副标题Label自定义配置 + * + * @author 兮玥 + * @email 190785909@qq.com + */ +@Component(IProperty.BEAN_NAME_PREFIX + SubTitleLabelProperty.ID) +public class SubTitleLabelProperty implements IProperty { + + public final static String ID = "SubTitleLabel"; + + static UseType[] UseTypes = new UseType[] { UseType.Site, UseType.Catalog }; + + @Override + public UseType[] getUseTypes() { + return UseTypes; + } + + @Override + public String getId() { + return ID; + } + + @Override + public String getName() { + return "内容副标题Label自定义配置"; + } + + public static String getValue(Map catalogProps, Map siteProps) { + String label = ConfigPropertyUtils.getStringValue(ID, catalogProps); + if (StringUtils.isBlank(label)) { + label = ConfigPropertyUtils.getStringValue(ID, siteProps); + } + return label; + } +} \ No newline at end of file diff --git a/chestnut-common/chestnut-common-staticize/src/main/java/com/chestnut/common/staticize/func/impl/GroupByFunction.java b/chestnut-common/chestnut-common-staticize/src/main/java/com/chestnut/common/staticize/func/impl/GroupByFunction.java index 7d5c8081..93c58823 100644 --- a/chestnut-common/chestnut-common-staticize/src/main/java/com/chestnut/common/staticize/func/impl/GroupByFunction.java +++ b/chestnut-common/chestnut-common-staticize/src/main/java/com/chestnut/common/staticize/func/impl/GroupByFunction.java @@ -39,12 +39,8 @@ public class GroupByFunction extends AbstractFunc { private static final String ARG1_NAME = "{FREEMARKER.FUNC." + FUNC_NAME + ".Arg1.Name}"; - private static final String ARG1_DESC = "{FREEMARKER.FUNC." + FUNC_NAME + ".Arg1.Desc}"; - private static final String ARG2_NAME = "{FREEMARKER.FUNC." + FUNC_NAME + ".Arg2.Name}"; - private static final String ARG2_DESC = "{FREEMARKER.FUNC." + FUNC_NAME + ".Arg2.Desc}"; - @Override public String getFuncName() { return FUNC_NAME; @@ -87,8 +83,8 @@ public class GroupByFunction extends AbstractFunc { @Override public List getFuncArgs() { return List.of( - new FuncArg(ARG1_NAME, FuncArgType.Array, true, ARG1_DESC), - new FuncArg(ARG2_NAME, FuncArgType.String, true, ARG2_DESC) + new FuncArg(ARG1_NAME, FuncArgType.Array, true), + new FuncArg(ARG2_NAME, FuncArgType.String, true) ); } } diff --git a/chestnut-ui/src/i18n/lang/en.js b/chestnut-ui/src/i18n/lang/en.js index e31d1689..583153cc 100644 --- a/chestnut-ui/src/i18n/lang/en.js +++ b/chestnut-ui/src/i18n/lang/en.js @@ -1008,6 +1008,8 @@ export default { DownloadRemoteImage: "Enable Download Remote Image", EnableSiteDeleteBackup: "Enable Site Delete Backup", MemberResourceUrl: "Member Resource Domain", + ShortTitleLabel: "Short Title Label", + SubTitleLabel: "Sub Title Label", }, Property: { QueryPlaceholder: "Input name/code", diff --git a/chestnut-ui/src/i18n/lang/zh-CN.js b/chestnut-ui/src/i18n/lang/zh-CN.js index f6a088a1..b4536f9c 100644 --- a/chestnut-ui/src/i18n/lang/zh-CN.js +++ b/chestnut-ui/src/i18n/lang/zh-CN.js @@ -1008,6 +1008,8 @@ export default { DownloadRemoteImage: "开启文章远程图片下载", EnableSiteDeleteBackup: "开启站点删除备份", MemberResourceUrl: "会员资源访问域名", + ShortTitleLabel: "短标题自定义表单名", + SubTitleLabel: "副标题自定义表单名", }, Property: { QueryPlaceholder: "输入名称/编码查询", diff --git a/chestnut-ui/src/i18n/lang/zh-TW.js b/chestnut-ui/src/i18n/lang/zh-TW.js index 14d02bac..b17e585f 100644 --- a/chestnut-ui/src/i18n/lang/zh-TW.js +++ b/chestnut-ui/src/i18n/lang/zh-TW.js @@ -1008,6 +1008,8 @@ export default { DownloadRemoteImage: "開啟文章遠程圖片下載", EnableSiteDeleteBackup: "開啟站點刪除備份", MemberResourceUrl: "會員資源訪問域名", + ShortTitleLabel: "短標題自定義表單名", + SubTitleLabel: "副標題自定義表單名", }, Property: { QueryPlaceholder: "輸入名稱/編碼查詢", diff --git a/chestnut-ui/src/views/cms/contentcore/catalogExtend.vue b/chestnut-ui/src/views/cms/contentcore/catalogExtend.vue index 9a28a761..81d72e74 100644 --- a/chestnut-ui/src/views/cms/contentcore/catalogExtend.vue +++ b/chestnut-ui/src/views/cms/contentcore/catalogExtend.vue @@ -107,6 +107,24 @@ inactive-value="N"> + + + {{ $t('CMS.Catalog.ApplyToChildren') }} + + + + {{ $t('CMS.Catalog.ApplyToChildren') }} +
@@ -245,6 +263,15 @@ export default { handleCatalogSelectorClose() { this.applyConfigPropKey = ""; this.openCatalogSelector = false; + }, + handleApplyToChildren(propKey) { + const data = { + catalogId: this.catalogId, + configPropKeys: [ propKey ] + } + applyConfigPropsToChildren(data).then(res => { + this.$modal.msgSuccess(res.msg); + }); } } }; diff --git a/chestnut-ui/src/views/cms/contentcore/contentEditor.vue b/chestnut-ui/src/views/cms/contentcore/contentEditor.vue index c1ab2e14..16e6c8b0 100644 --- a/chestnut-ui/src/views/cms/contentcore/contentEditor.vue +++ b/chestnut-ui/src/views/cms/contentcore/contentEditor.vue @@ -93,13 +93,13 @@ @@ -417,7 +417,9 @@ export default { toPublishAfterSave: false, openRelaContentDialog: false, openContentOpLogDialog: false, - ueditorImportCss: "" + ueditorImportCss: "", + shortTitleLabel: this.$t('CMS.Content.ShortTitle'), + subTitleLabel: this.$t('CMS.Content.SubTitle') }; }, created() { @@ -448,6 +450,12 @@ export default { if (response.data.contentType == "article") { this.articleFormat = this.isUpdateOperate ? response.data.format : this.$route.query.format; } + if (!this.$tools.isEmpty(response.data.shortTitleLabel)) { + this.shortTitleLabel = response.data.shortTitleLabel; + } + if (!this.$tools.isEmpty(response.data.subTitleLabel)) { + this.subTitleLabel = response.data.subTitleLabel; + } this.$nextTick(() => { this.form = response.data; this.catalogId = this.form.catalogId;