javaweb-plus/javaweb-admin/src/main/java/com/javaweb/web/controller/system/SysIndexController.java
@@ -8,6 +8,8 @@ import com.javaweb.common.core.domain.AjaxResult; import com.javaweb.common.utils.Arith; import com.javaweb.common.utils.StringUtils; import com.javaweb.geo.domain.Project; import com.javaweb.geo.service.IProjectService; import com.javaweb.system.service.ISysConfigService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -40,6 +42,9 @@ @Autowired private ISysConfigService configService; @Autowired private IProjectService projectService; private String getAdminIndex(){ return configService.selectConfigByKey(CmsConstants.KEY_ADMIN_INDEX); @@ -99,8 +104,16 @@ return "main"; } private Double getValue(int a,int b) { return Arith.div((double)a*100, (double)b, 4); // 系统介绍 @ResponseBody @GetMapping("/system/project") public AjaxResult project() { AjaxResult ajaxResult = AjaxResult.success(); List<Project> projects = projectService.selectProjectList(new Project()); ajaxResult.put("projects",projects); return ajaxResult; } } javaweb-plus/javaweb-admin/src/main/resources/static/js/custom/main.js
@@ -1,15 +1,16 @@ $(function() { loadMap(); //getReallyData(); getReallyData(); //getRegulatoryUnitChartData("",""); //bindEvent(); }) // 加载地图 let map=null; var countries = []; var countriesOverlay = new T.D3Overlay(init,redraw); var countriesOverlay1 = new T.D3Overlay(init1,redraw1); function loadMap() { let map = new T.Map('map_div'); map = new T.Map('map_div'); map.centerAndZoom(new T.LngLat(116.38, 39.9), 11); var control = new T.Control.Zoom(); @@ -71,11 +72,24 @@ // 获取数据库真实数据 function getReallyData() { let url = window.location.protocol + "//" + window.location.host + "/bjfw/geotdp/index/indexCollect"; let url = window.location.protocol + "//" + window.location.host + "/bjfw/system/project"; $.get(url,function(res){ var data = res.projects; showProjectPoint(data); }) } //地图上展示项目点 function showProjectPoint(data){ var projectIcon = new T.Icon({ iconUrl: '/bjfw/images/icons/6.png', iconSize: new T.Point(30, 30), iconAnchor: new T.Point(6, 40), }); var centerMarker = new T.Marker(new T.LngLat(center.lng, center.lat), { title: "项目",icon:icon}); var proj = infoWindowProject(onProject); addClickHandler(proj, centerMarker); } // 页面数据赋值 function pageAssignment(reallyData) { for ( let key in reallyData) { javaweb-plus/javaweb-admin/src/main/resources/templates/main.html
@@ -67,7 +67,6 @@ <script th:src="@{/js/custom/main.js}"></script> <th:block th:include="include :: sparkline-js" /> <th:block th:include="include :: footer" />