群发居民群

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>

View File

@@ -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')
}
}
</script>

View File

@@ -29,8 +29,8 @@
<script>
export default {
// 选择网格
name: "selectGridMember",
appName: "选择人员(网格成员)",
data() {
return {
selected: {},
@@ -103,11 +103,7 @@ export default {
if (!this.selected.length) {
return this.$u.toast('请选择网格员')
} else {
uni.navigateBack({
success: () => {
uni.$emit("pagePicker:custom", this.selected)
}
})
uni.navigateBack()
}
},
}

View File

@@ -22,8 +22,8 @@
import { mapState } from 'vuex'
export default {
// 选择创建人
name: "selectUser",
appName: "选择创建人",
data() {
return {
selected: {},
@@ -69,7 +69,6 @@ export default {
if(!this.selected.userId) {
return this.$u.toast('请选择创建人')
}
uni.$emit("pagePicker:custom", [this.selected])
uni.setStorageSync('userSelect', this.selected)
uni.navigateBack()
},

View File

@@ -15,8 +15,6 @@
</div>
</div>
<AiConsole />
<div class="btn">
<div class="submitBtn" @click="submit">确定</div>
</div>
@@ -57,59 +55,43 @@ export default {
submit() {
this.getWxGroups()
uni.setStorageSync('sendScope', this.sendScope)
uni.navigateBack({
// success: () => {
// uni.$emit("checkedScope",{ sendScope: this.sendScope });
// }
})
setTimeout(() => {
uni.navigateBack({
success: () => {
uni.$emit('predictUser', this.wxGroups)
}
})
}, 4000)
},
getWxGroups() {
this.$http.post(`/app/appmasssendingtask/queryWxGroups?sendScope=${this.sendScope}`,
null,
{
data: {
filterCriteria: this.girdListIds.join(',') || this.deptListIds.join(',')
},
headers: {'Content-Type': 'application'},
transformRequest: [function(data) {
return data.filterCriteria
}]
filterCriteria: this.girdListIds.join(',') || this.deptListIds.join(',')
}).then(res => {
if (res.code === 0) {
this.wxGroups = res.data
uni.setStorageSync('wxGroupsUser', this.wxGroups)
console.log(this.wxGroups,res.data);
}
})
// {
// filterCriteria: ''
// }).then(res => {
// if (res.code === 0) {
// this.wxGroups = res.data
// }
// })
},
},
onLoad(o) {
this.sendType = o.type;
document.title = "选择发送范围"
this.sendScope = uni.getStorageSync('sendScope') || ''
this.checkList.forEach(i=> {
return {
name: i.name,
value: i.value,
// this.checkList.forEach(i=> {
// return {
// name: i.name,
// value: i.value,
// checked: this.sendScope.find(v=>(i.value==v))
}
})
// }
// })
},
onShow() {
uni.$on("girdList",res => {
this.girdListIds = res.map(e=>e.id)
})
uni.$on("deptList",res => {
this.deptListIds = res.map(e=>e.id)
})
this.sendScope = uni.getStorageSync('sendScope') || ''
this.girdListIds = uni.getStorageSync('girdSelect').map(e=>e.id) || []
this.deptListIds = uni.getStorageSync('deptList').map(v=>v.id) || []
}
}
</script>