消息发送

This commit is contained in:
liuye
2022-06-24 21:47:52 +08:00
parent 8e807e785f
commit ac3f5d2eff
5 changed files with 55 additions and 55 deletions

View File

@@ -137,25 +137,32 @@ export default {
}
},
confirm() {
// if(!this.areaIdList.length) {
// return this.$u.toast('请选择用户')
// }
this.$loading()
if(this.form.sendType == 1 && !this.form.sendTime) {
return this.$u.toast('请选择群发时间')
if(!this.deptUserTagList.length) {
return this.$u.toast('请选择部门')
}
if(!this.form.content) {
return this.$u.toast('请输入文本内容')
}
if(this.form.contentType == 'image' && !this.formData.fileList.length) {
return this.$u.toast('请上传图片')
}
if(this.form.contentType == 'video' && !this.formData.fileList.length) {
return this.$u.toast('请上传视频')
}
if(this.form.contentType == 'file' && !this.formData.fileList.length) {
return this.$u.toast('请上传文件')
}
let result = {}, tags = {}
this.deptUserTagList.map(e => {
let {kind, id, tagIdList} = e
result[e.corpId] = [result[e.corpId], {kind, id}].flat()
if (tagIdList) {
tags[e.corpId] = [tags[e.corpId], {tagIdList}].flat()
}
})
console.log(result, tags)
var deptList = Object.keys(result).map(corpId => ({
corpId,
objList: result[corpId],
tagId: tags[corpId]?.tagIdList
}))
console.log(deptList)
this.formData.fileList = []
var contentFile = {
content: this.form.content,
@@ -195,20 +202,15 @@ export default {
...this.form,
...this.formData,
areaId: this.areaIdList.join(','),
tag: this.tagIdList.join(','),
deptList: deptList,
messageSource: this.sendType == 1 ? '1' : '2'
}
this.$http.post("/app/pushmessage/addOrUpdate", params).then(res => {
if (res?.code == 0) {
this.$u.toast('发送成功')
this.form = {
content: '',
contentType: 'text',
sendType: '0',
sendTime: ''
}
this.areaIdList = []
this.tagIdList = []
this.formDataInit()
setTimeout(() => {
uni.navigateBack()
}, 500)
}else {
this.$u.toast(res.msg)
}
@@ -216,14 +218,6 @@ export default {
this.$u.toast(err)
})
},
formDataInit() {
for(let key in this.formData) {
this.formData[key] = ''
}
this.formData.fileListImg = []
this.formData.fileListVideo = []
this.formData.fileListFile = []
},
back() {
uni.navigateBack()
}