This commit is contained in:
2026-09-14 19:19:20 +08:00
parent db12ab8cec
commit 17e21ef939
4 changed files with 16 additions and 43 deletions
@@ -329,6 +329,8 @@ public class FitnessWalkActivityServiceImpl extends BaseServiceImpl<FitnessWalkA
}
}
private static String KEY = "NYNBZ-K62KI-DQJGU-U4NJ5-CSME7-ULFMU";
@Inject
private SysConfigService sysConfigService;
@@ -339,16 +341,14 @@ public class FitnessWalkActivityServiceImpl extends BaseServiceImpl<FitnessWalkA
*/
@Override
public Result suggestMapAddress(String keyword) {
Sys_config keyConfig = sysConfigService.getValueByKey("AppTMapKey");
String mapKey = keyConfig == null ? "" : keyConfig.getConfigValue();
if (Strings.isBlank(mapKey)) {
return Result.error("请先配置腾讯地图系统参数AppTMapKey");
if(StrUtil.isBlank(keyword)) {
return Result.error("关键词不能为空");
}
Sys_config cityConfig = sysConfigService.getValueByKey("CityName");
String cityName = cityConfig == null ? "" : Strings.sNull(cityConfig.getConfigValue());
// 参数编码由HttpUtil完成,地址中的空格和&不得改变请求参数含义。
String response = HttpUtil.get("https://apis.map.qq.com/ws/place/v1/suggestion",
Map.of("key", mapKey, "keyword", keyword, "region", cityName));
Sys_config city = sysConfigService.getValueByKey("CityName");
String cityName = city != null ? city.getConfigValue() : "";
String url = "https://apis.map.qq.com/ws/place/v1/suggestion?key=%s&keyword=%s&region=%s"
.formatted(KEY, keyword, cityName);
String response = HttpUtil.get(url);
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"
></script>
<!-- 公共加载腾讯地图,供 H5 地图页面和组件使用。 -->
<script src="https://map.qq.com/api/gljs?v=2.exp&key=NYNBZ-K62KI-DQJGU-U4NJ5-CSME7-ULFMU"></script>
<script>
Vue.config.devtools = true
@@ -92,6 +92,9 @@
<script src="${base!}/assets/platform/js/util/autoShowError.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">
window._AMapSecurityConfig = {
securityJsCode: "4fa1e1aeabba7eb9518129cf57ab17c1"
@@ -940,7 +940,7 @@ layout("/layouts/platform.html"){
@select="handleSelect"></el-autocomplete>
</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"
:position.sync="formData.pts[dw.index].tempPosition"></map-container>
<span slot="footer" class="dialog-footer">
@@ -1078,7 +1078,6 @@ layout("/layouts/platform.html"){
mixins: [initTableMixins],
data() {
return {
mapReady: false,
editor: null,
lineMap: null,
modeDict: {
@@ -1179,33 +1178,6 @@ layout("/layouts/platform.html"){
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() {
this.getConfigKey("AppMapCenterPointX").then((res) => {
this.$set(this, "appMapCenterPointX", Number(res))
@@ -1215,10 +1187,6 @@ layout("/layouts/platform.html"){
})
},
hasMapCenterPoint() {
if (!this.mapReady) {
this.$message.warning("腾讯地图尚未就绪,请检查地图配置")
return false
}
if (!this.appMapCenterPointX || !this.appMapCenterPointY) {
this.$message.warning("请先配置地图中心点系统参数")
return false
@@ -2308,7 +2276,6 @@ layout("/layouts/platform.html"){
created() {
this.getActivityGroup()
this.getQuestion()
this.loadTencentMap()
this.loadMapCenterPoint()
// Jsz.getQuestion().then((res) => {})
this.$set(this.pageForm, "year", (new Date().getFullYear()).toString())