This commit is contained in:
shijingjing
2023-03-08 14:23:51 +08:00
parent b29cb84966
commit c53eb44c99
2 changed files with 35 additions and 15 deletions

View File

@@ -415,7 +415,7 @@ export default {
sizeType: ['compressed'],
sourceType: ['album'],
success: (res) => {
console.log(res);
// console.log(res);
let count = this.files?.length + (res.tempFiles?.length || res.tempFile ? 1 : 0)
if (count > 9) {
return this.$u.toast(`不能超过9个`)
@@ -535,6 +535,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=>{
return {
@@ -739,9 +740,15 @@ export default {
})
})
uni.$on("fodder",()=> {
this.checkedList = uni.getStorageSync('checkedList')
this.checkedList = uni.getStorageSync('checkedList').filter(i => i.type != 0)
})
this.checkedList = uni.getStorageSync('checkedList')
this.checkedList = uni.getStorageSync('checkedList')?.filter(i=> i.type != 0) || []
let arr = uni.getStorageSync('checkedList')?.filter(e => e.type == 0) || []
if (arr.length) {
let arrStr = arr.map(i => i.content)
this.content = this.content.concat(',', arrStr.toString())
uni.setStorageSync('checkedList', this.checkedList)
}
}
}
</script>

View File

@@ -1,8 +1,8 @@
<template>
<div class="fodderList">
<AiTopFixed class="search-box">
<u-search placeholder="素材名称" v-model="title" :clearabled="false" @search="getList()" :animation="false"></u-search>
</AiTopFixed>
<div class="search-box">
<u-search placeholder="素材名称" v-model="title" :clearabled="false" @search="getList()" :show-action="false"></u-search>
</div>
<div class="card" v-for="(item,index) in list" :key="index">
<div class="left">
<!-- 话术 -->
@@ -85,7 +85,8 @@ export default {
type: '',
list: [],
checkedList: [],
typeArr: ['话术','图片','小程序','文件','视频','网页']
typeArr: ['话术','图片','小程序','文件','视频','网页'],
arr: []
}
},
methods: {
@@ -96,13 +97,15 @@ export default {
current: this.current,
title: this.title,
type: this.type,
size: 10,
}
}).then(res=> {
if(res?.data) {
this.list = res.data.records.map(e=> {
this.arr = this.current==1? res.data.records : [...this.arr, ...res.data.records]
this.list = this.arr.map(e => {
return {
...e,
isChecked: this.checkedList.find(i=> i.id==e.id),
isChecked: this.checkedList?.find(i => i.id == e.id),
}
})
}
@@ -140,7 +143,7 @@ export default {
this.getList()
},
onReachBottom() {
this.current ++
this.current++,
this.getList()
}
}
@@ -148,14 +151,24 @@ export default {
<style lang="scss" scoped>
.fodderList {
padding-bottom: 120px;
padding: 120px 0;
box-sizing: border-box;
height: 100%;
.search-box {
width: 100%;
height: 104px;
background: #FFF;
padding: 20px 32px;
box-sizing: border-box;
position: fixed;
top: 0;
left: 0;
}
.card {
background: #fff;
padding: 24px 32px;
box-sizing: border-box;
margin-top: 24px;
padding: 24px 32px;
box-sizing: border-box;
display: flex;
align-items: center;
width: 100%;