Browse Source

云盘:添加共享空间分享链接

master
han2015 5 days ago
parent
commit
543bcb991e
  1. 27
      src/views/doc/manage.vue
  2. 44
      src/views/doc/space.vue

27
src/views/doc/manage.vue

@ -22,7 +22,7 @@ import {ElSelect,ElOption, ElText,ElInput,TableInstance,ElMessage,UploadFile,
UploadFiles,ElPagination,ElTree,TreeNode,ElDropdown,ElDropdownItem} from "element-plus";
import preview from './preview.vue';
import uploadlog from './uploadlog.vue';
import space from './space.vue';
import { useRoute } from 'vue-router'
import spacePermission from './spacePermission.vue';
import SvgIcon from "@/components/SvgIcon/index.vue";
import {doDelSpace,doAccessManage,doCreateAiagent,setAgentQueryURL,getAgentQueryURL} from "@/api/doc/space"
@ -60,7 +60,7 @@ const treeRef = ref();
const currentNode=ref<matterTree>({}) //
const officeHost=import.meta.env.VITE_OFFICE_HOST
const dynamicVNode = ref<VNode | null>(null) //permission
const route = useRoute()
const multipleTableRef = ref<TableInstance>()
const paginInfo = ref({ page: 0, total: 0 })
@ -69,7 +69,7 @@ const PRIVATESPACE = ref(true) //是空间状态的控制 2种:私有云盘和
const SpaceID= ref<{name:string,uuid:string,userUuid:string,manager:boolean,permits:matterPermit}>({}) //spaceid
const spaceEleRef = ref() //space,spaceTreeRefspaceTree
const spaceTreeData=ref<matterTree[]>([])//{name:'',uuid:'root',children:[]}
const spaceTreeRef = ref(); //space
const spaceTreeRef = ref(); //space
let spaceNodeUid="" //currentNode
const modListOrGrild=ref(true)
@ -861,6 +861,15 @@ function onAiAgent(row:matterInfo){
})
}
//
const onSpaceShareRequest=(spaceid:string,name:string)=>{
spaceTreeRef.value.data.forEach(item=>{
if(item.uuid==spaceid){
onSpaceNodeClick(item,null,null,null)
}
})
}
//
async function onAgentQueryURL(row:matterInfo){
await getAgentQueryURL(row.uuid).then(resp=>{
@ -896,7 +905,7 @@ async function onAgentQueryURL(row:matterInfo){
//------------------------------------------------------
//http://172.20.2.87:6010/api/alien/preview/5a10aaf6-396e-4d9a-7e87-3c5c8029d4db/123.png?ir=fill_100_100
//
onMounted(() => {
onMounted(async () => {
// treeRef.value.append(
// {name:'',uuid:'root',dir:false},
// currentNode.value.uuid
@ -904,7 +913,7 @@ onMounted(() => {
currentNode.value={uuid:"root"}
//
getMySpaces(uid,{roles:Departs.value}).then((resp)=>{
await getMySpaces(uid,{roles:Departs.value}).then((resp)=>{
resp.data.forEach((item)=>{
let ismanager=false
if(item.userUuid==rawUid || item.managers.includes(rawUid)) ismanager=true;
@ -917,6 +926,14 @@ onMounted(() => {
}else{
modListOrGrild.value=true
}
const query = route.query
if(query.s_token){
const s_token=decodeURIComponent(atob(query.s_token as string)).split("|")
if(s_token.length==3){
onSpaceShareRequest(s_token[0],s_token[2])
}
}
});
const handleSelectionChange = (val:matterInfo[]) => {

44
src/views/doc/space.vue

@ -5,6 +5,7 @@
-->
<script lang="ts" setup>
import { getFileIcon, readableSize,fileType} from "./tools"
import { useRoute } from 'vue-router'
import sharePermission from './sharePermission.vue';
import spacePermission from './spacePermission.vue';
import { matterPage,matterInfo,matterTree,doFileUpload,matterPermit} from "@/api/doc/type"
@ -16,18 +17,18 @@ import {
View,
Download,
Plus,Search,
Share,
Edit,
Setting,
Grid,List,
} from '@element-plus/icons-vue'
import {ElMessage,UploadFile,UploadFiles,ElPagination, ElProgress} from "element-plus";
import {ElMessage,UploadFile,UploadFiles,ElPagination, ElProgress,ElText} from "element-plus";
import aiagent from './agent.vue';
import uploadlog from './uploadlog.vue';
import router from "@/router";
import SvgIcon from "@/components/SvgIcon/index.vue";
import { useOrgMemberStore } from "@/store/modules/orgMember";
const orgMembers = useOrgMemberStore() //
const route = useRoute()
const siteHost=document.location.origin;
const defaultAiAgent=import.meta.env.VITE_DEFAULT_AI_AGENT
const matterList = ref<matterInfo[]>([])
const searchname=ref("") //
@ -176,7 +177,7 @@ function onDownload(row:matterInfo){
}
//
function onLoadMatterList(name?:string){
function onLoadMatterList(name?:string,_puuid?:string){
percentage.value=0
onprogress.value=false
@ -195,6 +196,7 @@ function onLoadMatterList(name?:string){
pageSize: 50,
orderCreateTime: "DESC",
orderDir: "DESC",
puuid:_puuid,
deleted:false,
name:name,
space:props.spaceid,
@ -531,6 +533,25 @@ function handleAiUpload(info:matterInfo){
//-------------------------------------------------
//-------------------edit & preive file for space---------------------
//
const onShareSpaceFile=(row:matterInfo)=>{
const str=btoa(encodeURIComponent(`${props.spaceid}|${row.puuid}|${row.name}`))
let _shareURL=`${siteHost}/#/doc/manage?s_token=${str}`
ElMessageBox({
title: '文件分享:',
customStyle: { '--el-messagebox-width':'800px',padding:'40px'},
message: () => h('div',{style:{display:'flex','flex-direction':'column','line-height':'34px', width:'600px'}},[
h(ElText,{style:{'align-self':'flex-start','font-weight':'bold'}},()=>row.name),
h(ElText,{style:{'align-self':'flex-start','overflow-wrap': 'anywhere'}},()=>_shareURL),
]),
confirmButtonText: '复制分享链接',
showCancelButton: true
}).then(()=>{
if(!navigator.clipboard) alert("clipboard 不可用")
navigator.clipboard.writeText(_shareURL)
})
}
//
function onPrivateView(row:matterInfo){
const _type=fileType(row.name!)
@ -603,7 +624,14 @@ onMounted(() => {
CutLevelPermit.value = PERMITS.FORBID //
}
}
const query = route.query
if(query.s_token){
const s_token=decodeURIComponent(atob(query.s_token as string)).split("|")
if(s_token.length==3){
onLoadMatterList(s_token[2],s_token[1])
return
}
}
onLoadMatterList()
});
@ -611,7 +639,7 @@ const handleSelectionChange = (val:matterInfo[]) => {
tabSelected.value = val
}
defineExpose({handleDoubleClick,onDelMatter,onSpaceMatterRename})
defineExpose({handleDoubleClick,onDelMatter,onSpaceMatterRename,onLoadMatterList})
//
function isOwner(){
@ -697,6 +725,7 @@ function isOwner(){
<el-tag v-if="scope.row.agent" effect="dark" size="small" type="success" round >智能体</el-tag>
<div v-show="currentHoverRow === scope.row.name" style="display:inline; margin-left:15px">
<el-button v-if="getFileIcon(scope.row.name)!='img'" size="small" :icon="View" circle @click="onPrivateView(scope.row)"></el-button>
<el-button size="small" :icon="Share" circle @click="onShareSpaceFile(scope.row)"></el-button>
<el-button v-if="scope.row.permitVal>=PERMITS.DOWNLOAD" size="small" :icon="Download" circle @click="onDownload(scope.row)"></el-button>
<span v-if="scope.row.permitVal>=PERMITS.MANAGER" class="manager_span" >
<el-button v-if="!scope.row.dir" size="small" circle @click="handleAiUpload(scope.row)">AI</el-button>
@ -737,6 +766,7 @@ function isOwner(){
</div>
<ul v-if="row.name!=''" class="grid-menus" v-show="currentHoverRow === row.name" @mouseleave="currentHoverRow=''">
<li v-if="getFileIcon(row.name)!='img'" @click="onPrivateView(row)">预览</li>
<li @click="onShareSpaceFile(row)">分享</li>
<li v-if="row.permitVal! >= PERMITS.DOWNLOAD" @click="onDownload(row)">下载</li>
<span v-if="row.permitVal! >= PERMITS.EDIT" >
<li @click="onlyOfficeEdit(row)">编辑</li>

Loading…
Cancel
Save