bug修复
This commit is contained in:
@@ -42,11 +42,18 @@
|
||||
</view>
|
||||
<view class="input_box">
|
||||
<uni-forms-item label="" name="content" label-width="0">
|
||||
<text class="input_tit"><i>*</i>说明:<span style="font-weight: normal; color: #999; font-size: 26rpx;">(600字以内)</span></text>
|
||||
<text class="input_tit"><i>*</i>主要内容:<span style="font-weight: normal; color: #999; font-size: 26rpx;">(600字以内)</span></text>
|
||||
<view class="in">
|
||||
<view class="uni-textarea">
|
||||
<textarea placeholder-style="font-size:26rpx" v-model="form.content" maxlength="600" auto-height
|
||||
placeholder="请输入内容" />
|
||||
<!-- <textarea placeholder-style="font-size:26rpx" v-model="form.content" maxlength="600" auto-height
|
||||
placeholder="请输入内容" /> -->
|
||||
<view class="editor-wrapper">
|
||||
<editor id="editor" class="ql-container" placeholder="请输入内容..."
|
||||
show-img-size show-img-toolbar show-img-resize
|
||||
@statuschange="onStatusChange" :read-only="readOnly"
|
||||
@ready="onEditorReady">
|
||||
</editor>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
@@ -94,6 +101,7 @@ import $http from '@/config/requestConfig.js';
|
||||
{ value: '0', text: "班内作业",name:"班内作业"},
|
||||
{ value: '1', text: "班内医案" ,name:"班内医案"},
|
||||
],
|
||||
readOnly: false,
|
||||
telError: false,
|
||||
relationError: false,
|
||||
relationErrorPattern:false,
|
||||
@@ -178,6 +186,30 @@ import $http from '@/config/requestConfig.js';
|
||||
},
|
||||
//方法
|
||||
methods: {
|
||||
readOnlyChange() {
|
||||
this.readOnly = !this.readOnly
|
||||
},
|
||||
onEditorReady() {
|
||||
// #ifdef APP-PLUS || MP-WEIXIN || H5
|
||||
uni.createSelectorQuery().select('#editor').context((res) => {
|
||||
this.editorCtx = res.context
|
||||
if (this.form.content == '') return
|
||||
res.context.setContents({
|
||||
html: this.form.content
|
||||
})
|
||||
}).exec()
|
||||
// #endif
|
||||
},
|
||||
undo() {
|
||||
this.editorCtx.undo()
|
||||
},
|
||||
redo() {
|
||||
this.editorCtx.redo()
|
||||
},
|
||||
onStatusChange(e) {
|
||||
const formats = e.detail
|
||||
this.formats = formats
|
||||
},
|
||||
chageType(e){
|
||||
// console.log('e',e);
|
||||
if(e == 0){
|
||||
@@ -203,6 +235,7 @@ import $http from '@/config/requestConfig.js';
|
||||
// that.isHave = true
|
||||
console.log(res)
|
||||
this.form = res.classTask
|
||||
this.onEditorReady()
|
||||
this.fileList1 = []
|
||||
if(this.form.img != ''){
|
||||
var List = this.form.img.split(',')
|
||||
@@ -267,8 +300,40 @@ import $http from '@/config/requestConfig.js';
|
||||
deletePic(event) {
|
||||
this.fileList1.splice(event.index, 1)
|
||||
},
|
||||
onSubmit() {
|
||||
this.$refs.form.validate().then(res => {
|
||||
getHtml() {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.editorCtx.getContents({
|
||||
success: (res) => {
|
||||
resolve(res);
|
||||
},
|
||||
fail: (error) => {
|
||||
reject(err);
|
||||
},
|
||||
});
|
||||
});
|
||||
},
|
||||
async onSubmit() {
|
||||
let data = await this.getHtml();
|
||||
var _data = data.html.replace(/<.*?>/g, "")
|
||||
if (!_data || _data == '') {
|
||||
uni.showToast({
|
||||
title: '请输入主要内容',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
this.form.content = data.html
|
||||
this.$refs.form.validate().then(async res => {
|
||||
let data = await this.getHtml();
|
||||
var _data = data.html.replace(/<.*?>/g, "")
|
||||
if (!_data || _data == '') {
|
||||
uni.showToast({
|
||||
title: '请输入主要内容',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
this.form.content = data.html
|
||||
if (this.fileList1.length > 0) {
|
||||
let _list = this.fileList1
|
||||
_list = _list.map(item => item.url)
|
||||
|
||||
Reference in New Issue
Block a user