This commit is contained in:
2025-04-05 23:47:00 +08:00
commit 8001f8eaeb
215 changed files with 14655 additions and 0 deletions

164
pages/map/map.js Normal file
View File

@@ -0,0 +1,164 @@
var t = require("../../@babel/runtime/helpers/interopRequireDefault")(require("../../@babel/runtime/regenerator")), e = require("../../@babel/runtime/helpers/asyncToGenerator"), o = getApp(), a = require("../../utils/login.js");
Page({
data: {
markers: [],
longitude: null,
latitude: null,
weather: {},
totop: !1,
shop: {},
showshop: !1,
zoomsize: 14,
showLocation: !0
},
onLoad: function(t) {
var e = this;
wx.showLoading({
title: ""
}), a.pageStart(o).then(function(t) {
e.getuserLocation();
});
},
getuserLocation: function() {
var o = this;
return e(t.default.mark(function e() {
var a;
return t.default.wrap(function(t) {
for (;;) switch (t.prev = t.next) {
case 0:
return t.next = 2, o.getlocation();
case 2:
a = t.sent, console.log("result:", a), a && (o.latitude = a.latitude, o.longitude = a.longitude),
o.getData();
case 6:
case "end":
return t.stop();
}
}, e);
}))();
},
latitude: null,
longitude: null,
onShareAppMessage: function() {},
tolocation: function() {
var t = wx.createMapContext("map");
console.log("moveToLocation"), t.moveToLocation({
success: function(t) {
console.log(t);
},
fail: function(t) {
wx.showModal({
title: "用户未授权",
content: "请开启相关权限,以便更好使用小程序哦!",
showCancel: !0,
success: function(t) {
t.confirm ? wx.openSetting({
success: function(t) {
console.log("authSetting", t), t.authSetting || that.showLocationFail();
}
}) : t.cancel;
},
fail: function(t) {
that.showLocationFail();
}
});
}
});
},
clickMaker: function(t) {
wx.openLocation({
latitude: latitude,
longitude: longitude,
scale: 18
});
},
callUs: function() {
if (!o.globalData.servicetel) return !1;
wx.makePhoneCall({
phoneNumber: "" + o.globalData.servicetel
});
},
getData: function() {
var t = this;
a.request(o.globalData.config.map, {
longitude: this.longitude,
latitude: this.latitude
}).then(function(e) {
wx.hideLoading(), 200 == e.code ? (e.data.list.forEach(function(t, e) {
t.id = e, t.width = 32, t.height = 32, t.latitude = 1 * t.latitude, t.longitude = 1 * t.longitude,
t.iconPath = "/img/location-blue.png", t.callout = {
content: t.name
};
}), t.setData({
weather: e.data.weather,
markers: e.data.list,
longitude: 1 * e.data.longitude,
latitude: 1 * e.data.latitude,
zoomsize: e.data.zoomsize
})) : wx.showModal({
title: "提示",
content: e.message,
confirmColor: "#EF8176",
cancelColor: "#999999"
});
}).catch(function(t) {
wx.hideLoading();
});
},
bindmarkertap: function(t) {
console.log(t);
this.data.markers.forEach(function(t) {
t.iconPath = "/img/location-blue.png";
});
for (var e = 0; e < this.data.markers.length; e++) if (this.data.markers[e].id == t.detail.markerId) {
console.log(e), this.data.markers[e].iconPath = "/img/location-red.png", this.data.markers[e].width = 50,
this.data.markers[e].height = 50, this.setData({
shop: Object.assign({}, this.data.markers[e]),
showshop: !0
});
break;
}
},
closeshop: function() {
this.setData({
showshop: !1
});
},
changeTop: function() {
this.setData({
totop: !this.data.totop
});
},
getlocation: function() {
return new Promise(function(t, e) {
wx.getLocation({
type: "wgs84",
success: function(e) {
e.latitude, e.longitude;
t(e);
},
fail: function(e) {
t();
}
});
});
},
showLocationFail: function() {
wx.showToast({
title: "位置失败",
icon: "none",
duration: 1e3
});
},
toMap: function() {
wx.openLocation({
latitude: this.data.shop.latitude,
longitude: this.data.shop.longitude,
name: this.data.shop.name,
address: this.data.shop.address
});
}
});

10
pages/map/map.json Normal file
View File

@@ -0,0 +1,10 @@
{
"navigationBarTitleText": "聚美汽服",
"navigationBarBackgroundColor": "#4cadf1",
"navigationBarTextStyle": "white",
"enablePullDownRefresh": false,
"navigationStyle": "custom",
"usingComponents": {
"page-loding": "../../template/pageLoding/pageLoding"
}
}

50
pages/map/map.wxml Normal file
View File

