This commit is contained in:
kahu474
2021-07-13 18:45:05 +08:00
parent 0b560fdc61
commit 6014d686b5
5 changed files with 108 additions and 41 deletions

View File

@ -662,7 +662,7 @@ export default {
if (this.formValidate.spec_type === 1 && this.manyFormValidate.length === 0) {
return this.$message.warning('请点击生成规格!');
}
edit(this.formValidate).then(async res => {
add(this.formValidate).then(async res => {
this.$message({
message: '操作成功',
type: 'success'

View File

@ -222,6 +222,7 @@ export default {
components: { editor, picUpload, mulpicUpload, Treeselect, MaterialList, UeditorWrap, singlePic,cgood },
data() {
return {
isAdd:false,// 是否是添加
spinShow: false,myTimes: [],
// 批量设置表格data
oneFormBatch: [
@ -410,6 +411,11 @@ export default {
initData('api/yxSystemGroupData',{ groupName: 'yshop_seckill_time',status:1 }).then(res => {
this.myTimes = res.content
})
if(this.$route.params.id){
this.isAdd = false
} else {
this.isAdd = true
}
},
methods: {
onInput(){
@ -654,17 +660,35 @@ export default {
if(this.formValidate.spec_type === 1 && this.manyFormValidate.length===0){
return this.$message.warning('请点击生成规格!');
}
edit(this.formValidate).then(async res => {
this.$message({
message:'操作成功',
type: 'success'
});
setTimeout(() => {
this.$router.push({ path: '/activity/seckill' });
}, 500);
}).catch(res => {
this.$message.error(res.msg);
})
// 判断是否是添加
if(this.isAdd){
console.log(this.formValidate)
add(this.formValidate).then(res=>{
this.$message({
message:'操作成功',
type: 'success'
});
setTimeout(() => {
this.$router.push({ path: '/activity/seckill' });
}, 500);
}).catch(res => {
this.$message.error(res.msg);
})
}else{
add(this.formValidate).then(async res => {
this.$message({
message:'操作成功',
type: 'success'
});
setTimeout(() => {
this.$router.push({ path: '/activity/seckill' });
}, 500);
}).catch(res => {
this.$message.error(res.msg);
})
}
} else {
if(!this.formValidate.store_name || !this.formValidate.cate_id || !this.formValidate.keyword
|| !this.formValidate.unit_name || !this.formValidate.store_info

View File

@ -17,7 +17,7 @@
icon="el-icon-plus"
@click="toAddURL"
>
新增312
新增
</el-button>
</div>
</div>

View File

@ -54,7 +54,6 @@
<udOperation
:data="scope.row"
:permission="permission"
:disabled-dle="scope.row.id === 1"
msg="确定删除吗,如果存在下级节点则一并删除,此操作不能撤销!"
/>
</template>

View File

@ -2,44 +2,61 @@
<div>
<el-form ref="form" :model="form" :rules="rules" style="margin-top: 6px;" size="small" label-width="100px">
<el-form-item label="邮件标题" prop="subject">
<el-input v-model="form.subject" style="width: 646px" />
<el-input v-model="form.subject" style="width: 646px"/>
</el-form-item>
<el-form-item
v-for="(domain, index) in tos"
:key="domain.key"
:label="'收件邮箱' + (index === 0 ? '': index)"
v-for="(domain, index) in tos"
: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-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>
<div ref="editor" class="editor" />
<el-button :loading="loading" style="margin-left:1.6%;" size="medium" type="primary" @click="doSubmit">发送邮件</el-button>
<el-form-item label="邮件内容">
<ueditor-wrap v-model="form.content" :config="myConfig" @beforeInit="addCustomDialog"
style="width: 90%;"></ueditor-wrap>
</el-form-item>
<div ref="editor" class="editor"/>
<el-button :loading="loading" style="margin-left:1.6%;" size="medium" type="primary" @click="doSubmit">发送邮件
</el-button>
</el-form>
</div>
</template>
<script>
import { send } from '@/api/tools/email'
import { upload } from '@/utils/upload'
import { validEmail } from '@/utils/validate'
import { mapGetters } from 'vuex'
import E from 'wangeditor'
import {send} from '@/api/tools/email'
import {upload} from '@/utils/upload'
import {validEmail} from '@/utils/validate'
import {mapGetters} from 'vuex'
import UeditorWrap from 'vue-ueditor-wrap';
export default {
name: 'Index',
data() {
return {
loading: false, form: { subject: '', tos: [], content: '' },
myConfig: {
autoHeightEnabled: false, // 编辑器不自动被内容撑高
initialFrameHeight: 500, // 初始容器高度
initialFrameWidth: '100%', // 初始容器宽度
UEDITOR_HOME_URL: '/UEditor/',
serverUrl: ''
},
loading: false, form: {subject: '', tos: [], content: ''},
tos: [{
value: ''
}],
rules: {
subject: [
{ required: true, message: '标题不能为空', trigger: 'blur' }
{required: true, message: '标题不能为空', trigger: 'blur'}
]
}
}
},
components: {
UeditorWrap
},
computed: {
...mapGetters([
'imagesUploadApi'
@ -51,7 +68,7 @@ export default {
// 自定义菜单配置
editor.customConfig.zIndex = 10
// 文件上传
editor.customConfig.customUploadImg = function(files, insert) {
editor.customConfig.customUploadImg = function (files, insert) {
// files 是 input 中选中的文件列表
// insert 是获取图片 url 后,插入到编辑器的方法
files.forEach(image => {
@ -68,6 +85,30 @@ export default {
editor.create()
},
methods: {
addCustomDialog () {
window.UE.registerUI('yshop', function (editor, uiName) {
let dialog = new window.UE.ui.Dialog({
iframeUrl: '/yshop/materia/index',
editor: editor,
name: uiName,
title: '上传图片',
cssRules: 'width:1200px;height:500px;padding:20px;'
});
this.dialog = dialog;
var btn = new window.UE.ui.Button({
name: 'dialog-button',
title: '上传图片',
cssRules: `background-image: url(../../../assets/images/icons.png);background-position: -726px -77px;`,
onclick: function () {
dialog.render();
dialog.open();
}
});
return btn;
}, 37);
},
removeDomain(item) {
var index = this.tos.indexOf(item)
if (index !== -1 && this.tos.length !== 1) {
@ -91,7 +132,7 @@ export default {
this.form.tos = []
if (valid) {
let sub = false
this.tos.forEach(function(data, index) {
this.tos.forEach(function (data, index) {
if (data.value === '') {
_this.$message({
message: '收件邮箱不能为空',
@ -108,7 +149,9 @@ export default {
sub = true
}
})
if (sub) { return false }
if (sub) {
return false
}
this.loading = true
send(this.form).then(res => {
this.$notify({
@ -131,12 +174,13 @@ export default {
</script>
<style scoped>
.editor{
text-align:left;
margin: 20px;
width: 730px;
}
::v-deep .w-e-text-container {
height: 360px !important;
}
.editor {
text-align: left;
margin: 20px;
width: 730px;
}
::v-deep .w-e-text-container {
height: 360px !important;
}
</style>