群发居民群

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"> <div @click="toSleectScoped">
<span> <span>
<span class="color_gray" v-if="!form.sendScope">请选择</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> <u-icon name="arrow-right" color="#CCD0D3"></u-icon>
</span> </span>
</div> </div>
@@ -28,7 +28,7 @@
<div class="fodder_alls"> <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_add" @click="showUpload = true"><u-icon name="plus" color="#CCD0D3" size="32"></u-icon></div>
<div class="fodder_title">添加素材</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>
<div class="fodder_file" v-for="(item, index) in files" :key="index"> <div class="fodder_file" v-for="(item, index) in files" :key="index">
<div class="item"> <div class="item">
@@ -146,7 +146,38 @@ export default {
choiceTime: '', // 定时发送时间 choiceTime: '', // 定时发送时间
sendScope: '', // 0全部居民群、1按部门选择、2按网格选择 sendScope: '', // 0全部居民群、1按部门选择、2按网格选择
sendType: '0', // 0立即发送、1定时发送 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, enableExamine: false,
isTimedTask: false, isTimedTask: false,
@@ -189,6 +220,7 @@ export default {
] ]
} }
], ],
midiaIds: [],
} }
}, },
methods: { methods: {
@@ -247,10 +279,10 @@ export default {
} }
if (res.tempFiles) { if (res.tempFiles) {
res.tempFiles?.map((item) => { res.tempFiles?.map((item) => {
this.uploadFile(item) this.uploadFile(item,type)
}) })
} else if (res?.tempFile) { } 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: '上传中'}) uni.showLoading({title: '上传中'})
let formData = new FormData() let formData = new FormData()
formData.append('file', img) 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() uni.hideLoading()
if (res?.data) { if (res?.data) {
this.$u.toast('上传成功!') this.$u.toast('上传成功!')
this.showUpload = false 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 => { }).catch(res => {
this.$u.toast(res) this.$u.toast(res)
@@ -293,7 +336,7 @@ export default {
confirm() { confirm() {
if(this.flag) return if(this.flag) return
// 文本
const firstContent = [ const firstContent = [
{ {
content: this.content, content: this.content,
@@ -301,22 +344,34 @@ export default {
}, },
] ]
this.form.contents.push(...firstContent) this.form.contents.push(...firstContent)
// 图片
const picUrl = this.files.map(e=> { const picUrl = this.files.filter(i=> ['.jpg','.jpeg','.png'].indexOf(this.getExtension(i.name)) !== -1).map(e=>{
if(['.jpg','.jpeg','.png'].indexOf(this.getExtension(e.name)) !== -1) { return {
console.log({ imgPicUrl: e.url,
imgPicUrl: e.url, msgType: '1',
msgType: '1' mediaId: e.mediaId
})
return {
imgPicUrl: e.url,
msgType: '1'
}
} }
}) })
this.form.contents.push(...picUrl) 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) { if(!this.form.taskTitle) {
return this.$u.toast('请输入任务名称') return this.$u.toast('请输入任务名称')
} }
@@ -377,9 +432,10 @@ export default {
onLoad(o) { onLoad(o) {
this.type = o.type; this.type = o.type;
document.title = this.type=='ResidentsGroup'? "群发居民群": this.type=='Residents'? "群发居民": "群发朋友圈" 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> </script>

View File

@@ -108,26 +108,19 @@ export default {
this.endTime = e.endDate this.endTime = e.endDate
}, },
submit() { submit() {
uni.setStorageSync('girdList',this.selectedUser)
uni.setStorageSync('deptList',this.deptListArr) uni.setStorageSync('deptList',this.deptListArr)
uni.navigateBack({ uni.navigateBack()
success: () => {
uni.$emit("girdList", this.selectedUser)
uni.$emit("deptList", this.deptListArr)
}
})
} }
}, },
onLoad(o) { onLoad(o) {
this.type = o.type; this.type = o.type;
this.sendType = o.sendType; this.sendType = o.sendType;
document.title = this.type == 1? '按部门选择':'按网格选择' 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> </script>

View File

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

View File

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

View File

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