更新记录

1.0.3(2022-11-21)

解决iOS打包报错问题

1.0.2(2022-11-18)

1、调整开始定位、结束定位方法传参以支持多个运单上传 2、添加“重启定位”方法 如已集成此插件旧版本,需要注意调整开始定位、结束定位的传入参数

1.0.1(2022-10-25)

第一版

查看更多

平台兼容性

Android Android CPU类型 iOS
适用版本区间:5.1 - 12.0 armeabi-v7a:未测试,arm64-v8a:未测试,x86:未测试 适用版本区间:12 - 15

原生插件通用使用流程:

  1. 购买插件,选择该插件绑定的项目。
  2. 在HBuilderX里找到项目,在manifest的app原生插件配置中勾选模块,如需要填写参数则参考插件作者的文档添加。
  3. 根据插件作者的提供的文档开发代码,在代码中引用插件,调用插件功能。
  4. 打包自定义基座,选择插件,得到自定义基座,然后运行时选择自定义基座,进行log输出测试。
  5. 开发完毕后正式云打包

付费原生插件目前不支持离线打包。
Android 离线打包原生插件另见文档 https://nativesupport.dcloud.net.cn/NativePlugin/offline_package/android
iOS 离线打包原生插件另见文档 https://nativesupport.dcloud.net.cn/NativePlugin/offline_package/ios

注意事项:使用HBuilderX2.7.14以下版本,如果同一插件且同一appid下购买并绑定了多个包名,提交云打包界面提示包名绑定不一致时,需要在HBuilderX项目中manifest.json->“App原生插件配置”->”云端插件“列表中删除该插件重新选择


简介

集成此原生插件获得网络货运监管上报的能力


初始化插件

    var plugin = uni.requireNativePlugin('cgg-wlhy-supervise-sender');

初始化监管上报:

    plugin.init({
                    'appId': "com.****.",
                    'appSecurity': "2df22d83df9c",
                    'enterpriseSenderCode':'12cULGxLjSOcK4nEtWpn',
                    'environment':'debug'
                },
                (ret) => {
                    uni.showToast({
                        title:'初始化: ' + JSON.stringify(ret),
                        icon: "none"
                    })
                })

参数: appId: 企业平台appId appSecurity: 企业平台appSecurity enterpriseSenderCode: 企业唯一标识 environment: 环境:“debug”测试,“release”正式 结果: code:结果编码,0表示成功,非0表示调用出错 message:错误描述

示例:

<template>
    <view class="content">
        <view class="btn-row">
            <button v-if="!hasLogin" type="primary" class="primary" @tap="bindLogin">测试步行导航</button>
        </view>
    </view>
</template>
<script>
    import {
        mapState,
        mapMutations
    } from 'vuex'

    export default {
        computed: {
            ...mapState(['hasLogin', 'forcedLogin'])
        },
        methods: {
            ...mapMutations(['logout']),
            bindLogin() {
                var plugin = uni.requireNativePlugin('cgg-wlhy-supervise-sender');
                plugin.init({
                    'appId': "com.****.",
                    'appSecurity': "2df22d83df9c",
                    'enterpriseSenderCode':'12cULGxLjSOcK4nEtWpn',
                    'environment':'debug'
                }, (ret) => {
                    uni.showToast({
                        title:'初始化: ' + JSON.stringify(ret),
                        icon: "none"
                    })
                })
            }
        }
    }
</script>
<style>
</style>

开启定位:

    plugin.start({
                    'driverName':'唐三藏',
                    'vehicleNumber':'皖M06090',
                    'remark': '这是备注',
                    'shippingNoteInfo':[{
                        'shippingNoteNumber':'CYD2208051011055744',
                        'serialNumber':'0000',
                        'startCountrySubdivisionCode':'650102',
                        'startLongitude':'87.620998',
                        'startLatitude':'43.798544',
                        'startLocationText':"新疆维吾尔族自治区乌鲁木齐市天山区前进路与健康路交叉口东80米纺织行办家属院",
                        'endCountrySubdivisionCode':'150722',
                        'endLongitude':'123.805922',
                        'endLatitude':'48.852599',
                        'endLocationText':"内蒙古自治区 呼伦贝尔市 莫力达瓦达斡尔族自治旗 杜拉尔鄂温克民族乡杜拉尔中心学校"
                    }]
                },
                (ret) => {
                    uni.showToast({
                        title:'结果:  ' + JSON.stringify(ret),
                        icon: "none"
                    })
                })

参数: driverName: 司机姓名 vehicleNumber: 车牌号 remark: 备注 shippingNoteInfo: 运单信息数组,结构如下:

    shippingNoteNumber: "",         /**<  运单号 */
    serialNumber: "",               /**<  分单号:0000 */
    startCountrySubdivisionCode: "",        /**<  运单规划的起点位置行政区划代码 */
    endCountrySubdivisionCode: "",          /**<  运单规划的到达位置行政区 */
    startLongitude: "",                     /**<  运单规划的起点位置经度 */
    startLatitude: "",                      /**<  运单规划的起点位置纬度 */
    endLongitude: "",                       /**<  运单规划的到达位置经度 */
    endLatitude: "",                        /**<  运单规划的到达位置纬度 */
    startLocationText: "",                  /**<  运单规划的起点地址文字描述 */
    endLocationText: ""                     /**<  运单规划的到达地址文字描述 */

