Commit 92f46174 authored by FE-安焕焕's avatar FE-安焕焕 👣

编辑器问题

parent 1dfcf7c5
<template> <template>
<div> <div>
<textarea id="editor" rows="10" cols="80" v-model="editorValue"></textarea> <textarea id="editor" rows="10" cols="80"></textarea>
</div> </div>
</template> </template>
<script type="text/ecmascript-6"> <script type="text/ecmascript-6">
...@@ -31,20 +31,23 @@ ...@@ -31,20 +31,23 @@
}, },
data() { data() {
return { return {
editorValue : this.value isInit: false
}; };
}, },
watch: {
value:{
deep: true,
immediate:true,
handler(value) {
this.isInit&&this.editor.setData(value.value)
}
}
},
mounted() { mounted() {
this.init() this.init()
}, },
beforeDestroy() { beforeDestroy() {
}, },
computed: {},
watch: {
value:function (value) {
this.editor.setData()
},
},
methods: { methods: {
init () { init () {
CKEDITOR.replace('editor', { CKEDITOR.replace('editor', {
...@@ -55,16 +58,13 @@ ...@@ -55,16 +58,13 @@
filebrowserImageUploadUrl: this.uploadUrl, filebrowserImageUploadUrl: this.uploadUrl,
filebrowserUploadMethod: 'form' filebrowserUploadMethod: 'form'
}); });
this.editor = CKEDITOR.instances.editor; this.editor = CKEDITOR.instances.editor;
this.editor.on( 'change', ( evt ) =>{ setTimeout(()=> {
// getData() returns CKEditor's HTML content. this.isInit = true
this.$emit('getValue', evt.editor.getData()) }, 1000)
});
}, },
}, getValue(){
watch:{ return this.editor.getData()
value: function(value) {
this.editor.setData(value)
} }
}, },
components: {} components: {}
......
...@@ -339,7 +339,7 @@ ...@@ -339,7 +339,7 @@
</div> </div>
</div> </div>
<div class="ckeditor"> <div class="ckeditor">
<ckeditor :value='sad' :uploadUrl='uploadurl' @getValue='getEditorValue' height='300px' width='100%' style="margin-left:3%"></ckeditor> <ckeditor :value='editorObject' ref='editor' :uploadUrl='uploadurl' height='300px' width='100%' style="margin-left:3%"></ckeditor>
</div> </div>
<div class="uploadEnclosure"> <div class="uploadEnclosure">
<p style="height:50px;"> <p style="height:50px;">
...@@ -393,6 +393,7 @@ import ckeditor from '../../components/ckeditor' ...@@ -393,6 +393,7 @@ import ckeditor from '../../components/ckeditor'
} }
return { return {
sad:'', sad:'',
editorObject: {type: '', value: ''},
ruleInline: { ruleInline: {
UpdateOWER: [ UpdateOWER: [
{ required: true, message: '邀约人不能为空', trigger: 'blur' } { required: true, message: '邀约人不能为空', trigger: 'blur' }
...@@ -1267,15 +1268,18 @@ import ckeditor from '../../components/ckeditor' ...@@ -1267,15 +1268,18 @@ import ckeditor from '../../components/ckeditor'
this.emailMassage=false this.emailMassage=false
}} }}
this.emailCode=value this.emailCode=value
let parmars={ let params={
resumeId:this.emailId==''?'':this.emailId, resumeId:this.emailId==''?'':this.emailId,
templateCode:this.emailCode templateCode:this.emailCode
} }
getEmailContent(parmars).then(res=>{ getEmailContent(params).then(res=>{
this.emailInline.theme=res.data.body.templateSubject this.emailInline.theme=res.data.body.templateSubject
this.emailInline.receiveEmail=res.data.body.receiveEmail this.emailInline.receiveEmail=res.data.body.receiveEmail
this.emailInline.templateContent=res.data.body.templateContent this.emailInline.templateContent=res.data.body.templateContent
this.sad=this.emailInline.templateContent this.editorObject = {
type: value,
value: this.emailInline.templateContent || ''
}
if(res.data.body&&res.data.body.resumeInterviewVO){ if(res.data.body&&res.data.body.resumeInterviewVO){
this.formInline.UpdateOWER=res.data.body.resumeInterviewVO.interviewerName this.formInline.UpdateOWER=res.data.body.resumeInterviewVO.interviewerName
this.formInline.UpdateVIEW=res.data.body.resumeInterviewVO.inviterName this.formInline.UpdateVIEW=res.data.body.resumeInterviewVO.inviterName
...@@ -1332,31 +1336,16 @@ import ckeditor from '../../components/ckeditor' ...@@ -1332,31 +1336,16 @@ import ckeditor from '../../components/ckeditor'
this.uploadFileList=[] this.uploadFileList=[]
this.SouSuo(this.pageT) this.SouSuo(this.pageT)
}, },
// getEditorValue(value){ getEditorValue(value){ // 调编辑器组件方法获取数据
// this.emailContent=value return this.$refs.editor.getValue()
// this.sad = value },
// // if(this.sad==''){this.$Notice.error({
// // title: '提示',
// // desc: '正文不能为空'
// // });
// // }
// // if(this.emailContent==''){
// // this.isDisable=false
// // }else{
// // this.isDisable=true
// // }
// },
getEditorValue: _debounce((value) => {
this.emailContent=value
this.sad = value
}),
delateFile(index){ delateFile(index){
this.fileList.splice(index,1) this.fileList.splice(index,1)
this.uploadFileList.splice(index,1) this.uploadFileList.splice(index,1)
}, },
// 确认发送邮件 // 确认发送邮件
confireSendEmail(){ confireSendEmail(){
this.sad = this.getEditorValue()
if(this.sad==''){ if(this.sad==''){
this.$Notice.error({ this.$Notice.error({
title: '提示', title: '提示',
......
...@@ -332,7 +332,7 @@ ...@@ -332,7 +332,7 @@
</div> </div>
</div> </div>
<div class="ckeditor"> <div class="ckeditor">
<ckeditor :value='sad' :uploadUrl='uploadurl' @getValue='getEditorValue' height='300px' width='100%' style="margin-left:3%"></ckeditor> <ckeditor :value='editorObject' ref='editor' :uploadUrl='uploadurl' height='300px' width='100%' style="margin-left:3%"></ckeditor>
</div> </div>
<div class="uploadEnclosure"> <div class="uploadEnclosure">
<p style="height:50px;"> <p style="height:50px;">
...@@ -401,6 +401,7 @@ export default { ...@@ -401,6 +401,7 @@ export default {
UpdateTIME:'', UpdateTIME:'',
UpdateVIEW:'' UpdateVIEW:''
}, },
editorObject: {type: '', value: ''},
emailInline:{ emailInline:{
moo:'', moo:'',
modalArr:[], modalArr:[],
...@@ -1168,7 +1169,10 @@ export default { ...@@ -1168,7 +1169,10 @@ export default {
this.emailInline.theme=res.data.body.templateSubject this.emailInline.theme=res.data.body.templateSubject
this.emailInline.receiveEmail=res.data.body.receiveEmail this.emailInline.receiveEmail=res.data.body.receiveEmail
this.emailInline.templateContent=res.data.body.templateContent this.emailInline.templateContent=res.data.body.templateContent
this.sad=this.emailInline.templateContent this.editorObject = {
type: value,
value: this.emailInline.templateContent || ''
}
if(res.data.body&&res.data.body.resumeInterviewVO){ if(res.data.body&&res.data.body.resumeInterviewVO){
this.formInline.UpdateOWER=res.data.body.resumeInterviewVO.interviewerName this.formInline.UpdateOWER=res.data.body.resumeInterviewVO.interviewerName
this.formInline.UpdateVIEW=res.data.body.resumeInterviewVO.inviterName this.formInline.UpdateVIEW=res.data.body.resumeInterviewVO.inviterName
...@@ -1225,10 +1229,9 @@ export default { ...@@ -1225,10 +1229,9 @@ export default {
this.uploadFileList=[] this.uploadFileList=[]
this.SouSuo(this.pageT) this.SouSuo(this.pageT)
}, },
getEditorValue: _debounce((value) => { getEditorValue(){ // 调编辑器组件方法获取数据
this.emailContent=value return this.$refs.editor.getValue()
this.sad = value },
}),
delateFile(index){ delateFile(index){
this.fileList.splice(index,1) this.fileList.splice(index,1)
this.uploadFileList.splice(index,1) this.uploadFileList.splice(index,1)
...@@ -1236,6 +1239,7 @@ export default { ...@@ -1236,6 +1239,7 @@ export default {
}, },
// 确认发送邮件 // 确认发送邮件
confireSendEmail(){ confireSendEmail(){
this.sad=this.getEditorValue()
if(this.sad==''){ if(this.sad==''){
this.$Notice.error({ this.$Notice.error({
title: '提示', title: '提示',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment