|
|
@@ -3,63 +3,72 @@
|
|
|
<div class="top">
|
|
|
<crumbs :list="tablist" />
|
|
|
<!-- <audio controls :src="`https://houseoss.4dkankan.com/chuanshan/audio/testaudio.mp3`"></audio> -->
|
|
|
+ </div>
|
|
|
+ <div class="second-line">
|
|
|
+ <div class="btn">
|
|
|
+ <button
|
|
|
+ @mouseover.stop="showList = true"
|
|
|
+ @click="$refs.uploadFile.click()"
|
|
|
+ class="ui-button ui-button-rect submit"
|
|
|
+ >
|
|
|
+ <span>上传素材</span>
|
|
|
+ <i class="iconfont icon-material_prompt hover-tips hover-tips-upload-icon">
|
|
|
+ <div>
|
|
|
+ <div class="remark">请上传20MB以内、mp3格式的音频</div>
|
|
|
+ </div>
|
|
|
+ </i>
|
|
|
+ <upload
|
|
|
+ ref="uploadFile"
|
|
|
+ :failString="'格式错误,请上传20MB以内、mp3格式的音频'"
|
|
|
+ :limitFailStr="'过大,请上传20MB以内、mp3格式的音频'"
|
|
|
+ accept-type="audio/mp3"
|
|
|
+ media-type="audio"
|
|
|
+ :limit="20"
|
|
|
+ @file-change="onFileChange"
|
|
|
+ ></upload>
|
|
|
+ <template v-if="showList">
|
|
|
+ <UploadList
|
|
|
+ @close="
|
|
|
+ () => {
|
|
|
+ showList = false;
|
|
|
+ }
|
|
|
+ "
|
|
|
+ :list="uploadList"
|
|
|
+ @del="delUploadItem"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
<div class="filter">
|
|
|
<div>
|
|
|
+ <i
|
|
|
+ @click="refreshList"
|
|
|
+ class="iconfont icon-works_search"
|
|
|
+ ></i>
|
|
|
<input
|
|
|
type="text"
|
|
|
v-model="searchKey"
|
|
|
- @keyup.enter="(paging.current = 1) && getMaterialList()"
|
|
|
- placeholder="搜索素材"
|
|
|
+ @keyup.enter="refreshList"
|
|
|
+ placeholder="搜索文件夹或素材"
|
|
|
/>
|
|
|
- <i
|
|
|
- @click="(paging.current = 1) && getMaterialList()"
|
|
|
- class="iconfont iconbs_search"
|
|
|
- ></i>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="btn">
|
|
|
- <button
|
|
|
- @mouseover.stop="showList = true"
|
|
|
- @click="$refs.uploadFile.click()"
|
|
|
- class="ui-button ui-button-rect submit"
|
|
|
- >
|
|
|
- <span>上传素材</span><i class="iconfont iconbs_upload"></i>
|
|
|
- <upload
|
|
|
- ref="uploadFile"
|
|
|
- :failString="'格式错误,请上传20MB以内、mp3格式的音频'"
|
|
|
- :limitFailStr="'过大,请上传20MB以内、mp3格式的音频'"
|
|
|
- accept-type="audio/mp3"
|
|
|
- media-type="audio"
|
|
|
- :limit="20"
|
|
|
- @file-change="onFileChange"
|
|
|
- ></upload>
|
|
|
- <template v-if="showList">
|
|
|
- <UploadList
|
|
|
- @close="
|
|
|
- () => {
|
|
|
- showList = false;
|
|
|
- }
|
|
|
- "
|
|
|
- :list="uploadList"
|
|
|
- @del="delUploadItem"
|
|
|
- />
|
|
|
- </template>
|
|
|
- </button>
|
|
|
- </div>
|
|
|
<div class="list">
|
|
|
<tableList
|
|
|
- v-if="list.length > 0"
|
|
|
@selection-change="
|
|
|
(data) => {
|
|
|
selectedArr = data;
|
|
|
}
|
|
|
"
|
|
|
+ @request-more-data="getMoreMaterialItem"
|
|
|
+ :canRequestMoreData="hasMoreData && !isRequestingMoreData"
|
|
|
:header="tabHeader"
|
|
|
:showLine="true"
|
|
|
:selection="false"
|
|
|
:data="list"
|
|
|
class="table-list"
|
|
|
+ ref="table-list"
|
|
|
>
|
|
|
<div slot-scope="{ data }" slot="header">
|
|
|
{{ data.name }}
|
|
|
@@ -74,7 +83,7 @@
|
|
|
<div class="remark">重命名</div>
|
|
|
</div>
|
|
|
</i>
|
|
|
- <i class="iconfont iconlist_delete hover-tips" @click="del(item)">
|
|
|
+ <i class="iconfont iconlist_delete hover-tips-warn" @click="del(item)">
|
|
|
<div>
|
|
|
<div class="remark">删除</div>
|
|
|
</div>
|
|
|
@@ -96,19 +105,16 @@
|
|
|
>
|
|
|
</div>
|
|
|
</tableList>
|
|
|
- <div class="nodata" v-if="list.length == 0">
|
|
|
+ <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="" />
|
|
|
- <span>{{
|
|
|
- isClickSearch ? "未搜索到结果" : "暂无素材,快去上传吧"
|
|
|
- }}</span>
|
|
|
+ <span>未搜索到结果</span>
|
|
|
+ </div>
|
|
|
+ <div class="nodata" v-if="list.length == 0 && !hasMoreData && !isClickSearch">
|
|
|
+ <img :src="config.empty" alt="" />
|
|
|
+ <span>暂无素材~</span>
|
|
|
+ <button @click="$refs.uploadFile.click()" class="upload-btn-in-table">上传素材</button>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- <div class="paging">
|
|
|
- <Paging
|
|
|
- v-if="paging.total > 0"
|
|
|
- :paging="paging"
|
|
|
- @changeCurrent="changeCurrent"
|
|
|
- />
|
|
|
</div>
|
|
|
|
|
|
<rename
|
|
|
@@ -121,19 +127,17 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import config from "@/config";
|
|
|
import tableList from "@/components/table";
|
|
|
import crumbs from "@/components/crumbs";
|
|
|
import { data } from "./audio";
|
|
|
import rename from "../popup/rename";
|
|
|
-import Paging from "../components/paging";
|
|
|
import vAudio from "@/components/audio";
|
|
|
|
|
|
import Upload from "@/components/shared/uploads/UploadMultiple";
|
|
|
import { changeByteUnit } from "@/utils/file";
|
|
|
import UploadList from "../components/uploadList";
|
|
|
|
|
|
-const TYPE = "audio";
|
|
|
-
|
|
|
import {
|
|
|
getMaterialList,
|
|
|
uploadMaterial,
|
|
|
@@ -141,18 +145,20 @@ import {
|
|
|
delMaterial,
|
|
|
} from "@/api";
|
|
|
|
|
|
+const TYPE = "audio";
|
|
|
+
|
|
|
export default {
|
|
|
components: {
|
|
|
tableList,
|
|
|
crumbs,
|
|
|
rename,
|
|
|
- Paging,
|
|
|
Upload,
|
|
|
vAudio,
|
|
|
UploadList,
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ config,
|
|
|
showRename: false,
|
|
|
showList: false,
|
|
|
popupItem: "",
|
|
|
@@ -166,27 +172,15 @@ export default {
|
|
|
},
|
|
|
],
|
|
|
list: [],
|
|
|
+ hasMoreData: true,
|
|
|
+ isRequestingMoreData: false,
|
|
|
uploadList: [],
|
|
|
isClickSearch: "",
|
|
|
- paging: {
|
|
|
- pageSize: 8,
|
|
|
- pageNum: 1,
|
|
|
- total: 0,
|
|
|
- showSize: 4,
|
|
|
- current: 1,
|
|
|
- },
|
|
|
};
|
|
|
},
|
|
|
mounted() {
|
|
|
- this.getMaterialList();
|
|
|
},
|
|
|
watch: {
|
|
|
- "paging.pageNum": function () {
|
|
|
- this.getMaterialList();
|
|
|
- },
|
|
|
- "$route.name": function (newVal) {
|
|
|
- console.log(newVal);
|
|
|
- },
|
|
|
},
|
|
|
methods: {
|
|
|
stopAllAudio() {
|
|
|
@@ -312,35 +306,42 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
- this.getMaterialList();
|
|
|
+ this.getMoreMaterialItem();
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
- changeCurrent(data) {
|
|
|
- this.paging.pageNum = data;
|
|
|
+ refreshList() {
|
|
|
+ console.log('refresh');
|
|
|
+ this.list = []
|
|
|
+ this.isRequestingMoreData = false
|
|
|
+ this.hasMoreData = true
|
|
|
+ console.log(this.$refs);
|
|
|
+ this.$refs['test'].requestMoreData()
|
|
|
},
|
|
|
- getMaterialList() {
|
|
|
+ getMoreMaterialItem() {
|
|
|
this.isClickSearch = !!this.searchKey;
|
|
|
+ this.isRequestingMoreData = true
|
|
|
getMaterialList(
|
|
|
{
|
|
|
- pageNum: this.paging.pageNum,
|
|
|
- pageSize: this.paging.pageSize,
|
|
|
+ pageNum: Math.floor(this.list.length / config.PAGE_SIZE) + 1,
|
|
|
+ pageSize: config.PAGE_SIZE,
|
|
|
searchKey: this.searchKey,
|
|
|
type: TYPE,
|
|
|
},
|
|
|
(data) => {
|
|
|
- this.list = [];
|
|
|
- setTimeout(() => {
|
|
|
- this.list = data.data.list.map((i) => {
|
|
|
- i.fileSize = changeByteUnit(Number(i.fileSize));
|
|
|
- return i;
|
|
|
- });
|
|
|
-
|
|
|
- this.paging.pageNum = data.data.pageNum;
|
|
|
- this.paging.pageSize = data.data.pageSize;
|
|
|
- this.paging.total = data.data.total;
|
|
|
+ const newData = data.data.list.map((i) => {
|
|
|
+ i.fileSize = changeByteUnit(Number(i.fileSize));
|
|
|
+ return i;
|
|
|
});
|
|
|
+ this.list = this.list.concat(newData)
|
|
|
+ if (this.list.length === data.data.total) {
|
|
|
+ this.hasMoreData = false
|
|
|
+ }
|
|
|
+ this.isRequestingMoreData = false
|
|
|
+ },
|
|
|
+ () => {
|
|
|
+ this.isRequestingMoreData = false
|
|
|
}
|
|
|
);
|
|
|
},
|
|
|
@@ -349,8 +350,6 @@ export default {
|
|
|
</script>
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
-.panorama {
|
|
|
-}
|
|
|
</style>
|
|
|
<style lang="less" scoped>
|
|
|
@import "../style.less";
|