|
|
|
@ -238,383 +238,383 @@ |
|
|
|
</el-card> |
|
|
|
</template> |
|
|
|
<script> |
|
|
|
import Cookies from 'js-cookie' |
|
|
|
import MapSelect from './map-select' |
|
|
|
import debounce from 'lodash/debounce' |
|
|
|
import 'quill/dist/quill.snow.css' |
|
|
|
import Quill from 'quill' |
|
|
|
export default { |
|
|
|
name: 'ActInfoAdd', |
|
|
|
data () { |
|
|
|
return { |
|
|
|
visible: false, |
|
|
|
dataForm: { |
|
|
|
id: '', |
|
|
|
title: '', |
|
|
|
headPic: '', |
|
|
|
signUpStartTime: '', |
|
|
|
signUpEndTime: '', |
|
|
|
actQuotaFlag: '1', |
|
|
|
actStartTime: '', |
|
|
|
actEndTime: '', |
|
|
|
actAddress: '', |
|
|
|
actLongitude: '', |
|
|
|
actLatitude: '', |
|
|
|
clockRadius: 200, |
|
|
|
actQuota: '', |
|
|
|
contacts: '', |
|
|
|
tel: '', |
|
|
|
requirement: '', |
|
|
|
actContent: '', |
|
|
|
actStatus: '', |
|
|
|
publishTime: '', |
|
|
|
sponsor: '', |
|
|
|
deptId: '', |
|
|
|
punishmentPoints: '', |
|
|
|
reward: '', |
|
|
|
isBanner: '1', |
|
|
|
actUserDefaultState: '1', |
|
|
|
bannerUrl: '', |
|
|
|
cancelReason: '', |
|
|
|
signUpNum: 0, |
|
|
|
sectionCode: '', |
|
|
|
categoryCode: '', |
|
|
|
categoryName: '' |
|
|
|
}, |
|
|
|
options: [], |
|
|
|
issignUpEndTime: { |
|
|
|
disabledDate (time) { |
|
|
|
return time < Date.now() - 8.64e7 // 8.64e7=1000*60*60*24一天 |
|
|
|
} |
|
|
|
}, |
|
|
|
isImgRequired: true, |
|
|
|
mapSelectVisible: false, |
|
|
|
signInIsAble: true, |
|
|
|
isAble: false, |
|
|
|
loading: false, |
|
|
|
// 富文本 |
|
|
|
quillEditor: null, |
|
|
|
quillEditorToolbarOptions: [ |
|
|
|
['bold', 'italic', 'underline', 'strike'], |
|
|
|
['blockquote', 'code-block', 'image'], |
|
|
|
[{ 'header': 1 }, { 'header': 2 }], |
|
|
|
[{ 'list': 'ordered' }, { 'list': 'bullet' }], |
|
|
|
[{ 'script': 'sub' }, { 'script': 'super' }], |
|
|
|
[{ 'indent': '-1' }, { 'indent': '+1' }], |
|
|
|
[{ 'direction': 'rtl' }], |
|
|
|
[{ 'size': ['small', false, 'large', 'huge'] }], |
|
|
|
[{ 'header': [1, 2, 3, 4, 5, 6, false] }], |
|
|
|
[{ 'color': [] }, { 'background': [] }], |
|
|
|
[{ 'font': [] }], |
|
|
|
[{ 'align': [] }], |
|
|
|
['clean'] |
|
|
|
], |
|
|
|
uploadUrl: '', |
|
|
|
pickerBeginDateBefore: { |
|
|
|
disabledDate: (time) => { |
|
|
|
let beginDateVal = this.dataForm.actStartTime |
|
|
|
if (beginDateVal) { |
|
|
|
return time.getTime() > new Date(beginDateVal).getTime() |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
pickerBeginDateAfter: { |
|
|
|
disabledDate: (time) => { |
|
|
|
let EndDateVal = this.dataForm.actEndTime |
|
|
|
if (EndDateVal) { |
|
|
|
return time.getTime() < new Date(EndDateVal).getTime() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
created () { |
|
|
|
this.visible = true |
|
|
|
this.$nextTick(() => { |
|
|
|
// 富文本 |
|
|
|
this.hideUpload = false |
|
|
|
this.uploadUrl = `${window.SITE_CONFIG['apiURL']}/oss/file/upload?token=${Cookies.get('token')}` |
|
|
|
if (this.quillEditor) { |
|
|
|
this.quillEditor.deleteText(0, this.quillEditor.getLength()) |
|
|
|
} else { |
|
|
|
this.quillEditorHandle() |
|
|
|
} |
|
|
|
// 富文本end |
|
|
|
}) |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
this.getOptions() |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
dataRule () { |
|
|
|
return { |
|
|
|
title: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
headPic: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
signUpStartTime: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
signUpEndTime: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
actStartTime: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
actEndTime: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
actAddress: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
actLongitude: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
actLatitude: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
clockRadius: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
actQuotaFlag: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
actQuota: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
clockNum: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
actShareNum: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
actBrowseNum: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
contacts: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
tel: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
requirement: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
actContent: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
actStatus: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
publishTime: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
sponsor: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
deptId: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
categoryCode: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
punishmentPoints: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
reward: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
revision: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
createdBy: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
createdTime: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
updatedBy: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
updatedTime: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
bannerUrl: [ |
|
|
|
{ required: this.isImgRequired, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
] |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
getOptions () { |
|
|
|
this.$http |
|
|
|
.get(`/property/sectioncategory/list`, { params: { sectionCode: 'community_forum' } }).then(({ data: res }) => { |
|
|
|
if (res.code !== 0) { |
|
|
|
return this.$message.error(res.msg) |
|
|
|
} |
|
|
|
this.options = res.data |
|
|
|
}) |
|
|
|
.catch(() => { }) |
|
|
|
}, |
|
|
|
changeHandler (value) { |
|
|
|
if (value === 1) { |
|
|
|
this.isImgRequired = true |
|
|
|
} else { |
|
|
|
this.isImgRequired = false |
|
|
|
} |
|
|
|
}, |
|
|
|
backToActList () { |
|
|
|
this.$emit('refreshDataList') |
|
|
|
this.$parent.selectComponent = 'ActInfoList' |
|
|
|
this.$router.push({ path: '/activity-actinfo' }) |
|
|
|
}, |
|
|
|
init () { |
|
|
|
this.visible = true |
|
|
|
this.$nextTick(() => { |
|
|
|
this.$refs['dataForm'].resetFields() |
|
|
|
if (this.dataForm.id) { |
|
|
|
this.getInfo() |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
position (position) { |
|
|
|
if (position.type === 1) { |
|
|
|
this.dataForm.actAddress = position.address |
|
|
|
this.dataForm.actLatitude = position.latitude |
|
|
|
this.dataForm.actLongitude = position.longitude |
|
|
|
} |
|
|
|
}, |
|
|
|
// 富文本编辑器 |
|
|
|
quillEditorHandle () { |
|
|
|
this.quillEditor = new Quill('#J_quillEditor', { |
|
|
|
modules: { |
|
|
|
toolbar: this.quillEditorToolbarOptions |
|
|
|
}, |
|
|
|
theme: 'snow' |
|
|
|
}) |
|
|
|
this.quillEditor.container.style.height = `${300}px` |
|
|
|
// // 自定义上传图片功能 (使用element upload组件) |
|
|
|
this.quillEditor.getModule('toolbar').addHandler('image', () => { |
|
|
|
this.$refs.uploadBtn.$el.click() |
|
|
|
}) |
|
|
|
// 监听内容变化,动态赋值 |
|
|
|
this.quillEditor.on('text-change', () => { |
|
|
|
this.dataForm.actContent = this.quillEditor.root.innerHTML |
|
|
|
if ((this.dataForm.actContent).length > 10000) { |
|
|
|
return this.$message.error('您输入的的内容已超过字数') |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 上传图片之前 (富文本) |
|
|
|
uploadBeforeUploadHandle (file) { |
|
|
|
if (file.type !== 'image/jpg' && file.type !== 'image/jpeg' && file.type !== 'image/png' && file.type !== 'image/gif') { |
|
|
|
this.$message.error(this.$t('upload.tip', { 'format': 'jpg、png、gif' })) |
|
|
|
return false |
|
|
|
} |
|
|
|
}, |
|
|
|
// 上传图片成功 (富文本) |
|
|
|
uploadSuccessHandle (res, file, fileList) { |
|
|
|
if (res.code !== 0) { |
|
|
|
return this.$message.error(res.msg) |
|
|
|
} |
|
|
|
this.quillEditor.insertEmbed(this.quillEditor.getSelection().index, 'image', res.data.url) |
|
|
|
}, |
|
|
|
setRegistTime () { |
|
|
|
this.dataForm.newsReleaseStartTime = this.time[0] |
|
|
|
this.dataForm.newsReleaseEndTime = this.time[1] |
|
|
|
}, |
|
|
|
// 上传图片ends |
|
|
|
// 获取信息 |
|
|
|
getInfo () { |
|
|
|
this.$http.get(`/property/activityinfo/${this.dataForm.id}`).then(({ data: res }) => { |
|
|
|
if (res.code !== 0) { |
|
|
|
return this.$message.error(res.msg) |
|
|
|
} |
|
|
|
this.dataForm = { |
|
|
|
...this.dataForm, |
|
|
|
...res.data |
|
|
|
} |
|
|
|
}).catch(() => { }) |
|
|
|
}, |
|
|
|
// 表单提交 |
|
|
|
dataFormSubmitHandle: debounce(function () { |
|
|
|
if (new Date() >= new Date(this.dataForm.signUpEndTime)) { |
|
|
|
return this.$message.error('报名截止时间必须大于当前时间') |
|
|
|
} |
|
|
|
if (this.dataForm.actStartTime >= this.dataForm.actEndTime) { |
|
|
|
return this.$message.error('活动结束时间必须大于活动开始时间') |
|
|
|
} |
|
|
|
if (this.dataForm.actStartTime <= this.dataForm.signUpEndTime) { |
|
|
|
return this.$message.error('活动开始时间必须大于报名截止时间') |
|
|
|
} |
|
|
|
if ((this.dataForm.actContent).length > 10000) { |
|
|
|
return this.$message.error('您输入的的内容已超过字数') |
|
|
|
} |
|
|
|
if (this.dataForm.isActQuota === 0) { |
|
|
|
this.dataForm.actQuota = 0 |
|
|
|
} |
|
|
|
this.$refs['dataForm'].validate((valid) => { |
|
|
|
if (!valid) { |
|
|
|
return false |
|
|
|
} |
|
|
|
var signUpEndTime = new Date(Date.parse(this.dataForm.signUpEndTime)) |
|
|
|
var actStarTime = new Date(Date.parse(this.dataForm.actStartTime)) |
|
|
|
var actEndTime = new Date(Date.parse(this.dataForm.actEndTime)) |
|
|
|
if (signUpEndTime > actStarTime) { |
|
|
|
return this.$message.error('活动开始时间必须大于报名截止时间.') |
|
|
|
} |
|
|
|
if (actEndTime < actStarTime) { |
|
|
|
return this.$message.error('活动结束时间必须大于活动开始时间.') |
|
|
|
} |
|
|
|
this.isAble = true |
|
|
|
this.$http[!this.dataForm.id ? 'post' : 'put']('/property/activityinfo/', this.dataForm).then(({ data: res }) => { |
|
|
|
this.isAble = false |
|
|
|
if (res.code !== 0) { |
|
|
|
return this.$message.error(res.msg) |
|
|
|
} |
|
|
|
this.$message({ |
|
|
|
message: this.$t('prompt.success'), |
|
|
|
type: 'success', |
|
|
|
duration: 500, |
|
|
|
onClose: () => { |
|
|
|
this.visible = false |
|
|
|
this.$emit('refreshDataList') |
|
|
|
} |
|
|
|
}) |
|
|
|
this.$parent.selectComponent = 'ActInfoList' |
|
|
|
this.$router.push({ |
|
|
|
path: '/activity-actinfo' |
|
|
|
}) |
|
|
|
}).catch(() => { }) |
|
|
|
}) |
|
|
|
}, 1000, { 'leading': true, 'trailing': false }), |
|
|
|
handleAvatarActSuccess (res, file) { |
|
|
|
this.loading = false |
|
|
|
this.dataForm.headPic = res.data.url |
|
|
|
}, |
|
|
|
handleAvatarBannerSuccess (res, file) { |
|
|
|
this.loading = false |
|
|
|
this.dataForm.bannerUrl = res.data.url |
|
|
|
}, |
|
|
|
beforeAvatarUpload (file) { |
|
|
|
this.loading = true |
|
|
|
}, |
|
|
|
handelError () { |
|
|
|
this.loading = false |
|
|
|
}, |
|
|
|
mapSelectHandle (type) { |
|
|
|
this.mapSelectVisible = true |
|
|
|
this.$nextTick(() => { |
|
|
|
this.$refs.mapSelect.init(type, this.dataForm.clockRadius) |
|
|
|
}) |
|
|
|
} |
|
|
|
import Cookies from 'js-cookie' |
|
|
|
import MapSelect from './map-select' |
|
|
|
import debounce from 'lodash/debounce' |
|
|
|
import 'quill/dist/quill.snow.css' |
|
|
|
import Quill from 'quill' |
|
|
|
export default { |
|
|
|
name: 'ActInfoAdd', |
|
|
|
data () { |
|
|
|
return { |
|
|
|
visible: false, |
|
|
|
dataForm: { |
|
|
|
id: '', |
|
|
|
title: '', |
|
|
|
headPic: '', |
|
|
|
signUpStartTime: '', |
|
|
|
signUpEndTime: '', |
|
|
|
actQuotaFlag: '1', |
|
|
|
actStartTime: '', |
|
|
|
actEndTime: '', |
|
|
|
actAddress: '', |
|
|
|
actLongitude: '', |
|
|
|
actLatitude: '', |
|
|
|
clockRadius: 200, |
|
|
|
actQuota: '', |
|
|
|
contacts: '', |
|
|
|
tel: '', |
|
|
|
requirement: '', |
|
|
|
actContent: '', |
|
|
|
actStatus: '', |
|
|
|
publishTime: '', |
|
|
|
sponsor: '', |
|
|
|
deptId: '', |
|
|
|
punishmentPoints: '', |
|
|
|
reward: '', |
|
|
|
isBanner: '1', |
|
|
|
actUserDefaultState: '1', |
|
|
|
bannerUrl: '', |
|
|
|
cancelReason: '', |
|
|
|
signUpNum: 0, |
|
|
|
sectionCode: '', |
|
|
|
categoryCode: '', |
|
|
|
categoryName: '' |
|
|
|
}, |
|
|
|
options: [], |
|
|
|
issignUpEndTime: { |
|
|
|
disabledDate (time) { |
|
|
|
return time < Date.now() - 8.64e7 // 8.64e7=1000*60*60*24一天 |
|
|
|
} |
|
|
|
}, |
|
|
|
isImgRequired: true, |
|
|
|
mapSelectVisible: false, |
|
|
|
signInIsAble: true, |
|
|
|
isAble: false, |
|
|
|
loading: false, |
|
|
|
// 富文本 |
|
|
|
quillEditor: null, |
|
|
|
quillEditorToolbarOptions: [ |
|
|
|
['bold', 'italic', 'underline', 'strike'], |
|
|
|
['blockquote', 'code-block', 'image'], |
|
|
|
[{ 'header': 1 }, { 'header': 2 }], |
|
|
|
[{ 'list': 'ordered' }, { 'list': 'bullet' }], |
|
|
|
[{ 'script': 'sub' }, { 'script': 'super' }], |
|
|
|
[{ 'indent': '-1' }, { 'indent': '+1' }], |
|
|
|
[{ 'direction': 'rtl' }], |
|
|
|
[{ 'size': ['small', false, 'large', 'huge'] }], |
|
|
|
[{ 'header': [1, 2, 3, 4, 5, 6, false] }], |
|
|
|
[{ 'color': [] }, { 'background': [] }], |
|
|
|
[{ 'font': [] }], |
|
|
|
[{ 'align': [] }], |
|
|
|
['clean'] |
|
|
|
], |
|
|
|
uploadUrl: '', |
|
|
|
pickerBeginDateBefore: { |
|
|
|
disabledDate: (time) => { |
|
|
|
let beginDateVal = this.dataForm.actStartTime |
|
|
|
if (beginDateVal) { |
|
|
|
return time.getTime() > new Date(beginDateVal).getTime() |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
pickerBeginDateAfter: { |
|
|
|
disabledDate: (time) => { |
|
|
|
let EndDateVal = this.dataForm.actEndTime |
|
|
|
if (EndDateVal) { |
|
|
|
return time.getTime() < new Date(EndDateVal).getTime() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
created () { |
|
|
|
this.visible = true |
|
|
|
this.$nextTick(() => { |
|
|
|
// 富文本 |
|
|
|
this.hideUpload = false |
|
|
|
this.uploadUrl = `${window.SITE_CONFIG['apiURL']}/oss/file/upload?token=${Cookies.get('token')}` |
|
|
|
if (this.quillEditor) { |
|
|
|
this.quillEditor.deleteText(0, this.quillEditor.getLength()) |
|
|
|
} else { |
|
|
|
this.quillEditorHandle() |
|
|
|
} |
|
|
|
// 富文本end |
|
|
|
}) |
|
|
|
}, |
|
|
|
mounted () { |
|
|
|
this.getOptions() |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
dataRule () { |
|
|
|
return { |
|
|
|
title: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
headPic: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
signUpStartTime: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
signUpEndTime: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
actStartTime: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
actEndTime: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
actAddress: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
actLongitude: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
actLatitude: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
clockRadius: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
actQuotaFlag: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
actQuota: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
clockNum: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
actShareNum: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
actBrowseNum: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
contacts: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
tel: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
requirement: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
actContent: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
actStatus: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
publishTime: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
sponsor: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
deptId: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
categoryCode: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
punishmentPoints: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
reward: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
revision: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
createdBy: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
createdTime: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
updatedBy: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
updatedTime: [ |
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
], |
|
|
|
bannerUrl: [ |
|
|
|
{ required: this.isImgRequired, message: this.$t('validate.required'), trigger: 'blur' } |
|
|
|
] |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
getOptions () { |
|
|
|
this.$http |
|
|
|
.get(`/property/sectioncategory/list`, { params: { sectionCode: 'community_forum' } }).then(({ data: res }) => { |
|
|
|
if (res.code !== 0) { |
|
|
|
return this.$message.error(res.msg) |
|
|
|
} |
|
|
|
this.options = res.data |
|
|
|
}) |
|
|
|
.catch(() => { }) |
|
|
|
}, |
|
|
|
changeHandler (value) { |
|
|
|
if (value === 1) { |
|
|
|
this.isImgRequired = true |
|
|
|
} else { |
|
|
|
this.isImgRequired = false |
|
|
|
} |
|
|
|
}, |
|
|
|
backToActList () { |
|
|
|
this.$emit('refreshDataList') |
|
|
|
this.$parent.selectComponent = 'ActInfoList' |
|
|
|
this.$router.push({ path: '/activity-actinfo' }) |
|
|
|
}, |
|
|
|
init () { |
|
|
|
this.visible = true |
|
|
|
this.$nextTick(() => { |
|
|
|
this.$refs['dataForm'].resetFields() |
|
|
|
if (this.dataForm.id) { |
|
|
|
this.getInfo() |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
position (position) { |
|
|
|
if (position.type === 1) { |
|
|
|
this.dataForm.actAddress = position.address |
|
|
|
this.dataForm.actLatitude = position.latitude |
|
|
|
this.dataForm.actLongitude = position.longitude |
|
|
|
} |
|
|
|
}, |
|
|
|
// 富文本编辑器 |
|
|
|
quillEditorHandle () { |
|
|
|
this.quillEditor = new Quill('#J_quillEditor', { |
|
|
|
modules: { |
|
|
|
toolbar: this.quillEditorToolbarOptions |
|
|
|
}, |
|
|
|
components: { |
|
|
|
MapSelect |
|
|
|
theme: 'snow' |
|
|
|
}) |
|
|
|
this.quillEditor.container.style.height = `${300}px` |
|
|
|
// // 自定义上传图片功能 (使用element upload组件) |
|
|
|
this.quillEditor.getModule('toolbar').addHandler('image', () => { |
|
|
|
this.$refs.uploadBtn.$el.click() |
|
|
|
}) |
|
|
|
// 监听内容变化,动态赋值 |
|
|
|
this.quillEditor.on('text-change', () => { |
|
|
|
this.dataForm.actContent = this.quillEditor.root.innerHTML |
|
|
|
if ((this.dataForm.actContent).length > 10000) { |
|
|
|
return this.$message.error('您输入的的内容已超过字数') |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 上传图片之前 (富文本) |
|
|
|
uploadBeforeUploadHandle (file) { |
|
|
|
if (file.type !== 'image/jpg' && file.type !== 'image/jpeg' && file.type !== 'image/png' && file.type !== 'image/gif') { |
|
|
|
this.$message.error(this.$t('upload.tip', { 'format': 'jpg、png、gif' })) |
|
|
|
return false |
|
|
|
} |
|
|
|
}, |
|
|
|
// 上传图片成功 (富文本) |
|
|
|
uploadSuccessHandle (res, file, fileList) { |
|
|
|
if (res.code !== 0) { |
|
|
|
return this.$message.error(res.msg) |
|
|
|
} |
|
|
|
this.quillEditor.insertEmbed(this.quillEditor.getSelection().index, 'image', res.data.url) |
|
|
|
}, |
|
|
|
setRegistTime () { |
|
|
|
this.dataForm.newsReleaseStartTime = this.time[0] |
|
|
|
this.dataForm.newsReleaseEndTime = this.time[1] |
|
|
|
}, |
|
|
|
// 上传图片ends |
|
|
|
// 获取信息 |
|
|
|
getInfo () { |
|
|
|
this.$http.get(`/property/activityinfo/${this.dataForm.id}`).then(({ data: res }) => { |
|
|
|
if (res.code !== 0) { |
|
|
|
return this.$message.error(res.msg) |
|
|
|
} |
|
|
|
this.dataForm = { |
|
|
|
...this.dataForm, |
|
|
|
...res.data |
|
|
|
} |
|
|
|
}).catch(() => { }) |
|
|
|
}, |
|
|
|
// 表单提交 |
|
|
|
dataFormSubmitHandle: debounce(function () { |
|
|
|
if (new Date() >= new Date(this.dataForm.signUpEndTime)) { |
|
|
|
return this.$message.error('报名截止时间必须大于当前时间') |
|
|
|
} |
|
|
|
if (this.dataForm.actStartTime >= this.dataForm.actEndTime) { |
|
|
|
return this.$message.error('活动结束时间必须大于活动开始时间') |
|
|
|
} |
|
|
|
if (this.dataForm.actStartTime <= this.dataForm.signUpEndTime) { |
|
|
|
return this.$message.error('活动开始时间必须大于报名截止时间') |
|
|
|
} |
|
|
|
if ((this.dataForm.actContent).length > 10000) { |
|
|
|
return this.$message.error('您输入的的内容已超过字数') |
|
|
|
} |
|
|
|
if (this.dataForm.isActQuota === 0) { |
|
|
|
this.dataForm.actQuota = 0 |
|
|
|
} |
|
|
|
this.$refs['dataForm'].validate((valid) => { |
|
|
|
if (!valid) { |
|
|
|
return false |
|
|
|
} |
|
|
|
var signUpEndTime = new Date(Date.parse(this.dataForm.signUpEndTime)) |
|
|
|
var actStarTime = new Date(Date.parse(this.dataForm.actStartTime)) |
|
|
|
var actEndTime = new Date(Date.parse(this.dataForm.actEndTime)) |
|
|
|
if (signUpEndTime > actStarTime) { |
|
|
|
return this.$message.error('活动开始时间必须大于报名截止时间.') |
|
|
|
} |
|
|
|
if (actEndTime < actStarTime) { |
|
|
|
return this.$message.error('活动结束时间必须大于活动开始时间.') |
|
|
|
} |
|
|
|
this.isAble = true |
|
|
|
this.$http[!this.dataForm.id ? 'post' : 'put']('/property/activityinfo/', this.dataForm).then(({ data: res }) => { |
|
|
|
this.isAble = false |
|
|
|
if (res.code !== 0) { |
|
|
|
return this.$message.error(res.msg) |
|
|
|
} |
|
|
|
this.$message({ |
|
|
|
message: this.$t('prompt.success'), |
|
|
|
type: 'success', |
|
|
|
duration: 500, |
|
|
|
onClose: () => { |
|
|
|
this.visible = false |
|
|
|
this.$emit('refreshDataList') |
|
|
|
} |
|
|
|
}) |
|
|
|
this.$parent.selectComponent = 'ActInfoList' |
|
|
|
this.$router.push({ |
|
|
|
path: '/activity-actinfo' |
|
|
|
}) |
|
|
|
}).catch(() => { }) |
|
|
|
}) |
|
|
|
}, 1000, { 'leading': true, 'trailing': false }), |
|
|
|
handleAvatarActSuccess (res, file) { |
|
|
|
this.loading = false |
|
|
|
this.dataForm.headPic = res.data.url |
|
|
|
}, |
|
|
|
handleAvatarBannerSuccess (res, file) { |
|
|
|
this.loading = false |
|
|
|
this.dataForm.bannerUrl = res.data.url |
|
|
|
}, |
|
|
|
beforeAvatarUpload (file) { |
|
|
|
this.loading = true |
|
|
|
}, |
|
|
|
handelError () { |
|
|
|
this.loading = false |
|
|
|
}, |
|
|
|
mapSelectHandle (type) { |
|
|
|
this.mapSelectVisible = true |
|
|
|
this.$nextTick(() => { |
|
|
|
this.$refs.mapSelect.init(type, this.dataForm.clockRadius) |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
components: { |
|
|
|
MapSelect |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|
<style> |
|
|
|
.avatar-uploader .el-upload { |
|
|
|
|