|
@@ -108,9 +108,7 @@ export default {
|
|
|
orderNo: 0
|
|
|
},
|
|
|
positions: [], //位置列表
|
|
|
- rules: {
|
|
|
-
|
|
|
- }
|
|
|
+ rules: {}
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
@@ -118,9 +116,9 @@ export default {
|
|
|
if (this.data.content !== '') {
|
|
|
this.$refs.editor && this.$refs.editor.clearValidate(); // 清除校验
|
|
|
}
|
|
|
- if (this.data.content === ''){
|
|
|
+ if (this.data.content === '') {
|
|
|
// console.log('内容为空');
|
|
|
- this.$refs['form'].validateField('content') // 手动校验
|
|
|
+ this.$refs['form'].validateField('content'); // 手动校验
|
|
|
}
|
|
|
this.data.text = this.$refs.quillEditor.quill.root.innerText;
|
|
|
}
|
|
@@ -133,34 +131,32 @@ export default {
|
|
|
this.renderPositions();
|
|
|
if (this.isEdit) {
|
|
|
setTimeout(() => {
|
|
|
- this.rules = {
|
|
|
+ this.rules = {
|
|
|
position: [
|
|
|
{ required: true, message: '请选择内容类型', trigger: 'change' }
|
|
|
],
|
|
|
title: [
|
|
|
{ required: true, message: '请输入段落标题', trigger: 'change' },
|
|
|
{ max: 30, message: '标题名称不能超过30字', trigger: 'change' }
|
|
|
-
|
|
|
],
|
|
|
content: [
|
|
|
{ required: true, message: '请输入段落内容', trigger: 'change' }
|
|
|
]
|
|
|
};
|
|
|
}, 100);
|
|
|
- }else{
|
|
|
- this.rules = {
|
|
|
- position: [
|
|
|
- { required: true, message: '请选择内容类型', trigger: 'change' }
|
|
|
- ],
|
|
|
- title: [
|
|
|
- { required: true, message: '请输入段落标题', trigger: 'change' },
|
|
|
- { max: 30, message: '标题名称不能超过30字', trigger: 'change' }
|
|
|
-
|
|
|
- ],
|
|
|
- content: [
|
|
|
- { required: true, message: '请输入段落内容', trigger: 'change' }
|
|
|
- ]
|
|
|
- };
|
|
|
+ } else {
|
|
|
+ this.rules = {
|
|
|
+ position: [
|
|
|
+ { required: true, message: '请选择内容类型', trigger: 'change' }
|
|
|
+ ],
|
|
|
+ title: [
|
|
|
+ { required: true, message: '请输入段落标题', trigger: 'change' },
|
|
|
+ { max: 30, message: '标题名称不能超过30字', trigger: 'change' }
|
|
|
+ ],
|
|
|
+ content: [
|
|
|
+ { required: true, message: '请输入段落内容', trigger: 'change' }
|
|
|
+ ]
|
|
|
+ };
|
|
|
}
|
|
|
},
|
|
|
mounted() {},
|
|
@@ -178,6 +174,7 @@ export default {
|
|
|
renderPositions() {
|
|
|
//显示位置枚举列表
|
|
|
const pos = localStorage.getItem('knowledgeEnumsData');
|
|
|
+ // console.log('this.showType,', this.showType);
|
|
|
let positions = config.contentTypes;
|
|
|
if (this.showType == 1) {
|
|
|
// 诊断
|
|
@@ -185,7 +182,8 @@ export default {
|
|
|
} else if (
|
|
|
this.showType == 3 ||
|
|
|
this.showType == 4 ||
|
|
|
- this.showType == 5
|
|
|
+ this.showType == 5 ||
|
|
|
+ this.showType == 7
|
|
|
) {
|
|
|
// 检验/检查
|
|
|
this.positions = positions.filter(item => {
|
|
@@ -217,7 +215,6 @@ export default {
|
|
|
</script>
|
|
|
|
|
|
<style lang="less">
|
|
|
-
|
|
|
.quill-editor.ql-editor {
|
|
|
padding-left: 0 !important;
|
|
|
}
|
|
@@ -250,19 +247,20 @@ export default {
|
|
|
/**富文本编辑器样式修改***/
|
|
|
.ql-snow .ql-picker.ql-size .ql-picker-label::before,
|
|
|
.ql-snow .ql-picker.ql-size .ql-picker-item::before,
|
|
|
-.ql-snow .ql-picker.ql-header .ql-picker-label::before,it
|
|
|
-.ql-editor,.quill-editor{
|
|
|
+.ql-snow .ql-picker.ql-header .ql-picker-label::before,
|
|
|
+it .ql-editor,
|
|
|
+.quill-editor {
|
|
|
padding-top: 0px !important;
|
|
|
margin-top: -8px;
|
|
|
min-height: 48px;
|
|
|
- p{
|
|
|
+ p {
|
|
|
padding-top: 8px;
|
|
|
}
|
|
|
}
|
|
|
-.ql-editor.ql-blank::before{
|
|
|
- padding-top: 0px
|
|
|
+.ql-editor.ql-blank::before {
|
|
|
+ padding-top: 0px;
|
|
|
}
|
|
|
-.btns{
|
|
|
+.btns {
|
|
|
margin-top: 20px;
|
|
|
}
|
|
|
</style>
|