💄 分享界面加入提取码

This commit is contained in:
jmal 2023-03-05 23:09:39 +08:00
parent a2abfa2dbd
commit c96ea30787

View File

@ -10,7 +10,7 @@
<span>{{ netdiskName }}</span> <span>{{ netdiskName }}</span>
</div> </div>
<div class="share-header-content sharer"> <div class="share-header-content sharer">
<span><span class="user">{{sharer.showName}}</span>的分享</span> <span><span class="user">{{ sharer.showName }}</span>的分享</span>
<el-avatar :src="sharerAvatarUrl"></el-avatar> <el-avatar :src="sharerAvatarUrl"></el-avatar>
</div> </div>
</div> </div>
@ -19,7 +19,8 @@
<transition-group name="breadcrumb"> <transition-group name="breadcrumb">
<el-breadcrumb-item v-for="(item,index) in pathList" :key="item.index"> <el-breadcrumb-item v-for="(item,index) in pathList" :key="item.index">
<span v-if="index===0">当前位置:</span> <span v-if="index===0">当前位置:</span>
<breadcrumb-file-path :pathList="pathList" :item="item" :index="index" @clickLink="handleLink"></breadcrumb-file-path> <breadcrumb-file-path :pathList="pathList" :item="item" :index="index"
@clickLink="handleLink"></breadcrumb-file-path>
</el-breadcrumb-item> </el-breadcrumb-item>
</transition-group> </transition-group>
<div class="search-content"> <div class="search-content">
@ -39,7 +40,9 @@
<div class="popper-arrow"></div> <div class="popper-arrow"></div>
<ul v-for="item in menus" :key="item.label"> <ul v-for="item in menus" :key="item.label">
<li class="menu-option" @click="menusOperations(item.operation)"> <li class="menu-option" @click="menusOperations(item.operation)">
<label class="menuitem"><svg-icon :icon-class="item.iconClass" /><span class="menuitem text">{{ item.label }}</span> <label class="menuitem">
<svg-icon :icon-class="item.iconClass"/>
<span class="menuitem text">{{ item.label }}</span>
</label> </label>
</li> </li>
</ul> </ul>
@ -47,7 +50,7 @@
<!--list布局--> <!--list布局-->
<el-table <el-table
v-show="!grid && !linkFailed" v-show="!grid && !linkFailed && !showShareCode"
ref="fileListTable" ref="fileListTable"
v-loading="tableLoading" v-loading="tableLoading"
style="width: 100%;margin: 20px 0 0 0;" style="width: 100%;margin: 20px 0 0 0;"
@ -100,7 +103,8 @@
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-col v-if="scope.row.index === editingIndex" :span="10"> <el-col v-if="scope.row.index === editingIndex" :span="10">
<el-input v-focus v-model="renameFileName" placeholder="" size="small" :clearable="true" @keyup.enter.native="rowRename(renameFileName, scope.row)"> <el-input v-focus v-model="renameFileName" placeholder="" size="small" :clearable="true"
@keyup.enter.native="rowRename(renameFileName, scope.row)">
</el-input> </el-input>
<el-button <el-button
v-loading="renameLoading" v-loading="renameLoading"
@ -122,16 +126,19 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column v-if="index === 3 && showUpdateDateItem" :key="index" width="50" :index="index" align="center" header-align="center"> <el-table-column v-if="index === 3 && showUpdateDateItem" :key="index" width="50" :index="index" align="center"
header-align="center">
</el-table-column> </el-table-column>
<el-table-column v-if="index === 4 && showUpdateDateItem" :key="index" width="50" :prop="item.name" :label="item.label" :index="index" class="el-icon-more" align="center" header-align="center"> <el-table-column v-if="index === 4 && showUpdateDateItem" :key="index" width="50" :prop="item.name"
:label="item.label" :index="index" class="el-icon-more" align="center" header-align="center">
<!-- 使用组件, 并传值到组件中 --> <!-- 使用组件, 并传值到组件中 -->
<template slot="header"> <template slot="header">
<svg-icon v-if="item.name !== ''" class="button-class" icon-class="more" @click="moreOperation($event)" /> <svg-icon v-if="item.name !== ''" class="button-class" icon-class="more" @click="moreOperation($event)"/>
</template> </template>
<template slot-scope="scope"> <template slot-scope="scope">
<svg-icon v-if="scope.row.index === cellMouseIndex" class="button-class" icon-class="more" @click="moreClick(scope.row,$event)" /> <svg-icon v-if="scope.row.index === cellMouseIndex" class="button-class" icon-class="more"
@click="moreClick(scope.row,$event)"/>
</template> </template>
</el-table-column> </el-table-column>
@ -148,7 +155,7 @@
header-align="left" header-align="left"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{formatSize(scope.row.size)}}</span> <span>{{ formatSize(scope.row.size) }}</span>
</template> </template>
</el-table-column> </el-table-column>
@ -165,19 +172,21 @@
header-align="left" header-align="left"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{scope.row.updateDate}}</span> <span>{{ scope.row.updateDate }}</span>
</template> </template>
</el-table-column> </el-table-column>
</template> </template>
</el-table> </el-table>
<!--grid布局--> <!--grid布局-->
<div v-show="grid && !linkFailed" v-loading="tableLoading" <div v-show="grid && !linkFailed && !showShareCode" v-loading="tableLoading"
element-loading-text="文件加载中" element-loading-text="文件加载中"
element-loading-spinner="el-icon-loading" element-loading-spinner="el-icon-loading"
element-loading-background="#f6f7fa88"> element-loading-background="#f6f7fa88">
<div class="checkbox-group-header"> <div class="checkbox-group-header">
<van-checkbox class="grid-all-checkbox" @click="clickGridAllCheckBox()" v-model="allChecked">{{indexList.length>0 ? '已选择 '+this.tableHead[2].label : "选择"}}</van-checkbox> <van-checkbox class="grid-all-checkbox" @click="clickGridAllCheckBox()" v-model="allChecked">
{{ indexList.length > 0 ? '已选择 ' + this.tableHead[2].label : "选择" }}
</van-checkbox>
<el-divider></el-divider> <el-divider></el-divider>
</div> </div>
@ -192,24 +201,47 @@
@click="gridItemClick(item,$event)" @click="gridItemClick(item,$event)"
@contextmenu.prevent="rowContextmenu(item)" @contextmenu.prevent="rowContextmenu(item)"
> >
<van-checkbox v-show="gridHoverItemIndex === index || indexList.includes(index)" class="grid-item-checkbox" :name="item" @click.stop="clickGridItemCheckBox(item,index)"/> <van-checkbox v-show="gridHoverItemIndex === index || indexList.includes(index)"
<div class="grid-item-icon"><icon-file :item="item" :image-url="imageUrl" :grid="true" :grid-width="gridColumnWidth" :public="true"></icon-file></div> class="grid-item-checkbox" :name="item" @click.stop="clickGridItemCheckBox(item,index)"/>
<span class="grid-item-text">{{item.name}}</span> <div class="grid-item-icon">
<icon-file :item="item" :image-url="imageUrl" :grid="true" :grid-width="gridColumnWidth"
:public="true"></icon-file>
</div>
<span class="grid-item-text">{{ item.name }}</span>
</div> </div>
</van-grid-item> </van-grid-item>
</van-grid> </van-grid>
</van-checkbox-group> </van-checkbox-group>
</div> </div>
<div v-if="linkFailed" class="share-header"> <div v-if="linkFailed && !showShareCode" class="share-header">
<p v-if="prompt !== ''">温馨提示:</p> <p v-if="prompt !== ''">温馨提示:</p>
<p>{{prompt}}</p> <p>{{ prompt }}</p>
</div> </div>
<sim-text-preview :file.sync="textPreviewRow" :shareId="shareId" :status.sync="textPreviewVisible"></sim-text-preview> <div v-if="showShareCode" class="share-content">
<image-viewer :fileList="fileList" :shareId="shareId" :file="imagePreviewRow" :status.sync="imagePreviewVisible"></image-viewer> <div class="share-icon">
<icon-file class="share-icon-font" :item="shareData" :grid="true" :details="true" :image-url="imageUrl"></icon-file>
</div>
<div class="share-filename">
<span>{{ shareData.fileName }}</span>
</div>
<div class="share-code">
<el-input v-model="extractionCode" placeholder="请输入提取码" clearable></el-input>
</div>
<div class="share-code-valid">
<el-button type="primary" :disabled="extractionCode.length === 0">查看文件</el-button>
</div>
</div>
<sim-text-preview :file.sync="textPreviewRow" :shareId="shareId"
:status.sync="textPreviewVisible"></sim-text-preview>
<image-viewer :fileList="fileList" :shareId="shareId" :file="imagePreviewRow"
:status.sync="imagePreviewVisible"></image-viewer>
<video-preview :file="videoPreviewRow" :shareId="shareId" :status.sync="videoPreviewVisible"></video-preview> <video-preview :file="videoPreviewRow" :shareId="shareId" :status.sync="videoPreviewVisible"></video-preview>
<office-preview :file="officePreviewRow" :shareId="shareId" :status.sync="officePreviewVisible"></office-preview> <office-preview :file="officePreviewRow" :shareId="shareId" :status.sync="officePreviewVisible"></office-preview>
<el-divider class="grid-divider" content-position="center"><i class="el-icon-folder-opened"></i>&nbsp;{{summaries}}</el-divider> <el-divider v-if="!showShareCode" class="grid-divider" content-position="center"><i
class="el-icon-folder-opened"></i>&nbsp;{{ summaries }}
</el-divider>
<el-pagination <el-pagination
background background
layout="prev, pager, next" layout="prev, pager, next"
@ -226,28 +258,29 @@
</template> </template>
<script> <script>
import { mapGetters } from 'vuex' import {mapGetters} from 'vuex'
import { formatTime, formatSize } from '@/utils/number' import {formatTime, formatSize} from '@/utils/number'
import Bus from '@/assets/js/bus' import Bus from '@/assets/js/bus'
import api from '@/api/file-api' import api from '@/api/file-api'
import BreadcrumbFilePath from "@/components/Breadcrumb/BreadcrumbFilePath"; import BreadcrumbFilePath from "@/components/Breadcrumb/BreadcrumbFilePath";
import IconFile from "@/components/Icon/IconFile"; import IconFile from "@/components/Icon/IconFile";
import AlLoading from "@/components/loading/AlLoading"; import AlLoading from "@/components/loading/AlLoading";
import { suffix } from '@/utils/file-type' import {suffix} from '@/utils/file-type'
import SimTextPreview from "@/components/preview/SimTextPreview"; import SimTextPreview from "@/components/preview/SimTextPreview";
import ImageViewer from "@/components/preview/ImageViewer"; import ImageViewer from "@/components/preview/ImageViewer";
import VideoPreview from "@/components/preview/VideoPreview"; import VideoPreview from "@/components/preview/VideoPreview";
import AudioPreview from "@/components/preview/AudioPreview"; import AudioPreview from "@/components/preview/AudioPreview";
import fileConfig from "@/utils/file-config"; import fileConfig from "@/utils/file-config";
import Clipboard from "clipboard"; import Clipboard from "clipboard";
import OfficePreview from "@/components/preview/OfficePreview"; import OfficePreview from "@/components/preview/OfficePreview";
import Logo from "@/components/Logo"; import Logo from "@/components/Logo";
export default {
export default {
components: { components: {
Logo, Logo,
OfficePreview, IconFile, BreadcrumbFilePath,AlLoading, OfficePreview, IconFile, BreadcrumbFilePath, AlLoading,
AudioPreview, VideoPreview, ImageViewer, SimTextPreview AudioPreview, VideoPreview, ImageViewer, SimTextPreview
}, },
data() { data() {
@ -270,7 +303,7 @@
pageIndex: 1, pageIndex: 1,
pageSize: 256, pageSize: 256,
total: 0, total: 0,
pageSizes: [10,20,30,40,50] pageSizes: [10, 20, 30, 40, 50]
}, },
indexList: [], indexList: [],
clientHeight: 500, clientHeight: 500,
@ -302,20 +335,20 @@
menusIsMultiple: false, menusIsMultiple: false,
menus: [], menus: [],
singleMenus: [ singleMenus: [
{ iconClass: 'menu-open', label: '打开', operation: 'open' }, {iconClass: 'menu-open', label: '打开', operation: 'open'},
{ iconClass: 'menu-download', label: '下载', operation: 'download' }, {iconClass: 'menu-download', label: '下载', operation: 'download'},
{ iconClass: 'menu-fuzhi', label: '复制下载连接', operation: 'copyDownloadUrl' }, {iconClass: 'menu-fuzhi', label: '复制下载连接', operation: 'copyDownloadUrl'},
], ],
singleMenusEdit: [ singleMenusEdit: [
{ iconClass: 'menu-open', label: '打开', operation: 'open' }, {iconClass: 'menu-open', label: '打开', operation: 'open'},
{ iconClass: 'menu-download', label: '下载', operation: 'download' }, {iconClass: 'menu-download', label: '下载', operation: 'download'},
{ iconClass: 'menu-fuzhi', label: '复制下载连接', operation: 'copyDownloadUrl' }, {iconClass: 'menu-fuzhi', label: '复制下载连接', operation: 'copyDownloadUrl'},
], ],
multipleMenus: [ multipleMenus: [
{ iconClass: 'menu-download', label: '下载', operation: 'download' }, {iconClass: 'menu-download', label: '下载', operation: 'download'},
], ],
multipleRightMenus: [ multipleRightMenus: [
{ iconClass: 'menu-download', label: '下载', operation: 'download' }, {iconClass: 'menu-download', label: '下载', operation: 'download'},
], ],
rowContextData: {}, rowContextData: {},
selectRowData: [], selectRowData: [],
@ -335,8 +368,8 @@
}, },
dragLoop: null, dragLoop: null,
positionX:0, positionX: 0,
positionY:0, positionY: 0,
grid: false, grid: false,
vmode: 'list', vmode: 'list',
gridColumnNum: -1, gridColumnNum: -1,
@ -352,10 +385,10 @@
shareId: this.$route.query.s, shareId: this.$route.query.s,
currentDirName: '', currentDirName: '',
linkFailed: true, linkFailed: true,
textPreviewVisible : false, textPreviewVisible: false,
textPreviewRow: {}, textPreviewRow: {},
imagePreviewRow: {}, imagePreviewRow: {},
imagePreviewVisible : false, imagePreviewVisible: false,
videoPreviewRow: {}, videoPreviewRow: {},
videoPreviewVisible: false, videoPreviewVisible: false,
officePreviewRow: {}, officePreviewRow: {},
@ -367,7 +400,10 @@
sharer: {},//分享者信息 sharer: {},//分享者信息
sharerAvatarUrl: '', sharerAvatarUrl: '',
netdiskName: 'JmalCloud', netdiskName: 'JmalCloud',
netdiskLogo: '' netdiskLogo: '',
showShareCode: false,
shareData: {},
extractionCode: ''
} }
}, },
computed: { computed: {
@ -405,7 +441,7 @@
} }
// 加载布局 // 加载布局
if(this.$route.query.vmode){ if (this.$route.query.vmode) {
this.vmode = this.$route.query.vmode this.vmode = this.$route.query.vmode
this.grid = this.vmode !== 'list'; this.grid = this.vmode !== 'list';
} }
@ -426,6 +462,7 @@
resize: { // 指令的名称 resize: { // 指令的名称
bind(el, binding) { // el为绑定的元素,binding为绑定给指令的对象 bind(el, binding) { // el为绑定的元素,binding为绑定给指令的对象
let width = '', height = ''; let width = '', height = '';
function isReize() { function isReize() {
const style = document.defaultView.getComputedStyle(el); const style = document.defaultView.getComputedStyle(el);
if (width !== style.width || height !== style.height) { if (width !== style.width || height !== style.height) {
@ -434,6 +471,7 @@
width = style.width; width = style.width;
height = style.height; height = style.height;
} }
el.__vueSetInterval__ = setInterval(isReize, 300); el.__vueSetInterval__ = setInterval(isReize, 300);
}, },
unbind(el) { unbind(el) {
@ -442,32 +480,32 @@
} }
}, },
methods: { methods: {
loadClientHeight(){ loadClientHeight() {
this.clientHeight = document.documentElement.clientHeight - 200 this.clientHeight = document.documentElement.clientHeight - 200
}, },
gridItemHover(item,index) { gridItemHover(item, index) {
this.gridHoverItemIndex = index; this.gridHoverItemIndex = index;
this.gridHoverIntermediate = index; this.gridHoverIntermediate = index;
}, },
gridItemOut(item,index) { gridItemOut(item, index) {
this.gridHoverIntermediate = -1 this.gridHoverIntermediate = -1
const _this = this const _this = this
setTimeout(function () { setTimeout(function () {
if(_this.gridHoverIntermediate !== _this.gridHoverItemIndex){ if (_this.gridHoverIntermediate !== _this.gridHoverItemIndex) {
_this.gridHoverItemIndex = -1; _this.gridHoverItemIndex = -1;
} }
},10) }, 10)
}, },
clickGridItemCheckBox(item,index) { clickGridItemCheckBox(item, index) {
// 同步列表的checkbox // 同步列表的checkbox
if(this.indexList.includes(index)){ if (this.indexList.includes(index)) {
this.$refs.fileListTable.toggleRowSelection(item, true) this.$refs.fileListTable.toggleRowSelection(item, true)
} }
}, },
clickGridAllCheckBox() { clickGridAllCheckBox() {
if(this.indexList.length !== this.fileList.length){ if (this.indexList.length !== this.fileList.length) {
this.$refs.checkboxGroup.toggleAll(true); this.$refs.checkboxGroup.toggleAll(true);
}else{ } else {
this.$refs.checkboxGroup.toggleAll(); this.$refs.checkboxGroup.toggleAll();
this.$refs.fileListTable.clearSelection(); this.$refs.fileListTable.clearSelection();
} }
@ -475,7 +513,7 @@
gridItemClick(row, e) { gridItemClick(row, e) {
const elPath = e.path || (e.composedPath && e.composedPath()) const elPath = e.path || (e.composedPath && e.composedPath())
let findIndex = elPath.findIndex(el => el.className === 'grid-item-checkbox van-checkbox') let findIndex = elPath.findIndex(el => el.className === 'grid-item-checkbox van-checkbox')
if (findIndex > -1){ if (findIndex > -1) {
return return
} }
if (this.indexList.length < 1) { if (this.indexList.length < 1) {
@ -484,16 +522,16 @@
this.editingIndex = -1 this.editingIndex = -1
} }
} else { } else {
if(this.indexList.includes(row.index)){ if (this.indexList.includes(row.index)) {
this.$refs.fileListTable.toggleRowSelection(row,false) this.$refs.fileListTable.toggleRowSelection(row, false)
}else{ } else {
this.$refs.fileListTable.toggleRowSelection(row,true) this.$refs.fileListTable.toggleRowSelection(row, true)
} }
} }
}, },
containerResize() { containerResize() {
let clientWidth = document.querySelector(".dashboard-container").clientWidth let clientWidth = document.querySelector(".dashboard-container").clientWidth
this.gridColumnNum = Math.round((clientWidth-10)/135) this.gridColumnNum = Math.round((clientWidth - 10) / 135)
this.gridColumnWidth = (clientWidth - 11 * this.gridColumnNum) / this.gridColumnNum - 4.5 this.gridColumnWidth = (clientWidth - 11 * this.gridColumnNum) / this.gridColumnNum - 4.5
}, },
// 格式化最近时间 // 格式化最近时间
@ -505,26 +543,26 @@
return formatSize(size) return formatSize(size)
}, },
// 浏览器的返回事件 // 浏览器的返回事件
goBack(){ goBack() {
const linkIndex = this.pathList.length-3 const linkIndex = this.pathList.length - 3
this.handleLink(this.pathList[linkIndex],linkIndex) this.handleLink(this.pathList[linkIndex], linkIndex)
}, },
handleLink(item, index) { handleLink(item, index) {
if(index === 0){ if (index === 0) {
this.pathList.splice(this.pathList.findIndex((v,i) => i === index + 1), this.pathList.length - (index + 1)) this.pathList.splice(this.pathList.findIndex((v, i) => i === index + 1), this.pathList.length - (index + 1))
this.getFileList(null,true); this.getFileList(null, true);
this.$router.push(`/s?s=${this.shareId}&vmode=${this.vmode}`) this.$router.push(`/s?s=${this.shareId}&vmode=${this.vmode}`)
} }
if(item && item.fileId){ if (item && item.fileId) {
this.accessShareOpenDir(item.fileId) this.accessShareOpenDir(item.fileId)
this.pathList.splice(this.pathList.findIndex((v,i) => i === index + 1), this.pathList.length - (index + 1)) this.pathList.splice(this.pathList.findIndex((v, i) => i === index + 1), this.pathList.length - (index + 1))
} }
}, },
// 切换布局 // 切换布局
changeVmode(){ changeVmode() {
this.grid = !this.grid this.grid = !this.grid
this.vmode = 'list' this.vmode = 'list'
if(this.grid){ if (this.grid) {
this.vmode = 'grid' this.vmode = 'grid'
} }
let f = '' let f = ''
@ -544,31 +582,86 @@
this.listModeSearch = true this.listModeSearch = true
this.pagination.fileId = fileId this.pagination.fileId = fileId
this.pagination['total'] = res.count this.pagination['total'] = res.count
this.$nextTick(()=>{ this.$nextTick(() => {
this.containerResize() this.containerResize()
this.tableLoading = false this.tableLoading = false
this.linkFailed = false this.linkFailed = false
}) })
}).catch(e => {}) }).catch(e => {
})
}, },
getFileList(pagination,overload) { getFileList(pagination, overload) {
this.tableLoading = true this.tableLoading = true
api.accessShare({ api.accessShare({
share:this.shareId, share: this.shareId,
pageIndex: this.pagination.pageIndex, pageIndex: this.pagination.pageIndex,
pageSize: this.pagination.pageSize pageSize: this.pagination.pageSize
}).then(res => { }).then(res => {
this.isLoading = false this.isLoading = false
if(Object.getPrototypeOf(res.data) === String.prototype){ if (Object.getPrototypeOf(res.data) === String.prototype) {
this.prompt = '该链接已失效' this.prompt = '该链接已失效'
}else{ } else {
let userId = null
if (res.data.isPrivacy) {
this.showShareCode = true
userId = res.data.userId
this.shareData = res.data
console.log('shareData', this.shareData)
} else {
this.fileList = res.data this.fileList = res.data
this.fileList.map((item,index) => { this.fileList.map((item, index) => {
item.index = index item.index = index
}) })
if(this.fileList.length > 0) { if (this.fileList.length > 0) {
api.getSharer({userId: this.fileList[0].userId}).then(res => { userId = this.fileList[0].userId
}
}
if (userId !== null) {
this.getSharer(userId)
}
if (this.fileList.length > 0) {
this.loadShareFileList(pagination, overload, res.count)
}
}
}).catch(() => {
this.tableLoading = false
this.linkFailed = true
this.isLoading = false
})
},
loadShareFileList(pagination, overload, resCount) {
this.loadClientHeight()
this.listModeSearch = false
this.listModeSearchOpenDir = false
this.pagination['total'] = resCount
this.$nextTick(() => {
this.containerResize()
this.tableLoading = false
this.linkFailed = false
})
if (!pagination) {
const pathList = this.fileList[0].path.split('/');
this.currentDirName = pathList[pathList.length - 2]
}
this.$nextTick(() => {
this.containerResize()
this.tableLoading = false
this.linkFailed = false
if (!pagination) {
// 打开文件夹
const item = {}
item['folder'] = this.currentDirName
item['index'] = this.pathList.length
if (!overload) {
this.pathList.push(item)
}
}
})
},
getSharer(userId) {
api.getSharer({userId: userId}).then(res => {
this.sharer = res.data this.sharer = res.data
console.log('this.sharer', this.sharer)
this.sharerAvatarUrl = window.location.origin + this.imageUrl + res.data.avatar this.sharerAvatarUrl = window.location.origin + this.imageUrl + res.data.avatar
if (this.sharer.netdiskName) { if (this.sharer.netdiskName) {
this.netdiskName = this.sharer.netdiskName this.netdiskName = this.sharer.netdiskName
@ -578,45 +671,12 @@
} }
this.$store.dispatch('user/setLogo', {netdiskName: this.netdiskName, netdiskLogo: this.netdiskLogo}) this.$store.dispatch('user/setLogo', {netdiskName: this.netdiskName, netdiskLogo: this.netdiskLogo})
}) })
}
this.loadClientHeight()
this.listModeSearch = false
this.listModeSearchOpenDir = false
this.pagination['total'] = res.count
this.$nextTick(()=>{
this.containerResize()
this.tableLoading = false
this.linkFailed = false
})
if(!pagination){
const pathList = this.fileList[0].path.split('/');
this.currentDirName = pathList[pathList.length-2]
}
this.$nextTick(()=>{
this.containerResize()
this.tableLoading = false
this.linkFailed = false
if(!pagination){
// 打开文件夹
const item = {}
item['folder'] = this.currentDirName
item['index'] = this.pathList.length
if(!overload){
this.pathList.push(item)
}
}
})
}
}).catch(() => {
this.tableLoading = false
this.linkFailed = true
})
}, },
currentChange(pageIndex) { currentChange(pageIndex) {
this.pagination.pageIndex = pageIndex this.pagination.pageIndex = pageIndex
if(this.pagination.fileId){ if (this.pagination.fileId) {
this.accessShareOpenDir(this.pagination.fileId) this.accessShareOpenDir(this.pagination.fileId)
}else{ } else {
this.getFileList(true) this.getFileList(true)
} }
}, },
@ -679,7 +739,7 @@
} }
row.forEach(r => { row.forEach(r => {
this.$refs.fileListTable.toggleRowSelection(r,true) this.$refs.fileListTable.toggleRowSelection(r, true)
}); });
const item_name = this.tableHead[2] const item_name = this.tableHead[2]
@ -707,25 +767,25 @@
item_date.label = '修改日期' item_date.label = '修改日期'
item_date.sortable = true item_date.sortable = true
} }
if(this.indexList.length === this.fileList.length){ if (this.indexList.length === this.fileList.length) {
this.allChecked = true this.allChecked = true
}else{ } else {
this.allChecked = false this.allChecked = false
} }
}, },
// cell-style 通过返回值可以实现样式变换利用传递过来的数组index循环改变样式 // cell-style 通过返回值可以实现样式变换利用传递过来的数组index循环改变样式
rowRed({ row, column, rowIndex, columnIndex }) { rowRed({row, column, rowIndex, columnIndex}) {
if (this.indexList.length < 1 && columnIndex === 2 && this.cellMouseIndex === rowIndex) { if (this.indexList.length < 1 && columnIndex === 2 && this.cellMouseIndex === rowIndex) {
return { cursor: 'pointer', color: "#19ACF9" } return {cursor: 'pointer', color: "#19ACF9"}
} }
for (let i = 0; i < this.indexList.length; i++) { for (let i = 0; i < this.indexList.length; i++) {
if (rowIndex === this.indexList[i]) { if (rowIndex === this.indexList[i]) {
return { backgroundColor: '#baebff91', cursor: 'default' } return {backgroundColor: '#baebff91', cursor: 'default'}
} }
} }
}, },
// 动态添加index到row里面去 // 动态添加index到row里面去
tableRowClassName({ row, rowIndex }) { tableRowClassName({row, rowIndex}) {
row.index = rowIndex row.index = rowIndex
}, },
// 选择某行预备数据 // 选择某行预备数据
@ -737,7 +797,7 @@
}, },
// 单元格hover进入时时间 // 单元格hover进入时时间
cellMouseEnter(row) { cellMouseEnter(row) {
if(this.editingIndex === -1){ if (this.editingIndex === -1) {
if (this.indexList.length < 1) { if (this.indexList.length < 1) {
this.cellMouseIndex = row.index this.cellMouseIndex = row.index
} }
@ -750,7 +810,7 @@
// 单元格点击事件 // 单元格点击事件
cellClick(row, column) { cellClick(row, column) {
clearTimeout(this.Loop); clearTimeout(this.Loop);
if(this.editingIndex === -1) { if (this.editingIndex === -1) {
const columnIndex = column.index const columnIndex = column.index
if (columnIndex === 0) { if (columnIndex === 0) {
// 点击选中 // 点击选中
@ -781,9 +841,9 @@
// 更多操作(单选) // 更多操作(单选)
moreClick(row, event) { moreClick(row, event) {
this.menusIsMultiple = false this.menusIsMultiple = false
if(row.contentType && row.contentType.includes("text")){ if (row.contentType && row.contentType.includes("text")) {
this.menus = this.singleMenusEdit this.menus = this.singleMenusEdit
}else{ } else {
this.menus = this.singleMenus this.menus = this.singleMenus
} }
// this.showOperationMenus(event) // this.showOperationMenus(event)
@ -797,9 +857,9 @@
this.menus = this.multipleRightMenus this.menus = this.multipleRightMenus
} else { } else {
this.menusIsMultiple = false this.menusIsMultiple = false
if(row.contentType && row.contentType.includes("text")){ if (row.contentType && row.contentType.includes("text")) {
this.menus = this.singleMenusEdit this.menus = this.singleMenusEdit
}else{ } else {
this.menus = this.singleMenus this.menus = this.singleMenus
} }
this.preliminaryRowData(row) this.preliminaryRowData(row)
@ -838,7 +898,7 @@
hide() { hide() {
const that = this const that = this
this.isJustHideMenus = true this.isJustHideMenus = true
setTimeout(function() { setTimeout(function () {
that.isJustHideMenus = false that.isJustHideMenus = false
}, 100) }, 100)
}, },
@ -859,11 +919,11 @@
}, },
downloadFile(copy) { downloadFile(copy) {
let totalSize = 0 let totalSize = 0
if(this.indexList.length > 0){ if (this.indexList.length > 0) {
this.selectRowData.forEach(item => { this.selectRowData.forEach(item => {
totalSize += item.size totalSize += item.size
}) })
}else{ } else {
totalSize = this.rowContextData.size totalSize = this.rowContextData.size
} }
if (totalSize > 0) { if (totalSize > 0) {
@ -875,22 +935,22 @@
} else { } else {
fileIds.push(this.rowContextData.id) fileIds.push(this.rowContextData.id)
} }
if (fileIds.length > 1 || this.rowContextData.isFolder){ if (fileIds.length > 1 || this.rowContextData.isFolder) {
if(copy){ if (copy) {
this.copyDownloadLink(fileConfig.publicPackageDownloadUrl(this.shareId, fileIds)) this.copyDownloadLink(fileConfig.publicPackageDownloadUrl(this.shareId, fileIds))
} else { } else {
fileConfig.publicPackageDownload(this.shareId, fileIds) fileConfig.publicPackageDownload(this.shareId, fileIds)
} }
return return
} }
if(copy){ if (copy) {
if (this.rowContextData.isShare) { if (this.rowContextData.isShare) {
this.copyDownloadLink(window.location.origin + fileConfig.previewUrl(this.sharer.username, this.rowContextData)) this.copyDownloadLink(window.location.origin + fileConfig.previewUrl(this.sharer.username, this.rowContextData))
} else { } else {
this.copyDownloadLink(fileConfig.publicPackageDownloadUrl(this.shareId, fileIds)) this.copyDownloadLink(fileConfig.publicPackageDownloadUrl(this.shareId, fileIds))
} }
} else { } else {
fileConfig.publicDownload( this.shareId, this.rowContextData) fileConfig.publicDownload(this.shareId, this.rowContextData)
} }
} else { } else {
this.$message({ this.$message({
@ -902,18 +962,18 @@
// 复制下载连接 // 复制下载连接
copyDownloadLink(url) { copyDownloadLink(url) {
let clipboard = new Clipboard('.menu-option', { let clipboard = new Clipboard('.menu-option', {
text: function (){ text: function () {
return url return url
} }
}) })
clipboard.on('success', e => { clipboard.on('success', e => {
this.$message({message: '复制成功',type: 'success',duration: 1000}); this.$message({message: '复制成功', type: 'success', duration: 1000});
// 释放内存 // 释放内存
clipboard.destroy() clipboard.destroy()
}) })
clipboard.on('error', e => { clipboard.on('error', e => {
// 不支持复制 // 不支持复制
this.$message({message: '该浏览器不支持自动复制',type: 'warning',duration: 1000}); this.$message({message: '该浏览器不支持自动复制', type: 'warning', duration: 1000});
clipboard.destroy() clipboard.destroy()
}) })
}, },
@ -931,31 +991,31 @@
this.$router.push(`/s?s=${this.shareId}&vmode=${this.vmode}`) this.$router.push(`/s?s=${this.shareId}&vmode=${this.vmode}`)
this.accessShareOpenDir(row.id) this.accessShareOpenDir(row.id)
} else { } else {
if(row.contentType.startsWith('image')){ if (row.contentType.startsWith('image')) {
// 图片 // 图片
this.imagePreviewVisible = true this.imagePreviewVisible = true
this.imagePreviewRow = row this.imagePreviewRow = row
return return
} }
if(suffix.simText.includes(row.suffix)){ if (suffix.simText.includes(row.suffix)) {
// 文本文件 // 文本文件
this.textPreviewRow = row this.textPreviewRow = row
this.textPreviewVisible = true this.textPreviewVisible = true
return return
} }
if(row.contentType.indexOf('video') > -1){ if (row.contentType.indexOf('video') > -1) {
// 视频文件 // 视频文件
this.videoPreviewVisible = true this.videoPreviewVisible = true
this.videoPreviewRow = row this.videoPreviewRow = row
return return
} }
// 音频文件 // 音频文件
if(row.contentType.indexOf('audio') > -1){ if (row.contentType.indexOf('audio') > -1) {
Bus.$emit('onAddAudio',row, this.audioCoverUrl) Bus.$emit('onAddAudio', row, this.audioCoverUrl)
return return
} }
// office文件 // office文件
if (row.contentType.indexOf('office') > -1 || ['pdf','csv','drawio','mind'].includes(row.suffix)) { if (row.contentType.indexOf('office') > -1 || ['pdf', 'csv', 'drawio', 'mind'].includes(row.suffix)) {
// office文件 // office文件
this.officePreviewVisible = true this.officePreviewVisible = true
this.officePreviewRow = row this.officePreviewRow = row
@ -966,78 +1026,133 @@
} }
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "src/styles/home-index"; @import "src/styles/home-index";
/*.el-breadcrumb {*/ /*.el-breadcrumb {*/
/*margin: 50px;*/ /*margin: 50px;*/
.dashboard-container { .dashboard-container {
min-width: 1024px; min-width: 1024px;
margin: 10px 0; margin: 10px 0;
} }
.header-location {
.header-location {
display: block; display: block;
height: 1px; height: 1px;
width: 100%; width: 100%;
margin: 0px 0; margin: 0px 0;
} }
.search-class { .search-class {
padding: 3px; padding: 3px;
} }
.share-h {
.share-h {
padding: 0 15px; padding: 0 15px;
} }
.share-header {
.share-header {
height: 45px; height: 45px;
.logo { .logo {
font-size: 20px; font-size: 20px;
} }
.share-header-content { .share-header-content {
display: flex; display: flex;
align-items: center; align-items: center;
svg { svg {
font-size: 2rem; font-size: 2rem;
} }
span { span {
margin-left: 10px; margin-left: 10px;
} }
} }
.sharer { .sharer {
font-size: 14px; font-size: 14px;
float: right; float: right;
top: 10px; top: 10px;
margin-top: -34px; margin-top: -34px;
>>>.el-avatar {
> > > .el-avatar {
margin: 0 0 0 10px; margin: 0 0 0 10px;
} }
.user { .user {
font-weight: 600; font-weight: 600;
} }
} }
} }
>>>.el-table{
> > > .el-table {
&::before { &::before {
width: auto; width: auto;
} }
.el-table__footer-wrapper { .el-table__footer-wrapper {
display: none; display: none;
} }
} }
.grid-divider {
.grid-divider {
height: 0; height: 0;
text-align: center; text-align: center;
width: auto; width: auto;
>>>.el-divider__text {
> > > .el-divider__text {
} }
>>>.el-divider__text.is-center {
> > > .el-divider__text.is-center {
position: relative; position: relative;
} }
} }
.newFileMenu li>.menuitem>.text {
.newFileMenu li > .menuitem > .text {
margin-left: 10px; margin-left: 10px;
}
.share-content {
display: flex;
-ms-flex-direction: column;
flex-direction: column;
-ms-flex-align: center;
align-items: center;
}
.share-icon {
margin: 20px 0 20px 0;
>>> .icon-favorite {
display: none;
} }
>>> .icon-share {
display: none;
}
.share-icon-font >>> .svg-icon {
font-size: 8rem;
}
}
.share-filename {
margin: 25px 0 50px 0;
}
.share-code {
>>> .el-input {
width: 200px;
}
}
.share-code-valid {
margin-top: 20px;
>>> .el-button {
width: 200px;
}
}
</style> </style>