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

View File

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

View File

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

View File

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

View File

@ -2,44 +2,61 @@
<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"/>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
v-for="(domain, index) in tos" v-for="(domain, index) in tos"
:key="domain.key" :key="domain.key"
:label="'收件邮箱' + (index === 0 ? '': index)" :label="'收件邮箱' + (index === 0 ? '': index)"
> >
<el-input v-model="domain.value" style="width: 550px" /> <el-input v-model="domain.value" style="width: 550px"/>
<el-button icon="el-icon-plus" @click="addDomain" /> <el-button icon="el-icon-plus" @click="addDomain"/>
<el-button style="margin-left:0;" icon="el-icon-minus" @click.prevent="removeDomain(domain)" /> <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" /> <el-form-item label="邮件内容">
<el-button :loading="loading" style="margin-left:1.6%;" size="medium" type="primary" @click="doSubmit">发送邮件</el-button> <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> </el-form>
</div> </div>
</template> </template>
<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 {validEmail} from '@/utils/validate'
import { mapGetters } from 'vuex' import {mapGetters} from 'vuex'
import E from 'wangeditor' import UeditorWrap from 'vue-ueditor-wrap';
export default { export default {
name: 'Index', name: 'Index',
data() { data() {
return { 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: [{ tos: [{
value: '' value: ''
}], }],
rules: { rules: {
subject: [ subject: [
{ required: true, message: '标题不能为空', trigger: 'blur' } {required: true, message: '标题不能为空', trigger: 'blur'}
] ]
} }
} }
}, },
components: {
UeditorWrap
},
computed: { computed: {
...mapGetters([ ...mapGetters([
'imagesUploadApi' 'imagesUploadApi'
@ -51,7 +68,7 @@ export default {
// 自定义菜单配置 // 自定义菜单配置
editor.customConfig.zIndex = 10 editor.customConfig.zIndex = 10
// 文件上传 // 文件上传
editor.customConfig.customUploadImg = function(files, insert) { editor.customConfig.customUploadImg = function (files, insert) {
// files 是 input 中选中的文件列表 // files 是 input 中选中的文件列表
// insert 是获取图片 url 后,插入到编辑器的方法 // insert 是获取图片 url 后,插入到编辑器的方法
files.forEach(image => { files.forEach(image => {
@ -68,6 +85,30 @@ export default {
editor.create() editor.create()
}, },
methods: { 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) { removeDomain(item) {
var index = this.tos.indexOf(item) var index = this.tos.indexOf(item)
if (index !== -1 && this.tos.length !== 1) { if (index !== -1 && this.tos.length !== 1) {
@ -91,7 +132,7 @@ export default {
this.form.tos = [] this.form.tos = []
if (valid) { if (valid) {
let sub = false let sub = false
this.tos.forEach(function(data, index) { this.tos.forEach(function (data, index) {
if (data.value === '') { if (data.value === '') {
_this.$message({ _this.$message({
message: '收件邮箱不能为空', message: '收件邮箱不能为空',
@ -108,7 +149,9 @@ export default {
sub = true sub = true
} }
}) })
if (sub) { return false } if (sub) {
return false
}
this.loading = true this.loading = true
send(this.form).then(res => { send(this.form).then(res => {
this.$notify({ this.$notify({
@ -131,12 +174,13 @@ export default {
</script> </script>
<style scoped> <style scoped>
.editor{ .editor {
text-align:left; text-align: left;
margin: 20px; margin: 20px;
width: 730px; width: 730px;
} }
::v-deep .w-e-text-container {
height: 360px !important; ::v-deep .w-e-text-container {
} height: 360px !important;
}
</style> </style>