添加移动端index操作
This commit is contained in:
parent
3a4578f849
commit
04ce83097f
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<span>
|
<span>
|
||||||
<svg-icon v-if="pc && item.isFavorite" icon-class="menu-favorite-hover" style="font-size: 1rem;float: right;margin-bottom: -1rem;position: relative;" />
|
<svg-icon v-if="pc && item.isFavorite" icon-class="menu-favorite-hover" style="font-size: 1rem;float: right;margin-left: 1rem;position: absolute;" />
|
||||||
<svg-icon v-if="!pc && item.isFavorite" icon-class="menu-favorite-hover" style="font-size: 0.5rem;float: right;margin-bottom: -1rem;position: relative;" />
|
<svg-icon v-if="!pc && item.isFavorite" icon-class="menu-favorite-hover" style="font-size: 0.5rem;float: right;margin-left: 2rem;position: absolute;" />
|
||||||
<svg-icon v-if="item.isFolder" icon-class="folder" />
|
<svg-icon v-if="item.isFolder" icon-class="folder" />
|
||||||
<svg-icon v-else-if="item.contentType.indexOf('video') > -1" icon-class="video" />
|
<svg-icon v-else-if="item.contentType.indexOf('video') > -1" icon-class="video" />
|
||||||
<svg-icon v-else-if="item.contentType.indexOf('audio') > -1" icon-class="audio" />
|
<svg-icon v-else-if="item.contentType.indexOf('audio') > -1" icon-class="audio" />
|
||||||
|
|||||||
@ -15,7 +15,7 @@ import router from './router'
|
|||||||
import VueWechatTitle from 'vue-wechat-title'
|
import VueWechatTitle from 'vue-wechat-title'
|
||||||
// import WeVue from 'we-vue'
|
// import WeVue from 'we-vue'
|
||||||
// import 'we-vue/lib/style.css'
|
// import 'we-vue/lib/style.css'
|
||||||
import { Button, Cell, CellGroup, Image, List, PullRefresh, SwipeCell, Col, Row, Divider, Sticky, NavBar, Icon, Tabbar, TabbarItem, ActionSheet, Dialog, Field, Overlay} from 'vant';
|
import { Button, Cell, CellGroup, Image, List, PullRefresh, SwipeCell, Col, Row, Divider, Sticky, NavBar, Icon, Tabbar, TabbarItem, ActionSheet, Field, Overlay} from 'vant';
|
||||||
|
|
||||||
import '@/icons' // icon
|
import '@/icons' // icon
|
||||||
import '@/permission' // permission control
|
import '@/permission' // permission control
|
||||||
@ -62,7 +62,6 @@ Vue.use(Icon);
|
|||||||
Vue.use(Tabbar);
|
Vue.use(Tabbar);
|
||||||
Vue.use(TabbarItem);
|
Vue.use(TabbarItem);
|
||||||
Vue.use(ActionSheet);
|
Vue.use(ActionSheet);
|
||||||
Vue.use(Dialog);
|
|
||||||
Vue.use(Field);
|
Vue.use(Field);
|
||||||
Vue.use(Overlay);
|
Vue.use(Overlay);
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<van-pull-refresh v-model="refreshing" @refresh="onRefresh">
|
<!-- <van-pull-refresh v-model="refreshing" @refresh="onRefresh"> -->
|
||||||
<van-list
|
<van-list
|
||||||
v-model="loading"
|
v-model="loading"
|
||||||
:finished="finished"
|
:finished="finished"
|
||||||
@ -57,7 +57,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</van-cell>
|
</van-cell>
|
||||||
</van-list>
|
</van-list>
|
||||||
</van-pull-refresh>
|
<!-- </van-pull-refresh> -->
|
||||||
|
|
||||||
<van-action-sheet
|
<van-action-sheet
|
||||||
v-model="actionSheetShow"
|
v-model="actionSheetShow"
|
||||||
@ -72,12 +72,18 @@
|
|||||||
</van-field>
|
</van-field>
|
||||||
</van-dialog>
|
</van-dialog>
|
||||||
|
|
||||||
<e-vue-contextmenu ref="contextShow" class="newFileMenu" :class="menuTriangle" @ctx-show="show" @ctx-hide="hide">
|
<van-dialog v-model="showRename" show-cancel-button @confirm="rowRename()">
|
||||||
|
<van-field class="rename-input" v-model="renameFileName" placeholder="请输入文件名称" :border="true" :clearable="true" ref="renameInput" :autofocus="true">
|
||||||
|
</van-field>
|
||||||
|
</van-dialog>
|
||||||
|
|
||||||
|
<e-vue-contextmenu ref="contextShow" class="newFileMenu" @ctx-show="show" @ctx-hide="hide">
|
||||||
<ul v-for="(item,index) in menus" :key="item.label" :class="{'menu-list-first':index===0,'menu-list-last':index===menus.length-1,'menu-list':index<menus.length-1&&index>0}">
|
<ul v-for="(item,index) in menus" :key="item.label" :class="{'menu-list-first':index===0,'menu-list-last':index===menus.length-1,'menu-list':index<menus.length-1&&index>0}">
|
||||||
<div v-if="index !== 0" style="border-bottom:1px solid #cccccc85"></div>
|
<div v-if="index !== 0" style="border-bottom:1px solid #cccccc85"></div>
|
||||||
<li :class="{'remove':item.operation==='remove'}" @click="menusOperations(item.operation)">
|
<li :class="{'remove':item.operation==='remove'}" @click="menusOperations(item.operation)">
|
||||||
<label class="menuitem"><svg-icon :icon-class="item.iconClass" /><span class="menuitem text">{{ item.label }}</span>
|
<div class="menuitem"><svg-icon :icon-class="item.iconClass" />
|
||||||
</label>
|
<span class="menuitem text">{{ item.label }}</span>
|
||||||
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</e-vue-contextmenu>
|
</e-vue-contextmenu>
|
||||||
@ -128,16 +134,17 @@
|
|||||||
import 'vant/lib/field/style';
|
import 'vant/lib/field/style';
|
||||||
import 'vant/lib/toast/style';
|
import 'vant/lib/toast/style';
|
||||||
import 'vant/lib/overlay/style';
|
import 'vant/lib/overlay/style';
|
||||||
|
import 'vant/lib/notify/style';
|
||||||
|
|
||||||
import { strlen, substring10, formatTime, formatSize } from '@/utils/number'
|
import { strlen, substring10, formatTime, formatSize } from '@/utils/number'
|
||||||
import api from '@/api/upload-api'
|
import api from '@/api/upload-api'
|
||||||
import IconFile from "../../../components/Icon/IconFile";
|
import IconFile from "../../../components/Icon/IconFile";
|
||||||
import Bus from '@/assets/js/bus'
|
import Bus from '@/assets/js/bus'
|
||||||
import { Toast } from 'vant';
|
import { Toast,Dialog,Notify } from 'vant';
|
||||||
import { getPath, getPathList, setPath, removePath } from '@/utils/path'
|
import { getPath, getPathList, setPath, removePath } from '@/utils/path'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {IconFile},
|
components: {IconFile,[Dialog.Component.name]: Dialog.Component},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
test: 0,
|
test: 0,
|
||||||
@ -165,6 +172,7 @@
|
|||||||
{ name: '新建文件夹' },
|
{ name: '新建文件夹' },
|
||||||
],
|
],
|
||||||
showNewFolder: false,
|
showNewFolder: false,
|
||||||
|
showRename: false,
|
||||||
newFolderName: '新建文件夹',
|
newFolderName: '新建文件夹',
|
||||||
Loop: null,
|
Loop: null,
|
||||||
isJustHideMenus: false,
|
isJustHideMenus: false,
|
||||||
@ -195,9 +203,7 @@
|
|||||||
tableLoading: false,
|
tableLoading: false,
|
||||||
newFolderLoading: false,
|
newFolderLoading: false,
|
||||||
renameLoading: false,
|
renameLoading: false,
|
||||||
menuTriangle: '', // 三角菜单
|
renameFileName: '',
|
||||||
cellMouseIndex: -1,
|
|
||||||
editingIndex: -1,
|
|
||||||
indexList: [],
|
indexList: [],
|
||||||
overlayShow: false,
|
overlayShow: false,
|
||||||
overlayContentClass: {}
|
overlayContentClass: {}
|
||||||
@ -274,12 +280,11 @@
|
|||||||
}
|
}
|
||||||
// 长按选择的数据
|
// 长按选择的数据
|
||||||
this.rowContextData = row
|
this.rowContextData = row
|
||||||
this.menuTriangle = ''
|
|
||||||
const offsetTop = target.offsetTop - row.scrollY
|
const offsetTop = target.offsetTop - row.scrollY
|
||||||
const e = {}
|
const e = {}
|
||||||
if ((offsetTop+(target.offsetHeight/2)) > document.body.offsetHeight/2) {
|
if ((offsetTop+(target.offsetHeight/2)) > document.body.offsetHeight/2) {
|
||||||
e.pageX = 50
|
e.pageX = 50
|
||||||
e.pageY = target.offsetTop - 288
|
e.pageY = target.offsetTop - 320
|
||||||
} else {
|
} else {
|
||||||
e.pageX = 50
|
e.pageX = 50
|
||||||
e.pageY = target.offsetTop + target.offsetHeight + 5
|
e.pageY = target.offsetTop + target.offsetHeight + 5
|
||||||
@ -314,16 +319,22 @@
|
|||||||
this.favoriteOperating(false)
|
this.favoriteOperating(false)
|
||||||
break
|
break
|
||||||
case 'details':
|
case 'details':
|
||||||
this.$notify.info({
|
Notify({
|
||||||
title: this.rowContextData.name,
|
message: this.rowContextData.name,
|
||||||
duration: 2000
|
color: '#ad0000',
|
||||||
})
|
background: '#ffe1e1',
|
||||||
|
duration: 1000
|
||||||
|
});
|
||||||
console.log('详情', this.rowContextData)
|
console.log('详情', this.rowContextData)
|
||||||
break
|
break
|
||||||
case 'rename':
|
case 'rename':
|
||||||
console.log('重命名')
|
console.log('重命名')
|
||||||
this.renameFileName = this.rowContextData.name
|
this.renameFileName = this.rowContextData.name
|
||||||
this.editingIndex = this.rowContextData.index
|
this.showRename = true
|
||||||
|
const that = this
|
||||||
|
setTimeout(function () {
|
||||||
|
that.$refs.renameInput.focus()
|
||||||
|
},0)
|
||||||
break
|
break
|
||||||
case 'copy':
|
case 'copy':
|
||||||
console.log('移动或复制')
|
console.log('移动或复制')
|
||||||
@ -341,6 +352,57 @@
|
|||||||
document.documentElement.style.overflow = null;
|
document.documentElement.style.overflow = null;
|
||||||
this.$refs.contextShow.hideMenu()
|
this.$refs.contextShow.hideMenu()
|
||||||
},
|
},
|
||||||
|
// 重命名
|
||||||
|
rowRename() {
|
||||||
|
const row = this.rowContextData
|
||||||
|
const newFileName = this.renameFileName
|
||||||
|
if (newFileName) {
|
||||||
|
if (!row.isFolder) {
|
||||||
|
const ext = '.' + row.suffix
|
||||||
|
if (!newFileName.endsWith(ext)) {
|
||||||
|
newFileName += ext
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('newFileName', newFileName)
|
||||||
|
|
||||||
|
this.renameLoading = true
|
||||||
|
const findIndex = this.fileList.findIndex(item => {
|
||||||
|
if(newFileName === item.name){
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
console.log(findIndex)
|
||||||
|
if(findIndex > -1){
|
||||||
|
let msg = '该文件已存在'
|
||||||
|
if(row.isFolder){
|
||||||
|
msg = '该文件夹已存在'
|
||||||
|
}
|
||||||
|
this.$message({
|
||||||
|
message: msg,
|
||||||
|
type: 'warning'
|
||||||
|
});
|
||||||
|
this.renameLoading = false
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
api.rename({
|
||||||
|
newFileName: newFileName,
|
||||||
|
username: this.$store.state.user.name,
|
||||||
|
id: row.id
|
||||||
|
}).then(res => {
|
||||||
|
if (res.data) {
|
||||||
|
this.renameLoading = false
|
||||||
|
row.name = newFileName
|
||||||
|
this.fileList[row.index] = row
|
||||||
|
this.editingIndex = -1
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.editingIndex = -1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 下载
|
||||||
downloadFile() {
|
downloadFile() {
|
||||||
let totalSize = 0
|
let totalSize = 0
|
||||||
this.selectRowData.forEach(item => {
|
this.selectRowData.forEach(item => {
|
||||||
@ -385,14 +447,15 @@
|
|||||||
fileIds.push(value.id)
|
fileIds.push(value.id)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
fileList = this.selectRowData
|
||||||
fileIds.push(this.selectRowData[0].id)
|
fileIds.push(this.selectRowData[0].id)
|
||||||
}
|
}
|
||||||
|
console.log(this.selectRowData[0])
|
||||||
const str = this.getShowSumFileAndFolder(fileList)
|
const str = this.getShowSumFileAndFolder(fileList)
|
||||||
|
|
||||||
this.$confirm('此操作将永久删除' + str + ', 是否继续?', '提示', {
|
Dialog.confirm({
|
||||||
confirmButtonText: '确定',
|
title: '提示',
|
||||||
cancelButtonText: '取消',
|
message: '此操作将永久删除' + str + ', 是否继续?'
|
||||||
type: 'warning'
|
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
api.delete({
|
api.delete({
|
||||||
username: this.$store.state.user.name,
|
username: this.$store.state.user.name,
|
||||||
@ -404,11 +467,8 @@
|
|||||||
} else {
|
} else {
|
||||||
this.getFileList()
|
this.getFileList()
|
||||||
}
|
}
|
||||||
this.$notify({
|
Toast.setDefaultOptions({ duration: 500 });
|
||||||
title: '删除成功',
|
Toast.success('删除成功');
|
||||||
type: 'success',
|
|
||||||
duration: 1000
|
|
||||||
})
|
|
||||||
this.$refs.fileListTable.clearSelection()// 删除后清空之前选择的数据
|
this.$refs.fileListTable.clearSelection()// 删除后清空之前选择的数据
|
||||||
this.selectRowData = []
|
this.selectRowData = []
|
||||||
})
|
})
|
||||||
@ -421,8 +481,7 @@
|
|||||||
},
|
},
|
||||||
touchStart(item){
|
touchStart(item){
|
||||||
// e.preventDefault();
|
// e.preventDefault();
|
||||||
Toast.setDefaultOptions({ duration: 500 });
|
// Toast.setDefaultOptions({ duration: 500 });
|
||||||
// Toast("手指触摸");
|
|
||||||
//手指触摸
|
//手指触摸
|
||||||
clearTimeout(this.Loop); //再次清空定时器,防止重复注册定时器
|
clearTimeout(this.Loop); //再次清空定时器,防止重复注册定时器
|
||||||
const that = this
|
const that = this
|
||||||
@ -433,12 +492,10 @@
|
|||||||
console.log(item)
|
console.log(item)
|
||||||
that.findListItem(item,e.targetTouches[0].target)
|
that.findListItem(item,e.targetTouches[0].target)
|
||||||
that.overlayShow = true
|
that.overlayShow = true
|
||||||
Toast("长按"+document.documentElement.style.overflow);
|
|
||||||
document.documentElement.style.overflow='hidden';
|
document.documentElement.style.overflow='hidden';
|
||||||
},500);
|
},500);
|
||||||
},
|
},
|
||||||
touchEnd(){
|
touchEnd(){
|
||||||
// Toast("手指离开");
|
|
||||||
//手指离开
|
//手指离开
|
||||||
clearTimeout(this.Loop);
|
clearTimeout(this.Loop);
|
||||||
},
|
},
|
||||||
@ -566,7 +623,9 @@
|
|||||||
pageSize: this.pagination.pageSize,
|
pageSize: this.pagination.pageSize,
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
if(onLoad){
|
if(onLoad){
|
||||||
res.data.forEach(file => {
|
res.data.forEach((file,number) => {
|
||||||
|
const index = (this.pagination.pageIndex-1) * this.pagination.pageSize + number
|
||||||
|
file['index'] = index
|
||||||
this.fileList.push(file)
|
this.fileList.push(file)
|
||||||
});
|
});
|
||||||
}else{
|
}else{
|
||||||
@ -729,11 +788,7 @@
|
|||||||
this.newFolderLoading = false
|
this.newFolderLoading = false
|
||||||
this.showNewFolder = false
|
this.showNewFolder = false
|
||||||
this.isShowNewFolder = false
|
this.isShowNewFolder = false
|
||||||
this.$notify({
|
Notify({ type: 'success', message: '新建文件夹成功', duration: 1000 });
|
||||||
title: '新建文件夹成功',
|
|
||||||
type: 'success',
|
|
||||||
duration: 1000
|
|
||||||
})
|
|
||||||
if (this.listModeSearch) {
|
if (this.listModeSearch) {
|
||||||
this.getFileListBySearchMode()
|
this.getFileListBySearchMode()
|
||||||
} else {
|
} else {
|
||||||
@ -972,8 +1027,9 @@
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
font-size: 16px;
|
font-size: 1em;
|
||||||
min-width: 136px;
|
min-width: 136px;
|
||||||
|
height: 3em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.newFileMenu .remove {
|
.newFileMenu .remove {
|
||||||
@ -1002,7 +1058,7 @@
|
|||||||
|
|
||||||
.newFileMenu li .menuitem {
|
.newFileMenu li .menuitem {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
line-height: 38px;
|
line-height: 3em;;
|
||||||
margin-left: 10%;
|
margin-left: 10%;
|
||||||
}
|
}
|
||||||
.newFileMenu li .menuitem .text {
|
.newFileMenu li .menuitem .text {
|
||||||
@ -1011,8 +1067,8 @@
|
|||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
}
|
}
|
||||||
.newFileMenu li .menuitem .svg-icon {
|
.newFileMenu li .menuitem .svg-icon {
|
||||||
width: 1.2rem;
|
width: 1rem;
|
||||||
height: 1.2rem;
|
height: 1rem;
|
||||||
}
|
}
|
||||||
/deep/ .ctx-menu-container {
|
/deep/ .ctx-menu-container {
|
||||||
top: unset;
|
top: unset;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user