This commit is contained in:
2026-05-14 18:21:05 +08:00
parent 38d98eb553
commit 19bb93dce4
5 changed files with 18 additions and 16 deletions

View File

@ -469,7 +469,7 @@
this.classList.toggle('active');
});
});
let sku = ""
// 单选按钮逻辑
document.querySelectorAll('.option-btn').forEach(btn => {
btn.addEventListener('click', async function () {
@ -504,9 +504,18 @@
// 百叶模型替换逻辑
// if (categoryName === "louver") {
const currentText = this.textContent;
console.log(currentText);
const response = await fetch(`http://localhost:3001/api/product-configs/by-sku/${currentText}`);
const result = await response.json();
if (result.code === 200) {
const { divisions, enable_placement_zone } = result.data;
// const {position_x, position_y, position_z} = data;
if (enable_placement_zone) {
sku = currentText;
await placementWall(divisions);
}
}
skuToFunc(currentText);
// skuToFunc(currentText);
// }
});
});
@ -516,16 +525,7 @@
await hotspotRequest();
})
let sku = ""
const skuToFunc = async (currentText) => {
sku = currentText;
if(currentText.includes("3m")){
await placementWall(3);
}else{
await placementWall(1);
}
}
const hotspotRequest = async () => {
try {
@ -863,7 +863,7 @@
// 将模型放置到该区域
try {
const response = await fetch(`http://localhost:3000/api/product-configs/by-sku/${sku}`);
const response = await fetch(`http://localhost:3001/api/product-configs/by-sku/${sku}`);
const result = await response.json();
if (result.code === 200 && result.data) {
@ -875,7 +875,7 @@
if (event.event_type === 'change_model') {
console.log(event.target_data);
const {id, name, file_url, model_control_type, category } = event.target_data;
const { id, name, file_url, model_control_type, category } = event.target_data;
console.log('替换百叶模型:', event);
console.log('替换百叶模型类型:', category);
@ -892,7 +892,7 @@
modelControlType: model_control_type,
drag: {
enable: true,
axis: Math.abs((rotation.y-0)) <90 ? 'x' : 'z',
axis: Math.abs((rotation.y - 0)) < 90 ? 'x' : 'z',
step: 0.1,
},
transform: {