Переглянути джерело

feat:1.拉取目录传远程ip端口

wangkun 1 тиждень тому
батько
коміт
57e4949bf4
2 змінених файлів з 14 додано та 9 видалено
  1. 6 7
      src/api/ude.js
  2. 8 2
      src/view/ude/access/access.vue

+ 6 - 7
src/api/ude.js

@@ -72,7 +72,7 @@ async function fetchAll(getPage) {
 
 // ---- 接入服务(t_service)----
 export const getServiceList = (page = 1, pageSize = MAX_PAGE_SIZE) =>
-  service.get(`${BASE}/services`, { params: { page, pageSize } }) // -> {list, total}
+  service.get(`${BASE}/services`, { params: { page, pageSize }}) // -> {list, total}
 export const getAllServices = () => fetchAll(getServiceList) // -> ServiceResp[]
 export const createService = data => service.post(`${BASE}/services`, data) // data 无需 id(表自增)
 export const updateService = (id, data) => service.put(`${BASE}/services/${id}`, data)
@@ -83,12 +83,12 @@ export const brushService = id => service.post(`${BASE}/services/${id}/brush`)
 
 // ---- 密钥(t_key,用于「密钥标识」下拉)----
 export const getKeyList = (page = 1, pageSize = MAX_PAGE_SIZE) =>
-  service.post(`${BASE}/keys/list`, { params: { page, pageSize } }) // -> {list, total}
+  service.post(`${BASE}/keys/list`, { params: { page, pageSize }}) // -> {list, total}
 export const getAllKeys = () => fetchAll(getKeyList) // -> KeyResp[]
 
 // ---- 保护目录(t_directory)----
 export const getDirectoryList = (page = 1, pageSize = MAX_PAGE_SIZE) =>
-  service.get(`${BASE}/directories`, { params: { page, pageSize } }) // -> {list, total}
+  service.get(`${BASE}/directories`, { params: { page, pageSize }}) // -> {list, total}
 export const getAllDirectories = () => fetchAll(getDirectoryList) // -> DirectoryResp[]
 export const createDirectory = data => service.post(`${BASE}/directories`, data) // data 无需 id(表自增),仅 serviceId/directory
 export const deleteDirectory = id => service.delete(`${BASE}/directories/${id}`)
@@ -98,8 +98,7 @@ export const deleteDirectory = id => service.delete(`${BASE}/directories/${id}`)
 // udeServer 不暴露 UKey 配置接口,统一兜底为 longmai,使 driver.js 至少能实例化。
 export const getProxyUkey = () => Promise.resolve({ model: 'longmai' })
 
-
 // 本地目录懒加载(udeServer 所在 Linux 主机文件系统,从根目录 / 开始,只列目录不列文件)
-export const getDirChildren = path =>
-  service.get(`${BASE}/dirs/children`, { params: { path: path || '/' } })
-// 返回: { nodes: [{name, path, isDir, hasChildren}] }
+export const getDirChildren = (data) =>
+  service.get(`${BASE}/dirs/children`, { params: { ip: data.ip, port: data.port, path: data.path || '/' }})
+// 返回: { nodes: [{name, path, isDir, hasChildren}] }

+ 8 - 2
src/view/ude/access/access.vue

@@ -454,7 +454,13 @@ const closeLocalTree = () => {
 // el-tree lazy 回调:根节点(level=0)请求 '/',其余请求该节点的 path,每次只加载一层
 const loadLocalDirNode = (node, resolve) => {
   const path = node.level === 0 ? '/' : node.data.path
-  getDirChildren(path)
+  const data = {
+    ip: form.value.ip,
+    port: form.value.port,
+    path
+  }
+
+  getDirChildren(data)
     .then(res => {
       // hasChildren=false → leaf=true,前端不再显示展开箭头
       resolve((res?.nodes || []).map(n => ({ ...n, leaf: !n.hasChildren })))
@@ -764,4 +770,4 @@ const brushServiceInfo = async row => {
 .add-directory-btn {
   margin-top: 4px;
 }
-</style>
+</style>