Pārlūkot izejas kodu

三维场景加入文件夹功能(还差搜索功能)

任一存 2 gadi atpakaļ
vecāks
revīzija
ffc6728174

+ 62 - 4
packages/qjkankan-editor/src/api/index.js

@@ -122,10 +122,68 @@ export function getPanoInfo(data, ok, no) {
  * @param {*} ok 
  * @param {*} no 
  */
- export function getSceneList(data, ok, no) {
-    return http.postJson(`${URL_FILL}/manage/work/select/4dkk/${data.workId || number()}`, data, (result)=>{
-        return ok(result)
-    }, no)
+export function getSceneList(data, ok, no) {
+  const {
+    pathLevel2Id,
+    folderId,
+    pageNum,
+    pageSize,
+    searchKey,
+  } = data
+
+  if (folderId === 'root') {
+    ok({
+      data: {
+        list: [
+          {
+            name: '四维看看',
+            sceneName: '四维看看',
+            id: 'kankan',
+            type: 'dir', 
+          },
+          {
+            name: '四维看见',
+            sceneName: '四维看见',
+            id: 'kanjian',
+            type: 'dir',
+          },
+        ],
+        total: 2,
+      }
+    })
+    return
+  } else {
+    http.postJson(`${URL_FILL}/ucenter/user/scene/newList`, {
+      cameraId: null,
+      cameraType: null,
+      endTime: "",
+      folderId: Number.isInteger(folderId) ? folderId : '',
+      folderType: pathLevel2Id === 'kankan' ? "0" : '2',
+      isOldMu: false,
+      isSetData: true,
+      keywordType: "sceneName",
+      pageNum,
+      pageSize,
+      sceneName: searchKey,
+      sceneSource: pathLevel2Id === 'kankan' ? "1" : '3',
+      sceneType: searchKey,
+      startTime: "",
+    }).then((res) => {
+      console.log(res);
+      ok({
+        data: {
+          list: res.data.pageInfo.list.map((item) => {
+            if (item.isFolder === 1) {
+              item.type = 'dir'
+              item.sceneName = item.name
+            }
+            return item
+          }),
+          total: res.data.pageInfo.total
+        }
+      })
+    })
+  }
 }
 
 

+ 40 - 53
packages/qjkankan-editor/src/components/materialListInMaterialSelector.vue

@@ -539,63 +539,50 @@ export default {
     requestMoreData() {
       this.isRequestingMoreData = true
       const latestUsedSearchKey = this.searchKey
+
+      let getListFn = null
+      let params = null
       if (this.materialType === '3D') {
-        getSceneList(
-          {
-            pageNum: Math.floor(this.list.length / config.PAGE_SIZE) + 1,
-            pageSize: config.PAGE_SIZE,
-            searchKey: this.searchKey,
-            workId: this.workId,
-          },
-          (data) => {
-            const newData = data.data.data.list.map((i) => {
-              this.materialItemCustomProcess(i)
-              return i;
-            });
-            this.list = this.list.concat(newData)
-            if (this.list.length === data.data.data.total) {
-              this.hasMoreData = false
-            }
-            this.isRequestingMoreData = false
-            this.latestUsedSearchKey = latestUsedSearchKey
-          },
-          () => {
-            this.isRequestingMoreData = false
-            this.latestUsedSearchKey = latestUsedSearchKey
-          }
-        )
+        getListFn = getSceneList
+        params = {
+          pathLevel2Id: this.folderPath[1]?.id,
+          folderId: this.currentFolderId,
+          pageNum: Math.floor(this.list.length / config.PAGE_SIZE) + 1,
+          pageSize: config.PAGE_SIZE,
+          searchKey: this.searchKey,
+        }
       } else {
-        getMaterialList(
-          {
-            dirId: this.currentFolderId,
-            pageNum: Math.floor(this.listRealLength / config.PAGE_SIZE) + 1,
-            pageSize: config.PAGE_SIZE,
-            searchKey: this.searchKey,
-            type: this.materialType,
-          },
-          (data) => {
-            const newData = data.data.list.map((i) => {
-              if (i.fileSize) {
-                i.fileSize = changeByteUnit(Number(i.fileSize));
-              } else {
-                i.fileSize = ''
-              }
-              this.materialItemCustomProcess(i)
-              return i;
-            });
-            this.list = this.list.concat(newData)
-            if (this.listRealLength === data.data.total) {
-              this.hasMoreData = false
+        getListFn = getMaterialList
+        params = {
+          dirId: this.currentFolderId,
+          pageNum: Math.floor(this.listRealLength / config.PAGE_SIZE) + 1,
+          pageSize: config.PAGE_SIZE,
+          searchKey: this.searchKey,
+          type: this.materialType,
+        }
+      }
+      getListFn(params, (data) => {
+          const newData = data.data.list.map((i) => {
+            if (i.fileSize) {
+              i.fileSize = changeByteUnit(Number(i.fileSize));
+            } else {
+              i.fileSize = ''
             }
-            this.isRequestingMoreData = false
-            this.latestUsedSearchKey = latestUsedSearchKey
-          },
-          () => {
-            this.isRequestingMoreData = false
-            this.latestUsedSearchKey = latestUsedSearchKey
+            this.materialItemCustomProcess(i)
+            return i;
+          });
+          this.list = this.list.concat(newData)
+          if (this.listRealLength === data.data.total) {
+            this.hasMoreData = false
           }
-        );
-      }
+          this.isRequestingMoreData = false
+          this.latestUsedSearchKey = latestUsedSearchKey
+        },
+        () => {
+          this.isRequestingMoreData = false
+          this.latestUsedSearchKey = latestUsedSearchKey
+        }
+      );
     },
     refreshMaterialList: debounce(function (type) {
       this.isRequestingMoreData = false

+ 24 - 12
packages/qjkankan-editor/src/components/materialSelectorFolderMixin.js

@@ -28,19 +28,28 @@ export default {
       this.folderPath = this.folderPath.slice(0, idx + 1)
     },
     onClickFolder(folder) {
-      getFolderTree({
-        type: this.currentMaterialType,
-      }).then((res) => {
-        this.folderTree = res.data
-        const targetPathIdList = folder.ancestors.split(',').map((item) => {
-          return Number(item)
+      if (this.materialType === '3D') {
+        // 搜索三维场景得不到匹配的文件夹,所以素材是三维场景时如果调用此方法,不会是因为点击了搜索结果中的文件夹,因此可以在当前路径基础上进行跳转。
+        this.folderPath.push({
+          name: folder.name,
+          id: folder.id
         })
-        targetPathIdList.push(folder.id)
-        this.folderPath = nodeIdList2nodeInfoListByNodeTree(targetPathIdList, this.folderTree)
-        this.$emit('need-clear-filter')
-      })
+      } else {
+        getFolderTree({
+          type: this.currentMaterialType,
+        }).then((res) => {
+          this.folderTree = res.data
+          const targetPathIdList = folder.ancestors.split(',').map((item) => {
+            return Number(item)
+          })
+          targetPathIdList.push(folder.id)
+          this.folderPath = nodeIdList2nodeInfoListByNodeTree(targetPathIdList, this.folderTree)
+          this.$emit('need-clear-filter')
+        })
+      }
     },
     onClickParentFolder(clickedItem) {
+      // 搜索三维场景得到的结果没有所在路径信息,所以不显示其父级目录也不提供点击跳转到父级目录的方法,因此素材是三维场景时不会调用此方法,因此此方法不许考虑三维场景这种特殊情况。
       getFolderTree({
         type: this.currentMaterialType,
       }).then((res) => {
@@ -61,7 +70,10 @@ export default {
             }
           }, targetNodePath)
           this.folderPath = targetNodePath.map((item) => {
-            return item.id
+            return {
+              name: item.name,
+              id: item.id,
+            }
           })
         }
         this.$emit('need-clear-filter')
@@ -80,7 +92,7 @@ export default {
   created() {
     this.folderPath.push({
       name: i18n.t(`gather.${this.currentMaterialType}`),
-      id: 1,
+      id: this.materialType === '3D' ? 'root' : 1,
     })
   }
 }

+ 4 - 0
packages/qjkankan-editor/vue.config.js

@@ -33,6 +33,10 @@ module.exports = {
           target: proxy_url,
           changeOrigin: true,
       },
+      '/ucenter': {
+        target: process.env.VUE_APP_PROXY_URL_ROOT,
+        changeOrigin: true,
+      },
       '/web': {
         target: proxy_url,
         changeOrigin: true,