This commit is contained in:
liuye
2022-06-27 09:08:37 +08:00
parent 0976619da6
commit 149fc5a5d6
2 changed files with 50 additions and 57 deletions

View File

@@ -8,7 +8,7 @@
<div class="select-user"> <div class="select-user">
<div class="label color-666"><span class="tips">*</span>发送方式</div> <div class="label color-666"><span class="tips">*</span>发送方式</div>
<div class="right"> <div class="right">
<u-radio-group v-model="form.sendType" @change="radioGroupChange"> <u-radio-group v-model="form.messageSource" @change="radioGroupChange">
<u-radio v-for="(item, index) in typeList" :key="index" :label="item.name" :name="item.type">{{ item.name }}</u-radio> <u-radio v-for="(item, index) in typeList" :key="index" :label="item.name" :name="item.type">{{ item.name }}</u-radio>
</u-radio-group> </u-radio-group>
</div> </div>
@@ -43,15 +43,15 @@
<div class="type-content"> <div class="type-content">
<div class="flex"> <div class="flex">
<p class="label" style="width:40px;">图片</p> <p class="label" style="width:40px;">图片</p>
<AiUploader type="image" :def.sync="formData.fileListImg" :limit="1" @data="(v) => fileDataImg = v"></AiUploader> <AiUploader type="image" :limit="9" multiple :def.sync="fileListImg" @data="changeImg"></AiUploader>
</div> </div>
<div class="flex"> <div class="flex" >
<p class="label" style="width:40px;">视频</p> <p class="label" style="width:40px;">视频</p>
<AiUploader type="video" :limit="1" placeholder="上传视频" :def.sync="formData.fileListVideo" @data="(v) => fileDataVideo = v"></AiUploader> <AiUploader type="video" :limit="9" multiple placeholder="上传视频" :def.sync="fileListVideo" @data="changeVideo"></AiUploader>
</div> </div>
<div class="flex"> <div class="flex">
<p class="label" style="width:40px;">附件</p> <p class="label" style="width:40px;">附件</p>
<AiUploader type="file" :limit="1" placeholder="上传附件" :def.sync="formData.fileListFile" @data="(v) => fileDataFile = v"></AiUploader> <AiUploader type="file" :limit="9" multiple placeholder="上传附件" :def.sync="fileListFile" @data="changeFile"></AiUploader>
</div> </div>
</div> </div>
</div> </div>
@@ -81,20 +81,17 @@ export default {
data() { data() {
return { return {
typeList: [ typeList: [
{name: '居民群', type: '0'}, {name: '居民群', type: '2'},
{name: '居民', type: '1'} {name: '居民', type: '1'}
], ],
form: { form: {
content: '', content: '',
contentType: 'text', messageSource: '2', // 1居民 2居民群
sendType: '0',
},
formData: {
fileListImg: [],
fileListVideo: [],
fileListFile: [],
fileList: [],
}, },
fileList: [],
fileListImg: [],
fileListVideo: [],
fileListFile: [],
areaIdList: [], areaIdList: [],
tagIdList: [], tagIdList: [],
fileDataImg: null, fileDataImg: null,
@@ -119,9 +116,39 @@ export default {
} }
}, },
methods: { 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) { radioGroupChange(e) {
this.form.sendType = e this.form.messageSource = e
uni.setStorageSync('sendType', e) uni.setStorageSync('messageSource', e)
this.deptUserTagList = [] this.deptUserTagList = []
this.deptUserList = [] this.deptUserList = []
}, },
@@ -171,48 +198,18 @@ export default {
return res return res
}).filter(e => !!e) }).filter(e => !!e)
this.fileList = []
this.formData.fileList = []
var contentFile = { var contentFile = {
content: this.form.content, content: this.form.content,
contentType: 'text' contentType: 'text'
} }
// if(this.formData.fileList.length) { this.fileList = [...this.fileListImg, ...this.fileListVideo, ...this.fileListFile]
// this.formData.file = this.formData.fileList[0] this.fileList.unshift(contentFile)
// 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)
}
var params = { var params = {
...this.form, ...this.form,
...this.formData, fileList: this.fileList,
areaId: this.areaIdList.join(','), areaId: this.areaIdList.join(','),
deptList: deptList, deptList: deptList,
messageSource: this.form.sendType == '1' ? '1' : '2'
} }
this.$http.post("/app/pushmessage/addOrUpdate", params).then(res => { this.$http.post("/app/pushmessage/addOrUpdate", params).then(res => {
if (res?.code == 0) { if (res?.code == 0) {
@@ -242,10 +239,6 @@ export default {
}, },
onShow() { onShow() {
this.deptUserTagList = uni.getStorageSync('selectDeptUser') this.deptUserTagList = uni.getStorageSync('selectDeptUser')
this.form.sendType = uni.getStorageSync('sendType')
if (!this.form.sendType) {
this.form.sendType = '0'
}
} }
} }
</script> </script>

View File

@@ -48,7 +48,7 @@ export default {
deptList: [], deptList: [],
userList: [], userList: [],
showTagList: false, showTagList: false,
sendType: '', //0居民 1居民群 messageSource: '', //1居民 2居民群
tagList: [], tagList: [],
deptIndex: 0, deptIndex: 0,
noDept: true noDept: true
@@ -85,7 +85,7 @@ export default {
this.showTagList=false this.showTagList=false
}, },
getTagList(id) { 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 => { this.$http.post(url).then(res => {
if (res?.code == 0) { if (res?.code == 0) {
res.data.records.map((item) => { res.data.records.map((item) => {
@@ -123,7 +123,7 @@ export default {
}, },
onLoad() { onLoad() {
var list = uni.getStorageSync('selectDeptUser') var list = uni.getStorageSync('selectDeptUser')
this.sendType = uni.getStorageSync('sendType') this.messageSource = uni.getStorageSync('messageSource')
list.map((item) => { list.map((item) => {
item.tagIdList = [] item.tagIdList = []
if(item.kind == 'dept') { if(item.kind == 'dept') {