|
|
@@ -56,11 +56,11 @@
|
|
|
</div>
|
|
|
</li>
|
|
|
</ul>
|
|
|
- <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="add" class="upload-btn-in-table">创建作品</button>
|
|
|
@@ -80,6 +80,7 @@
|
|
|
import share from '../popup/share'
|
|
|
import preview from "@/components/preview";
|
|
|
import config from "@/config";
|
|
|
+import { debounce } from "@/utils/other.js"
|
|
|
|
|
|
import {
|
|
|
addWorks,
|
|
|
@@ -100,6 +101,8 @@ export default {
|
|
|
hasMoreData: true,
|
|
|
isRequestingMoreData: false,
|
|
|
searchKey:'',
|
|
|
+ // 因为searchKey的变化经过debounce、异步请求的延时,才会反映到数据列表的变化上,所以是否显示、显示哪种无数据提示,也要等到数据列表变化后,根据数据列表是否为空,以及引发本次变化的那个searchKey瞬时值来决定。本变量就是用来保存那个瞬时值。
|
|
|
+ lastestUsedSearchKey: '',
|
|
|
showShare:false,
|
|
|
showPreview:false,
|
|
|
showItem:'',
|
|
|
@@ -109,12 +112,20 @@ export default {
|
|
|
mounted(){
|
|
|
},
|
|
|
watch:{
|
|
|
- // searchKey(){
|
|
|
- // this.paging.current = 1
|
|
|
- // this.getWorksList()
|
|
|
- // }
|
|
|
+ searchKey: {
|
|
|
+ handler: function () {
|
|
|
+ this.refreshListDebounced()
|
|
|
+ },
|
|
|
+ immediate: false,
|
|
|
+ },
|
|
|
},
|
|
|
methods:{
|
|
|
+ refreshListDebounced: debounce(function() {
|
|
|
+ console.log('refresh');
|
|
|
+ this.list = []
|
|
|
+ this.isRequestingMoreData = false
|
|
|
+ this.hasMoreData = true
|
|
|
+ }, 700, false),
|
|
|
openShare(data){
|
|
|
getPanoInfo(data.id, (data) => {
|
|
|
if (data.scenes.length<=0) {
|
|
|
@@ -153,6 +164,7 @@ export default {
|
|
|
delWorks(item.id,()=>{
|
|
|
this.$msg.success("删除成功");
|
|
|
this.isRequestingMoreData = true
|
|
|
+ const lastestUsedSearchKey = this.searchKey
|
|
|
getWorksList(
|
|
|
{
|
|
|
pageNum: this.list.length + 1,
|
|
|
@@ -166,12 +178,14 @@ export default {
|
|
|
this.hasMoreData = false
|
|
|
}
|
|
|
this.isRequestingMoreData = false
|
|
|
+ this.lastestUsedSearchKey = lastestUsedSearchKey
|
|
|
// TODO: 这是干啥呢?
|
|
|
this.$nextTick(()=>{
|
|
|
this.$bus.emit('refreshTips')
|
|
|
})
|
|
|
},
|
|
|
() => {
|
|
|
+ this.lastestUsedSearchKey = lastestUsedSearchKey
|
|
|
this.isRequestingMoreData = false
|
|
|
}
|
|
|
)
|
|
|
@@ -181,6 +195,7 @@ export default {
|
|
|
},
|
|
|
requestMoreData() {
|
|
|
this.isRequestingMoreData = true
|
|
|
+ const thisTimeSearchKey = this.searchKey
|
|
|
getWorksList(
|
|
|
{
|
|
|
pageNum: Math.floor(this.list.length / config.PAGE_SIZE) + 1,
|
|
|
@@ -193,12 +208,14 @@ export default {
|
|
|
this.hasMoreData = false
|
|
|
}
|
|
|
this.isRequestingMoreData = false
|
|
|
+ this.lastestUsedSearchKey = thisTimeSearchKey
|
|
|
// TODO: 这是干啥呢?
|
|
|
this.$nextTick(()=>{
|
|
|
this.$bus.emit('refreshTips')
|
|
|
})
|
|
|
},
|
|
|
() => {
|
|
|
+ this.lastestUsedSearchKey = thisTimeSearchKey
|
|
|
this.isRequestingMoreData = false
|
|
|
}
|
|
|
);
|