mirror of
https://gitee.com/liweiyi/ChestnutCMS.git
synced 2025-12-06 16:38:24 +08:00
自定义内容标记页面短/副标题表单Label支持
This commit is contained in:
parent
1778d5f5cd
commit
722eb3b9fb
@ -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);
|
||||
|
||||
@ -60,11 +60,15 @@ public class ContentVO implements InitByContent {
|
||||
*/
|
||||
private String subTitle;
|
||||
|
||||
private String subTitleLabel;
|
||||
|
||||
/**
|
||||
* 短标题
|
||||
*/
|
||||
private String shortTitle;
|
||||
|
||||
private String shortTitleLabel;
|
||||
|
||||
/**
|
||||
* 标题样式
|
||||
*/
|
||||
|
||||
@ -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<String, String> catalogProps, Map<String, String> siteProps) {
|
||||
String label = ConfigPropertyUtils.getStringValue(ID, catalogProps);
|
||||
if (StringUtils.isBlank(label)) {
|
||||
label = ConfigPropertyUtils.getStringValue(ID, siteProps);
|
||||
}
|
||||
return label;
|
||||
}
|
||||
}
|
||||
@ -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<String, String> catalogProps, Map<String, String> siteProps) {
|
||||
String label = ConfigPropertyUtils.getStringValue(ID, catalogProps);
|
||||
if (StringUtils.isBlank(label)) {
|
||||
label = ConfigPropertyUtils.getStringValue(ID, siteProps);
|
||||
}
|
||||
return label;
|
||||
}
|
||||
}
|
||||
@ -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<FuncArg> 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)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -1008,6 +1008,8 @@ export default {
|
||||
DownloadRemoteImage: "开启文章远程图片下载",
|
||||
EnableSiteDeleteBackup: "开启站点删除备份",
|
||||
MemberResourceUrl: "会员资源访问域名",
|
||||
ShortTitleLabel: "短标题自定义表单名",
|
||||
SubTitleLabel: "副标题自定义表单名",
|
||||
},
|
||||
Property: {
|
||||
QueryPlaceholder: "输入名称/编码查询",
|
||||
|
||||
@ -1008,6 +1008,8 @@ export default {
|
||||
DownloadRemoteImage: "開啟文章遠程圖片下載",
|
||||
EnableSiteDeleteBackup: "開啟站點刪除備份",
|
||||
MemberResourceUrl: "會員資源訪問域名",
|
||||
ShortTitleLabel: "短標題自定義表單名",
|
||||
SubTitleLabel: "副標題自定義表單名",
|
||||
},
|
||||
Property: {
|
||||
QueryPlaceholder: "輸入名稱/編碼查詢",
|
||||
|
||||
@ -107,6 +107,24 @@
|
||||
inactive-value="N">
|
||||
</el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('CMS.Site.Extend.ShortTitleLabel')" prop="ShortTitleLabel">
|
||||
<el-input class="mr5" v-model="form_extend.ShortTitleLabel"></el-input>
|
||||
<el-button
|
||||
class="btn-apply-child"
|
||||
icon="el-icon-finished"
|
||||
type="primary"
|
||||
plain
|
||||
@click="handleApplyToChildren('ShortTitleLabel')">{{ $t('CMS.Catalog.ApplyToChildren') }}</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('CMS.Site.Extend.SubTitleLabel')" prop="SubTitleLabel">
|
||||
<el-input class="mr5" v-model="form_extend.SubTitleLabel"></el-input>
|
||||
<el-button
|
||||
class="btn-apply-child"
|
||||
icon="el-icon-finished"
|
||||
type="primary"
|
||||
plain
|
||||
@click="handleApplyToChildren('SubTitleLabel')">{{ $t('CMS.Catalog.ApplyToChildren') }}</el-button>
|
||||
</el-form-item>
|
||||
</el-card>
|
||||
<el-card shadow="hover">
|
||||
<div slot="header" class="clearfix">
|
||||
@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -93,13 +93,13 @@
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
:label="$t('CMS.Content.ShortTitle')"
|
||||
:label="shortTitleLabel"
|
||||
v-if="showOtherTitle"
|
||||
prop="shortTitle">
|
||||
<el-input v-model="form.shortTitle" maxlength="120" show-word-limit />
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
:label="$t('CMS.Content.SubTitle')"
|
||||
:label="subTitleLabel"
|
||||
v-if="showOtherTitle"
|
||||
prop="subTitle">
|
||||
<el-input v-model="form.subTitle" maxlength="120" show-word-limit />
|
||||
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user