From 5e79d534828e58e2097532df89a283ff3e7a1d95 Mon Sep 17 00:00:00 2001 From: jmal Date: Tue, 18 Feb 2020 14:30:25 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=88=86=E9=A1=B5:?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E8=BF=87=E5=A4=9A=E6=97=B6=E5=88=86=E9=A1=B5?= =?UTF-8?q?,=20=E4=BC=98=E5=8C=96=E8=B7=AF=E5=BE=84=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=EF=BC=8C=E8=BF=87=E9=95=BF=E5=88=99=E7=BC=A9=E7=9F=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/home/index.vue | 90 ++++++++++++++++++++++++++++++---------- 1 file changed, 68 insertions(+), 22 deletions(-) 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; + } + From a44d7b37c5c5d108ec05f87d64324d7a80574b20 Mon Sep 17 00:00:00 2001 From: jmal Date: Tue, 18 Feb 2020 18:04:38 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E7=AB=AF=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.js | 3 +- src/utils/number.js | 4 +- src/views/home/mobile/index.vue | 1056 +++++++------------------------ 3 files changed, 221 insertions(+), 842 deletions(-) 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 32be4ca..556655d 100644 --- a/src/utils/number.js +++ b/src/utils/number.js @@ -98,7 +98,9 @@ export function formatTime(agoTime) { } 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/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 @@ - - -