From 7d0d1bf34ab2e199f10ba0b0fa7afdbf4229faab Mon Sep 17 00:00:00 2001
From: han2015 <1019850453@qq.com>
Date: Thu, 21 Aug 2025 09:45:21 +0800
Subject: [PATCH] =?UTF-8?q?=E5=AF=B9onlyoffice=E7=9A=84=E5=8F=82=E6=95=B0b?=
=?UTF-8?q?ase64=E7=BC=96=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/assets/icons/img-icon.svg | 2 ++
src/views/doc/manage.vue | 45 ++++++++++++++++++++++++++++++---
src/views/doc/onlyoffice.vue | 2 +-
src/views/doc/recentVisited.vue | 2 +-
src/views/doc/share.vue | 14 +++++-----
src/views/doc/space.vue | 15 ++++++++---
6 files changed, 63 insertions(+), 17 deletions(-)
create mode 100644 src/assets/icons/img-icon.svg
diff --git a/src/assets/icons/img-icon.svg b/src/assets/icons/img-icon.svg
new file mode 100644
index 0000000..61a2a01
--- /dev/null
+++ b/src/assets/icons/img-icon.svg
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/src/views/doc/manage.vue b/src/views/doc/manage.vue
index c4dc0a5..1441dbd 100644
--- a/src/views/doc/manage.vue
+++ b/src/views/doc/manage.vue
@@ -440,7 +440,7 @@ function onPrivateView(row:matterInfo){
const info =btoa(encodeURIComponent(`${row.name}`)) //预览模式不需要绝对路径,只核对一下文件名即可
const _url=`${siteHost}${apiURL}/alien/download/${row.uuid}/${row.name}?access_token=${_token}`
//前半部分内容是为了校验信息,主要内容是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
}
@@ -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----------------
//自定义上传,目的是支持多文件上传, 使用html原生组件,是为了解决并发问题
@@ -756,7 +783,7 @@ const handleSelectionChange = (val:matterInfo[]) => {