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 @@ + +file_type_image \ 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[]) => { - + @@ -772,7 +799,7 @@ const handleSelectionChange = (val:matterInfo[]) => {
-
+
@@ -781,8 +808,9 @@ const handleSelectionChange = (val:matterInfo[]) => {
- + +
@@ -862,6 +890,7 @@ const handleSelectionChange = (val:matterInfo[]) => { display: flex; flex-wrap: wrap; /* 关键属性,允许子元素自动换行 */ .grid-item{ + position: relative; height: 134px; width: 134px; margin: 5px; @@ -872,6 +901,14 @@ const handleSelectionChange = (val:matterInfo[]) => { align-items: center; text-align:center; } + .grid-menus{ + position: absolute; + top: 10px; + button{ + color: #000000; + margin: 4px; + } + } .grid{ :hover { background-color: #c4c4c4; /* 悬停时的背景色 */ diff --git a/src/views/doc/onlyoffice.vue b/src/views/doc/onlyoffice.vue index 5520fbf..11f254e 100644 --- a/src/views/doc/onlyoffice.vue +++ b/src/views/doc/onlyoffice.vue @@ -50,7 +50,7 @@ onMounted(()=>{ if (query.fileurl){ const info=query.info?.toString()??"error" const _info=decodeURIComponent(atob(info)) - const _url=decodeURIComponent(query.fileurl) + const _url=decodeURIComponent(window.atob(query.fileurl)) const name=query.name?.toString()??"" const dtype=query.dtype?.toString()??"word" //验证一下文件名是否合规 diff --git a/src/views/doc/recentVisited.vue b/src/views/doc/recentVisited.vue index ea18c34..447f9e5 100644 --- a/src/views/doc/recentVisited.vue +++ b/src/views/doc/recentVisited.vue @@ -141,7 +141,7 @@ onUnmounted(()=>{ diff --git a/src/views/doc/share.vue b/src/views/doc/share.vue index e0cb2b8..0dbe785 100644 --- a/src/views/doc/share.vue +++ b/src/views/doc/share.vue @@ -119,7 +119,7 @@ function onShareView(row:matterInfo){ if(_type!==""){ //office file 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` - 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{ //by kkFilePreview let a = row.name ?? ''; @@ -145,7 +145,7 @@ function onShareView(row:matterInfo){ } } -//onlyoffice在线编辑 +//onlyoffice在线编辑,现在看来分享的不适合编辑,只保留预览 async function onlyOfficeEdit(row:matterInfo){ const _type=fileType(row.name!) if(_type===""){ @@ -166,7 +166,7 @@ async function onlyOfficeEdit(row:matterInfo){ const _verify = btoa(row.uuid.match(/(\w+-\w+)/)![0]+"true") //增加一个权限验证的标记 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` - 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(() => { @@ -243,7 +241,7 @@ onMounted(() => {