diff --git a/src/main.js b/src/main.js index 9d4a1a0..e53b667 100644 --- a/src/main.js +++ b/src/main.js @@ -14,7 +14,7 @@ import store from './store' import router from './router' // import WeVue from 'we-vue' // import 'we-vue/lib/style.css' -import { Button, Cell, CellGroup, Image, List, PullRefresh, SwipeCell, Col, Row, Divider } from 'vant'; +import { Button, Cell, CellGroup, Image, List, PullRefresh, SwipeCell, Col, Row, Divider, Sticky } from 'vant'; import '@/icons' // icon import '@/permission' // permission control @@ -49,6 +49,7 @@ Vue.use(SwipeCell); Vue.use(Col); Vue.use(Row); Vue.use(Divider); +Vue.use(Sticky); Vue.use(uploader) Vue.use(EVueContextmenu) diff --git a/src/utils/number.js b/src/utils/number.js index 33426d5..1a93815 100644 --- a/src/utils/number.js +++ b/src/utils/number.js @@ -102,7 +102,9 @@ export function formatTime(agoTime) { * @param {*} size */ export function formatSize(size) { - if (size < 1024) { + if (size === 0) { + return '' + } else if (size < 1024) { return size + 'B' } else if (size < 1024 * 1024) { return (size/1024).toFixed(2) + 'k' diff --git a/src/views/home/index.vue b/src/views/home/index.vue index f4739d3..62ed1c4 100644 --- a/src/views/home/index.vue +++ b/src/views/home/index.vue @@ -4,16 +4,29 @@ + +   + ... + {{ item.folder }} + + {{ substring10(item.folder) }}... + + + + {{ item.folder }} + + {{ substring10(item.folder) }}... + + + + {{ item.folder }} + + {{ item.folder }} + {{ substring10(item.folder) }}... + {{ substring10(item.folder) }}... + + -   - ... - {{ item.folder }} - {{ substring10(item.folder) }}... - {{ item.folder }} - {{ substring10(item.folder) }}... - - {{ item.folder }} - {{ substring10(item.folder) }}...    {{ (scope.row.agoTime/(1000*60*60*24*30*12)).toFixed(0) }} 年前 - + + @@ -260,6 +282,12 @@ export default { { 'folder': '+', index: 1 } ], fileList: [], + pagination: { + pageIndex: 1, + pageSize: 25, + total: 0, + pageSizes: [10,20,30,40,50] + }, indexList: [], clientHeight: 500, // 表头数据 @@ -352,7 +380,7 @@ export default { } const that = this window.onresize = function temp() { - that.clientHeight = document.documentElement.clientHeight - 150 + that.clientHeight = document.documentElement.clientHeight - 165 } }, destroyed() { @@ -427,6 +455,7 @@ export default { setPath(this.path, this.pathList) this.getFileList() } + console.log("this.pathList:", this.pathList) }, newFolder() { this.newFolderName = '新建文件夹' @@ -515,14 +544,15 @@ export default { userId: this.$store.state.user.userId, keyword: key, currentDirectory: getPath(), - pageIndex: 1, - pageSize: 30 + pageIndex: this.pagination.pageIndex, + pageSize: this.pagination.pageSize }).then(res => { this.fileList = res.data this.tableLoading = false - this.clientHeight = document.documentElement.clientHeight - 150 + this.clientHeight = document.documentElement.clientHeight - 165 this.listModeSearch = true this.path = '' + this.pagination['total'] = res.count }).catch(e => {}) }else{ this.handleLink('',0) @@ -534,13 +564,14 @@ export default { userId: this.$store.state.user.userId, id: row.id, currentDirectory: getPath(), - pageIndex: 1, - pageSize: 30 + pageIndex: this.pagination.pageIndex, + pageSize: this.pagination.pageSize }).then(res => { this.fileList = res.data this.tableLoading = false - this.clientHeight = document.documentElement.clientHeight - 150 + this.clientHeight = document.documentElement.clientHeight - 165 this.listModeSearch = true + this.pagination['total'] = res.count }).catch(e => {}) this.path = row.path + row.name }, @@ -549,13 +580,14 @@ export default { api.fileList({ userId: this.$store.state.user.userId, currentDirectory: getPath(), - pageIndex: 1, - pageSize: 30 + pageIndex: this.pagination.pageIndex, + pageSize: this.pagination.pageSize }).then(res => { this.fileList = res.data this.tableLoading = false - this.clientHeight = document.documentElement.clientHeight - 150 + this.clientHeight = document.documentElement.clientHeight - 165 this.listModeSearch = false + this.pagination['total'] = res.count }).catch(e => {}) }, getFileListBySearchMode() { @@ -563,15 +595,24 @@ export default { api.fileList({ userId: this.$store.state.user.userId, currentDirectory: this.path, - pageIndex: 1, + pageIndex: this.pagination.pageIndex, pageSize: 30 }).then(res => { this.fileList = res.data this.tableLoading = false - this.clientHeight = document.documentElement.clientHeight - 150 + this.clientHeight = document.documentElement.clientHeight - 165 this.listModeSearch = true + this.pagination['total'] = res.count }).catch(e => {}) }, + currentChange(pageIndex) { + this.pagination.pageIndex = pageIndex + if (this.listModeSearch) { + this.searchFile(this.searchFileName) + } else { + this.getFileList() + } + }, getSummaries(param) { // 合计 const { columns, data } = param @@ -1226,5 +1267,10 @@ export default { width: 30%; } + .el-pagination { + float: right; + margin-top: 50px; + } + diff --git a/src/views/home/mobile/index.vue b/src/views/home/mobile/index.vue index 614caba..ee76a08 100644 --- a/src/views/home/mobile/index.vue +++ b/src/views/home/mobile/index.vue @@ -1,866 +1,242 @@ - - -