仿滴滴打车百度地图定位查找附近出租车或门店信息

这篇具有很好参考价值的文章主要介绍了仿滴滴打车百度地图定位查找附近出租车或门店信息。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

随着技术的发展,开发的复杂度也越来越高,传统开发方式将一个系统做成了整块应用,经常出现的情况就是一个小小的改动或者一个小功能的增加可能会引起整体逻辑的修改,造成牵一发而动全身。通过组件化开发,可以有效实现单独开发,单独维护,而且他们之间可以随意的进行组合。大大提升开发效率低,降低维护成本。

组件化对于任何一个业务场景复杂的前端应用以及经过多次迭代之后的产品来说都是必经之路。组件化要做的不仅仅是表面上看到的模块拆分解耦,其背后还有很多工作来支撑组件化的进行,例如结合业务特性的模块拆分策略、模块间的交互方式和构建系统等等 。

本文给大家介绍的组件是:

前端vue仿滴滴打车百度地图定位查找附近出租车或门店信息, 

阅读全文下载完整组件代码请关注微信公众号: 前端组件开发

仿滴滴打车百度地图定位查找附近出租车或门店信息

效果图如下:

仿滴滴打车百度地图定位查找附近出租车或门店信息

仿滴滴打车百度地图定位查找附近出租车或门店信息

#

#### 使用方法

```使用方法

#安装vue-baidu-map插件

npm install vue-baidu-map --save

<!-- center: 地图中心点 zoom:地图放大比例 -->

<baidu-map v-show="seen" class="bm-view" :center="centerPoint" :zoom="10">

<bm-control class='bmControl'>

<div class="bmTopView">

<!-- 名称 -->

<view class="netView">{{infoName}}

</view>

<!-- 详情 +  打车按钮 -->

<view class="rowView">

<view class="midView">{{infoDetail}}</view>

<view class="locImg" v-show="followIsHide">打车</view>

</view>

</div>

<!-- 我的位置 附近的车图标 -->

<div class="bmBotView">

<image class="userIcon" src="../../static/img/biz/person.svg"></image>

<view class="userName">定位</view>

<image class="userIcon" src="../../static/img/biz/car.svg"></image>

<view class="userName">附近的车</view>

</div>

<view style="height: 2rpx;"></view>

</bm-control>

<!-- 定位点 -->

<bm-marker title="" v-for="(item,index) in netList" :key="100 + index" :data-index="index"

@click="netCurClick(item)" :position="{lng: item.longitude, lat: item.latitude}"

:icon="{url: 'static/img/biz/person.svg', size: {width: 34, height: 34}}">

</bm-marker>

<!-- 附近的车 -->

<bm-marker title="" v-for="(item,index) in nearComList" :key="200 + index" @click="companyCurClick(item)"

:position="{lng: item.longitude, lat: item.latitude}"

:icon="{url: 'static/img/biz/car.svg', size: {width: 34, height: 34}}">

</bm-marker>

</baidu-map>

```文章来源地址https://www.toymoban.com/news/detail-488414.html

#### HTML代码部分

```html

<template>

<view class="content">

<!-- center: 地图中心点 zoom:地图放大比例 -->

<baidu-map v-show="seen" class="bm-view" :center="centerPoint" :zoom="10">

<bm-control class='bmControl'>

<div class="bmTopView">

<!-- 名称 -->

<view class="netView">{{infoName}}

</view>

<!-- 详情 +  打车按钮 -->

<view class="rowView">

<view class="midView">{{infoDetail}}</view>

<view class="locImg" v-show="followIsHide">打车</view>

</view>

</div>

<!-- 我的位置 附近的车图标 -->

<div class="bmBotView">

<image class="userIcon" src="../../static/img/biz/person.svg"></image>

<view class="userName">定位</view>

<image class="userIcon" src="../../static/img/biz/car.svg"></image>

<view class="userName">附近的车</view>

</div>

<view style="height: 2rpx;"></view>

</bm-control>

<!-- 定位点 -->

<bm-marker title="" v-for="(item,index) in netList" :key="100 + index" :data-index="index"

@click="netCurClick(item)" :position="{lng: item.longitude, lat: item.latitude}"

:icon="{url: 'static/img/biz/person.svg', size: {width: 34, height: 34}}">

</bm-marker>

<!-- 附近的车 -->

<bm-marker title="" v-for="(item,index) in nearComList" :key="200 + index" @click="companyCurClick(item)"

:position="{lng: item.longitude, lat: item.latitude}"

:icon="{url: 'static/img/biz/car.svg', size: {width: 34, height: 34}}">

</bm-marker>

</baidu-map>

</view>

</template>

```

