This commit is contained in:
shijingjing
2023-03-08 10:09:12 +08:00
parent dfac18eee4
commit 6bee9d53e3
4 changed files with 80 additions and 28 deletions

View File

@@ -35,7 +35,8 @@
<div class="fodder_add" @click="showUpload = true"><u-icon name="plus" color="#CCD0D3" size="32"></u-icon></div>
<div class="fodder_title">添加素材</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="item.id">
<div class="item">
<div class="images">
<img src="https://cdn.cunwuyun.cn/dvcp/h5/file.png" alt="">
@@ -44,7 +45,20 @@
<div class="name">{{ item.name }}</div>
<div class="size">{{ item.fileSizeStr }}</div>
</div>
<div class="remove" @click="remove" style="color: #f72c27">删除</div>
<div class="remove" @click="remove(index)" style="color: #f72c27">删除</div>
</div>
</div>
<!-- 素材库 -->
<div class="fodder_file" v-for="(item, index) in checkedList" :key="item.id">
<div class="item">
<div class="images">
<img src="https://cdn.cunwuyun.cn/dvcp/h5/file.png" alt="">
</div>
<div class="info">
<div class="name">{{ item.title }}</div>
<div class="size">{{ item.fileSizeStr }}</div>
</div>
<div class="remove" @click="removeSucai(index)" style="color: #f72c27">删除</div>
</div>
</div>
</div>
@@ -96,7 +110,7 @@
<img class="text_left" src="https://cdn.cunwuyun.cn/dvcp/announce/avatar.png" />
<div class="text_right">{{ content }}</div>
</div>
<!-- 本地素材 -->
<div class="file_content" v-for="item in files" :key="item.id">
<img class="text_left" src="https://cdn.cunwuyun.cn/dvcp/announce/avatar.png" />
<img class="only_pic" :src="item.url" alt="" v-if="['.jpg', '.jpeg','.png'].indexOf(getExtension(item.name)) !== -1">
@@ -112,9 +126,22 @@
</div>
</div>
</div>
<!-- 素材库 -->
<div class="file_content" v-for="item in checkedList" :key="item.id">
<img class="text_left" src="https://cdn.cunwuyun.cn/dvcp/announce/avatar.png" />
<img class="only_pic" :src="item.imgPicUrl" alt="" v-if="item.type==1">
<video controls class="only_video" :src="item.fileUrl" v-if="item.type == 4"></video>
<div class="text_right file_right" v-if="['0','2','3','5'].includes(item.type)">
<div class="cont_left">
<h4>{{ item.title }}</h4>
<p v-if="['1', '4', '3'].includes(item.type)">{{ item.fileSizeStr }}</p>
<p v-if="item.type==5">{{ item.linkUrl }}</p>
</div>
<div class="cont_right">
<img :src="sucaiIcon[item.type]" alt="">
</div>
</div>
</div>
</div>
<div class="footer">
<div class="exit" @click="showPopup = false">退出预览</div>
@@ -327,6 +354,15 @@ export default {
circleTagsRemove: [], // 朋友圈剔除
startTime: '',
endTime: '',
checkedList: [],
sucaiIcon: [
'https://cdn.cunwuyun.cn/dvcp/announce/ic-script.png',
'https://cdn.cunwuyun.cn/dvcp/announce/ic-picture.png',
'https://cdn.cunwuyun.cn/dvcp/announce/ic-routine.png',
'https://cdn.cunwuyun.cn/dvcp/announce/ic-document.png',
'https://cdn.cunwuyun.cn/dvcp/announce/ic-video.png',
'https://cdn.cunwuyun.cn/dvcp/announce/ic-web.png',
]
}
},
methods: {
@@ -371,12 +407,8 @@ export default {
return name.substring(name.lastIndexOf('.'))
},
getExamines(e) {
console.log(e);
},
uploadBtn(type) {
let count = 9 - (this.files?.length || 0)
let count = 9 - (this.files?.length || 0) - (this.checkedList?.length || 0)
if(count > 0){
let params = {
count,
@@ -423,6 +455,7 @@ export default {
uni.chooseFile(params)
} else {
uni.navigateTo({url: `./fodderList?type=${this.type}&msgType=${type}`})
this.showUpload = false
}
} else {
this.$u.toast(`不能超过9个`)
@@ -464,6 +497,12 @@ export default {
remove(index) {
this.files.splice(index, 1)
},
removeSucai(index) {
this.checkedList.splice(index, 1)
uni.setStorageSync("checkedList", this.checkedList)
},
choiceTime(e) {
@@ -497,7 +536,7 @@ export default {
]
this.form.contents.push(...firstContent)
// 图片
const picUrl = this.files.filter(i=> ['.jpg','.jpeg','.png'].indexOf(this.getExtension(i.name)) == 1).map(e=>{
const picUrl = this.files.filter(i=> ['.jpg','.jpeg','.png'].indexOf(this.getExtension(i.name)) !== -1).map(e=>{
return {
imgPicUrl: e.url,
msgType: '1',
@@ -506,7 +545,7 @@ export default {
})
this.form.contents.push(...picUrl)
// 视频
const video = this.files.filter(i=> ['.mp4'].indexOf(this.getExtension(i.name)) == 1).map(e=>{
const video = this.files.filter(i=> ['.mp4'].indexOf(this.getExtension(i.name)) !== -1).map(e=>{
return {
imgPicUrl: e.url,
msgType: '2',
@@ -524,6 +563,10 @@ export default {
})
this.form.contents.push(...files)
if(this.checkedList.length) {
this.form.contents.push(...this.checkedList)
}
if(this.type=='Residents' || this.type=='CircleOfFriends') {
this.forms.contents = this.form.contents
this.forms.taskTitle = this.form.taskTitle
@@ -609,6 +652,7 @@ export default {
uni.removeStorageSync('startTime')
uni.removeStorageSync('endTime')
uni.removeStorageSync('selectDeptUser')
uni.removeStorageSync('checkedList')
},
},
@@ -694,6 +738,10 @@ export default {
}
})
})
uni.$on("fodder",()=> {
this.checkedList = uni.getStorageSync('checkedList')
})
this.checkedList = uni.getStorageSync('checkedList')
}
}
</script>