@@ -0,0 +1,50 @@
<view>
<cover-view class="weather">
<cover-view class="{{totop?'totop inner':'inner'}}">
<cover-view class="blue-bg">
<cover-image class="sun" mode="widthFix" src="/img/sun.jpeg"></cover-image>
<cover-view class="inner-text">
<cover-view class="air_tips">{{weather.air_tips}}</cover-view>
<cover-view class="wea">
<cover-view class="temp">{{weather.tem}}℃</cover-view>
<cover-view class="text">{{weather.wea}}</cover-view>
</cover-view>
<cover-view class="intro">
<cover-view class="l"> 天气:{{weather.tem2}}~{{weather.tem1}}℃ {{weather.wea}} </cover-view>
<cover-view class="r">{{weather.city}}</cover-view>
</cover-view>
</cover-view>
</cover-view>
<cover-view class="bottom">
<cover-view bindtap="changeTop" class="top">
<cover-image src="/img/top.png"></cover-image>
</cover-view>
</cover-view>
</cover-view>
</cover-view>
<cover-view class="{{showshop?'showshop shop':'shop'}}">
<cover-view class="name">{{shop.name}}</cover-view>
<cover-view class="border"></cover-view>
<cover-view class="add">
<cover-view class="l">
<cover-image class="location" src="/img/location-blue.png"></cover-image>
<cover-view class="text">{{shop.address}}</cover-view>
</cover-view>
<cover-view bindtap="toMap" class="r" wx:if="{{shop.distance}}"> {{shop.distance}}kw<cover-image class="right" src="/img/right.png"></cover-image>
</cover-view>
</cover-view>
<cover-view class="border"></cover-view>
<cover-view bindtap="toMap" class="tomap">导航</cover-view>
</cover-view>
<view class="map">
<map bindmarkertap="bindmarkertap" bindtap="closeshop" id="map" latitude="{{latitude}}" longitude="{{longitude}}" markers="{{markers}}" scale="{{zoomsize}}" showLocation="{{showLocation}}"></map>
<cover-view class="custom-btn">
<cover-view bindtap="callUs" class="btn">
<cover-image class="img" src="/img/service.png"></cover-image>
</cover-view>
<cover-view bindtap="tolocation" class="btn">
<cover-image class="img" src="/img/local.png"></cover-image>
</cover-view>
</cover-view>
</view>
</view>

235
pages/map/map.wxss Normal file
View File

@@ -0,0 +1,235 @@
.map {
position: relative;
}
.custom-btn {
bottom: 200rpx;
left: 20rpx;
position: fixed;
}
.custom-btn .btn {
background: #fff;
border: 2rpx solid #e4e4e4;
border-radius: 50%;
box-sizing: border-box;
font-size: 44rpx;
height: 88rpx;
line-height: 84rpx;
margin-bottom: 28rpx;
text-align: center;
width: 88rpx;
z-index: 130;
}
.iconfont {
color: #333;
font-size: 48rpx;
}
.circle {
border: 2rpx solid #333;
border-radius: 50%;
box-sizing: border-box;
height: 40rpx;
margin: 22rpx;
width: 40rpx;
}
.circle-s {
height: 16rpx;
margin: 10rpx;
width: 16rpx;
}
.btn .img {
display: block;
height: 40rpx;
margin: 22rpx;
width: 40rpx;
}
map {
height: 100vh;
width: 100vw;
z-index: 0;
}
.weather {
left: 0;
position: fixed;
top: 0;
width: 100vw;
z-index: 100;
}
.blue-bg,.weather {
box-sizing: border-box;
}
.blue-bg {
background: #4cadf1;
overflow: hidden;
}
.inner-text {
padding: 70px 20px 10px;
position: relative;
z-index: 8;
}
.sun {
height: 174px;
left: 0;
position: absolute;
top: 0;
width: 100vw;
}
.air_tips {
color: #fff;
font-size: 13px;
overflow: hidden;
padding: 0 20px;
text-align: center;
text-overflow: ellipsis;
white-space: pre-wrap;
white-space: nowrap;
word-break: break-all;
}
.wea {
color: #333;
padding: 10px 0 4px;
}
.wea .temp {
display: inline-block;
font-size: 44px;
font-weight: 200;
line-height: 44px;
margin-right: 4px;
vertical-align: bottom;
}
.wea .text {
display: inline;
font-size: 14px;
line-height: 32px;
}
.intro {
align-items: center;
color: #333;
display: flex;
font-size: 13px;
justify-content: space-between;
}
.bottom {
position: relative;
top: -24px;
}
.top {
background: #a2cefb;
border-radius: 50%;
display: block;
margin: 0 auto;
z-index: 10;
}
.top,.top image {
height: 48px;
width: 48px;
}
.inner {
position: relative;
transition: all .3s;
}
.inner.totop {
top: -144px;
}
.inner.totop .bottom {
top: 0;
transform: rotateZ(180deg);
}
.shop {
background: #fff;
border-radius: 10px;
left: 5vw;
position: fixed;
top: -900px;
width: 90vw;
z-index: 102;
}
.shop.showshop {
top: 90px;
}
.shop .name {
color: #333;
font-size: 16px;
line-height: 1.5;
padding: 14px;
}
.border {
background: #f2f2f2;
height: 1px;
width: 100%;
}
.shop .add {
color: #666;
display: flex;
font-size: 14px;
justify-content: space-between;
line-height: 1.5;
padding: 14px;
}
.shop .add,.shop .add .l {
align-items: center;
}
.shop .add .l {
display: inline-flex;
}
.shop .add .text {
line-height: 1.5;
max-width: 50vw;
white-space: pre-wrap;
word-break: break-all;
}
.shop .add .location {
display: inline-block;
height: 14px;
margin-right: 3px;
width: 14px;
}
.shop .add .r {
align-items: center;
color: #4cadf1;
}
.shop .add .right {
display: inline-block;
height: 12px;
margin-left: 3px;
width: 12px;
}
.shop .tomap {
color: #4cadf1;
padding: 20px 0;
text-align: center;
}