diff --git a/src/components/quill/index.vue b/src/components/quill/index.vue
index 51708d6..bde8779 100644
--- a/src/components/quill/index.vue
+++ b/src/components/quill/index.vue
@@ -2,8 +2,8 @@
@@ -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;
+ }
}
}
diff --git a/src/views/Program.vue b/src/views/Program.vue
index 05302ff..ae2d1f0 100644
--- a/src/views/Program.vue
+++ b/src/views/Program.vue
@@ -43,9 +43,9 @@
实验代码
- 参考答案
+ 参考答案
-
+
diff --git a/src/views/Transaction.vue b/src/views/Transaction.vue
index 6a5cbd8..2972385 100644
--- a/src/views/Transaction.vue
+++ b/src/views/Transaction.vue
@@ -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
};