diff --git a/src/constant/constant.js b/src/constant/constant.js
index 1ada06b..0eb53b9 100644
--- a/src/constant/constant.js
+++ b/src/constant/constant.js
@@ -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
diff --git a/src/views/email/create.vue b/src/views/email/create.vue
index 3023f27..05c975d 100644
--- a/src/views/email/create.vue
+++ b/src/views/email/create.vue
@@ -19,14 +19,14 @@
-
-
-
+
+
+
-
-
-
+
+
+
@@ -48,11 +48,6 @@
-
-
- 收件人(account_id)
-
-
@@ -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))
diff --git a/src/views/example/components/Dropdown/Comment.vue b/src/views/example/components/Dropdown/Comment.vue
index f520b37..f7a17b1 100644
--- a/src/views/example/components/Dropdown/Comment.vue
+++ b/src/views/example/components/Dropdown/Comment.vue
@@ -6,7 +6,6 @@
- 个人
群发
全体
@@ -17,18 +16,17 @@