fix: 联调

This commit is contained in:
wanganmao
2022-12-20 18:17:50 +08:00
parent f13bcda737
commit 348f549420
13 changed files with 140 additions and 918 deletions

View File

@@ -50,8 +50,13 @@ const constantRoutes = [
},
{
path: '/ring360-preview',
name: 'editCreative',
component: () => import(/* webpackChunkName: 'creative' */ '@views/Creative/Ring360Preview.vue')
name: 'ring360Preview',
component: () => import(/* webpackChunkName: 'ring360Preview' */ '@views/Creative/Ring360Preview.vue')
},
{
path: '/model3d-preview',
name: 'model3dPreview',
component: () => import(/* webpackChunkName: 'model3dPreview' */ '@views/Creative/Model3DPreview.vue')
},
{
path: '/luck',

View File

@@ -62,7 +62,7 @@
</div>
<Previewer ref="previewerRef" />
<RenameMeterial ref="renameMeterialRef" @complete="query" />
<CreateMaterial ref="createMaterialRef" />
<CreateMaterial ref="createMaterialRef" @complete="query" />
</div>
</a-spin>
</template>

View File

@@ -0,0 +1,42 @@
<template>
<WareViewer ref="viewer" :model="model" style="width: 100%; height: 100%;" />
</template>
<script setup>
import WareViewer from "@/views/planetDesign/Design/components/config/Viewer3D/WareViewer.vue";
import { ref } from "@vue/reactivity";
import { onMounted } from "@vue/runtime-core";
const model = ref(null);
onMounted(() => {
var url = "";
fetch(
"https://test-cxp-public-web-1302259445.cos.ap-beijing.myqcloud.com/uat-yls/3D/shelves/shelves-v3-store/v3.4/ware/milkpowder-can1-lod0.glb",
{
method: "get",
responseType: "blob",
}
)
.then((res) => res.blob())
.then((res) => {
let reader = new FileReader();
reader.addEventListener(
"load",
(e) => {
model.value = {
file: {},
result: e.target.result,
};
},
false
);
reader.readAsArrayBuffer(res);
});
});
</script>
<style>
</style>

View File

@@ -167,8 +167,9 @@ const del = (row) => {
title: "确认删除",
content: "删除作品后将不能找回,是否确认删除?",
async onOk () {
await delMaterialCenter(row.id);
await query();
await delMaterialCenter(row.id).then(() => {
query();
});
},
onCancel () { },
});

View File

