diff --git a/src/apps/AppMessageNotification/AppMessageNotification.vue b/src/apps/AppMessageNotification/AppMessageNotification.vue index 0f56cae5..70fa6a56 100644 --- a/src/apps/AppMessageNotification/AppMessageNotification.vue +++ b/src/apps/AppMessageNotification/AppMessageNotification.vue @@ -8,7 +8,7 @@
*发送方式
- + {{ item.name }}
@@ -43,15 +43,15 @@

图片

- +
-
+

视频

- +

附件

- +
@@ -81,20 +81,17 @@ export default { data() { return { typeList: [ - {name: '居民群', type: '0'}, + {name: '居民群', type: '2'}, {name: '居民', type: '1'} ], form: { content: '', - contentType: 'text', - sendType: '0', - }, - formData: { - fileListImg: [], - fileListVideo: [], - fileListFile: [], - fileList: [], + messageSource: '2', // 1居民 2居民群 }, + fileList: [], + fileListImg: [], + fileListVideo: [], + fileListFile: [], areaIdList: [], tagIdList: [], fileDataImg: null, @@ -119,9 +116,39 @@ export default { } }, methods: { + changeImg(e) { + this.$nextTick(() => { + this.fileListImg.map((item) => { + if(item.id == e.file.id) { + item.mediaId = e.media.mediaId + item.contentType = 'image' + } + }) + }) + }, + changeVideo(e) { + this.$nextTick(() => { + this.fileListVideo.map((item) => { + if(item.id == e.file.id) { + item.mediaId = e.media.mediaId + item.contentType = 'video' + } + }) + }) + }, + changeFile(e) { + this.$nextTick(() => { + this.fileListFile.map((item) => { + if(item.id == e.file.id) { + item.mediaId = e.media.mediaId + item.contentType = 'file' + } + }) + }) + }, radioGroupChange(e) { - this.form.sendType = e - uni.setStorageSync('sendType', e) + this.form.messageSource = e + uni.setStorageSync('messageSource', e) this.deptUserTagList = [] this.deptUserList = [] }, @@ -171,48 +198,18 @@ export default { return res }).filter(e => !!e) - - this.formData.fileList = [] + this.fileList = [] var contentFile = { content: this.form.content, contentType: 'text' } - // if(this.formData.fileList.length) { - // this.formData.file = this.formData.fileList[0] - // this.formData.accessUrl = this.formData.fileList[0].url - // this.formData.mediaId = this.fileData.media.mediaId - // } - this.formData.fileList.push(contentFile) - if (this.formData.fileListImg.length) { - var info = { - contentType: 'image', - mediaId: this.fileDataImg.media.mediaId, - accessUrl: this.formData.fileListImg[0].url - } - this.formData.fileList.push(info) - } - if (this.formData.fileListVideo.length) { - var info = { - contentType: 'video', - mediaId: this.fileDataVideo.media.mediaId, - accessUrl: this.formData.fileListVideo[0].url - } - this.formData.fileList.push(info) - } - if (this.formData.fileListFile.length) { - var info = { - contentType: 'file', - mediaId: this.fileDataFile.media.mediaId, - accessUrl: this.formData.fileListFile[0].url - } - this.formData.fileList.push(info) - } + this.fileList = [...this.fileListImg, ...this.fileListVideo, ...this.fileListFile] + this.fileList.unshift(contentFile) var params = { ...this.form, - ...this.formData, + fileList: this.fileList, areaId: this.areaIdList.join(','), deptList: deptList, - messageSource: this.form.sendType == '1' ? '1' : '2' } this.$http.post("/app/pushmessage/addOrUpdate", params).then(res => { if (res?.code == 0) { @@ -242,10 +239,6 @@ export default { }, onShow() { this.deptUserTagList = uni.getStorageSync('selectDeptUser') - this.form.sendType = uni.getStorageSync('sendType') - if (!this.form.sendType) { - this.form.sendType = '0' - } } } diff --git a/src/apps/AppMessageNotification/selectTag.vue b/src/apps/AppMessageNotification/selectTag.vue index 2f4b1b1c..6a0ca9bc 100644 --- a/src/apps/AppMessageNotification/selectTag.vue +++ b/src/apps/AppMessageNotification/selectTag.vue @@ -48,7 +48,7 @@ export default { deptList: [], userList: [], showTagList: false, - sendType: '', //0居民 1居民群 + messageSource: '', //1居民 2居民群 tagList: [], deptIndex: 0, noDept: true @@ -85,7 +85,7 @@ export default { this.showTagList=false }, getTagList(id) { - var url = this.sendType == 1 ? `/app/wxcp/wxcorptag/listAllByCorp?dvcpCorpId=${id}&size=1000` : `/app/wxcp/wxgroupchattag/listAllByCorp?dvcpCorpId=${id}&size=1000` + var url = this.messageSource == 1 ? `/app/wxcp/wxcorptag/listAllByCorp?dvcpCorpId=${id}&size=1000` : `/app/wxcp/wxgroupchattag/listAllByCorp?dvcpCorpId=${id}&size=1000` this.$http.post(url).then(res => { if (res?.code == 0) { res.data.records.map((item) => { @@ -123,7 +123,7 @@ export default { }, onLoad() { var list = uni.getStorageSync('selectDeptUser') - this.sendType = uni.getStorageSync('sendType') + this.messageSource = uni.getStorageSync('messageSource') list.map((item) => { item.tagIdList = [] if(item.kind == 'dept') {