修复富文本版本升级带来的问题
This commit is contained in:
@@ -66,7 +66,7 @@
|
|||||||
"vue-splitpane": "1.0.4",
|
"vue-splitpane": "1.0.4",
|
||||||
"vuedraggable": "2.20.0",
|
"vuedraggable": "2.20.0",
|
||||||
"vuex": "3.1.0",
|
"vuex": "3.1.0",
|
||||||
"wangeditor": "^4.7.9",
|
"wangeditor": "^4.7.11",
|
||||||
"xlsx": "^0.17.4"
|
"xlsx": "^0.17.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -41,9 +41,9 @@ export default {
|
|||||||
const _this = this
|
const _this = this
|
||||||
var editor = new E(this.$refs.editor)
|
var editor = new E(this.$refs.editor)
|
||||||
// 自定义菜单配置
|
// 自定义菜单配置
|
||||||
editor.customConfig.zIndex = 5
|
editor.config.zIndex = 5
|
||||||
// 文件上传
|
// 文件上传
|
||||||
editor.customConfig.customUploadImg = function(files, insert) {
|
editor.config.customUploadImg = function(files, insert) {
|
||||||
// files 是 input 中选中的文件列表
|
// files 是 input 中选中的文件列表
|
||||||
// insert 是获取图片 url 后,插入到编辑器的方法
|
// insert 是获取图片 url 后,插入到编辑器的方法
|
||||||
files.forEach(image => {
|
files.forEach(image => {
|
||||||
@@ -54,7 +54,7 @@ export default {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
editor.customConfig.onchange = (html) => {
|
editor.config.onchange = (html) => {
|
||||||
this.editorContent = html
|
this.editorContent = html
|
||||||
}
|
}
|
||||||
editor.create()
|
editor.create()
|
||||||
|
|||||||
@@ -2,19 +2,13 @@
|
|||||||
<div>
|
<div>
|
||||||
<el-form ref="form" :model="form" :rules="rules" style="margin-top: 6px;" size="small" label-width="100px">
|
<el-form ref="form" :model="form" :rules="rules" style="margin-top: 6px;" size="small" label-width="100px">
|
||||||
<el-form-item label="邮件标题" prop="subject">
|
<el-form-item label="邮件标题" prop="subject">
|
||||||
<el-input v-model="form.subject" style="width: 646px" />
|
<el-input v-model="form.subject" style="width: 646px" placeholder="请输入邮件标题,标题不能为空" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item
|
<el-form-item label="收件地址" prop="tos">
|
||||||
v-for="(domain, index) in tos"
|
<el-input v-model="form.tos" style="width: 646px" placeholder="请输入收件地址,多个地址英文逗号,隔开" />
|
||||||
:key="domain.key"
|
|
||||||
:label="'收件邮箱' + (index === 0 ? '': index)"
|
|
||||||
>
|
|
||||||
<el-input v-model="domain.value" style="width: 550px" />
|
|
||||||
<el-button icon="el-icon-plus" @click="addDomain" />
|
|
||||||
<el-button style="margin-left:0;" icon="el-icon-minus" @click.prevent="removeDomain(domain)" />
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<div ref="editor" class="editor" />
|
<div ref="editor" class="editor" />
|
||||||
<el-button :loading="loading" style="margin-left:1.6%;" size="medium" type="primary" @click="doSubmit">发送邮件</el-button>
|
<el-button :loading="loading" style="margin-left:1.6%;margin-bottom: 30px" size="medium" type="primary" @click="doSubmit">发送邮件</el-button>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -22,93 +16,55 @@
|
|||||||
<script>
|
<script>
|
||||||
import { send } from '@/api/tools/email'
|
import { send } from '@/api/tools/email'
|
||||||
import { upload } from '@/utils/upload'
|
import { upload } from '@/utils/upload'
|
||||||
import { validEmail } from '@/utils/validate'
|
|
||||||
import { mapGetters } from 'vuex'
|
import { mapGetters } from 'vuex'
|
||||||
import E from 'wangeditor'
|
import E from 'wangeditor'
|
||||||
export default {
|
export default {
|
||||||
name: 'Index',
|
name: 'Index',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
loading: false, form: { subject: '', tos: [], content: '' },
|
loading: false, form: { subject: '', tos: '', content: '' },
|
||||||
tos: [{
|
|
||||||
value: ''
|
|
||||||
}],
|
|
||||||
rules: {
|
rules: {
|
||||||
subject: [
|
subject: [
|
||||||
{ required: true, message: '标题不能为空', trigger: 'blur' }
|
{ required: true, message: '标题不能为空', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
tos: [
|
||||||
|
{ required: true, message: '收件人不能为空', trigger: 'blur' }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters([
|
...mapGetters([
|
||||||
'imagesUploadApi'
|
'imagesUploadApi',
|
||||||
|
'baseApi'
|
||||||
])
|
])
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
const _this = this
|
const _this = this
|
||||||
var editor = new E(this.$refs.editor)
|
var editor = new E(this.$refs.editor)
|
||||||
// 自定义菜单配置
|
// 自定义菜单配置
|
||||||
editor.customConfig.zIndex = 10
|
editor.config.zIndex = 10
|
||||||
// 文件上传
|
// 文件上传
|
||||||
editor.customConfig.customUploadImg = function(files, insert) {
|
editor.config.customUploadImg = function(files, insert) {
|
||||||
// files 是 input 中选中的文件列表
|
// files 是 input 中选中的文件列表
|
||||||
// insert 是获取图片 url 后,插入到编辑器的方法
|
// insert 是获取图片 url 后,插入到编辑器的方法
|
||||||
files.forEach(image => {
|
files.forEach(image => {
|
||||||
files.forEach(image => {
|
upload(_this.imagesUploadApi, image).then(res => {
|
||||||
upload(_this.imagesUploadApi, image).then(data => {
|
const data = res.data
|
||||||
insert(data.data.url)
|
const url = _this.baseApi + '/file/' + data.type + '/' + data.realName
|
||||||
})
|
insert(url)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
editor.customConfig.onchange = (html) => {
|
editor.config.onchange = (html) => {
|
||||||
this.form.content = html
|
this.form.content = html
|
||||||
}
|
}
|
||||||
editor.create()
|
editor.create()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
removeDomain(item) {
|
|
||||||
var index = this.tos.indexOf(item)
|
|
||||||
if (index !== -1 && this.tos.length !== 1) {
|
|
||||||
this.tos.splice(index, 1)
|
|
||||||
} else {
|
|
||||||
this.$message({
|
|
||||||
message: '请至少保留一位联系人',
|
|
||||||
type: 'warning'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
addDomain() {
|
|
||||||
this.tos.push({
|
|
||||||
value: '',
|
|
||||||
key: Date.now()
|
|
||||||
})
|
|
||||||
},
|
|
||||||
doSubmit() {
|
doSubmit() {
|
||||||
const _this = this
|
|
||||||
this.$refs['form'].validate((valid) => {
|
this.$refs['form'].validate((valid) => {
|
||||||
this.form.tos = []
|
|
||||||
if (valid) {
|
if (valid) {
|
||||||
let sub = false
|
|
||||||
this.tos.forEach(function(data, index) {
|
|
||||||
if (data.value === '') {
|
|
||||||
_this.$message({
|
|
||||||
message: '收件邮箱不能为空',
|
|
||||||
type: 'warning'
|
|
||||||
})
|
|
||||||
sub = true
|
|
||||||
} else if (validEmail(data.value)) {
|
|
||||||
_this.form.tos.push(data.value)
|
|
||||||
} else {
|
|
||||||
_this.$message({
|
|
||||||
message: '收件邮箱格式错误',
|
|
||||||
type: 'warning'
|
|
||||||
})
|
|
||||||
sub = true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
if (sub) { return false }
|
|
||||||
this.loading = true
|
this.loading = true
|
||||||
send(this.form).then(res => {
|
send(this.form).then(res => {
|
||||||
this.$notify({
|
this.$notify({
|
||||||
|
|||||||
Reference in New Issue
Block a user