|
|
@@ -395,7 +395,7 @@
|
|
|
</van-popup>
|
|
|
<div class="page_top">
|
|
|
<div class="client_top_box">
|
|
|
- <van-search class="search_input" placeholder="搜索客户昵称/客户群昵称" v-model="keyword" :clearable="false" left-icon=""
|
|
|
+ <van-search class="search_input" placeholder="搜索素材名称" v-model="keyword" :clearable="false" left-icon=""
|
|
|
@search="handleSearch">
|
|
|
<!-- 自定义右侧图标 -->
|
|
|
<template v-slot:right-icon>
|
|
|
@@ -650,58 +650,61 @@
|
|
|
handleFolderClick(item) {
|
|
|
this.pathList.push(item)
|
|
|
this.treeData = []
|
|
|
- this.handleSearch(item)
|
|
|
+ this.getMaterData(item)
|
|
|
},
|
|
|
- handleSearch(item) {
|
|
|
- if (this.keyword === '') {
|
|
|
- this.getTreeData()
|
|
|
- } else {
|
|
|
- this.itemList = []
|
|
|
- let url = ''
|
|
|
- if (this.contentType === 0) {
|
|
|
- url = '/scrm/v1/wxcp-chat-tool/p/pageArticle'
|
|
|
- } else if (this.contentType === 2) {
|
|
|
- url = '/scrm/v1/wxcp-chat-tool/p/pageForm'
|
|
|
- } else if (this.contentType === 3) {
|
|
|
- url = '/scrm/v1/wxcp-chat-tool/p/pageFile'
|
|
|
- } else if (this.contentType === 15) {
|
|
|
- url = '/scrm/v1/wxcp-chat-tool/p/pageVideo'
|
|
|
- } else if (this.contentType === 17) {
|
|
|
- url = '/scrm/v1/wxcp-chat-tool/p/pageImg'
|
|
|
- } else if (this.contentType === 4) {
|
|
|
- url = '/scrm/v1/wxcp-chat-tool/p/pageUrl'
|
|
|
+ getMaterData (item) {
|
|
|
+ this.itemList = []
|
|
|
+ let url = ''
|
|
|
+ if (this.contentType === 0) {
|
|
|
+ url = '/scrm/v1/wxcp-chat-tool/p/pageArticle'
|
|
|
+ } else if (this.contentType === 2) {
|
|
|
+ url = '/scrm/v1/wxcp-chat-tool/p/pageForm'
|
|
|
+ } else if (this.contentType === 3) {
|
|
|
+ url = '/scrm/v1/wxcp-chat-tool/p/pageFile'
|
|
|
+ } else if (this.contentType === 15) {
|
|
|
+ url = '/scrm/v1/wxcp-chat-tool/p/pageVideo'
|
|
|
+ } else if (this.contentType === 17) {
|
|
|
+ url = '/scrm/v1/wxcp-chat-tool/p/pageImg'
|
|
|
+ } else if (this.contentType === 4) {
|
|
|
+ url = '/scrm/v1/wxcp-chat-tool/p/pageUrl'
|
|
|
+ }
|
|
|
+ fetch(this.httpUrl + url, {
|
|
|
+ method: 'post',
|
|
|
+ body: JSON.stringify({
|
|
|
+ groupId: item ? item.id : null,
|
|
|
+ keyword: this.keyword,
|
|
|
+ page: 1,
|
|
|
+ pageCount: 1000,
|
|
|
+ }),
|
|
|
+ headers: {
|
|
|
+ 'Content-Type': 'application/json',
|
|
|
+ 'tenancyId': this.tenancyId,
|
|
|
}
|
|
|
- fetch(this.httpUrl + url, {
|
|
|
- method: 'post',
|
|
|
- body: JSON.stringify({
|
|
|
- groupId: item ? item.id : null,
|
|
|
- keyword: this.keyword,
|
|
|
- page: 1,
|
|
|
- pageCount: 1000,
|
|
|
- }),
|
|
|
- headers: {
|
|
|
- 'Content-Type': 'application/json',
|
|
|
- 'tenancyId': this.tenancyId,
|
|
|
+ }).then(res => {
|
|
|
+ return res.json()
|
|
|
+ }).then(result => {
|
|
|
+ let { data, code, msg } = result
|
|
|
+ if (code === 1) {
|
|
|
+ this.itemList = data.records || []
|
|
|
+ if (this.itemList.length > 0) {
|
|
|
+ // 回显已选择的数据
|
|
|
+ this.checkedMaterIds = this.extractSameIds(this.itemList, this.selectedMaters)
|
|
|
}
|
|
|
- }).then(res => {
|
|
|
- return res.json()
|
|
|
- }).then(result => {
|
|
|
- let { data, code, msg } = result
|
|
|
- if (code === 1) {
|
|
|
- this.itemList = data.records || []
|
|
|
- if (this.itemList.length > 0) {
|
|
|
- // 回显已选择的数据
|
|
|
- this.checkedMaterIds = this.extractSameIds(this.itemList, this.selectedMaters)
|
|
|
- }
|
|
|
- if (this.allTreeData.filter(all => all.id === item.id)[0] && this.allTreeData.filter(all => all.id === item.id)[0].children) {
|
|
|
- this.treeData = this.allTreeData.filter(all => all.id === item.id)[0].children
|
|
|
- } else {
|
|
|
- this.treeData = []
|
|
|
- }
|
|
|
+ if (this.allTreeData.filter(all => all.id === item.id)[0] && this.allTreeData.filter(all => all.id === item.id)[0].children) {
|
|
|
+ this.treeData = this.allTreeData.filter(all => all.id === item.id)[0].children
|
|
|
} else {
|
|
|
- vant.Toast.fail(msg)
|
|
|
+ this.treeData = []
|
|
|
}
|
|
|
- })
|
|
|
+ } else {
|
|
|
+ vant.Toast.fail(msg)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleSearch() {
|
|
|
+ if (this.keyword === '') {
|
|
|
+ this.getTreeData()
|
|
|
+ } else {
|
|
|
+ this.getMaterData()
|
|
|
}
|
|
|
},
|
|
|
extractSameIds(itemList, selectedMaters) {
|