Browse Source

案例功能修复

master
李鹏飞 6 years ago
parent
commit
21a8cfa2e6
  1. 60
      src/views/modules/case/typicalcase-add-or-update.vue

60
src/views/modules/case/typicalcase-add-or-update.vue

@ -49,7 +49,7 @@
<el-form-item label="案例来源:"
prop="caseSource">
<el-input v-model="item.caseSource"
disabled="true"
:disabled="true"
type="text"
clearable
style="width: 40rem;">
@ -60,7 +60,7 @@
</el-row>
<el-row>
<el-form-item label="案例类型:"prop="associatedType">
<el-select v-model="item.associatedType" disabled="true">
<el-select v-model="item.associatedType" :disabled="true">
<el-option label="议题" value="0"></el-option>
<el-option label="项目" value="1"></el-option>
<el-option label="话题" value="2"></el-option>
@ -69,7 +69,18 @@
</el-row>
<el-row>
<el-form-item label="内容描述:" prop="contentDescription">
<quill-editor ref="text" v-model="item.contentDescription" class="myQuillEditor" :options="editorOption" style="width: 40rem;"></quill-editor>
<el-upload ref="upload"
:action="uploadUrl"
:show-file-list="false"
:before-upload="uploadBeforeUploadHandle"
:on-success="uploadSuccessHandle"
style="display: none;">
<el-button ref="uploadBtn"
type="primary"
id="uploadBtn"
size="small">{{ $t('upload.button') }}</el-button>
</el-upload>
<quill-editor ref="myQuillEditor" v-model="item.contentDescription" class="myQuillEditor" :options="editorOption" style="width: 40rem;"></quill-editor>
</el-form-item>
</el-row>
</div>
@ -112,11 +123,11 @@ export default {
//
this.hideUpload = false
this.uploadUrl = `${window.SITE_CONFIG['apiURL']}/oss/file/upload?token=${Cookies.get('token')}`
if (this.quillEditor) {
this.quillEditor.deleteText(0, this.quillEditor.getLength())
} else {
this.quillEditorHandle()
}
// if (this.quillEditor) {
// this.quillEditor.deleteText(0, this.quillEditor.getLength())
// } else {
// this.quillEditorHandle()
// }
// end
})
},
@ -131,7 +142,28 @@ export default {
connectListVisible: false,
content: '',
loading: false,
editorOption: {},
editorOption: {
placeholder: 'Please enter it here...',
modules:{
toolbar:{
container: [
['bold', 'italic', 'underline', 'strike'],// 线线
['blockquote'],//
[{ 'header': 1 }, { 'header': 2 }],// 12
[{ 'list': 'ordered'}, { 'list': 'bullet' }],//
[{ 'indent': '-1'}, { 'indent': '+1' }],//
[{ 'direction': 'rtl' }],//
[{ 'size': ['small', false, 'large', 'huge'] }],//
[{ 'header': [1, 2, 3, 4, 5, 6, false] }],//
[{ 'color': [] }, { 'background': [] }],//
[{ 'font': [] }],//
[{ 'align': [] }],//
['clean'],//
['image']//
]
}
}
},
//
quillEditor: null,
quillEditorToolbarOptions: [
@ -286,16 +318,14 @@ export default {
return false
}
},
// ()
uploadSuccessHandle (res, file, fileList) {
uploadSuccessHandle (res) {
let quill = this.$refs.myQuillEditor[0].quill;
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.quillEditor.insertEmbed(this.quillEditor.getSelection().index, 'image', res.data.url)
},
setRegistTime () {
this.dataForm.newsReleaseStartTime = this.time[0]
this.dataForm.newsReleaseEndTime = this.time[1]
this.quill.insertEmbed(this.quill.getSelection().index, 'image', res.data.url)
},
// ends
init () {

Loading…
Cancel
Save