feat:增加系统参数控制活动签到调用腾讯api开关

This commit is contained in:
2026-11-03 20:44:42 +08:00
parent d8313d7822
commit 6e95c9b6f2
3 changed files with 21 additions and 11 deletions
@@ -77,7 +77,10 @@
src="https://webapi.amap.com/maps?v=2.0&key=57f0d098ba1b881ecc436c4cfd23bbbf&plugin=AMap.PolyEditor,AMap.Geolocation"
></script>-->
<!-- 活动签到关闭腾讯位置服务时,不加载地图 SDK;未配置时兼容原有行为。 -->
<!--#if ((config.AppActivitySignTencentMap!"true") == "true") {#-->
<script src="https://map.qq.com/api/gljs?v=2.exp&key=NYNBZ-K62KI-DQJGU-U4NJ5-CSME7-ULFMU"></script>
<!--#}#-->
<script nonce="${cspNonce!}">
Vue.config.devtools = true
@@ -4,7 +4,7 @@ const times = {
`
<div>
<van-action-sheet v-model="visible" title="时间段" cancel-text="取消">
<div id="mapContainer" v-if="row?.isMobileSign === true && row?.signType === 3"
<div id="mapContainer" v-if="tencentMapEnabled && row?.isMobileSign === true && row?.signType === 3"
style="width: 100%; height: 250px"></div>
<button v-for="(item,index) in row?.courseTimes" type="button" class="van-action-sheet__item">
<div style="display: flex; justify-content: space-between; align-items: center">
@@ -47,6 +47,7 @@ const times = {
store,
data() {
return {
tencentMapEnabled: ${(config.AppActivitySignTencentMap!"true") == "true"},
visible: false,
row: null,
weekdayCNMap: {0: '周日', 1: '周一', 2: '周二', 3: '周三', 4: '周四', 5: '周五', 6: '周六'},
@@ -70,7 +71,7 @@ const times = {
this.row = row
this.visible = true
this.$nextTick(() => {
if (this.row.signType === 3) {
if (this.row.signType === 3 && this.tencentMapEnabled) {
if (this.map) this.map.destroy()
this.initMap()
this.getLocation((coords) => {
@@ -108,13 +109,15 @@ const times = {
this.visible = false
} else {
this.$toast(res.msg)
this.markerLayer.remove(["current"])
this.getLocation((coords) => {
if (coords) {
const center = new TMap.LatLng(coords.lat, coords.lng)
this.createMarker(center, 'current', 'current')
}
})
if (this.tencentMapEnabled && this.markerLayer) {
this.markerLayer.remove(["current"])
this.getLocation((coords) => {
if (coords) {
const center = new TMap.LatLng(coords.lat, coords.lng)
this.createMarker(center, 'current', 'current')
}
})
}
}
})
}
@@ -170,6 +173,8 @@ const times = {
);
},
initMap() {
// 开关仅控制腾讯地图,浏览器定位及签到距离校验仍保留。
if (!this.tencentMapEnabled) return
if (!this.row.courseLocationCoordinates) {
this.$toast('未设置签到点')
return
@@ -25,7 +25,7 @@ layout("/layouts/platform_h5.html"){
<div id="app" class="sign-page">
<van-nav-bar title="活动签到" left-text="返回" left-arrow @click-left="onNavBack" fixed placeholder></van-nav-bar>
<div id="mapContainer" class="sign-map"></div>
<div id="mapContainer" class="sign-map" v-if="tencentMapEnabled"></div>
<template v-if="extensionEnabled">
<section class="sign-panel">
<h1 class="sign-title">{{signData.activityName || '活动签到'}}</h1>
@@ -78,6 +78,7 @@ layout("/layouts/platform_h5.html"){
components: {"train-sign-dynamic-form": httpVueLoader("/components/module/trainSignUp/TrainSignDynamicForm.vue?v=" + new Date().getTime())},
data() {
return {
tencentMapEnabled: ${(config.AppActivitySignTencentMap!"true") == "true"},
ownerId: "train-sign-scan-" + Date.now(), courseId: GetQueryString("courseId"), row: {}, signData: {},
extensionEnabled: false, legacyResult: {code: 1, msg: "正在获取签到信息"},
statusMessage: "请获取定位后完成签到", messageType: "", signLoading: false, formLoading: false,
@@ -92,7 +93,8 @@ layout("/layouts/platform_h5.html"){
},
methods: {
initMap() {
if (this.map) return
// 关闭腾讯位置服务时跳过地图,仍通过浏览器定位完成签到。
if (!this.tencentMapEnabled || this.map) return
if (!this.row.courseLocationCoordinates || this.row.courseLocationCoordinates.length < 2) {
this.statusMessage = "当前点位未设置地图坐标"; this.messageType = "error"; return
}