lc_branch
pp5jxn7yq 2 years ago
parent 5da2fc2309
commit 50422eaf78

2
src/.gitignore vendored

@ -0,0 +1,2 @@
project.config.json
config.js

@ -1,5 +0,0 @@
#include<stdio.h>
typedef struct {
};

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

@ -0,0 +1,74 @@
<div align="center">
<h1> 导览 - 微信地图导览小程序 </h1>
[![GitHub license](https://img.shields.io/github/license/gxgk/school-map)](https://github.com/gxgk/school-map/blob/master/LICENSE)
[![GitHub stars](https://img.shields.io/github/stars/gxgk/school-map)](https://github.com/gxgk/school-map/stargazers)
[![test](https://img.shields.io/badge/platform-微信小程序-green)]()
首款开源的微信地图导览小程序,仅需修改地图文件,就可以适配某一学校/景区,具有出色的用户体验。
***官网https://www.gxgkcat.com***
☑️一键配置切换 ☑️地图路径规划 ☑️在线热修补
</div>
---
## 🤩预览
![导览](https://map.gxgkcat.com/%E6%A0%A1%E5%9B%AD%E5%AF%BC%E8%A7%88/Screenshot.jpg)
![二维码](https://map.gxgkcat.com/%E6%A0%A1%E5%9B%AD%E5%AF%BC%E8%A7%88/qrcode.jpg)
---
## 📝使用说明
1、项目根文件新建config.js文件写入以下内容并根据自身需求修改
```js
module.exports = {
// 调试模式开关,调试模式下只调用本地数据
debug: true,
// 学校数据配置名称,学校英文缩写
school: "gdst",
// 高德路线规划密钥必须加入https://restapi.amap.com为request合法域名
// 密钥申请地址http://lbs.amap.com/api/javascript-api/summary/
key: "",
// 地图更新地址,用于热修补,无需每次都提交审核
updateUrl: "https://www.qq.com/json.json",
// 图片CDN域名
imgCDN: "https://www.gxgkcat.com/"
}
```
2、复制resources下的地图数据文件gdst.js重命名gdst.js为(你自己学校的英文缩写.js根据实际情况修改)
```js
module.exports.introduce = {}
module.exports.map = [{}]
```
3、修改地图文件
```
参照例子自行研究
地图经纬度获取http://lbs.qq.com/tool/getpoint/index.html
```
---
## 📒开源许可证
请认真阅读并遵守以下开源协议
`MIT License` [License](https://github.com/gxgk/map/blob/master/LICENSE)
欢迎 pull request and star
允许任何人对该项目进行变动
同时欢迎各位校友参与到该项目(可新增关于界面加入参与贡献者名称)
不过,该项目所有图片均有版权(学院宣传服务中心所有),禁止盗用,包含首页背景
> @ 广东科技学院 - 莞香广科团队 http://www.gxgkcat.com

@ -0,0 +1,97 @@
//app.js
let config = require('config.js')
App({
onLaunch: function() {
var _this = this;
//载入学校位置数据
_this.loadSchoolConf()
//如果已经授权,提前获取定位信息
wx.getSetting({
success(res) {
if (res.authSetting['scope.userLocation']) {
//获取地理位置
wx.getLocation({
type: 'wgs84', // 默认为 wgs84 返回 gps 坐标gcj02 返回可用于 wx.openLocation 的坐标
success: function(res) {
_this.globalData.latitude = res.latitude;
_this.globalData.longitude = res.longitude;
_this.globalData.islocation = true
}
})
}
}
})
},
loadNetWorkScoolConf: function() {
var _this = this
return new Promise(function(resolve, reject) {
if (!_this.debug) {
// 优先读取缓存信息
var map = wx.getStorageSync('map')
var introduce = wx.getStorageSync('introduce')
if (map && introduce) {
_this.globalData.map = map;
_this.globalData.introduce = introduce;
}
// 再加载网络数据
wx.request({
url: config.updateUrl,
header: {
'content-type': 'application/json'
},
success: function(res) {
console.log("加载远程数据")
if (res.data.map && res.data.map.length > 0) {
//刷新数据
_this.globalData.map = res.data.map;
_this.globalData.introduce = res.data.introduce;
// 存储学校位置数据于缓存中
wx.setStorage({
key: "map",
data: res.data.map
})
wx.setStorage({
key: "introduce",
data: res.data.introduce
})
}
},
complete: function(info) {
resolve();
}
})
} else {
resolve();
}
});
},
loadSchoolConf: function() {
var _this = this
// 载入本地数据
_this.globalData.map = _this.school.map;
_this.globalData.introduce = _this.school.introduce;
_this.loadNetWorkScoolConf().then(function() {
// 渲染id
for (let i = 0; i < _this.globalData.map.length; i++) {
for (let b = 0; b < _this.globalData.map[i].data.length; b++) {
_this.globalData.map[i].data[b].id = b + 1;
}
}
})
},
debug: config.debug, //开启后只调用本地数据
imgCDN: config.imgCDN,
school: require('/resources/' + config.school),
globalData: {
userInfo: null,
map: null,
introduce: null,
latitude: null,
longitude: null
}
})

@ -0,0 +1,25 @@
{
"pages": [
"pages/index",
"pages/map/index",
"pages/map/details",
"pages/map/polyline",
"pages/map/search",
"pages/web-views/web-views"
],
"permission": {
"scope.userLocation": {
"desc": "你的位置信息将用于辅助规划路线"
}
},
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#079df2",
"navigationBarTitleText": "校园导览",
"navigationBarTextStyle": "white"
},
"sitemapLocation": "sitemap.json",
"navigateToMiniProgramAppIdList": [
"wx8afedfde046e5916"
]
}

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

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

@ -1,3 +0,0 @@
{
"usingComponents": {}
}

@ -1,36 +0,0 @@
<!--pages/canteen/canteen.wxml-->
<view class = "container">
<view class = "word">
<text>窗口1:\n
窗口详情:\n
评分:x.x</text>
</view>
<button size="mini" type="primary"class="tapbtn1" bindtap="goEvaluate">评价菜品</button>
<button size="mini" type="default"class="tapbtn2" bindtap="goCwindow">查看评价</button>
</view>
<view class="divLineX"></view>
<!--pages/canteen/canteen.wxml-->
<view class = "container">
<view class = "word">
<text>窗口:2\n
窗口详情:\n
评分:</text>
</view>
<button size="mini" type="primary"class="tapbtn1" bindtap="goEvaluate">评价菜品</button>
<button size="mini" type="default"class="tapbtn2" bindtap="goCwindow">查看评价</button>
</view>
<view class="divLineX"></view>
<!--pages/canteen/canteen.wxml-->
<view class = "container">
<view class = "word">
<text>窗口3:\n
窗口详情:\n
评分:</text>
</view>
<button size="mini" type="primary"class="tapbtn1" bindtap="goEvaluate">评价菜品</button>
<button size="mini" type="default"class="tapbtn2" bindtap="goCwindow">查看评价</button>
</view>
<view class="divLineX"></view>

@ -1,37 +0,0 @@
/* pages/canteen/canteen.wxss */
.tapbtn1{
margin-bottom: 20rpx;
background-color: #FFFFFF;
width:200rpx;
height: 60rpx;
border-radius: 100rpx;
text-align: top;
justify-content: center;
font-size: 20rpx;
}
.tapbtn2{
margin-bottom: 20rpx;
background-color: #FFFFFF;
width:200rpx;
height: 60rpx;
border-radius: 100rpx;
text-align: center;
justify-content: center;
font-size: 20rpx;
}
.container{
display:flex;
}
.word{
display:flexbox;
margin-right: 13em;
}
.divLineX{
background: #E4E6ED;
width: 100%;
height: 1rpx;
}

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1506927773816" class="icon" style="" viewBox="0 0 1025 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3359" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M1021.923737 450.547539c-3.949605-59.390357-13.750477-117.46418-33.937347-173.636341-22.381095-62.315991-56.318442-117.317898-105.907928-161.933807-40.373741-36.424135-87.037593-62.169709-138.089895-80.162354C699.665221 19.162899 653.879058 9.800872 607.068924 5.119858c-19.748025-1.901662-39.496051-2.925633-59.244076-4.242168-1.901662-0.146282-3.657042-0.438845-5.558703-0.731408l-60.414329 0c-10.093435 0.731408-20.040589 1.316535-30.134024 2.047943-52.076274 3.364478-103.42114 11.263688-153.44947 26.769545-51.783711 16.090984-99.764098 39.642332-142.185782 74.018524-57.049851 46.225007-95.375648 105.322801-120.09725 173.928904C19.748025 321.819671 10.239717 368.483523 5.119858 416.171347 0 463.127763-1.170253 510.23046 1.170253 557.333157c3.51076 71.092891 14.628167 140.722965 41.543994 207.281124 44.762191 110.588941 124.339418 184.461184 236.244895 224.103516 47.541542 16.822392 96.692183 26.3307 146.866795 31.157995 54.416781 5.26614 108.833561 5.412422 163.250342 0.87769 69.044948-5.851267 136.041952-19.894307 199.089351-49.589486 99.178971-46.810134 164.566877-123.754292 200.991013-226.444023 15.652139-44.323346 25.160447-89.963226 29.84146-136.627078 1.901662-19.455462 2.925633-39.203487 4.38845-58.658949 0.146282-1.609098 0.585127-3.364478 0.87769-4.973577l0-63.486244C1023.240272 470.588128 1022.655145 460.640974 1021.923737 450.547539zM713.708261 537.292569c-22.673659 37.886952-47.102697 74.603651-71.092891 111.759195-37.886952 58.805231-76.066468 117.46418-114.099701 176.269411-11.556252 17.846364-21.210842 17.846364-32.913375-0.292563-59.536639-92.01117-120.09725-183.290931-178.609917-275.887227-93.181423-147.890767-5.119858-328.548628 153.888315-357.219835 13.750477-2.486788 27.647235-3.218197 41.543994-4.681013 114.245983 1.316535 211.523293 83.965678 229.66222 196.602563C750.571241 438.113597 741.940623 489.897308 713.708261 537.292569zM634.423597 429.336697c-4.242168 64.363934-57.927541 114.538546-122.584038 114.392265-63.339962-0.146282-116.732772-48.858077-121.998912-111.32035-5.412422-64.071371 38.472079-121.998912 101.226915-132.092347 45.347317-7.314083 83.673114 7.167802 114.392265 41.397712 6.875238 7.606647 5.851267 19.016617-1.75538 25.745574-7.89921 6.875238-19.162899 6.14383-26.623264-2.194225-12.433942-13.896759-27.500954-23.405067-45.786162-27.647235-46.663852-11.117407-93.912831 19.162899-103.42114 66.411878-9.65459 47.395261 22.088532 93.912831 69.630074 101.812041 49.882049 8.191773 95.52193-27.062109 99.91038-77.383003 0.731408-8.191773 3.949605-14.774449 11.995097-17.992645 6.728957-2.63307 13.16535-1.609098 18.724054 3.218197C633.107061 417.487882 634.862442 422.900304 634.423597 429.336697z" p-id="3360" fill="#1296db"></path></svg>

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

@ -1 +0,0 @@
真他妈牛逼

@ -0,0 +1,32 @@
//获取应用实例
var app = getApp();
Page({
data: {
images: app.globalData.introduce.images,
shortName: app.globalData.introduce.shortName,
mapCopyright: app.globalData.introduce.mapCopyright,
imgCDN: app.imgCDN
},
onLoad: function (options) {
wx.setNavigationBarTitle({
title: app.globalData.introduce.name
})
},
onShareAppMessage: function (res) {
if (res.from === 'button') {
// 来自页面内转发按钮
console.log(res.target)
}
return {
title: app.globalData.introduce.name + ' - 校园导览',
path: '/pages/index',
imageUrl: app.imgCDN + app.globalData.introduce.share,
success: function (res) {
// 转发成功
},
fail: function (res) {
// 转发失败
}
}
},
})

@ -0,0 +1,3 @@
{
"navigationBarBackgroundColor": "#0c101b"
}

@ -0,0 +1,18 @@
<view class="page" style="background: url('{{imgCDN}}{{images}}'); background-size: 100% 100%;">
<view class="button_container">
<navigator class="button" url="map/details">
<text>{{shortName}}简介</text>
</navigator>
<navigator class="button" url="map/index">
<text>逛逛{{shortName}}</text>
</navigator>
</view>
<view class="copyright">
<navigator target="miniProgram" app-id="wx8afedfde046e5916">
<text>© 莞香广科</text>
</navigator>
<navigator url="web-views/web-views?url={{mapCopyright.url}}">
<text>{{mapCopyright?"数据版权:"+mapCopyright.name:""}}</text>
</navigator>
</view>
</view>

@ -0,0 +1,44 @@
.page {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
color: white;
}
.button_container {
width: 100%;
display: flex;
align-items: center;
flex-direction: row;
margin-top: 120px;
justify-content: center;
}
.button {
width: 145rpx;
height: 145rpx;
margin: 20px;
background-color: rgba(255, 224, 115, 0.9);
border-radius: 80rpx;
display: flex;
justify-content: center;
}
.button text {
width: 55%;
align-self: center;
text-align: center;
}
.copyright {
display: flex;
justify-content: flex-end;
flex-direction: column;
align-items: center;
height: 55vh;
font-size: 27rpx;
text-align: center;
line-height: 150%;
text-shadow:#000 1rpx 0 0,#000 0 1rpx 0,#000 -1rpx 0 0,#000 0 -1rpx 0;
}

@ -0,0 +1,107 @@
// pages/map/details.js
//获取应用实例
var app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
tid: 0,
bid: 0,
building: {
img: []//加载中图片地址
},
imgCDN: app.imgCDN
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
var bid = parseInt(options.bid);
var tid = parseInt(options.tid);
if (!options.bid || !options.tid){
var data = app.globalData.introduce;
} else {
var data = app.globalData.map[tid].data[bid];
}
this.setData({
bid: bid,
tid: tid,
building: data
});
wx.setNavigationBarTitle({
title: data.name
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function (res) {
var title, path;
if (this.data.introduce){
title = app.globalData.introduce.name + '校园导览';
path = "/pages/map/details";
} else {
title = this.data.building.name + ' - ' + app.globalData.introduce.name + '校园导览'
path = "/pages/map/details?tid=" + this.data.tid + "&bid=" + this.data.bid
}
if (res.from === 'button') {
// 来自页面内转发按钮
console.log(res.target)
}
return {
title: title,
path: path,
imageUrl: app.imgCDN + this.data.building.img[0],
success: function (res) {
// 转发成功
},
fail: function (res) {
// 转发失败
}
}
},
})

@ -0,0 +1,22 @@
<!--pages/map/details.wxml-->
<view>
<swiper class="swiper" indicator-dots="{{building.img.length == 1 ? false : true}}" indicator-active-color="#fff" autoplay="1" interval="3000" duration="500">
<block wx:for="{{building.img}}" wx:key="*this">
<swiper-item>
<image class="swiper-image" src="{{imgCDN}}{{item + '?imageMogr2/thumbnail/1500x/interlace/1/blur/1x0/quality/100|imageslim'}}"> </image>
</swiper-item>
</block>
</swiper>
<view class="building">
<view class="buildingName">{{building.name}}</view>
<navigator class="nav_map" url='polyline?latitude={{building.latitude}}&longitude={{building.longitude}}'>
<image src="/img/location.svg"> </image>
</navigator>
</view>
<view class="descript">
<view class='description'>
<rich-text nodes="{{ building.description }}"></rich-text>
</view>
</view>
</view>

@ -0,0 +1,50 @@
/* pages/map/details.wxss */
.description {
padding: 40rpx 40rpx;
line-height: 30px;
font-size: 30rpx;
}
.swiper {
height: 40vh;
}
.swiper-image {
width: 100%;
height:100%;
}
.building {
height: 10vh;
display: flex;
margin: auto 20rpx;
}
.buildingName {
margin: auto 15rpx;
width: 80%;
color: #079df2;
font-size: 50rpx;
white-space:nowrap;
}
.nav_map {
margin: auto 10rpx;
}
.nav_map image {
width: 80rpx;
height: 80rpx;
}
.descript {
background: #f8f8f8;
width: 100%;
min-height: 49vh;
}
.descript rich-text {
font-size: 30rpx;
color: #000;
}

@ -0,0 +1,93 @@
//获取应用实例
var app = getApp();
Page({
data: {
fullscreen: false,
latitude: 22.973132,
longitude: 113.755875,
buildlData: app.globalData.map,
windowHeight: "",
windowWidth: "",
isSelectedBuild: 0,
isSelectedBuildType: 0,
imgCDN: app.imgCDN,
islocation: true
},
onLoad: function () {
wx.showShareMenu({
withShareTicket: true
})
var _this = this;
wx.getSystemInfo({
success: function (res) {
//获取当前设备宽度与高度,用于定位控键的位置
_this.setData({
windowHeight: res.windowHeight,
windowWidth: res.windowWidth,
})
console.log(res.windowWidth)
}
})
//载入更新后的数据
this.setData({
buildlData: app.globalData.map
})
},
onShareAppMessage: function (res) {
if (res.from === 'button') {
// 来自页面内转发按钮
console.log(res.target)
}
return {
title: app.globalData.introduce.name + ' - 校园导览',
path: '/pages/map/index',
success: function (res) {
// 转发成功
},
fail: function (res) {
// 转发失败
}
}
},
regionchange(e) {
// 视野变化
// console.log(e.type)
},
markertap(e) {
// 选中 其对应的框
this.setData({
isSelectedBuild: e.markerId
})
// console.log("e.markerId", e.markerId)
},
navigateSearch() {
wx.navigateTo({
url: 'search'
})
},
location: function () {
var _this = this
wx.getLocation({
type: 'gcj02', // 默认为 wgs84 返回 gps 坐标gcj02 返回可用于 wx.openLocation 的坐标
success: function (res) {
app.globalData.latitude = res.latitude;
app.globalData.longitude = res.longitude;
_this.setData({
longitude: res.longitude,
latitude: res.latitude
})
}
})
},
clickButton: function (e) {
//console.log(this.data.fullscreen)
//打印所有关于点击对象的信息
this.setData({ fullscreen: !this.data.fullscreen })
},
changePage: function (event) {
this.setData({
isSelectedBuildType: event.currentTarget.id,
isSelectedBuild: 0
});
}
})

@ -0,0 +1,43 @@
<!--pages/map/map.wxml-->
<view style="width: 100%;">
<scroll-view scroll-x="true">
<view class="top-swich" style="width:{{buildlData.length * 120 < windowWidth ? windowWidth: buildlData.length * 120}}rpx;" wx:if="{{!fullscreen}}">
<label wx:for="{{buildlData}}" wx:key="id" id="{{index}}" bindtap="changePage" class="top-swich-btn {{isSelectedBuildType == index ? 'active' : ''}}">{{item.name}}
</label>
</view>
</scroll-view>
<map longitude="{{longitude}}" latitude="{{latitude}}" scale="{{buildlData[isSelectedBuildType].scale}}" markers="{{buildlData[isSelectedBuildType].data}}" bindmarkertap="markertap" bindregionchange="regionchange" include-points="{{buildlData[isSelectedBuildType].data}}"
show-location="{{islocation? 'true': 'false'}}" enable-overlooking="true" enable-traffic="true" enable-3D="true" style="width: auto; height:{{fullscreen ? 94 : 48}}vh;">
<cover-view class="controls {{fullscreen ? 'full' : ''}}">
<cover-view bindtap="navigateSearch">
<cover-image class="img" src="/img/search.png" />
</cover-view>
<cover-view bindtap="location">
<cover-image class="img" src="/img/location.png" />
</cover-view>
</cover-view>
</map>
<button bindtap="clickButton">
共有{{buildlData[isSelectedBuildType].data.length}}个景观 ◕‿◕
</button>
<scroll-view scroll-y="true" style="height:{{fullscreen ? 0 : 40}}vh" scroll-top="{{(isSelectedBuild -1 ) * 70}}">
<view wx:for="{{buildlData[isSelectedBuildType].data}}" wx:key="id" class="building-item" style="{{isSelectedBuild -1 == index ? 'background-color: #d5d5d5;' : ''}}">
<view class="img-view">
<navigator class="img" url='details?tid={{isSelectedBuildType}}&bid={{index}}'>
<image src="{{imgCDN}}{{item.img[0] + '?imageView2/1/w/240/h/180/q/100|imageslim'}}" mode="aspectFill"> </image>
<view class="item">
<view class="itemName">
{{item.name}}
</view>
<view class="itemFloor" wx:if="{{item.floor}}">
位置:{{item.floor}}
</view>
</view>
</navigator>
<navigator class="text" url='polyline?latitude={{item.latitude}}&longitude={{item.longitude}}'>
<image src="/img/location.svg"> </image>
</navigator>
</view>
</view>
</scroll-view>
</view>

@ -0,0 +1,101 @@
/* pages/map/map.wxss */
.building-item {
height: 50px;
border-bottom: 1px solid #e0e0e0;
padding: 10px;
}
.top-swich {
background-color: #079df2;
height: 6vh;
color: white;
display: flex;
justify-content: space-around;
}
::-webkit-scrollbar {
width: 0;
height: 0;
color: transparent;
}
.top-swich-btn {
background-color: none;
letter-spacing: 3rpx;
height: 65rpx;
color: #fff;
font-size: 30rpx;
}
.active {
border-bottom: solid white;
height: 50rpx;
display: inline-block;
}
button {
font-size: 26rpx;
height: 6vh;
}
.img-view {
height: 100%;
display: flex;
}
.img {
width: 85%;
height: 100%;
display: flex;
}
.img image {
width: 60px;
height: 90%;
margin: auto 7rpx;
}
.item {
display: flex;
flex-direction: column;
margin: auto 0;
}
.itemName {
margin: 0 20rpx;
font-size: 32rpx;
}
.itemFloor {
margin: 0 20rpx;
font-size: 28rpx;
color: #555;
}
.text {
margin: auto 15px;
width: 13%;
}
.text image {
width: 70rpx;
height: 70rpx;
}
.controls {
position: relative;
top: 65%;
left: 85%;
/* display: flex; */
}
.controls .img {
margin-top: 5px;
width: 80rpx;
height: 80rpx;
}
.full {
top: 82%;
}

@ -0,0 +1,104 @@
var app = getApp();
var amapFile = require('../../utils/amap-wx.js');
Page({
data: {
latitude: null,
longitude: null,
markers: [],
distance: '',
polyline: []
},
onLoad: function (options) {
var _this = this;
_this.setData({
longitude: app.globalData.longitude,
latitude: app.globalData.latitude
})
_this.routing(options);
wx.getLocation({
type: 'gcj02',
success: function (res) {
app.globalData.latitude = res.latitude;
app.globalData.longitude = res.longitude;
_this.setData({
latitude: res.latitude,
longitude: res.longitude
});
_this.routing(options);
},
fail: function () {
console.log("定位失败")
wx.showModal({
title: '无法使用该功能',
content: '请点击右上角在“关于校园导览”设置中给予定位权限',
showCancel: false,
success: function (res) {
wx.navigateBack({
delta: 1
})
return;
}
})
}
})
},
routing: function (options){
var _this = this;
let distance = Math.abs(_this.data.longitude - options.longitude) + Math.abs(_this.data.latitude - options.latitude)
console.log(distance);
var myAmapFun = new amapFile.AMapWX({ key: require('../../config.js').key });
let routeData = {
origin: options.longitude + ',' + options.latitude,
destination: _this.data.longitude + ',' + _this.data.latitude,
success: function (data) {
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])
})
}
}
}
_this.setData({
markers: [{
"width": "25",
"height": "35",
iconPath: "/img/mapicon_end.png",
latitude: options.latitude,
longitude: options.longitude
}, {
"width": "25",
"height": "35",
iconPath: "/img/mapicon_start.png",
latitude: _this.data.latitude,
longitude: _this.data.longitude
}],
polyline: [{
points: points,
color: "#0091ff",
width: 6
}]
});
if (data.paths[0] && data.paths[0].distance) {
_this.setData({
distance: data.paths[0].distance + '米'
});
}
},
fail: function (info) {
}
}
if (distance < 0.85) {
// getWalkingRoute 步行
myAmapFun.getWalkingRoute(routeData)
} else {
// getDrivingRoute 驾车
myAmapFun.getDrivingRoute(routeData)
}
}
})

@ -0,0 +1,3 @@
{
"navigationBarTitleText": "路径规划"
}

@ -0,0 +1,7 @@
<map id="navi_map" longitude="{{longitude}}" latitude="{{latitude}}"
scale="14" markers="{{markers}}" polyline="{{polyline}}" include-points="{{markers}}"
class="navi_map" show-location enable-overlooking="true" enable-3D="true" enable-traffic="true">
<cover-view class="distance">{{distance}}</cover-view>
</map>

@ -0,0 +1,17 @@
.navi_map {
width: auto;
height: 100vh;
}
.distance {
position: absolute;
bottom: 30px;
right: 10px;
height: 30px;
line-height: 30px;
text-align: center;
padding: 3px 5px 3px 5px;
color: #fff;
background: #0091ff;
border-radius: 5px;
}

@ -0,0 +1,133 @@
// pages/map/search.js
//获取应用实例
var app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
keyword: null,
buildlData: app.globalData.map,
showData: null,
cursor: 0,
imgCDN: app.imgCDN
},
bindSearchInput: function(e) {
let showData = new Array();
let searchdata = this.data.buildlData;
if (e.detail.cursor >= this.data.cursor) {
//输入文字
let inputData = e.detail.value.replace(/(^\s*)|(\s*$)/g, "")
if (inputData) {
let z = 0,
x = 100;
for (var b in searchdata) {
for (var i in searchdata[b].data) {
if (searchdata[b].data[i].name.indexOf(inputData) != -1 || (searchdata[b].data[i].floor && searchdata[b].data[i].floor.indexOf(inputData) != -1)) {
let build = searchdata[b].data[i];
build.tid = b;
build.bid = i;
z = z + 1;
build.index = z;
showData.push(build);
} else if (searchdata[b].data[i].description.indexOf(inputData) != -1) {
let build = searchdata[b].data[i];
build.tid = b;
build.bid = i;
x = x + 1;
build.index = x;
showData.push(build);
}
}
}
//冒泡排序
for (var i = 0; i < showData.length; i++) {
for (var j = 0; j < showData.length - i - 1; j++) {
if (showData[j].index > showData[j + 1].index) {
var temp = showData[j];
showData[j] = showData[j + 1];
showData[j + 1] = temp;
console.log('交换' + showData[j].index + ':' + showData[j + 1].index)
}
}
}
if (inputData == 'gxgk') {
showData.push({
name: "\u839e\u9999\u5e7f\u79d1"
})
}
this.setData({
showData: showData
});
}
} else {
//删除文字
console.log('删除文字')
this.setData({
showData: null
});
}
this.data.cursor = e.detail.cursor;
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
},
reset: function() {
this.setData({
keyword: null
});
}
})

