diff --git a/src/apps/AppCooperationPropaganda/addPropaganda.vue b/src/apps/AppCooperationPropaganda/addPropaganda.vue index 0b881d5b..f9b41d9b 100644 --- a/src/apps/AppCooperationPropaganda/addPropaganda.vue +++ b/src/apps/AppCooperationPropaganda/addPropaganda.vue @@ -10,7 +10,7 @@
请选择 - 预计送达{{ 1 }}名成员 + 预计送达{{ form.wxGroups.length }}名成员
@@ -28,7 +28,7 @@
添加素材
- +
@@ -146,7 +146,38 @@ export default { choiceTime: '', // 定时发送时间 sendScope: '', // 0:全部居民群、1:按部门选择、2:按网格选择 sendType: '0', // 0:立即发送、1:定时发送 - wxGroups: [], // 送达居民群 + wxGroups: [ + { + corpId: "ww596787bb70f08288", + errorCode: null, + errorMsg: null, + groupCount: 1, + groupIds: "wrytYEDgAAA5MGVJ3Ttb6ycbmxJ2Zv-Q", + groupNames: "111", + groupOwnerId: "d41d8cd98f00b204e9800998ecf8427e", + groupOwnerName: "张硕", + id: null, + msgId: null, + sendStatus: null, + sendTime: null, + taskId: null, + }, + { + corpId: "ww596787bb70f08288", + errorCode: null, + errorMsg: null, + groupCount: 4, + groupIds: "wrytYEDgAA-Llt9H1jr40WT1_RfOstWQ,wrytYEDgAADava7QSJGicwZg09nG_GXg,wrytYEDgAAKG6qd39fHWFkrTiT9vsSQQ,wrytYEDgAAPxVpqyzf4kwzwvtdE0nqbQ", + groupNames: "慧政务需求沟通,临汾市政法委企微项目沟通,淄博企微项目沟通群,未命名群聊", + groupOwnerId: "XieJin", + groupOwnerName: "谢晋", + id: null, + msgId: null, + sendStatus: null, + sendTime: null, + taskId: null, + } + ], // 送达居民群 }, enableExamine: false, isTimedTask: false, @@ -189,6 +220,7 @@ export default { ] } ], + midiaIds: [], } }, methods: { @@ -247,10 +279,10 @@ export default { } if (res.tempFiles) { res.tempFiles?.map((item) => { - this.uploadFile(item) + this.uploadFile(item,type) }) } else if (res?.tempFile) { - this.uploadFile(res.tempFile) + this.uploadFile(res.tempFile,type) } }, } @@ -266,16 +298,27 @@ export default { } }, - uploadFile(img) { + uploadFile(img,type) { uni.showLoading({title: '上传中'}) let formData = new FormData() formData.append('file', img) - this.$http.post('/admin/file/add2', formData).then((res) => { + formData.append('type', type) + this.$http.post('/app/wxcp/upload/uploadFile', formData,{ + withCredentials: false + }).then((res) => { uni.hideLoading() if (res?.data) { this.$u.toast('上传成功!') this.showUpload = false - this.files.push(res.data) + // this.files.push(res.data) + this.files.push({ + ...res.data.file, + media: res.data.media, + msgType: type, + sysFileId: res.data.file.id, + imgPicUrl: res.data.file.url, + mediaId: res.data.media.mediaId + }) } }).catch(res => { this.$u.toast(res) @@ -293,7 +336,7 @@ export default { confirm() { if(this.flag) return - + // 文本 const firstContent = [ { content: this.content, @@ -301,22 +344,34 @@ export default { }, ] this.form.contents.push(...firstContent) - - const picUrl = this.files.map(e=> { - if(['.jpg','.jpeg','.png'].indexOf(this.getExtension(e.name)) !== -1) { - console.log({ - imgPicUrl: e.url, - msgType: '1' - }) - return { - imgPicUrl: e.url, - msgType: '1' - } + // 图片 + const picUrl = this.files.filter(i=> ['.jpg','.jpeg','.png'].indexOf(this.getExtension(i.name)) !== -1).map(e=>{ + return { + imgPicUrl: e.url, + msgType: '1', + mediaId: e.mediaId } }) - this.form.contents.push(...picUrl) - + // 视频 + const video = this.files.filter(i=> ['.mp4'].indexOf(this.getExtension(i.name)) !== -1).map(e=>{ + return { + imgPicUrl: e.url, + msgType: '2', + mediaId: e.mediaId + } + }) + this.form.contents.push(...video) + // 文件 + const files = this.files.filter(i=> ['.mp4','.jpg','.jpeg','.png'].indexOf(this.getExtension(i.name)) == -1).map(e=>{ + return { + imgPicUrl: e.url, + msgType: '3', + mediaId: e.mediaId + } + }) + this.form.contents.push(...files) + if(!this.form.taskTitle) { return this.$u.toast('请输入任务名称') } @@ -377,9 +432,10 @@ export default { onLoad(o) { this.type = o.type; document.title = this.type=='ResidentsGroup'? "群发居民群": this.type=='Residents'? "群发居民": "群发朋友圈" - uni.$on('checkedScope', res => { - this.form.sendScope = res.sendScope - }) + }, + onShow() { + this.form.wxGroups = uni.getStorageSync('wxGroupsUser') || [] + this.form.sendScope = uni.getStorageSync('sendScope') } } diff --git a/src/apps/AppCooperationPropaganda/scopedSelect.vue b/src/apps/AppCooperationPropaganda/scopedSelect.vue index 104213e7..50b07f57 100644 --- a/src/apps/AppCooperationPropaganda/scopedSelect.vue +++ b/src/apps/AppCooperationPropaganda/scopedSelect.vue @@ -108,26 +108,19 @@ export default { this.endTime = e.endDate }, submit() { - uni.setStorageSync('girdList',this.selectedUser) uni.setStorageSync('deptList',this.deptListArr) - uni.navigateBack({ - success: () => { - uni.$emit("girdList", this.selectedUser) - uni.$emit("deptList", this.deptListArr) - } - }) + uni.navigateBack() } }, onLoad(o) { this.type = o.type; this.sendType = o.sendType; document.title = this.type == 1? '按部门选择':'按网格选择' - uni.$on("pagePicker:custom", res => { - this.selectedUser = res - }) - this.selectedUser = uni.getStorageSync('girdList') - this.deptListArr = uni.getStorageSync('deptList') }, + onShow() { + this.selectedUser = uni.getStorageSync('girdSelect') + this.deptListArr = uni.getStorageSync('deptList') + } } diff --git a/src/apps/AppCooperationPropaganda/selectGridMember.vue b/src/apps/AppCooperationPropaganda/selectGridMember.vue index f3f181ff..75cd01b5 100644 --- a/src/apps/AppCooperationPropaganda/selectGridMember.vue +++ b/src/apps/AppCooperationPropaganda/selectGridMember.vue @@ -29,8 +29,8 @@