Browse Source

对onlyoffice的参数base64编码

space_permission
han2015 3 months ago
parent
commit
7d0d1bf34a
  1. 2
      src/assets/icons/img-icon.svg
  2. 43
      src/views/doc/manage.vue
  3. 2
      src/views/doc/onlyoffice.vue
  4. 2
      src/views/doc/recentVisited.vue
  5. 14
      src/views/doc/share.vue
  6. 15
      src/views/doc/space.vue

2
src/assets/icons/img-icon.svg

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
<svg width="800px" height="800px" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"><title>file_type_image</title><path d="M30,5.851Q30,16,30,26.149H2Q2,16,2,5.851H30" style="fill:#2dcc9f"/><path d="M24.232,8.541a2.2,2.2,0,1,0,1.127.623,2.212,2.212,0,0,0-1.127-.623" style="fill:#fff"/><path d="M18.111,20.1q-2.724-3.788-5.45-7.575Q8.619,18.147,4.579,23.766q5.449,0,10.9,0,1.316-1.832,2.634-3.663" style="fill:#fff"/><path d="M22.057,16q-2.793,3.882-5.584,7.765,5.584,0,11.169,0Q24.851,19.882,22.057,16Z" style="fill:#fff"/></svg>

After

Width:  |  Height:  |  Size: 654 B

43
src/views/doc/manage.vue