结果: code:结果编码,0表示成功,非0表示调用出错 message:错误描述

示例:

<template>
    <view class="content">
        <view class="btn-row">
            <button v-if="!hasLogin" type="primary" class="primary" @tap="bindLogin">测试步行导航</button>
        </view>
    </view>
</template>
<script>
    import {
        mapState,
        mapMutations
    } from 'vuex'

    export default {
        computed: {
            ...mapState(['hasLogin', 'forcedLogin'])
        },
        methods: {
            ...mapMutations(['logout']),
            bindLogin() {
                var plugin = uni.requireNativePlugin('cgg-wlhy-supervise-sender');
                plugin.start({
                            'driverName':'唐三藏',
                            'vehicleNumber':'皖M06090',
                            'remark': '这是备注',
                            'shippingNoteInfo':[{
                                'shippingNoteNumber':'CYD2208051011055744',
                                'serialNumber':'0000',
                                'startCountrySubdivisionCode':'650102',
                                'startLongitude':'87.620998',
                                'startLatitude':'43.798544',
                                'startLocationText':"新疆维吾尔族自治区乌鲁木齐市天山区前进路与健康路交叉口东80米纺织行办家属院",
                                'endCountrySubdivisionCode':'150722',
                                'endLongitude':'123.805922',
                                'endLatitude':'48.852599',
                                'endLocationText':"内蒙古自治区 呼伦贝尔市 莫力达瓦达斡尔族自治旗 杜拉尔鄂温克民族乡杜拉尔中心学校"
                            }]
                        }, (ret) => {
                            uni.showToast({
                                title:'结果: ' + JSON.stringify(ret),
                                icon: "none"
                            })
                        })
            }
        }
    }
</script>
<style>
</style>

重启定位:

    plugin.restart({
                    'driverName':'唐三藏',
                    'vehicleNumber':'皖M06090',
                    'remark': '这是备注',
                    'shippingNoteInfo':[{
                        'shippingNoteNumber':'CYD2208051011055744',
                        'serialNumber':'0000',
                        'startCountrySubdivisionCode':'650102',
                        'startLongitude':'87.620998',
                        'startLatitude':'43.798544',
                        'startLocationText':"新疆维吾尔族自治区乌鲁木齐市天山区前进路与健康路交叉口东80米纺织行办家属院",
                        'endCountrySubdivisionCode':'150722',
                        'endLongitude':'123.805922',
                        'endLatitude':'48.852599',
                        'endLocationText':"内蒙古自治区 呼伦贝尔市 莫力达瓦达斡尔族自治旗 杜拉尔鄂温克民族乡杜拉尔中心学校"
                    }]
                },
                (ret) => {
                    uni.showToast({
                        title:'结果:  ' + JSON.stringify(ret),
                        icon: "none"
                    })
                })

参数: driverName: 司机姓名 vehicleNumber: 车牌号 remark: 备注 shippingNoteInfo: 运单信息数组,结构如下:

    shippingNoteNumber: "",         /**<  运单号 */
    serialNumber: "",               /**<  分单号:0000 */
    startCountrySubdivisionCode: "",        /**<  运单规划的起点位置行政区划代码 */
    endCountrySubdivisionCode: "",          /**<  运单规划的到达位置行政区 */
    startLongitude: "",                     /**<  运单规划的起点位置经度 */
    startLatitude: "",                      /**<  运单规划的起点位置纬度 */
    endLongitude: "",                       /**<  运单规划的到达位置经度 */
    endLatitude: "",                        /**<  运单规划的到达位置纬度 */
    startLocationText: "",                  /**<  运单规划的起点地址文字描述 */
    endLocationText: ""                     /**<  运单规划的到达地址文字描述 */

结果: code:结果编码,0表示成功,非0表示调用出错 message:错误描述

示例:

<template>
    <view class="content">
        <view class="btn-row">
            <button v-if="!hasLogin" type="primary" class="primary" @tap="bindLogin">测试步行导航</button>
        </view>
    </view>