#### JS代码 (引入组件 填充数据)

```javascript

<script>

import Vue from 'vue'

import BaiduMap from 'vue-baidu-map'

import {

BmlMarkerClusterer

} from 'vue-baidu-map'

Vue.use(BaiduMap, {

// ak 是在百度地图开发者平台申请的密钥 详见 http://lbsyun.baidu.com/apiconsole/key */

ak: 'dEctYrTTeVr76ANfzG7XwYZGPj'

});

export default {

components: {

},

data() {

return {

nearComList: [], // 附近商机列表

infoName: '',

infoDetail: '',

tabbarIsHide: false,

followIsHide: false,

seen: true,

netList: [],

netItem: {},

// 中心坐标 {lng: 113.282202, lat:23.13771 }

centerPoint: {

lng: 113.282202,

lat: 23.13771

}

};

},

mounted: function(e) {

let myThis = this;

this.netItem = {

'orgName': '我的地址',

'orgAddr': '详细地址',

'longitude': '113.22',

'latitude': '23.12'

};

this.netList.push(this.netItem);

          this.infoName = this.netItem.orgName;

          this.infoDetail = this.netItem.orgAddr;

this.nearComList = [{

'comName': '车名称',

'comAddr': '车详细地址',

'longitude': '113.262',

'latitude': '23.2128'

},

{

'comName': '车名称2',

'comAddr': '车详细地址2',

'longitude': '113.532632',

'latitude': '23.1228'

},

{

'comName': '车名称3',

'comAddr': '车详细地址3',

'longitude': '113.42632',

'latitude': '23.1228'

},

{

'comName': '车名称4',

'comAddr': '车详细地址4',

'longitude': '113.327632',

'latitude': '23.16228'

},

{

'comName': '车名称5',

'comAddr': '车详细地址5',

'longitude': '113.324632',

'latitude': '23.3228'

},

{

'comName': '车名称6',

'comAddr': '车详细地址6',

'longitude': '113.1632',

'latitude': '23.2228'

}

];

},

methods: {

showOrHideTabbar() {

this.tabbarIsHide = !this.tabbarIsHide;

if (this.tabbarIsHide) {

uni.hideTabBar();

} else {

uni.showTabBar();

}

},

netCurClick(item) {

this.followIsHide = false;

this.infoName = this.netItem.orgName;

this.infoDetail = this.netItem.orgAddr;

},

companyCurClick(item) {

this.followIsHide = true;

this.infoName = item.comName;

this.infoDetail = item.comAddr;

console.log('客户坐标item = ' + JSON.stringify(item));

},

// 计算两点附近距离

getDistance(lat1, lng1, lat2, lng2) {

let EARTH_RADIUS = 6378.137;

let radLat1 = this.rad(lat1);

let radLat2 = this.rad(lat2);

let a = radLat1 - radLat2;

let b = this.rad(lng1) - this.rad(lng2);

let s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) +

Math.cos(radLat1) * Math.cos(radLat2) *

Math.pow(Math.sin(b / 2), 2)));

s = s * EARTH_RADIUS;

//s = Math.round(s * 10000d) / 10000d;

s = Math.round(s * 10000) / 10000;

s = s * 1000; //乘以1000是换算成米

return s;

},

rad(d) {

return d * Math.PI / 180.0;

},

},

};

</script>

```

#### CSS

