富文本修复

master
yujialong 2 years ago
parent 11dbcaa2cd
commit 123a722bbe
  1. 70
      src/components/quill/index.vue
  2. 4
      src/views/Program.vue
  3. 2
      src/views/Transaction.vue

@ -2,8 +2,8 @@
<div class="quill" :class="[classes,readonly ? 'readonly' : '']">
<div :ref="toref" :style="styles" v-loading="loading"></div>
<el-upload :action="this.api.fileupload" :before-upload="beforeUpload" :on-success="editorUploadSuccess" style="display: none">
<el-button class="editorUpload" ref="editorUpload" size="small" type="primary">点击上传</el-button>
<el-upload :headers="headers" :action="this.api.fileupload" :before-upload="beforeUpload" :on-success="editorUploadSuccess" style="display: none">
<el-button :id="'editorUpload' + index" ref="editorUpload" size="small" type="primary">点击上传</el-button>
</el-upload>
</div>
</template>
@ -43,11 +43,19 @@
},
minHeight: {
type: Number
}
},
//
index: {
type: Number,
default: 0
},
},
data () {
let that = this
return {
headers: {
token: this.$store.state.token
},
Quill: null,
currentValue: '',
options: {
@ -57,18 +65,16 @@
modules: {
toolbar: {
container: this.readonly ? [] : toolbarOptions,
// handlers: {
// 'image' (value) {
// console.log(22,value,that.Quill,that.toref,that.$refs)
// if (value) {
// that.qu = that.Quill
// // iview
// document.querySelector('.editorUpload').click()
// } else {
// this.Quill.format('image', false);
// }
// }
// }
handlers: {
"image": function(value) {
if (value) {
// iview
document.querySelector("#editorUpload" + that.index).click();
} else {
this.Quill.format("image", false);
}
}
}
}
},
placeholder: '',
@ -185,28 +191,22 @@
beforeUpload(file){
this.loading = true
},
editorUploadSuccess (res) {
editorUploadSuccess(res) {
//
// let toeval = "this.$refs."+this.toref+'.quill'
let toeval = 'this.$refs.editor2'
// console.log("toeval",toeval);
let quill = eval(toeval);
// let quill = this.Quill
let quill = this.Quill;
//
console.log(11,this.$refs)
// if (res.data.filesResult.fileUrl) {
// //
// let length = quill.selection.savedRange.index;
// // res
// quill.insertEmbed(length, 'image', res.data.filesResult.fileUrl)
// //
// quill.setSelection(length + 1)
// } else {
// this.$message.success('')
// }
this.loading = false
},
if (res.data.filesResult.fileUrl) {
//
let length = quill.getSelection().index;
// res
quill.insertEmbed(length, "image", res.data.filesResult.fileUrl);
//
quill.setSelection(length + 1);
} else {
util.successMsg("图片插入失败");
}
this.loading = false;
}
}
}
</script>

@ -43,9 +43,9 @@
<div class="black"></div>
<div>实验代码</div>
</div>
<p style=" text-align: center;">参考答案</p>
<p style="text-align: center;">参考答案</p>
<div>
<quill v-model="formData.points.experimentCode" :readonly="isView" :border="true" :minHeight="300" :height="300"/>
<quill v-model="formData.points.experimentCode" :readonly="isView" :border="true" :minHeight="300" :height="300" :index="1"/>
</div>
</div>

@ -853,7 +853,7 @@ export default {
lcId: i.lcId,
itemId:'',
type: i.type ? i.type : "",
operationIds: `285,${point.business},${i.operationIds}`,
operationIds: `${this.systemId == 11 ? 285 : 591},${point.business},${i.operationIds}`,
resultOperation: i.resultOperation,
ruleOperation: i.ruleOperation
};

Loading…
Cancel
Save