更新记录
1.0.1(2025-07-22) 下载此版本
修复web平台地图位置图标不显示问题,新增参数markersIconPath。
1.0.0(2024-10-30) 下载此版本
发布
平台兼容性
uni-app(4.06)
| Vue2 | Vue2插件版本 | Vue3 | Vue2插件版本 | Chrome | Chrome插件版本 | Safari | app-vue | app-vue插件版本 | app-nvue | Android | iOS | 鸿蒙 | 
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| √ | 1.0.0 | √ | 1.0.0 | 50 | 1.0.0 | - | √ | 1.0.0 | - | - | - | - | 
| 微信小程序 | 支付宝小程序 | 抖音小程序 | 百度小程序 | 快手小程序 | 京东小程序 | 鸿蒙元服务 | QQ小程序 | 飞书小程序 | 快应用-华为 | 快应用-联盟 | 
|---|---|---|---|---|---|---|---|---|---|---|
| - | - | - | - | - | - | - | - | - | - | - | 
uni-app x(4.75)
| Chrome | Safari | Android | iOS | 鸿蒙 | 微信小程序 | 
|---|---|---|---|---|---|
| - | - | - | - | - | - | 
高德地图定位打卡
示例说明
默认 (展示地图,是否可以打卡)
<template>
    <view class="container">
        <map-positioning-punch
            :clock-in-area="clockInArea"
            :refresh-timeout="refreshTimeout"
            @clockInClick="clockIn"
            :is-report="true"
            @change="locationChange"
        >
        </map-positioning-punch>
    </view>
</template>
<script>
    /**
     * 作者:腾辉工作室
     * 邮箱:844475003@qq.com
     */
    export default {
        data() {
            return {
                // 打卡区域设置
                clockInArea: [
                    {
                        longitude: '111.455906',
                        latitude: '27.257652',
                        distance: 150,
                    },
                    {
                        longitude: '111.45304',
                        latitude: '27.256399',
                        distance: 400,
                    },
                    {
                        longitude: '111.447355',
                        latitude: '27.258016',
                        distance: 300,
                    }
                ],
                // 刷新打卡区域频率
                refreshTimeout: 3000
            }
        },
        methods: {
            // 位置变化
            locationChange({ location, areaLocation, distance }) {
                uni.showToast({
                    icon: 'success',
                    title: '上报成功'
                })
                // location 当前位置
                // areaLocation 符合打卡的区域
                // distance 打卡距离
                console.log(11, location, areaLocation, distance)
            },
            // 打卡回调事件
            clockIn({ location, areaLocation, distance }) {
                uni.showToast({
                    icon: 'success',
                    title: '打卡成功'
                })
                // location 当前位置
                // areaLocation 符合打卡的区域
                // distance 打卡距离
                console.log(location, areaLocation, distance)
            }
        }
    }
</script>
参数
| 参数名 | 描述 | 
|---|---|
| clockInArea | 打卡区域设置 Array<经纬度信息、半径> | 
| refreshTimeout | 打卡定位刷新频率 Number,默认:3000 | 
| clockIn | 打卡数据回调 Function 返回 location-当前位置, areaLocation-符合打卡区域信息, distance - 打卡位置距离打卡区域距离(m) | 
| isPort | 是否上报实时位置数据 | 
| change | 上报数据返回,同打卡回调一致 | 
自定义打卡按钮
<map-positioning-punch
        :clock-in-area="clockInArea"
        :refresh-timeout="refreshTimeout"
        :is-report="true"
        @change="locationChange"
    >
        <view>自定义打卡按钮</view>
    </map-positioning-punch>
自定义地图位置图标
<map-positioning-punch
        :markers-icon-path="markersIconPath"
    >
        <view>自定义地图位置图标</view>
    </map-positioning-punch>
注意:web平台使用自定义地图位置图标,需要使用本地图片,本地图片路径需要使用绝对路径,例如:/static/img.png,否则地图不显示
manifest.json App模块配置

高德地图开放平台
获取用户名
申请安卓、IOS应用


                                                                    
                                                                        收藏人数:
                                    
                                                        下载插件并导入HBuilderX
                                                    
                                        赞赏(3)
                                    
                                            
 下载 501
                
 赞赏 5
                
            
                    下载 10688502 
                
                        赞赏 1797 
                    
            
            
            
            
            
            
            
            
            
            
            
            
            
            
                        
                                赞赏
            
京公网安备:11010802035340号