```CSS

<style>

.content {

display: flex;

flex-direction: column;

width: 100%;

height: 100%;

overflow: hidden;

}

/* 搜索 */

.topView {

margin-top: 2px;

width: 100%;

height: 56px;

display: flex;

flex-direction: row;

}

.uni-search {

text-align: center;

justify-content: center;

width: 88%;

height: 30px;

background-color: #F2F2F2;

}

.changeIcon {

margin-left: -2px;

margin-top: 27rpx;

width: 12%;

height: 24px;

}

/* .mySwitch {

width: 208rpx;

margin-left: 3px;

height: 56rpx;

margin-top: 22rpx;

} */

/* 地图 */

.bm-view {

width: 100%;

height: calc(100vh - 154px);

}

/* 自定义控件 */

.bmControl {

margin-top: calc(100vh - 284px);

width: 100vw;

margin-left: 0vw;

height: 90px;

background-color: white;

border-radius: 8rpx;

}

.bmTopView {

display: flex;

flex-direction: column;

margin-left: 26rpx;

margin-top: 12rpx;

width: 100%;

height: 112rpx;

}

.rowView {

display: flex;

flex-direction: row;

}

.netView {

font-size: 16px;

font-weight: 500;

color: #333333;

line-height: 26px;

font-family: PingFangSC-Semibold, PingFang SC;

}

.midView {

display: flex;

flex-direction: row;

margin-left: 6rpx;

color: #666666;

width: 70%;

height: 60rpx;

line-height: 50rpx;

font-size: 13px;

}

.locImg {

margin-left: 2px;

margin-top: 0rpx;

width: 74px;

height: 30px;

background-color: #1677FF;

border-radius: 32px;

color: #FFFFFF;

text-align: center;

line-height: 30px;

}

.bmBotView {

display: flex;

flex-direction: row;

margin-left: 6rpx;

height: 36px;

}

.bmBotleftView {

width: 70%;

display: flex;

flex-direction: row;

}

.userIcon {

margin-left: 24rpx;

margin-top: 4rpx;

width: 20px;

height: 20px;

}

.userName {

text-align: center;

margin-left: 2px;

margin-top: 0rpx;

width: auto;

height: 24px;

line-height: 24px;

font-size: 26rpx;

color: #999999;

border-radius: 3px;

}

.pullScrollView {

display: flex;

flex-direction: column;

height: auto;

width: 100%;

background-color: #F2F2F2;

}

.uni-list {

margin-top: 0px;

height: 100%;

}

.uni-list-cell {

display: flex;

flex-direction: column;

margin-bottom: 12px;

width: 91%;

margin-left: 4.5%;

height: auto;

background-color: #FFFFFF;

border-radius: 12rpx;

}

.list-text {

margin-left: 34rpx;

line-height: 44px;

width: 100%;

font-size: 32rpx;

color: #333333;

height: 44px;

}

.list-textDetail {

margin-left: 34rpx;

line-height: 40rpx;

width: 100%;

font-size: 28rpx;

color: #666666;

height: 40rpx;

margin-bottom: 40rpx;

}

.checkbtn {

margin-top: -12px;

margin-left: 8px;

text-align: center;

width: 160rpx;

font-size: 26rpx;

color: #1677FF;

background-color: #E7F1FF;

height: 34px;

line-height: 34px;

border-radius: 34rpx;

}

</style>

```

