diff --git a/jero-web/src/views/businessSupport/problemKnowledgeBase/components/problemKnowledgeBaseAdd.vue b/jero-web/src/views/businessSupport/problemKnowledgeBase/components/problemKnowledgeBaseAdd.vue index 0b67d2eaf..27d8c801e 100644 --- a/jero-web/src/views/businessSupport/problemKnowledgeBase/components/problemKnowledgeBaseAdd.vue +++ b/jero-web/src/views/businessSupport/problemKnowledgeBase/components/problemKnowledgeBaseAdd.vue @@ -129,6 +129,7 @@ + {{$t('pleaseWaitWhileRunning')}} @@ -181,7 +193,28 @@ import 'quill/dist/quill.bubble.css' import listAddModel from './listAddModel' import { quillEditor } from 'vue-quill-editor' + import Vue from 'vue' + import { ACCESS_TOKEN } from '@/store/mutation-types' + const toolbarOptions = [ + ['bold', 'italic', 'underline', 'strike'], // toggled buttons + ['blockquote', 'code-block'], + + [{ 'header': 1 }, { 'header': 2 }], // custom button values + [{ 'list': 'ordered' }, { 'list': 'bullet' }], + [{ 'script': 'sub' }, { 'script': 'super' }], // superscript/subscript + [{ 'indent': '-1' }, { 'indent': '+1' }], // outdent/indent + [{ 'direction': 'rtl' }], // text direction + + [{ 'size': ['small', false, 'large', 'huge'] }], // custom dropdown + [{ 'header': [1, 2, 3, 4, 5, 6, false] }], + + [{ 'color': [] }, { 'background': [] }], // dropdown with defaults from theme + [{ 'font': [] }], + [{ 'align': [] }], + ['link', 'image', 'video'], + ['clean'] // remove formatting button + ] export default { name: 'problemKnowledgeBaseAdd', components: { @@ -193,8 +226,28 @@ data() { return { formInline: {}, + headers: '', + uploadAction: window._CONFIG['domianURL'] + '/sys/common/upload', loading: false, problemTypeList: [], + editorOption: { // 富文本框配置 + placeholder: '', + theme: 'snow', // or 'bubble' + modules: { + toolbar: { + container: toolbarOptions, // 工具栏 + handlers: { + 'image': function(value) { + if (value) { + document.querySelector('.ant-upload input').click() + } else { + this.quill.format('image', false) + } + } + } + } + } + }, rules: { showPermissions: [ { @@ -260,12 +313,13 @@ name: this.$t('Privacy') } ], - content: '

I am Example

', - editorOption: { - // Some Quill options... - } + content: '

I am Example

' } }, + created() { + const token = Vue.ls.get(ACCESS_TOKEN) + this.headers = { 'X-Access-Token': token } + }, computed: { editor() { return this.$refs.myQuillEditor.quill @@ -353,6 +407,9 @@ } , onEditorChange({ quill, html, text }) { + console.log(html) + console.log(quill) + console.log(text) this.formInline.content = html } , @@ -376,8 +433,25 @@ this.formInline.standNumber = number this.formInline.bussDocumentLibraryId = id this.formInline = { ...this.formInline } - } - , + }, + handleChange(info) { + let { file } = info + const status = info.file.status + if (status === 'done') { + let vm = this + let quill = this.$refs.myQuillEditor.quill + let length = quill.getSelection().index + let fileName = file.response.result.fileName + let index1 = fileName.lastIndexOf('.') + let index2 = fileName.length + let fileSuffix = fileName.substring(index1, index2) + quill.insertEmbed(length, 'image', window._CONFIG['domianPreviewURL']+'/sys/common/download/'+file.response.result.id+fileSuffix) + quill.setSelection(length + 1) + this.quillUpdateImg = false + } else if (status === 'uploading') { + + } + }, clickButtonToUpload(item) { this.$refs.uploadFile.perentHandleFunc() this.$refs.uploadFile.visible = true