diff --git a/ScreenShot_2026-05-16_160948_763.png b/ScreenShot_2026-05-16_160948_763.png new file mode 100644 index 0000000..31035ee Binary files /dev/null and b/ScreenShot_2026-05-16_160948_763.png differ diff --git a/ScreenShot_2026-05-16_162707_658.png b/ScreenShot_2026-05-16_162707_658.png new file mode 100644 index 0000000..22b674a Binary files /dev/null and b/ScreenShot_2026-05-16_162707_658.png differ diff --git a/ScreenShot_2026-05-16_164044_115.png b/ScreenShot_2026-05-16_164044_115.png new file mode 100644 index 0000000..60311fb Binary files /dev/null and b/ScreenShot_2026-05-16_164044_115.png differ diff --git a/ScreenShot_2026-05-16_165441_930.png b/ScreenShot_2026-05-16_165441_930.png new file mode 100644 index 0000000..07990d7 Binary files /dev/null and b/ScreenShot_2026-05-16_165441_930.png differ diff --git a/index copy 3.html b/index copy 3.html new file mode 100644 index 0000000..a76ab35 --- /dev/null +++ b/index copy 3.html @@ -0,0 +1,954 @@ + + + + + + + 3D Model Showcase SDK - TS + + + + +
+ +
+ + + + + +
+ + +
+
选装选配
+ + + + + +
+
+ 棚子尺寸 + +
+
+
+ + + + +
+
+
+ + +
+
+ 棚子类型 + +
+
+
+ + + + +
+
+
+ + +
+
+ 百叶 + +
+
+
+ + + + + +
+
+
+ + +
+
+ 配色 + +
+
+
+ + + + +
+
+
+ + + +
+
+ + + + + + + + + \ No newline at end of file diff --git a/index.html b/index.html index 0c0c205..8b9bfe8 100644 --- a/index.html +++ b/index.html @@ -509,13 +509,14 @@ if (result.code === 200) { console.log(result.data); sku = currentText; - const { enable_placement_zone,wall_divisions } = result.data; + await initPlacementZoneConfig(); + const { enable_placement_zone, wall_divisions } = result.data; // const {position_x, position_y, position_z} = data; if (enable_placement_zone && wall_divisions != undefined) { - // await initPlacementZoneConfig(placement_zone); + console.log(wall_divisions); - await placementWall(wall_divisions); + // await placementWall(wall_divisions); } } @@ -798,8 +799,8 @@ }); // 初始化放置区域配置数据(只需设置一次) - const initPlacementZoneConfig = (placement_zone) => { - const { alpha, border_color, color, show_border, thickness, walls } = placement_zone + const initPlacementZoneConfig = (divisions=1) => { + // 只清除旧的放置区域网格,不清除模型 kernel.dropZone.clearZones(); // 调整 baseY 来控制整体高度(正数向上,负数向下) @@ -807,19 +808,52 @@ const height = 2.27; // 调整 offset 来控制每个面向外或向内的偏移 // 正数 = 向外移动,负数 = 向内移动 - const wallOffset = -0.07; // 修改这个值来调整墙面偏移 + const wallOffset = 0; // 修改这个值来调整墙面偏移 kernel.dropZone.setData({ - color: color, - alpha: +alpha, - thickness: thickness, - showBorder: !show_border, - borderColor: border_color, - walls: walls + color: "#21c7ff", + alpha: 0.3, + thickness: 2, + showBorder: true, + borderColor: "#ffffff", + walls: [ + { + name: 'front', + startPoint: [-1.85, baseY, -1.45], + endPoint: [1.85, baseY, -1.45], + height: height, + divisions: divisions, + offset: wallOffset // 向外或向内偏移 + }, + { + name: 'back', + startPoint: [1.85, baseY, 1.45], + endPoint: [-1.85, baseY, 1.45], + height: height, + divisions: divisions, + offset: wallOffset + }, + { + name: 'left', + startPoint: [-2.9, baseY, 1.45], + endPoint: [-2.9, baseY, -1.45], + height: height, + divisions: divisions, + offset: wallOffset + }, + { + name: 'right', + startPoint: [2.9, baseY, -1.45], + endPoint: [2.9, baseY, 1.45], + height: height, + divisions: divisions, + offset: wallOffset + } + ] }); - kernel.dropZone.generateDropZones(); + kernel.dropZone.generateDropZones(divisions); // 显示放置区域 kernel.dropZone.show(); dropZoneVisible = true; @@ -834,7 +868,7 @@ divisions: wall.divisions })) console.log(divisions); - + kernel.dropZone.updateDivisions(divisions); // 显示放置区域 kernel.dropZone.show(); diff --git a/index.js b/index.js index 17e3e00..08c6f27 100644 --- a/index.js +++ b/index.js @@ -32,16 +32,20 @@ const data = await response.json() const models = data.data // 这就是模型列表 models.forEach(model => { - const { alpha, border_color, color, show_border, thickness, walls } = model.placement_zone - kernel.dropZone.setData({ + console.log(model.placement_zone); + if (model.placement_zone) { + const { alpha, border_color, color, show_border, thickness, walls } = model.placement_zone + kernel.dropZone.setData({ + + color: color, + alpha: +alpha, + thickness: thickness, + showBorder: !show_border, + borderColor: border_color, + walls: walls + }); + } - color: color, - alpha: +alpha, - thickness: thickness, - showBorder: !show_border, - borderColor: border_color, - walls: walls - }); kernel.model.add({ modelId: model.id, modelUrl: model.file_url,