富文本修复

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

@ -43,9 +43,9 @@
<div class="black"></div> <div class="black"></div>
<div>实验代码</div> <div>实验代码</div>
</div> </div>
<p style=" text-align: center;">参考答案</p> <p style="text-align: center;">参考答案</p>
<div> <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>
</div> </div>

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

Loading…
Cancel
Save