1
This commit is contained in:
parent
8fd8bdf4d9
commit
4fa3075e33
@ -1,3 +1,2 @@
|
|||||||
export const MAIL_TYPE_PERSONAL = 1
|
export const MAIL_TYPE_GROUP = 1
|
||||||
export const MAIL_TYPE_GROUP = 2
|
export const MAIL_TYPE_ALL = 2
|
||||||
export const MAIL_TYPE_ALL = 3
|
|
||||||
|
@ -19,14 +19,14 @@
|
|||||||
<el-date-picker v-model.number="postForm.expiretime" type="datetime" format="yyyy-MM-dd HH:mm:ss" value-format="timestamp" placeholder="Select date and time" required />
|
<el-date-picker v-model.number="postForm.expiretime" type="datetime" format="yyyy-MM-dd HH:mm:ss" value-format="timestamp" placeholder="Select date and time" required />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="10">
|
<el-col :span="10" v-show="userRegVisible">
|
||||||
<el-form-item label-width="120px" label="用户注册时间>=:" class="postInfo-container-item" prop="sendtime">
|
<el-form-item label-width="120px" label="注册时间>=:" class="postInfo-container-item" prop="user_reg_start_time">
|
||||||
<el-date-picker v-model.number="postForm.sendtime" type="datetime" format="yyyy-MM-dd HH:mm:ss" value-format="timestamp" placeholder="Select date and time" required />
|
<el-date-picker v-model.number="postForm.user_reg_start_time" type="datetime" format="yyyy-MM-dd HH:mm:ss" value-format="timestamp" placeholder="Select date and time" required />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="10">
|
<el-col :span="10" v-show="userRegVisible">
|
||||||
<el-form-item label-width="120px" label="用户注册时间<=:" class="postInfo-container-item" prop="expiretime">
|
<el-form-item label-width="120px" label="注册时间<=:" class="postInfo-container-item" prop="user_reg_end_time">
|
||||||
<el-date-picker v-model.number="postForm.expiretime" type="datetime" format="yyyy-MM-dd HH:mm:ss" value-format="timestamp" placeholder="Select date and time" required />
|
<el-date-picker v-model.number="postForm.user_reg_end_time" type="datetime" format="yyyy-MM-dd HH:mm:ss" value-format="timestamp" placeholder="Select date and time" required />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
@ -48,11 +48,6 @@
|
|||||||
</el-row>
|
</el-row>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-form-item style="margin-bottom: 40px;" prop="to">
|
|
||||||
<MDinput v-show="personalMailVisible" v-model="postForm.to" :maxlength="100" name="to" required>
|
|
||||||
收件人(account_id)
|
|
||||||
</MDinput>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item v-show="groupMailVisible" style="margin-bottom: 40px;" prop="to" label="收件人列表:">
|
<el-form-item v-show="groupMailVisible" style="margin-bottom: 40px;" prop="to" label="收件人列表:">
|
||||||
<el-input v-model="postForm.to" type="textarea" :rows="6" required />
|
<el-input v-model="postForm.to" type="textarea" :rows="6" required />
|
||||||
</el-input>
|
</el-input>
|
||||||
@ -71,7 +66,7 @@ import Sticky from '@/components/Sticky/index.vue'
|
|||||||
import MDinput from '@/components/MDinput/index.vue'
|
import MDinput from '@/components/MDinput/index.vue'
|
||||||
import { addMail, updateEmail } from '@/api/mail'
|
import { addMail, updateEmail } from '@/api/mail'
|
||||||
import { parseTime } from '@/utils'
|
import { parseTime } from '@/utils'
|
||||||
import { MAIL_TYPE_PERSONAL, MAIL_TYPE_GROUP, MAIL_TYPE_ALL } from '@/constant/constant'
|
import { MAIL_TYPE_GROUP, MAIL_TYPE_ALL } from '@/constant/constant'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Email',
|
name: 'Email',
|
||||||
@ -79,23 +74,47 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
postForm: {
|
postForm: {
|
||||||
mailtype: MAIL_TYPE_PERSONAL,
|
mailtype: MAIL_TYPE_GROUP,
|
||||||
sendtime: '',
|
sendtime: '',
|
||||||
expiretime: '',
|
expiretime: '',
|
||||||
|
user_reg_start_time: '',
|
||||||
|
user_reg_end_time: '',
|
||||||
subject: '',
|
subject: '',
|
||||||
to: '',
|
|
||||||
from: '',
|
|
||||||
usertype: 0,
|
|
||||||
content: '',
|
content: '',
|
||||||
attachments: ''
|
attachments: '',
|
||||||
|
to: '',
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
sendtime: [{ required: true, message: '请选择发送时间', trigger: 'blur' }],
|
sendtime: [{ required: true, message: '请选择发送时间', trigger: 'blur' }],
|
||||||
expiretime: [{ required: true, message: '请选择过期时间', trigger: 'blur' }],
|
expiretime: [{ required: true, message: '请选择过期时间', trigger: 'blur' }],
|
||||||
subject: [{ required: true, message: 'subject is required', trigger: 'blur' }],
|
subject: [{ required: true, message: 'subject is required', trigger: 'blur' }],
|
||||||
content: [{ required: true, message: 'content is required', trigger: 'blur' }]
|
content: [{ required: true, message: 'content is required', trigger: 'blur' }],
|
||||||
|
user_reg_start_time: [
|
||||||
|
{ required: true, message: '用户注册开始时间', trigger: 'blur' },
|
||||||
|
{
|
||||||
|
validator: (rule, value, cb, source, options) => {
|
||||||
|
const errors = [];
|
||||||
|
console.log(this.postForm.mailtype);
|
||||||
|
cb();
|
||||||
|
return errors;
|
||||||
|
},
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
user_reg_end_time: [
|
||||||
|
{ required: true, message: '用户注册结束时间', trigger: 'blur' },
|
||||||
|
{
|
||||||
|
validator: (rule, value, cb, source, options) => {
|
||||||
|
const errors = [];
|
||||||
|
console.log(this.postForm.mailtype);
|
||||||
|
cb();
|
||||||
|
return errors;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
},
|
},
|
||||||
personalMailVisible: true,
|
userRegVisible: true,
|
||||||
|
groupMailVisible: true,
|
||||||
mailTypeVisible: true,
|
mailTypeVisible: true,
|
||||||
dialogStatus: 'create'
|
dialogStatus: 'create'
|
||||||
}
|
}
|
||||||
@ -103,37 +122,27 @@ export default {
|
|||||||
watch: {
|
watch: {
|
||||||
'postForm.mailtype'(val) {
|
'postForm.mailtype'(val) {
|
||||||
switch (val) {
|
switch (val) {
|
||||||
case MAIL_TYPE_PERSONAL:
|
case MAIL_TYPE_GROUP:
|
||||||
{
|
{
|
||||||
this.personalMailVisible = true
|
this.userRegVisible = true;
|
||||||
this.groupMailVisible = false
|
this.groupMailVisible = true;
|
||||||
|
}
|
||||||
}
|
break;
|
||||||
break
|
case MAIL_TYPE_ALL:
|
||||||
case MAIL_TYPE_GROUP:
|
|
||||||
{
|
{
|
||||||
this.personalMailVisible = false
|
this.userRegVisible = true;
|
||||||
this.groupMailVisible = true
|
this.groupMailVisible = false;
|
||||||
|
}
|
||||||
}
|
break
|
||||||
break
|
|
||||||
case MAIL_TYPE_ALL:
|
|
||||||
{
|
|
||||||
this.personalMailVisible = false
|
|
||||||
this.groupMailVisible = false
|
|
||||||
|
|
||||||
}
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
if (this.dialogStatus === 'create' && val === 2) {
|
if (this.dialogStatus === 'create' && val === 2) {
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
const mailid = this.$route.params.mailid
|
const mailid = this.$route.params.mailid
|
||||||
if (mailid) {
|
if (mailid) {
|
||||||
this.personalMailVisible = false
|
|
||||||
this.mailTypeVisible = false
|
this.mailTypeVisible = false
|
||||||
this.dialogStatus = 'update'
|
this.dialogStatus = 'update'
|
||||||
const editEmail = JSON.parse(sessionStorage.getItem('editEmail' + mailid))
|
const editEmail = JSON.parse(sessionStorage.getItem('editEmail' + mailid))
|
||||||
@ -156,22 +165,30 @@ export default {
|
|||||||
const data = JSON.parse(JSON.stringify(this.postForm))
|
const data = JSON.parse(JSON.stringify(this.postForm))
|
||||||
data.sendtime = data.sendtime / 1000
|
data.sendtime = data.sendtime / 1000
|
||||||
data.expiretime = data.expiretime / 1000
|
data.expiretime = data.expiretime / 1000
|
||||||
this.$refs['postForm'].validate((valid) => {
|
data.user_reg_start_time = data.user_reg_start_time / 1000
|
||||||
if (valid) {
|
data.user_reg_end_time = data.user_reg_end_time / 1000
|
||||||
addMail(data).then(response => {
|
console.log('valid begin');
|
||||||
if (response.code === 0) {
|
try {
|
||||||
this.$message({
|
this.$refs['postForm'].validate((valid) => {
|
||||||
message: '发布成功',
|
console.log('valid end', valid);
|
||||||
type: 'success',
|
if (valid) {
|
||||||
duration: 1200,
|
addMail(data).then(response => {
|
||||||
onClose: () => {
|
if (response.code === 0) {
|
||||||
this.$router.push('index')
|
this.$message({
|
||||||
}
|
message: '发布成功',
|
||||||
})
|
type: 'success',
|
||||||
}
|
duration: 1200,
|
||||||
})
|
onClose: () => {
|
||||||
}
|
this.$router.push('index')
|
||||||
})
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} catch(e) {
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
updateFrom() {
|
updateFrom() {
|
||||||
const data = JSON.parse(JSON.stringify(this.postForm))
|
const data = JSON.parse(JSON.stringify(this.postForm))
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
<el-dropdown-menu slot="dropdown" class="no-padding">
|
<el-dropdown-menu slot="dropdown" class="no-padding">
|
||||||
<el-dropdown-item>
|
<el-dropdown-item>
|
||||||
<el-radio-group v-model="mailtype" style="padding: 10px;">
|
<el-radio-group v-model="mailtype" style="padding: 10px;">
|
||||||
<el-radio :label="MAIL_TYPE_PERSONAL">个人</el-radio>
|
|
||||||
<el-radio :label="MAIL_TYPE_GROUP">群发</el-radio>
|
<el-radio :label="MAIL_TYPE_GROUP">群发</el-radio>
|
||||||
<el-radio :label="MAIL_TYPE_ALL">全体</el-radio>
|
<el-radio :label="MAIL_TYPE_ALL">全体</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
@ -17,18 +16,17 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
import { MAIL_TYPE_PERSONAL, MAIL_TYPE_GROUP, MAIL_TYPE_ALL } from '@/constant/constant'
|
import { MAIL_TYPE_GROUP, MAIL_TYPE_ALL } from '@/constant/constant'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
value: {
|
value: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: MAIL_TYPE_PERSONAL
|
default: MAIL_TYPE_GROUP
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
MAIL_TYPE_PERSONAL: MAIL_TYPE_PERSONAL,
|
|
||||||
MAIL_TYPE_GROUP: MAIL_TYPE_GROUP,
|
MAIL_TYPE_GROUP: MAIL_TYPE_GROUP,
|
||||||
MAIL_TYPE_ALL: MAIL_TYPE_ALL
|
MAIL_TYPE_ALL: MAIL_TYPE_ALL
|
||||||
}
|
}
|
||||||
@ -46,11 +44,6 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
getMailTypeDesc() {
|
getMailTypeDesc() {
|
||||||
switch (this.value) {
|
switch (this.value) {
|
||||||
case MAIL_TYPE_PERSONAL:
|
|
||||||
{
|
|
||||||
return '邮件类型: 个人'
|
|
||||||
}
|
|
||||||
break
|
|
||||||
case MAIL_TYPE_GROUP:
|
case MAIL_TYPE_GROUP:
|
||||||
{
|
{
|
||||||
return '邮件类型: 群发'
|
return '邮件类型: 群发'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user