bill 1 месяц назад
Родитель
Сommit
67477ae117
3 измененных файлов с 10 добавлено и 6 удалено
  1. 2 2
      src/api/material.ts
  2. 6 1
      src/components/materials/index.vue
  3. 2 3
      src/views/animation/left.vue

+ 2 - 2
src/api/material.ts

@@ -153,11 +153,11 @@ export const syncMaterialAll = async () => {
   await axios.get(SYNC_MATERIAL + params.caseId);
 };
 
-export const addMaterial = (file: File) => {
+export const addMaterial = (file: File, data = {}) => {
   return axios<any>({
     method: "POST",
     url: ADD_MATERIAL,
-    data: jsonToForm({ file }),
+    data: jsonToForm({ file, ...data }),
     headers: { ...UPLOAD_HEADS },
   });
 };

+ 6 - 1
src/components/materials/index.vue

@@ -315,7 +315,12 @@ const foreceRefresh = async () => {
 };
 
 const uploadHandler = async (file: File) => {
-  await addMaterial(file);
+  const data: Record<string, any> = {};
+  if (props.groupIds.length === 1) {
+    data.dictId = props.groupIds[0];
+  }
+
+  await addMaterial(file, data);
   refresh();
 };
 

+ 2 - 3
src/views/animation/left.vue

@@ -109,13 +109,12 @@ const clickHandler = (item: AnimationModel) => {
 const selectModel = async () => {
   const groups = await fetchMaterialGroups();
   const group = groups.find((item) => item.useType === "animation");
-  console.error(group);
   const list = await selectMaterials({
-    uploadFormat: ["animation-model"],
+    uploadFormat: ["zip"],
     // format: ["glb"],
     isSystem: 1,
     maxSize: 2 * 1024 * 1024 * 1024,
-    readonly: true,
+    readonly: false,
     groupIds: group ? [group.id] : undefined,
   });
   if (!list?.length) return;