|
@@ -257,7 +257,7 @@
|
|
<!-- <Editor id="tinymce" v-model="tinymceHtml" :init="editorInit"></Editor> -->
|
|
<!-- <Editor id="tinymce" v-model="tinymceHtml" :init="editorInit"></Editor> -->
|
|
<!-- <el-input type="textarea" v-model="addForm.taskDesc" :rows="3"></el-input> -->
|
|
<!-- <el-input type="textarea" v-model="addForm.taskDesc" :rows="3"></el-input> -->
|
|
<!-- <quill-edito v-model="addForm.taskDesc"></quill-edito> -->
|
|
<!-- <quill-edito v-model="addForm.taskDesc"></quill-edito> -->
|
|
- <quill-editor ref="text" v-model="addForm.taskDesc" class="myQuillEditor" :options="editorOption" />
|
|
|
|
|
|
+ <quill-editor ref="text" v-model="addForm.taskDesc" class="myQuillEditor" :options="editorOption" @blur="onEditorBlur($event)" @focus="onEditorFocus($event)"/>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<!-- 富文本 -->
|
|
<!-- 富文本 -->
|
|
<div v-if="addForm.id != null">
|
|
<div v-if="addForm.id != null">
|
|
@@ -463,7 +463,7 @@
|
|
FileCenter,
|
|
FileCenter,
|
|
ProjectInfo,
|
|
ProjectInfo,
|
|
Summary,
|
|
Summary,
|
|
- quillEditor
|
|
|
|
|
|
+ quillEditor // 富文本
|
|
},
|
|
},
|
|
|
|
|
|
data() {
|
|
data() {
|
|
@@ -557,7 +557,6 @@ toolbar: 'bold italic underline strikethrough | fontsizeselect | forecolor backc
|
|
commentList: [],
|
|
commentList: [],
|
|
editorOption: { // 富文本框里面的默认值
|
|
editorOption: { // 富文本框里面的默认值
|
|
placeholder: '请输入文本...',
|
|
placeholder: '请输入文本...',
|
|
- theme: 'snow',
|
|
|
|
modules: {
|
|
modules: {
|
|
toolbar:[
|
|
toolbar:[
|
|
['bold', 'italic', 'underline', 'strike'], //加粗,斜体,下划线,删除线
|
|
['bold', 'italic', 'underline', 'strike'], //加粗,斜体,下划线,删除线
|
|
@@ -579,8 +578,10 @@ toolbar: 'bold italic underline strikethrough | fontsizeselect | forecolor backc
|
|
['clean'], //清除字体样式
|
|
['clean'], //清除字体样式
|
|
['image','video'] //上传图片、上传视频
|
|
['image','video'] //上传图片、上传视频
|
|
], //工具栏设置
|
|
], //工具栏设置
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ },
|
|
|
|
+ theme: 'snow',
|
|
|
|
+ },
|
|
|
|
+ textContent: true, // 控制提交
|
|
};
|
|
};
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
@@ -588,7 +589,38 @@ toolbar: 'bold italic underline strikethrough | fontsizeselect | forecolor backc
|
|
if(this.count >= 6) return
|
|
if(this.count >= 6) return
|
|
this.count += 2
|
|
this.count += 2
|
|
},
|
|
},
|
|
-
|
|
|
|
|
|
+ onEditorFocus() {
|
|
|
|
+ this.onEditorBlur()
|
|
|
|
+ },
|
|
|
|
+ // 获得焦点时触发
|
|
|
|
+ onEditorBlur(){
|
|
|
|
+ let theEle = this.$refs.text; // 获取元素
|
|
|
|
+ console.log(theEle.value); // 获取到富文本内容
|
|
|
|
+ var img = theEle.value.match(/<img[^>]+>/g); // 赛选 img 标签
|
|
|
|
+ console.log(img);
|
|
|
|
+ var arrImg = ''
|
|
|
|
+ for (var j = 0; j < img.length; j++) {
|
|
|
|
+ // 正则匹配,摘出img标签下的src里的内容,即capture
|
|
|
|
+ img[j].replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/gi, function(match, capture) {
|
|
|
|
+ arrImg += capture
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ // 原来的字符流大小,单位为字节
|
|
|
|
+ var strLen = arrImg.length;
|
|
|
|
+ // 计算后得到的文件流大小,单位为字节
|
|
|
|
+ var fileSize=parseInt(strLen-(strLen/8)*2);
|
|
|
|
+ console.log(fileSize,"字节");
|
|
|
|
+ var size = "";
|
|
|
|
+ size = (fileSize/1024/1024).toFixed(2);
|
|
|
|
+ if (size > 2){
|
|
|
|
+ this.textContent = false
|
|
|
|
+ this.$message({
|
|
|
|
+ showClose: true,
|
|
|
|
+ message: '图片超过了2MB,请重新上传',
|
|
|
|
+ type: 'warning'
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ },
|
|
// 侧边栏的点击事件
|
|
// 侧边栏的点击事件
|
|
retract() {
|
|
retract() {
|
|
if (this.$refs.box.className == 'el-icon-arrow-left') {
|
|
if (this.$refs.box.className == 'el-icon-arrow-left') {
|
|
@@ -1454,6 +1486,11 @@ toolbar: 'bold italic underline strikethrough | fontsizeselect | forecolor backc
|
|
},
|
|
},
|
|
|
|
|
|
submitInsert() {
|
|
submitInsert() {
|
|
|
|
+ if (this.textContent !== true) return this.$message({
|
|
|
|
+ showClose: true,
|
|
|
|
+ message: '图片太大,请重新上传',
|
|
|
|
+ type: 'warning'
|
|
|
|
+ });
|
|
this.$refs.form1.validate(valid => {
|
|
this.$refs.form1.validate(valid => {
|
|
if (valid) {
|
|
if (valid) {
|
|
delete this.addForm.subTaskList;
|
|
delete this.addForm.subTaskList;
|