群发居民群

This commit is contained in:
shijingjing
2022-09-08 16:05:19 +08:00
parent cd3d85fe12
commit 8960553ceb
5 changed files with 109 additions and 83 deletions

View File

@@ -10,7 +10,7 @@
<div @click="toSleectScoped">
<span>
<span class="color_gray" v-if="!form.sendScope">请选择</span>
<span v-if="form.sendScope">预计送达{{ 1 }}名成员</span>
<span v-if="form.sendScope">预计送达{{ form.wxGroups.length }}名成员</span>
<u-icon name="arrow-right" color="#CCD0D3"></u-icon>
</span>
</div>
@@ -28,7 +28,7 @@
<div class="fodder_alls">
<div class="fodder_add" @click="showUpload = true"><u-icon name="plus" color="#CCD0D3" size="32"></u-icon></div>
<div class="fodder_title">添加素材</div>
<!-- <AiUploader :def.sync="files" placeholder="添加素材" type="file" :limit="9" multiple action="/admin/file/add2"></AiUploader> -->
<!-- <AiUploader :def.sync="files" placeholder="添加素材" type="file" :limit="9" multiple action="/app/wxcp/upload/uploadFile" :mediaId.sync="midiaIds"></AiUploader> -->
</div>
<div class="fodder_file" v-for="(item, index) in files" :key="index">
<div class="item">
@@ -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')
}
}
</script>