</template>
<script>
    import {
        mapState,
        mapMutations
    } from 'vuex'

    export default {
        computed: {
            ...mapState(['hasLogin', 'forcedLogin'])
        },
        methods: {
            ...mapMutations(['logout']),
            bindLogin() {
                var plugin = uni.requireNativePlugin('cgg-wlhy-supervise-sender');
                plugin.restart({
                    'driverName':'唐三藏',
                    'vehicleNumber':'皖M06090',
                    'remark': '这是备注',
                    'shippingNoteInfo':[{
                        'shippingNoteNumber':'CYD2208051011055744',
                        'serialNumber':'0000',
                        'startCountrySubdivisionCode':'650102',
                        'startLongitude':'87.620998',
                        'startLatitude':'43.798544',
                        'startLocationText':"新疆维吾尔族自治区乌鲁木齐市天山区前进路与健康路交叉口东80米纺织行办家属院",
                        'endCountrySubdivisionCode':'150722',
                        'endLongitude':'123.805922',
                        'endLatitude':'48.852599',
                        'endLocationText':"内蒙古自治区 呼伦贝尔市 莫力达瓦达斡尔族自治旗 杜拉尔鄂温克民族乡杜拉尔中心学校"
                    }]
                },
                (ret) => {
                    uni.showToast({
                        title:'结果:  ' + JSON.stringify(ret),
                        icon: "none"
                    })
                })
            }
        }
    }
</script>
<style>
</style>

结束定位:

    plugin.stop({
                    'driverName':'唐三藏',
                    'vehicleNumber':'皖M06090',
                    'remark': '这是备注',
                    'shippingNoteInfo':[{
                        'shippingNoteNumber':'CYD2208051011055744',
                        'serialNumber':'0000',
                        'startCountrySubdivisionCode':'650102',
                        'startLongitude':'87.620998',
                        'startLatitude':'43.798544',
                        'startLocationText':"新疆维吾尔族自治区乌鲁木齐市天山区前进路与健康路交叉口东80米纺织行办家属院",
                        'endCountrySubdivisionCode':'150722',
                        'endLongitude':'123.805922',
                        'endLatitude':'48.852599',
                        'endLocationText':"内蒙古自治区 呼伦贝尔市 莫力达瓦达斡尔族自治旗 杜拉尔鄂温克民族乡杜拉尔中心学校"
                    }]
                },
                (ret) => {
                    uni.showToast({
                        title:'结果:  ' + JSON.stringify(ret),
                        icon: "none"
                    })
                })

参数: driverName: 司机姓名 vehicleNumber: 车牌号 remark: 备注 shippingNoteInfo: 运单信息数组,结构如下:

    shippingNoteNumber: "",         /**<  运单号 */
    serialNumber: "",               /**<  分单号:0000 */
    startCountrySubdivisionCode: "",        /**<  运单规划的起点位置行政区划代码 */
    endCountrySubdivisionCode: "",          /**<  运单规划的到达位置行政区 */
    startLongitude: "",                     /**<  运单规划的起点位置经度 */
    startLatitude: "",                      /**<  运单规划的起点位置纬度 */
    endLongitude: "",                       /**<  运单规划的到达位置经度 */
    endLatitude: "",                        /**<  运单规划的到达位置纬度 */
    startLocationText: "",                  /**<  运单规划的起点地址文字描述 */
    endLocationText: ""                     /**<  运单规划的到达地址文字描述 */

结果: code:结果编码,0表示成功,非0表示调用出错 message:错误描述

示例:

<template>
    <view class="content">
        <view class="btn-row">
            <button v-if="!hasLogin" type="primary" class="primary" @tap="bindLogin">测试步行导航</button>
        </view>
    </view>
</template>
<script>
    import {
        mapState,
        mapMutations
    } from 'vuex'

    export default {
        computed: {
            ...mapState(['hasLogin', 'forcedLogin'])
        },
        methods: {
            ...mapMutations(['logout']),
            bindLogin() {
                var plugin = uni.requireNativePlugin('cgg-wlhy-supervise-sender');
                plugin.stop({
                    'driverName':'唐三藏',
                    'vehicleNumber':'皖M06090',
                    'remark': '这是备注',
                    'shippingNoteInfo':[{
                        'shippingNoteNumber':'CYD2208051011055744',
                        'serialNumber':'0000',
                        'startCountrySubdivisionCode':'650102',
                        'startLongitude':'87.620998',
                        'startLatitude':'43.798544',
                        'startLocationText':"新疆维吾尔族自治区乌鲁木齐市天山区前进路与健康路交叉口东80米纺织行办家属院",
                        'endCountrySubdivisionCode':'150722',
                        'endLongitude':'123.805922',
                        'endLatitude':'48.852599',
                        'endLocationText':"内蒙古自治区 呼伦贝尔市 莫力达瓦达斡尔族自治旗 杜拉尔鄂温克民族乡杜拉尔中心学校"
                    }]
                },
                (ret) => {
                    uni.showToast({
                        title:'结果:  ' + JSON.stringify(ret),
                        icon: "none"
                    })
                })
            }
        }
    }
</script>
<style>
</style>

隐私、权限声明

1. 本插件需要申请的系统权限列表:

定位权限

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

插件使用的高德定位SDK会采集数据,详情可参考:https://developer.amap.com/product/navigation#/

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

许可协议

作者未提供license.md

使用中有什么不明白的地方,就向插件作者提问吧~ 我要提问