From 1a2c1d005bf7de2528f73638fb24d31da812aad5 Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Tue, 22 Jun 2021 17:40:13 +0800
Subject: [PATCH] 增加模型

---
 widgets/modelDiagram/Widget.js |  113 ++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 96 insertions(+), 17 deletions(-)

diff --git a/widgets/modelDiagram/Widget.js b/widgets/modelDiagram/Widget.js
index 434f01e..360a0b0 100644
--- a/widgets/modelDiagram/Widget.js
+++ b/widgets/modelDiagram/Widget.js
@@ -47,36 +47,115 @@
 				$('.jimu-widget-modelDiagram').find('.always').unbind("mousedown").bind("mousedown", function (event) {
 					if (event.which == 3) {
 						// console.log('you');
-						that.getInput();
-						var as = that.a - 0.00004
-							, bs = that.b - 0.00004;
-						for (var i = 1; i <= 7; i++) {
-							var aa = as * 100000;
-							aa += i;
-							aa = aa / 100000;
-							for (var n = 1; n <= 6; n++) {
-								var bb = bs * 100000;
-								bb += n;
-								bb = bb / 100000;
-								// console.log(aa,bb)
-								that.always(aa, bb);
-							}
+						if ($("#modelDiagramCHONGFU").is(":hidden")) {//判断是否隐藏
+							$('#modelDiagramCHONGFU').show();
+							$('#modelDYes').click(() => {
+								that.getInput();
+								var W = $('#modelDiagramW').val()
+									, H = $('#modelDiagramH').val()
+									, JW = $('#modelDiagramJW').val()
+									, JH = $('#modelDiagramJH').val()
+									, as = that.a - (0.00001 * ((+H + 1) / 2)) * JH
+									, bs = that.b - (0.00001 * ((+W + 1) / 2)) * JW;
+								for (var i = 1; i <= H; i++) {
+									var aa = as * 100000;
+									aa += i * JH;
+									aa = aa / 100000;
+									for (var n = 1; n <= W; n++) {
+										var bb = bs * 100000;
+										bb += n * JW;
+										bb = bb / 100000;
+										// console.log(aa,bb)
+										that.always(aa, bb);
+									}
+								}
+							})
+							$('#modelDNo').click(() => {
+								$('#modelDiagramCHONGFU').hide();
+							})
 						}
-
 					} else if (event.which == 1) {
 						// console.log('zuo');
 					}
 				});
+
 				$('.jimu-widget-modelDiagram').find('.closesmodelDiagram').click(() => {
 					$('.jimu-widget-modelDiagram').hide();
 					that.stopPlay();
 				})
+				//初演示
+				layui.use(['dropdown', 'util', 'layer', 'table'], function () {
+					var dropdown = layui.dropdown
+						, layer = layui.layer;
+					dropdown.render({
+						elem: '.models'
+						, data: [{
+							title: '人偶'
+							, value: './images/gltf/Cesium_Man.glb'
+							, id: 100
+							, num: [3, 3, 1, 1]
+						}, {
+							title: '飞机'
+							, value: './images/gltf/Cesium_Air.glb'
+							, id: 101
+							, num: [3, 3, 30, 30]
+						}, {
+							title: '飞机2'
+							, value: './images/gltf/CesiumDrone.glb'
+							, id: 102
+							, num: [3, 3, 7, 7]
+						}, {
+							title: '装甲车'
+							, value: './images/gltf/GroundVehicle.glb'
+							, id: 103
+							, num: [3, 3, 4, 9]
+						}, {
+							title: '热气球'
+							, value: './images/gltf/CesiumBalloon.glb'
+							, id: 104
+							, num: [3, 3, 1, 1]
+						}, {
+							title: '牛奶车动画'
+							, value: './images/gltf/CesiumMilkTruck.glb'
+							, id: 105
+							, num: [3, 3, 1, 1]
+						}, {
+							title: '牛奶车gltf'
+							, value: './images/gltf/CesiumMilkTruck.gltf'
+							, id: 106
+							, num: [3, 3, 1, 1]
+						}, {
+							title: '人gltf'
+							, value: './images/gltf/walk.gltf'
+							, id: 107
+							, num: [3, 3, 1, 1]
+						}
+						]
+						, click: function (obj) {
+							layer.tips('选择了:' + obj.title, this.elem, { tips: [1, '#5FB878'] });
+							that.urls = obj.value;
+							var dom = $('.models');
+							dom.empty();
+							var str = `${obj.title} <i class="layui-icon layui-icon-down layui-font-12"></i>`
+							dom.append(str);
+							that.setNum(obj.num)
+						}
+					});
+				});
+
 
 			},
-			beginCesium: function (a = 116.058987, b = 28.973468, g = 1000, once = 'always') {
+			urls: './images/gltf/Cesium_Man.glb',
+			setNum: function (num) {
+				$('#modelDiagramW').val(num[0])
+				$('#modelDiagramH').val(num[1])
+				$('#modelDiagramJW').val(num[2])
+				$('#modelDiagramJH').val(num[3])
+			},
+			beginCesium: function (a, b, g, once) {
 				var viewer = this.map
 					, that = this
-					, url = "./images/gltf/Cesium_Man.glb";
+					, url = that.urls;
 
 				//静态
 				// var position = Cesium.Cartesian3.fromDegrees(116.058987, 28.973468, 1000);

--
Gitblit v1.9.3