|
|
@@ -40,14 +40,10 @@
|
|
|
</div>
|
|
|
<div class="filter">
|
|
|
<div>
|
|
|
- <i
|
|
|
- @click="refreshList"
|
|
|
- class="iconfont icon-works_search search"
|
|
|
- ></i>
|
|
|
+ <i class="iconfont icon-works_search search"></i>
|
|
|
<input
|
|
|
type="text"
|
|
|
v-model="searchKey"
|
|
|
- @keyup.enter="refreshList"
|
|
|
placeholder="搜索文件夹或素材"
|
|
|
/>
|
|
|
<i v-if="searchKey" @click="searchKey=''" class="iconfont icontoast_red del"></i>
|
|
|
@@ -122,11 +118,11 @@
|
|
|
</div>
|
|
|
</tableList>
|
|
|
<div class="total-number" v-if="list.length !== 0 || hasMoreData">已加载{{list.length}}条</div>
|
|
|
- <div class="nodata" v-if="list.length == 0 && !hasMoreData && searchKey">
|
|
|
+ <div class="nodata" v-if="list.length == 0 && !hasMoreData && lastestUsedSearchKey">
|
|
|
<img :src="$noresult" alt="" />
|
|
|
<span>未搜索到结果</span>
|
|
|
</div>
|
|
|
- <div class="nodata" v-if="list.length == 0 && !hasMoreData && !searchKey">
|
|
|
+ <div class="nodata" v-if="list.length == 0 && !hasMoreData && !lastestUsedSearchKey">
|
|
|
<img :src="config.empty" alt="" />
|
|
|
<span>暂无素材~</span>
|
|
|
<button @click="$refs.uploadFile.click()" class="upload-btn-in-table">上传素材</button>
|
|
|
@@ -167,8 +163,8 @@ import cover from "../popup/cover";
|
|
|
import Upload from "@/components/shared/uploads/UploadMultiple";
|
|
|
import { getImgWH, changeByteUnit } from "@/utils/file";
|
|
|
import UploadList from "../components/uploadList";
|
|
|
-
|
|
|
import uploadui from "../components/uploadui";
|
|
|
+import { debounce } from "@/utils/other.js"
|
|
|
|
|
|
import {
|
|
|
getMaterialList,
|
|
|
@@ -207,7 +203,11 @@ export default {
|
|
|
popupItem: null,
|
|
|
tabHeader: data,
|
|
|
selectedArr: [],
|
|
|
+
|
|
|
searchKey: "",
|
|
|
+ // 因为searchKey的变化经过debounce、异步请求的延时,才会反映到数据列表的变化上,所以是否显示、显示哪种无数据提示,也要等到数据列表变化后,根据数据列表是否为空,以及引发本次变化的那个searchKey瞬时值来决定。本变量就是用来保存那个瞬时值。
|
|
|
+ lastestUsedSearchKey: '',
|
|
|
+
|
|
|
tablist: [
|
|
|
{
|
|
|
name: "全景图片",
|
|
|
@@ -233,8 +233,20 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
},
|
|
|
+ searchKey: {
|
|
|
+ handler: function () {
|
|
|
+ this.refreshListDebounced()
|
|
|
+ },
|
|
|
+ immediate: false,
|
|
|
+ },
|
|
|
},
|
|
|
methods: {
|
|
|
+ refreshListDebounced: debounce(function() {
|
|
|
+ this.list = []
|
|
|
+ this.isRequestingMoreData = false
|
|
|
+ this.hasMoreData = true
|
|
|
+ this.$refs['table-list'].requestMoreData()
|
|
|
+ }, 700, false),
|
|
|
clearinter() {
|
|
|
this.interval && clearInterval(this.interval);
|
|
|
this.interval = null;
|
|
|
@@ -287,6 +299,7 @@ export default {
|
|
|
})
|
|
|
if (index >= 0) {
|
|
|
this.isRequestingMoreData = true
|
|
|
+ const lastestUsedSearchKey = this.searchKey
|
|
|
getMaterialList(
|
|
|
{
|
|
|
pageNum: index + 1,
|
|
|
@@ -302,9 +315,11 @@ export default {
|
|
|
this.showCover = false;
|
|
|
this.popupItem = "";
|
|
|
this.isRequestingMoreData = false
|
|
|
+ this.lastestUsedSearchKey = lastestUsedSearchKey
|
|
|
},
|
|
|
() => {
|
|
|
this.isRequestingMoreData = false
|
|
|
+ this.lastestUsedSearchKey = lastestUsedSearchKey
|
|
|
this.showCover = false;
|
|
|
this.popupItem = "";
|
|
|
}
|
|
|
@@ -359,6 +374,7 @@ export default {
|
|
|
delMaterial(item.id, () => {
|
|
|
this.$msg.success("删除成功");
|
|
|
this.isRequestingMoreData = true
|
|
|
+ const lastestUsedSearchKey = this.searchKey
|
|
|
getMaterialList(
|
|
|
{
|
|
|
pageNum: this.list.length + 1,
|
|
|
@@ -386,9 +402,11 @@ export default {
|
|
|
}
|
|
|
|
|
|
this.isRequestingMoreData = false
|
|
|
+ this.lastestUsedSearchKey = lastestUsedSearchKey
|
|
|
},
|
|
|
() => {
|
|
|
this.isRequestingMoreData = false
|
|
|
+ this.lastestUsedSearchKey = lastestUsedSearchKey
|
|
|
}
|
|
|
)
|
|
|
});
|
|
|
@@ -494,15 +512,9 @@ export default {
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
- refreshList() {
|
|
|
- console.log('refresh');
|
|
|
- this.list = []
|
|
|
- this.isRequestingMoreData = false
|
|
|
- this.hasMoreData = true
|
|
|
- this.$refs['table-list'].requestMoreData()
|
|
|
- },
|
|
|
getMoreMaterialItem(islongpolling = null) {
|
|
|
this.isRequestingMoreData = true
|
|
|
+ const lastestUsedSearchKey = this.searchKey
|
|
|
getMaterialList(
|
|
|
{
|
|
|
pageNum: Math.floor(this.list.length / config.PAGE_SIZE) + 1,
|
|
|
@@ -521,9 +533,11 @@ export default {
|
|
|
this.hasMoreData = false
|
|
|
}
|
|
|
this.isRequestingMoreData = false
|
|
|
+ this.lastestUsedSearchKey = lastestUsedSearchKey
|
|
|
},
|
|
|
() => {
|
|
|
this.isRequestingMoreData = false
|
|
|
+ this.lastestUsedSearchKey = lastestUsedSearchKey
|
|
|
}
|
|
|
);
|
|
|
},
|