소스 검색

管理中心和编辑器-素材选择弹窗-三维场景的搜索功能

任一存 2 년 전
부모
커밋
d3f55591eb

+ 66 - 13
packages/qjkankan-editor/src/api/index.js

@@ -2,6 +2,7 @@ import { http,getToken } from '../utils/request'
 import config from '../config'
 import { $waiting } from "@/components/shared/loading";
 import { postOrderTraversal } from "@/utils/other.js";
+import { i18n } from "@/lang"
 
 const number = function() {
     return config.projectNum
@@ -117,18 +118,14 @@ export function getPanoInfo(data, ok, no) {
 
 
 /**
- * 获取四维看看场景列表
- * @param {*} data 
- * @param {*} ok 
- * @param {*} no 
+ * 获取三维场景列表(不应使用其搜索功能,因为无法全局搜索,而且无论搜的是什么词,指定文件夹中所有子文件夹都会被返回。
  */
-export function getSceneList(data, ok, no) {
+export function getSceneList(data, ok) {
   const {
     pathLevel2Id,
     folderId,
     pageNum,
     pageSize,
-    searchKey,
   } = data
 
   if (folderId === 'root') {
@@ -136,14 +133,14 @@ export function getSceneList(data, ok, no) {
       data: {
         list: [
           {
-            name: '四维看看',
-            sceneName: '四维看看',
+            name: i18n.t('gather.siweikankan'),
+            sceneName: i18n.t('gather.siweikankan'),
             id: 'kankan',
             type: 'dir', 
           },
           {
-            name: '四维看见',
-            sceneName: '四维看见',
+            name: i18n.t('gather.siweikanjian'),
+            sceneName: i18n.t('gather.siweikanjian'),
             id: 'kanjian',
             type: 'dir',
           },
@@ -164,13 +161,14 @@ export function getSceneList(data, ok, no) {
       keywordType: "sceneName",
       pageNum,
       pageSize,
-      sceneName: searchKey,
+      sceneName: '',
       sceneSource: pathLevel2Id === 'kankan' ? "1" : '3',
-      sceneType: searchKey,
+      sceneType: null,
+      searchKey: '',
       startTime: "",
     }).then((res) => {
-      console.log(res);
       ok({
+        code: 0,
         data: {
           list: res.data.pageInfo.list.map((item) => {
             if (item.isFolder === 1) {
@@ -186,6 +184,61 @@ export function getSceneList(data, ok, no) {
   }
 }
 
+/**
+ * 获取三维场景列表(使用关键词搜索功能)
+ */
+
+ export function searchInAllScenes(data, ok) {
+  const {
+    searchKey,
+  } = data
+  return Promise.all([
+    http.postJson(`${URL_FILL}/ucenter/user/scene/getOnlySceneList`, {
+      cameraId: null,
+      cameraType: null,
+      endTime: "",
+      folderId: '',
+      folderType: '0',
+      isOldMu: false,
+      isSetData: true,
+      keywordType: "sceneName",
+      pageNum: 1,
+      pageSize: 999999,
+      sceneName: searchKey,
+      sceneSource: '1',
+      sceneType: null,
+      searchKey,
+      startTime: "",
+    }),
+    http.postJson(`${URL_FILL}/ucenter/user/scene/getOnlySceneList`, {
+      cameraId: null,
+      cameraType: null,
+      endTime: "",
+      folderId: '',
+      folderType: '2',
+      isOldMu: false,
+      isSetData: true,
+      keywordType: "sceneName",
+      pageNum: 1,
+      pageSize: 999999,
+      sceneName: searchKey,
+      sceneSource: '3',
+      sceneType: null,
+      searchKey,
+      startTime: "",
+    }),
+  ]).then((res) => {
+    let total = res[0].data.total + res[1].data.total
+    let list = [...res[0].data.list, ...res[1].data.list]
+    ok({
+      code: 0,
+      data: {
+        total,
+        list,
+      }
+    })
+  })
+}
 
 /**
  * 获取初始场景

+ 32 - 30
packages/qjkankan-editor/src/components/materialListInMaterialSelector.vue

@@ -304,6 +304,7 @@
 import {
   getMaterialList,
   getSceneList,
+  searchInAllScenes,
   uploadMaterial,
   checkUserSize,
 } from "@/api";
@@ -347,10 +348,6 @@ export default {
         return
       }
     },
-    workId: {
-      type: String,
-      default: '',
-    },
     tableHeaderKeyList: {
       type: Array,
       default: () => {
@@ -543,13 +540,20 @@ export default {
       let getListFn = null
       let params = null
       if (this.materialType === '3D') {
-        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,
+        if (!this.searchKey) {
+          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 {
+          getListFn = searchInAllScenes
+          params = {
+            searchKey: this.searchKey
+          }
         }
       } else {
         getListFn = getMaterialList
@@ -562,27 +566,25 @@ export default {
         }
       }
       getListFn(params, (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
+        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

+ 0 - 5
packages/qjkankan-editor/src/components/materialSelector.vue

@@ -340,7 +340,6 @@
 
       :currentMaterialType="currentMaterialType"
       :materialType="'3D'"
-      :workId="workId"
 
       :tableHeaderKeyList="['thumb', 'sceneName']"
 
@@ -418,10 +417,6 @@ export default {
       type: Boolean,
       default: false,
     },
-    workId: {
-      type: String,
-      default: '',
-    },
   },
   data () {
     return {

+ 2 - 0
packages/qjkankan-editor/src/lang/_en.json

@@ -581,6 +581,8 @@
     "audio": "Audio",
     "video": "Video",
     "scene": "3D Scene",
+    "siweikankan": "四维看看",
+    "siweikanjian": "四维看见",
     "keywords": "Enter keywords",
     "how_to_shoot": "How to shoot a 3D scene?",
     "pano_size": "Support 2:1 jpg files ≤ 120MB",

+ 2 - 0
packages/qjkankan-editor/src/lang/_zh.json

@@ -583,6 +583,8 @@
     "audio": "音频",
     "video": "视频",
     "scene": "三维场景",
+    "siweikankan": "四维看看",
+    "siweikanjian": "四维看见",
     "keywords": "请输入关键字",
     "how_to_shoot": "如何拍摄三维场景",
     "pano_size": "请上传2:1、120MB以内、jpg格式的图片",

+ 1 - 1
packages/qjkankan-editor/src/views/material/works/index.vue

@@ -86,7 +86,7 @@
         :title="select_material"
         :selectableType="['pano', '3D']"
         :isMultiSelection="true"
-        :workId="newWorkId" initialMaterialType="pano"
+        initialMaterialType="pano"
         @cancle="isShowMaterialSelector = false"
         @submit="handleSubmitFromMaterialSelector"
       />