|
@@ -39,13 +39,13 @@
|
|
|
<div class="filter">
|
|
<div class="filter">
|
|
|
<div>
|
|
<div>
|
|
|
<i
|
|
<i
|
|
|
- @click="(paging.current = 1) && getMaterialList()"
|
|
|
|
|
|
|
+ @click="getMaterialList()"
|
|
|
class="iconfont icon-works_search"
|
|
class="iconfont icon-works_search"
|
|
|
></i>
|
|
></i>
|
|
|
<input
|
|
<input
|
|
|
type="text"
|
|
type="text"
|
|
|
v-model="searchKey"
|
|
v-model="searchKey"
|
|
|
- @keyup.enter="(paging.current = 1) && getMaterialList()"
|
|
|
|
|
|
|
+ @keyup.enter="getMaterialList()"
|
|
|
placeholder="搜索文件夹或素材"
|
|
placeholder="搜索文件夹或素材"
|
|
|
/>
|
|
/>
|
|
|
</div>
|
|
</div>
|
|
@@ -58,6 +58,8 @@
|
|
|
selectedArr = data;
|
|
selectedArr = data;
|
|
|
}
|
|
}
|
|
|
"
|
|
"
|
|
|
|
|
+ @request-more-data="getMaterialList"
|
|
|
|
|
+ :canRequestMoreData="hasMoreData && !isRequestingMoreData"
|
|
|
:header="tabHeader"
|
|
:header="tabHeader"
|
|
|
:showLine="true"
|
|
:showLine="true"
|
|
|
:selection="false"
|
|
:selection="false"
|
|
@@ -111,15 +113,16 @@
|
|
|
sub.fontweight && ((showPreview = true), (popupItem = item))
|
|
sub.fontweight && ((showPreview = true), (popupItem = item))
|
|
|
"
|
|
"
|
|
|
:style="{ fontWeight: sub.fontweight, color: '#202020' }"
|
|
:style="{ fontWeight: sub.fontweight, color: '#202020' }"
|
|
|
- >{{ data || "-" }}</span
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ >{{ data || "-" }}
|
|
|
|
|
+ </span>
|
|
|
</div>
|
|
</div>
|
|
|
</tableList>
|
|
</tableList>
|
|
|
- <div class="nodata" v-if="list.length == 0 && isClickSearch">
|
|
|
|
|
|
|
+ <div class="total-number" v-if="list.length !== 0 || hasMoreData">已加载{{list.length}}条</div>
|
|
|
|
|
+ <div class="nodata" v-if="list.length == 0 && !hasMoreData && isClickSearch">
|
|
|
<img :src="$noresult" alt="" />
|
|
<img :src="$noresult" alt="" />
|
|
|
<span>未搜索到结果</span>
|
|
<span>未搜索到结果</span>
|
|
|
</div>
|
|
</div>
|
|
|
- <div class="nodata" v-if="list.length == 0 && !isClickSearch">
|
|
|
|
|
|
|
+ <div class="nodata" v-if="list.length == 0 && !hasMoreData && !isClickSearch">
|
|
|
<img :src="config.empty" alt="" />
|
|
<img :src="config.empty" alt="" />
|
|
|
<span>暂无素材~</span>
|
|
<span>暂无素材~</span>
|
|
|
<button @click="$refs.uploadFile.click()" class="upload-btn-in-table">上传素材</button>
|
|
<button @click="$refs.uploadFile.click()" class="upload-btn-in-table">上传素材</button>
|
|
@@ -177,6 +180,7 @@ import {
|
|
|
|
|
|
|
|
const TYPE = "pano";
|
|
const TYPE = "pano";
|
|
|
const LONGPOLLINGTIME = 10;
|
|
const LONGPOLLINGTIME = 10;
|
|
|
|
|
+const PAGE_SIZE = 20;
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
|
name: 'Pano',
|
|
name: 'Pano',
|
|
@@ -193,7 +197,7 @@ export default {
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
config,
|
|
config,
|
|
|
- isLongPolling: false,
|
|
|
|
|
|
|
+ isLongPolling: false, // TODO?
|
|
|
showRename: false,
|
|
showRename: false,
|
|
|
showPreview: false,
|
|
showPreview: false,
|
|
|
showCover: false,
|
|
showCover: false,
|
|
@@ -209,28 +213,16 @@ export default {
|
|
|
},
|
|
},
|
|
|
],
|
|
],
|
|
|
list: [],
|
|
list: [],
|
|
|
|
|
+ hasMoreData: true,
|
|
|
|
|
+ isRequestingMoreData: false,
|
|
|
uploadList: [],
|
|
uploadList: [],
|
|
|
isClickSearch: "",
|
|
isClickSearch: "",
|
|
|
- paging: {
|
|
|
|
|
- pageSize: 8,
|
|
|
|
|
- pageNum: 1,
|
|
|
|
|
- total: 0,
|
|
|
|
|
- showSize: 4,
|
|
|
|
|
- current: 1,
|
|
|
|
|
- },
|
|
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
mounted() {
|
|
mounted() {
|
|
|
- this.getMaterialList();
|
|
|
|
|
|
|
+ // this.getMaterialList();
|
|
|
},
|
|
},
|
|
|
watch: {
|
|
watch: {
|
|
|
- "paging.pageNum": function () {
|
|
|
|
|
- this.getMaterialList();
|
|
|
|
|
- },
|
|
|
|
|
- searchKey(){
|
|
|
|
|
- this.paging.current = 1
|
|
|
|
|
- this.getMaterialList();
|
|
|
|
|
- },
|
|
|
|
|
isLongPolling: {
|
|
isLongPolling: {
|
|
|
handler: function (newVal) {
|
|
handler: function (newVal) {
|
|
|
if (!newVal) {
|
|
if (!newVal) {
|
|
@@ -433,28 +425,30 @@ export default {
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
- changeCurrent(data) {
|
|
|
|
|
- this.paging.pageNum = data;
|
|
|
|
|
- },
|
|
|
|
|
getMaterialList(islongpolling = null) {
|
|
getMaterialList(islongpolling = null) {
|
|
|
this.isClickSearch = !!this.searchKey;
|
|
this.isClickSearch = !!this.searchKey;
|
|
|
-
|
|
|
|
|
|
|
+ this.isRequestingMoreData = true
|
|
|
getMaterialList(
|
|
getMaterialList(
|
|
|
{
|
|
{
|
|
|
- pageNum: this.paging.pageNum,
|
|
|
|
|
- pageSize: this.paging.pageSize,
|
|
|
|
|
|
|
+ pageNum: Math.floor(this.list.length / PAGE_SIZE) + 1,
|
|
|
|
|
+ pageSize: PAGE_SIZE,
|
|
|
searchKey: this.searchKey,
|
|
searchKey: this.searchKey,
|
|
|
type: TYPE,
|
|
type: TYPE,
|
|
|
islongpolling
|
|
islongpolling
|
|
|
},
|
|
},
|
|
|
(data) => {
|
|
(data) => {
|
|
|
- this.list = data.data.list.map((i) => {
|
|
|
|
|
|
|
+ const newData = data.data.list.map((i) => {
|
|
|
i.fileSize = changeByteUnit(Number(i.fileSize));
|
|
i.fileSize = changeByteUnit(Number(i.fileSize));
|
|
|
return i;
|
|
return i;
|
|
|
});
|
|
});
|
|
|
- this.paging.pageNum = data.data.pageNum;
|
|
|
|
|
- this.paging.pageSize = data.data.pageSize;
|
|
|
|
|
- this.paging.total = data.data.total;
|
|
|
|
|
|
|
+ this.list = this.list.concat(newData)
|
|
|
|
|
+ if (this.list.length === data.data.total) {
|
|
|
|
|
+ this.hasMoreData = false
|
|
|
|
|
+ }
|
|
|
|
|
+ this.isRequestingMoreData = false
|
|
|
|
|
+ },
|
|
|
|
|
+ () => {
|
|
|
|
|
+ this.isRequestingMoreData = false
|
|
|
}
|
|
}
|
|
|
);
|
|
);
|
|
|
},
|
|
},
|