diff --git a/package.json b/package.json index aa4abaa..8d6c5d8 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "e-vue-contextmenu": "^0.1.3", "element-ui": "2.13.0", "exif-js": "^2.3.0", + "gsap": "^3.2.6", "highlightjs-line-numbers.js": "^2.7.0", "jquery": "^1.12.4", "js-cookie": "2.2.0", diff --git a/src/assets/js/Physics2DPlugin.js b/src/assets/js/Physics2DPlugin.js new file mode 100644 index 0000000..ff5b915 --- /dev/null +++ b/src/assets/js/Physics2DPlugin.js @@ -0,0 +1,13 @@ +/*! + * VERSION: 0.2.0 + * DATE: 2016-07-12 + * UPDATES AND DOCS AT: http://greensock.com + * + * @license Copyright (c) 2008-2016, GreenSock. All rights reserved. + * Physics2DPlugin is a Club GreenSock membership benefit; You must have a valid membership to use + * this code without violating the terms of use. Visit http://greensock.com/club/ to sign up or get more details. + * This work is subject to the software agreement that was issued with your membership. + * + * @author: Jack Doyle, jack@greensock.com + */ +var _gsScope="undefined"!=typeof module&&module.exports&&"undefined"!=typeof global?global:this||window;(_gsScope._gsQueue||(_gsScope._gsQueue=[])).push(function(){"use strict";var t=Math.PI/180,e=function(t,e,i,n,r){this.p=e,this.f="function"==typeof t[e],this.start=this.value=this.f?t[e.indexOf("set")||"function"!=typeof t["get"+e.substr(3)]?e:"get"+e.substr(3)]():parseFloat(t[e]),this.velocity=i||0,this.v=this.velocity/r,n||0===n?(this.acceleration=n,this.a=this.acceleration/(r*r)):this.acceleration=this.a=0},i="greensock.com",n="Physics2DPlugin",r=String.fromCharCode(103,114,101,101,110,115,111,99,107,46,99,111,109),o=String.fromCharCode(47,114,101,113,117,105,114,101,115,45,109,101,109,98,101,114,115,104,105,112,47),s=function(t){for(var e=-1!==(window?window.location.href:"").indexOf(String.fromCharCode(103,114,101,101,110,115,111,99,107))&&-1!==t.indexOf(String.fromCharCode(108,111,99,97,108,104,111,115,116)),i=[r,String.fromCharCode(99,111,100,101,112,101,110,46,105,111),String.fromCharCode(99,111,100,101,112,101,110,46,100,101,118),String.fromCharCode(99,115,115,45,116,114,105,99,107,115,46,99,111,109),String.fromCharCode(99,100,112,110,46,105,111),String.fromCharCode(103,97,110,110,111,110,46,116,118),String.fromCharCode(99,111,100,101,99,97,110,121,111,110,46,110,101,116),String.fromCharCode(116,104,101,109,101,102,111,114,101,115,116,46,110,101,116),String.fromCharCode(99,101,114,101,98,114,97,120,46,99,111,46,117,107),String.fromCharCode(116,121,109,112,97,110,117,115,46,110,101,116),String.fromCharCode(116,119,101,101,110,109,97,120,46,99,111,109),String.fromCharCode(116,119,101,101,110,108,105,116,101,46,99,111,109),String.fromCharCode(112,108,110,107,114,46,99,111),String.fromCharCode(104,111,116,106,97,114,46,99,111,109),String.fromCharCode(119,101,98,112,97,99,107,98,105,110,46,99,111,109),String.fromCharCode(97,114,99,104,105,118,101,46,111,114,103),String.fromCharCode(106,115,102,105,100,100,108,101,46,110,101,116)],o=i.length;--o>-1;)if(-1!==t.indexOf(i[o]))return!0;return e&&window&&window.console&&console.log(String.fromCharCode(87,65,82,78,73,78,71,58,32,97,32,115,112,101,99,105,97,108,32,118,101,114,115,105,111,110,32,111,102,32)+n+String.fromCharCode(32,105,115,32,114,117,110,110,105,110,103,32,108,111,99,97,108,108,121,44,32,98,117,116,32,105,116,32,119,105,108,108,32,110,111,116,32,119,111,114,107,32,111,110,32,97,32,108,105,118,101,32,100,111,109,97,105,110,32,98,101,99,97,117,115,101,32,105,116,32,105,115,32,97,32,109,101,109,98,101,114,115,104,105,112,32,98,101,110,101,102,105,116,32,111,102,32,67,108,117,98,32,71,114,101,101,110,83,111,99,107,46,32,80,108,101,97,115,101,32,115,105,103,110,32,117,112,32,97,116,32,104,116,116,112,58,47,47,103,114,101,101,110,115,111,99,107,46,99,111,109,47,99,108,117,98,47,32,97,110,100,32,116,104,101,110,32,100,111,119,110,108,111,97,100,32,116,104,101,32,39,114,101,97,108,39,32,118,101,114,115,105,111,110,32,102,114,111,109,32,121,111,117,114,32,71,114,101,101,110,83,111,99,107,32,97,99,99,111,117,110,116,32,119,104,105,99,104,32,104,97,115,32,110,111,32,115,117,99,104,32,108,105,109,105,116,97,116,105,111,110,115,46,32,84,104,101,32,102,105,108,101,32,121,111,117,39,114,101,32,117,115,105,110,103,32,119,97,115,32,108,105,107,101,108,121,32,100,111,119,110,108,111,97,100,101,100,32,102,114,111,109,32,101,108,115,101,119,104,101,114,101,32,111,110,32,116,104,101,32,119,101,98,32,97,110,100,32,105,115,32,114,101,115,116,114,105,99,116,101,100,32,116,111,32,108,111,99,97,108,32,117,115,101,32,111,114,32,111,110,32,115,105,116,101,115,32,108,105,107,101,32,99,111,100,101,112,101,110,46,105,111,46)),e}(window?window.location.host:""),a=Math.random(),h=_gsScope._gsDefine.globals,l=h.com.greensock.core.Animation._rootFramesTimeline,c=_gsScope._gsDefine.plugin({propName:"physics2D",version:"0.2.0",API:2,init:function(a,h,c,d){if("function"==typeof h&&(h=h(d,a)),!s)return window.location.href="http://"+r+o+"?plugin="+n+"&source="+i,!1;this._target=a,this._tween=c,this._runBackwards=c.vars.runBackwards===!0,this._step=0;for(var f,u=c._timeline,g=+h.angle||0,p=+h.velocity||0,_=+h.acceleration||0,m=h.xProp||"x",C=h.yProp||"y",v=h.accelerationAngle||0===h.accelerationAngle?+h.accelerationAngle:g;u._timeline;)u=u._timeline;return this._stepsPerTimeUnit=f=u===l?1:30,h.gravity&&(_=+h.gravity,v=90),g*=t,v*=t,this._friction=1-+(h.friction||0),this._overwriteProps.push(m),this._overwriteProps.push(C),this._x=new e(a,m,Math.cos(g)*p,Math.cos(v)*_,f),this._y=new e(a,C,Math.sin(g)*p,Math.sin(v)*_,f),this._skipX=this._skipY=!1,s},set:function(){var t,e,i,n,r,o,s=this._tween._time,a=this._x,h=this._y;if(this._runBackwards===!0&&(s=this._tween._duration-s),1===this._friction)i=s*s*.5,t=a.start+(a.velocity*s+a.acceleration*i),e=h.start+(h.velocity*s+h.acceleration*i);else{if(s*=this._stepsPerTimeUnit,n=o=(0|s)-this._step,r=s%1,0>o)for(o=-o;--o>-1;)a.value-=a.v,h.value-=h.v,a.v/=this._friction,h.v/=this._friction,a.v-=a.a,h.v-=h.a;else for(;--o>-1;)a.v+=a.a,h.v+=h.a,a.v*=this._friction,h.v*=this._friction,a.value+=a.v,h.value+=h.v;t=a.value+a.v*r,e=h.value+h.v*r,this._step+=n}this._skipX||(a.m&&(t=a.m(t,this._target)),a.f?this._target[a.p](t):this._target[a.p]=t),this._skipY||(h.m&&(e=h.m(e,this._target)),h.f?this._target[h.p](e):this._target[h.p]=e)}}),d=c.prototype;d._kill=function(t){return null!=t[this._x.p]&&(this._skipX=!0),null!=t[this._y.p]&&(this._skipY=!0),this._super._kill.call(this,t)},d._mod=function(t){var e=t[this._x.p]||t.physics2D;e&&"function"==typeof e&&(this._x.m=e),e=t[this._y.p]||t.physics2D,e&&"function"==typeof e&&(this._y.m=e)},c._autoCSS=!0,c._cssRegister=function(){var t=h.CSSPlugin;if(t){var e=t._internals,i=e._parseToProxy,n=e._setPluginRatio,r=e.CSSPropTween;e._registerComplexSpecialProp("physics2D",{parser:function(t,e,o,s,h,l){l=new c;var d,f=e.xProp||"x",u=e.yProp||"y",g={};return g[f]=g[u]=a++,d=i(t,g,s,h,l),h=new r(t,"physics2D",0,0,d.pt,2),h.data=d,h.plugin=l,h.setRatio=n,l._onInitTween(d.proxy,e,s._tween),h}})}}}),_gsScope._gsDefine&&_gsScope._gsQueue.pop()(); diff --git a/src/components/Breadcrumb/BreadcrumbFilePath.vue b/src/components/Breadcrumb/BreadcrumbFilePath.vue index 60c1fb1..18955b2 100644 --- a/src/components/Breadcrumb/BreadcrumbFilePath.vue +++ b/src/components/Breadcrumb/BreadcrumbFilePath.vue @@ -5,14 +5,14 @@   ... - {{ item.folder }} - {{ substring10(item.folder) }}... + {{ item.folder }} + {{ substring10(item.folder) }}... - {{ item.folder }} - {{ substring10(item.folder) }}... + {{ item.folder }} + {{ substring10(item.folder) }}... - + {{ item.folder }} {{ item.folder }} {{ substring10(item.folder) }}... @@ -24,14 +24,14 @@   ... - {{ item.folder }} - {{ substring10(item.folder) }}... + {{ item.folder }} + {{ substring10(item.folder) }}... - {{ item.folder }} - {{ substring10(item.folder) }}... + {{ item.folder }} + {{ substring10(item.folder) }}... - + {{ item.folder }} {{ item.folder }} {{ substring10(item.folder) }}... diff --git a/src/components/ShowFile/ShowFile.vue b/src/components/ShowFile/ShowFile.vue index 9fa3123..b9f62a4 100644 --- a/src/components/ShowFile/ShowFile.vue +++ b/src/components/ShowFile/ShowFile.vue @@ -2,13 +2,22 @@
- - + + +   + + + + + + +
+
@@ -47,15 +56,13 @@
- + + - - -
-
+ - + @@ -72,8 +79,8 @@
  • @@ -130,149 +137,181 @@ - - + + +
  • + + + + + + + + + + + + + + + + + + + + + + + - -
    -
    +
    {{indexList.length>0 ? '已选择 '+this.tableHead[2].label : "选择"}}
    @@ -293,7 +332,7 @@
    - + @@ -313,21 +352,22 @@  {{summaries}}
    + - - + + + + + + + + + + @@ -341,11 +381,14 @@
    - - {{rowContextData.isFolder ? '文件夹': rowContextData.contentType}} + + {{rowContextData.name}} + + + {{rowContextData.isFolder ? '文件夹': rowContextData.contentType}} - {{rowContextData.size}}字节 ({{formatSize(rowContextData.size)}}) + {{rowContextData.size}}字节 {{rowContextData.size >0 ? '('+formatSize(rowContextData.size)+')': ''}} {{rowContextData.path}} @@ -369,7 +412,7 @@ /* eslint-disable */ import { mapGetters } from 'vuex' // import defaultSettings from '@/settings' - import { getPath, getPathList, setPath, removePath } from '@/utils/path' + // import { getPath, getPathList, setPath, removePath } from '@/utils/path' import { strlen, substring10, formatTime, formatSize } from '@/utils/number' import { suffix } from '@/utils/file-type' import Bus from '@/assets/js/bus' @@ -382,10 +425,19 @@ import ImageViewer from "@/components/preview/ImageViewer"; import VideoPreview from "@/components/preview/VideoPreview"; import AudioPreview from "@/components/preview/AudioPreview"; + import ButtonUpload from "@/components/button/ButtonUpload"; + import 'pl-table/themes/index.css'; + // import 'pl-table/themes/plTableStyle.css'; + import { PlTable, PlTableColumn } from 'pl-table'; + var rowStyleExecuting = false export default { name: 'ShowFile', - components: {AudioPreview, VideoPreview, ImageViewer, SimTextPreview, IconFile, BreadcrumbFilePath, EmptyFile}, + components: {AudioPreview, VideoPreview, ImageViewer, SimTextPreview, IconFile, BreadcrumbFilePath, EmptyFile, + PlTable, + PlTableColumn, + ButtonUpload + }, props: { emptyStatus: { 'type': String, @@ -496,16 +548,17 @@ renameFileName: '', searchFileName: '', pathList: [ - { 'folder': '', index: 0 }, - { 'folder': '+', index: 1 } + { 'folder': ''}, ], fileList: [], pagination: { pageIndex: 1, - pageSize: 25, + pageSize: 100, total: 0, pageSizes: [10,20,30,40,50] }, + isIndeterminate: false, + isSelectAll: false, indexList: [], clientHeight: 500, // 表头数据 @@ -536,8 +589,8 @@ menusIsMultiple: false, menus: [], rowContextData: {}, - selectRowData: [], - tableLoading: false, + tableLoading: true, + finished: false, newFolderLoading: false, renameLoading: false, menuTriangle: '', // 三角菜单 @@ -573,7 +626,8 @@ videoPreviewVisible: false, audioPreviewRow: {}, audioPreviewVisible: false, - drawer: false + drawer: false, + rowStyleExecuting: false, } }, computed: { @@ -585,11 +639,12 @@ this.getFileList() }, mounted() { + Bus.$on('fileSuccess', () => { this.getFileList() }) Bus.$on('clickMore', (selectRowData) => { - this.selectRowData = selectRowData + this.$refs.fileListTable.tableSelectData = selectRowData this.preliminaryRowData() }) @@ -602,6 +657,7 @@ const that = this window.onresize = function temp() { that.clientHeight = document.documentElement.clientHeight - 165 + console.log('that.clientHeight',that.clientHeight) } // 加载布局 @@ -615,25 +671,19 @@ } // 加载url上的path - if(this.$route.query.path){ + if(this.$route.query.path !== '/'){ const path = decodeURI(this.$route.query.path) this.pathList.splice(1,1) path.split('/').forEach((pathName,index)=>{ if(index > 0){ const item = {} item['folder'] = pathName - item['index'] = index this.pathList.push(item) } }) - const item = {} - item['folder'] = '+' - item['index'] = this.pathList.length - this.pathList.push(item) } }, destroyed() { - removePath() window.removeEventListener('popstate', this.goBack, false); }, directives: { @@ -664,6 +714,9 @@ } }, methods: { + load () { + this.getFileList(true) + }, gridItemHover(item,index) { this.gridHoverItemIndex = index; this.gridHoverIntermediate = index; @@ -679,7 +732,7 @@ }, clickGridItemCheckBox(item,index) { if(this.indexList.length === 0){ - this.selectRowData = [] + this.$refs.fileListTable.tableSelectData = [] } // 同步列表的checkbox if(this.indexList.includes(index)){ @@ -960,6 +1013,9 @@ const linkIndex = this.pathList.length-3 this.handleLink(this.pathList[linkIndex],linkIndex) }, + lastLink(){ + this.handleLink(this.pathList[this.pathList.length-2],this.pathList.length-2) + }, handleLink(item, index, unPushLink, unRefresh) { if(item && item.search){ if(item.searchKey){ @@ -967,9 +1023,9 @@ } else if(item.row){ this.searchFileAndOpenDir(item.row) } - this.pathList.splice(this.pathList.findIndex(v => v.index === index + 2), this.pathList.length - (index + 2)) + this.pathList.splice(this.pathList.findIndex((v,i) => i === index + 1), this.pathList.length - (index + 1)) } else { - this.pathList.splice(this.pathList.findIndex(v => v.index === index + 2), this.pathList.length - (index + 2)) + this.pathList.splice(this.pathList.findIndex((v,i) => i === index + 1), this.pathList.length - (index + 1)) this.pathList.forEach((p, number) => { if (number === 0) { this.path = '' @@ -1074,10 +1130,11 @@ // 切换布局 changeVmode(){ this.grid = !this.grid - console.log(this.$route.fullPath) this.vmode = 'list' if(this.grid){ this.vmode = 'grid' + }else{ + this.$refs.fileListTable.setHeight() } if(!this.path){ this.path = '' @@ -1088,18 +1145,12 @@ }, searchFile(key) { if(key){ - this.pathList = [{ 'folder': '', index: 0 }] + this.pathList = [{ 'folder': ''}] const item1 = {} item1['folder'] = '搜索: ' + '"'+ key +'"' item1['search'] = true item1['searchKey'] = key - item1['index'] = 1 - const item2 = {} - item2['folder'] = '+' - item2['index'] = 2 this.pathList.push(item1) - this.pathList.push(item2) - // this.$router.push(`?search-file=${key}`) this.$router.push(`?vmode=${this.vmode}&search-file=${key}`) this.tableLoading = true api.searchFile({ @@ -1168,7 +1219,12 @@ }).catch(e => {}) this.path = row.path + row.name }, - getFileList() { + getFileList(onLoad) { + if (onLoad) { + this.pagination.pageIndex++ + } else { + this.pagination.pageIndex = 1 + } this.tableLoading = true api.fileList({ userId: this.$store.state.user.userId, @@ -1183,11 +1239,24 @@ pageIndex: this.pagination.pageIndex, pageSize: this.pagination.pageSize }).then(res => { - this.fileList = res.data + if(onLoad){ + res.data.forEach((file,number) => { + file['index'] = (this.pagination.pageIndex - 1) * this.pagination.pageSize + number + this.fileList.push(file) + }); + }else{ + this.fileList = res.data + } + // 数据全部加载完成 + if (this.fileList.length >= res.count) { + this.finished = true; + } + this.fileList.map((item,index) => { item.index = index }) this.clientHeight = document.documentElement.clientHeight - 165 + this.clientHeight = 550 + 40 + 51 this.listModeSearch = false this.listModeSearchOpenDir = false this.pagination['total'] = res.count @@ -1304,99 +1373,125 @@ } return sizeSum }, - // 收集选中的index值作为数组 传递给rowRed判断变换样式 - handleSelectionChange(row) { - // 选中的值 - this.selectRowData = row - let selectTotalSize = 0 - this.indexList = [] - for (const item of row) { - selectTotalSize += item.size - this.indexList.push(item.index) - } - - row.forEach(r => { - this.$refs.fileListTable.toggleRowSelection(r,true) - }); - - const item_name = this.tableHead[2] - const item_more = this.tableHead[4] - const item_size = this.tableHead[5] - const item_date = this.tableHead[6] - if (this.selectRowData.length > 0) { - const sumFileAndFolder = this.getShowSumFileAndFolder(row) - const sizeSum = this.getShowSumSize(selectTotalSize) - item_name.label = sumFileAndFolder - item_name.sortable = false - item_more.name = 'more' - item_size.label = sizeSum - item_size.sortable = false - item_date.label = '' - item_date.sortable = false - } else { - item_name.label = '名称' - item_name.sortable = true - item_more.name = '' - item_size.label = '大小' - item_size.sortable = true - item_date.label = '修改日期' - item_date.sortable = true - } - if(this.indexList.length === this.fileList.length){ - this.allChecked = true + selectAll(checked) { + this.isSelectAll = checked + if(checked){ + this.fileList.forEach(row => { + this.indexList.push(row.index) + }) }else{ - this.allChecked = false + this.indexList.splice(0,this.indexList.length) + this.isIndeterminate = false } }, - // cell-style 通过返回值可以实现样式变换利用传递过来的数组index循环改变样式 - rowRed({ row, column, rowIndex, columnIndex }) { - if (this.indexList.length < 1 && columnIndex === 2 && this.cellMouseIndex === rowIndex) { - return { cursor: 'pointer', color: "#19ACF9" } + checkChange(checked,index) { + if(checked){ + this.indexList.push(index) + }else{ + this.indexList.splice(this.indexList.findIndex(i => index === i), 1) } - for (let i = 0; i < this.indexList.length; i++) { - if (rowIndex === this.indexList[i]) { - return { backgroundColor: '#EBEEF5', color: '#b7b5b6', cursor: 'default' } + if(this.indexList.length > 0){ + this.isIndeterminate = true + }else{ + this.isIndeterminate = false + } + }, + tableBodyScroll(table, e) { + let scrollBottom = e.target.scrollHeight-e.target.clientHeight-e.target.scrollTop; + if(scrollBottom < 200){ + if(!this.finished){ + this.getFileList(true) } } }, + // 收集选中的index值作为数组 传递给rowRed判断变换样式 + handleSelectionChange(row) { + this.$refs.fileListTable.tableSelectData = row + let selectTotalSize = 0 + row.forEach(item => { + selectTotalSize += item.size + }) + const item_name = this.tableHead[2] + const item_more = this.tableHead[4] + const item_size = this.tableHead[5] + const item_date = this.tableHead[6] + if (row.length > 0) { + const sumFileAndFolder = this.getShowSumFileAndFolder(row) + const sizeSum = this.getShowSumSize(selectTotalSize) + item_name.label = sumFileAndFolder + item_name.sortable = false + item_more.name = 'more' + item_size.label = sizeSum + item_size.sortable = false + item_date.label = '' + item_date.sortable = false + } else { + item_name.label = '名称' + item_name.sortable = true + item_more.name = '' + item_size.label = '大小' + item_size.sortable = true + item_date.label = '修改日期' + item_date.sortable = true + } + }, + // cell-style 通过返回值可以实现样式变换利用传递过来的数组index循环改变样式 + rowStyle({ row, rowIndex}) { + if(this.$refs.fileListTable.tableSelectData.length > 0){ + console.log('rowStyle',this.$refs.fileListTable.tableSelectData[0].index) + } + if(this.$refs.fileListTable.tableSelectData.findIndex(item => item.index === row.index) > -1){ + return { backgroundColor: '#F5F7FA' } + } + }, // 动态添加index到row里面去 tableRowClassName({ row, rowIndex }) { - row.index = rowIndex + // row.index = rowIndex }, // 选择某行预备数据 preliminaryRowData(row) { if (row) { - this.selectRowData[0] = row + this.$refs.fileListTable.tableSelectData[0] = row this.rowContextData = row } - const isFavorite = this.selectRowData[0].isFavorite + const isFavorite = this.$refs.fileListTable.tableSelectData[0].isFavorite this.highlightFavorite(isFavorite, false) }, - // 单元格hover进入时时间 + // 单元格hover进入时事件 cellMouseEnter(row) { - if(this.editingIndex === -1){ + if(this.$refs.contextShow.locals.menuType === 'moreClick' && this.$refs.contextShow.locals.rowIndex !== row.index) { + this.$refs.contextShow.hideMenu() + } + if(this.editingIndex === -1 && !this.$refs.contextShow.ctxVisible) { if (this.indexList.length < 1) { this.cellMouseIndex = row.index } } }, - // 单元格hover退出时时间 - cellMouseLeave() { + // 单元格hover退出时事件 + cellMouseLeave(row) { + if(this.$refs.contextShow.locals.menuType === 'moreClick' && this.$refs.contextShow.locals.rowIndex !== row.index) { + this.$refs.contextShow.hideMenu() + return + } + if(this.$refs.contextShow.ctxVisible && this.$refs.contextShow.locals.menuType === 'moreClick' && this.$refs.contextShow.locals.rowIndex === row.index) { + return + } this.cellMouseIndex = -1 }, + //双击 + dblclick(row){ + // this.fileClick(row) + }, // 单元格点击事件 cellClick(row, column) { clearTimeout(this.Loop); if(this.editingIndex === -1) { const columnIndex = column.index - if (columnIndex === 0) { - // 点击选中 - this.$refs.fileListTable.toggleRowSelection(row) - } if (columnIndex === 2) { if (this.indexList.length < 1) { if (row.index !== this.editingIndex) { - this.fileClick(row) + // this.fileClick(row) this.editingIndex = -1 } } @@ -1404,11 +1499,19 @@ if (columnIndex === 4) { // // 单个操作 } - if (this.indexList.length > 0 && columnIndex > 0) { - this.$refs.fileListTable.toggleRowSelection(row) + if(columnIndex === 0 ){ + this.$refs.fileListTable.toggleRowSelection([{row:row}]) + } else { + this.$refs.fileListTable.clearSelection() + this.$refs.fileListTable.toggleRowSelection([{row:row}]) } } }, + // 选取输入框部分内容 + renameInputFocus(event,row) { + event.currentTarget.selectionStart = 0 + event.currentTarget.selectionEnd = event.currentTarget.value.length - row.suffix.length - 1 + }, // 重命名 rowRename(newFileName, row) { if (newFileName) { @@ -1457,6 +1560,8 @@ this.fileList[row.index] = row this.editingIndex = -1 } + }).then(()=>{ + this.$refs.fileListTable.clearSelection() }) } else { this.editingIndex = -1 @@ -1476,16 +1581,17 @@ }else{ this.menus = this.singleMenus } - // this.showOperationMenus(event) this.preliminaryRowData(row) - this.showOperationMenus(event) + this.showOperationMenus(event,{'menuType':'moreClick',rowIndex: row.index}) }, // 鼠标右击 rowContextmenu(row) { - if (this.indexList.includes(row.index)) { + if (this.$refs.fileListTable.tableSelectData.length > 1 && this.$refs.fileListTable.tableSelectData.findIndex(item => item.index === row.index) > -1) { this.menusIsMultiple = true this.menus = this.multipleRightMenus } else { + this.$refs.fileListTable.clearSelection() + this.$refs.fileListTable.toggleRowSelection([{row:row}]) this.menusIsMultiple = false if(row.contentType && row.contentType.includes("text")){ this.menus = this.singleMenusEdit @@ -1494,6 +1600,7 @@ } this.preliminaryRowData(row) } + console.log('menusIsMultiple', this.menusIsMultiple) event.preventDefault() this.menuTriangle = '' const e = {} @@ -1504,25 +1611,26 @@ e.clientX = event.clientX + 5 e.clientY = event.clientY + 2 this.$refs.contextShow.showMenu(e) + this.cellMouseIndex = -1 }, // 显示操作菜单 - showOperationMenus(event) { + showOperationMenus(event, menuData) { + let offsetY = event.pageY + if(event.target.clientHeight > 0){ + offsetY += event.target.clientHeight/2-event.offsetY + } const e = {} - if (document.body.scrollHeight - event.pageY > 400) { + if (document.body.scrollHeight - offsetY > 400) { this.menuTriangle = 'menu-triangle-top' e.pageX = event.pageX - 78 - e.pageY = event.pageY + 30 - e.clientX = event.clientX + 78 - e.clientY = event.clientY + 30 + e.pageY = offsetY + 25 } else { this.menuTriangle = 'menu-triangle-bottom' e.pageX = event.pageX - 78 - e.pageY = event.pageY - 350 - e.clientX = event.clientX + 78 - e.clientY = event.clientY - 350 + e.pageY = offsetY - (this.menus.length * 38) - 36 } if (!this.isJustHideMenus) { - this.$refs.contextShow.showMenu(e) + this.$refs.contextShow.showMenu(e,menuData) } }, menuFavoriteOver(index, isFavorite) { @@ -1541,7 +1649,7 @@ if (item_menu) { if (isFavorite) { item_menu.label = '取消收藏' - item_menu.iconClass = 'menu-favorite-hover' + item_menu.iconClass = 'menu-unfavorite-hover' item_menu.operation = 'unFavorite' } else { if (isHover) { @@ -1564,6 +1672,7 @@ setTimeout(function() { that.isJustHideMenus = false }, 100) + this.cellMouseIndex = -1 console.log('菜单隐藏了') }, // 菜单操作 @@ -1587,7 +1696,7 @@ break case 'deselect': // 取消选定 - this.$refs.fileListTable.toggleRowSelection(this.rowContextData) + this.$refs.fileListTable.clearSelection() break case 'unFavorite': // 取消收藏 @@ -1681,7 +1790,7 @@ let fileIds = []; if (this.menusIsMultiple || this.indexList.length > 1) { - const exits = this.selectRowData.some(value => { + const exits = this.$refs.fileListTable.tableSelectData.some(value => { fileIds.push(value.id) const thisParentPath = value.path if(thisParentPath === selectNodePath){ @@ -1732,13 +1841,13 @@ if(operating === 'move'){ // 移除列表 - if (this.selectRowData.length === 1) { - this.fileList.splice(this.selectRowData[0].index, 1) + if (this.$refs.fileListTable.tableSelectData.length === 1) { + this.fileList.splice(this.$refs.fileListTable.tableSelectData[0].index, 1) } else { this.getFileList() } this.$refs.fileListTable.clearSelection()// 删除后清空之前选择的数据 - this.selectRowData = [] + this.$refs.fileListTable.tableSelectData = [] } setTimeout(function () { @@ -1772,7 +1881,7 @@ if(this.rowContextData.id){ row = this.rowContextData } else { - row = this.selectRowData[0] + row = this.$refs.fileListTable.tableSelectData[0] } } this.shareDialog = true @@ -1815,21 +1924,26 @@ }, downloadFile() { let totalSize = 0 - this.selectRowData.forEach(item => { + this.$refs.fileListTable.tableSelectData.forEach(item => { totalSize += item.size }) if (totalSize > 0) { var fileIds = []; - if (this.indexList.length > 1) { - this.selectRowData.forEach(value => { + // if (this.indexList.length > 1) { + // this.$refs.fileListTable.tableSelectData.forEach(value => { + // fileIds.push(value.id) + // }) + // } else { + // if (this.rowContextData.id) { + // fileIds.push(this.rowContextData.id) + // } else { + // fileIds.push(this.$refs.fileListTable.tableSelectData[0].id) + // } + // } + if (this.$refs.fileListTable.tableSelectData.length > 0) { + this.$refs.fileListTable.tableSelectData.forEach(value => { fileIds.push(value.id) }) - } else { - if (this.rowContextData.id) { - fileIds.push(this.rowContextData.id) - } else { - fileIds.push(this.selectRowData[0].id) - } } window.open(process.env.VUE_APP_BASE_FILE_API + 'download?jmal-token=' + this.$store.state.user.token + '&fileIds=' + fileIds, '_self') } else { @@ -1841,11 +1955,11 @@ }, // 收藏/取消收藏 favoriteOperating(isFavorite) { - this.selectRowData[0].isFavorite = isFavorite + this.$refs.fileListTable.tableSelectData[0].isFavorite = isFavorite this.highlightFavorite(isFavorite, true) api.favoriteUrl({ token: this.$store.state.user.token, - id: this.selectRowData[0].id, + id: this.$refs.fileListTable.tableSelectData[0].id, isFavorite: isFavorite }).then(res => { }) @@ -1855,16 +1969,17 @@ let fileList = [] const fileIds = [] if (this.menusIsMultiple || this.indexList.length > 1) { - fileList = this.selectRowData - this.selectRowData.forEach(value => { + fileList = this.$refs.fileListTable.tableSelectData + this.$refs.fileListTable.tableSelectData.forEach(value => { fileIds.push(value.id) }) } else { - fileIds.push(this.selectRowData[0].id) + fileIds.push(this.$refs.fileListTable.tableSelectData[0].id) } - console.log(fileIds) const str = this.getShowSumFileAndFolder(fileList) + console.log(this.$refs.fileListTable.tableSelectData) + this.$confirm('此操作将永久删除' + str + ', 是否继续?', '提示', { confirmButtonText: '确定', cancelButtonText: '取消', @@ -1874,19 +1989,24 @@ username: this.$store.state.user.name, fileIds: fileIds }).then(() => { + // 移除列表 + if(this.$refs.fileListTable.tableSelectData.length > 0){ + this.$refs.fileListTable.tableSelectData.forEach(item => { + let fileIndex = this.fileList.findIndex(file => file.id === item.id) + if(fileIndex > -1){ + this.fileList.splice(fileIndex,1) + } + }) + } + this.$refs.fileListTable.doLayout() + this.$refs.fileListTable.clearSelection()// 删除后清空之前选择的数据 + this.$refs.fileListTable.tableSelectData = [] + }).then(()=>{ this.$notify({ title: '删除成功', type: 'success', duration: 1000 }) - // 移除列表 - if (this.selectRowData.length === 1) { - this.fileList.splice(this.selectRowData[0].index, 1) - } else { - this.getFileList() - } - this.$refs.fileListTable.clearSelection()// 删除后清空之前选择的数据 - this.selectRowData = [] }) }) }, @@ -1895,18 +2015,12 @@ if (row.isFolder) { // 打开文件夹 if (this.listModeSearch) { - const item1 = {} - item1['folder'] = row.name - item1['search'] = true - item1['row'] = row - item1['index'] = this.pathList.length - 1 - const item2 = {} - item2['folder'] = '+' - item2['index'] = this.pathList.length - this.pathList[this.pathList.length - 1] = item1 - this.pathList.push(item2) + const item = {} + item['folder'] = row.name + item['search'] = true + item['row'] = row + this.pathList.push(item) this.pagination.pageIndex = 1 - // this.$router.push(`?search-file=${row.id}`) this.$router.push(`?vmode=${this.vmode}&search-file=${row.id}`) this.searchFileAndOpenDir(row) } else { @@ -1915,20 +2029,13 @@ } else { this.path = '/' + row.name } - const item1 = {} - item1['folder'] = row.name - item1['index'] = this.pathList.length - 1 - const item2 = {} - item2['folder'] = '+' - item2['index'] = this.pathList.length - this.pathList[this.pathList.length - 1] = item1 - this.pathList.push(item2) - setPath(this.path, this.pathList) + const item = {'folder':row.name} + this.pathList.push(item) this.pagination.pageIndex = 1 const path = encodeURIComponent(this.path); this.$router.push(`?vmode=${this.vmode}&path=${path}`) this.openDir(row) - // this.getFileList() + console.log(this.pathList) } } else { if(row.contentType.indexOf('image') > -1){ @@ -1986,16 +2093,27 @@ /deep/:focus { outline:0; } - - /deep/.el-drawer__header span { - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; + /deep/.el-drawer__header { + color: #000000; + span { + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + } } - .details-form { - margin-left: 20px; - margin-top: 20px; + margin: 20px 10px 0 20px; + /deep/.el-form-item__content { + white-space: normal; + word-break: break-all; + word-wrap: break-word; + } + /deep/.el-form-item { + margin-bottom: 0; + } + a:hover { + color: #409EFF; + } } .drawer-icon { text-align: center; @@ -2003,5 +2121,20 @@ .drawer-icon-font /deep/.svg-icon { font-size: 8rem; } + .list-item { + height: 50px; + } + .table-file-name:hover { + color: #19ACF9; + } + /deep/.plTableBox .el-table .el-table__header th { + background-color: #FFFFFF; + } + /deep/.el-table td { + height: 50px!important; + } + .home-link:hover { + corlor: #409EFF; + } diff --git a/src/components/button/ButtonUpload.vue b/src/components/button/ButtonUpload.vue new file mode 100644 index 0000000..bcee898 --- /dev/null +++ b/src/components/button/ButtonUpload.vue @@ -0,0 +1,217 @@ + + + + diff --git a/src/icons/svg/back.svg b/src/icons/svg/back.svg new file mode 100644 index 0000000..b477279 --- /dev/null +++ b/src/icons/svg/back.svg @@ -0,0 +1 @@ + diff --git a/src/icons/svg/menu-unfavorite-hover.svg b/src/icons/svg/menu-unfavorite-hover.svg new file mode 100644 index 0000000..c92913f --- /dev/null +++ b/src/icons/svg/menu-unfavorite-hover.svg @@ -0,0 +1 @@ + diff --git a/src/icons/svg/menu-unfavorite.svg b/src/icons/svg/menu-unfavorite.svg new file mode 100644 index 0000000..9c7ab04 --- /dev/null +++ b/src/icons/svg/menu-unfavorite.svg @@ -0,0 +1 @@ + diff --git a/src/views/demo/index.vue b/src/views/demo/index.vue index c7afb70..fb06bd7 100644 --- a/src/views/demo/index.vue +++ b/src/views/demo/index.vue @@ -1,78 +1,24 @@ + \ No newline at end of file + +