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 = 2
|
||||
export const MAIL_TYPE_ALL = 3
|
||||
export const MAIL_TYPE_GROUP = 1
|
||||
export const MAIL_TYPE_ALL = 2
|
||||
|
@ -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-form-item>
|
||||
</el-col>
|
||||
<el-col :span="10">
|
||||
<el-form-item label-width="120px" label="用户注册时间>=:" class="postInfo-container-item" prop="sendtime">
|
||||
<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-col :span="10" v-show="userRegVisible">
|
||||
<el-form-item label-width="120px" label="注册时间>=:" class="postInfo-container-item" prop="user_reg_start_time">
|
||||
<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-col>
|
||||
<el-col :span="10">
|
||||
<el-form-item label-width="120px" label="用户注册时间<=:" class="postInfo-container-item" prop="expiretime">
|
||||
<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-col :span="10" v-show="userRegVisible">
|
||||
<el-form-item label-width="120px" label="注册时间<=:" class="postInfo-container-item" prop="user_reg_end_time">
|
||||
<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-col>
|
||||
</el-row>
|
||||
@ -48,11 +48,6 @@
|
||||
</el-row>
|
||||
<el-row>
|
||||
<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-input v-model="postForm.to" type="textarea" :rows="6" required />
|
||||
</el-input>
|
||||
@ -71,7 +66,7 @@ import Sticky from '@/components/Sticky/index.vue'
|
||||
import MDinput from '@/components/MDinput/index.vue'
|
||||
import { addMail, updateEmail } from '@/api/mail'
|
||||
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 {
|
||||
name: 'Email',
|
||||
@ -79,23 +74,47 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
postForm: {
|
||||
mailtype: MAIL_TYPE_PERSONAL,
|
||||
mailtype: MAIL_TYPE_GROUP,
|
||||
sendtime: '',
|
||||
expiretime: '',
|
||||
user_reg_start_time: '',
|
||||
user_reg_end_time: '',
|
||||
subject: '',
|
||||
to: '',
|
||||
from: '',
|
||||
usertype: 0,
|
||||
content: '',
|
||||
attachments: ''
|
||||
attachments: '',
|
||||
to: '',
|
||||
},
|
||||
rules: {
|
||||
sendtime: [{ required: true, message: '请选择发送时间', trigger: 'blur' }],
|
||||
expiretime: [{ required: true, message: '请选择过期时间', 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,
|
||||
dialogStatus: 'create'
|
||||
}
|
||||
@ -103,37 +122,27 @@ export default {
|
||||
watch: {
|
||||
'postForm.mailtype'(val) {
|
||||
switch (val) {
|
||||
case MAIL_TYPE_PERSONAL:
|
||||
case MAIL_TYPE_GROUP:
|
||||
{
|
||||
this.personalMailVisible = true
|
||||
this.groupMailVisible = false
|
||||
|
||||
}
|
||||
break
|
||||
case MAIL_TYPE_GROUP:
|
||||
this.userRegVisible = true;
|
||||
this.groupMailVisible = true;
|
||||
}
|
||||
break;
|
||||
case MAIL_TYPE_ALL:
|
||||
{
|
||||
this.personalMailVisible = false
|
||||
this.groupMailVisible = true
|
||||
|
||||
}
|
||||
break
|
||||
case MAIL_TYPE_ALL:
|
||||
{
|
||||
this.personalMailVisible = false
|
||||
this.groupMailVisible = false
|
||||
|
||||
}
|
||||
break
|
||||
this.userRegVisible = true;
|
||||
this.groupMailVisible = false;
|
||||
}
|
||||
break
|
||||
}
|
||||
/*
|
||||
if (this.dialogStatus === 'create' && val === 2) {
|
||||
}*/
|
||||
if (this.dialogStatus === 'create' && val === 2) {
|
||||
}*/
|
||||
}
|
||||
},
|
||||
created() {
|
||||
const mailid = this.$route.params.mailid
|
||||
if (mailid) {
|
||||
this.personalMailVisible = false
|
||||
this.mailTypeVisible = false
|
||||
this.dialogStatus = 'update'
|
||||
const editEmail = JSON.parse(sessionStorage.getItem('editEmail' + mailid))
|
||||
@ -156,22 +165,30 @@ export default {
|
||||
const data = JSON.parse(JSON.stringify(this.postForm))
|
||||
data.sendtime = data.sendtime / 1000
|
||||
data.expiretime = data.expiretime / 1000
|
||||
this.$refs['postForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
addMail(data).then(response => {
|
||||
if (response.code === 0) {
|
||||
this.$message({
|
||||
message: '发布成功',
|
||||
type: 'success',
|
||||
duration: 1200,
|
||||
onClose: () => {
|
||||
this.$router.push('index')
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
data.user_reg_start_time = data.user_reg_start_time / 1000
|
||||
data.user_reg_end_time = data.user_reg_end_time / 1000
|
||||
console.log('valid begin');
|
||||
try {
|
||||
this.$refs['postForm'].validate((valid) => {
|
||||
console.log('valid end', valid);
|
||||
if (valid) {
|
||||
addMail(data).then(response => {
|
||||
if (response.code === 0) {
|
||||
this.$message({
|
||||
message: '发布成功',
|
||||
type: 'success',
|
||||
duration: 1200,
|
||||
onClose: () => {
|
||||
this.$router.push('index')
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
} catch(e) {
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
updateFrom() {
|
||||
const data = JSON.parse(JSON.stringify(this.postForm))
|
||||
|
@ -6,7 +6,6 @@
|
||||
<el-dropdown-menu slot="dropdown" class="no-padding">
|
||||
<el-dropdown-item>
|
||||
<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_ALL">全体</el-radio>
|
||||
</el-radio-group>
|
||||
@ -17,18 +16,17 @@
|
||||
|
||||
<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 {
|
||||
props: {
|
||||
value: {
|
||||
type: Number,
|
||||
default: MAIL_TYPE_PERSONAL
|
||||
default: MAIL_TYPE_GROUP
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
MAIL_TYPE_PERSONAL: MAIL_TYPE_PERSONAL,
|
||||
MAIL_TYPE_GROUP: MAIL_TYPE_GROUP,
|
||||
MAIL_TYPE_ALL: MAIL_TYPE_ALL
|
||||
}
|
||||
@ -46,11 +44,6 @@ export default {
|
||||
methods: {
|
||||
getMailTypeDesc() {
|
||||
switch (this.value) {
|
||||
case MAIL_TYPE_PERSONAL:
|
||||
{
|
||||
return '邮件类型: 个人'
|
||||
}
|
||||
break
|
||||
case MAIL_TYPE_GROUP:
|
||||
{
|
||||
return '邮件类型: 群发'
|
||||
|
Loading…
x
Reference in New Issue
Block a user