¶Ô±ÈÐÂÎļþ |
| | |
| | | <!DOCTYPE html> |
| | | <html xmlns="http://www.w3.org/1999/xhtml"> |
| | | <head> |
| | | <title>LFæ¥å£æµè¯</title> |
| | | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| | | <script src="js/jquery.1.12.4.js"></script> |
| | | <script src="js/rsa.min.js"></script> |
| | | <script src="js/rollups.js"></script> |
| | | <script> |
| | | window.onload = function () { |
| | | getPublicKey(); |
| | | } |
| | | |
| | | function getPublicKey() { |
| | | $.get(url + "sign/getPublicKey", function (rs) { |
| | | if (rs && rs.code == 200) { |
| | | window.encrypt = new JSEncrypt(); |
| | | encrypt.setPublicKey(rs.result); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | function ajax(url, type, data, dataType, contentType, fn) { |
| | | $.ajax({ |
| | | url: url, |
| | | type: type, |
| | | data: data, |
| | | dataType: dataType || "json", // htmlãjsonãjsonpãscriptãtext |
| | | contentType: contentType || "application/json", // "application/x-www-form-urlencoded" |
| | | success: function (data) { |
| | | fn(data); |
| | | }, |
| | | error: function (e) { |
| | | console.error(e); |
| | | fn(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | function TestCros() { |
| | | $.get(url + "Style/selectCount", function (rs) { |
| | | alert(rs.result); |
| | | }); |
| | | } |
| | | |
| | | function check() { |
| | | $.get(url + "sign/check" + token, function (rs) { |
| | | alert("code: " + rs.code + ", msg: " + rs.msg + ", result: " + rs.result); |
| | | }); |
| | | } |
| | | |
| | | function getCurrentUser() { |
| | | $.get(url + "sign/getCurrentUser" + token, function (rs) { |
| | | alert("code: " + rs.code + ", msg: " + rs.msg + ", result: " + rs.result.uname); |
| | | }); |
| | | } |
| | | |
| | | function logout() { |
| | | $.get(url + "sign/logout" + token, function (rs) { |
| | | alert("code: " + rs.code + ", msg: " + rs.msg + ", result: " + rs.result); |
| | | }); |
| | | } |
| | | |
| | | function updateUsersPwd() { |
| | | var data = { |
| | | "adminPwd": encrypt.encrypt("Admin@123"), |
| | | "newPwd": encrypt.encrypt("Admin@123"), |
| | | "ids": [4, 5] |
| | | }; |
| | | |
| | | // JSON.stringify(data),"application/x-www-form-urlencoded" |
| | | ajax(url + "user/updateUsersPwd" + token, "POST", JSON.stringify(data), "json", null, function (rs) { |
| | | alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); |
| | | console.log(rs); |
| | | }); |
| | | } |
| | | |
| | | function insertUser() { |
| | | var data = { |
| | | // |
| | | }; |
| | | ajax(url + "user/updateUsersPwd" + token, "POST", JSON.stringify(data), "json", null, function (rs) { |
| | | alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); |
| | | console.log(rs); |
| | | }); |
| | | } |
| | | |
| | | function ajxUpload() { |
| | | var formData = new FormData(); |
| | | var fs = document.getElementById("file1"); |
| | | for (var i = 0, c = fs.files.length; i < c; i++) { |
| | | formData.append("file", fs.files[i]); // fs.files[i].name |
| | | } |
| | | |
| | | $.ajax(url + "style/upload" + token, { |
| | | type: "post", |
| | | data: formData, |
| | | async: false, |
| | | cache: false, |
| | | processData: false, |
| | | contentType: false, |
| | | success: function (rs) { |
| | | alert(rs.code + "ï¼" + rs.result); |
| | | console.log(rs); |
| | | }, |
| | | error: function (e) { |
| | | console.error(e); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | // ä¸ä¼ æ°æ® |
| | | function uploadData() { |
| | | var formData = new FormData(); |
| | | var fs = document.getElementById("file1"); |
| | | for (var i = 0, c = fs.files.length; i < c; i++) { |
| | | formData.append(fs.files[i].name, fs.files[i]); // fs.files[i].name,file |
| | | } |
| | | formData.append("name", "æµè¯"); |
| | | formData.append("dirid", "10"); |
| | | formData.append("depid", "1"); |
| | | formData.append("verid", "1"); |
| | | formData.append("type", "gdb"); |
| | | formData.append("cs", "CGCS 2000"); |
| | | formData.append("scale", "1:1000"); |
| | | formData.append("resolution", "0.5m"); |
| | | formData.append("gather", "2022-10-03 15:00:00"); |
| | | formData.append("descr", "è´¨éä¸é"); |
| | | |
| | | $.ajax(url + "uploader/uploadData" + token, { |
| | | type: "post", |
| | | data: formData, |
| | | async: true, |
| | | cache: false, |
| | | processData: false, |
| | | contentType: false, |
| | | success: function (rs) { |
| | | alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); |
| | | console.log(rs); |
| | | }, |
| | | error: function (e) { |
| | | console.error(e); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | function uploadShpForWKT() { |
| | | var formData = new FormData(); |
| | | var fs = document.getElementById("shpFiles"); |
| | | var exts = [".shp", ".shx", ".dbf", ".prj"]; |
| | | |
| | | var count = 0; |
| | | for (var i = 0, c = fs.files.length; i < c; i++) { |
| | | var name = fs.files[i].name.toLocaleLowerCase(); |
| | | var ext = name.substring(name.lastIndexOf(".")); |
| | | if (exts.indexOf(ext) > -1) { |
| | | count++; |
| | | formData.append(fs.files[i].name, fs.files[i]); // fs.files[i].name,file |
| | | } |
| | | } |
| | | if (count != 4) { |
| | | alert("ShapeFileæä»¶éæ©ä¸å
¨ï¼"); |
| | | return; |
| | | } |
| | | |
| | | $.ajax(url + "inquiry/uploadShp" + token, { |
| | | type: "post", |
| | | data: formData, |
| | | async: true, |
| | | cache: false, |
| | | processData: false, |
| | | contentType: false, |
| | | success: function (rs) { |
| | | alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result.csid + ", " + rs.result.wkt); |
| | | console.log(rs); |
| | | }, |
| | | error: function (e) { |
| | | console.error(e); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | function downloadShp() { |
| | | var data = [ |
| | | { id: 1, name: "Point-1", props: "{}", wkt: "POINT(95.80461853400004 34.13862467200005)" }, |
| | | { id: 2, name: "Linestring-1", props: "{}", wkt: "LINESTRING(04.98985101830993 37.43840773692756,104.99318913447104 37.43883729720358)" }, |
| | | { id: 3, name: "Polygon-1", props: "{}", wkt: "POLYGON((104.9907822932683 37.43532941961706,104.99088987736599 37.43532941961706,104.9908670336867 37.4349030213574,104.99078327712658 37.4349030213574,104.9907822932683 37.43532941961706))" } |
| | | ]; |
| | | |
| | | ajax(url + "mark/downloadShp" + token, "POST", JSON.stringify(data), "json", null, function (rs) { |
| | | alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); |
| | | // ä¸è½½æä»¶ |
| | | if (rs && rs.code == 200) { |
| | | var a = document.createElement('a'); // å建ä¸ä¸ªaæ ç¾å
ç´ |
| | | a.style.display = 'none'; // 设置å
ç´ ä¸å¯è§ |
| | | // http://127.0.0.1:12316/mark/downloadFile?guid=5ce046cc05b186332775c03ac6792caf |
| | | a.href = url + "mark/downloadFile" + token + "&guid=" + rs.result; |
| | | |
| | | document.body.appendChild(a); // å å
¥ |
| | | a.click(); // 触åç¹å»,ä¸è½½ |
| | | document.body.removeChild(a); // éæ¾ |
| | | } |
| | | }); |
| | | |
| | | function htmlDownload(data) { |
| | | var url = window.URL.createObjectURL(new Blob([data], { type: "application/zip" })); |
| | | |
| | | var link = document.createElement('a'); |
| | | link.style.display = 'none'; |
| | | link.href = url; |
| | | link.setAttribute('download', "shp.zip"); |
| | | document.body.appendChild(link); |
| | | link.click(); |
| | | |
| | | window.URL.revokeObjectURL(url); |
| | | document.body.removeChild(link); |
| | | } |
| | | } |
| | | |
| | | function testAES() { |
| | | var str1 = encrypt("admin"); |
| | | var str2 = decrypt(str1); |
| | | //console.log("%c%s", "color: red; background: yellow; font-size: 24px;", "admin"); |
| | | console.log("admin", str1, str2); |
| | | |
| | | var str3 = "gAPpDbZ53XfoQfvT8dj/uhBWX5os8kBJQ1LrNvH3VX7byFQdUJMPiEr8Fkj0q2i1pw+L8KFrvR0MLXq2xaO21nlQQXmEPofJxpDQZwEWUIFZsToXo1kLRD3t6WQezxWB8YTzXHM20Ba73x/ZuuezVhOFOq1U8HKf1dXQdv7gBzEB6fWMmFDc3FuH8GDDHv3LfT86Gio9VgMO6ohlrUdf3ZKtTHeLSuzGF4t0RZuX97YBNo25IIzpeTfRTXBxfdxA"; |
| | | console.log(decrypt(str3)); |
| | | } |
| | | |
| | | function encrypt(word){ |
| | | return CryptoJS.AES.encrypt(CryptoJS.enc.Utf8.parse(word), CryptoJS.enc.Utf8.parse(base64Decode("QSNzX2xGX3NFcnZlX2sueQ==")), { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 }).toString(); |
| | | } |
| | | |
| | | function decrypt(word) { |
| | | return CryptoJS.enc.Utf8.stringify(CryptoJS.AES.decrypt(word, CryptoJS.enc.Utf8.parse(base64Decode("QSNzX2xGX3NFcnZlX2sueQ==")), { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 })).toString(); |
| | | } |
| | | |
| | | function downloadFile() { |
| | | var a = document.createElement('a'); // å建ä¸ä¸ªaæ ç¾å
ç´ |
| | | a.style.display = 'none'; // 设置å
ç´ ä¸å¯è§ |
| | | a.href = url + "mark/downloadFile" + token + "&guid=" + "5ce046cc05b186332775c03ac6792caf"; |
| | | |
| | | document.body.appendChild(a); // å å
¥ |
| | | a.click(); // 触åç¹å»,ä¸è½½ |
| | | document.body.removeChild(a); // éæ¾ |
| | | } |
| | | |
| | | function uploadShpForMark() { |
| | | var formData = new FormData(); |
| | | var fs = document.getElementById("shpFiles"); |
| | | var exts = [".shp", ".shx", ".dbf", ".prj"]; |
| | | |
| | | var count = 0; |
| | | for (var i = 0, c = fs.files.length; i < c; i++) { |
| | | var name = fs.files[i].name.toLocaleLowerCase(); |
| | | var ext = name.substring(name.lastIndexOf(".")); |
| | | if (exts.indexOf(ext) > -1) { |
| | | count++; |
| | | formData.append(fs.files[i].name, fs.files[i]); // fs.files[i].name,file |
| | | } |
| | | } |
| | | if (count != 4) { |
| | | alert("ShapeFileæä»¶éæ©ä¸å
¨ï¼"); |
| | | return; |
| | | } |
| | | |
| | | $.ajax(url + "mark/uploadShp" + token, { |
| | | type: "post", |
| | | data: formData, |
| | | async: true, |
| | | cache: false, |
| | | processData: false, |
| | | contentType: false, |
| | | success: function (rs) { |
| | | alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + ", " + JSON.stringify(rs.result)); |
| | | console.log(rs); |
| | | }, |
| | | error: function (e) { |
| | | console.error(e); |
| | | } |
| | | }); |
| | | } |
| | | </script> |
| | | <script> |
| | | var url = "http://127.0.0.1:12316/"; |
| | | var token = "?token=a5cca7ad-bfe6-43bd-aa62-e19f2ffac6bd"; |
| | | |
| | | function exportMap1() { |
| | | var page = $("#selectPage").find("option:selected").text(); |
| | | var data = { |
| | | token: token.replace("?token=", ""), |
| | | title: "管éåºç¡å¤§æ°æ®å¹³å°ï¼DW1-01ï¼", |
| | | pageSize: page, |
| | | province: "æ²³åç", |
| | | scale: "1ï¼5ä¸", |
| | | resolution: "5ç±³", |
| | | date: "2022.11.09", |
| | | layers: "é室,管éä¸å¿çº¿,ç¢é注记,ç¢éå¾", |
| | | rotation: 0, |
| | | xmin: 103.394023, |
| | | ymin: 30.690466, |
| | | ymax: 37.871048, |
| | | xmax: 112.534648 |
| | | }; |
| | | |
| | | ajax(url + "export/insertMap" + token, "POST", JSON.stringify(data), null, null, function (rs) { |
| | | console.log(rs); |
| | | alert("code = " + rs.code + ", result = " + rs.result); |
| | | if (rs.code = 200) downloadMap(rs.result); |
| | | }); |
| | | } |
| | | |
| | | function exportMap2() { |
| | | var page = $("#selectPage").find("option:selected").text(); |
| | | var data = { |
| | | token: token.replace("?token=", ""), |
| | | title: "管éåºç¡å¤§æ°æ®å¹³å°ï¼DW1-02ï¼", |
| | | pageSize: page, |
| | | province: "å±±ä¸ç", |
| | | scale: "1ï¼20ä¸", |
| | | resolution: "20ç±³", |
| | | date: "2022.11.10", |
| | | layers: "ç«åº,管éä¸å¿çº¿,é«å¾·å½±å注记,é«å¾·å½±å", |
| | | rotation: 0, |
| | | xmin: 103.394023, |
| | | ymin: 30.690466, |
| | | ymax: 37.871048, |
| | | xmax: 112.534648 |
| | | }; |
| | | |
| | | ajax(url + "export/insertMap" + token, "POST", JSON.stringify(data), null, null, function (rs) { |
| | | console.log(rs); |
| | | alert("code = " + rs.code + ", result = " + rs.result); |
| | | if (rs.code = 200) downloadMap(rs.result); |
| | | }); |
| | | } |
| | | |
| | | function downloadMap(guid) { |
| | | var a = document.createElement('a'); // å建ä¸ä¸ªaæ ç¾å
ç´ |
| | | a.style.display = 'none'; // 设置å
ç´ ä¸å¯è§ |
| | | a.href = url + "mark/downloadFile" + token + "&guid=" + guid; |
| | | |
| | | document.body.appendChild(a); // å å
¥ |
| | | a.click(); // 触åç¹å»,ä¸è½½ |
| | | document.body.removeChild(a); // éæ¾ |
| | | } |
| | | </script> |
| | | </head> |
| | | <body> |
| | | <input type="button" value="TestCros" onclick="TestCros();" /> |
| | | <input type="button" value="check" onclick="check();" /> |
| | | <input type="button" value="getCurrentUser" onclick="getCurrentUser();" /> |
| | | <input type="button" value="logout" onclick="logout();" /> |
| | | <input type="button" value="updateUsersPwd" onclick="updateUsersPwd();" /> |
| | | <input type="button" value="insertUser" onclick="insertUser();" /> |
| | | <input type="button" value="Ajaxä¸ä¼ " onclick="ajxUpload()" /> |
| | | <input type="button" value="uploadData" onclick="uploadData();" /> |
| | | <input type="button" value="uploadShpForWKT" onclick="uploadShpForWKT();" /> |
| | | <input type="button" value="uploadShp" onclick="downloadShp();" /> |
| | | <input type="button" value="downloadFile" onclick="downloadFile();" /> |
| | | <input type="button" value="uploadShpForMark" onclick="uploadShpForMark();" /> |
| | | <br /> |
| | | <br /> |
| | | |
| | | <form id="upForm" name="upForm" method="post" enctype="multipart/form-data" action="http://127.0.0.1:12316/file/upload"> |
| | | æä»¶ä¸ä¼ ï¼ |
| | | <input id="file1" name="file1" type="file" multiple="multiple" /> |
| | | <input id="file2" name="file2" type="file" multiple="multiple" webkitdirectory /> |
| | | <input id="shpFiles" name="shpFiles" type="file" multiple="multiple" accept=".shp,.shx,.dbf,.prj" /> |
| | | </form> |
| | | <br /> |
| | | |
| | | åºå¾ï¼<select id="selectPage"> |
| | | <option>A0</option> |
| | | <option>A1</option> |
| | | <option>A2</option> |
| | | <option>A3</option> |
| | | <option selected="selected">A4</option> |
| | | <option>A5</option> |
| | | <option>A6</option> |
| | | </select> |
| | | <input type="button" value="åºå¾-1" onclick="exportMap1()" /> |
| | | <input type="button" value="åºå¾-2" onclick="exportMap2()" /> |
| | | </body> |
| | | </html> |
| | | <!-- |
| | | decrypt("gAPpDbZ53XfoQfvT8dj/uhBWX5os8kBJQ1LrNvH3VX7byFQdUJMPiEr8Fkj0q2i1pw+L8KFrvR0MLXq2xaO21nlQQXmEPofJxpDQZwEWUIFZsToXo1kLRD3t6WQezxWB8YTzXHM20Ba73x/ZuuezVhOFOq1U8HKf1dXQdv7gBzEB6fWMmFDc3FuH8GDDHv3LfT86Gio9VgMO6ohlrUdf3ZKtTHeLSuzGF4t0RZuX97YBNo25IIzpeTfRTXBxfdxA") |
| | | "POLYGON ((115.94927385452 32.3754479115071 0,121.989371092554 32.2766788010181 0,121.850621222894 29.6874200067864 0,115.9727267226 29.7835368627922 0,115.94927385452 32.3754479115071 0))" |
| | | |
| | | decrypt("6vqSpEI5Uu76H5TiwFjM6KDhY6dOpnFwSnOYNa7y0Wa6iyzrntctmq4HxwyEQdis") |
| | | "POINT(95.80461853400004 34.13862467200005)" |
| | | --> |