diff --git a/wx_navigationLite-master/LICENSE b/wx_navigationLite-master/LICENSE new file mode 100644 index 0000000..f7a2cae --- /dev/null +++ b/wx_navigationLite-master/LICENSE @@ -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. diff --git a/wx_navigationLite-master/README.md b/wx_navigationLite-master/README.md new file mode 100644 index 0000000..2f1df11 --- /dev/null +++ b/wx_navigationLite-master/README.md @@ -0,0 +1,29 @@ +## 导航lite +地图导航、路线导航、公交地铁换乘方案 + + +#### 效果截图 + + + + + + + + + + + +#### 安装与运行 + +``` bash +安装微信开发者工具。 把项目下载到本地。 在微信开发者工具中打开该项目即可预览。 +``` + + +#### 在线访问 + + + +#### 鼠标右上角star,谢谢! + diff --git a/wx_navigationLite-master/app.js b/wx_navigationLite-master/app.js new file mode 100644 index 0000000..bd32a09 --- /dev/null +++ b/wx_navigationLite-master/app.js @@ -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: '', + }, + } +}) \ No newline at end of file diff --git a/wx_navigationLite-master/app.json b/wx_navigationLite-master/app.json new file mode 100644 index 0000000..d9df514 --- /dev/null +++ b/wx_navigationLite-master/app.json @@ -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" + ] +} diff --git a/wx_navigationLite-master/app.wxss b/wx_navigationLite-master/app.wxss new file mode 100644 index 0000000..fdea17b --- /dev/null +++ b/wx_navigationLite-master/app.wxss @@ -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; +} diff --git a/wx_navigationLite-master/image/admin.jpg b/wx_navigationLite-master/image/admin.jpg new file mode 100644 index 0000000..3c9f687 Binary files /dev/null and b/wx_navigationLite-master/image/admin.jpg differ diff --git a/wx_navigationLite-master/image/admin.png b/wx_navigationLite-master/image/admin.png new file mode 100644 index 0000000..8582bcf Binary files /dev/null and b/wx_navigationLite-master/image/admin.png differ diff --git a/wx_navigationLite-master/image/arrow.png b/wx_navigationLite-master/image/arrow.png new file mode 100644 index 0000000..8928b16 Binary files /dev/null and b/wx_navigationLite-master/image/arrow.png differ diff --git a/wx_navigationLite-master/image/arrow0.png b/wx_navigationLite-master/image/arrow0.png new file mode 100644 index 0000000..ba71d7f Binary files /dev/null and b/wx_navigationLite-master/image/arrow0.png differ diff --git a/wx_navigationLite-master/image/arrow1.png b/wx_navigationLite-master/image/arrow1.png new file mode 100644 index 0000000..6955cd2 Binary files /dev/null and b/wx_navigationLite-master/image/arrow1.png differ diff --git a/wx_navigationLite-master/image/bank.jpg b/wx_navigationLite-master/image/bank.jpg new file mode 100644 index 0000000..9603e7f Binary files /dev/null and b/wx_navigationLite-master/image/bank.jpg differ diff --git a/wx_navigationLite-master/image/bathing.jpg b/wx_navigationLite-master/image/bathing.jpg new file mode 100644 index 0000000..f9ff9d3 Binary files /dev/null and b/wx_navigationLite-master/image/bathing.jpg differ diff --git a/wx_navigationLite-master/image/company.png b/wx_navigationLite-master/image/company.png new file mode 100644 index 0000000..49ff233 Binary files /dev/null and b/wx_navigationLite-master/image/company.png differ diff --git a/wx_navigationLite-master/image/drive.png b/wx_navigationLite-master/image/drive.png new file mode 100644 index 0000000..8f7c30b Binary files /dev/null and b/wx_navigationLite-master/image/drive.png differ diff --git a/wx_navigationLite-master/image/endpoint.png b/wx_navigationLite-master/image/endpoint.png new file mode 100644 index 0000000..4b9ed6c Binary files /dev/null and b/wx_navigationLite-master/image/endpoint.png differ diff --git a/wx_navigationLite-master/image/endpoint0.png b/wx_navigationLite-master/image/endpoint0.png new file mode 100644 index 0000000..54dc1ad Binary files /dev/null and b/wx_navigationLite-master/image/endpoint0.png differ diff --git a/wx_navigationLite-master/image/exchange.png b/wx_navigationLite-master/image/exchange.png new file mode 100644 index 0000000..fc4b80b Binary files /dev/null and b/wx_navigationLite-master/image/exchange.png differ diff --git a/wx_navigationLite-master/image/fangda.png b/wx_navigationLite-master/image/fangda.png new file mode 100644 index 0000000..e668586 Binary files /dev/null and b/wx_navigationLite-master/image/fangda.png differ diff --git a/wx_navigationLite-master/image/flower.png b/wx_navigationLite-master/image/flower.png new file mode 100644 index 0000000..f7c5186 Binary files /dev/null and b/wx_navigationLite-master/image/flower.png differ diff --git a/wx_navigationLite-master/image/food.jpg b/wx_navigationLite-master/image/food.jpg new file mode 100644 index 0000000..01903cd Binary files /dev/null and b/wx_navigationLite-master/image/food.jpg differ diff --git a/wx_navigationLite-master/image/gantan.png b/wx_navigationLite-master/image/gantan.png new file mode 100644 index 0000000..6a9f907 Binary files /dev/null and b/wx_navigationLite-master/image/gantan.png differ diff --git a/wx_navigationLite-master/image/goto.png b/wx_navigationLite-master/image/goto.png new file mode 100644 index 0000000..09347d9 Binary files /dev/null and b/wx_navigationLite-master/image/goto.png differ diff --git a/wx_navigationLite-master/image/home.png b/wx_navigationLite-master/image/home.png new file mode 100644 index 0000000..142b7c6 Binary files /dev/null and b/wx_navigationLite-master/image/home.png differ diff --git a/wx_navigationLite-master/image/hotel.jpg b/wx_navigationLite-master/image/hotel.jpg new file mode 100644 index 0000000..4eb304c Binary files /dev/null and b/wx_navigationLite-master/image/hotel.jpg differ diff --git a/wx_navigationLite-master/image/lishi.png b/wx_navigationLite-master/image/lishi.png new file mode 100644 index 0000000..8488af9 Binary files /dev/null and b/wx_navigationLite-master/image/lishi.png differ diff --git a/wx_navigationLite-master/image/loadline.png b/wx_navigationLite-master/image/loadline.png new file mode 100644 index 0000000..b8fae26 Binary files /dev/null and b/wx_navigationLite-master/image/loadline.png differ diff --git a/wx_navigationLite-master/image/location.png b/wx_navigationLite-master/image/location.png new file mode 100644 index 0000000..b9e731e Binary files /dev/null and b/wx_navigationLite-master/image/location.png differ diff --git a/wx_navigationLite-master/image/logo.png b/wx_navigationLite-master/image/logo.png new file mode 100644 index 0000000..d5a9def Binary files /dev/null and b/wx_navigationLite-master/image/logo.png differ diff --git a/wx_navigationLite-master/image/menu.png b/wx_navigationLite-master/image/menu.png new file mode 100644 index 0000000..6b0095f Binary files /dev/null and b/wx_navigationLite-master/image/menu.png differ diff --git a/wx_navigationLite-master/image/metro.jpg b/wx_navigationLite-master/image/metro.jpg new file mode 100644 index 0000000..a03edfc Binary files /dev/null and b/wx_navigationLite-master/image/metro.jpg differ diff --git a/wx_navigationLite-master/image/more.jpg b/wx_navigationLite-master/image/more.jpg new file mode 100644 index 0000000..29d57f9 Binary files /dev/null and b/wx_navigationLite-master/image/more.jpg differ diff --git a/wx_navigationLite-master/image/movie.jpg b/wx_navigationLite-master/image/movie.jpg new file mode 100644 index 0000000..246d126 Binary files /dev/null and b/wx_navigationLite-master/image/movie.jpg differ diff --git a/wx_navigationLite-master/image/nophoto.jpg b/wx_navigationLite-master/image/nophoto.jpg new file mode 100644 index 0000000..a967010 Binary files /dev/null and b/wx_navigationLite-master/image/nophoto.jpg differ diff --git a/wx_navigationLite-master/image/rest.png b/wx_navigationLite-master/image/rest.png new file mode 100644 index 0000000..5f6afdd Binary files /dev/null and b/wx_navigationLite-master/image/rest.png differ diff --git a/wx_navigationLite-master/image/route0.png b/wx_navigationLite-master/image/route0.png new file mode 100644 index 0000000..8f7c30b Binary files /dev/null and b/wx_navigationLite-master/image/route0.png differ diff --git a/wx_navigationLite-master/image/route1.png b/wx_navigationLite-master/image/route1.png new file mode 100644 index 0000000..94b51a0 Binary files /dev/null and b/wx_navigationLite-master/image/route1.png differ diff --git a/wx_navigationLite-master/image/route2.png b/wx_navigationLite-master/image/route2.png new file mode 100644 index 0000000..8fe95e1 Binary files /dev/null and b/wx_navigationLite-master/image/route2.png differ diff --git a/wx_navigationLite-master/image/route3.png b/wx_navigationLite-master/image/route3.png new file mode 100644 index 0000000..a8c97f6 Binary files /dev/null and b/wx_navigationLite-master/image/route3.png differ diff --git a/wx_navigationLite-master/image/share.png b/wx_navigationLite-master/image/share.png new file mode 100644 index 0000000..c1197bb Binary files /dev/null and b/wx_navigationLite-master/image/share.png differ diff --git a/wx_navigationLite-master/image/spot.jpg b/wx_navigationLite-master/image/spot.jpg new file mode 100644 index 0000000..cebc232 Binary files /dev/null and b/wx_navigationLite-master/image/spot.jpg differ diff --git a/wx_navigationLite-master/image/start-end.png b/wx_navigationLite-master/image/start-end.png new file mode 100644 index 0000000..e06d905 Binary files /dev/null and b/wx_navigationLite-master/image/start-end.png differ diff --git a/wx_navigationLite-master/image/startpoint.png b/wx_navigationLite-master/image/startpoint.png new file mode 100644 index 0000000..27ed2d0 Binary files /dev/null and b/wx_navigationLite-master/image/startpoint.png differ diff --git a/wx_navigationLite-master/image/startpoint0.png b/wx_navigationLite-master/image/startpoint0.png new file mode 100644 index 0000000..3ae930b Binary files /dev/null and b/wx_navigationLite-master/image/startpoint0.png differ diff --git a/wx_navigationLite-master/image/step1.jpg b/wx_navigationLite-master/image/step1.jpg new file mode 100644 index 0000000..6f68731 Binary files /dev/null and b/wx_navigationLite-master/image/step1.jpg differ diff --git a/wx_navigationLite-master/image/step2.jpg b/wx_navigationLite-master/image/step2.jpg new file mode 100644 index 0000000..bfcc67f Binary files /dev/null and b/wx_navigationLite-master/image/step2.jpg differ diff --git a/wx_navigationLite-master/image/submit.png b/wx_navigationLite-master/image/submit.png new file mode 100644 index 0000000..3631a4d Binary files /dev/null and b/wx_navigationLite-master/image/submit.png differ diff --git a/wx_navigationLite-master/image/supermarket.jpg b/wx_navigationLite-master/image/supermarket.jpg new file mode 100644 index 0000000..506e67d Binary files /dev/null and b/wx_navigationLite-master/image/supermarket.jpg differ diff --git a/wx_navigationLite-master/image/transit.jpg b/wx_navigationLite-master/image/transit.jpg new file mode 100644 index 0000000..c0c822b Binary files /dev/null and b/wx_navigationLite-master/image/transit.jpg differ diff --git a/wx_navigationLite-master/image/wx_logo.png b/wx_navigationLite-master/image/wx_logo.png new file mode 100644 index 0000000..37d80d1 Binary files /dev/null and b/wx_navigationLite-master/image/wx_logo.png differ diff --git a/wx_navigationLite-master/pages/admin/admin.js b/wx_navigationLite-master/pages/admin/admin.js new file mode 100644 index 0000000..af02b25 --- /dev/null +++ b/wx_navigationLite-master/pages/admin/admin.js @@ -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 + }) + } + } + } +}) diff --git a/wx_navigationLite-master/pages/admin/admin.json b/wx_navigationLite-master/pages/admin/admin.json new file mode 100644 index 0000000..88beb13 --- /dev/null +++ b/wx_navigationLite-master/pages/admin/admin.json @@ -0,0 +1,5 @@ +{ + "usingComponents": {}, + "backgroundColor":"#eee", + "navigationBarTitleText": "设置" +} \ No newline at end of file diff --git a/wx_navigationLite-master/pages/admin/admin.wxml b/wx_navigationLite-master/pages/admin/admin.wxml new file mode 100644 index 0000000..42c4bd8 --- /dev/null +++ b/wx_navigationLite-master/pages/admin/admin.wxml @@ -0,0 +1,48 @@ + + + + + + + + 设置 + + + + + + + + 操作 + + + + + + 添加到我的小程序 + + + + + + + + + + + + + + + diff --git a/wx_navigationLite-master/pages/admin/admin.wxss b/wx_navigationLite-master/pages/admin/admin.wxss new file mode 100644 index 0000000..ed5071a --- /dev/null +++ b/wx_navigationLite-master/pages/admin/admin.wxss @@ -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;} + + + + diff --git a/wx_navigationLite-master/pages/collect/collect.js b/wx_navigationLite-master/pages/collect/collect.js new file mode 100644 index 0000000..cfe24f4 --- /dev/null +++ b/wx_navigationLite-master/pages/collect/collect.js @@ -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 () { + + } +}) \ No newline at end of file diff --git a/wx_navigationLite-master/pages/collect/collect.json b/wx_navigationLite-master/pages/collect/collect.json new file mode 100644 index 0000000..92988cf --- /dev/null +++ b/wx_navigationLite-master/pages/collect/collect.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "收藏导航lite" +} \ No newline at end of file diff --git a/wx_navigationLite-master/pages/collect/collect.wxml b/wx_navigationLite-master/pages/collect/collect.wxml new file mode 100644 index 0000000..1863eb2 --- /dev/null +++ b/wx_navigationLite-master/pages/collect/collect.wxml @@ -0,0 +1,17 @@ + + + 如何收藏导航lite? + + 1.点击右上方“虚线点” + + + + 2.点击下方“添加到我的小程序” + + + + 如有问题,请联系我 + 微信:17521071571 + 邮箱:mr_huang509@163.com + + diff --git a/wx_navigationLite-master/pages/collect/collect.wxss b/wx_navigationLite-master/pages/collect/collect.wxss new file mode 100644 index 0000000..cddab84 --- /dev/null +++ b/wx_navigationLite-master/pages/collect/collect.wxss @@ -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;} + diff --git a/wx_navigationLite-master/pages/detail/detail.js b/wx_navigationLite-master/pages/detail/detail.js new file mode 100644 index 0000000..2be629d --- /dev/null +++ b/wx_navigationLite-master/pages/detail/detail.js @@ -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 () { + + } +}) \ No newline at end of file diff --git a/wx_navigationLite-master/pages/detail/detail.json b/wx_navigationLite-master/pages/detail/detail.json new file mode 100644 index 0000000..728981d --- /dev/null +++ b/wx_navigationLite-master/pages/detail/detail.json @@ -0,0 +1,6 @@ +{ + "navigationBarTitleText": "路线详情", + "backgroundColorTop": "#4188fe", + "backgroundColorBottom": "#fff" + +} \ No newline at end of file diff --git a/wx_navigationLite-master/pages/detail/detail.wxml b/wx_navigationLite-master/pages/detail/detail.wxml new file mode 100644 index 0000000..4f88b2e --- /dev/null +++ b/wx_navigationLite-master/pages/detail/detail.wxml @@ -0,0 +1,83 @@ + + + + + {{ getDetail[1].startName }} + + {{ getDetail[1].sitename }} + + + {{ getDetail[0].duration }} · + {{ getDetail[0].distance }} + + + + + + + + 从 {{ getDetail[1].startName }} 出发 + {{ getDetail[1].taxi_cost }} + + + + + + + + + {{ getDetail[0].segments[index].walkingDistance }} + + + + + {{ getDetail[0].segments[index].bus.buslines[0].name }} + + + + + + {{ getDetail[0].segments[index].bus.buslines[0].departure_stop.name }} + {{ getDetail[0].segments[index].entrance.name }} + + + + 途径{{ getDetail[0].segments[index].bus.buslines[0].via_stops.length }}个站 · {{ getDetail[0].segments[index].distance }} · {{ getDetail[0].segments[index].duration }} + + + + {{ getDetail[0].segments[index].bus.buslines[0].via_stops[idx].name }} + + + {{ getDetail[0].segments[index].bus.buslines[0].arrival_stop.name }} + {{ getDetail[0].segments[index].exit.name }} + + + + + + + {{ getDetail[0].segments[index].walkingDistance0 }} + + + + + + + + {{ getDetail[0].steps[index].road }} + + + + {{ getDetail[0].steps[index].instruction }} + + + + + + + + 到达 {{ getDetail[1].sitename }} + + + diff --git a/wx_navigationLite-master/pages/detail/detail.wxss b/wx_navigationLite-master/pages/detail/detail.wxss new file mode 100644 index 0000000..69f2376 --- /dev/null +++ b/wx_navigationLite-master/pages/detail/detail.wxss @@ -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;} + + + + diff --git a/wx_navigationLite-master/pages/index/index.js b/wx_navigationLite-master/pages/index/index.js new file mode 100644 index 0000000..b2497e2 --- /dev/null +++ b/wx_navigationLite-master/pages/index/index.js @@ -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 + }) + } + } + } +}) \ No newline at end of file diff --git a/wx_navigationLite-master/pages/index/index.json b/wx_navigationLite-master/pages/index/index.json new file mode 100644 index 0000000..fda03cd --- /dev/null +++ b/wx_navigationLite-master/pages/index/index.json @@ -0,0 +1,4 @@ +{ + "disableScroll": true + +} \ No newline at end of file diff --git a/wx_navigationLite-master/pages/index/index.wxml b/wx_navigationLite-master/pages/index/index.wxml new file mode 100644 index 0000000..ff94bd5 --- /dev/null +++ b/wx_navigationLite-master/pages/index/index.wxml @@ -0,0 +1,44 @@ + + + + + + + + + + + 搜索地点,公交,地铁 + + {{weatherMsg.temperature}}° {{weatherMsg.weather}} + + + + + + + + + + + 路线 + + + + + + + diff --git a/wx_navigationLite-master/pages/index/index.wxss b/wx_navigationLite-master/pages/index/index.wxss new file mode 100644 index 0000000..b2853b2 --- /dev/null +++ b/wx_navigationLite-master/pages/index/index.wxss @@ -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;} + + diff --git a/wx_navigationLite-master/pages/navigation/navigation.js b/wx_navigationLite-master/pages/navigation/navigation.js new file mode 100644 index 0000000..ecf587e --- /dev/null +++ b/wx_navigationLite-master/pages/navigation/navigation.js @@ -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 + }) + } + } + } +}) \ No newline at end of file diff --git a/wx_navigationLite-master/pages/navigation/navigation.json b/wx_navigationLite-master/pages/navigation/navigation.json new file mode 100644 index 0000000..8dbe65e --- /dev/null +++ b/wx_navigationLite-master/pages/navigation/navigation.json @@ -0,0 +1,5 @@ +{ + "navigationBarTitleText": "路线", + "backgroundColorTop":"#4188fe", + "backgroundColorBottom":"#eee" +} \ No newline at end of file diff --git a/wx_navigationLite-master/pages/navigation/navigation.wxml b/wx_navigationLite-master/pages/navigation/navigation.wxml new file mode 100644 index 0000000..2274bae --- /dev/null +++ b/wx_navigationLite-master/pages/navigation/navigation.wxml @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + {{toolData[index]}} + + + + + + + + {{homePart.homeText}} + + + + + + + + {{companyPart.companyText}} + + + + + + + + + + + + + {{historyRoute[index].startName}} + + {{historyRoute[index].endName}} + + + + + + + + + 清空历史纪录 + + + + + + 无历史纪录 + + 数据来源,高德地图开放平台,腾讯地图开放平台 + + + + + + + + + + + diff --git a/wx_navigationLite-master/pages/navigation/navigation.wxss b/wx_navigationLite-master/pages/navigation/navigation.wxss new file mode 100644 index 0000000..aae2b87 --- /dev/null +++ b/wx_navigationLite-master/pages/navigation/navigation.wxss @@ -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;} + + + diff --git a/wx_navigationLite-master/pages/nearby/nearby.js b/wx_navigationLite-master/pages/nearby/nearby.js new file mode 100644 index 0000000..d5d0b68 --- /dev/null +++ b/wx_navigationLite-master/pages/nearby/nearby.js @@ -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 () { + + } +}) diff --git a/wx_navigationLite-master/pages/nearby/nearby.json b/wx_navigationLite-master/pages/nearby/nearby.json new file mode 100644 index 0000000..55dda64 --- /dev/null +++ b/wx_navigationLite-master/pages/nearby/nearby.json @@ -0,0 +1,5 @@ +{ + "navigationBarTitleText": "路线详情", + "backgroundColorBottom": "#eee", + "onReachBottomDistance": 0 +} \ No newline at end of file diff --git a/wx_navigationLite-master/pages/nearby/nearby.wxml b/wx_navigationLite-master/pages/nearby/nearby.wxml new file mode 100644 index 0000000..f65f3dd --- /dev/null +++ b/wx_navigationLite-master/pages/nearby/nearby.wxml @@ -0,0 +1,43 @@ + + + + + + + 中心附近搜索 + + + + + + + + + + {{tips[index].name}} + {{tips[index].cityname}}{{tips[index].adname}}{{tips[index].address}} + + + + {{tips[index].distance}}m + + {{tips[index].biz_ext.rating}}分 + 暂无评分 + {{tips[index].tel}} + + + + + + 去这里 + + + + + + —— 我是有底线的 —— + + + + + diff --git a/wx_navigationLite-master/pages/nearby/nearby.wxss b/wx_navigationLite-master/pages/nearby/nearby.wxss new file mode 100644 index 0000000..f2b4174 --- /dev/null +++ b/wx_navigationLite-master/pages/nearby/nearby.wxss @@ -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;} + diff --git a/wx_navigationLite-master/pages/route/route.js b/wx_navigationLite-master/pages/route/route.js new file mode 100644 index 0000000..ff6fc26 --- /dev/null +++ b/wx_navigationLite-master/pages/route/route.js @@ -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(); + + } + + } + }) + + } + + +}) \ No newline at end of file diff --git a/wx_navigationLite-master/pages/route/route.json b/wx_navigationLite-master/pages/route/route.json new file mode 100644 index 0000000..0b1b20d --- /dev/null +++ b/wx_navigationLite-master/pages/route/route.json @@ -0,0 +1,4 @@ +{ + "backgroundColorTop": "#4188fe", + "backgroundColorBottom":"#fff" +} \ No newline at end of file diff --git a/wx_navigationLite-master/pages/route/route.wxml b/wx_navigationLite-master/pages/route/route.wxml new file mode 100644 index 0000000..9c741f2 --- /dev/null +++ b/wx_navigationLite-master/pages/route/route.wxml @@ -0,0 +1,93 @@ + + + + + + + + + + + {{toolData[index].tool}} + + + + + + + + + {{time}} + + + + + + {{recommend}} + + + + + + + + + + + 最佳 + {{transits[index].duration}} + 步行{{transits[index].walking_distance}} + + + + + + + {{transits[index].transport[0]}} + + + {{items}} + + + + + 22站 · + {{transits[index].cost}}元 · + {{transits[index].distance}} + + + + + + + 暂无推荐路线 + + + + + + + + + + + + + {{threeRouteData.duration}} + {{threeRouteData.distance}} + + + + 推荐 + 打车约{{threeRouteData.taxi_cost}}元 + 红绿灯{{threeRouteData.traffic_lights}}个 + + 路线详情 + + + + + + + + diff --git a/wx_navigationLite-master/pages/route/route.wxss b/wx_navigationLite-master/pages/route/route.wxss new file mode 100644 index 0000000..599bf39 --- /dev/null +++ b/wx_navigationLite-master/pages/route/route.wxss @@ -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;} + diff --git a/wx_navigationLite-master/pages/search/search.js b/wx_navigationLite-master/pages/search/search.js new file mode 100644 index 0000000..6df78c3 --- /dev/null +++ b/wx_navigationLite-master/pages/search/search.js @@ -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 + }) + } + } + } +}) \ No newline at end of file diff --git a/wx_navigationLite-master/pages/search/search.json b/wx_navigationLite-master/pages/search/search.json new file mode 100644 index 0000000..a4f3c52 --- /dev/null +++ b/wx_navigationLite-master/pages/search/search.json @@ -0,0 +1,4 @@ +{ + "navigationBarTitleText": "搜索附近", + "backgroundColorBottom": "#eee" +} \ No newline at end of file diff --git a/wx_navigationLite-master/pages/search/search.wxml b/wx_navigationLite-master/pages/search/search.wxml new file mode 100644 index 0000000..ecf5c1f --- /dev/null +++ b/wx_navigationLite-master/pages/search/search.wxml @@ -0,0 +1,89 @@ + + + + + + + 搜索 + + + + + + + + {{tips[index].name}} + {{tips[index].cityname}}{{tips[index].adname}}{{tips[index].address}} + {{tips[index].distance}}m + + + + + 去这里 + + + + + + + + + + + + {{i.nameCn}} + + + + + + + + + + + + + + {{historyData[index].name}} + {{historyData[index].address}} + + + + 去这里 + + + + + + + + {{ historyData[index] }} + + + + + + + + + + 清空历史纪录 + + + + + + 无历史纪录 + + + 数据来源,高德地图开放平台,腾讯地图开放平台 + + + + + \ No newline at end of file diff --git a/wx_navigationLite-master/pages/search/search.wxss b/wx_navigationLite-master/pages/search/search.wxss new file mode 100644 index 0000000..c2d6504 --- /dev/null +++ b/wx_navigationLite-master/pages/search/search.wxss @@ -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;} diff --git a/wx_navigationLite-master/pages/site/site.js b/wx_navigationLite-master/pages/site/site.js new file mode 100644 index 0000000..0c74fc9 --- /dev/null +++ b/wx_navigationLite-master/pages/site/site.js @@ -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 + }) + } + } + } +}) \ No newline at end of file diff --git a/wx_navigationLite-master/pages/site/site.json b/wx_navigationLite-master/pages/site/site.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/wx_navigationLite-master/pages/site/site.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/wx_navigationLite-master/pages/site/site.wxml b/wx_navigationLite-master/pages/site/site.wxml new file mode 100644 index 0000000..b9a46b5 --- /dev/null +++ b/wx_navigationLite-master/pages/site/site.wxml @@ -0,0 +1,21 @@ + + + + 数据略有偏差,请以实际情况为主 + + + + + {{siteData.endName}} + {{siteData.siteaddress}} + + + + + + + + + 返回首页 + + diff --git a/wx_navigationLite-master/pages/site/site.wxss b/wx_navigationLite-master/pages/site/site.wxss new file mode 100644 index 0000000..53b4834 --- /dev/null +++ b/wx_navigationLite-master/pages/site/site.wxss @@ -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;} + diff --git a/wx_navigationLite-master/project.config.json b/wx_navigationLite-master/project.config.json new file mode 100644 index 0000000..a756f5e --- /dev/null +++ b/wx_navigationLite-master/project.config.json @@ -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" +} \ No newline at end of file diff --git a/wx_navigationLite-master/project.private.config.json b/wx_navigationLite-master/project.private.config.json new file mode 100644 index 0000000..ccea257 --- /dev/null +++ b/wx_navigationLite-master/project.private.config.json @@ -0,0 +1,7 @@ +{ + "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", + "projectname": "navigation", + "setting": { + "compileHotReLoad": true + } +} \ No newline at end of file diff --git a/wx_navigationLite-master/screenshot/1.jpg b/wx_navigationLite-master/screenshot/1.jpg new file mode 100644 index 0000000..aa64f16 Binary files /dev/null and b/wx_navigationLite-master/screenshot/1.jpg differ diff --git a/wx_navigationLite-master/screenshot/2.jpg b/wx_navigationLite-master/screenshot/2.jpg new file mode 100644 index 0000000..c52539f Binary files /dev/null and b/wx_navigationLite-master/screenshot/2.jpg differ diff --git a/wx_navigationLite-master/screenshot/3.jpg b/wx_navigationLite-master/screenshot/3.jpg new file mode 100644 index 0000000..da47305 Binary files /dev/null and b/wx_navigationLite-master/screenshot/3.jpg differ diff --git a/wx_navigationLite-master/screenshot/4.jpg b/wx_navigationLite-master/screenshot/4.jpg new file mode 100644 index 0000000..64c4f30 Binary files /dev/null and b/wx_navigationLite-master/screenshot/4.jpg differ diff --git a/wx_navigationLite-master/screenshot/5.jpg b/wx_navigationLite-master/screenshot/5.jpg new file mode 100644 index 0000000..78a2b3b Binary files /dev/null and b/wx_navigationLite-master/screenshot/5.jpg differ diff --git a/wx_navigationLite-master/screenshot/6.jpg b/wx_navigationLite-master/screenshot/6.jpg new file mode 100644 index 0000000..5a4a9d4 Binary files /dev/null and b/wx_navigationLite-master/screenshot/6.jpg differ diff --git a/wx_navigationLite-master/screenshot/7.jpg b/wx_navigationLite-master/screenshot/7.jpg new file mode 100644 index 0000000..5276205 Binary files /dev/null and b/wx_navigationLite-master/screenshot/7.jpg differ diff --git a/wx_navigationLite-master/screenshot/visit.png b/wx_navigationLite-master/screenshot/visit.png new file mode 100644 index 0000000..5e02fdd Binary files /dev/null and b/wx_navigationLite-master/screenshot/visit.png differ diff --git a/wx_navigationLite-master/utils/amap-web.js b/wx_navigationLite-master/utils/amap-web.js new file mode 100644 index 0000000..0483fa2 --- /dev/null +++ b/wx_navigationLite-master/utils/amap-web.js @@ -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\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"]) \ No newline at end of file diff --git a/wx_navigationLite-master/utils/amap-wx.js b/wx_navigationLite-master/utils/amap-wx.js new file mode 100644 index 0000000..eb969c3 --- /dev/null +++ b/wx_navigationLite-master/utils/amap-wx.js @@ -0,0 +1 @@ +function AMapWX(a){this.key=a.key,this.requestConfig={key:a.key,s:"rsx",platform:"WXJS",appname:a.key,sdkversion:"1.2.0",logversion:"2.0"}}AMapWX.prototype.getWxLocation=function(a,b){wx.getLocation({type:"gcj02",success:function(a){var c=a.longitude+","+a.latitude;wx.setStorage({key:"userLocation",data:c}),b(c)},fail:function(c){wx.getStorage({key:"userLocation",success:function(a){a.data&&b(a.data)}}),a.fail({errCode:"0",errMsg:c.errMsg||""})}})},AMapWX.prototype.getRegeo=function(a){function c(c){var d=b.requestConfig;wx.request({url:"https://restapi.amap.com/v3/geocode/regeo",data:{key:b.key,location:c,extensions:"all",s:d.s,platform:d.platform,appname:b.key,sdkversion:d.sdkversion,logversion:d.logversion},method:"GET",header:{"content-type":"application/json"},success:function(b){var d,e,f,g,h,i,j,k,l;b.data.status&&"1"==b.data.status?(d=b.data.regeocode,e=d.addressComponent,f=[],g="",d&&d.roads[0]&&d.roads[0].name&&(g=d.roads[0].name+"附近"),h=c.split(",")[0],i=c.split(",")[1],d.pois&&d.pois[0]&&(g=d.pois[0].name+"附近",j=d.pois[0].location,j&&(h=parseFloat(j.split(",")[0]),i=parseFloat(j.split(",")[1]))),e.provice&&f.push(e.provice),e.city&&f.push(e.city),e.district&&f.push(e.district),e.streetNumber&&e.streetNumber.street&&e.streetNumber.number?(f.push(e.streetNumber.street),f.push(e.streetNumber.number)):(k="",d&&d.roads[0]&&d.roads[0].name&&(k=d.roads[0].name),f.push(k)),f=f.join(""),l=[{iconPath:a.iconPath,width:a.iconWidth,height:a.iconHeight,name:f,desc:g,longitude:h,latitude:i,id:0,regeocodeData:d}],a.success(l)):a.fail({errCode:b.data.infocode,errMsg:b.data.info})},fail:function(b){a.fail({errCode:"0",errMsg:b.errMsg||""})}})}var b=this;a.location?c(a.location):b.getWxLocation(a,function(a){c(a)})},AMapWX.prototype.getWeather=function(a){function d(d){var e="base";a.type&&"forecast"==a.type&&(e="all"),wx.request({url:"https://restapi.amap.com/v3/weather/weatherInfo",data:{key:b.key,city:d,extensions:e,s:c.s,platform:c.platform,appname:b.key,sdkversion:c.sdkversion,logversion:c.logversion},method:"GET",header:{"content-type":"application/json"},success:function(b){function c(a){var b={city:{text:"城市",data:a.city},weather:{text:"天气",data:a.weather},temperature:{text:"温度",data:a.temperature},winddirection:{text:"风向",data:a.winddirection+"风"},windpower:{text:"风力",data:a.windpower+"级"},humidity:{text:"湿度",data:a.humidity+"%"}};return b}var d,e;b.data.status&&"1"==b.data.status?b.data.lives?(d=b.data.lives,d&&d.length>0&&(d=d[0],e=c(d),e["liveData"]=d,a.success(e))):b.data.forecasts&&b.data.forecasts[0]&&a.success({forecast:b.data.forecasts[0]}):a.fail({errCode:b.data.infocode,errMsg:b.data.info})},fail:function(b){a.fail({errCode:"0",errMsg:b.errMsg||""})}})}function e(e){wx.request({url:"https://restapi.amap.com/v3/geocode/regeo",data:{key:b.key,location:e,extensions:"all",s:c.s,platform:c.platform,appname:b.key,sdkversion:c.sdkversion,logversion:c.logversion},method:"GET",header:{"content-type":"application/json"},success:function(b){var c,e;b.data.status&&"1"==b.data.status?(e=b.data.regeocode,e.addressComponent?c=e.addressComponent.adcode:e.aois&&e.aois.length>0&&(c=e.aois[0].adcode),d(c)):a.fail({errCode:b.data.infocode,errMsg:b.data.info})},fail:function(b){a.fail({errCode:"0",errMsg:b.errMsg||""})}})}var b=this,c=b.requestConfig;a.city?d(a.city):b.getWxLocation(a,function(a){e(a)})},AMapWX.prototype.getPoiAround=function(a){function d(d){var e={key:b.key,location:d,s:c.s,platform:c.platform,appname:b.key,sdkversion:c.sdkversion,logversion:c.logversion};a.querytypes&&(e["types"]=a.querytypes),a.querykeywords&&(e["keywords"]=a.querykeywords),wx.request({url:"https://restapi.amap.com/v3/place/around",data:e,method:"GET",header:{"content-type":"application/json"},success:function(b){var c,d,e,f;if(b.data.status&&"1"==b.data.status){if(b=b.data,b&&b.pois){for(c=[],d=0;d { + 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 +}