From 9c20266aab1821e88da43f6dc1717045e1a32b42 Mon Sep 17 00:00:00 2001 From: wam <525987762@qq.com> Date: Wed, 21 Dec 2022 21:39:27 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=88=AA=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/Creative/Material.vue | 13 ++++++-- src/views/Creative/MyCreation.vue | 12 +++++++ .../Creative/components/CreateMaterial.vue | 31 +++++++++++++++++++ 3 files changed, 53 insertions(+), 3 deletions(-) diff --git a/src/views/Creative/Material.vue b/src/views/Creative/Material.vue index c6ec1c84..78d03abb 100644 --- a/src/views/Creative/Material.vue +++ b/src/views/Creative/Material.vue @@ -24,7 +24,8 @@
@@ -179,9 +180,15 @@ watch( } .page-item-logo{ flex: 10; + text-align: center; + overflow: hidden; + span{ + display: block; + margin-top: 3vw; + } img{ - max-width: 100%; - max-height: 100%; + width: 100%; + height: 100%; } } .page-item-title{ diff --git a/src/views/Creative/MyCreation.vue b/src/views/Creative/MyCreation.vue index 72cd9679..ed3dead8 100644 --- a/src/views/Creative/MyCreation.vue +++ b/src/views/Creative/MyCreation.vue @@ -24,6 +24,8 @@
@@ -236,6 +238,16 @@ watch( } .page-item-logo{ flex: 10; + text-align: center; + overflow: hidden; + span{ + display: block; + margin-top: 3vw; + } + img{ + width: 100%; + height: 100%; + } } .page-item-title{ flex: 5; diff --git a/src/views/Creative/components/CreateMaterial.vue b/src/views/Creative/components/CreateMaterial.vue index afed737a..a93cee4a 100644 --- a/src/views/Creative/components/CreateMaterial.vue +++ b/src/views/Creative/components/CreateMaterial.vue @@ -35,6 +35,7 @@ 支持上传glb格式的模型,模型素材包小于500M,建议上传10M以内素材包效果更佳

+ @@ -65,6 +66,7 @@ const { ref, reactive }=require("@vue/reactivity"); import common from "@/api/common.js"; import { createMaterialLibrary } from "../api"; import { message } from 'ant-design-vue'; +import WareViewer from "@/views/planetDesign/Design/components/config/Viewer3D/WareViewer.vue"; const emit = defineEmits(["complete"]); @@ -100,6 +102,11 @@ const show = (type) => { visible.value = true; } + +const model = ref(null); + +const viewerRef = ref(); + const onCustomRequest = async (upload) => { if(formData.value.type == THREE_D_TYPE.SHELF) { @@ -118,10 +125,34 @@ const onCustomRequest = async (upload) => { const data = await common.cosUpload3D(upload.file); upload.onSuccess(data); + + if([THREE_D_TYPE.ENV_3D, THREE_D_TYPE.SHELF, THREE_D_TYPE.EXHIBITION_BOOTH, THREE_D_TYPE.WARE].includes(formData.value.type)){ + + let reader = new FileReader(); + reader.addEventListener( + "load", + (e) => { + model.value = { + file: {}, + result: e.target.result, + }; + }, + false + ); + + reader.readAsArrayBuffer(upload.file); + } } const ok = async () => { if(step.value >= 1) { + + if([THREE_D_TYPE.ENV_3D, THREE_D_TYPE.SHELF, THREE_D_TYPE.EXHIBITION_BOOTH, THREE_D_TYPE.WARE].includes(formData.value.type)){ + var blob = await viewerRef.value.snapshot(); + const data = await common.cosUpload(blob, blob.name, "", () => {}); + formData.value.cover = data.url; + } + const data = JSON.parse(JSON.stringify(formData.value)); await createMaterialLibrary(buildData(data)); visible.value = false;