@ -440,7 +440,7 @@ function onPrivateView(row:matterInfo){
const info =btoa(encodeURIComponent(`${row.name}`)) // const info =btoa(encodeURIComponent(`${row.name}`)) //
const _url=`${siteHost}${apiURL}/alien/download/${row.uuid}/${row.name}?access_token=${_token}` const _url=`${siteHost}${apiURL}/alien/download/${row.uuid}/${row.name}?access_token=${_token}`
//fileurl //fileurl
window.open(`/#/onlyoffice?name=${row.name}&dtype=${_type}&info=${info}&fileurl=`+encodeURIComponent(_url),"_blank") window.open(`/#/onlyoffice?name=${row.name}&dtype=${_type}&info=${info}&fileurl=`+window.btoa(encodeURIComponent(_url)),"_blank")
return return
} }
@ -453,6 +453,33 @@ function onPrivateView(row:matterInfo){
}) })
} }
//onlyoffice线
async function onlyOfficeEdit(row:matterInfo){
const _type=fileType(row.name!)
if(_type===""){
alert("暂不支持该类型编辑")
return
}
let _token=document.cookie.match(/hxpan=([\w-]*)/)
if (_token&&_token.length>1){
_token=_token[1]
}
ElMessageBox.confirm("线上资源有限,确定继续线上编辑吗", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(()=>{
//office file
//base64 encode for MASK
const _verify = btoa(row.uuid.match(/(\w+-\w+)/)![0]+"true") //
const info =btoa(encodeURIComponent(`${row.userUuid}/root${row.path}`)) //
const _url=`${siteHost}${apiURL}/alien/download/${row.uuid}/${row.name}?access_token=${_token}`
window.open(`/#/onlyoffice?name=${row.name}&dtype=${_type}&info=${info}&verify=${_verify}&fileurl=`+window.btoa(encodeURIComponent(_url)),"_blank")
})
}
//--------------UPGRADE: multy file upload section---------------- //--------------UPGRADE: multy file upload section----------------
//, 使html //, 使html
@ -756,7 +783,7 @@ const handleSelectionChange = (val:matterInfo[]) => {
<el-button size="small" :icon="View" circle @click="onPrivateView(scope.row)"></el-button> <el-button size="small" :icon="View" circle @click="onPrivateView(scope.row)"></el-button>
<el-button size="small" :icon="Share" circle @click="onShareMatter(scope.row)"></el-button> <el-button size="small" :icon="Share" circle @click="onShareMatter(scope.row)"></el-button>
<el-button size="small" :icon="Download" circle @click="onDownload(scope.row)"></el-button> <el-button size="small" :icon="Download" circle @click="onDownload(scope.row)"></el-button>
<!-- <el-button size="small" :icon="Edit" circle @click="onMatterRename(scope.row)"></el-button> --> <el-button size="small" :icon="Edit" circle @click="onlyOfficeEdit(scope.row)"></el-button>
<el-button size="small" :icon="Delete" circle @click="onDelMatter(scope.row)"></el-button> <el-button size="small" :icon="Delete" circle @click="onDelMatter(scope.row)"></el-button>
</div> </div>
</template> </template>
@ -772,7 +799,7 @@ const handleSelectionChange = (val:matterInfo[]) => {
<div class="table-grid" v-else> <div class="table-grid" v-else>
<div class="grid-item" v-for="row in matterList"> <div class="grid-item" v-for="row in matterList">
<div class="grid"> <div class="grid">
<div class="grid-box" @mouseover="handleMouseEnter(row)"> <div class="grid-box" @click="handleMouseEnter(row)">
<svg-icon v-if="row.dir" icon-class="folder-icon" size="80px"/> <svg-icon v-if="row.dir" icon-class="folder-icon" size="80px"/>
<el-image v-else-if="getFileIcon(row.name)==='img'" style="width: 80px;" :preview-src-list="[getImageDownloadURL(row.uuid,row.name)]" :src="getImagePreivewURL(row.uuid,row.name)" /> <el-image v-else-if="getFileIcon(row.name)==='img'" style="width: 80px;" :preview-src-list="[getImageDownloadURL(row.uuid,row.name)]" :src="getImagePreivewURL(row.uuid,row.name)" />
<svg-icon v-else :icon-class="getFileIcon(row.name)+'-icon'" size="80px"/> <svg-icon v-else :icon-class="getFileIcon(row.name)+'-icon'" size="80px"/>
@ -783,6 +810,7 @@ const handleSelectionChange = (val:matterInfo[]) => {
<el-button v-if="getFileIcon(row.name)!='img'" size="small" :icon="View" circle @click="onPrivateView(row)"></el-button> <el-button v-if="getFileIcon(row.name)!='img'" size="small" :icon="View" circle @click="onPrivateView(row)"></el-button>
<el-button size="small" :icon="Share" circle @click="onShareMatter(row)"></el-button> <el-button size="small" :icon="Share" circle @click="onShareMatter(row)"></el-button>
<el-button size="small" :icon="Download" circle @click="onDownload(row)"></el-button> <el-button size="small" :icon="Download" circle @click="onDownload(row)"></el-button>
<el-button size="small" :icon="Edit" circle @click="onlyOfficeEdit(row)"></el-button>
<el-button size="small" :icon="Delete" circle @click="onDelMatter(row)"></el-button> <el-button size="small" :icon="Delete" circle @click="onDelMatter(row)"></el-button>
</div> </div>
</div> </div>
@ -862,6 +890,7 @@ const handleSelectionChange = (val:matterInfo[]) => {
display: flex; display: flex;
flex-wrap: wrap; /* 关键属性,允许子元素自动换行 */ flex-wrap: wrap; /* 关键属性,允许子元素自动换行 */
.grid-item{ .grid-item{
position: relative;
height: 134px; height: 134px;
width: 134px; width: 134px;
margin: 5px; margin: 5px;
@ -872,6 +901,14 @@ const handleSelectionChange = (val:matterInfo[]) => {
align-items: center; align-items: center;
text-align:center; text-align:center;
} }
.grid-menus{
position: absolute;
top: 10px;
button{
color: #000000;
margin: 4px;
}
}
.grid{ .grid{
:hover { :hover {
background-color: #c4c4c4; /* 悬停时的背景色 */ background-color: #c4c4c4; /* 悬停时的背景色 */

2
src/views/doc/onlyoffice.vue

@ -50,7 +50,7 @@ onMounted(()=>{
if (query.fileurl){ if (query.fileurl){
const info=query.info?.toString()??"error" const info=query.info?.toString()??"error"
const _info=decodeURIComponent(atob(info)) const _info=decodeURIComponent(atob(info))
const _url=decodeURIComponent(query.fileurl) const _url=decodeURIComponent(window.atob(query.fileurl))
const name=query.name?.toString()??"" const name=query.name?.toString()??""
const dtype=query.dtype?.toString()??"word" const dtype=query.dtype?.toString()??"word"
// //

2
src/views/doc/recentVisited.vue

@ -141,7 +141,7 @@ onUnmounted(()=>{
<template #default="scope"> <template #default="scope">
<div v-show="currentHoverRow === scope.row.uuid"> <div v-show="currentHoverRow === scope.row.uuid">
<el-button size="small" :icon="View" circle @click="onlyOfficeView(scope.row)"></el-button> <el-button size="small" :icon="View" circle @click="onlyOfficeView(scope.row)"></el-button>
<el-button size="small" :icon="Edit" circle @click="onlyOfficeEdit(scope.row)"></el-button> <!-- <el-button size="small" :icon="Edit" circle @click="onlyOfficeEdit(scope.row)"></el-button> -->
<el-button size="small" :icon="Delete" circle @click="onClearHistory(scope.row)"></el-button> <el-button size="small" :icon="Delete" circle @click="onClearHistory(scope.row)"></el-button>
</div> </div>
</template> </template>

14
src/views/doc/share.vue

@ -119,7 +119,7 @@ function onShareView(row:matterInfo){
if(_type!==""){ //office file if(_type!==""){ //office file
const info =btoa(encodeURIComponent(`${row.name}`)) // const info =btoa(encodeURIComponent(`${row.name}`)) //
const _url=`${siteHost}${apiURL}/share/zip?shareUuid=${row.uuid}&code=${row.code}&uid=${uid}&dprt=${udprt}&puuid=root&rootUuid=root` const _url=`${siteHost}${apiURL}/share/zip?shareUuid=${row.uuid}&code=${row.code}&uid=${uid}&dprt=${udprt}&puuid=root&rootUuid=root`
window.open(`/#/onlyoffice?name=${row.name}&dtype=${_type}&info=${info}&fileurl=`+encodeURIComponent(_url),"_blank") window.open(`/#/onlyoffice?name=${row.name}&dtype=${_type}&info=${info}&fileurl=`+window.btoa(encodeURIComponent(_url)),"_blank")
}else{ }else{
//by kkFilePreview //by kkFilePreview
let a = row.name ?? ''; let a = row.name ?? '';
@ -145,7 +145,7 @@ function onShareView(row:matterInfo){
} }
} }
//onlyoffice线 //onlyoffice线,
async function onlyOfficeEdit(row:matterInfo){ async function onlyOfficeEdit(row:matterInfo){
const _type=fileType(row.name!) const _type=fileType(row.name!)
if(_type===""){ if(_type===""){
@ -166,7 +166,7 @@ async function onlyOfficeEdit(row:matterInfo){
const _verify = btoa(row.uuid.match(/(\w+-\w+)/)![0]+"true") // const _verify = btoa(row.uuid.match(/(\w+-\w+)/)![0]+"true") //
const info =btoa(encodeURIComponent(`${row.userUuid}/root${filepath}`)) // const info =btoa(encodeURIComponent(`${row.userUuid}/root${filepath}`)) //
const _url=`${siteHost}${apiURL}/share/zip?shareUuid=${row.uuid}&code=${row.code}&uid=${uid}&dprt=${udprt}&puuid=root&rootUuid=root` const _url=`${siteHost}${apiURL}/share/zip?shareUuid=${row.uuid}&code=${row.code}&uid=${uid}&dprt=${udprt}&puuid=root&rootUuid=root`
window.open(`/#/onlyoffice?name=${row.name}&dtype=${_type}&info=${info}&verify=${_verify}&fileurl=`+encodeURIComponent(_url),"_blank") window.open(`/#/onlyoffice?name=${row.name}&dtype=${_type}&info=${info}&verify=${_verify}&fileurl=`+window.btoa(encodeURIComponent(_url)),"_blank")
}) })
} }
@ -232,10 +232,8 @@ onMounted(() => {
<el-table-column style="width: 80%;" property="name" label="我的文件分享"> <el-table-column style="width: 80%;" property="name" label="我的文件分享">
<template #default="scope"> <template #default="scope">
<div style="display: flex; align-items: center"> <div style="display: flex; align-items: center">
<el-icon :size="26"> <svg-icon v-if="scope.row.dir" icon-class="folder-icon" :size="26"/>
<component v-if="scope.row.dir" :is="Folder" /> <svg-icon v-else :icon-class="getFileIcon(scope.row.name)+'-icon'" :size="26" />
<component v-else :is="getFileIcon(scope.row.name)" />
</el-icon>
<span style="margin-left: 10px">{{ checkExpirTime(scope.row)?scope.row.name+' (已过期)':scope.row.name }}</span> <span style="margin-left: 10px">{{ checkExpirTime(scope.row)?scope.row.name+' (已过期)':scope.row.name }}</span>
</div> </div>
</template> </template>
@ -243,7 +241,7 @@ onMounted(() => {
<el-table-column width="250" align="center"> <el-table-column width="250" align="center">
<template #default="scope"> <template #default="scope">
<div v-show="currentHoverRow === scope.row.uuid"> <div v-show="currentHoverRow === scope.row.uuid">
<el-button size="small" :icon="Edit" circle @click="onlyOfficeEdit(scope.row)"></el-button> <!-- <el-button size="small" :icon="Edit" circle @click="onlyOfficeEdit(scope.row)"></el-button> -->
<el-button size="small" :icon="Avatar" circle @click="()=>{drawerModel=true; permitListRef=scope.row.permitInfos}"></el-button> <el-button size="small" :icon="Avatar" circle @click="()=>{drawerModel=true; permitListRef=scope.row.permitInfos}"></el-button>
<el-button size="small" :icon="View" circle @click="onShareView(scope.row)"></el-button> <el-button size="small" :icon="View" circle @click="onShareView(scope.row)"></el-button>
<el-button size="small" :icon="Share" circle @click="showShareMessage(scope.row)"></el-button> <el-button size="small" :icon="Share" circle @click="showShareMessage(scope.row)"></el-button>

15
src/views/doc/space.vue

@ -403,7 +403,7 @@ function onPrivateView(row:matterInfo){
const info =btoa(encodeURIComponent(`${row.name}`)) // const info =btoa(encodeURIComponent(`${row.name}`)) //
const _url=`${props.siteHost}${props.apiURL}/space/download/${row.uuid}/${row.name}?space=${props.spaceid}` const _url=`${props.siteHost}${props.apiURL}/space/download/${row.uuid}/${row.name}?space=${props.spaceid}`
//fileurl //fileurl
window.open(`/#/onlyoffice?name=${row.name}&dtype=${_type}&info=${info}&fileurl=`+encodeURIComponent(_url),"_blank") window.open(`/#/onlyoffice?name=${row.name}&dtype=${_type}&info=${info}&fileurl=`+window.btoa(encodeURIComponent(_url)),"_blank")
}else{ }else{
alert("暂不支持该类型预览") alert("暂不支持该类型预览")
} }
@ -427,7 +427,7 @@ async function onlyOfficeEdit(row:matterInfo){
const _verify = btoa(row.uuid.match(/(\w+-\w+)/)![0]+"true") // const _verify = btoa(row.uuid.match(/(\w+-\w+)/)![0]+"true") //
const info =btoa(encodeURIComponent(`${row.userUuid}/root${row.path}`)) // const info =btoa(encodeURIComponent(`${row.userUuid}/root${row.path}`)) //
const _url=`${props.siteHost}${props.apiURL}/space/download/${row.uuid}/${row.name}?space=${props.spaceid}` const _url=`${props.siteHost}${props.apiURL}/space/download/${row.uuid}/${row.name}?space=${props.spaceid}`
window.open(`/#/onlyoffice?name=${row.name}&dtype=${_type}&info=${info}&verify=${_verify}&fileurl=`+encodeURIComponent(_url),"_blank") window.open(`/#/onlyoffice?name=${row.name}&dtype=${_type}&info=${info}&verify=${_verify}&fileurl=`+window.btoa(encodeURIComponent(_url)),"_blank")
}) })
} }
@ -548,7 +548,7 @@ function isOwner(){
<div class="table-grid" v-else> <div class="table-grid" v-else>
<div class="grid-item" v-for="row in matterList"> <div class="grid-item" v-for="row in matterList">
<div class="grid"> <div class="grid">
<div class="grid-box" @mouseover="handleMouseEnter(row)"> <div class="grid-box" @click="handleMouseEnter(row)">
<svg-icon v-if="row.dir" icon-class="folder-icon" size="80px"/> <svg-icon v-if="row.dir" icon-class="folder-icon" size="80px"/>
<el-image v-else-if="getFileIcon(row.name)==='img'" style="width: 80px;" :preview-src-list="[getSpaceImageDURL(row.uuid,row.name)]" :src="getSpaceImageViewURL(row.uuid,row.name)" /> <el-image v-else-if="getFileIcon(row.name)==='img'" style="width: 80px;" :preview-src-list="[getSpaceImageDURL(row.uuid,row.name)]" :src="getSpaceImageViewURL(row.uuid,row.name)" />
<svg-icon v-else :icon-class="getFileIcon(row.name)+'-icon'" size="80px"/> <svg-icon v-else :icon-class="getFileIcon(row.name)+'-icon'" size="80px"/>
@ -591,6 +591,7 @@ function isOwner(){
display: flex; display: flex;
flex-wrap: wrap; /* 关键属性,允许子元素自动换行 */ flex-wrap: wrap; /* 关键属性,允许子元素自动换行 */
.grid-item{ .grid-item{
position: relative;
height: 134px; height: 134px;
width: 134px; width: 134px;
margin: 5px; margin: 5px;
@ -601,6 +602,14 @@ function isOwner(){
align-items: center; align-items: center;
text-align:center; text-align:center;
} }
.grid-menus{
position: absolute;
top: 10px;
button{
color: black;
margin: 4px;
}
}
.grid{ .grid{
:hover { :hover {
background-color: #c4c4c4; /* 悬停时的背景色 */ background-color: #c4c4c4; /* 悬停时的背景色 */

Loading…
Cancel
Save