From 4e0de68fb6fdb5fbfd29c910325fb824e857cbb2 Mon Sep 17 00:00:00 2001 From: tonkia Date: Tue, 25 Dec 2018 19:15:36 +0800 Subject: [PATCH] home crop picture and fix some mistakes --- app.js | 18 +++- static/img/webbg.jpg | Bin 4780 -> 15125 bytes static/js/createScheme.js | 196 ++++++++++++++++++++++++-------------- views/createScheme.html | 23 ++++- views/home.html | 2 +- 5 files changed, 162 insertions(+), 77 deletions(-) diff --git a/app.js b/app.js index 0a7c118..c33b133 100644 --- a/app.js +++ b/app.js @@ -162,8 +162,12 @@ app.post('/saveScheme', function (req, res) { //------------------------------------------------------------------------------------------------ //获取初始方案 app.post('/getScheme', function (req, res) { - var data = { name: '默认方案', components: [], img: null, id: null }; - res.send(data); + var data = { name: '默认方案', components: [], img: null, id: null, maxHeight: 10, height: 2, maxDistance: 30, distance: 10 }; + replyData = { + msg: 0, + data: data + } + res.send(replyData); }); //根据局ID获取初始方案 @@ -175,9 +179,17 @@ app.post('/getScheme/:id', function (req, res) { if (row.length > 0) { var data = JSON.parse(row[0].data); data.id = id; - res.send(data); + replyData = { + msg: 0, + data: data + } + res.send(replyData); } else { //TODO 找不到方案 + replyData = { + msg: 1 + } + res.send(replyData); } }) } else { diff --git a/static/img/webbg.jpg b/static/img/webbg.jpg index 18d83c063d8fefd00f8f76faf6b77fda03203de8..cc62d499e27adb374897853b84e16b2c56fbf8c4 100644 GIT binary patch literal 15125 zcmbVTdsvj`mH$T2Q3Fm**aj7tMAL%WR3$VD%8bURYgQ}21jrl28R8e^L{g!w14bw`o!wY zB;kF(bAGpTX87uGyY!>wOP4K`6beaF;D6HachX{M?3gjiF{8&SmCAAB#*X*#^YwY+ z37<(%KBe*toU9HCoE#AF%yT~verD>=rUe9q%$@$T*>l3e!qmaxk@G?q{QQNmQ2LiB z#*G{2^MsGTudjdTvjNYB{-6IE{z95KR`D~%BQM2NY1Bl8*F?qeSCSe(=V%50CCPs& zMtOOU9-|yPZu}GY!0{hRqZD3VqrAOFkM{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0b%oI-;Fp|5To-ohs)c$mz6&L6!D6fiuj#XAu}7>vB9EJQO#@pTxtnGBY0$g&cM8M#mi?z(d*hyKS%SZK$4n93)os zp#U7h4msu&sN3iYsR2U=1{MZ{J4|TZVVzw;>$W-_0V0RDv~J@PSy<9juMY&)0e$HK zN`=RoG)7;fwo9F>eBoF=xU)s-wZ}~+6z}88LqCb58J;Hv%C+2@4>`DP>og}?ynes` zeta!lJ|xbJ8V!KM+M~vm4cP{SdT;(V=iWL3Cu|YaHt6>3K3Jl>eODT!DlEF@pzqMa z&yLK<56T#WS&77&m_;DqMl1qoiBk;m$w36yjp2UD^#Cwota!!ti;j`scuz4{ZS}}u7Z}zaSoo zM1f2v+C&0lIBu<1LIRsm3~@OTd&KOt693i_fV~UFV8y;M&TMt{?KYhM-8S=%xfep3 zKnQTV2Tcj#&6@8Fub<&tVr9B*5o$#ow(>r`tJRrAk)eR3f+rS1aWHn+NGy@Ptw)#W z4nzU}yJ3;n&;YPx5&{B(z{ZoCOl&)TiCc-Kv>~$(aK~2-HuaStS23l{ZXF|{(8D@t z8z3}sm8z~Zefm)pkJVy?k;7MHl?Gb^ZSVjNwA;x?0QnUmQ#YpY1Fx61f%=8XIzuU*k)t!D@1>IsJ3Ypp= 0 && textureIndex >= 0) - replaceTexture(data.components[comIndex].models[modelIndex].modelObj, data.components[comIndex].textures[textureIndex].textureObj); - } + for (var comIndex in data.components) { + var modelIndex = data.components[comIndex].modelIndex; + var textureIndex = data.components[comIndex].textureIndex; + //赋贴图 + if (data.components[comIndex].models.length > 0 && data.components[comIndex].textures.length > 0) + replaceTexture(data.components[comIndex].models[modelIndex].modelObj, data.components[comIndex].textures[textureIndex].textureObj); } } + //--------------------------------------------------------------------------------------------------------------------- //初始化所有事件 function initEvent() { @@ -323,42 +326,63 @@ function initEvent() { //复制一个saveData var saveData = {}; $.extend(saveData, data); - //去除aveData中多余的数据 - for (var index in saveData.components) { - for (textureIndex in saveData.components[index].textures) { - delete saveData.components[index].textures[textureIndex].textureObj; - } - for (modelIndex in saveData.components[index].models) { - delete saveData.components[index].models[modelIndex].modelObj; - } - } //生成缩略图 + var imgData = renderer.domElement.toDataURL("image/jpeg");//这里可以选择png格式jpeg格式 + var image = new Image(); - let imgData = renderer.domElement.toDataURL("image/jpeg");//这里可以选择png格式jpeg格式 - saveData.img = imgData; - //上传服务器 - $.ajax({ - type: "POST", - url: "/saveScheme", - contentType: "application/json; charset=utf-8", - data: JSON.stringify(saveData), - success: function (returnData) { - console.info(returnData); - if (returnData.affectedRows > 0) { - //获取保存后的id - if (returnData.insertId) - data.id = returnData.insertId; - new $.zui.Messager('保存成功!', { - type: 'success', - close: false, - actions: [{ - icon: 'times', - text: '确定' - }] - }).show(); + image.src = imgData; + //异步 + image.onload = function () { + var sWidth = image.width; + var sHeigth = image.height; + var tWidth = sHeigth / 1.2; + var tHeigth = sHeigth; + //压缩后的像素 + $('#compress')[0].width = 200; + $('#compress')[0].height = 240; + //console.info(sWidth + ":" + sHeigth + ":" + tWidth + ":" + tHeigth); + //压缩图片 + $('#compress')[0].getContext('2d').drawImage(image, (sWidth - tWidth) / 2, (sHeigth - tHeigth) / 2, tWidth, tHeigth, 0, 0, $('#compress')[0].width, $('#compress')[0].height); + imgData = $('#compress')[0].toDataURL("image/jpeg", 0.5); + + saveData.img = imgData; + //去除多余数据 + var sendData = JSON.stringify(saveData, function (key, value) { + if (key == 'textureObj' || key == 'modelObj') { + return null; + } else { + return value; } - } - }); + }) + // console.info(data); + // console.info(saveData); + // console.info(sendData); + //上传服务器 + $.ajax({ + type: "POST", + url: "/saveScheme", + contentType: "application/json; charset=utf-8", + data: sendData, + success: function (returnData) { + // console.info(returnData); + if (returnData.affectedRows > 0) { + //获取保存后的id + if (returnData.insertId) + data.id = returnData.insertId; + new $.zui.Messager('保存成功!', { + type: 'success', + close: false, + actions: [{ + icon: 'times', + text: '确定' + }] + }).show(); + } + } + }); + }; + + }); //方案名变动监听 @@ -503,6 +527,34 @@ function initEvent() { $('#textureManagerment').click(function () { $('#textureManagermentModal').modal('show'); }); + + //相机高度控制 + $('#cameraHeight').mousemove(function () { + var height = data.maxHeight / 100 * $('#cameraHeight').val(); + data.height = parseFloat(height.toFixed(2)); + $('#cameraHeightValue').text(data.height); + camera.position.y = data.height + controls.target.set(0, data.height, 0); + controls.update(); + }); + + //相机距离控制 + $('#cameraDistance').mousemove(function () { + distance = data.maxDistance / 100 * $('#cameraDistance').val(); + data.distance = parseFloat(distance.toFixed(2)); + $('#cameraDistanceValue').text(data.distance); + controls.minDistance = data.distance; + controls.maxDistance = data.distance; + controls.update(); + }); + + $('#cameraHeightMaxValue').change(function () { + data.maxHeight = parseFloat($('#cameraHeightMaxValue').val()); + }); + + $('#cameraDistanceMaxValue').change(function () { + data.maxDistance = parseFloat($('#cameraDistanceMaxValue').val()); + }); } // 选择上传完成后加载模型 diff --git a/views/createScheme.html b/views/createScheme.html index 59956a9..d0eac49 100644 --- a/views/createScheme.html +++ b/views/createScheme.html @@ -54,11 +54,15 @@ #textureField>img{ margin-top:5px; } - + #cameraConfig>*{ + margin-top:5px; + margin-bottom:5px; + } +
@@ -68,8 +72,23 @@
+
+
+
+
+
+ xx
+ +
+
+ xx
+ +
+
+
+
@@ -174,6 +193,8 @@
+ + diff --git a/views/home.html b/views/home.html index 2b14acd..bd24736 100644 --- a/views/home.html +++ b/views/home.html @@ -86,7 +86,7 @@ var name = data.schemeList[index].name; var img = data.schemeList[index].img; var id = data.schemeList[index].id; - $('#schemeList').append(""); + $('#schemeList').append(""); } }); }