@@ -1,5 +1,5 @@
<template>
<div>
<div class="choose-marerial">
<div class="item" v-for="(item, index) in list" :key="index" :class="current.includes(item) ? 'selected' : ''" @click="toggle(item)">
<div class="cover">
<img :src="item.material_json?.urlThumb" alt="">
@@ -47,8 +47,9 @@ onMounted(async () => {
</script>
<style scoped lang="scss">
.item{
.choose-marerial{
min-height: 300px;
.item{
width: 31%;
border: solid 1px #eee;
outline: solid 1px #fff;
@@ -66,8 +67,9 @@ onMounted(async () => {
line-height: 30px;
text-align: center;
}
}
.selected{
}
.selected{
outline: solid 1px green;
}
}
</style>

View File

@@ -25,25 +25,18 @@ const factorys = [
type: CREATIVE_TYPE.THREE_D,
build: (data) => {
var pUrl = "";
var sUrl = "";
var key = new Date().getTime();
try{
data = data.data;
pUrl = data.panorama[0].material_json.url;
sUrl = data.shelves[0].material_json.url;
}
catch(e){}
var key = new Date().getTime();
return {
"planetid": `${key}-scene`,
"planetid": `scene-${key}`,
"name": `场景-${key}`,
"arrangementId": "bsld2da4",
"relShopId": "sllqkj4l",
"panorama": {
"url": pUrl,
"urlSmall": pUrl,
"url": data.panorama.find(x => x).material_json.url,
"urlSmall": data.panorama.find(x => x).material_json.url,
"urlThumb": "",
"urlDepth": "",
"urlShelfExr": "",
@@ -54,863 +47,13 @@ const factorys = [
"shelves": [
{
"name": `货架-${key}`,
"planetid": `${key}-shelf`,
"planetid": `shelf-${key}`,
"id": `${key}-shelf`,
"url": sUrl,
"id": `shelf-${key}`,
"url": data.shelves.find(x => x).material_json.url,
"urlThumb": "",
"hideWhenSurvey": true,
"cells": [
{
"name": "0-1",
"box": {
"position": {
"x": -0.6093719155636137,
"y": 1.1925115714503842,
"z": 0.45
},
"scale": {
"x": 1,
"y": 1,
"z": 1
},
"rotation": {
"x": 0,
"y": 0,
"z": 0
},
"size": {
"x": 0.3736,
"y": 0.2259,
"z": 0.2179
},
"child": {
"sign": {
"position": {
"x": -0.006,
"y": -0.029369916622918046,
"z": 0.1847
},
"rotation": {
"x": 0,
"y": 0,
"z": 0
},
"scale": {
"x": 1,
"y": 1,
"z": 1
}
},
"logo": {
"position": {
"x": 0,
"y": 0.15,
"z": 0
}
}
}
},
"pileNumber": 2,
"pileRotationY": 0
},
{
"name": "0-2",
"box": {
"position": {
"x": -0.18520626992561548,
"y": 1.1908614160723439,
"z": 0.45
},
"scale": {
"x": 1,
"y": 1,
"z": 1
},
"rotation": {
"x": 0,
"y": 0,
"z": 0
},
"size": {
"x": 0.3736,
"y": 0.2259,
"z": 0.2179
},
"child": {
"sign": {
"position": {
"x": -0.006,
"y": -0.03174731410176801,
"z": 0.1847
},
"rotation": {
"x": 0,
"y": 0,
"z": 0
},
"scale": {
"x": 1,
"y": 1,
"z": 1
}
},
"logo": {
"position": {
"x": 0,
"y": 0.15,
"z": 0
}
}
}
},
"pileNumber": 2,
"pileRotationY": 0
},
{
"name": "0-3",
"box": {
"position": {
"x": 0.2287325535366465,
"y": 1.1892382329257407,
"z": 0.45
},
"scale": {
"x": 1,
"y": 1,
"z": 1
},
"rotation": {
"x": 0,
"y": 0,
"z": 0
},
"size": {
"x": 0.3736,
"y": 0.2259,
"z": 0.2179
},
"child": {
"sign": {
"position": {
"x": -0.006,
"y": -0.028571714546698213,
"z": 0.1847
},
"rotation": {
"x": 0,
"y": 0,
"z": 0
},
"scale": {
"x": 1,
"y": 1,
"z": 1
}
},
"logo": {
"position": {
"x": 0,
"y": 0.15,
"z": 0
}
}
}
},
"pileNumber": 2,
"pileRotationY": 0
},
{
"name": "0-4",
"box": {
"position": {
"x": 0.661393068886308,
"y": 1.1909523674363642,
"z": 0.4537964589333506
},
"scale": {
"x": 1,
"y": 1,
"z": 1
},
"rotation": {
"x": 0,
"y": 0,
"z": 0
},
"size": {
"x": 0.3736,
"y": 0.2259,
"z": 0.2179
},
"child": {
"sign": {
"position": {
"x": -0.006,
"y": -0.03136253199426353,
"z": 0.1847
},
"rotation": {
"x": 0,
"y": 0,
"z": 0
},
"scale": {
"x": 1,
"y": 1,
"z": 1
}
},
"logo": {
"position": {
"x": 0,
"y": 0.15,
"z": 0
}
}
}
},
"pileNumber": 2,
"pileRotationY": 0
},
{
"name": "1-1",
"box": {
"position": {
"x": -0.605500512913119,
"y": 0.8538858659191146,
"z": 0.45017966628074646
},
"rotation": {
"x": 0,
"y": 0,
"z": 0
},
"scale": {
"x": 1,
"y": 1,
"z": 1
},
"size": {
"x": 0.37358155846595764,
"y": 0.225911445915699,
"z": 0.21794167160987854
},
"child": {
"sign": {
"position": {
"x": -0.0027324557304382324,
"y": -0.03184773059511403,
"z": 0.1743204391002655
},
"rotation": {
"x": 0,
"y": 0,
"z": 0
},
"scale": {
"x": 0.7393795847892761,
"y": 0.05661093816161156,
"z": 0.05661093816161156
}
},
"logo": {
"position": {
"x": 0,
"y": 0.1499999999999999,
"z": 0
}
}
}
},
"pileNumber": 2,
"pileRotationY": 0
},
{
"name": "1-2",
"box": {
"position": {
"x": -0.18658027999214435,
"y": 0.8512643658064176,
"z": 0.45017966628074646
},
"rotation": {
"x": 0,
"y": 0,
"z": 0
},
"scale": {
"x": 1,
"y": 1,
"z": 1
},
"size": {
"x": 0.37358155846595764,
"y": 0.225911445915699,
"z": 0.21794167160987854
},
"child": {
"sign": {
"position": {
"x": 0,
"y": -0.02759083972388149,
"z": 0.1743204391002655
},
"rotation": {
"x": 0,
"y": 0,
"z": 0
},
"scale": {
"x": 0.7393795847892761,
"y": 0.05661093816161156,
"z": 0.05661093816161156
}
},
"logo": {
"position": {
"x": 0,
"y": 0.1499999999999999,
"z": 0
}
}
}
},
"pileNumber": 2,
"pileRotationY": 0
},
{
"name": "1-3",
"box": {
"position": {
"x": 0.2230628973331703,
"y": 0.8511807287232012,
"z": 0.45017966628074646
},
"rotation": {
"x": 0,
"y": 0,
"z": 0
},
"scale": {
"x": 1,
"y": 1,
"z": 1
},
"size": {
"x": 0.37358155846595764,
"y": 0.225911445915699,
"z": 0.21794167160987854
},
"child": {
"sign": {
"position": {
"x": -0.005585700273513794,
"y": -0.032213962561231047,
"z": 0.1743204391002655
},
"rotation": {
"x": 0,
"y": 0,
"z": 0
},
"scale": {
"x": 0.7393795847892761,
"y": 0.05661093816161156,
"z": 0.05661093816161156
}
},
"logo": {
"position": {
"x": 0,
"y": 0.1499999999999999,
"z": 0
}
}
}
},
"pileNumber": 2,
"pileRotationY": 0
},
{
"name": "1-4",
"box": {
"position": {
"x": 0.6551478924840007,
"y": 0.8483097259524031,
"z": 0.45
},
"scale": {
"x": 1,
"y": 1,
"z": 1
},
"rotation": {
"x": 0,
"y": 0,
"z": 0
},
"size": {
"x": 0.3736,
"y": 0.2259,
"z": 0.2179
},
"child": {
"sign": {
"position": {
"x": -0.006,
"y": -0.02673691703609271,
"z": 0.1847
},
"rotation": {
"x": 0,
"y": 0,
"z": 0
},
"scale": {
"x": 1,
"y": 1,
"z": 1
}
},
"logo": {
"position": {
"x": 0,
"y": 0.15,
"z": 0
}
}
}
},
"pileNumber": 2,
"pileRotationY": 0
},
{
"name": "2-1",
"box": {
"position": {
"x": -0.60433011332925,
"y": 0.5125224579062782,
"z": 0.45017966628074646
},
"rotation": {
"x": 0,
"y": 0,
"z": 0
},
"scale": {
"x": 1,
"y": 1,
"z": 1
},
"size": {
"x": 0.37358155846595764,
"y": 0.225911445915699,
"z": 0.21794167160987854
},
"child": {
"sign": {
"position": {
"x": -0.0027324557304382324,
"y": -0.034508354476310954,
"z": 0.1743204391002655
},
"rotation": {
"x": 0,
"y": 0,
"z": 0
},
"scale": {
"x": 0.7393795847892761,
"y": 0.05661093816161156,
"z": 0.05661093816161156
}
},
"logo": {
"position": {
"x": 0,
"y": 0.15000000000000002,
"z": 0
}
}
}
},
"pileNumber": 2,
"pileRotationY": 0
},
{
"name": "2-2",
"box": {
"position": {
"x": -0.1914175066620415,
"y": 0.5095275839341008,
"z": 0.45017966628074646
},
"rotation": {
"x": 0,
"y": 0,
"z": 0
},
"scale": {
"x": 1,
"y": 1,
"z": 1
},
"size": {
"x": 0.37358155846595764,
"y": 0.225911445915699,
"z": 0.21794167160987854
},
"child": {
"sign": {
"position": {
"x": 0,
"y": -0.027170852492222397,
"z": 0.1743204391002655
},
"rotation": {
"x": 0,
"y": 0,
"z": 0
},
"scale": {
"x": 0.7393795847892761,
"y": 0.05661093816161156,
"z": 0.05661093816161156
}
},
"logo": {
"position": {
"x": 0,
"y": 0.15000000000000002,
"z": 0
}
}
}
},
"pileNumber": 2,
"pileRotationY": 0
},
{
"name": "2-3",
"box": {
"position": {
"x": 0.22360906333448538,
"y": 0.5101818344822482,
"z": 0.45017966628074646
},
"rotation": {
"x": 0,
"y": 0,
"z": 0
},
"scale": {
"x": 1,
"y": 1,
"z": 1
},
"size": {
"x": 0.37358155846595764,
"y": 0.225911445915699,
"z": 0.21794167160987854
},
"child": {
"sign": {
"position": {
"x": -0.005585700273513794,
"y": -0.030842453533999448,
"z": 0.1743204391002655
},
"rotation": {
"x": 0,
"y": 0,
"z": 0
},
"scale": {
"x": 0.7393795847892761,
"y": 0.05661093816161156,
"z": 0.05661093816161156
}
},
"logo": {
"position": {
"x": 0,
"y": 0.15000000000000002,
"z": 0
}
}
}
},
"pileNumber": 2,
"pileRotationY": 0
},
{
"name": "2-4",
"box": {
"position": {
"x": 0.6482247451401058,
"y": 0.504394091002413,
"z": 0.45
},
"scale": {
"x": 1,
"y": 1,
"z": 1
},
"rotation": {
"x": 0,
"y": 0,
"z": 0
},
"size": {
"x": 0.3736,
"y": 0.2259,
"z": 0.2179
},
"child": {
"sign": {
"position": {
"x": -0.006,
"y": -0.02471250348374021,
"z": 0.1847
},
"rotation": {
"x": 0,
"y": 0,
"z": 0
},
"scale": {
"x": 1,
"y": 1,
"z": 1
}
},
"logo": {
"position": {
"x": 0,
"y": 0.15,
"z": 0
}
}
}
},
"pileNumber": 2,
"pileRotationY": 0
},
{
"name": "3-1",
"box": {
"position": {
"x": -0.6134215690979794,
"y": 0.1945505440235138,
"z": 0.45017966628074646
},
"rotation": {
"x": 0,
"y": 0,
"z": 0
},
"scale": {
"x": 1,
"y": 1,
"z": 1
},
"size": {
"x": 0.37358155846595764,
"y": 0.225911445915699,
"z": 0.21794167160987854
},
"child": {
"sign": {
"position": {
"x": -0.0027324557304382324,
"y": -0.024228371171756358,
"z": 0.1846828854084015
},
"rotation": {
"x": 0,
"y": 0,
"z": 0
},
"scale": {
"x": 0.7393795847892761,
"y": 0.05661093816161156,
"z": 0.05661093816161156
}
},
"logo": {
"position": {
"x": 0,
"y": 0.15000000000000002,
"z": 0
}
}
}
},
"pileNumber": 2,
"pileRotationY": 0
},
{
"name": "3-2",
"box": {
"position": {
"x": -0.19111044416229633,
"y": 0.1945505440235138,
"z": 0.45017966628074646
},
"rotation": {
"x": 0,
"y": 0,
"z": 0
},
"scale": {
"x": 1,
"y": 1,
"z": 1
},
"size": {
"x": 0.37358155846595764,
"y": 0.225911445915699,
"z": 0.21794167160987854
},
"child": {
"sign": {
"position": {
"x": 0,
"y": -0.021009267483951266,
"z": 0.1846828854084015
},
"rotation": {
"x": 0,
"y": 0,
"z": 0
},
"scale": {
"x": 0.7393795847892761,
"y": 0.05661093816161156,
"z": 0.05661093816161156
}
},
"logo": {
"position": {
"x": 0,
"y": 0.15000000000000002,
"z": 0
}
}
}
},
"pileNumber": 2,
"pileRotationY": 0
},
{
"name": "3-3",
"box": {
"position": {
"x": 0.21581759477578777,
"y": 0.1945505440235138,
"z": 0.45017966628074646
},
"rotation": {
"x": 0,
"y": 0,
"z": 0
},
"scale": {
"x": 1,
"y": 1,
"z": 1
},
"size": {
"x": 0.37358155846595764,
"y": 0.225911445915699,
"z": 0.21794167160987854
},
"child": {
"sign": {
"position": {
"x": -0.005585700273513794,
"y": -0.020448554878266023,
"z": 0.1846828854084015
},
"rotation": {
"x": 0,
"y": 0,
"z": 0
},
"scale": {
"x": 0.7393795847892761,
"y": 0.05661093816161156,
"z": 0.05661093816161156
}
},
"logo": {
"position": {
"x": 0,
"y": 0.15000000000000002,
"z": 0
}
}
}
},
"pileNumber": 2,
"pileRotationY": 0
},
{
"name": "3-4",
"box": {
"position": {
"x": 0.6432047193626257,
"y": 0.19147498005043284,
"z": 0.45
},
"scale": {
"x": 1,
"y": 1,
"z": 1
},
"rotation": {
"x": 0,
"y": 0,
"z": 0
},
"size": {
"x": 0.3736,
"y": 0.2259,
"z": 0.2179
},
"child": {
"sign": {
"position": {
"x": -0.006,
"y": -0.013996807328698846,
"z": 0.1847
},
"rotation": {
"x": 0,
"y": 0,
"z": 0
},
"scale": {
"x": 1,
"y": 1,
"z": 1
}
},
"logo": {
"position": {
"x": 0,
"y": 0.15,
"z": 0
}
}
}
},
"pileNumber": 2,
"pileRotationY": 0
}
],
"cells": data.shelves.find(x => x).material_json.cells,
"position": {
"x": 2.5193034425825944,
"y": -1.0605054800098004,
@@ -927,23 +70,21 @@ const factorys = [
"z": 1
},
"wares": [
{
"planetid": `${key}-ware`,
"name": `商品${key}`,
"wares": data.wares.map((x, i) => ({
"planetid": `ware-${key}-${i}`,
"name": `商品${key}-${i}`,
"surveyWare": {
"id": "ware1-1",
"id": `ware-${key}-${i}`,
"type": 1,
"commodity": {
"url": "https://test-cxp-public-web-1302259445.cos.ap-beijing.myqcloud.com/uat-yls/3D/shelves/shelves-v3-store/v3.4/ware/milkpowder-can1-lod0.glb"
"url": x.material_json.commodity.url
},
"texture": null,
"urlThumb": "https://test-cxp-public-web-1302259445.cos.ap-beijing.myqcloud.com/uat-yls/3D/shelves/shelves-v3-store/v3.4/ware/milkpowder-can1.png"
},
"surveyLogo": "",
"surveyPrice": 190
}
]
}))
}
]
}

View File

@@ -113,9 +113,8 @@ const show = (type) => {
}
const ok = async () => {
step.value++;
if(formData.value.type == CREATIVE_TYPE.THREE_D) {
if(step.value >= 4) {
if(step.value >= 3) {
formData.value.data = buildData(formData.value);
await createMaterialCenter(formData.value);
visible.value = false;
@@ -123,13 +122,14 @@ const ok = async () => {
}
}
else {
if(step.value >= 2) {
if(step.value >= 1) {
formData.value.data = buildData(formData.value)
await createMaterialCenter(formData.value);
visible.value = false;
emit("complete");
}
}
step.value++;
}
defineExpose({

View File

@@ -80,8 +80,16 @@ const factorys = [
type: THREE_D_TYPE.SHELF,
build(data){
var url = "";
var cells = [];
try{
url = data.fileList[0].response.url;
data.fileList.forEach(file => {
if(file.response.url){
url = file.response.url;
}
if(file.response.cells){
cells = file.response.cells;
}
})
}
catch(e){ }
//#region 返回值
@@ -94,7 +102,7 @@ const factorys = [
"url": url,
"urlThumb": "",
"hideWhenSurvey": true,
"cells": [],
"cells": cells,
"position": {
"x": 2.5193034425825946,
"y": -1.0605054800098004,
@@ -170,7 +178,7 @@ const factorys = [
"texture": null,
"urlThumb": "",
"surveyLogo": "",
"surveyPrice": 190
"surveyPrice": 10
},
};
}

View File

@@ -64,6 +64,7 @@ import { THREE_D_TYPE_S, THREE_D_TYPE, buildData } from "./CreateMaterial.consta
const { ref, reactive }=require("@vue/reactivity");
import common from "@/api/common.js";
import { createMaterialLibrary } from "../api";
import { message } from 'ant-design-vue';
const emit = defineEmits(["complete"]);
@@ -81,6 +82,11 @@ const formData = ref({
const show = (type) => {
if(type == THREE_D_TYPE.CHARTLET) {
message.info("素材库不支持上传贴图");
return;
}
const obj = THREE_D_TYPE_S.find(x => x.type == type);
if(!obj) return;
@@ -95,17 +101,32 @@ const show = (type) => {
}
const onCustomRequest = async (upload) => {
if(formData.value.type == THREE_D_TYPE.SHELF) {
if(upload.file.name.lastIndexOf(".json") >= 0) {
var reader = new FileReader();
reader.readAsText(upload.file,"utf-8");
reader.onload = () => {
//读取完成后数据保存在对象的result属性中
upload.onSuccess({
cells: JSON.parse(reader.result)
});
}
return;
}
}
const data = await common.cosUpload3D(upload.file);
upload.onSuccess(data);
}
const ok = async () => {
step.value++;
if(step.value >= 2) {
if(step.value >= 1) {
await createMaterialLibrary(buildData(formData.value));
visible.value = false;
emit("complete");
}
step.value++;
}
defineExpose({

View File

@@ -14,6 +14,9 @@ defineExpose({
if(data.type == CREATIVE_TYPE.RING_360) {
ring360PreviewerRef.value.show(data);
}
if(data.type == CREATIVE_TYPE.MODEL_3D) {
window.open("/#/model3d-preview");
}
}
})
</script>

View File

@@ -1,5 +1,5 @@
<template>
<a-modal v-model:visible="visible" title="3D环物" width="800px" @ok="ok">
<a-modal v-model:visible="visible" title="3D环物" width="1000px" @ok="ok" :footer="null">
<iframe v-if="visible" :src="url" frameborder="0" style="width: 100%; height: 500px;"></iframe>
</a-modal>
</template>
@@ -7,7 +7,6 @@
<script setup>
const { ref }=require("@vue/reactivity");
const visible = ref(false);
const url = ref("")

View File

@@ -10,7 +10,7 @@
</template>
<script>
import { SurveyViewer } from "./shelves.module";
import { ShopSurveyViewer as SurveyViewer } from "@/views/Creative/lib/shelves.module.js";
import { debounce } from 'lodash-es';
var viewer_ = null;