@ -0,0 +1,35 @@
<!--index.wxml-->
<view class="search">
<view class="search-icon">
<icon type="search" size="16" color="blue" />
</view>
<view class="search-form">
<form>
<input bindinput="bindSearchInput" type="text" name="search" placeholder="请输入景点名称关键词" value="{{keyword}}" style="font-size: 30rpx;" />
</form>
</view>
<view class="search-icon" bindtap="reset">
<icon type="cancel" size="16" color="purple" />
</view>
</view>
<view wx:for="{{showData}}" wx:key="name" class="building-item">
<view style="height:100%; display: flex;">
<navigator class="img" url='details?tid={{item.tid}}&bid={{item.bid}}'>
<image src="{{imgCDN}}{{item.img[0]}}" mode="aspectFill"> </image>
<view class="item">
<view class="itemName">
{{item.name}}
</view>
<view class="itemFloor" wx:if="{{item.floor}}">
{{item.floor}}
</view>
</view>
</navigator>
<navigator class="text" url='polyline?latitude={{item.latitude}}&longitude={{item.longitude}}'>
<image src="/img/location.svg"> </image>
</navigator>
</view>
</view>

@ -0,0 +1,16 @@
@import 'index.wxss'
.search {
width: 96%;
height: 80rpx;
background-color: #f5f5f5;
border-radius: 15px;
margin: 20rpx 2%;
display: flex;
}
.search-icon{
margin:auto 20rpx;
}
.search-form{
margin:auto 15rpx; width: 100%;
}

@ -0,0 +1,68 @@
// pages/web-views/web-views.js
Page({
/**
* 页面的初始数据
*/
data: {
url: 'www.gxgk.cc' //给予默认值防止ios初次加载报错
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
url: encodeURI(options.url)
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

@ -0,0 +1,2 @@
<!--pages/web-views/web-views.wxml-->
<web-view src="https://{{url}}"></web-view>

@ -0,0 +1 @@
/* pages/web-views/web-views.wxss */

@ -1 +0,0 @@
代码

File diff suppressed because one or more lines are too long

@ -0,0 +1,7 @@
{
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
"rules": [{
"action": "allow",
"page": "*"
}]
}

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save