This commit is contained in:
2026-06-04 16:15:21 +08:00
parent 7676364229
commit bef0bf527b
34 changed files with 158 additions and 309 deletions

View File

@ -44,7 +44,10 @@ export const init = async (customConfig = {}) => {
container: document.querySelector('#renderDom'),
modelUrlList: [],
env: { envPath: 'https://cdn.files.zguiy.com/zt/environment.env', intensity: 1.2, rotationY: 0.3, background: false },
camera:{},
camera: {
position: { x: 5, y: 2, z: 7 }, // 相机位置x-左右y-上下z-前后
target: { x: 0, y: 1, z: 0 } // 相机目标点:相机看向的位置
},
gizmo: {
position: false,
rotation: false,
@ -59,7 +62,6 @@ export const init = async (customConfig = {}) => {
}
};
// 合并用户自定义配置
const config = { ...defaultConfig, ...customConfig };
kernel.init(config);
}
@ -106,10 +108,12 @@ export const getPlacementZone = async (sku) => {
let division_include = []
// 同时包含10和13
const only10_13 = /(?=.*10)(?=.*13)/.test(pergolaSku)
// 只包含10 无13 无12
const only10 = /(?=.*10)(?!.*13)(?!.*12)/.test(pergolaSku)
// 只包含10 无13 无12 无20
const only10 = /(?=.*10)(?!.*13)(?!.*12)(?!.*20)/.test(pergolaSku)
// 同时包含10和12
const only10_12 = /(?=.*10)(?=.*12)/.test(pergolaSku)
// 同时包含10和20
const only10_20 = /(?=.*10)(?=.*20)/.test(pergolaSku)
// 1. 只要字符串里包含 10就返回 true
const has10 = /10/.test(sku);
@ -140,7 +144,24 @@ export const getPlacementZone = async (sku) => {
if (only10_12 && has10) {
division_include.push('左', '右')
}
//棚子同时包10和20的并且含配件是10
if (only10_20 && has10) {
if (pergolaSku === "SPF111S1020PILLAR4PCS") {
division_include.push('左', '右')
}
else {
division_include.push('前', '后', '左', '右', "前1", "后1", "前2", "后2")
}
}
//棚子同时包10和20的并且含配件是13
if (only10_20 && has13) {
if (pergolaSku === "SPF111S1020PILLAR4PCS") {
division_include.push('前', '后')
}
}
const response = await fetch(apiConfig.getApiUrl(`/api/product-configs/by-sku/${sku}`));
const result = await response.json();
if (result.code === 200) {
@ -202,7 +223,7 @@ export const executeEvent = async (dropzone_data, result, sku) => {
// 第一次循环:处理 change_model
for (const event of result.data.events) {
if (event.event_type === 'change_model') {
const { name, file_url, model_control_type, category } = event.target_data;
// 生成唯一的模型ID
@ -210,7 +231,7 @@ export const executeEvent = async (dropzone_data, result, sku) => {
modelName = name;
kernel.dropZone.recordModelPlacement(wallName, index, name + '_' + modelId);
await kernel.model.add({
modelName: name,