修改禅道已知bug

This commit is contained in:
sunFlower
2022-09-30 17:46:55 +08:00
parent 8cfb1b714f
commit 325126d55a
@@ -139,12 +139,16 @@
<div class="title-text">
<span class="title-text-text">{{$t('content')}}</span>
</div>
<a-form-model-item style="height: 357px" class="itemModel itemModel-explain" prop="content">
<a-form-model-item style="height: 357px"
class="itemModel itemModel-explain ql-snow" prop="content">
<quill-editor
v-if="isDisplayIndex"
class="text-editor"
ref="myQuillEditor"
@ready="onEditorReady($event)"
v-model="formInline.content"
style="height: 300px"
:content="formInline.content"
style="height: 300px"
:options="editorOption"
@blur="quilleditorBlur"
@change="onEditorChange($event)"
@@ -242,6 +246,7 @@
loading: false,
headers: '',
dictOptions: [],
isDisplayIndex: false,
uploadAction: window._CONFIG['domianURL'] + '/sys/common/upload',
editorOption: { // 富文本框配置
placeholder: '',
@@ -319,6 +324,7 @@
add: '/problemKnowledgeBase/problemKnowledgeBaseEO/add',
edit: '/problemKnowledgeBase/problemKnowledgeBaseEO/edit'
},
formInlineOne: {},
isDisplay: false,
disabled: false,
content: '<h2>I am Example</h2>',
@@ -345,53 +351,14 @@
},
mounted() {
this.getBase()
let quill = this.$refs.myQuillEditor.quill
this.$forceUpdate()
quill.root.addEventListener(
'paste',
(evt) => {
if (
evt.clipboardData &&
evt.clipboardData.files &&
evt.clipboardData.files.length
) {
evt.preventDefault();
[].forEach.call(evt.clipboardData.files, (file) => {
if (!file.type.match(/^image\/(gif|jpe?g|a?png|bmp)/i)) {
return
}
const formData = new FormData()
formData.append('file', file)
axios({
url: this.uploadAction,
method: 'post',
data: formData,
headers: {
'Content-Type': 'multipart/form-data',
'X-Access-Token': Vue.ls.get(ACCESS_TOKEN)
}
})
.then((res) => {
if (res.data.success) {
let quill = this.$refs.myQuillEditor.quill
let length = quill.getSelection().index
let fileName = res.data.result.fileName
let index1 = fileName.lastIndexOf('.')
let index2 = fileName.length
let fileSuffix = fileName.substring(index1, index2)
quill.insertEmbed(length, 'image', window._CONFIG['domianWebImgURL'] + '/sys/common/download/' + res.data.result.id + fileSuffix)
quill.setSelection(length + 1)
}
})
})
}
},
false
)
if (this.$route.query.id) {
this.queryById()
document.title = this.$t('problemKnowledgeBase') + this.$t('edit')
} else {
this.isDisplayIndex = true
this.$nextTick(()=>{
this.myQuillEditor()
})
document.title = this.$t('problemKnowledgeBase') + this.$t('newlyAdded')
}
},
@@ -408,6 +375,51 @@
Delta.ops = ops
return Delta
},
myQuillEditor() {
let quill = this.$refs.myQuillEditor.quill
this.$forceUpdate()
quill.root.addEventListener(
'paste',
(evt) => {
if (
evt.clipboardData &&
evt.clipboardData.files &&
evt.clipboardData.files.length
) {
evt.preventDefault();
[].forEach.call(evt.clipboardData.files, (file) => {
if (!file.type.match(/^image\/(gif|jpe?g|a?png|bmp)/i)) {
return
}
const formData = new FormData()
formData.append('file', file)
axios({
url: this.uploadAction,
method: 'post',
data: formData,
headers: {
'Content-Type': 'multipart/form-data',
'X-Access-Token': Vue.ls.get(ACCESS_TOKEN)
}
})
.then((res) => {
if (res.data.success) {
let quill = this.$refs.myQuillEditor.quill
let length = quill.getSelection().index
let fileName = res.data.result.fileName
let index1 = fileName.lastIndexOf('.')
let index2 = fileName.length
let fileSuffix = fileName.substring(index1, index2)
quill.insertEmbed(length, 'image', window._CONFIG['domianWebImgURL'] + '/sys/common/download/' + res.data.result.id + fileSuffix)
quill.setSelection(length + 1)
}
})
})
}
},
false
)
},
quilleditorBlur() {
this.$refs.ruleForm.validateField('content')
},
@@ -428,12 +440,15 @@
this.formInline = { ...this.formInline }
},
queryById() {
this.loading = true
this.isDisplayIndex = false
let query = {
id: this.$route.query.id
}
getAction('/problemKnowledgeBase/problemKnowledgeBaseEO/queryById', query).then((res) => {
if (res.success) {
this.formInline = res.result || {}
this.formInlineOne = JSON.parse(JSON.stringify(res.result))
if (this.formInline.showPermissions == 'Privacy') {
this.isDisplay = true
if (this.formInline.permissionUserList && this.formInline.permissionUserList.length > 0) {
@@ -465,11 +480,21 @@
} else {
this.formInline = {}
}
this.isDisplayIndex = true
this.$nextTick(() => {
this.myQuillEditor()
})
this.loading = false
})
},
backClick() {
this.$router.go(-1)
},
onEditorReady(quill) {
if (this.formInlineOne.content){
document.getElementsByClassName('ql-editor')[0].innerHTML = this.formInlineOne.content
}
},
showPermissionsChange(event, name) {
if (event == 'Open') {
this.isDisplay = false
@@ -483,9 +508,6 @@
onEditorFocus(quill) {
console.log('editor focus!', quill)
},
onEditorReady(quill) {
console.log('editor ready!', quill)
},
PersonnelSelectionChange(value, id) {
this.formInline[value] = id
this.formInline = { ...this.formInline }
@@ -577,9 +599,11 @@
this.$refs.ruleForm.validate(valid => {
if (valid) {
let formInline = JSON.parse(JSON.stringify(this.formInline))
if (formInline.standNumber && formInline.standNumber.length > 0) {
// if (formInline.standNumber && formInline.standNumber.length > 0) {
if (formInline.standNumber instanceof Array){
formInline.standNumber = formInline.standNumber.join(',')
}
// }
this.loading = true
this.confirmLoading = true
let url = ''