zjj_branch
Zjj 1 year ago
parent 7d6b2c3261
commit 7d87091f34

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020 jwhuang
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

@ -0,0 +1,29 @@
## 导航lite
地图导航、路线导航、公交地铁换乘方案
#### 效果截图
<img src="https://images.gitee.com/uploads/images/2019/1212/163448_1cb55db5_5543907.jpeg" width="280">
<img src="https://raw.githubusercontent.com/jwhuang59/wx_navigationLite/master/screenshot/2.jpg" width="280">
<img src="https://images.gitee.com/uploads/images/2019/1212/163448_af262fa0_5543907.jpeg" width="280">
<img src="https://images.gitee.com/uploads/images/2019/1212/163450_fbb224e1_5543907.jpeg" width="280">
<img src="https://images.gitee.com/uploads/images/2019/1212/163449_b412800a_5543907.jpeg" width="280">
<img src="https://images.gitee.com/uploads/images/2019/1212/163451_5047206e_5543907.jpeg" width="280">
<img src="https://images.gitee.com/uploads/images/2019/1212/163453_761bb179_5543907.jpeg" width="280">
#### 安装与运行
``` bash
安装微信开发者工具。 把项目下载到本地。 在微信开发者工具中打开该项目即可预览。
```
#### 在线访问
<img src="https://github.com/jwhuang59/wx_navigationLite/blob/master/screenshot/visit.png?raw=true" width="280">
#### 鼠标右上角star谢谢

@ -0,0 +1,57 @@
//app.js
const amapFile = require('utils/amap-wx.js');
App({
onLaunch: function () {
// 展示本地存储能力
var logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs)
// 登录
// wx.login({
// success: res => {
// // 发送 res.code 到后台换取 openId, sessionKey, unionId
// }
// })
// 获取用户信息
// wx.getSetting({
// success: res => {
// if (res.authSetting['scope.userInfo']) {
// // 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
// wx.getUserInfo({
// success: res => {
// // 可以将 res 发送给后台解码出 unionId
// this.globalData.userInfo = res.userInfo
// // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
// // 所以此处加入 callback 以防止这种情况
// if (this.userInfoReadyCallback) {
// this.userInfoReadyCallback(res)
// }
// }
// })
// }
// }
// })
},
globalData: {
mapInfo:"",
mapApi:"https://restapi.amap.com/v3/",
history:[],
historyRoute:[],
homePart: {
homeText: '设置一个地址',
homePoint: ''
},
companyPart: {
companyText: '设置一个地址',
companyPoint: '',
},
}
})

@ -0,0 +1,36 @@
{
"pages": [
"pages/index/index",
"pages/search/search",
"pages/nearby/nearby",
"pages/site/site",
"pages/route/route",
"pages/detail/detail",
"pages/admin/admin",
"pages/navigation/navigation",
"pages/collect/collect"
],
"permission": {
"scope.userLocation": {
"desc": "你的位置信息将用于小程序位置接口的效果展示"
}
},
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#4188fe",
"navigationBarTitleText": "导航lite",
"navigationBarTextStyle": "white"
},
"navigateToMiniProgramAppIdList": [
"wxbbec65de8931cc38"
],
"requiredPrivateInfos":[
"getLocation",
"chooseAddress",
"onLocationChange",
"startLocationUpdate",
"startLocationUpdateBackground",
"choosePoi",
"chooseLocation"
]
}

