提交 5f04d733 authored 作者: 龙菲's avatar 龙菲

下载、批量下载联调;新建文件接口联调

上级 2c86b025
...@@ -42,7 +42,11 @@ ...@@ -42,7 +42,11 @@
:title="`${scope.row.isDir ? '' : '点击预览'}`" :title="`${scope.row.isDir ? '' : '点击预览'}`"
style="width: 30px; max-height: 30px; cursor: pointer" style="width: 30px; max-height: 30px; cursor: pointer"
@click=" @click="
$file.handleFileNameClick(scope.row, scope.$index, sortedFileList) $file.handleFileNameClickNew(
scope.row,
scope.$index,
sortedFileList
)
" "
v-else v-else
/> />
...@@ -61,7 +65,11 @@ ...@@ -61,7 +65,11 @@
<template slot-scope="scope"> <template slot-scope="scope">
<span <span
@click=" @click="
$file.handleFileNameClick(scope.row, scope.$index, sortedFileList) $file.handleFileNameClickNew(
scope.row,
scope.$index,
sortedFileList
)
" "
> >
<span <span
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
> >
<li <li
class="right-menu-item" class="right-menu-item"
@click="$file.handleFileNameClick(selectedFile, 0, [selectedFile])" @click="$file.handleFileNameClickNew(selectedFile, 0, [selectedFile])"
v-if="seeBtnShow" v-if="seeBtnShow"
> >
<i class="el-icon-view"></i> 查看 <i class="el-icon-view"></i> 查看
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
:title="$file.getFileNameComplete(item)" :title="$file.getFileNameComplete(item)"
:style="`width: ${gridSize + 40}px; `" :style="`width: ${gridSize + 40}px; `"
:class="item.userFileId === selectedFile.userFileId ? 'active' : ''" :class="item.userFileId === selectedFile.userFileId ? 'active' : ''"
@click="$file.handleFileNameClick(item, index, fileListSorted)" @click="$file.handleFileNameClickNew(item, index, fileListSorted)"
@contextmenu.prevent="handleContextMenu(item, index, $event)" @contextmenu.prevent="handleContextMenu(item, index, $event)"
> >
<video <video
......
...@@ -292,8 +292,14 @@ export default { ...@@ -292,8 +292,14 @@ export default {
}, },
// 批量下载文件链接 // 批量下载文件链接
batchDownloadLink() { batchDownloadLink() {
const baseApi = "/api"; // return `${
return `${baseApi}/filetransfer/batchDownloadFile?userFileIds=${this.selectedFiles // process.env.VUE_APP_BASE_API
// }/filetransfer/batchDownloadFile?userFileIds=${this.selectedFiles
// .map((item) => item.userFileId)
// .join(",")}`;
return `${
process.env.VUE_APP_BASE_API
}/v1/api/folder/transfer/batchDownloadFile?userFileIds=${this.selectedFiles
.map((item) => item.userFileId) .map((item) => item.userFileId)
.join(",")}`; .join(",")}`;
}, },
......
...@@ -9,6 +9,7 @@ import { ...@@ -9,6 +9,7 @@ import {
markdownFileType markdownFileType
} from '@/libs/qiwen/map.js' } from '@/libs/qiwen/map.js'
import { officeFileType } from '@/libs/qiwen/map.js' import { officeFileType } from '@/libs/qiwen/map.js'
import { getViewUrlDbPath } from '@/api/wps'
// 全局函数 - 文件相关 // 全局函数 - 文件相关
const fileFunction = { const fileFunction = {
...@@ -286,8 +287,98 @@ const fileFunction = { ...@@ -286,8 +287,98 @@ const fileFunction = {
Number(router.currentRoute.query.fileType) === 4 ? currentIndex : 0 Number(router.currentRoute.query.fileType) === 4 ? currentIndex : 0
Vue.prototype.$openBox.audioPreview({ audioList, defaultIndex }) Vue.prototype.$openBox.audioPreview({ audioList, defaultIndex })
}, },
/**
* 文件预览——word使用wps预览,pdf使用pdf组件进行预览
* @description 若当前点击的为文件夹,则进入文件夹内部;若是文件,则进行相应的预览。
* @param {object} row 文件信息
* @param {number} currentIndex 当前文件索引
* @param {array} fileList 文件列表
*/
handleFileNameClickNew(row, currentIndex, fileList = []) {
// 如果当前文件在回收站中,则不允许预览
if (row.deleteFlag !== undefined && row.deleteFlag !== 0) {
return false
}
// 若是文件夹则进入该文件夹
if (row.isDir) {
// debugger
if (router.currentRoute.name === 'Share') {
// 当前是查看他人分享列表的页面
router.push({
query: {
filePath: `${row.shareFilePath === '/' ? '' : row.shareFilePath}/${row.fileName
}`
}
})
} else if (Number(router.currentRoute.query.fileType) === 8) {
// 当前是我的已分享列表页面
router.push({
query: {
fileType: 8,
filePath: `${row.shareFilePath === '/' ? '' : row.shareFilePath}/${row.fileName
}`,
shareBatchNum: row.shareBatchNum
}
})
} else if (Number(router.currentRoute.query.fileType) !== 6) {
// 回收站页面不允许打开文件夹
// 网盘页面
router.push({
query: {
filePath: `${row.filePath === '/' ? '' : row.filePath}/${row.fileName
}`,
fileType: router.currentRoute.query.fileType
}
})
}
} else {
const WORD = ['doc', 'docx']
const PDF = ['pdf']
// 若当前点击项是word
if (WORD.includes(row.extendName.toLowerCase())) {
let flag = false
// 根据当前路由判断,是否支持编辑,目前只要我的创作才能够编辑
console.log('router.currentRoute', router.currentRoute);
if (router.currentRoute.name === 'MyCreate') {
flag = true
}
console.log(123, row);
const { fileId, identifier } = row
const params = {
fileId: identifier,
flag
}
getViewUrlDbPath(params).then(res => {
if (res.data) {
console.log(res.data);
// 跳转 使用sessionStorage,避免关键信息在ip中暴露
// 使用push会停留当前页面,故不采纳
// params 传递参数,子组件无法渲染iframe组件,故不采纳
// localStorage.wpsUrl = res.data.wpsUrl
// localStorage.token = res.data.token
// let resolve = $el.$router.resolve({
// path: '/wpsReader',
// query: {
// wpsUrl: res.data.wpsUrl,
// token: res.data.token
// }
// })
// window.open(resolve.href, '_blank')
}
})
// router.push('/wpsReader')
return false
}
// 若当前点击项是pdf
if (PDF.includes(row.extendName.toLowerCase())) {
router.push('/pdfReader')
return false
}
}
},
/** /**
* 文件预览 * 文件预览——原始奇文的方法,使用的onlyoffice预览
* @description 若当前点击的为文件夹,则进入文件夹内部;若是文件,则进行相应的预览。 * @description 若当前点击的为文件夹,则进入文件夹内部;若是文件,则进行相应的预览。
* @param {object} row 文件信息 * @param {object} row 文件信息
* @param {number} currentIndex 当前文件索引 * @param {number} currentIndex 当前文件索引
......
...@@ -36,17 +36,17 @@ export const staticRouters = [ ...@@ -36,17 +36,17 @@ export const staticRouters = [
affix: false affix: false
} }
}, },
{ // {
path: 'myTemplate', // path: 'myTemplate',
component: () => import('@/views/mine/myTemplate/index.vue'), // component: () => import('@/views/mine/myTemplate/index.vue'),
name: 'MyTemplate', // name: 'MyTemplate',
meta: { // meta: {
title: '我的模板', // title: '我的模板',
icon: 'dashboard', // icon: 'dashboard',
noCache: false, // noCache: false,
affix: false // affix: false
} // }
}, // },
{ {
path: 'myCollect', path: 'myCollect',
component: () => import('@/views/mine/myCollect/index.vue'), component: () => import('@/views/mine/myCollect/index.vue'),
......
<template> <template>
<div>阅读wps</div> <div>
阅读wps
<div id="viewFile"></div>
</div>
</template> </template>
<script> <script>
export default {}; import WebOfficeSDK from "/public/weboffice/web-office-sdk-v1.1.8.es";
export default {
mounted() {
// this.getBookList();
console.log("WebOfficeSDK", WebOfficeSDK);
this.openWps(this.$route.query.wpsUrl, this.$route.query.token);
},
methods: {
async openWps(url, token) {
this.wps = WebOfficeSDK.config({
wpsUrl: url, // 如果需要通过js-sdk传递token方式鉴权,则需要包含_w_tokentype=1参数
mount: document.querySelector("#viewFile"),
});
this.wps.setToken({ token });
this.wps.ready();
},
},
};
</script> </script>
<style lang=""></style> <style lang=""></style>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论