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'], sizeType: ['compressed'],
sourceType: ['album'], sourceType: ['album'],
success: (res) => { success: (res) => {
console.log(res); // console.log(res);
let count = this.files?.length + (res.tempFiles?.length || res.tempFile ? 1 : 0) let count = this.files?.length + (res.tempFiles?.length || res.tempFile ? 1 : 0)
if (count > 9) { if (count > 9) {
return this.$u.toast(`不能超过9个`) return this.$u.toast(`不能超过9个`)
@@ -535,6 +535,7 @@ export default {
}, },
] ]
this.form.contents.push(...firstContent) 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 { return {
@@ -739,9 +740,15 @@ export default {
}) })
}) })
uni.$on("fodder",()=> { 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> </script>

View File

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