@ -0,0 +1,11 @@
/**app.wxss**/
.container {
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 410 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 595 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 924 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 835 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 910 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

@ -0,0 +1,118 @@
// pages/admin/admin.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
clearStorage: function () {
var that = this;
wx.showModal({
title: '提示',
content: '是否清除缓存',
success(res) {
if (res.confirm) {
wx.clearStorage({
success: function () {
wx.showToast({
title: '清除完成',
icon: 'success',
duration: 1000
})
}
});
} else if (res.cancel) {
wx.hideToast()
}
}
})
},
toCollect:function(){
wx.navigateTo({
url: '../collect/collect',
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
return {
title: '导航lite地图导航、路线导航、公交地铁换乘方案',
path: '/pages/index/index',
success: function (res) {
// 转发成功
wx.showToast({
title: '分享成功',
icon: 'success',
duration: 1000
})
},
fail: function (res) {
// 转发失败
wx.showToast({
title: '分享取消',
icon: 'success',
duration: 1000
})
}
}
}
})

@ -0,0 +1,5 @@
{
"usingComponents": {},
"backgroundColor":"#eee",
"navigationBarTitleText": "设置"
}

@ -0,0 +1,48 @@
<!--pages/admin/admin.wxml-->
<view class="container">
<view class="header">
<open-data type="userAvatarUrl" class="adminImg"></open-data>
<open-data type="userNickName" class="adminName"></open-data>
</view>
<view class="wrapper">
<text class="title">设置</text>
<button class="lis" open-type="openSetting">
<label>授权设置</label>
<text>允许使用地理位置</text>
</button>
<view class="lis" bindtap='clearStorage'>
<label>清除缓存</label>
</view>
<text class="title">操作</text>
<button open-type="share" class="lis">
<label>分享</label>
<text>分享给微信好友</text>
</button>
<view class="lis" bindtap="toCollect">
<label>收藏</label>
<text>添加到我的小程序</text>
</view>
<button class="lis" open-type="contact">
<label>客服</label>
<text>查看使用指南</text>
</button>
<button class="lis" open-type="feedback">
<label>意见反馈</label>
</button>
</view>
</view>

@ -0,0 +1,18 @@
/* pages/admin/admin.wxss */
.container{width:100%;height:100%;}
.header{width:100%;height:120px;margin:0 auto;background:#eee;}
.header .adminImg{width:60px;height:60px;margin:20px auto 10px;border-radius:50%;display: block;overflow: hidden;}
.header .adminName{height:30px;line-height:30px;text-align:center;font-size:16px;color:#333;display:block;}
.wrapper{position: absolute;top:120px;left:0;right:0;bottom:0;background:#eee;}
.wrapper .title{height:40px;line-height:46px;font-size:15px;color:#999;padding:0 10px;display: block;background:#eee;}
.wrapper .lis{height:50px;line-height:50px;padding:0 10px;border-bottom:1px solid #eee;background:#fff;text-align:left;}
.wrapper .lis label{color:#333;font-size:16px;}
.wrapper .lis text{font-size:14px;color:#aaa;margin-left:12px;}
.wrapper button::after{border:none;}
.button-hover{background:#dedede !important;}

@ -0,0 +1,66 @@
// pages/collect/collect.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "收藏导航lite"
}

@ -0,0 +1,17 @@
<!--pages/collect/collect.wxml-->
<view class="container">
<text class="title">如何收藏导航lite</text>
<view class="step">
<text>1.点击右上方“虚线点”</text>
<image src="../../image/step1.jpg"></image>
</view>
<view class="step">
<text>2.点击下方“添加到我的小程序”</text>
<image src="../../image/step2.jpg"></image>
</view>
<view class="other">
<text>如有问题,请联系我</text>
<text>微信17521071571</text>
<text>邮箱mr_huang509@163.com</text>
</view>
</view>

@ -0,0 +1,10 @@
/* pages/collect/collect.wxss */
.container{width:100%;padding:0 20px;margin-top:20px;display:block;text-align:left;}
.container .title{font-size:18px;color:#333;font-weight:bold;}
.container .step{margin-top:15px;}
.container .step text{font-size:16px;color:#666;}
.container .step image{width:100%;margin:15px 0}
.container .other{margin:10px 0 30px;}
.container .other text{font-size:15px;color:#666;display:block;}

@ -0,0 +1,288 @@
// pages/detail/detail.js
const amapFile = require('../../utils/amap-wx.js');
const appData = getApp().globalData;
//时间换算
function timeStamp(StatusMinute) {
var day = parseInt(StatusMinute / 60 / 24);
var hour = parseInt(StatusMinute / 60 % 24);
var min = parseInt(StatusMinute % 60);
StatusMinute = "";
if (day > 0) {
StatusMinute = day + "天";
}
if (hour > 0) {
StatusMinute += hour + "小时";
}
if (min > 0) {
StatusMinute += parseFloat(min) + "分钟";
}
return StatusMinute;
}
Page({
/**
* 页面的初始数据
*/
data: {
getDetail:'',
showBus:'',
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
console.log(options)
wx.showLoading({
title: '加载中',
})
var that = this;
var num = options.num
if (options.showbus == 'true') {
wx.request({
url: 'https://restapi.amap.com/v3/direction/' + options.post,
data: {
key: 'e96f52f2aaa72ccfcddae396c0293794',
origin: options.origin,
destination: options.destination,
city: appData.mapInfo.regeocodeData.addressComponent.province,
},
success: function (res) {
wx.hideLoading()
var segments = res.data.route.transits[num].segments
for (var i = 0; i < segments.length; i++) {
if (segments[i].entrance.name) {
segments[i].entrance.name = segments[i].entrance.name + '进站'
}
if (segments[i].exit.name) {
segments[i].exit.name = segments[i].exit.name + '出站'
}
if (segments[i].walking != '') {
if (segments[i].bus.buslines != '') {
segments[i].walkingDistance = '步行' + segments[i].walking.distance + '米到达' + segments[i].bus.buslines[0].departure_stop.name + ',约' + parseInt(segments[i].walking.duration / 60) + '分钟'
} else {
segments[i].walkingDistance0 = '步行' + segments[i].walking.distance + '米' + ',约' + parseInt(segments[i].walking.duration / 60) + '分钟'
}
}
if (segments[i].bus.buslines != '') {
segments[i].distance = parseInt(segments[i].bus.buslines[0].distance / 1000).toFixed(1) + '公里'
segments[i].duration = parseInt(segments[i].bus.buslines[0].duration / 60).toFixed(0) + '分钟'
}
}
res.data.route.transits[num].duration = timeStamp(parseInt(res.data.route.transits[num].duration / 60))
if (res.data.route.transits[num].distance < 1000) {
res.data.route.transits[num].distance = res.data.route.transits[num].distance + "米"
} else {
res.data.route.transits[num].distance = (res.data.route.transits[num].distance / 1000).toFixed(1) + "公里"
}
var busData = [];
busData.push(res.data.route.transits[num])
busData.push({
taxi_cost: '花费' + parseInt(res.data.route.transits[num].cost) + '元',
sitename: options.sitename,
startName: options.startName,
})
//console.log(busData)
that.setData({
getDetail: busData,
showBus: options.showbus
})
}
})
}else{
if (options.post == 'bicycling') {
wx.request({
url: 'https://restapi.amap.com/v4/direction/' + options.post,
data: {
key: 'e96f52f2aaa72ccfcddae396c0293794',
origin: options.origin,
destination: options.destination
},
success: function (res) {
wx.hideLoading()
res.data.data.paths[0].duration = timeStamp(parseInt(res.data.data.paths[0].duration / 60))
if (res.data.data.paths[0].distance < 1000) {
res.data.data.paths[0].distance = res.data.data.paths[0].distance + "米"
} else {
res.data.data.paths[0].distance = (res.data.data.paths[0].distance / 1000).toFixed(1) + "公里"
}
res.data.data.paths.push({
sitename: options.sitename,
taxi_cost: '',
startName: options.startName,
})
that.setData({
getDetail: res.data.data.paths,
hasBus: options.post,
})
},
fail: function (res) {
console.log(res)
},
})
} else {
wx.request({
url: 'https://restapi.amap.com/v3/direction/' + options.post,
data: {
key: 'e96f52f2aaa72ccfcddae396c0293794',
origin: options.origin,
destination: options.destination
},
success: function (res) {
wx.hideLoading()
res.data.route.paths[0].duration = timeStamp(parseInt(res.data.route.paths[0].duration / 60))
if (res.data.route.paths[0].distance < 1000) {
res.data.route.paths[0].distance = res.data.route.paths[0].distance + "米"
} else {
res.data.route.paths[0].distance = (res.data.route.paths[0].distance / 1000).toFixed(1) + "公里"
}
var total = 0;
if (options.post == 'driving') {
for (var i = 0; i < res.data.route.paths[0].steps.length; i++) {
total += parseInt(res.data.route.paths[0].steps[i].tolls)
}
total = '过路费' + total + '元'
} else {
total = ''
}
res.data.route.paths.push({
sitename: options.sitename,
taxi_cost: total,
startName: options.startName,
})
that.setData({
getDetail: res.data.route.paths
})
console.log(res.data.route.paths)
},
fail: function (res) {
console.log(res)
},
})
}
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

@ -0,0 +1,6 @@
{
"navigationBarTitleText": "路线详情",
"backgroundColorTop": "#4188fe",
"backgroundColorBottom": "#fff"
}

@ -0,0 +1,83 @@
<!--pages/detail/detail.wxml-->
<view class="container">
<view class="place">
<view class="place-sec">
<text class="origin">{{ getDetail[1].startName }}</text>
<image src="../../image/arrow1.png"></image>
<text class="destination">{{ getDetail[1].sitename }}</text>
</view>
<view class="place-row">
<text>{{ getDetail[0].duration }} · </text>
<text>{{ getDetail[0].distance }}</text>
</view>
</view>
<view class="detail">
<view class="lis-start">
<image src="../../image/startpoint0.png"></image>
<text class="start-origin">从 {{ getDetail[1].startName }} 出发</text>
<text class="start-case">{{ getDetail[1].taxi_cost }}</text>
<view class="clear"></view>
</view>
<block wx:if="{{showBus}}">
<view class="busDetail" wx:for="{{getDetail[0].segments}}" wx:key="index">
<text>{{ getDetail[0].segments[index].walkingDistance }}</text>
<view class="busStep" wx:if="{{ getDetail[0].segments[index].bus.buslines != '' }}">
<view class="ste-sitename" >
{{ getDetail[0].segments[index].bus.buslines[0].name }}
</view>
<view class="step-wrapper">
<view class="site-departure_stop">
<text>{{ getDetail[0].segments[index].bus.buslines[0].departure_stop.name }}</text>
<text>{{ getDetail[0].segments[index].entrance.name }}</text>
</view>
<view class="site-msg">
<text>途径{{ getDetail[0].segments[index].bus.buslines[0].via_stops.length }}个站 · </text><text>{{ getDetail[0].segments[index].distance }} · </text><text>{{ getDetail[0].segments[index].duration }}</text>
</view>
<view class="sitem-via_stops">
<text wx:for="{{ getDetail[0].segments[index].bus.buslines[0].via_stops }}" wx:key="num" wx:for-index="idx">{{ getDetail[0].segments[index].bus.buslines[0].via_stops[idx].name }} <text wx:if="{{idx < getDetail[0].segments[index].bus.buslines[0].via_stops.length - 1}}"> → </text></text>
</view>
<view class="site-arrival_stop">
<text>{{ getDetail[0].segments[index].bus.buslines[0].arrival_stop.name }}</text>
<text>{{ getDetail[0].segments[index].exit.name }}</text>
</view>
</view>
</view>
<text>{{ getDetail[0].segments[index].walkingDistance0 }}</text>
</view>
</block>
<block wx:else>
<view class="detail-lis" wx:for="{{ getDetail[0].steps }}" wx:key="{{index}}">
<view class="detail-load">
<text>{{ getDetail[0].steps[index].road }}</text>
</view>
<view class="detail-process">
<text>{{ getDetail[0].steps[index].instruction }}</text>
</view>
</view>
</block>
<view class="lis-end">
<image src="../../image/endpoint0.png"></image>
<text class="end-origin">到达 {{ getDetail[1].sitename }}</text>
</view>
</view>
</view>

@ -0,0 +1,67 @@
/* pages/detail/detail.wxss */
.container{width:100%;display:flex;}
.place{width:100%;background:#4188fe;padding:10px 15px;box-sizing: border-box;text-align:center;}
.place .place-sec{height:30px;line-height:30px;}
.place .place-sec text{font-size:14px;color:#fff;}
.place .place-sec .origin{width:150px;float:left;overflow: hidden;text-overflow:ellipsis;white-space: nowrap;text-align:left;}
.place .place-sec image{width:20px;height:20px;margin:5px auto;display:inline-block;}
.place .place-sec .destination{width:150px;float:right;overflow: hidden;text-overflow:ellipsis;white-space: nowrap;text-align:right}
.place .place-row{height:30px;line-height:30px;text-align:right;}
.place .place-row text{font-size:15px;color:#fff;}
.detail{width:100%;padding:10px 20px;box-sizing: border-box;}
.detail .lis-start{margin-left:20px;position:relative;border-bottom:1px solid #ddd;}
.detail .lis-start:after{content:"";width:2px;height:16px;background:#ccc;position:absolute;left:-21px;bottom:-1px;}
.detail .lis-start text{margin:15px 0;font-size:15px;color:#333}
.detail .lis-start image{width:20px;height:20px;position:absolute;left:-30px;top:50%;transform: translate(0,-50%);}
.detail .lis-start .start-origin{width:70%;float:left;}
.detail .lis-start .start-case{width:30%;float:right;text-align:right;color:#0091ff}
.detail .lis-start .clear{clear:both;}
.detail .lis-end{height:50px;margin-left:20px;position:relative;}
.detail .lis-end:after{content:"";width:2px;height:16px;background:#ccc;position:absolute;left:-21px;top:-1px;}
.detail .lis-end text{margin:15px 0;font-size:15px;color:#333}
.detail .lis-end image{width:20px;height:20px;position:absolute;left:-30px;top:50%;transform: translate(0,-50%);}
.detail .lis-end .end-origin{float:left;}
.detail .lis-end .end-case{float:right;text-align:right;color:#0091ff}
.detail .detail-lis{margin-left:20px;position:relative;}
.detail .detail-lis:before{content:"";width:2px;height:100%;background:#ccc;position:absolute;left:-21px;top:0}
.detail .detail-lis:after{content:"";width:14px;height:14px;border-radius: 8px;background:#eee;border:1px solid #bbb;position:absolute;left:-28px;top:50%;transform: translate(0,-50%);}
.detail .detail-lis .detail-load{padding-top:10px;}
.detail .detail-lis .detail-load text:nth-child(1){font-size:15px;font-weight:bold;color:#333}
.detail .detail-lis .detail-process{border-bottom:1px solid #ddd;padding-bottom:10px;}
.detail .detail-lis .detail-process text{font-size:14px;color:#999;}
.busDetail{margin-left:20px;position:relative;}
.busDetail:before{content:"";width:2px;height:100%;background:#ccc;position:absolute;left:-21px;top:0}
.busDetail:after{content:"";width:14px;height:14px;border-radius: 8px;background:#eee;border:1px solid #bbb;position:absolute;left:-28px;top:50%;transform: translate(0,-50%);}
.busDetail>text{font-size:14px;color:#999;line-height:42px;display:block;}
.busDetail .busStep{width:100%;padding-bottom:15px;border-bottom:1px solid #ddd}
.busDetail .busStep .ste-sitename{background:#9ed199;font-size:16px;height:42px;line-height:42px;color:#fff;border-top-left-radius:5px;
border-top-right-radius:5px;padding-left:10px;}
.busDetail .busStep .step-wrapper{background:#eef7f2;padding:6px 10px;}
.busDetail .busStep .step-wrapper .site-departure_stop{margin-bottom:6px;}
.busDetail .busStep .step-wrapper .site-departure_stop text:nth-child(1){font-size:15px;font-weight:bold;}
.busDetail .busStep .step-wrapper .site-departure_stop text:nth-child(2){font-size:12px;background:#5884ef;border-radius: 2px;margin-left:5px;display:inline-block;}
.busDetail .busStep .site-msg{font-size:14px;color:#999;margin:5px 0;}
.busDetail .busStep .sitem-via_stops{font-size:15px;color:#333;}
.busDetail .busStep .step-wrapper .site-arrival_stop{margin:5px 0;}
.busDetail .busStep .step-wrapper .site-arrival_stop text:nth-child(1){font-size:15px;font-weight:bold;}
.busDetail .busStep .step-wrapper .site-arrival_stop text:nth-child(2){font-size:12px;background:#ff2f4c;border-radius: 2px;margin-left:5px;}

@ -0,0 +1,161 @@
// pages/maps.js
const amapFile = require('../../utils/amap-wx.js');
Page({
/**
* 页面的初始数据
*/
data: {
tips:{},
mapMsg: "",
weatherMsg: "",
iconPath:"../../image/location.png",
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
var that = this;
var myAmapFun = new amapFile.AMapWX({ key: 'eeef012afe4c956d0d38fd3a132fb267' });
myAmapFun.getRegeo({
success: function (data) {
//console.log(data[0])
getApp().globalData.mapInfo = data[0]
that.setData({
mapMsg: data[0]
});
},
fail: function (info) {
console.log(info)
}
});
myAmapFun.getWeather({
success: function (data) {
that.setData({
weatherMsg: data.liveData
});
},
fail: function (info) {
console.log(info)
}
})
},
bindInput: function (e) {
var that = this;
var keywords = e.detail.value;
var key = config.Config.key;
var myAmapFun = new amapFile.AMapWX({ key: 'eeef012afe4c956d0d38fd3a132fb267' });
myAmapFun.getInputtips({
keywords: keywords,
location: '',
success: function (data) {
if (data && data.tips) {
that.setData({
tips: data.tips
});
}
}
})
},
bindSearch: function (e) {
wx.navigateTo({
url: '../search/search'
})
},
toAdmin:function(){
wx.navigateTo({
url: '../admin/admin'
})
},
toLocation:function(){
this.mapCtx.moveToLocation()
},
toLoadline:function(){
wx.navigateTo({
url: '../navigation/navigation?startPoint=' + this.data.mapMsg.longitude + ',' + this.data.mapMsg.latitude +'&startName=我的位置'
})
},
onReady: function () {
this.mapCtx = wx.createMapContext('myMap')
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
return {
title: '导航lite地图导航、路线导航、公交地铁换乘方案',
path: '/pages/index/index',
success: function (res) {
// 转发成功
wx.showToast({
title: '分享成功',
icon: 'success',
duration: 1000
})
},
fail: function (res) {
// 转发失败
wx.showToast({
title: '分享取消',
icon: 'success',
duration: 1000
})
}
}
}
})

@ -0,0 +1,44 @@
<!--pages/maps.wxml-->
<!-- <view class="section">
<view class="wrapper">
<input bindinput="bindInput" placeholder="搜索地点,公交,地铁" />
</navigator>
<text>{{weatherInfo.temperature}}℃ , {{weatherInfo.weather}}</text>
</view>
</view>
<view bindtouchstart="bindSearch" data-keywords="{{i.name}}" class="text_box" wx:for="{{tips}}" wx:for-item="i">
{{i.name}}
</view> -->
<view class="container">
<map id="myMap" style="width: 100%; height: 100%;" scale="16" latitude="{{mapMsg.latitude}}" longitude="{{mapMsg.longitude}}" iconPath="../../image/location.png" show-location >
<cover-view class="wrapper">
<cover-image src='../../image/admin.png' class='admin' bindtap="toAdmin"></cover-image>
<cover-view class="input" bindtap="bindSearch">搜索地点,公交,地铁</cover-view>
<cover-view class="text">{{weatherMsg.temperature}}° {{weatherMsg.weather}} </cover-view>
</cover-view>
<cover-view class="rest" bindtap="toLocation">
<cover-image src='../../image/rest.png' class='restimg'></cover-image>
</cover-view>
<cover-view class="share" >
<button open-type="share">
<cover-image src='../../image/flower.png' class='shareimg'></cover-image>
</button>
</cover-view>
<cover-view class="loadline" bindtap="toLoadline">
<cover-image src='../../image/loadline.png' class='loadlineimg'></cover-image>
<cover-view class="loadlinetext">路线</cover-view>
</cover-view>
</map>
</view>

@ -0,0 +1,28 @@
/* pages/maps.wxss */
.section{width: 100%;position:absolute;top:20px;}
.text_box{margin: 10px 25px;border-bottom:1px solid #c3c3c3;padding-bottom:10px}
.container{position: absolute;z-index:-1;top: 0;bottom: 0;left: 0;right: 0;}
.container .wrapper{width:90%;height:40px;margin:20px auto 0;background:#ffffff;border-radius: 5px;border:1px solid #e7e7e7}
.container .admin{width:30px;height:30px;margin:6px;display:inline-block;float:left;}
.container .input{width:50%;float:left;height:40px;line-height:40px;color:#666;font-size:14px;}
.container .text{width:20%;height:42px;line-height:42px;float:right;text-align:right;font-size:14px;color:#666;padding-right:10px;}
.container .rest{width:42px;height:42px;border-radius: 50%;position:absolute;bottom:40px;left:30px;background:#fff;border:1px solid #e7e7e7}
.container .restimg{width:30px;height:30px;margin:6px auto;}
.container .share{width:42px;height:42px;border-radius: 50%;position:absolute;bottom:40px;right:30px;background:#fff;border:1px solid #e7e7e7}
.container .share button{background-color:transparent;}
.container .share button::after{border:none;}
.container .shareimg{width:30px;height:30px;margin:6px auto;}
.container .loadline{width:68px;height:68px;border-radius: 50%;position:absolute;bottom:100px;right:50%;margin-right:-34px;background:#4188fe;}
.container .loadlineimg{width:32px;height:32px;margin:6px auto 2px;}
.container .loadlinetext{text-align:center;color:#fff;font-size:16px;}

@ -0,0 +1,618 @@
// pages/navigation/navigation.js
const appData = getApp().globalData;
Page({
/**
* 页面的初始数据
*/
data: {
startPointBean:true,
endPointBean:false,
hasanimate:'',
toolData: ["驾车", "公交", "步行", "骑行",],
_num:0,
changeData:'',
hasHistory:true,
historyRoute:'',
homePart:'',
companyPart:'',
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
changeData:options,
homePart: appData.homePart,
companyPart: appData.companyPart
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
chooseStartPoint:function(){
var that = this
wx.chooseLocation({
type: 'gcj02', // 返回可以用于wx.openLocation的经纬度
success(res) {
if (res.name != '') {
if (that.data.endPointBean) {
wx.navigateTo({
url: "../route/route?startName=" + res.name + "&startPoint=" + res.longitude + ',' + res.latitude + "&endName=" + that.data.changeData.endName + "&endPoint=" + that.data.changeData.endPoint + "&ways=" + that.data._num
})
that.setData({
changeData: {
startName: res.name,
startPoint: res.longitude + ',' + res.latitude,
endName: that.data.changeData.endName,
endPoint: that.data.changeData.endPoint
},
startPointBean:true
})
that.storageHistory();
} else {
that.setData({
changeData: {
startName: res.name,
startPoint: res.longitude + ',' + res.latitude,
},
})
}
} else {
wx.showToast({
title: '请选择正确的地址',
icon: 'none',
duration: 1500
})
}
}
})
},
changePoint:function(){
this.setData({
hasanimate:'animate'
})
var that = this
setTimeout(function(){
that.setData({
hasanimate: ''
})
},300)
if (this.data.endPointBean && this.data.startPointBean) {
this.setData({
changeData: {
startName: this.data.changeData.endName,
startPoint: this.data.changeData.endPoint,
endName: this.data.changeData.startName,
endPoint: this.data.changeData.startPoint,
},
})
} else if (this.data.startPointBean){
this.setData({
changeData: {
startName: '输入起点',
startPoint: '',
endName: this.data.changeData.startName,
endPoint: this.data.changeData.startPoint,
},
endPointBean: true,
startPointBean: false
})
} else if (this.data.endPointBean){
this.setData({
changeData: {
startName: this.data.changeData.endName,
startPoint: this.data.changeData.endPoint,
endName: '输入终点',
endPoint: "",
},
startPointBean: true,
endPointBean: false
})
}
},
changetool:function(e){
this.setData({
_num: e.target.dataset.num
})
},
chooseEndPoint:function(){
var that = this
wx.chooseLocation({
type: 'gcj02', // 返回可以用于wx.openLocation的经纬度
success(res) {
if (res.name != '') {
if (that.data.startPointBean){
wx.navigateTo({
url: "../route/route?startName=" + that.data.changeData.startName + "&startPoint=" + that.data.changeData.startPoint + "&endName=" + res.name + "&endPoint=" + res.longitude + ',' + res.latitude + "&ways=" + that.data._num
})
that.setData({
changeData: {
startName: that.data.changeData.startName,
startPoint: that.data.changeData.startPoint,
endName: res.name,
endPoint: res.longitude + ',' + res.latitude,
},
endPointBean: true
})
that.storageHistory();
}else{
that.setData({
changeData: {
endName: res.name,
endPoint: res.longitude + ',' + res.latitude,
},
})
}
} else {
wx.showToast({
title: '请选择正确的地址',
icon: 'none',
duration: 1500
})
}
}
})
},
goTo:function(){
if (this.data.endPointBean && this.data.startPointBean){
wx.navigateTo({
url: "../route/route?startName=" + this.data.changeData.startName + "&startPoint=" + this.data.changeData.startPoint + "&endName=" + this.data.changeData.endName + "&endPoint=" + this.data.changeData.endPoint + "&ways=" + this.data._num,
})
this.storageHistory();
}else{
if (this.data.startPointBean == false){
wx.showToast({
title: '请输入起点',
icon: 'none',
duration: 1500
})
}
if (this.data.endPointBean == false) {
wx.showToast({
title: '请输入终点',
icon: 'none',
duration: 1500
})
}
}
},
emptyHistory: function () {
var that = this
wx.showModal({
title: '提示',
content: '是否清空历史纪录',
success(res) {
if (res.confirm) {
that.setData({
historyRoute: '',
hasHistory: false
})
appData.historyRoute = [];
} else if (res.cancel) {
}
}
})
},
setupHome:function(){
var that = this
if (this.data.homePart.homeText == "设置一个地址"){
wx.chooseLocation({
type: 'gcj02', // 返回可以用于wx.openLocation的经纬度
success(res) {
if (res.name != '') {
appData.homePart.homeText = res.name
appData.homePart.homePoint = res.longitude + ',' + res.latitude
} else {
wx.showToast({
title: '请选择正确的地址',
icon: 'none',
duration: 1500
})
}
}
})
}else{
wx.showActionSheet({
itemList: ['从这出发', '到这里去', '删除'],
success(res) {
switch (res.tapIndex) {
case 0:
if ( that.data.changeData.endPoint == undefined ){
that.setData({
changeData:{
startName: that.data.homePart.homeText,
startPoint: that.data.homePart.homePoint
}
})
}else{
wx.navigateTo({
url: "../route/route?startName=" + that.data.homePart.homeText + "&startPoint=" + that.data.homePart.homePoint + "&endName=" + that.data.changeData.endName + "&endPoint=" + that.data.changeData.endPoint + "&ways=" + that.data._num,
})
that.setData({
changeData: {
startName: that.data.homePart.homeText,
startPoint: that.data.homePart.homePoint,
endName: that.data.changeData.endName,
endPoint: that.data.changeData.endPoint
},
startPointBean: true
})
that.storageHistory();
}
break;
case 1:
if ( that.data.changeData.startPoint == undefined ) {
that.setData({
changeData: {
endName: that.data.homePart.homeText,
endPoint: that.data.homePart.homePoint,
}
})
} else {
wx.navigateTo({
url: "../route/route?startName=" + that.data.changeData.startName + "&startPoint=" + that.data.changeData.startPoint + "&endName=" + that.data.homePart.homeText + "&endPoint=" + that.data.homePart.homePoint + "&ways=" + that.data._num,
})
that.setData({
changeData: {
startName: that.data.changeData.startName,
startPoint: that.data.changeData.startPoint,
endName: that.data.homePart.homeText,
endPoint: that.data.homePart.homePoint
},
endPointBean: true
})
that.storageHistory();
}
break;
case 2:
that.setData({
homePart:{
homeText: "设置一个地址",
homePoint: ""
}
})
appData.homePart.homeText = "设置一个地址";
appData.homePart.homePoint = "";
}
},
})
}
},
setupCompany: function () {
var that = this
if (this.data.companyPart.companyText == "设置一个地址") {
wx.chooseLocation({
type: 'gcj02', // 返回可以用于wx.openLocation的经纬度
success(res) {
if (res.name != '') {
appData.companyPart.companyText = res.name
appData.companyPart.companyPoint = res.longitude + ',' + res.latitude
} else {
wx.showToast({
title: '请选择正确的地址',
icon: 'none',
duration: 1500
})
}
}
})
} else {
wx.showActionSheet({
itemList: ['从这出发', '到这里去', '删除'],
success(res) {
switch (res.tapIndex) {
case 0:
if (that.data.changeData.endPoint == undefined) {
that.setData({
changeData: {
startName: that.data.companyPart.companyText,
startPoint: that.data.companyPart.companyPoint
}
})
} else {
wx.navigateTo({
url: "../route/route?startName=" + that.data.homePart.homeText + "&startPoint=" + that.data.companyPart.companyPoint + "&endName=" + that.data.changeData.endName + "&endPoint=" + that.data.changeData.endPoint + "&ways=" + that.data._num,
})
that.setData({
changeData: {
startName: that.data.companyPart.companyText,
startPoint: that.data.companyPart.companyPoint,
endName: that.data.changeData.endName,
endPoint: that.data.changeData.endPoint
},
startPointBean: true
})
that.storageHistory();
}
break;
case 1:
if (that.data.changeData.startPoint == undefined) {
that.setData({
changeData: {
endName: that.data.companyPart.companyText,
endPoint: that.data.companyPart.companyPoint,
}
})
} else {
wx.navigateTo({
url: "../route/route?startName=" + that.data.changeData.startName + "&startPoint=" + that.data.changeData.startPoint + "&endName=" + that.data.companyPart.companyText + "&endPoint=" + that.data.companyPart.companyPoint + "&ways=" + that.data._num,
})
that.setData({
changeData: {
startName: that.data.changeData.startName,
startPoint: that.data.changeData.startPoint,
endName: that.data.companyPart.companyText,
endPoint: that.data.companyPart.companyPoint
},
endPointBean: true
})
that.storageHistory();
}
break;
case 2:
that.setData({
companyPart: {
companyText: "设置一个地址",
companyPoint: ""
}
})
appData.companyPart.companyText = "设置一个地址";
appData.companyPart.companyPoint = "";
}
},
})
}
},
storageHistory:function(){
//历史纪录
if (appData.historyRoute != '') {
var bean = true;
for (var i = 0; i < appData.historyRoute.length; i++) {
if (appData.historyRoute[i].startPoint == this.data.changeData.startPoint && appData.historyRoute[i].endPoint == this.data.changeData.endPoint && appData.historyRoute[i].ways == this.data._num){
bean = false
}
}
if(bean){
appData.historyRoute.unshift({
startName: this.data.changeData.startName,
startPoint: this.data.changeData.startPoint,
endName: this.data.changeData.endName,
endPoint: this.data.changeData.endPoint,
ways: this.data._num
})
}
} else {
appData.historyRoute.unshift({
startName: this.data.changeData.startName,
startPoint: this.data.changeData.startPoint,
endName: this.data.changeData.endName,
endPoint: this.data.changeData.endPoint,
ways: this.data._num
})
}
},
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
if (appData.historyRoute != '') {
this.setData({
hasHistory: true,
})
} else {
this.setData({
hasHistory: false,
})
}
this.setData({
historyRoute: appData.historyRoute,
homePart: appData.homePart,
companyPart: appData.companyPart
})
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
return {
title: '导航lite地图导航、路线导航、公交地铁换乘方案',
path: '/pages/index/index',
success: function (res) {
// 转发成功
wx.showToast({
title: '分享成功',
icon: 'success',
duration: 1000
})
},
fail: function (res) {
// 转发失败
wx.showToast({
title: '分享取消',
icon: 'success',
duration: 1000
})
}
}
}
})

@ -0,0 +1,5 @@
{
"navigationBarTitleText": "路线",
"backgroundColorTop":"#4188fe",
"backgroundColorBottom":"#eee"
}

@ -0,0 +1,88 @@
<!--pages/navigation/navigation.wxml-->
<view class="container">
<view class="flex">
<view class="content">
<view class="flex-wrapper">
<image src="../../image/exchange.png" class="changePoint {{ hasanimate }}" bindtap="changePoint"></image>
<view class="goTo">
<view class="go">
<label>从</label>
<button bindtap='chooseStartPoint' wx:if="{{ startPointBean == false }}">输入起点</button>
<button bindtap='chooseStartPoint' wx:if="{{ startPointBean == true }}">{{changeData.startName}}</button>
</view>
<view class="to">
<label>到</label>
<button bindtap='chooseEndPoint' wx:if="{{ endPointBean == false }}">输入终点</button>
<button bindtap='chooseEndPoint' wx:if="{{ endPointBean == true }}">{{changeData.endName}}</button>
</view>
</view>
<image src="../../image/submit.png" class="submit" bindtap='goTo'></image>
</view>
<view class="flex-menu">
<view wx:for="{{toolData}}" wx:key="index" class="flex-item {{index == _num ? 'active' : ''}}" data-num="{{index}}" bindtap="changetool">{{toolData[index]}}</view>
</view>
<view class="flex-setUp">
<view class="setUp-item">
<image src="../../image/home.png"></image>
<view class="home item" bindtap="setupHome">
<label>家</label>
<text>{{homePart.homeText}}</text>
</view>
</view>
<view class="setUp-item">
<image src="../../image/company.png"></image>
<view class="company item" bindtap="setupCompany">
<label>公司</label>
<text>{{companyPart.companyText}}</text>
</view>
</view>
</view>
<button open-type='share' class="share" >
<image src="../../image/share.png"></image>
<label>分享</label>
<text>把导航lite分享给好友</text>
</button>
<view wx:if="{{ hasHistory != '' }}" class="history-wrapper">
<view class="hasHistory" wx:for="{{historyRoute}}" wx:key="{{index}}" wx:for-item="item">
<navigator hover-class="none" url="../route/route?startName={{historyRoute[index].startName}}&startPoint={{historyRoute[index].startPoint}}&endName={{historyRoute[index].endName}}&endPoint={{historyRoute[index].endPoint}}&ways={{historyRoute[index].ways}}">
<view class="history-place" >
<image src="../../image/lishi.png" class="before-icon"></image>
<view class="placeName">
<text>{{historyRoute[index].startName}}</text>
<image src="../../image/arrow0.png"></image>
<text>{{historyRoute[index].endName}}</text>
</view>
<image src="../../image/route{{historyRoute[index].ways}}.png" class="icon-route"></image>
</view>
</navigator>
</view>
<view class="empty-history" bindtap='emptyHistory'>
清空历史纪录
</view>
</view>
<view class="noHistory" wx:else>
<image src="../../image/gantan.png"></image>
<text>无历史纪录</text>
</view>
<view class="tips">数据来源,高德地图开放平台,腾讯地图开放平台</view>
</view>
</view>
</view>

@ -0,0 +1,69 @@
/* pages/navigation/navigation.wxss */
.container{width:100%;height:100%;background:#eee;position:absolute;top:0;bottom:0;left:0;right:0}
.flex{width:100%;display:flex;flex-direction:column;}
.flex-wrapper{display:flex;flex-direction:row;position:relative;background:#4188fe;}
.flex-wrapper .goTo{width:75%;margin:10px auto 5px;}
.flex-wrapper .go,.flex-wrapper .to{height:42px;line-height:42px;display:flex;flex-direction:row-column;background:#699efe;margin-bottom:5px;border-radius: 5px;}
.flex-wrapper label{width:18%;font-size:14px;color:#dfdfdf;text-align:center;}
.flex-wrapper button{width:80%;height:42px;line-height:42px;color:#fff;font-size:15px;border:none;text-align:left;overflow: hidden;text-overflow:ellipsis;white-space: nowrap;background:transparent;padding:0 10px 0 0;margin:0}
.flex-wrapper button:after{border:none;}
.flex-wrapper .changePoint{width:24px;height:24px;position:absolute;left:10px;top:50%;margin-top:-12px;}
.flex-wrapper .submit{width:24px;height:24px;position:absolute;right:10px;top:50%;transform: translate(0,-50%)}
.flex-wrapper .animate{animation:top 0.3s linear;-webkit-animation:top 0.3s linear;}
@keyframes top{0%{transform:rotate(0deg);}50%{transform:rotate(180deg)}100%{transform:rotate(360deg);}}
@-webkit-keyframes top{0%{transform:rotate(0deg);}50%{transform:rotate(180deg)}100%{transform:rotate(360deg);}}
.flex-menu{width:100%;height:40px;display: flex;background:#4188fe;}
.flex-item{height: 36px; line-height: 36px;text-align: center;color:#dfdfdf;font-size:14px;flex: 1}
.flex-item.active{color:#fff;border-bottom:2px solid #fff;}
.flex-setUp{width:100%;display:flex;flex-direction: column;background:#fff;}
.flex-setUp .setUp-item{height:50px;line-height:50px;display: flex;flex-direction: row}
.flex-setUp .setUp-item image{width:18px;height:18px;margin:16px 8px;}
.flex-setUp .setUp-item .item{border-bottom:1px solid #eee;flex:1}
.flex-setUp .setUp-item .item label{font-size:15px;color:#333;}
.flex-setUp .setUp-item .item text{font-size:14px;color:#999;margin-left:6px;}
.flex-setUp .setUp-item .company{border:0}
.share{width:100%;background:#fff;height:50px;line-height:50px;display:flex;flex-direction: row;margin:5px 0;padding:0;}
.share image{width:22px;height:22px;margin:14px 6px;}
.share label{font-size:15px;color:#333;}
.share text{font-size:13px;color:#999;margin-left:6px;}
.history-wrapper{background:#fff;}
.hasHistory .history-place{display:flex;flex-direction:row-column;padding-top:15px;position:relative;}
.hasHistory .before-icon{width:18px;height:18px;position:absolute;top:50%;left:8px;transform: translate(0,-50%)}
.placeName{flex:1;border-bottom:1px solid #eee;vertical-align: top;padding:0 36px 15px 0;margin-left:34px;}
.placeName text{font-size:15px;color:#666;}
.placeName image{width:18px;height:18px;margin:0 5px;vertical-align: middle;}
.hasHistory .icon-route{width:20px;height:20px;position:absolute;top:50%;right:8px;transform: translate(0,-50%)}
.empty-history{height:50px;line-height:50px;font-size:15px;color:#999;text-align:center;}
.flex .tips{padding:50px 0 10px 0;font-size:13px;color:#ddd;text-align:center;background:#eee}
.flex .noHistory{width:100%;height:50px;line-height:50px;background:#fff;display:flex;flex-direction: row}
.flex .noHistory image{width:18px;height:18px;margin:16px 8px;}
.flex .noHistory text{line-height:50px;font-size:15px;color:#999;text-align:center;}

@ -0,0 +1,216 @@
// pages/near/near.js
const appData = getApp().globalData;
Page({
/**
* 页面的初始数据
*/
data: {
tips: [],
keywords:"",
page:0,
point:"",
siteName:'我的位置',
toBottom:false,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
//console.log(options)
wx.setNavigationBarTitle({
title: options.keywords
})
var that = this;
this.setData({
point: appData.mapInfo.longitude + "," + appData.mapInfo.latitude,
keywords: options.keywords
})
this.getDataFunc();
},
onReachBottom: function (e) {
this.getDataFunc();
},
getDataFunc: function(){
wx.showLoading({
title: '加载中',
})
var that = this
var loadData = this.data.tips
wx.request({
url: appData.mapApi + 'place/around',
data: {
key: 'e96f52f2aaa72ccfcddae396c0293794',
location: that.data.point,
keywords: that.data.keywords,
page: that.data.page + 1
},
success: function (res) {
wx.hideLoading()
if(res.data.count != 0){
for (var i = 0; i < res.data.pois.length; i++) {
loadData.push(res.data.pois[i])
}
that.setData({
tips: loadData,
page: that.data.page + 1
})
console.log(loadData)
}else{
that.setData({
toBottom:true
})
}
}
})
},
updatePoint: function(){
var that =this
wx.chooseLocation({
type: 'gcj02', // 返回可以用于wx.openLocation的经纬度
success(res) {
//console.log(res)
that.setData({
siteName:res.name,
point: res.longitude + ',' + res.latitude
})
wx.request({
url: appData.mapApi + 'place/around',
data: {
key: 'e96f52f2aaa72ccfcddae396c0293794',
location: that.data.point,
keywords: that.data.keywords,
page: 1
},
success: function (res) {
that.setData({
tips: res.data.pois,
page: 1
})
}
})
}
})
},
writeHistory:function(res){
var _num = res.currentTarget.dataset.num
var writeData = (this.data.tips)[_num]
var endImg = writeData.photos == "" ? "" : writeData.photos[0].url
if (appData.history != '') {
var part = [];
for (let i = 0; i < appData.history.length; i++) {
part.push(appData.history[i].endPoint)
}
if (part.indexOf(writeData.location) === -1) {
appData.history.unshift({
name: writeData.name,
img: endImg,
address: writeData.cityname + writeData.adname + writeData.address,
startPoint: this.data.point,
endPoint: writeData.location
})
}
} else {
appData.history.unshift({
name: writeData.name,
img: endImg,
address: writeData.cityname + writeData.adname + writeData.address,
startPoint: this.data.point,
endPoint: writeData.location
})
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
// onReachBottom: function () {
// },
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

@ -0,0 +1,5 @@
{
"navigationBarTitleText": "路线详情",
"backgroundColorBottom": "#eee",
"onReachBottomDistance": 0
}

@ -0,0 +1,43 @@
<!--pages/near/near.wxml-->
<view class="container">
<view class="flex" id="wrapper">
<view class="wrapper-search">
<text>在</text>
<button class="location" hover-class='none' bindtap='updatePoint'>{{siteName}}</button>
<text>中心附近搜索</text>
</view>
<view class="near-menu">
<view class="near-lis" wx:for="{{tips}}" wx:key="index" >
<navigator hover-class="none" url="../site/site?endName= {{tips[index].name}}&siteimg={{tips[index].photos[0].url}}&siteaddress={{tips[index].cityname}}{{tips[index].adname}}{{tips[index].address}}&startName={{siteName}}&startPoint={{point}}&endPoint={{tips[index].location}}" >
<image class="near-img" wx:if="{{ tips[index].photos != '' }}" src="{{tips[index].photos[0].url}}"></image>
<image class="near-img" wx:elif="{{ tips[index].photos == '' }}" src="../../image/nophoto.jpg"></image>
<view class="near-msg">
<text class="name">{{tips[index].name}}</text>
<text class="address">{{tips[index].cityname}}{{tips[index].adname}}{{tips[index].address}}</text>
<view class="distance">
<text>距</text>
<label>我的位置</label>
<text>{{tips[index].distance}}m</text>
</view>
<text class="rating" wx:if="{{ tips[index].biz_ext.rating != '' }}">{{tips[index].biz_ext.rating}}分</text>
<text class="rating" wx:elif="{{ tips[index].biz_ext.rating == '' }}">暂无评分</text>
<text class="tel">{{tips[index].tel}}</text>
</view>
</navigator>
<navigator hover-class="none" url="../route/route?startName={{siteName}}&startPoint={{point}}&endName= {{tips[index].name}}&endPoint={{tips[index].location}}&ways=0" >
<view class="near-goto" bindtap='writeHistory' data-num="{{index}}">
<image src="../../image/goto.png"></image>
<text class="goto">去这里</text>
</view>
</navigator>
</view>
</view>
<view class="toBottom" wx:if="{{toBottom}}">—— 我是有底线的 ——</view>
</view>
</view>

@ -0,0 +1,33 @@
/* pages/near/near.wxss */
.container{width:100%;height:100%;background:#eee;}
.flex{width:100%;display:flex;flex-direction:column}
.wrapper-search{width:100%;height:60px;background:#fff;border-bottom:5px solid #eee;}
.wrapper-search .location{width:150px;height:36px;line-height:36px;padding:0 10px;font-size:15px;background-color:#eee;margin:12px 0;border-radius: 5px;box-sizing:border-box;display:inline-block;border:none;text-align:left;color:#333;overflow: hidden;text-overflow:ellipsis;white-space: nowrap;}
.wrapper-search text{display:inline-block;line-height:60px;color:#666;font-size:16px;margin:0 10px;vertical-align: top}
.near-menu{width:100%;display: flex;flex-direction:column;}
.near-menu .near-lis{padding:0 10px;background:#fff;border-bottom:1px solid #ccc;box-sizing:border-box;position:relative;}
.near-menu .near-lis .near-img{width:80px;height:80px;position:absolute;top:10px;left:10px;}
.near-menu .near-lis .near-msg{width:60%;display: flex;flex-direction:column;padding:10px 0;margin-left:90px;}
.near-menu .near-msg>text{line-height:18px;color:#666;font-size:13px;}
.near-menu .near-msg .name{font-size:15px;color:#333;margin-bottom:5px;font-weight:bold}
.near-menu .near-msg .distance{height:20px;line-height:20px;color:#666;margin-top:5px;}
.near-menu .near-msg .distance label{width:60px;height:20px;line-height:20px;text-align:center;background:#eee;color:#666;margin:0 5px;font-size:12px;display:inline-block;vertical-align: top}
.near-menu .near-msg .distance text{font-size:12px;line-height:20px;display:inline-block;vertical-align: top}
.near-menu .near-msg .rating{color:red;font-size:12px;margin-top:3px;}
.near-menu .near-msg .tel{color:#666;font-size:12px;}
.near-menu .near-lis .near-goto{display: flex;flex-direction:column;position:absolute;top:50%;right:10px;transform: translate(0,-50%)}
.near-menu .near-lis .near-goto image{width:30px;height:30px;margin:0 auto;}
.near-menu .near-lis .near-goto text{font-size:13px;color:#4188fe;}
.toBottom{width:100%;height:30px;line-height:30px;color:#333;text-align:center;font-size:13px;background:#eee;}

@ -0,0 +1,631 @@
// pages/route/route.js
const amapFile = require('../../utils/amap-wx.js');
const myAmapFun = new amapFile.AMapWX({ key: 'eeef012afe4c956d0d38fd3a132fb267' });
const util = require('../../utils/util.js');
const appData = getApp().globalData;
const date = new Date();
const curYear = date.getFullYear()
const curMonth = date.getMonth()
const curDay = date.getDate()-1
const curHour = date.getHours()
const curMinute = date.getMinutes()
const years = [];
const months = [];
const days = [];
const hours = [];
const minutes = [];
//时间换算
function timeStamp(StatusMinute) {
var day = parseInt(StatusMinute / 60 / 24);
var hour = parseInt(StatusMinute / 60 % 24);
var min = parseInt(StatusMinute % 60);
StatusMinute = "";
if (day > 0) {
StatusMinute = day + "天";
}
if (hour > 0) {
StatusMinute += hour + "小时";
}
if (min > 0) {
StatusMinute += parseFloat(min) + "分钟";
}
return StatusMinute;
}
//获取年
for (let i = 2018; i <= date.getFullYear() + 5; i++) {
years.push("" + i + "年");
}
//获取月份
for (let i = 1; i <= 12; i++) {
if (i < 10) {
i = "0" + i;
}
months.push("" + i + "月");
}
//获取日期
for (let i = 1; i <= 31; i++) {
if (i < 10) {
i = "0" + i;
}
days.push("" + i + "日");
}
//获取小时
for (let i = 0; i < 24; i++) {
if (i < 10) {
i = "0" + i;
}
hours.push("" + i + "时");
}
//获取分钟
for (let i = 0; i < 60; i++) {
if (i < 10) {
i = "0" + i;
}
minutes.push("" + i + "分");
}
Page({
data: {
sendData:'',
toolData: [
{ tool: "驾车", way: "goToCar", post:"driving"},
{ tool: "公交", way: "goToBus", post: "transit/integrated"},
{ tool: "步行", way: "goToWalk", post: "walking" },
{ tool: "骑行", way: "goToRide", post: "bicycling" }
],
_num:0,
showbus:false,
markers: '',
threeRouteData:'',
transits: [],
polyline: [],
style:'',
hasBusRoute:true,
time: '现在出发',
recommend: "最快捷(推荐)",
dateArray: [years, months, days, hours, minutes],
dateIndex: [curYear, curMonth, curDay, curHour, curMinute],
recommedArray:['最快捷(推荐)','最经济','少换乘','少步行','不做地铁'],
recommedIndex:"0",
timeFilter:'',
strategyFilter:0,
},
onLoad: function (options) {
//console.log(options)
wx.showLoading({
title: '加载中',
})
var that = this
this.setData({
sendData: options,
markers: [{
iconPath: "../../image/startpoint.png",
id: 0,
latitude: options.startPoint.split(",")[1],
longitude: options.startPoint.split(",")[0],
width: 23,
height: 33
}, {
iconPath: "../../image/endpoint.png",
id: 0,
latitude: options.endPoint.split(",")[1],
longitude: options.endPoint.split(",")[0],
width: 24,
height: 34
}],
})
// 获取wxml文本数据
// wx.setNavigationBarTitle({
// title: e._relatedInfo.anchorRelatedText+'-路线'
// })
switch (parseInt(options.ways)) {
case 0:
that.goToCar();
break;
case 1:
that.goToBus();
break;
case 2:
that.goToWalk();
break;
case 3:
that.goToRide();
}
},
goDetail: function (e) {
var postTool = this.data.toolData[this.data._num].post;
wx.navigateTo({
url: '../detail/detail?post=' + postTool + '&origin=' + this.data.sendData.startPoint + '&destination=' + this.data.sendData.endPoint + '&startName=' + this.data.sendData.startName + '&sitename=' + this.data.sendData.endName + '&num=' + e.currentTarget.dataset.num + '&showbus=' + this.data.showbus
})
},
goToCar: function (e) {
wx.showLoading({
title: '加载中',
})
this.setData({
showbus: false,
_num: 0,
})
wx.setNavigationBarTitle({
title: '驾车-路线'
})
var that = this;
myAmapFun.getDrivingRoute({
origin: this.data.sendData.startPoint,
destination: this.data.sendData.endPoint,
success: function (data) {
wx.hideLoading()
var points = [];
if (data.paths && data.paths[0] && data.paths[0].steps) {
var steps = data.paths[0].steps;
for (var i = 0; i < steps.length; i++) {
var poLen = steps[i].polyline.split(';');
for (var j = 0; j < poLen.length; j++) {
points.push({
longitude: parseFloat(poLen[j].split(',')[0]),
latitude: parseFloat(poLen[j].split(',')[1])
})
}
}
}
data.paths[0].duration = timeStamp(parseInt(data.paths[0].duration / 60))
if (data.paths[0].distance < 1000) {
data.paths[0].distance = data.paths[0].distance + "米"
} else {
data.paths[0].distance = (data.paths[0].distance / 1000).toFixed(1) + "公里"
}
data.paths[0].taxi_cost = parseInt(data.taxi_cost)
that.setData({
style: '',
threeRouteData: data.paths[0],
polyline: [{
points: points,
color: "#4fba39",
width: 8,
arrowLine: true,
}]
});
},
fail: function (info) {
}
})
},
busRouteData: function ( date, time, strategy ){
wx.showLoading({
title: '加载中',
})
var that = this
myAmapFun.getTransitRoute({
origin: this.data.sendData.startPoint,
destination: this.data.sendData.endPoint,
city: appData.mapInfo.regeocodeData.addressComponent.province,
date: date,
time: time,
strategy: strategy,
success: function (data) {
wx.hideLoading()
//console.log(data.transits)
if (data.transits != '') {
var transits = data.transits;
for (var i = 0; i < transits.length; i++) {
var segments = transits[i].segments;
transits[i].transport = [];
for (var j = 0; j < segments.length; j++) {
if (segments[j].bus && segments[j].bus.buslines && segments[j].bus.buslines[0] && segments[j].bus.buslines[0].name) {
var name = segments[j].bus.buslines[0].name
if (j !== 0) {
name = '--' + name;
}
transits[i].transport.push(name);
}
}
if (transits[i].walking_distance < 1000) {
transits[i].walking_distance = transits[i].walking_distance + "米"
} else {
transits[i].walking_distance = (transits[i].walking_distance / 1000).toFixed(1) + "公里"
}
if (transits[i].distance < 1000) {
transits[i].distance = transits[i].distance + "米"
} else {
transits[i].distance = (transits[i].distance / 1000).toFixed(1) + "公里"
}
transits[i].cost = parseInt(transits[i].cost)
transits[i].duration = timeStamp(parseInt(transits[i].duration / 60))
for (var j = 0; j < transits[i].transport.length; j++) {
if (j > 0) {
transits[i].transport[j] = transits[i].transport[j].split('(')[0].substring(2)
} else {
transits[i].transport[j] = transits[i].transport[j].split('(')[0]
}
}
}
that.setData({
transits: transits,
hasBusRoute: true
});
}else{
that.setData({
hasBusRoute:false
})
}
},
fail: function (info) {
}
})
},
goToBus: function (e) {
this.setData({
showbus: true,
_num: 1,
})
wx.setNavigationBarTitle({
title: '公交-路线'
})
this.busRouteData(this.data.timeFilter[0], this.data.timeFilter[1],this.data.strategyFilter);
},
goToWalk: function (e) {
wx.showLoading({
title: '加载中',
})
wx.setNavigationBarTitle({
title: '步行-路线'
})
this.setData({
showbus: false,
_num: 2,
})
var that = this;
myAmapFun.getWalkingRoute({
origin: this.data.sendData.startPoint,
destination: this.data.sendData.endPoint,
success: function (data) {
wx.hideLoading()
var points = [];
if (data.paths && data.paths[0] && data.paths[0].steps) {
var steps = data.paths[0].steps;
for (var i = 0; i < steps.length; i++) {
var poLen = steps[i].polyline.split(';');
for (var j = 0; j < poLen.length; j++) {
points.push({
longitude: parseFloat(poLen[j].split(',')[0]),
latitude: parseFloat(poLen[j].split(',')[1])
})
}
}
}
data.paths[0].duration = timeStamp(parseInt(data.paths[0].duration / 60))
if (data.paths[0].distance < 1000) {
data.paths[0].distance = data.paths[0].distance + "米"
} else {
data.paths[0].distance = (data.paths[0].distance / 1000).toFixed(1) + "公里"
}
that.setData({
style:'18px auto',
threeRouteData: data.paths[0],
polyline: [{
points: points,
color: "#0091ff",
width: 8,
arrowLine: true,
}]
});
},
fail: function (info) {
}
})
},
goToRide: function (e) {
wx.showLoading({
title: '加载中',
})
wx.setNavigationBarTitle({
title: '骑行-路线'
})
this.setData({
showbus: false,
_num: 3,
})
var that = this;
myAmapFun.getRidingRoute({
origin: this.data.sendData.startPoint,
destination: this.data.sendData.endPoint,
success: function (data) {
wx.hideLoading()
var points = [];
if (data.paths && data.paths[0] && data.paths[0].steps) {
var steps = data.paths[0].steps;
for (var i = 0; i < steps.length; i++) {
var poLen = steps[i].polyline.split(';');
for (var j = 0; j < poLen.length; j++) {
points.push({
longitude: parseFloat(poLen[j].split(',')[0]),
latitude: parseFloat(poLen[j].split(',')[1])
})
}
}
}
data.paths[0].duration = timeStamp(parseInt(data.paths[0].duration / 60))
if (data.paths[0].distance < 1000) {
data.paths[0].distance = data.paths[0].distance + "米"
} else {
data.paths[0].distance = (data.paths[0].distance / 1000).toFixed(1) + "公里"
}
that.setData({
style: '18px auto',
threeRouteData: data.paths[0],
polyline: [{
points: points,
color: "#44adfc",
width: 8,
arrowLine: true,
}]
});
},
fail: function (info) {
}
})
},
//获取时间日期
bindDateChange: function (e) {
this.setData({
dateIndex: e.detail.value
})
const index = this.data.dateIndex;
const year = parseInt(this.data.dateArray[0][index[0]]);
const month = parseInt(this.data.dateArray[1][index[1]]);
const day = parseInt(this.data.dateArray[2][index[2]]);
const hour = parseInt(this.data.dateArray[3][index[3]]);
const minute = parseInt(this.data.dateArray[4][index[4]]);
var Aminute = '';
if (minute < 10) {
Aminute = "0" + minute;
}else{
Aminute = minute;
}
this.setData({
time: year + '/' + month + '/' + day + ' ' + hour + ':' + Aminute,
timeFilter: [year + '-' + month + '-' + day, hour + ':' + Aminute]
})
this.busRouteData(this.data.timeFilter[0], this.data.timeFilter[1], this.data.strategyFilter);
},
//获取推荐路线
bindRecommedChange:function(e){
const index = e.detail.value
const curRecommend = this.data.recommedArray
if(index == 4){
index == 5
this.setData({
recommendIndex: e.detail.value,
recommend: curRecommend[index],
strategyFilter: index
})
}else{
this.setData({
recommendIndex: e.detail.value,
recommend: curRecommend[index],
strategyFilter: index
})
}
this.busRouteData(this.data.timeFilter[0], this.data.timeFilter[1], this.data.strategyFilter);
},
chooseStartPoint: function(){
var that = this
wx.chooseLocation({
type: 'gcj02', // 返回可以用于wx.openLocation的经纬度
success(res) {
if(res.name != ''){
that.setData({
sendData: {
startName: res.name,
startPoint: res.longitude + ',' + res.latitude,
endName: that.data.sendData.endName,
endPoint: that.data.sendData.endPoint
},
markers: [{
iconPath: "../../image/startpoint.png",
id: 0,
latitude: res.latitude,
longitude: res.longitude,
width: 23,
height: 33
}, {
iconPath: "../../image/endpoint.png",
id: 0,
latitude: that.data.sendData.endPoint.split(",")[1],
longitude: that.data.sendData.endPoint.split(",")[0],
width: 24,
height: 34
}],
})
}else{
wx.showToast({
title: '请选择正确的地址',
icon: 'none',
duration: 1500
})
}
switch (that.data._num) {
case 0:
that.goToCar();
break;
case 1:
that.goToBus();
break;
case 2:
that.goToWalk();
break;
case 3:
that.goToRide();
}
}
})
},
chooseEndPoint: function(){
var that = this
wx.chooseLocation({
type: 'gcj02', // 返回可以用于wx.openLocation的经纬度
success(res) {
if (res.name != '') {
that.setData({
sendData: {
startName: that.data.sendData.startName,
startPoint: that.data.sendData.startPoint,
endName: res.name,
endPoint: res.longitude + ',' + res.latitude,
},
markers: [{
iconPath: "../../image/startpoint.png",
id: 0,
latitude: that.data.sendData.startPoint.split(",")[1],
longitude: that.data.sendData.startPoint.split(",")[0],
width: 23,
height: 33
}, {
iconPath: "../../image/endpoint.png",
id: 0,
latitude: res.latitude,
longitude: res.longitude,
width: 24,
height: 34
}],
})
}else{
wx.showToast({
title: '请选择正确的地址',
icon: 'none',
duration: 1500
})
}
switch (that.data._num) {
case 0:
that.goToCar();
break;
case 1:
that.goToBus();
break;
case 2:
that.goToWalk();
break;
case 3:
that.goToRide();
}
}
})
}
})

@ -0,0 +1,4 @@
{
"backgroundColorTop": "#4188fe",
"backgroundColorBottom":"#fff"
}

@ -0,0 +1,93 @@
<!--pages/route/route.wxml-->
<view class="container">
<view class="route-head">
<button class="start" bindtap='chooseStartPoint'>{{sendData.startName}}</button>
<image src="../../image/arrow.png"></image>
<button class="end" bindtap='chooseEndPoint'>{{sendData.endName}}</button>
</view>
<view class="flex-select">
<view wx:for="{{toolData}}" wx:key="index" class="flex-item {{index == _num ? 'active' : ''}}" data-num="{{index}}" bindtap="{{toolData[index].way}}">{{toolData[index].tool}}</view>
</view>
<view class="busroute" wx:if="{{ showbus }}">
<view class="route-select">
<view class="date">
<picker mode="multiSelector" bindchange="bindDateChange" value="{{dateIndex}}" range="{{dateArray}}">
<text>{{time}}</text>
</picker>
</view>
<view class="recommend">
<picker mode="selector" bindchange="bindRecommedChange" value="{{recommedIndex}}" range="{{recommedArray}}">
<text>{{recommend}}</text>
</picker>
</view>
</view>
<view class="busplan" >
<view class="busplan-lis" wx:for="{{transits}}" wx:key="index" data-num="{{index}}" bindtap='goDetail' wx:if="{{hasBusRoute == true}}">
<view class="lis-left">
<view wx:if = "{{index < 1}}" class="good"><text>最佳</text></view>
<text>{{transits[index].duration}}</text>
<text>步行{{transits[index].walking_distance}}</text>
</view>
<view class="lis-right">
<view class="routeline">
<text class="line-first">{{transits[index].transport[0]}}</text>
<view class="line-over" wx:for="{{transits[index].transport}}" wx:key="index" wx:for-item="items" wx:if = "{{index > 0}}">
<image src="../../image/arrow0.png"></image>
<text>{{items}}</text>
</view>
</view>
<view class="routeother">
<text>22站 · </text>
<text>{{transits[index].cost}}元 · </text>
<text>{{transits[index].distance}}</text>
</view>
</view>
</view>
<view class="noBusRoute" wx:if="{{hasBusRoute == false}}">暂无推荐路线</view>
</view>
</view>
<view wx:else>
<view class="map_box">
<map style="width:100%;height:100%" id="navi_map" markers="{{markers}}" include-points="{{polyline[0].points}}" polyline="{{polyline}}" ></map>
</view>
<view class="route_box">
<view class="box-top" style="margin:{{style}}">
<text>{{threeRouteData.duration}}</text>
<text>{{threeRouteData.distance}}</text>
</view>
<view class="box-bottom" wx:if="{{threeRouteData.traffic_lights}}">
<text class="good">推荐</text>
<text>打车约{{threeRouteData.taxi_cost}}元</text>
<text>红绿灯{{threeRouteData.traffic_lights}}个</text>
</view>
<view class="toDetail" bindtap='goDetail'>路线详情</view>
</view>
</view>
</view>

@ -0,0 +1,57 @@
/* pages/route/route.wxss */
.container .route-head{width:100%;height:50px;display:flex;background:#4188fe;}
.container .route-head button{width:200px;height:30px;line-height:30px;background:#699efe;border:none;margin:9px 0;color:#eee;font-size:14px;text-align:left;overflow: hidden;text-overflow:ellipsis;white-space: nowrap;padding-left:10px;}
.container .route-head image{width:30px;height:30px;margin:10px auto;}
.container .route-head .start{float:left;margin-left:15px;}
.container .route-head .end{float:right;margin-right:15px;}
.flex-select{width:100%;height:40px;display: flex;background:#4188fe;}
.flex-item{height: 36px; line-height: 36px;text-align: center;color:#dfdfdf;font-size:14px;flex: 1}
.flex-item.active{color:#fff;border-bottom:2px solid #fff;}
.map_box{position:absolute;top: 90px;bottom: 80px;left: 0px;right: 0px;}
.route_box{position:absolute;height: 80px;bottom: 0px;left: 0px;right: 0px;}
.route_box{padding:10px;box-sizing:border-box;flex:1}
.route_box .box-top text{font-size:16px;color:#333;margin-right:8px;font-weight:bold;}
.route_box .box-bottom text{font-size:14px;color:#666;margin-right:8px;}
.route_box .box-bottom .good{color:#5fc095;font-size:15px;border-right:1px solid #ccc;padding-right:10px;}
.toDetail{height:30px;line-height:30px;font-size:16px;position:absolute;bottom: 20px;right: 10px;padding:5px 10px;color: #fff;background: #0091ff;text-align:center;border-radius:5px;}
.busroute{width:100%;}
.busroute .route-select{width:100%;height:50px;border-bottom:8px solid #eee;flex:1;}
.busroute .date{width:50%;height:50px;float:left;text-align:center;}
.busroute .date text{line-height:50px;font-size:16px;color:#333;}
.busroute .date text:after{content:'';display: inline-block; width: 6px; height: 6px; border-right: 2px solid #999; border-top: 2px solid #999; -webkit-transform: rotate(135deg); transform: rotate(135deg); cursor:pointer;margin:-3px 0 0 8px;vertical-align: middle;}
.busroute .recommend{width:50%;height:50px;float:right;text-align:center;}
.busroute .recommend text{line-height:50px;font-size:16px;color:#333;}
.busroute .recommend text:after{content:'';display: inline-block; width: 6px; height: 6px; border-right: 2px solid #999; border-top: 2px solid #999; -webkit-transform: rotate(135deg); transform: rotate(135deg); cursor:pointer;margin:-3px 0 0 8px;vertical-align: middle;}
.busplan .busplan-lis{padding:10px 0;overflow:auto;border-bottom:1px solid #eee}
.busplan-lis .lis-left{width:30%;display:flex;flex-direction: column;text-align:right;padding-right:10px;float:left;padding:0 10px;box-sizing: border-box;}
.busplan-lis .lis-left text{margin:2px 0;font-size:13px;color:#333}
.busplan-lis .lis-left .good text{width:30px;padding:1px 2px;background:#5fc095;color:#fff;float:right;text-align:center;border-radius: 2px;}
.busplan-lis .lis-right{width:70%;padding-left:10px;float:right;padding:0 10px;box-sizing: border-box;border-left:1px solid #ccc;}
.busplan-lis .lis-right .routeline{line-height:20px;}
.busplan-lis .lis-right .routeline text{height:24px;line-height:24px;font-size:15px;color:#333;background:#ccc;padding:0 5px;font-weight:bold;border-radius:3px;vertical-align: top;display:inline-block;margin-top:3px;}
.busplan-lis .lis-right .routeline .line-over{display:inline-block;}
.busplan-lis .lis-right .routeline image{width:14px;height:14px;margin:8px 5px;}
.busplan-lis .lis-right .routeother{height:24px;line-height:24px;margin-top:5px;}
.busplan-lis .lis-right .routeother text{font-size:13px;color:#333;vertical-align: middle;}
.noBusRoute{font-size:16px;color:#666;margin-top:20px;text-align:center;}

@ -0,0 +1,206 @@
// pages/search/search.js
const appData = getApp().globalData;
Page({
/**
* 页面的初始数据
*/
data: {
tips:"",
keywords:"",
hasInput:true,
hasHistory:true,
historyData:'',
menu: [
{ nameEn: "food", nameCn: "美食" },
{ nameEn: "hotel", nameCn: "酒店" },
{ nameEn: "spot", nameCn: "景点" },
{ nameEn: "bank", nameCn: "银行" },
{ nameEn: "movie", nameCn: "电影院" },
{ nameEn: "metro", nameCn: "地铁" },
{ nameEn: "transit", nameCn: "公交" },
{ nameEn: "supermarket", nameCn: "超市" },
{ nameEn: "bathing", nameCn: "洗浴" },
{ nameEn: "more", nameCn: "更多" }
],
location:'',
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
bindInput: function (e) {
var that = this;
var keywords = e.detail.value;
if (keywords != ""){
wx.request({
url: appData.mapApi + "place/around?key=e96f52f2aaa72ccfcddae396c0293794&keywords=" + keywords + "&location=" + appData.mapInfo.latitude + "," + appData.mapInfo.longitude,
success: function (data) {
var points=[];
for (var i = 0; i < data.data.pois.length;i++){
points.push({
longitude: data.data.pois[i].location.split(",")[0],
latitude: data.data.pois[i].location.split(",")[1]
})
data.data.pois[i].location = points[i]
}
that.setData({
tips: data.data.pois,
keywords: keywords,
hasInput: false,
})
}
})
}else{
setTimeout(function () {
that.setData({
keywords:"",
tips: "",
hasInput:true,
})
}, 500);
}
},
bindSubmit: function () {
if (this.data.keywords != ''){
wx.navigateTo({
url: '../nearby/nearby?keywords=' + this.data.keywords,
})
if (appData.history.indexOf(this.data.keywords) === -1 ){
appData.history.unshift(this.data.keywords)
}
}else{
wx.showToast({
title: '搜索字段不能为空',
icon: 'none',
duration: 1500
})
}
},
emptyHistory: function(){
var that = this
wx.showModal({
title: '提示',
content: '是否清空历史纪录',
success(res) {
if (res.confirm) {
that.setData({
historyData:'',
hasHistory:false
})
appData.history = [];
} else if (res.cancel) {
}
}
})
},
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
if (appData.history != '') {
this.setData({
hasHistory: true,
})
} else {
this.setData({
hasHistory: false,
})
}
this.setData({
location: appData.mapInfo.longitude + "," + appData.mapInfo.latitude,
historyData: appData.history
})
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
return {
title: '导航lite地图导航、路线导航、公交地铁换乘方案',
path: '/pages/index/index',
success: function (res) {
// 转发成功
wx.showToast({
title: '分享成功',
icon: 'success',
duration: 1000
})
},
fail: function (res) {
// 转发失败
wx.showToast({
title: '分享取消',
icon: 'success',
duration: 1000
})
}
}
}
})

@ -0,0 +1,4 @@
{
"navigationBarTitleText": "搜索附近",
"backgroundColorBottom": "#eee"
}

@ -0,0 +1,89 @@
<!--pages/search/search.wxml-->
<view class="container">
<view class="flex">
<view class="wrapper-search">
<input placeholder="在”我的位置“附近搜索" class="search" bindinput="bindInput" />
<text bindtap='bindSubmit'>搜索</text>
</view>
<view class="wrapper-menu">
<view class="wrapper-lis" wx:for="{{tips}}" wx:key="index">
<navigator hover-class="none" url="../site/site?endName= {{tips[index].name}}&siteimg={{tips[index].photos[0].url}}&siteaddress={{tips[index].cityname}}{{tips[index].adname}}{{tips[index].address}}&endPoint={{tips[index].location.longitude}},{{tips[index].location.latitude}}&startPoint={{location}}&startName=我的位置" >
<view class="map-msg" >
<text class="name">{{tips[index].name}}</text>
<text class="address">{{tips[index].cityname}}{{tips[index].adname}}{{tips[index].address}}</text>
<text class="distance">{{tips[index].distance}}m</text>
</view>
</navigator>
<view class="map-goto">
<image src="../../image/goto.png"></image>
<text class="goto">去这里</text>
</view>
</view>
</view>
<block wx:if="{{ hasInput }}">
<view class="flex-content">
<view class="jump-menu">
<view class="jump-wrapper" wx:for="{{menu}}" wx:key="index" wx:for-item="i">
<navigator hover-class="none" url="../nearby/nearby?keywords= {{ i.nameCn }}" >
<view class="jump-lis">
<image src="../../image/{{i.nameEn}}.jpg"></image>
<text>{{i.nameCn}}</text>
</view>
</navigator>
</view>
</view>
<button open-type='share' class="share" >
<image src="../../image/share.png"></image>
<label>分享</label>
<text>把导航lite分享给好友</text>
</button>
<view wx:if="{{ hasHistory != '' }}" class="history-wrapper">
<view class="hasHistory" wx:for="{{historyData}}" wx:key="{{index}}" wx:for-item="item">
<navigator wx:if="{{historyData[index].name}}" hover-class="none" url="../site/site?endName= {{historyData[index].name}}&siteimg={{historyData[index].img}}&siteaddress={{historyData[index].address}}&endPoint={{historyData[index].endPoint}}&startPoint={{historyData[index].startPoint}}&startName=我的位置">
<view class="history-place" >
<image src="../../image/lishi.png" class="before-icon"></image>
<view class="place-left">
<text>{{historyData[index].name}}</text>
<text>{{historyData[index].address}}</text>
</view>
<view class="place-right">
<image src="../../image/goto.png"></image>
<text>去这里</text>
</view>
</view>
</navigator>
<navigator hover-class="none" url="../nearby/nearby?keywords={{ historyData[index] }}" wx:else>
<view class="history-area">
<image src="../../image/lishi.png" class="before-icon"></image>
<view class="area-left">
<text>{{ historyData[index] }}</text>
</view>
<view class="area-right">
<image src="../../image/fangda.png"></image>
</view>
</view>
</navigator>
</view>
<view class="empty-history" bindtap='emptyHistory'>
清空历史纪录
</view>
</view>
<view class="noHistory" wx:else>
<image src="../../image/gantan.png"></image>
<text>无历史纪录</text>
</view>
<view class="tips">数据来源,高德地图开放平台,腾讯地图开放平台</view>
</view>
</block>
</view>
</view>

@ -0,0 +1,63 @@
/* pages/search/search.wxss */
.container{width:100%;height:100%;background:#eee;position:absolute;top:0;bottom:0;left:0;right:0}
.flex{width:100%;display:flex;flex-direction:column;}
.wrapper-search{width:100%;height:60px;background:#fff;border-bottom:5px solid #eee;}
.wrapper-search .search{width:80%;height:42px;line-height:42px;padding:0 10px;font-size:15px;float:left;background:#f0f0f0;margin:9px 0 9px 12px;border-radius: 5px;box-sizing:border-box}
.wrapper-search text{width:16%;float:right;text-align:center;line-height:60px;color:#666;font-size:18px;}
.wrapper-menu{width:100%;display: flex;flex-direction:column;}
.wrapper-lis{width:100%;padding:0 10px;background:#fff;border-bottom:1px solid #ccc;box-sizing:border-box;position:relative;}
.wrapper-menu .map-msg{width:80%;display: flex;flex-direction:column;padding:10px 0;float:left;}
.wrapper-menu .map-msg text{line-height:20px;color:#666;font-size:13px;}
.wrapper-menu .map-msg .name{font-size:15px;color:#333;margin-bottom:5px;font-weight:bold}
.wrapper-menu .map-goto{display: flex;flex-direction:column;float:right;position:absolute;top:50%;right:10px;transform: translate(0,-50%)}
.wrapper-menu .map-goto image{width:30px;height:30px;margin:0 auto;}
.wrapper-menu .map-goto text{font-size:13px;color:#4188fe;}
.jump-menu{width:100%;height:200px;padding:10px 10px;box-sizing: border-box;background:#fff;border-bottom:5px solid #eee;}
.jump-menu .jump-lis{width:20%;float:left;display:flex;flex-direction: column;}
.jump-menu .jump-lis image{width:45px;height:45px;margin:10px auto 0;}
.jump-menu .jump-lis text{text-align:center;font-size:15px;margin-top:5px;}
.share{width:100%;background:#fff;height:50px;line-height:50px;display:flex;flex-direction: row;margin-bottom:5px;padding:0;}
.share image{width:22px;height:22px;margin:14px 6px;}
.share label{font-size:15px;color:#333;}
.share text{font-size:13px;color:#999;margin-left:6px;}
.history-wrapper{background:#fff;}
.hasHistory .history-place{position:relative;display:flex;flex-direction:column;padding-top:15px;}
.hasHistory .before-icon{width:18px;height:18px;position:absolute;left:8px;top:50%;transform: translate(0,-50%);}
.place-left{display: flex;flex-direction:column;margin-left:36px;border-bottom:1px solid #dfdfdf;padding-bottom:15px;}
.place-left text{width:80%;display:inline-block;}
.place-left text:nth-child(1){font-size:15px;color:#333;margin-bottom:2px;}
.place-left text:nth-child(2){font-size:13px;color:#999;}
.place-right{display: flex;flex-direction:column;float:right;position:absolute;top:50%;right:10px;transform: translate(0,-50%)}
.place-right image{width:30px;height:30px;margin:0 auto;}
.place-right text{font-size:13px;color:#4188fe;}
.history-area{position:relative;display:flex;flex-direction:column;padding-top:10px;}
.history-area .area-left{margin-left:36px;border-bottom:1px solid #dfdfdf;padding-bottom:15px;}
.history-area .area-left text{width:80%;display:inline-block;font-size:15px;color:#333;}
.history-area .area-right{position:absolute;top:50%;right:15px;transform: translate(0,-50%)}
.history-area .area-right image{width:24px;height:24px;margin:0 auto;}
.empty-history{height:50px;line-height:50px;font-size:15px;color:#999;text-align:center;}
.flex-content .tips{padding:50px 0 10px 0;font-size:13px;color:#ddd;text-align:center;background:#eee}
.noHistory{width:100%;height:50px;line-height:50px;background:#fff;display:flex;flex-direction: row}
.noHistory image{width:18px;height:18px;margin:16px 8px;}
.noHistory text{line-height:50px;font-size:15px;color:#999;text-align:center;}

@ -0,0 +1,148 @@
// pages/site/site.js
const appData = getApp().globalData;
Page({
/**
* 页面的初始数据
*/
data: {
siteData:"",
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
console.log(options)
this.setData({
siteData: options
})
wx.setNavigationBarTitle({
title: options.endName
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
returnIndex:function(){
wx.reLaunch({
url: '../index/index',
});
},
writeHistory: function(){
//历史纪录
if (appData.history != ''){
var part = [];
for (let i = 0; i < appData.history.length; i++) {
part.push(appData.history[i].endPoint)
}
if (part.indexOf(this.data.siteData.endPoint) === -1) {
appData.history.unshift({
name: this.data.siteData.endName,
img: this.data.siteData.siteimg,
address: this.data.siteData.siteaddress,
startPoint: this.data.siteData.startPoint,
endPoint: this.data.siteData.endPoint
})
}
}else{
appData.history.unshift({
name: this.data.siteData.endName,
img: this.data.siteData.siteimg,
address: this.data.siteData.siteaddress,
startPoint: this.data.siteData.startPoint,
endPoint: this.data.siteData.endPoint
})
}
},
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function (res) {
if (res.from === 'button') {
// 来自页面内转发按钮
console.log(res.target)
}
return {
title: '导航lite地图导航、路线导航、公交地铁换乘方案',
path: '/pages/index/index',
success: function (res) {
// 转发成功
wx.showToast({
title: '分享成功',
icon: 'success',
duration: 1000
})
},
fail: function (res) {
// 转发失败
wx.showToast({
title: '分享取消',
icon: 'success',
duration: 1000
})
}
}
}
})

@ -0,0 +1,21 @@
<!--pages/site/site.wxml-->
<view class="container">
<view class="tips">
<text>数据略有偏差,请以实际情况为主</text>
</view>
<image wx:if="{{siteData.siteimg == ''}}" src="../../image/nophoto.jpg"></image>
<image wx:elif="{{siteData.siteimg != ''}}" src="{{siteData.siteimg}}"></image>
<text class="site-name">{{siteData.endName}}</text>
<text class="site-address">{{siteData.siteaddress}}</text>
<navigator hover-class="none" url="../route/route?startName={{siteData.startName}}&startPoint={{siteData.startPoint}}&endName={{siteData.endName}}&endPoint={{siteData.endPoint}}&ways=0" >
<button class="goto" bindtap='writeHistory'>去这里</button>
</navigator>
<view class="site-foot">
<button class="share" open-type='share' hover-class="none">分享地点给好友</button>
<text class="return" bindtap='returnIndex' hover-class="none" plain="ture" loading="ture">返回首页</text>
</view>
</view>

@ -0,0 +1,21 @@
/* pages/site/site.wxss */
.container{width:100%;display:flex;flex-direction:column}
.container .tips{width:100%;}
.container .tips text{color:#999;font-size:12px;margin:10px 0;background:#eee;padding:3px 8px;border-radius: 3px;float:left;}
.container image{width:100px;height:100px;margin:10px auto 30px;border-radius:5px;}
.container .site-name{color:#333;font-size:16px;text-align:center;}
.container .site-address{color:#666;font-size:14px;text-align:center;margin-top:5px;padding:0 20px}
.container navigator{width:100%;}
.container .goto{width:80%;height:42px;line-height:42px;border-radius: 5px;color:#4188fe;border:1px solid #4188fe;text-align:center;background:#fff;margin:50px auto 15px;font-size:16px;}
.container .site-foot{width:100%;display: flex;}
.container .site-foot .share{width:60%;line-height:20px;float:left;border: none;background:#fff;text-align:right;padding-right:15px;box-sizing: border-box;font-size:16px;color:#333;}
.container .site-foot .share::after{border: none;}
.container .site-foot .return{width:40%;line-height:20px;float:right;text-align:left;padding-left:15px;box-sizing: border-box;border-left:1px solid #ccc;font-size:16px;color:#333;display:inline-block;}

@ -0,0 +1,33 @@
{
"description": "项目配置文件。",
"setting": {
"urlCheck": true,
"es6": true,
"postcss": true,
"minified": true,
"newFeature": true,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"coverView": false,
"enhance": false,
"showShadowRootInWxmlPanel": false,
"packNpmRelationList": [],
"ignoreUploadUnusedFiles": true,
"condition": false
},
"compileType": "miniprogram",
"condition": {},
"editorSetting": {
"tabIndent": "insertSpaces",
"tabSize": 2
},
"libVersion": "3.1.2",
"packOptions": {
"ignore": [],
"include": []
},
"appid": "wx6972d34f565f8801"
}

@ -0,0 +1,7 @@
{
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"projectname": "navigation",
"setting": {
"compileHotReLoad": true
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

@ -0,0 +1,4 @@
(function(config){(function(a,b){function c(a){var c=b.createElement("script");c.charset="utf-8";c.src=a;c.id="amap_main_js";(a=h||k)&&a.appendChild(c)}function d(){var a=["v="+config[4],"key="+config[0],"cache=0"];config[7]&&a.push("plugin="+config[7]);config[5]&&a.push("callback="+config[5]);for(var d=config[2]+"/maps?"+a.join("&"),a=config[2].split(",")[0],e=b.getElementsByTagName("script"),f,k=0;k<e.length;k+=1)if(0===e[k].src.indexOf(a.split(":")[1]+"/maps?")){f=e[k];break}config[5]||f&&f.async?c(d):(b.write('<script crossorigin="anonymous" id="amap_main_js" src="'+
d+'" type="text/javascript">\x3c/script>'),setTimeout(function(){b.getElementById("amap_main_js")||c(d)},1))}function e(){for(var a in localStorage)localStorage.hasOwnProperty(a)&&0===a.indexOf("_AMap_")&&localStorage.removeItem(a)}var f=function(){var a=!1;try{var b=(new Date).getTime();localStorage.setItem("_test",b);localStorage.getItem("_test")==b&&(a=!0)}catch(c){}return a}(),h=b.head||b.getElementsByTagName("head")[0],k=b.body||b.getElementsByTagName("body")[0];if(f)try{var l=JSON.parse(localStorage.getItem("_AMap_raster"));
if(l&&"1546588221391"===l.version)config.DB=!0,eval(l.script);else throw e(),Error("localStorage's version is "+l.version+", but the latest version is 1546588221391");}catch(m){d()}else d()})(window,document);
})(["4db2a9b3dbd090255e5f19683bd98601",[120.856804,30.675593,122.247149,31.872716,121.472644,31.231706],"https://webapi.amap.com",1,"1.4.12",null,"310000","",true,true,true,true,"1546954489-1"])

File diff suppressed because one or more lines are too long

@ -0,0 +1,19 @@
const formatTime = date => {
const year = date.getFullYear()
const month = date.getMonth() + 1
const day = date.getDate()
const hour = date.getHours()
const minute = date.getMinutes()
const second = date.getSeconds()
return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':')
}
const formatNumber = n => {
n = n.toString()
return n[1] ? n : '0' + n
}
module.exports = {
formatTime: formatTime
}
Loading…
Cancel
Save