到了这里,关于仿滴滴打车百度地图定位查找附近出租车或门店信息的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 出租车GPS轨迹数据分析

    •使用numpy、pandas等完成“00.csv”文件读取; •剔除无效数据:GPS 采集出租车轨迹数据的过程中,可能因设备问题 导致数据没有采集到,故而在原始轨迹数据集中记录为空值。因此,需 要将每个采样点中有效字段为空值的数据进行剔除,即剔除 DeviceID、 Longitude、Latitude、

    2024年02月04日
    浏览(34)
  • 基于单片机出租车计价器设计

     功能介绍 以51单片机作为主控系统; 1602液晶屏显示最初的起步价,里程收费,等待时间收费; 按键调整起步价,里程收费,等待时间收费; 电机旋转,通过霍尔传感器检测转速,来模拟出租车行驶; 电路图 仿真图 元器件清单 B1 5V直流电机+托盘(粘好磁铁) BT1 2032纽扣电

    2024年02月11日
    浏览(31)
  • 企业spark案例 —— 出租车轨迹分析(Python)

    头歌的大数据作业,答案没找着,遂自己整了一份 第1关:SparkSql 数据清洗 任务描述 本关任务:将出租车轨迹数据规整化,清洗掉多余的字符串。 相关知识 为了完成本关任务,你需要掌握:1. 如何使用 SparkSQL 读取 CSV 文件,2. 如何使用正则表达式清洗掉多余字符串。 编程要

    2024年02月03日
    浏览(38)
  • 【Vivado】基于FPGA的出租车计价表设计

    学校FPGA设计结课课设 主要做了出租车计价表,一个比较旧的课题,代码如下: 分模块编程,按照价目表写代码,具体注释见代码。 在module里新加一个 input 变量 key_stage ,用 key_stage 表示不同车流量段,用以计数 在module里新增一个变量 state 来限定是在白天还是夜间

    2024年02月04日
    浏览(41)
  • LeetCode 2008. 出租车的最大盈利:动态规划 + 哈希表

    力扣题目链接:https://leetcode.cn/problems/maximum-earnings-from-taxi/ 你驾驶出租车行驶在一条有 n  个地点的路上。这 n  个地点从近到远编号为  1  到  n  ,你想要从 1  开到 n  ,通过接乘客订单盈利。你只能沿着编号递增的方向前进,不能改变方向。 乘客信息用一个下标从 0  开

    2024年02月04日
    浏览(36)
  • 0097-基于单片机的出租车计价器仿真设计

    1、采用51/52单片机作为主控芯片; 2、采用1602液晶显示:里程、计价、实时时间、实时单价、本次行程计时; 3、采用DS1302作为时钟芯片; 4、支持切换显示界面、设置日期时间、设置白天单价、设置夜晚单价; 5、支持分别设置3千米内的单价、3千米外的单价、等待时的单价

    2024年02月20日
    浏览(36)
  • 【Cocos 3d】从零开始自制3d出租车小游戏

    本文很长,建议收藏食用。 课程来源: 游戏开发教程 | 零基础也可以用18堂课自制一款3D小游戏 | Cocos Creator 3D 中文教程(合集)p1~p6 简介: 资源下载:https://github.com/cocos-creator/tutorial-taxi-game 适合学习人群:本教程假定你对编程有一定的了解,ts,js 学习过其中之一。 如果不

    2024年02月02日
    浏览(41)
  • transbigdata 笔记:官方文档案例1(出租车GPS数据处理)

    官方文档中给定的出租车数据在transbigdata/docs/source/gallery/data/TaxiData-Sample.csv at main · ni1o1/transbigdata (github.com)     transbigdata笔记:数据预处理-CSDN博客 transbigdata笔记:数据预处理-CSDN博客 异常记录点,指的是记录点前后的出租车状态(有乘客/无乘客)和自己的出租车状态不一

    2024年01月21日
    浏览(37)
  • 使用TransBigData快速高效地处理、分析、挖掘出租车GPS数据

    TransBigData是一个为交通时空大数据处理、分析和可视化而开发的Python包。TransBigData为处理常见的交通时空大数据(如出租车GPS数据、共享单车数据和公交车GPS数据等)提供了快速而简洁的方法。TransBigData为交通时空大数据分析的各个阶段提供了多种处理方法,代码简洁、高效、

    2024年02月14日
    浏览(36)
  • 出租车模拟计费Verilog代码AX301开发板Quartus

    名称:出租车模拟计费Verilog代码AX301开发板Quartus 软件:Quartus 语言:Verilog 代码功能: 出租车模拟计费系统的实现 设计一个模拟的出租车计费系统,能显示里程和费用。 要求:(1)自行设定车速,根据计时转换为里程,里程显示方式为XXX,单位为km; (2)费用的计算及显

    2024年01月17日
    浏览(29)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包