commit
This commit is contained in:
+9
-9
@@ -329,6 +329,8 @@ public class FitnessWalkActivityServiceImpl extends BaseServiceImpl<FitnessWalkA
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String KEY = "NYNBZ-K62KI-DQJGU-U4NJ5-CSME7-ULFMU";
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private SysConfigService sysConfigService;
|
private SysConfigService sysConfigService;
|
||||||
|
|
||||||
@@ -339,16 +341,14 @@ public class FitnessWalkActivityServiceImpl extends BaseServiceImpl<FitnessWalkA
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Result suggestMapAddress(String keyword) {
|
public Result suggestMapAddress(String keyword) {
|
||||||
Sys_config keyConfig = sysConfigService.getValueByKey("AppTMapKey");
|
if(StrUtil.isBlank(keyword)) {
|
||||||
String mapKey = keyConfig == null ? "" : keyConfig.getConfigValue();
|
return Result.error("关键词不能为空");
|
||||||
if (Strings.isBlank(mapKey)) {
|
|
||||||
return Result.error("请先配置腾讯地图系统参数AppTMapKey");
|
|
||||||
}
|
}
|
||||||
Sys_config cityConfig = sysConfigService.getValueByKey("CityName");
|
Sys_config city = sysConfigService.getValueByKey("CityName");
|
||||||
String cityName = cityConfig == null ? "" : Strings.sNull(cityConfig.getConfigValue());
|
String cityName = city != null ? city.getConfigValue() : "";
|
||||||
// 参数编码由HttpUtil完成,地址中的空格和&不得改变请求参数含义。
|
String url = "https://apis.map.qq.com/ws/place/v1/suggestion?key=%s&keyword=%s®ion=%s"
|
||||||
String response = HttpUtil.get("https://apis.map.qq.com/ws/place/v1/suggestion",
|
.formatted(KEY, keyword, cityName);
|
||||||
Map.of("key", mapKey, "keyword", keyword, "region", cityName));
|
String response = HttpUtil.get(url);
|
||||||
return Result.success(JSON.parseObject(response));
|
return Result.success(JSON.parseObject(response));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,6 +80,9 @@
|
|||||||
src="https://webapi.amap.com/maps?v=2.0&key=57f0d098ba1b881ecc436c4cfd23bbbf&plugin=AMap.PolyEditor,AMap.Geolocation"
|
src="https://webapi.amap.com/maps?v=2.0&key=57f0d098ba1b881ecc436c4cfd23bbbf&plugin=AMap.PolyEditor,AMap.Geolocation"
|
||||||
></script>
|
></script>
|
||||||
|
|
||||||
|
<!-- 公共加载腾讯地图,供 H5 地图页面和组件使用。 -->
|
||||||
|
<script src="https://map.qq.com/api/gljs?v=2.exp&key=NYNBZ-K62KI-DQJGU-U4NJ5-CSME7-ULFMU"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
Vue.config.devtools = true
|
Vue.config.devtools = true
|
||||||
|
|
||||||
|
|||||||
@@ -92,6 +92,9 @@
|
|||||||
<script src="${base!}/assets/platform/js/util/autoShowError.js"></script>
|
<script src="${base!}/assets/platform/js/util/autoShowError.js"></script>
|
||||||
<script src="${base!}/assets/platform/plugins/fullcalendar/fullcalendar.min.js"></script>
|
<script src="${base!}/assets/platform/plugins/fullcalendar/fullcalendar.min.js"></script>
|
||||||
|
|
||||||
|
<!-- 公共加载腾讯地图及绘图工具,供点位选择和线路编辑使用。 -->
|
||||||
|
<script src="https://map.qq.com/api/gljs?v=2.exp&key=NYNBZ-K62KI-DQJGU-U4NJ5-CSME7-ULFMU&libraries=tools"></script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
window._AMapSecurityConfig = {
|
window._AMapSecurityConfig = {
|
||||||
securityJsCode: "4fa1e1aeabba7eb9518129cf57ab17c1"
|
securityJsCode: "4fa1e1aeabba7eb9518129cf57ab17c1"
|
||||||
|
|||||||
@@ -940,7 +940,7 @@ layout("/layouts/platform.html"){
|
|||||||
@select="handleSelect"></el-autocomplete>
|
@select="handleSelect"></el-autocomplete>
|
||||||
</div>
|
</div>
|
||||||
<div style="width: 100%;height: 600px" id="dwMap"></div>-->
|
<div style="width: 100%;height: 600px" id="dwMap"></div>-->
|
||||||
<map-container v-if="mapReady" v-if="dwDialogVisible"
|
<map-container v-if="dwDialogVisible"
|
||||||
:radius="formData.pts[dw.index].radius ? Number(formData.pts[dw.index].radius) : 100"
|
:radius="formData.pts[dw.index].radius ? Number(formData.pts[dw.index].radius) : 100"
|
||||||
:position.sync="formData.pts[dw.index].tempPosition"></map-container>
|
:position.sync="formData.pts[dw.index].tempPosition"></map-container>
|
||||||
<span slot="footer" class="dialog-footer">
|
<span slot="footer" class="dialog-footer">
|
||||||
@@ -1078,7 +1078,6 @@ layout("/layouts/platform.html"){
|
|||||||
mixins: [initTableMixins],
|
mixins: [initTableMixins],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
mapReady: false,
|
|
||||||
editor: null,
|
editor: null,
|
||||||
lineMap: null,
|
lineMap: null,
|
||||||
modeDict: {
|
modeDict: {
|
||||||
@@ -1179,33 +1178,6 @@ layout("/layouts/platform.html"){
|
|||||||
return resp.data
|
return resp.data
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 仅在健步走页面加载SDK,避免改动全站地图和布局。
|
|
||||||
loadTencentMap() {
|
|
||||||
return this.getConfigKey("AppTMapKey").then((key) => {
|
|
||||||
if (!key) {
|
|
||||||
throw new Error("请先配置腾讯地图系统参数AppTMapKey")
|
|
||||||
}
|
|
||||||
if (window.TMap && window.TMap.tools) {
|
|
||||||
this.$set(this, "mapReady", true)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
const script = document.createElement("script")
|
|
||||||
script.src = "https://map.qq.com/api/gljs?v=2.exp&libraries=tools&key=" + encodeURIComponent(key)
|
|
||||||
script.onload = () => {
|
|
||||||
this.$set(this, "mapReady", true)
|
|
||||||
resolve()
|
|
||||||
}
|
|
||||||
script.onerror = () => {
|
|
||||||
script.remove()
|
|
||||||
reject(new Error("腾讯地图加载失败,请检查地图Key和网络"))
|
|
||||||
}
|
|
||||||
document.head.appendChild(script)
|
|
||||||
})
|
|
||||||
}).catch((error) => {
|
|
||||||
this.$message.warning(error.message)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
loadMapCenterPoint() {
|
loadMapCenterPoint() {
|
||||||
this.getConfigKey("AppMapCenterPointX").then((res) => {
|
this.getConfigKey("AppMapCenterPointX").then((res) => {
|
||||||
this.$set(this, "appMapCenterPointX", Number(res))
|
this.$set(this, "appMapCenterPointX", Number(res))
|
||||||
@@ -1215,10 +1187,6 @@ layout("/layouts/platform.html"){
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
hasMapCenterPoint() {
|
hasMapCenterPoint() {
|
||||||
if (!this.mapReady) {
|
|
||||||
this.$message.warning("腾讯地图尚未就绪,请检查地图配置")
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
if (!this.appMapCenterPointX || !this.appMapCenterPointY) {
|
if (!this.appMapCenterPointX || !this.appMapCenterPointY) {
|
||||||
this.$message.warning("请先配置地图中心点系统参数")
|
this.$message.warning("请先配置地图中心点系统参数")
|
||||||
return false
|
return false
|
||||||
@@ -2308,7 +2276,6 @@ layout("/layouts/platform.html"){
|
|||||||
created() {
|
created() {
|
||||||
this.getActivityGroup()
|
this.getActivityGroup()
|
||||||
this.getQuestion()
|
this.getQuestion()
|
||||||
this.loadTencentMap()
|
|
||||||
this.loadMapCenterPoint()
|
this.loadMapCenterPoint()
|
||||||
// Jsz.getQuestion().then((res) => {})
|
// Jsz.getQuestion().then((res) => {})
|
||||||
this.$set(this.pageForm, "year", (new Date().getFullYear()).toString())
|
this.$set(this.pageForm, "year", (new Date().getFullYear()).toString())
|
||||||
|
|||||||
Reference in New Issue
Block a user