feat:新增地图模块,用于查找附近设备场地

This commit is contained in:
2025-08-18 14:52:39 +08:00
parent c5b8026fba
commit 38eb05fefd
122 changed files with 8317 additions and 1768 deletions
+9 -5
View File
@@ -1,16 +1,20 @@
"use strict";
const _imports_0$4 = "/static/logo.png";
const _imports_0$3 = "/static/scan-icon.png";
const _imports_0$2 = "/static/user-active.png";
const _imports_1 = "/static/jl.png";
const _imports_1$1 = "/static/jl.png";
const _imports_2 = "/static/complaint.png";
const _imports_3 = "/static/hlep.png";
const _imports_0$1 = "/static/images/wxpayflag.png";
const _imports_0 = "/static/images/location-map.svg";
const _imports_1 = "/static/map.png";
exports._imports_0 = _imports_0$3;
exports._imports_0$1 = _imports_0$2;
exports._imports_0$2 = _imports_0$1;
exports._imports_0$3 = _imports_0;
exports._imports_1 = _imports_1;
exports._imports_0$1 = _imports_0$4;
exports._imports_0$2 = _imports_0$2;
exports._imports_0$3 = _imports_0$1;
exports._imports_0$4 = _imports_0;
exports._imports_1 = _imports_1$1;
exports._imports_1$1 = _imports_1;
exports._imports_2 = _imports_2;
exports._imports_3 = _imports_3;
//# sourceMappingURL=../../.sourcemap/mp-weixin/common/assets.js.map
File diff suppressed because it is too large Load Diff
+207 -132
View File
@@ -1,6 +1,14 @@
"use strict";
const common_vendor = require("../common/vendor.js");
const common_assets = require("../common/assets.js");
if (!Array) {
const _easycom_uv_icon2 = common_vendor.resolveComponent("uv-icon");
_easycom_uv_icon2();
}
const _easycom_uv_icon = () => "../node-modules/@climblee/uv-ui/components/uv-icon/uv-icon.js";
if (!Math) {
_easycom_uv_icon();
}
const _sfc_main = {
__name: "MapComponent",
props: {
@@ -29,41 +37,179 @@ const _sfc_main = {
"mapCenterChange"
],
setup(__props, { expose: __expose, emit: __emit }) {
const collapseRef = common_vendor.ref(null);
common_vendor.ref([
{
title: "扫码使用",
desc: "找到附近设备,扫描设备上的二维码"
},
{
title: "免押金支付",
desc: "无需支付押金,使用支付分免押即可完成租借"
},
{
title: "开始使用",
desc: "设备自动解锁,风扇弹出后取出即可开始使用"
},
{
title: "归还设备",
desc: "使用完毕后,按照设备规格要求将风扇还入即可结束订单"
}
]);
const props = __props;
const emit = __emit;
const mapKey = common_vendor.ref(0);
const mapZoom = common_vendor.ref(16);
const isLoading = common_vendor.ref(true);
const mapCenter = common_vendor.ref({
longitude: 116.397128,
latitude: 39.916527
});
const loadPositionsTimer = common_vendor.ref(null);
const isMapInitialized = common_vendor.ref(false);
const updateMapCenter = (longitude, latitude) => {
if (mapCenter.value.longitude === longitude && mapCenter.value.latitude === latitude) {
return;
}
mapCenter.value = { longitude, latitude };
mapZoom.value = 16;
common_vendor.nextTick$1(() => {
setTimeout(() => {
const mapContext = common_vendor.index.createMapContext("mainMap");
if (mapContext) {
mapContext.setCenterOffset({
longitude,
latitude,
success: () => {
},
fail: () => {
mapContext.includePoints({
points: [{ longitude, latitude }],
padding: [0, 0, 0, 0]
});
}
});
const mapZoom = common_vendor.ref(17);
const mapMarkers = common_vendor.ref([]);
const mapContext = common_vendor.ref(null);
const updateMapMarkers = () => {
mapMarkers.value = [];
if (props.userLocation) {
mapMarkers.value.push({
id: 0,
// ID必须是数字
// iconPath: '/static/scan-icon.png',
width: 32,
height: 32,
latitude: props.userLocation.latitude,
longitude: props.userLocation.longitude,
title: "我的位置",
callout: {
content: "我的位置",
color: "#ffffff",
fontSize: 12,
borderRadius: 4,
bgColor: "#2196F3",
padding: 6,
display: "BYCLICK"
// 点击时显示
},
customCallout: {
anchorX: 0,
anchorY: 0
}
}, 200);
});
});
}
if (props.filteredPositions && props.filteredPositions.length > 0) {
props.filteredPositions.forEach((pos, index) => {
if (pos.longitude && pos.latitude) {
const lat = parseFloat(pos.latitude);
const lng = parseFloat(pos.longitude);
if (lat >= -90 && lat <= 90 && lng >= -180 && lng <= 180) {
mapMarkers.value.push({
id: index + 1,
// ID必须是数字,避免和用户位置的ID冲突
// iconPath: '/static/scan-icon.png',
width: 30,
height: 30,
latitude: lat,
longitude: lng,
title: pos.name,
position: pos,
// 存储原始位置数据,用于事件处理
callout: {
content: pos.name,
color: "#333333",
fontSize: 12,
borderRadius: 4,
bgColor: "#ffffff",
padding: 6,
display: "BYCLICK"
// 点击时显示
}
});
} else {
common_vendor.index.__f__("warn", "at components/MapComponent.vue:176", `忽略无效坐标: ${pos.name}, 纬度=${lat}, 经度=${lng}`);
}
}
});
}
isLoading.value = false;
};
const moveToLocation = (location) => {
if (!location || !location.longitude || !location.latitude)
return;
if (mapContext.value) {
mapContext.value.moveToLocation({
longitude: location.longitude,
latitude: location.latitude,
success: () => {
common_vendor.index.__f__("log", "at components/MapComponent.vue:194", "地图已移动到指定位置");
},
fail: (error) => {
common_vendor.index.__f__("error", "at components/MapComponent.vue:197", "移动地图失败:", error);
}
});
}
};
common_vendor.watch(() => props.userLocation, (newLocation) => {
if (newLocation && newLocation.longitude && newLocation.latitude) {
mapCenter.value = {
longitude: newLocation.longitude,
latitude: newLocation.latitude
};
updateMapMarkers();
moveToLocation(newLocation);
}
}, {
immediate: true,
deep: true
});
common_vendor.watch(() => props.filteredPositions, (newPositions) => {
updateMapMarkers();
}, {
deep: true
});
const onMapUpdated = () => {
isLoading.value = false;
};
const onMapRegionChange = (e) => {
if (e.type === "end" && e.causedBy === "drag") {
if (mapContext.value) {
mapContext.value.getCenterLocation({
success: (res) => {
if (res.longitude && res.latitude) {
mapCenter.value = {
longitude: res.longitude,
latitude: res.latitude
};
emit("mapCenterChange", mapCenter.value);
}
}
});
}
}
};
const onMapMarkerTap = (e) => {
const markerId = e.markerId;
const marker = mapMarkers.value.find((item) => item.id === markerId);
if (marker) {
if (markerId === 0) {
common_vendor.index.showToast({
title: "这是您的位置",
icon: "none"
});
return;
}
if (marker.position) {
emit("markerTap", marker.position);
}
}
};
const onCalloutTap = (e) => {
const markerId = e.markerId;
const marker = mapMarkers.value.find((item) => item.id === markerId);
if (marker && marker.position) {
emit("markerTap", marker.position);
}
};
const onMapError = (error) => {
common_vendor.index.__f__("error", "at components/MapComponent.vue:283", "地图加载失败:", error);
isLoading.value = false;
};
const handleRelocate = () => {
emit("relocate");
@@ -74,121 +220,50 @@ const _sfc_main = {
const handleShowList = () => {
emit("showList");
};
const handleMarkerTap = (e) => {
if (!e.detail || typeof e.detail.markerId === "undefined") {
return;
}
const markerId = e.detail.markerId;
if (markerId === 9999) {
common_vendor.index.showToast({
title: "这是您的位置",
icon: "none"
});
return;
}
const position = props.filteredPositions[markerId];
if (position) {
emit("markerTap", position);
}
};
const handleRegionChange = (e) => {
if (e.detail.type === "end") {
const { center } = e.detail;
if (!center || typeof center.longitude === "undefined" || typeof center.latitude === "undefined") {
return;
}
mapCenter.value = {
longitude: center.longitude,
latitude: center.latitude
};
mapZoom.value = 16;
if (loadPositionsTimer.value) {
clearTimeout(loadPositionsTimer.value);
}
loadPositionsTimer.value = setTimeout(() => {
emit("mapCenterChange", mapCenter.value);
}, 500);
}
};
const mapMarkers = common_vendor.computed(() => {
const markers = [];
props.filteredPositions.forEach((item, index) => {
if (item.longitude && item.latitude) {
markers.push({
id: index,
longitude: parseFloat(item.longitude),
latitude: parseFloat(item.latitude),
title: item.name,
iconPath: "/static/scan-icon.png",
width: 30,
height: 30,
callout: {
content: item.name,
fontSize: 14,
borderRadius: 8,
bgColor: "#ffffff",
padding: 10,
display: "BYCLICK"
}
});
common_vendor.onMounted(() => {
common_vendor.nextTick$1(() => {
mapContext.value = common_vendor.index.createMapContext("map");
updateMapMarkers();
if (collapseRef.value) {
collapseRef.value.init();
}
});
if (props.userLocation) {
markers.push({
id: 9999,
// 特殊ID标识用户位置
longitude: props.userLocation.longitude,
latitude: props.userLocation.latitude,
title: "我的位置",
iconPath: "/static/scan-icon.png",
width: 32,
height: 32,
callout: {
content: "我的位置",
fontSize: 14,
borderRadius: 8,
bgColor: "#2196F3",
color: "#ffffff",
padding: 10,
display: "BYCLICK"
}
});
}
return markers;
});
common_vendor.watch(() => props.userLocation, (newLocation) => {
if (newLocation && newLocation.longitude && newLocation.latitude && !isMapInitialized.value) {
updateMapCenter(newLocation.longitude, newLocation.latitude);
isMapInitialized.value = true;
}
}, { immediate: true, deep: true });
common_vendor.onMounted(() => {
});
common_vendor.onUnmounted(() => {
if (loadPositionsTimer.value) {
clearTimeout(loadPositionsTimer.value);
}
mapContext.value = null;
});
__expose({
mapCenter: common_vendor.computed(() => mapCenter.value)
mapCenter: common_vendor.computed(() => mapCenter.value),
moveToLocation,
updateMapMarkers,
initCollapse: () => {
if (collapseRef.value) {
collapseRef.value.init();
}
}
});
return (_ctx, _cache) => {
return common_vendor.e({
a: mapKey.value,
b: mapCenter.value.longitude,
c: mapCenter.value.latitude,
a: mapCenter.value.longitude,
b: mapCenter.value.latitude,
c: mapMarkers.value,
d: mapZoom.value,
e: mapMarkers.value,
f: common_vendor.o(handleMarkerTap),
g: common_vendor.o(handleRegionChange),
h: !mapCenter.value.longitude
}, !mapCenter.value.longitude ? {} : {}, {
i: common_assets._imports_0,
j: common_vendor.o(handleRelocate),
k: common_assets._imports_0,
l: common_vendor.o(handleScan),
e: common_vendor.o(onMapRegionChange),
f: common_vendor.o(onMapMarkerTap),
g: common_vendor.o(onCalloutTap),
h: common_vendor.o(onMapUpdated),
i: common_vendor.o(onMapError),
j: isLoading.value
}, isLoading.value ? {} : {}, {
k: common_vendor.p({
name: "map-fill",
size: "18"
}),
l: common_vendor.o(handleRelocate),
m: common_assets._imports_0,
n: common_vendor.o(handleShowList)
n: common_vendor.o(handleScan),
o: common_assets._imports_1$1,
p: common_vendor.o(handleShowList)
});
};
}
+3 -1
View File
@@ -1,4 +1,6 @@
{
"component": true,
"usingComponents": {}
"usingComponents": {
"uv-icon": "../node-modules/@climblee/uv-ui/components/uv-icon/uv-icon"
}
}
+1 -1
View File
@@ -1 +1 @@
<view class="map-container data-v-651a9dc3"><map id="mainMap" class="map data-v-651a9dc3" key="{{a}}" longitude="{{b}}" latitude="{{c}}" scale="{{d}}" markers="{{e}}" show-location="{{false}}" enable-scroll="{{true}}" enable-zoom="{{true}}" enable-rotate="{{false}}" show-compass="{{false}}" bindmarkertap="{{f}}" bindregionchange="{{g}}"></map><view wx:if="{{h}}" class="map-loading data-v-651a9dc3"><view class="loading-content data-v-651a9dc3"><view class="loading-spinner data-v-651a9dc3"></view><text class="data-v-651a9dc3">地图加载中...</text></view></view><view class="map-controls data-v-651a9dc3"><view class="control-btn location-control data-v-651a9dc3" bindtap="{{j}}"><image class="control-icon data-v-651a9dc3" src="{{i}}" mode="aspectFit"/><text class="data-v-651a9dc3">我的位置</text></view><view class="control-btn scan-control main-btn data-v-651a9dc3" bindtap="{{l}}"><image class="control-icon data-v-651a9dc3" src="{{k}}" mode="aspectFit"/><text class="data-v-651a9dc3">扫码使用</text></view><view class="control-btn list-control data-v-651a9dc3" bindtap="{{n}}"><image class="control-icon data-v-651a9dc3" src="{{m}}" mode="aspectFit"/><text class="data-v-651a9dc3">附近场地</text></view></view></view>
<view class="map-container data-v-651a9dc3"><view class="map-wrapper data-v-651a9dc3"><map id="map" class="native-map data-v-651a9dc3" longitude="{{a}}" latitude="{{b}}" markers="{{c}}" scale="{{d}}" show-location="{{true}}" bindregionchange="{{e}}" bindmarkertap="{{f}}" bindcallouttap="{{g}}" bindupdated="{{h}}" binderror="{{i}}"></map><view wx:if="{{j}}" class="map-loading data-v-651a9dc3"><view class="loading-content data-v-651a9dc3"><view class="loading-spinner data-v-651a9dc3"></view><text class="data-v-651a9dc3">地图加载中...</text></view></view></view><view class="map-controls data-v-651a9dc3"><view class="control-btn location-control data-v-651a9dc3" bindtap="{{l}}"><uv-icon wx:if="{{k}}" class="data-v-651a9dc3" u-i="651a9dc3-0" bind:__l="__l" u-p="{{k}}"></uv-icon><text class="data-v-651a9dc3" style="margin-left:8rpx">我的位置</text></view><view class="control-btn scan-control main-btn data-v-651a9dc3" bindtap="{{n}}"><image class="control-icon data-v-651a9dc3" src="{{m}}" mode="aspectFit"/><text class="data-v-651a9dc3">扫码使用</text></view><view class="control-btn list-control data-v-651a9dc3" bindtap="{{p}}"><image class="control-icon data-v-651a9dc3" src="{{o}}" mode="aspectFit"/><text class="data-v-651a9dc3">附近设备</text></view></view></view>
+37 -12
View File
@@ -27,12 +27,33 @@
.map-container.data-v-651a9dc3 {
flex: 1;
position: relative;
height: 100vh;
width: 100%;
height: 60vh;
/* 增加高度 */
width: 92%;
/* 略微增加宽度 */
margin: 10rpx auto 30rpx;
/* 调整上下间距,左右自动居中 */
border-radius: 24rpx;
/* 添加圆角 */
overflow: hidden;
/* 确保圆角生效 */
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.1);
/* 添加阴影效果 */
}
.map-container .map.data-v-651a9dc3 {
.map-container .map-wrapper.data-v-651a9dc3 {
width: 100%;
height: 100%;
position: relative;
overflow: hidden;
border-radius: 24rpx;
/* 内层也添加圆角 */
}
.map-container .map-wrapper .native-map.data-v-651a9dc3 {
width: 100%;
height: 100%;
display: block;
border-radius: 24rpx;
/* 地图也添加圆角 */
}
.map-container .map-loading.data-v-651a9dc3 {
position: absolute;
@@ -68,26 +89,28 @@
}
.map-container .map-controls.data-v-651a9dc3 {
position: absolute;
right: 30rpx;
right: 20rpx;
bottom: 20rpx;
left: 30rpx;
left: 20rpx;
display: flex;
justify-content: center;
align-items: center;
gap: 30rpx;
gap: 20rpx;
}
.map-container .map-controls .control-btn.data-v-651a9dc3 {
min-width: 140rpx;
height: 80rpx;
min-width: 120rpx;
/* 减小按钮宽度 */
height: 70rpx;
/* 减小按钮高度 */
background: #ffffff;
border-radius: 40rpx;
border-radius: 35rpx;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.1);
transition: all 0.2s ease;
padding: 0 20rpx;
padding: 0 16rpx;
}
.map-container .map-controls .control-btn.data-v-651a9dc3:active {
transform: scale(0.95);
@@ -104,8 +127,10 @@
font-weight: 500;
}
.map-container .map-controls .control-btn.main-btn.data-v-651a9dc3 {
min-width: 160rpx;
height: 90rpx;
min-width: 140rpx;
/* 减小主按钮宽度 */
height: 80rpx;
/* 减小主按钮高度 */
box-shadow: 0 6rpx 20rpx rgba(33, 150, 243, 0.4);
transform: translateY(-5rpx);
}
+1 -1
View File
@@ -1,5 +1,5 @@
"use strict";
const URL = "https://my.gxfs123.com/api";
const URL = "https://fansdev.gxfs123.com/api";
const appid = "wx2165f0be356ae7a9";
exports.URL = URL;
exports.appid = appid;
+8 -5
View File
@@ -67,11 +67,14 @@ const rentPowerBank = (deviceNo, phone) => {
return config_http.request({
url: "/app/device/rentPowerBank",
method: "post",
data: { deviceNo, phone }
data: {
deviceNo,
phone
}
});
};
const confirmPaymentAndRent = (orderId) => {
common_vendor.index.__f__("log", "at config/user.js:120", `确认支付并弹出风扇, orderId: ${orderId}`);
common_vendor.index.__f__("log", "at config/user.js:123", `确认支付并弹出风扇, orderId: ${orderId}`);
return config_http.request({
url: `/app/device/confirmPaymentAndRent?orderId=${orderId}`,
method: "GET"
@@ -85,7 +88,7 @@ const getOrderByOrderNo = (orderNo) => {
});
};
const getOrderByOrderNoScore = (orderNo) => {
common_vendor.index.__f__("log", "at config/user.js:157", "通过订单号获取支付分订单信息", orderNo);
common_vendor.index.__f__("log", "at config/user.js:160", "通过订单号获取支付分订单信息", orderNo);
return config_http.request({
url: `/app/wx-payment/score/create/${orderNo}`,
method: "get",
@@ -93,7 +96,7 @@ const getOrderByOrderNoScore = (orderNo) => {
});
};
const getOrderByOrderNoScorePayStatus = (orderNo) => {
common_vendor.index.__f__("log", "at config/user.js:166", "通过订单号获取支付分订单状态", orderNo);
common_vendor.index.__f__("log", "at config/user.js:169", "通过订单号获取支付分订单状态", orderNo);
return config_http.request({
url: `/app/wx-payment/score/status/${orderNo}`,
method: "get",
@@ -101,7 +104,7 @@ const getOrderByOrderNoScorePayStatus = (orderNo) => {
});
};
const updateOrderPackage = (data) => {
common_vendor.index.__f__("log", "at config/user.js:176", "更新订单套餐信息:", data);
common_vendor.index.__f__("log", "at config/user.js:179", "更新订单套餐信息:", data);
return config_http.request({
url: "/app/device/updateOrderPackage",
method: "post",
@@ -0,0 +1,90 @@
"use strict";
const common_vendor = require("../../../../../common/vendor.js");
const _sfc_main = {
name: "uv-cell",
emits: ["click"],
mixins: [common_vendor.mpMixin, common_vendor.mixin, common_vendor.props$6],
computed: {
titleTextStyle() {
return this.$uv.addStyle(this.titleStyle);
}
},
methods: {
// 点击cell
clickHandler(e) {
if (this.disabled)
return;
this.$emit("click", {
name: this.name
});
this.openPage();
this.stop && this.preventEvent(e);
}
}
};
if (!Array) {
const _easycom_uv_icon2 = common_vendor.resolveComponent("uv-icon");
const _easycom_uv_line2 = common_vendor.resolveComponent("uv-line");
(_easycom_uv_icon2 + _easycom_uv_line2)();
}
const _easycom_uv_icon = () => "../uv-icon/uv-icon.js";
const _easycom_uv_line = () => "../uv-line/uv-line.js";
if (!Math) {
(_easycom_uv_icon + _easycom_uv_line)();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: _ctx.icon
}, _ctx.icon ? {
b: common_vendor.p({
name: _ctx.icon,
["custom-style"]: _ctx.iconStyle,
size: _ctx.size === "large" ? 22 : 18
})
} : {}, {
c: _ctx.title
}, _ctx.title ? {
d: common_vendor.t(_ctx.title),
e: common_vendor.s($options.titleTextStyle),
f: common_vendor.n(_ctx.disabled && "uv-cell--disabled"),
g: common_vendor.n(_ctx.size === "large" && "uv-cell__title-text--large")
} : {}, {
h: _ctx.label
}, _ctx.label ? {
i: common_vendor.t(_ctx.label),
j: common_vendor.n(_ctx.disabled && "uv-cell--disabled"),
k: common_vendor.n(_ctx.size === "large" && "uv-cell__label--large")
} : {}, {
l: !_ctx.$uv.test.empty(_ctx.value)
}, !_ctx.$uv.test.empty(_ctx.value) ? {
m: common_vendor.t(_ctx.value),
n: common_vendor.n(_ctx.disabled && "uv-cell--disabled"),
o: common_vendor.n(_ctx.size === "large" && "uv-cell__value--large")
} : {}, {
p: _ctx.$slots["right-icon"] || _ctx.isLink
}, _ctx.$slots["right-icon"] || _ctx.isLink ? common_vendor.e({
q: _ctx.$slots["right-icon"]
}, _ctx.$slots["right-icon"] ? {} : {
r: common_vendor.p({
name: _ctx.rightIcon,
["custom-style"]: _ctx.rightIconStyle,
color: _ctx.disabled ? "#c8c9cc" : "info",
size: _ctx.size === "large" ? 18 : 16
})
}, {
s: common_vendor.n(`uv-cell__right-icon-wrap--${_ctx.arrowDirection}`)
}) : {}, {
t: common_vendor.n(_ctx.center && "uv-cell--center"),
v: common_vendor.n(_ctx.size === "large" && "uv-cell__body--large"),
w: common_vendor.s(_ctx.cellStyle),
x: _ctx.border
}, _ctx.border ? {} : {}, {
y: common_vendor.n(_ctx.customClass),
z: common_vendor.s(_ctx.$uv.addStyle(_ctx.customStyle)),
A: !_ctx.disabled && (_ctx.clickable || _ctx.isLink) ? "uv-cell--clickable" : "",
B: common_vendor.o((...args) => $options.clickHandler && $options.clickHandler(...args))
});
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-fd61d93a"]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../../../../.sourcemap/mp-weixin/node-modules/@climblee/uv-ui/components/uv-cell/uv-cell.js.map
@@ -0,0 +1,7 @@
{
"component": true,
"usingComponents": {
"uv-icon": "../uv-icon/uv-icon",
"uv-line": "../uv-line/uv-line"
}
}
@@ -0,0 +1 @@
<view class="{{['uv-cell', 'data-v-fd61d93a', y]}}" style="{{z}}" hover-class="{{A}}" hover-stay-time="{{250}}" bindtap="{{B}}"><view class="{{['uv-cell__body', 'data-v-fd61d93a', t, v]}}" style="{{w}}"><view class="uv-cell__body__content data-v-fd61d93a"><view class="uv-cell__left-icon-wrap data-v-fd61d93a"><block wx:if="{{$slots.icon}}"><slot name="icon"></slot></block><block wx:else><uv-icon wx:if="{{a}}" class="data-v-fd61d93a" u-i="fd61d93a-0" bind:__l="__l" u-p="{{b}}"></uv-icon></block></view><view class="uv-cell__title data-v-fd61d93a"><block wx:if="{{$slots.title}}"><slot name="title"></slot></block><block wx:else><text wx:if="{{c}}" style="{{e}}" class="{{['uv-cell__title-text', 'data-v-fd61d93a', f, g]}}">{{d}}</text></block><block wx:if="{{$slots.label}}"><slot name="label"></slot></block><block wx:else><text wx:if="{{h}}" class="{{['uv-cell__label', 'data-v-fd61d93a', j, k]}}">{{i}}</text></block></view></view><block wx:if="{{$slots.value}}"><slot name="value"></slot></block><block wx:else><text wx:if="{{l}}" class="{{['uv-cell__value', 'data-v-fd61d93a', n, o]}}">{{m}}</text></block><view wx:if="{{p}}" class="{{['uv-cell__right-icon-wrap', 'data-v-fd61d93a', s]}}"><slot wx:if="{{q}}" name="right-icon"></slot><uv-icon wx:else class="data-v-fd61d93a" u-i="fd61d93a-1" bind:__l="__l" u-p="{{r||''}}"></uv-icon></view></view><uv-line wx:if="{{x}}" class="data-v-fd61d93a" u-i="fd61d93a-2" bind:__l="__l"></uv-line></view>
@@ -0,0 +1,110 @@
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
view.data-v-fd61d93a, scroll-view.data-v-fd61d93a, swiper-item.data-v-fd61d93a {
display: flex;
flex-direction: column;
flex-shrink: 0;
flex-grow: 0;
flex-basis: auto;
align-items: stretch;
align-content: flex-start;
}
.uv-cell__body.data-v-fd61d93a {
display: flex;
flex-direction: row;
box-sizing: border-box;
padding: 10px 15px;
font-size: 15px;
color: #303133;
}
.uv-cell__body__content.data-v-fd61d93a {
display: flex;
flex-direction: row;
align-items: center;
flex: 1;
}
.uv-cell__body--large.data-v-fd61d93a {
padding-top: 13px;
padding-bottom: 13px;
}
.uv-cell__left-icon-wrap.data-v-fd61d93a, .uv-cell__right-icon-wrap.data-v-fd61d93a {
display: flex;
flex-direction: row;
align-items: center;
font-size: 16px;
}
.uv-cell__left-icon-wrap.data-v-fd61d93a {
margin-right: 4px;
}
.uv-cell__right-icon-wrap.data-v-fd61d93a {
margin-left: 4px;
transition: transform 0.3s;
}
.uv-cell__right-icon-wrap--up.data-v-fd61d93a {
transform: rotate(-90deg);
}
.uv-cell__right-icon-wrap--down.data-v-fd61d93a {
transform: rotate(90deg);
}
.uv-cell__title.data-v-fd61d93a {
flex: 1;
}
.uv-cell__title-text.data-v-fd61d93a {
font-size: 15px;
line-height: 22px;
color: #303133;
}
.uv-cell__title-text--large.data-v-fd61d93a {
font-size: 16px;
}
.uv-cell__label.data-v-fd61d93a {
margin-top: 5px;
font-size: 12px;
color: #909193;
line-height: 18px;
}
.uv-cell__label--large.data-v-fd61d93a {
font-size: 14px;
}
.uv-cell__value.data-v-fd61d93a {
text-align: right;
font-size: 14px;
line-height: 24px;
color: #606266;
}
.uv-cell__value--large.data-v-fd61d93a {
font-size: 15px;
}
.uv-cell--clickable.data-v-fd61d93a {
background-color: #f3f4f6;
}
.uv-cell--disabled.data-v-fd61d93a {
color: #c8c9cc;
cursor: not-allowed;
}
.uv-cell--center.data-v-fd61d93a {
align-items: center;
}
@@ -0,0 +1,132 @@
"use strict";
const common_vendor = require("../../../../../common/vendor.js");
const _sfc_main = {
name: "uv-collapse-item",
mixins: [common_vendor.mpMixin, common_vendor.mixin, common_vendor.props$1],
data() {
return {
elId: "",
// uni.createAnimation的导出数据
animationData: {},
// 是否展开状态
expanded: false,
// 根据expanded确定是否显示border,为了控制展开时,cell的下划线更好的显示效果,进行一定时间的延时
showBorder: false,
// 是否动画中,如果是则不允许继续触发点击
animating: false,
// 父组件uv-collapse的参数
parentData: {
accordion: false,
border: false
}
};
},
watch: {
expanded(n) {
clearTimeout(this.timer);
this.timer = null;
this.timer = setTimeout(() => {
this.showBorder = n;
}, n ? 10 : 290);
}
},
created() {
this.elId = this.$uv.guid();
},
mounted() {
this.init();
},
methods: {
// 异步获取内容,或者动态修改了内容时,需要重新初始化
init() {
this.updateParentData();
if (!this.parent) {
return this.$uv.error("uv-collapse-item必须要搭配uv-collapse组件使用");
}
const {
value,
accordion,
children = []
} = this.parent;
if (accordion) {
if (this.$uv.test.array(value)) {
return this.$uv.error("手风琴模式下,uv-collapse组件的value参数不能为数组");
}
this.expanded = this.name == value;
} else {
if (!this.$uv.test.array(value) && value !== null) {
return this.$uv.error("非手风琴模式下,uv-collapse组件的value参数必须为数组");
}
this.expanded = (value || []).some((item) => item == this.name);
}
this.$nextTick(function() {
this.setContentAnimate();
});
},
updateParentData() {
this.getParentData("uv-collapse");
},
async setContentAnimate() {
const rect = await this.queryRect();
const height = this.expanded ? rect.height : 0;
this.animating = true;
const animation = common_vendor.index.createAnimation({
timingFunction: "ease-in-out"
});
animation.height(height).step({
duration: this.duration
}).step();
this.animationData = animation.export();
this.$uv.sleep(this.duration).then(() => {
this.animating = false;
});
},
// 点击collapsehead头部
clickHandler() {
if (this.disabled && this.animating)
return;
this.parent && this.parent.onChange(this);
},
// 查询内容高度
queryRect() {
return new Promise((resolve) => {
this.$uvGetRect(`#${this.elId}`).then((size) => {
resolve(size);
});
});
}
}
};
if (!Array) {
const _easycom_uv_cell2 = common_vendor.resolveComponent("uv-cell");
const _easycom_uv_line2 = common_vendor.resolveComponent("uv-line");
(_easycom_uv_cell2 + _easycom_uv_line2)();
}
const _easycom_uv_cell = () => "../uv-cell/uv-cell.js";
const _easycom_uv_line = () => "../uv-line/uv-line.js";
if (!Math) {
(_easycom_uv_cell + _easycom_uv_line)();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: common_vendor.o($options.clickHandler),
b: common_vendor.p({
title: _ctx.title,
value: _ctx.value,
label: _ctx.label,
icon: _ctx.icon,
isLink: _ctx.isLink,
clickable: _ctx.clickable,
border: $data.parentData.border && $data.showBorder,
arrowDirection: $data.expanded ? "up" : "down",
disabled: _ctx.disabled
}),
c: $data.elId,
d: $data.elId,
e: $data.animationData,
f: $data.parentData.border
}, $data.parentData.border ? {} : {});
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-b32ffb1f"]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../../../../.sourcemap/mp-weixin/node-modules/@climblee/uv-ui/components/uv-collapse-item/uv-collapse-item.js.map
@@ -0,0 +1,7 @@
{
"component": true,
"usingComponents": {
"uv-cell": "../uv-cell/uv-cell",
"uv-line": "../uv-line/uv-line"
}
}
@@ -0,0 +1 @@
<view class="uv-collapse-item data-v-b32ffb1f"><uv-cell wx:if="{{b}}" class="data-v-b32ffb1f" bindclick="{{a}}" u-i="b32ffb1f-0" bind:__l="__l" u-p="{{b}}"></uv-cell><view class="uv-collapse-item__content data-v-b32ffb1f" animation="{{e}}" ref="animation"><view class="uv-collapse-item__content__text content-class data-v-b32ffb1f" id="{{c}}" ref="{{d}}"><slot/></view></view><uv-line wx:if="{{f}}" class="data-v-b32ffb1f" u-i="b32ffb1f-1" bind:__l="__l"></uv-line></view>
@@ -0,0 +1,44 @@
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
view.data-v-b32ffb1f, scroll-view.data-v-b32ffb1f, swiper-item.data-v-b32ffb1f {
display: flex;
flex-direction: column;
flex-shrink: 0;
flex-grow: 0;
flex-basis: auto;
align-items: stretch;
align-content: flex-start;
}
.uv-collapse-item__content.data-v-b32ffb1f {
overflow: hidden;
height: 0;
}
.uv-collapse-item__content__text.data-v-b32ffb1f {
padding: 12px 15px;
color: #606266;
font-size: 14px;
line-height: 18px;
}
@@ -0,0 +1,76 @@
"use strict";
const common_vendor = require("../../../../../common/vendor.js");
const _sfc_main = {
name: "uv-collapse",
mixins: [common_vendor.mpMixin, common_vendor.mixin, common_vendor.props$2],
watch: {
needInit() {
this.init();
},
// 当父组件需要子组件需要共享的参数发生了变化,手动通知子组件
parentData() {
if (this.children.length) {
this.children.map((child) => {
typeof child.updateParentData === "function" && child.updateParentData();
});
}
}
},
created() {
this.children = [];
},
computed: {
needInit() {
return [this.accordion, this.value];
}
},
methods: {
// 重新初始化一次内部的所有子元素
init() {
this.children.map((child) => {
child.init();
});
},
/**
* collapse-item被点击时触发,由collapse统一处理各子组件的状态
* @param {Object} target 被操作的面板的实例
*/
onChange(target) {
let changeArr = [];
this.children.map((child, index) => {
if (this.accordion) {
child.expanded = child === target ? !target.expanded : false;
child.setContentAnimate();
} else {
if (child === target) {
child.expanded = !child.expanded;
child.setContentAnimate();
}
}
changeArr.push({
// 如果没有定义name属性,则默认返回组件的index索引
name: child.name || index,
status: child.expanded ? "open" : "close"
});
});
this.$emit("change", changeArr);
this.$emit(target.expanded ? "open" : "close", target.name);
}
}
};
if (!Array) {
const _easycom_uv_line2 = common_vendor.resolveComponent("uv-line");
_easycom_uv_line2();
}
const _easycom_uv_line = () => "../uv-line/uv-line.js";
if (!Math) {
_easycom_uv_line();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: _ctx.border
}, _ctx.border ? {} : {});
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../../../../.sourcemap/mp-weixin/node-modules/@climblee/uv-ui/components/uv-collapse/uv-collapse.js.map
@@ -0,0 +1,6 @@
{
"component": true,
"usingComponents": {
"uv-line": "../uv-line/uv-line"
}
}
@@ -0,0 +1 @@
<view class="uv-collapse"><uv-line wx:if="{{a}}" u-i="544d1ba4-0" bind:__l="__l"></uv-line><slot/></view>
@@ -0,0 +1,112 @@
"use strict";
const common_vendor = require("../../../../../common/vendor.js");
const _sfc_main = {
emits: ["click", "close", "change"],
mixins: [common_vendor.mpMixin, common_vendor.mixin, common_vendor.props$2],
watch: {
text: {
immediate: true,
handler(newValue, oldValue) {
if (!this.$uv.test.array(newValue)) {
this.$uv.error("noticebar组件direction为column时,要求text参数为数组形式");
}
}
}
},
computed: {
// 文字内容的样式
textStyle() {
let style = {};
style.color = this.color;
style.fontSize = this.$uv.addUnit(this.fontSize);
return style;
},
// 垂直或者水平滚动
vertical() {
if (this.mode == "horizontal")
return false;
else
return true;
},
// NVUE中的swiper在css中样式不生效
swiperStyle() {
const style = {};
return style;
}
},
data() {
return {
index: 0
};
},
methods: {
noticeChange(e) {
this.index = e.detail.current;
this.$emit("change", this.index);
},
// 点击通告栏
clickHandler() {
this.$emit("click", this.index);
},
// 点击关闭按钮
close() {
this.$emit("close");
}
}
};
if (!Array) {
const _easycom_uv_icon2 = common_vendor.resolveComponent("uv-icon");
_easycom_uv_icon2();
}
const _easycom_uv_icon = () => "../uv-icon/uv-icon.js";
if (!Math) {
_easycom_uv_icon();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: _ctx.icon
}, _ctx.icon ? {
b: common_vendor.p({
name: _ctx.icon,
color: _ctx.color,
size: "19"
})
} : {}, {
c: common_vendor.f(_ctx.text, (item, index, i0) => {
return {
a: common_vendor.t(item),
b: index
};
}),
d: common_vendor.s($options.textStyle),
e: _ctx.disableTouch,
f: _ctx.step ? false : true,
g: _ctx.duration,
h: !_ctx.disableScroll,
i: common_vendor.s($options.swiperStyle),
j: common_vendor.o((...args) => $options.noticeChange && $options.noticeChange(...args)),
k: ["link", "closable"].includes(_ctx.mode)
}, ["link", "closable"].includes(_ctx.mode) ? common_vendor.e({
l: _ctx.mode === "link"
}, _ctx.mode === "link" ? {
m: common_vendor.p({
name: "arrow-right",
size: 17,
color: _ctx.color
})
} : {}, {
n: _ctx.mode === "closable"
}, _ctx.mode === "closable" ? {
o: common_vendor.o($options.close),
p: common_vendor.p({
name: "close",
size: 16,
color: _ctx.color
})
} : {}) : {}, {
q: common_vendor.o((...args) => $options.clickHandler && $options.clickHandler(...args))
});
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-edae50b8"]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../../../../.sourcemap/mp-weixin/node-modules/@climblee/uv-ui/components/uv-column-notice/uv-column-notice.js.map
@@ -0,0 +1,6 @@
{
"component": true,
"usingComponents": {
"uv-icon": "../uv-icon/uv-icon"
}
}
@@ -0,0 +1 @@
<view class="uv-notice data-v-edae50b8" bindtap="{{q}}"><block wx:if="{{$slots.icon}}"><slot name="icon"></slot></block><block wx:else><view wx:if="{{a}}" class="uv-notice__left-icon data-v-edae50b8"><uv-icon wx:if="{{b}}" class="data-v-edae50b8" u-i="edae50b8-0" bind:__l="__l" u-p="{{b}}"></uv-icon></view></block><swiper disable-touch="{{e}}" vertical="{{f}}" circular interval="{{g}}" autoplay="{{h}}" class="uv-notice__swiper data-v-edae50b8" style="{{i}}" bindchange="{{j}}"><swiper-item wx:for="{{c}}" wx:for-item="item" wx:key="b" class="uv-notice__swiper__item data-v-edae50b8"><text class="uv-notice__swiper__item__text uv-line-1 data-v-edae50b8" style="{{d}}">{{item.a}}</text></swiper-item></swiper><view wx:if="{{k}}" class="uv-notice__right-icon data-v-edae50b8"><uv-icon wx:if="{{l}}" class="data-v-edae50b8" u-i="edae50b8-1" bind:__l="__l" u-p="{{m}}"></uv-icon><uv-icon wx:if="{{n}}" class="data-v-edae50b8" bindclick="{{o}}" u-i="edae50b8-2" bind:__l="__l" u-p="{{p}}"></uv-icon></view></view>
@@ -0,0 +1,105 @@
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
.uv-line-1.data-v-edae50b8 {
display: -webkit-box !important;
overflow: hidden;
text-overflow: ellipsis;
word-break: break-all;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical !important;
}
.uv-line-2.data-v-edae50b8 {
display: -webkit-box !important;
overflow: hidden;
text-overflow: ellipsis;
word-break: break-all;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical !important;
}
.uv-line-3.data-v-edae50b8 {
display: -webkit-box !important;
overflow: hidden;
text-overflow: ellipsis;
word-break: break-all;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical !important;
}
.uv-line-4.data-v-edae50b8 {
display: -webkit-box !important;
overflow: hidden;
text-overflow: ellipsis;
word-break: break-all;
-webkit-line-clamp: 4;
-webkit-box-orient: vertical !important;
}
.uv-line-5.data-v-edae50b8 {
display: -webkit-box !important;
overflow: hidden;
text-overflow: ellipsis;
word-break: break-all;
-webkit-line-clamp: 5;
-webkit-box-orient: vertical !important;
}
view.data-v-edae50b8, scroll-view.data-v-edae50b8, swiper-item.data-v-edae50b8 {
display: flex;
flex-direction: column;
flex-shrink: 0;
flex-grow: 0;
flex-basis: auto;
align-items: stretch;
align-content: flex-start;
}
.uv-notice.data-v-edae50b8 {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
}
.uv-notice__left-icon.data-v-edae50b8 {
align-items: center;
margin-right: 5px;
}
.uv-notice__right-icon.data-v-edae50b8 {
margin-left: 5px;
align-items: center;
}
.uv-notice__swiper.data-v-edae50b8 {
height: 16px;
display: flex;
flex-direction: row;
align-items: center;
flex: 1;
}
.uv-notice__swiper__item.data-v-edae50b8 {
display: flex;
flex-direction: row;
align-items: center;
overflow: hidden;
}
.uv-notice__swiper__item__text.data-v-edae50b8 {
font-size: 14px;
color: #f9ae3d;
}
@@ -0,0 +1,95 @@
"use strict";
const common_vendor = require("../../../../../common/vendor.js");
const _sfc_main = {
name: "uv-icon",
emits: ["click"],
mixins: [common_vendor.mpMixin, common_vendor.mixin, common_vendor.props$1],
data() {
return {
colorType: [
"primary",
"success",
"info",
"error",
"warning"
]
};
},
computed: {
uClasses() {
let classes = [];
classes.push(this.customPrefix);
classes.push(this.customPrefix + "-" + this.name);
if (this.color && this.colorType.includes(this.color))
classes.push("uv-icon__icon--" + this.color);
return classes;
},
iconStyle() {
let style = {};
style = {
fontSize: this.$uv.addUnit(this.size),
lineHeight: this.$uv.addUnit(this.size),
fontWeight: this.bold ? "bold" : "normal",
// 某些特殊情况需要设置一个到顶部的距离,才能更好的垂直居中
top: this.$uv.addUnit(this.top)
};
if (this.color && !this.colorType.includes(this.color))
style.color = this.color;
return style;
},
// 判断传入的name属性,是否图片路径,只要带有"/"均认为是图片形式
isImg() {
const isBase64 = this.name.indexOf("data:") > -1 && this.name.indexOf("base64") > -1;
return this.name.indexOf("/") !== -1 || isBase64;
},
imgStyle() {
let style = {};
style.width = this.width ? this.$uv.addUnit(this.width) : this.$uv.addUnit(this.size);
style.height = this.height ? this.$uv.addUnit(this.height) : this.$uv.addUnit(this.size);
return style;
},
// 通过图标名,查找对应的图标
icon() {
const code = common_vendor.icons["uvicon-" + this.name];
return code ? unescape(`%u${code}`) : ["uvicon"].indexOf(this.customPrefix) > -1 ? this.name : "";
}
},
methods: {
clickHandler(e) {
this.$emit("click", this.index);
this.stop && this.preventEvent(e);
}
}
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: $options.isImg
}, $options.isImg ? {
b: _ctx.name,
c: _ctx.imgMode,
d: common_vendor.s($options.imgStyle),
e: common_vendor.s(_ctx.$uv.addStyle(_ctx.customStyle))
} : {
f: common_vendor.t($options.icon),
g: common_vendor.n($options.uClasses),
h: common_vendor.s($options.iconStyle),
i: common_vendor.s(_ctx.$uv.addStyle(_ctx.customStyle)),
j: _ctx.hoverClass
}, {
k: _ctx.label !== ""
}, _ctx.label !== "" ? {
l: common_vendor.t(_ctx.label),
m: _ctx.labelColor,
n: _ctx.$uv.addUnit(_ctx.labelSize),
o: _ctx.labelPos == "right" ? _ctx.$uv.addUnit(_ctx.space) : 0,
p: _ctx.labelPos == "bottom" ? _ctx.$uv.addUnit(_ctx.space) : 0,
q: _ctx.labelPos == "left" ? _ctx.$uv.addUnit(_ctx.space) : 0,
r: _ctx.labelPos == "top" ? _ctx.$uv.addUnit(_ctx.space) : 0
} : {}, {
s: common_vendor.o((...args) => $options.clickHandler && $options.clickHandler(...args)),
t: common_vendor.n("uv-icon--" + _ctx.labelPos)
});
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-7cc7ad3f"]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../../../../.sourcemap/mp-weixin/node-modules/@climblee/uv-ui/components/uv-icon/uv-icon.js.map
@@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}
@@ -0,0 +1 @@
<view bindtap="{{s}}" class="{{['uv-icon', 'data-v-7cc7ad3f', t]}}"><image wx:if="{{a}}" class="uv-icon__img data-v-7cc7ad3f" src="{{b}}" mode="{{c}}" style="{{d + ';' + e}}"></image><text wx:else class="{{['uv-icon__icon', 'data-v-7cc7ad3f', g]}}" style="{{h + ';' + i}}" hover-class="{{j}}">{{f}}</text><text wx:if="{{k}}" class="uv-icon__label data-v-7cc7ad3f" style="{{'color:' + m + ';' + ('font-size:' + n) + ';' + ('margin-left:' + o) + ';' + ('margin-top:' + p) + ';' + ('margin-right:' + q) + ';' + ('margin-bottom:' + r)}}">{{l}}</text></view>
File diff suppressed because one or more lines are too long
@@ -0,0 +1,35 @@
"use strict";
const common_vendor = require("../../../../../common/vendor.js");
const _sfc_main = {
name: "uv-line",
mixins: [common_vendor.mpMixin, common_vendor.mixin, common_vendor.props$7],
computed: {
lineStyle() {
const style = {};
style.margin = this.margin;
if (this.direction === "row") {
style.borderBottomWidth = "1px";
style.borderBottomStyle = this.dashed ? "dashed" : "solid";
style.width = this.$uv.addUnit(this.length);
if (this.hairline)
style.transform = "scaleY(0.5)";
} else {
style.borderLeftWidth = "1px";
style.borderLeftStyle = this.dashed ? "dashed" : "solid";
style.height = this.$uv.addUnit(this.length);
if (this.hairline)
style.transform = "scaleX(0.5)";
}
style.borderColor = this.color;
return this.$uv.deepMerge(style, this.$uv.addStyle(this.customStyle));
}
}
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return {
a: common_vendor.s($options.lineStyle)
};
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-0a68c4fc"]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../../../../.sourcemap/mp-weixin/node-modules/@climblee/uv-ui/components/uv-line/uv-line.js.map
@@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}
@@ -0,0 +1 @@
<view class="uv-line data-v-0a68c4fc" style="{{a}}"></view>
@@ -0,0 +1,28 @@
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
.uv-line.data-v-0a68c4fc {
vertical-align: middle;
}
@@ -0,0 +1,85 @@
"use strict";
const common_vendor = require("../../../../../common/vendor.js");
const _sfc_main = {
name: "uv-notice-bar",
emits: ["click", "close", "change"],
mixins: [common_vendor.mpMixin, common_vendor.mixin, common_vendor.props],
data() {
return {
show: true
};
},
methods: {
// 点击通告栏
click(index) {
this.$emit("click", index);
if (this.url && this.linkType) {
this.openPage();
}
},
// 点击关闭按钮
close() {
this.show = false;
this.$emit("close");
},
// 竖向滚动时触发
change(index) {
this.$emit("change", index);
}
}
};
if (!Array) {
const _easycom_uv_column_notice2 = common_vendor.resolveComponent("uv-column-notice");
const _easycom_uv_row_notice2 = common_vendor.resolveComponent("uv-row-notice");
(_easycom_uv_column_notice2 + _easycom_uv_row_notice2)();
}
const _easycom_uv_column_notice = () => "../uv-column-notice/uv-column-notice.js";
const _easycom_uv_row_notice = () => "../uv-row-notice/uv-row-notice.js";
if (!Math) {
(_easycom_uv_column_notice + _easycom_uv_row_notice)();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: $data.show
}, $data.show ? common_vendor.e({
b: _ctx.direction === "column" || _ctx.direction === "row" && _ctx.step
}, _ctx.direction === "column" || _ctx.direction === "row" && _ctx.step ? {
c: common_vendor.o($options.close),
d: common_vendor.o($options.click),
e: common_vendor.o($options.change),
f: common_vendor.p({
color: _ctx.color,
bgColor: _ctx.bgColor,
text: _ctx.text,
mode: _ctx.mode,
step: _ctx.step,
icon: _ctx.icon,
["disable-touch"]: _ctx.disableTouch,
["disable-scroll"]: _ctx.disableScroll,
fontSize: _ctx.fontSize,
duration: _ctx.duration
})
} : {
g: common_vendor.o($options.close),
h: common_vendor.o($options.click),
i: common_vendor.p({
color: _ctx.color,
bgColor: _ctx.bgColor,
text: _ctx.text,
mode: _ctx.mode,
fontSize: _ctx.fontSize,
speed: _ctx.speed,
url: _ctx.url,
linkType: _ctx.linkType,
icon: _ctx.icon
})
}, {
j: common_vendor.s({
backgroundColor: _ctx.bgColor
}),
k: common_vendor.s(_ctx.$uv.addStyle(_ctx.customStyle))
}) : {});
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-47251d11"]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../../../../.sourcemap/mp-weixin/node-modules/@climblee/uv-ui/components/uv-notice-bar/uv-notice-bar.js.map
@@ -0,0 +1,7 @@
{
"component": true,
"usingComponents": {
"uv-column-notice": "../uv-column-notice/uv-column-notice",
"uv-row-notice": "../uv-row-notice/uv-row-notice"
}
}
@@ -0,0 +1 @@
<view wx:if="{{a}}" class="uv-notice-bar data-v-47251d11" style="{{j + ';' + k}}"><block wx:if="{{b}}"><uv-column-notice wx:if="{{f}}" class="data-v-47251d11" bindclose="{{c}}" bindclick="{{d}}" bindchange="{{e}}" u-i="47251d11-0" bind:__l="__l" u-p="{{f}}"></uv-column-notice></block><block wx:else><uv-row-notice wx:if="{{i}}" class="data-v-47251d11" bindclose="{{g}}" bindclick="{{h}}" u-i="47251d11-1" bind:__l="__l" u-p="{{i}}"></uv-row-notice></block></view>
@@ -0,0 +1,39 @@
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
view.data-v-47251d11, scroll-view.data-v-47251d11, swiper-item.data-v-47251d11 {
display: flex;
flex-direction: column;
flex-shrink: 0;
flex-grow: 0;
flex-basis: auto;
align-items: stretch;
align-content: flex-start;
}
.uv-notice-bar.data-v-47251d11 {
overflow: hidden;
padding: 9px 12px;
flex: 1;
}
@@ -0,0 +1,150 @@
"use strict";
const common_vendor = require("../../../../../common/vendor.js");
const _sfc_main = {
name: "uv-row-notice",
emits: ["click", "close"],
mixins: [common_vendor.mpMixin, common_vendor.mixin, common_vendor.props$3],
data() {
return {
animationDuration: "0",
// 动画执行时间
animationPlayState: "paused",
// 动画的开始和结束执行
// nvue下,内容发生变化,导致滚动宽度也变化,需要标志为是否需要重新计算宽度
// 不能在内容变化时直接重新计算,因为nvue的animation模块上一次的滚动不是刚好结束,会有影响
nvueInit: true,
show: true
};
},
watch: {
text: {
immediate: true,
handler(newValue, oldValue) {
this.vue();
if (!this.$uv.test.string(newValue)) {
this.$uv.error("noticebar组件direction为row时,要求text参数为字符串形式");
}
}
},
fontSize() {
this.vue();
},
speed() {
this.vue();
}
},
computed: {
// 文字内容的样式
textStyle() {
let style = {};
style.color = this.color;
style.fontSize = this.$uv.addUnit(this.fontSize);
return style;
},
animationStyle() {
let style = {};
style.animationDuration = this.animationDuration;
style.animationPlayState = this.animationPlayState;
return style;
},
// 内部对用户传入的数据进一步分割,放到多个text标签循环,否则如果用户传入的字符串很长(100个字符以上)
// 放在一个text标签中进行滚动,在低端安卓机上,动画可能会出现抖动现象,需要分割到多个text中可解决此问题
innerText() {
let result = [], len = 20;
const textArr = this.text ? this.text.split("") : [];
for (let i = 0; i < textArr.length; i += len) {
result.push(textArr.slice(i, i + len).join(""));
}
return result;
}
},
mounted() {
this.init();
},
methods: {
init() {
this.vue();
if (!this.$uv.test.string(this.text)) {
this.$uv.error("noticebar组件direction为row时,要求text参数为字符串形式");
}
},
// vue版处理
async vue() {
let textWidth = 0;
await this.$uv.sleep();
textWidth = (await this.$uvGetRect(".uv-notice__content__text")).width;
(await this.$uvGetRect(".uv-notice__content")).width;
this.animationDuration = `${textWidth / this.$uv.getPx(this.speed)}s`;
this.animationPlayState = "paused";
setTimeout(() => {
this.animationPlayState = "running";
}, 10);
},
// nvue版处理
async nvue() {
},
loopAnimation(textWidth, boxWidth) {
},
getNvueRect(el) {
},
// 点击通告栏
clickHandler(index) {
this.$emit("click");
},
// 点击右侧按钮,需要判断点击的是关闭图标还是箭头图标
close() {
this.$emit("close");
}
}
};
if (!Array) {
const _easycom_uv_icon2 = common_vendor.resolveComponent("uv-icon");
_easycom_uv_icon2();
}
const _easycom_uv_icon = () => "../uv-icon/uv-icon.js";
if (!Math) {
_easycom_uv_icon();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: _ctx.icon
}, _ctx.icon ? {
b: common_vendor.p({
name: _ctx.icon,
color: _ctx.color,
size: "19"
})
} : {}, {
c: common_vendor.f($options.innerText, (item, index, i0) => {
return {
a: common_vendor.t(item),
b: index
};
}),
d: common_vendor.s($options.textStyle),
e: common_vendor.s($options.animationStyle),
f: ["link", "closable"].includes(_ctx.mode)
}, ["link", "closable"].includes(_ctx.mode) ? common_vendor.e({
g: _ctx.mode === "link"
}, _ctx.mode === "link" ? {
h: common_vendor.p({
name: "arrow-right",
size: 17,
color: _ctx.color
})
} : {}, {
i: _ctx.mode === "closable"
}, _ctx.mode === "closable" ? {
j: common_vendor.o($options.close),
k: common_vendor.p({
name: "close",
size: 16,
color: _ctx.color
})
} : {}) : {}, {
l: common_vendor.o((...args) => $options.clickHandler && $options.clickHandler(...args))
});
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-c6b51d8b"]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../../../../.sourcemap/mp-weixin/node-modules/@climblee/uv-ui/components/uv-row-notice/uv-row-notice.js.map
@@ -0,0 +1,6 @@
{
"component": true,
"usingComponents": {
"uv-icon": "../uv-icon/uv-icon"
}
}
@@ -0,0 +1 @@
<view class="uv-notice data-v-c6b51d8b" bindtap="{{l}}"><block wx:if="{{$slots.icon}}"><slot name="icon"></slot></block><block wx:else><view wx:if="{{a}}" class="uv-notice__left-icon data-v-c6b51d8b"><uv-icon wx:if="{{b}}" class="data-v-c6b51d8b" u-i="c6b51d8b-0" bind:__l="__l" u-p="{{b}}"></uv-icon></view></block><view class="uv-notice__content data-v-c6b51d8b" ref="uv-notice__content"><view ref="uv-notice__content__text" class="uv-notice__content__text data-v-c6b51d8b" style="{{e}}"><text wx:for="{{c}}" wx:for-item="item" wx:key="b" class="data-v-c6b51d8b" style="{{d}}">{{item.a}}</text></view></view><view wx:if="{{f}}" class="uv-notice__right-icon data-v-c6b51d8b"><uv-icon wx:if="{{g}}" class="data-v-c6b51d8b" u-i="c6b51d8b-1" bind:__l="__l" u-p="{{h}}"></uv-icon><uv-icon wx:if="{{i}}" class="data-v-c6b51d8b" bindclick="{{j}}" u-i="c6b51d8b-2" bind:__l="__l" u-p="{{k}}"></uv-icon></view></view>
@@ -0,0 +1,74 @@
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
view.data-v-c6b51d8b, scroll-view.data-v-c6b51d8b, swiper-item.data-v-c6b51d8b {
display: flex;
flex-direction: column;
flex-shrink: 0;
flex-grow: 0;
flex-basis: auto;
align-items: stretch;
align-content: flex-start;
}
.uv-notice.data-v-c6b51d8b {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
}
.uv-notice__left-icon.data-v-c6b51d8b {
align-items: center;
margin-right: 5px;
}
.uv-notice__right-icon.data-v-c6b51d8b {
margin-left: 5px;
align-items: center;
}
.uv-notice__content.data-v-c6b51d8b {
text-align: right;
flex: 1;
display: flex;
flex-direction: row;
flex-wrap: nowrap;
overflow: hidden;
}
.uv-notice__content__text.data-v-c6b51d8b {
font-size: 14px;
color: #f9ae3d;
padding-left: 100%;
word-break: keep-all;
white-space: nowrap;
animation: uv-loop-animation-c6b51d8b 10s linear infinite both;
display: flex;
flex-direction: row;
}
@keyframes uv-loop-animation-c6b51d8b {
0% {
transform: translate3d(0, 0, 0);
}
100% {
transform: translate3d(-100%, 0, 0);
}
}
+2 -2
View File
@@ -295,14 +295,14 @@ const _sfc_main = {
a: common_vendor.t(deviceStatus.text),
b: common_vendor.n(deviceStatus.class),
c: common_vendor.t(deviceId.value),
d: common_assets._imports_0$3,
d: common_assets._imports_0$4,
e: common_vendor.t(deviceLocation.value),
f: common_vendor.t(deviceFeeConfig.value.maxHourPrice),
g: common_vendor.t(deviceInfo.value.depositAmount),
h: common_vendor.t(hasActiveOrder.value ? "归还设备" : "免押租借"),
i: hasActiveOrder.value ? 1 : "",
j: common_vendor.o(($event) => handleRent("wx-score-pay")),
k: common_assets._imports_0$2,
k: common_assets._imports_0$3,
l: showPhoneAuthPopup.value
}, showPhoneAuthPopup.value ? {
m: common_vendor.o(() => {
+132 -64
View File
@@ -4,9 +4,16 @@ const common_assets = require("../../common/assets.js");
const util_index = require("../../util/index.js");
const config_url = require("../../config/url.js");
const config_user = require("../../config/user.js");
const utils_amap = require("../../utils/amap.js");
const utils_mapUtils = require("../../utils/mapUtils.js");
if (!Array) {
const _easycom_uv_notice_bar2 = common_vendor.resolveComponent("uv-notice-bar");
const _easycom_uv_icon2 = common_vendor.resolveComponent("uv-icon");
(_easycom_uv_notice_bar2 + _easycom_uv_icon2)();
}
const _easycom_uv_notice_bar = () => "../../node-modules/@climblee/uv-ui/components/uv-notice-bar/uv-notice-bar.js";
const _easycom_uv_icon = () => "../../node-modules/@climblee/uv-ui/components/uv-icon/uv-icon.js";
if (!Math) {
MapComponent();
(_easycom_uv_notice_bar + MapComponent + _easycom_uv_icon)();
}
const MapComponent = () => "../../components/MapComponent.js";
const _sfc_main = {
@@ -21,6 +28,32 @@ const _sfc_main = {
const showPhoneAuthPopup = common_vendor.ref(false);
const isLocationInitialized = common_vendor.ref(false);
const showLocationPopup = common_vendor.ref(false);
const guideSteps = common_vendor.ref([
{
title: "扫码使用",
desc: "找到附近设备,扫描设备上的二维码即可开始租借"
},
{
title: "免押金支付",
desc: "无需支付押金,使用支付分免押即可完成租借"
},
{
title: "开始使用",
desc: "设备自动解锁,风扇弹出后取出即可开始使用"
},
{
title: "归还设备",
desc: "使用完毕后,按照设备规格要求将风扇还入即可结束订单"
}
]);
const noticeText = common_vendor.ref("消费规则:每小时5元,不足1小时按1小时计费,最高24小时封顶,请爱护设备,使用后请及时归还");
const formatDistance = (distanceInMeters) => {
if (distanceInMeters < 1e3) {
return `${Math.round(distanceInMeters)}m`;
} else {
return `${(distanceInMeters / 1e3).toFixed(1)}km`;
}
};
const mapRef = common_vendor.ref(null);
common_vendor.computed(() => {
if (userLocation.value && userLocation.value.address) {
@@ -36,51 +69,63 @@ const _sfc_main = {
const init = async () => {
isLoading.value = true;
try {
await getUserLocation();
if (true) {
utils_mapUtils.testDistanceCalculation();
}
await getUserLocationAndAddress();
await loadPositions();
} catch (error) {
common_vendor.index.__f__("error", "at pages/index/index.vue:177", "初始化失败:", error);
common_vendor.index.__f__("error", "at pages/index/index.vue:241", "初始化失败:", error);
await loadPositions();
} finally {
isLoading.value = false;
}
};
const getUserLocation = async () => {
const getUserLocationAndAddress = async () => {
try {
const location = await new Promise((resolve, reject) => {
common_vendor.index.getLocation({
type: "gcj02",
success: resolve,
fail: reject
});
});
const location = await utils_mapUtils.getUserLocation();
userLocation.value = {
longitude: location.longitude,
latitude: location.latitude
};
try {
common_vendor.index.setStorageSync("userLocation", {
longitude: location.longitude,
latitude: location.latitude
});
} catch (e) {
common_vendor.index.__f__("warn", "at pages/index/index.vue:267", "缓存基础定位信息失败:", e);
}
if (!isLocationInitialized.value) {
isLocationInitialized.value = true;
}
try {
const addressResult = await utils_amap.AmapUtil.regeocode(location.longitude, location.latitude);
const addressResult = await utils_mapUtils.getRegeo(location.longitude, location.latitude);
if (addressResult.success) {
const addressInfo = addressResult.data;
userLocation.value.address = addressInfo.formatted_address;
userLocation.value.city = addressInfo.addressComponent.city;
userLocation.value.district = addressInfo.addressComponent.district;
try {
common_vendor.index.setStorageSync("userLocation", {
longitude: userLocation.value.longitude,
latitude: userLocation.value.latitude,
address: userLocation.value.address,
city: userLocation.value.city,
district: userLocation.value.district
});
} catch (e) {
common_vendor.index.__f__("warn", "at pages/index/index.vue:294", "缓存带地址的定位信息失败:", e);
}
}
} catch (error) {
}
setTimeout(async () => {
await loadPositions();
common_vendor.index.hideLoading();
common_vendor.index.showToast({
title: "定位成功",
icon: "success"
});
}, 800);
} catch (error) {
common_vendor.index.__f__("error", "at pages/index/index.vue:231", "获取位置失败:", error);
common_vendor.index.__f__("error", "at pages/index/index.vue:309", "获取位置失败:", error);
common_vendor.index.showToast({
title: "获取位置失败,显示默认地图",
icon: "none"
@@ -93,11 +138,15 @@ const _sfc_main = {
await util_index.wxLogin();
}
const res = await common_vendor.index.request({
url: `${config_url.URL}/device/position/list`,
url: `${config_url.URL}/device/position/app/list`,
method: "GET",
header: {
"Authorization": "Bearer " + common_vendor.index.getStorageSync("token"),
"Clientid": common_vendor.index.getStorageSync("client_id")
},
data: {
latitude: userLocation.value.latitude,
longitude: userLocation.value.longitude
}
});
if (res.statusCode === 200 && res.data.code === 200) {
@@ -105,13 +154,13 @@ const _sfc_main = {
calculateDistances();
filteredPositions.value = [...positionList.value];
} else {
common_vendor.index.__f__("error", "at pages/index/index.vue:259", "获取场地列表失败:", res.data.msg);
common_vendor.index.__f__("error", "at pages/index/index.vue:341", "获取场地列表失败:", res.data.msg);
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/index/index.vue:262", "获取场地列表异常:", error);
common_vendor.index.__f__("error", "at pages/index/index.vue:344", "获取场地列表异常:", error);
}
};
const calculateDistances = (centerPoint = null) => {
const calculateDistances = async (centerPoint = null) => {
var _a;
const center = centerPoint || userLocation.value || ((_a = mapRef.value) == null ? void 0 : _a.mapCenter);
if (!center || typeof center.longitude === "undefined" || typeof center.latitude === "undefined") {
@@ -120,21 +169,23 @@ const _sfc_main = {
positionList.value.forEach((item) => {
if (item.longitude && item.latitude) {
try {
const distance = utils_amap.AmapUtil.calculateDistance(
const distanceInMeters = utils_mapUtils.calculateDistanceSync(
center.latitude,
center.longitude,
parseFloat(item.latitude),
parseFloat(item.longitude)
);
item.distance = distance.toFixed(1);
item.distance = formatDistance(distanceInMeters);
item.distanceInMeters = distanceInMeters;
} catch (error) {
common_vendor.index.__f__("error", "at pages/index/index.vue:286", "计算距离异常:", error, item);
item.distance = "999.0";
common_vendor.index.__f__("error", "at pages/index/index.vue:372", "计算距离异常:", error, item);
item.distance = "999.0km";
item.distanceInMeters = 999e3;
}
}
});
positionList.value.sort((a, b) => {
return (parseFloat(a.distance) || 999) - (parseFloat(b.distance) || 999);
return (a.distanceInMeters || 999e3) - (b.distanceInMeters || 999e3);
});
};
const loadPositionsByCenter = async (center) => {
@@ -153,21 +204,23 @@ const _sfc_main = {
if (res.statusCode === 200 && res.data.code === 200) {
positionList.value = res.data.rows || [];
calculateDistances(center);
const maxDistance = 10;
const maxDistanceInMeters = 1e4;
filteredPositions.value = positionList.value.filter((item) => {
return !item.distance || parseFloat(item.distance) <= maxDistance;
return !item.distanceInMeters || item.distanceInMeters <= maxDistanceInMeters;
});
} else {
common_vendor.index.__f__("error", "at pages/index/index.vue:326", "根据地图中心加载场地失败:", res.data.msg);
common_vendor.index.__f__("error", "at pages/index/index.vue:413", "根据地图中心加载场地失败:", res.data.msg);
positionList.value = [];
filteredPositions.value = [];
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/index/index.vue:331", "根据地图中心加载场地异常:", error);
common_vendor.index.__f__("error", "at pages/index/index.vue:418", "根据地图中心加载场地异常:", error);
}
};
const handleRelocate = async () => {
common_vendor.index.showLoading({ title: "定位中..." });
common_vendor.index.showLoading({
title: "定位中..."
});
common_vendor.index.reLaunch({
url: "/pages/index/index"
});
@@ -206,9 +259,6 @@ const _sfc_main = {
address: position.location
});
};
const toggleSheet = () => {
isExpanded.value = !isExpanded.value;
};
const handleScan = async () => {
try {
const scanResult = await new Promise((resolve, reject) => {
@@ -287,14 +337,14 @@ const _sfc_main = {
});
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/index/index.vue:492", "获取设备信息异常:", error);
common_vendor.index.__f__("error", "at pages/index/index.vue:581", "获取设备信息异常:", error);
common_vendor.index.navigateTo({
url: `/pages/device/detail?deviceNo=${deviceNo}`
});
}
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/index/index.vue:499", "扫码处理失败:", error);
common_vendor.index.__f__("error", "at pages/index/index.vue:588", "扫码处理失败:", error);
common_vendor.index.showToast({
title: "扫码失败",
icon: "none"
@@ -314,37 +364,56 @@ const _sfc_main = {
};
return (_ctx, _cache) => {
return common_vendor.e({
a: !isLoading.value && userLocation.value
a: common_assets._imports_0$1,
b: common_vendor.p({
text: noticeText.value,
mode: "link",
speed: 50,
["show-icon"]: true,
color: "#2196F3",
["bg-color"]: "#E3F2FD",
icon: "volume"
}),
c: !isLoading.value && userLocation.value
}, !isLoading.value && userLocation.value ? {
b: common_vendor.sr(mapRef, "1cf27b2a-0", {
d: common_vendor.sr(mapRef, "1cf27b2a-1", {
"k": "mapRef"
}),
c: common_vendor.o(handleRelocate),
d: common_vendor.o(handleScan),
e: common_vendor.o(showLocationList),
f: common_vendor.o(selectPosition),
g: common_vendor.o(onMapCenterChange),
h: common_vendor.p({
e: common_vendor.o(handleRelocate),
f: common_vendor.o(handleScan),
g: common_vendor.o(showLocationList),
h: common_vendor.o(selectPosition),
i: common_vendor.o(onMapCenterChange),
j: common_vendor.p({
userLocation: userLocation.value,
positionList: positionList.value,
filteredPositions: filteredPositions.value,
searchKeyword: searchKeyword.value
})
} : {}, {
i: isLoading.value || !userLocation.value
k: common_vendor.f(guideSteps.value, (step, index, i0) => {
return {
a: common_vendor.t(index + 1),
b: common_vendor.t(step.title),
c: common_vendor.t(step.desc),
d: index
};
}),
l: isLoading.value || !userLocation.value
}, isLoading.value || !userLocation.value ? {} : {}, {
j: showLocationPopup.value
m: showLocationPopup.value
}, showLocationPopup.value ? common_vendor.e({
k: common_vendor.o(hideLocationList),
l: common_vendor.o(toggleSheet),
m: common_vendor.t(filteredPositions.value.length),
n: common_assets._imports_0,
o: common_vendor.o(hideLocationList),
p: common_vendor.f(filteredPositions.value, (item, index, i0) => {
n: common_vendor.o(hideLocationList),
o: common_vendor.t(filteredPositions.value.length),
p: common_vendor.p({
name: "close"
}),
q: common_vendor.o(hideLocationList),
r: common_vendor.f(filteredPositions.value, (item, index, i0) => {
return common_vendor.e({
a: common_vendor.t(item.name),
b: common_vendor.t(item.describe),
c: common_vendor.t(item.location),
b: common_vendor.t(item.status === "online" ? "可租借/归还" : "不可租借/归还"),
c: common_vendor.n(item.status),
d: item.workTime && item.workTime !== "0"
}, item.workTime && item.workTime !== "0" ? {
e: common_vendor.t(item.workTime)
@@ -360,20 +429,19 @@ const _sfc_main = {
l: common_vendor.o(($event) => selectPositionFromPopup(item), item.positionId)
});
}),
q: common_assets._imports_0,
r: filteredPositions.value.length === 0 && !isLoading.value
s: filteredPositions.value.length === 0 && !isLoading.value
}, filteredPositions.value.length === 0 && !isLoading.value ? {
s: common_assets._imports_0
t: common_assets._imports_0
} : {}, {
t: isExpanded.value ? 1 : ""
v: isExpanded.value ? 1 : ""
}) : {}, {
v: isLoading.value
w: isLoading.value
}, isLoading.value ? {} : {}, {
w: showPhoneAuthPopup.value
x: showPhoneAuthPopup.value
}, showPhoneAuthPopup.value ? {
x: common_vendor.o(($event) => showPhoneAuthPopup.value = false),
y: common_vendor.o(onGetPhoneNumber),
z: common_vendor.o(($event) => showPhoneAuthPopup.value = false)
y: common_vendor.o(($event) => showPhoneAuthPopup.value = false),
z: common_vendor.o(onGetPhoneNumber),
A: common_vendor.o(($event) => showPhoneAuthPopup.value = false)
} : {});
};
}
+2
View File
@@ -1,6 +1,8 @@
{
"navigationBarTitleText": "附近场地",
"usingComponents": {
"uv-notice-bar": "../../node-modules/@climblee/uv-ui/components/uv-notice-bar/uv-notice-bar",
"uv-icon": "../../node-modules/@climblee/uv-ui/components/uv-icon/uv-icon",
"map-component": "../../components/MapComponent"
}
}
+1 -1
View File
@@ -1 +1 @@
<view class="container data-v-1cf27b2a"><map-component wx:if="{{a}}" class="r data-v-1cf27b2a" u-r="mapRef" bindrelocate="{{c}}" bindscan="{{d}}" bindshowList="{{e}}" bindmarkerTap="{{f}}" bindmapCenterChange="{{g}}" u-i="1cf27b2a-0" bind:__l="__l" u-p="{{h}}"/><view wx:if="{{i}}" class="map-loading-placeholder data-v-1cf27b2a"><view class="loading-content data-v-1cf27b2a"><view class="loading-spinner data-v-1cf27b2a"></view><text class="data-v-1cf27b2a">正在获取位置信息...</text></view></view><view wx:if="{{j}}" class="location-popup data-v-1cf27b2a"><view class="popup-mask data-v-1cf27b2a" bindtap="{{k}}"></view><view class="{{['location-sheet', 'data-v-1cf27b2a', t && 'expanded']}}"><view class="sheet-handle data-v-1cf27b2a" bindtap="{{l}}"><view class="handle-bar data-v-1cf27b2a"></view></view><view class="sheet-header data-v-1cf27b2a"><text class="sheet-title data-v-1cf27b2a">附近场地 ({{m}})</text><view class="close-btn data-v-1cf27b2a" bindtap="{{o}}"><image class="close-icon data-v-1cf27b2a" src="{{n}}" mode="aspectFit"/></view></view><scroll-view class="sheet-content data-v-1cf27b2a" scroll-y="true"><view wx:for="{{p}}" wx:for-item="item" wx:key="k" class="position-item data-v-1cf27b2a" bindtap="{{item.l}}"><view class="position-info data-v-1cf27b2a"><view class="position-name data-v-1cf27b2a">{{item.a}}</view><view class="position-desc data-v-1cf27b2a">{{item.b}}</view><view class="position-location data-v-1cf27b2a"><image class="location-icon-small data-v-1cf27b2a" src="{{q}}" mode="aspectFit"/><text class="data-v-1cf27b2a">{{item.c}}</text></view><view wx:if="{{item.d}}" class="position-time data-v-1cf27b2a"><text class="data-v-1cf27b2a">营业时间:{{item.e}}</text></view></view><view class="position-actions data-v-1cf27b2a"><view wx:if="{{item.f}}" class="distance-info data-v-1cf27b2a"><text class="data-v-1cf27b2a">{{item.g}}km</text></view><view class="{{['status-tag', 'data-v-1cf27b2a', item.i]}}"><text class="data-v-1cf27b2a">{{item.h}}</text></view><view class="nav-btn data-v-1cf27b2a" catchtap="{{item.j}}"><text class="data-v-1cf27b2a">导航</text></view></view></view><view wx:if="{{r}}" class="empty-state data-v-1cf27b2a"><image class="empty-icon data-v-1cf27b2a" src="{{s}}" mode="aspectFit"/><text class="empty-text data-v-1cf27b2a">暂无附近场地</text></view></scroll-view></view></view><view wx:if="{{v}}" class="loading-overlay data-v-1cf27b2a"><view class="loading-content data-v-1cf27b2a"><view class="loading-spinner data-v-1cf27b2a"></view><text class="data-v-1cf27b2a">正在获取场地信息...</text></view></view><view wx:if="{{w}}" class="phone-auth-popup data-v-1cf27b2a"><view class="popup-mask data-v-1cf27b2a" catchtap="{{x}}"></view><view class="popup-content data-v-1cf27b2a"><view class="popup-header data-v-1cf27b2a"><text class="popup-title data-v-1cf27b2a">授权获取手机号</text></view><view class="popup-body data-v-1cf27b2a"><view class="auth-desc data-v-1cf27b2a"><text class="data-v-1cf27b2a">为了提供更好的服务和紧急联系,需要授权获取您的手机号</text></view><button class="auth-btn data-v-1cf27b2a" open-type="getPhoneNumber" bindgetphonenumber="{{y}}"><text class="data-v-1cf27b2a">一键获取手机号</text></button><view class="auth-cancel data-v-1cf27b2a" bindtap="{{z}}"><text class="data-v-1cf27b2a">暂不授权</text></view></view></view></view></view>
<view class="container data-v-1cf27b2a"><view class="header-section data-v-1cf27b2a"><view class="logo-container data-v-1cf27b2a"><image class="logo-image data-v-1cf27b2a" src="{{a}}" mode="aspectFit"/><text class="app-name data-v-1cf27b2a">共享风扇</text></view><uv-notice-bar wx:if="{{b}}" class="data-v-1cf27b2a" u-i="1cf27b2a-0" bind:__l="__l" u-p="{{b}}"></uv-notice-bar></view><map-component wx:if="{{c}}" class="r data-v-1cf27b2a" u-r="mapRef" bindrelocate="{{e}}" bindscan="{{f}}" bindshowList="{{g}}" bindmarkerTap="{{h}}" bindmapCenterChange="{{i}}" u-i="1cf27b2a-1" bind:__l="__l" u-p="{{j}}"/><view class="steps-guide data-v-1cf27b2a"><view class="guide-header data-v-1cf27b2a"><text class="guide-title data-v-1cf27b2a">使用指南</text></view><view class="steps-container data-v-1cf27b2a"><view wx:for="{{k}}" wx:for-item="step" wx:key="d" class="step-item data-v-1cf27b2a"><view class="step-number data-v-1cf27b2a">{{step.a}}</view><view class="step-content data-v-1cf27b2a"><text class="step-title data-v-1cf27b2a">{{step.b}}</text><text class="step-desc data-v-1cf27b2a">{{step.c}}</text></view></view></view></view><view wx:if="{{l}}" class="map-loading-placeholder data-v-1cf27b2a"><view class="loading-content data-v-1cf27b2a"><view class="loading-spinner data-v-1cf27b2a"></view><text class="data-v-1cf27b2a">正在获取位置信息...</text></view></view><view wx:if="{{m}}" class="location-popup data-v-1cf27b2a"><view class="popup-mask data-v-1cf27b2a" bindtap="{{n}}"></view><view class="{{['location-sheet', 'data-v-1cf27b2a', v && 'expanded']}}"><view class="sheet-header data-v-1cf27b2a"><text class="sheet-title data-v-1cf27b2a">附近设备场地 ({{o}})</text><view class="close-btn data-v-1cf27b2a" bindtap="{{q}}"><uv-icon wx:if="{{p}}" class="data-v-1cf27b2a" u-i="1cf27b2a-2" bind:__l="__l" u-p="{{p}}"></uv-icon></view></view><scroll-view class="sheet-content data-v-1cf27b2a" scroll-y="true"><view wx:for="{{r}}" wx:for-item="item" wx:key="k" class="position-item data-v-1cf27b2a" bindtap="{{item.l}}"><view class="position-info data-v-1cf27b2a"><view class="position-name data-v-1cf27b2a">{{item.a}}</view><view class="{{['status-tag', 'data-v-1cf27b2a', item.c]}}"><text class="data-v-1cf27b2a">{{item.b}}</text></view><view wx:if="{{item.d}}" class="position-time data-v-1cf27b2a"><text class="data-v-1cf27b2a">营业时间:{{item.e}}</text></view></view><view class="position-actions data-v-1cf27b2a"><view wx:if="{{item.f}}" class="distance-info data-v-1cf27b2a"><text class="data-v-1cf27b2a">{{item.g}}</text></view><view class="{{['status-tag', 'data-v-1cf27b2a', item.i]}}"><text class="data-v-1cf27b2a">{{item.h}}</text></view><view class="nav-btn data-v-1cf27b2a" catchtap="{{item.j}}"><text class="data-v-1cf27b2a">导航</text></view></view></view><view wx:if="{{s}}" class="empty-state data-v-1cf27b2a"><image class="empty-icon data-v-1cf27b2a" src="{{t}}" mode="aspectFit"/><text class="empty-text data-v-1cf27b2a">附近5公里内暂无设备</text></view></scroll-view></view></view><view wx:if="{{w}}" class="loading-overlay data-v-1cf27b2a"><view class="loading-content data-v-1cf27b2a"><view class="loading-spinner data-v-1cf27b2a"></view><text class="data-v-1cf27b2a">正在获取场地信息...</text></view></view><view wx:if="{{x}}" class="phone-auth-popup data-v-1cf27b2a"><view class="popup-mask data-v-1cf27b2a" catchtap="{{y}}"></view><view class="popup-content data-v-1cf27b2a"><view class="popup-header data-v-1cf27b2a"><text class="popup-title data-v-1cf27b2a">授权获取手机号</text></view><view class="popup-body data-v-1cf27b2a"><view class="auth-desc data-v-1cf27b2a"><text class="data-v-1cf27b2a">为了提供更好的服务和紧急联系,需要授权获取您的手机号</text></view><button class="auth-btn data-v-1cf27b2a" open-type="getPhoneNumber" bindgetphonenumber="{{z}}"><text class="data-v-1cf27b2a">一键获取手机号</text></button><view class="auth-cancel data-v-1cf27b2a" bindtap="{{A}}"><text class="data-v-1cf27b2a">暂不授权</text></view></view></view></view></view>
+133 -3
View File
@@ -29,6 +29,39 @@
background-color: #f6f7fb;
display: flex;
flex-direction: column;
padding-top: 20rpx;
}
/* 顶部Logo和通知栏 */
.header-section.data-v-1cf27b2a {
width: 92%;
margin: 0 auto 20rpx;
}
.logo-container.data-v-1cf27b2a {
display: flex;
align-items: center;
}
.logo-container .logo-image.data-v-1cf27b2a {
width: 80rpx;
height: 80rpx;
margin-right: 8rpx;
}
.logo-container .app-name.data-v-1cf27b2a {
font-size: 36rpx;
font-weight: 600;
color: #333;
}
/* 地图标题 */
.map-title.data-v-1cf27b2a {
width: 92%;
margin: 0 auto 10rpx;
padding: 10rpx 0;
}
.map-title text.data-v-1cf27b2a {
font-size: 32rpx;
font-weight: 600;
color: #333;
}
/* 顶部搜索栏 */
@@ -120,7 +153,7 @@
border-radius: 4rpx;
}
.location-popup .location-sheet .sheet-header.data-v-1cf27b2a {
padding: 0 30rpx 20rpx;
padding: 20rpx 30rpx;
border-bottom: 1px solid #f0f0f0;
display: flex;
justify-content: space-between;
@@ -150,9 +183,9 @@
height: 24rpx;
}
.location-popup .location-sheet .sheet-content.data-v-1cf27b2a {
flex: 1;
padding: 20rpx 0;
overflow: hidden;
height: 60vh;
/* 固定高度以保证小程序端 scroll-view 正常滚动 */
}
@keyframes slideUp-1cf27b2a {
from {
@@ -251,6 +284,25 @@ to {
font-size: 28rpx;
color: #999;
}
.status-tag.data-v-1cf27b2a {
padding: 8rpx 16rpx;
border-radius: 20rpx;
font-size: 22rpx;
width: -webkit-fit-content;
width: fit-content;
}
.status-tag.online.data-v-1cf27b2a {
background: #e8f5e8;
color: #4caf50;
}
.status-tag.offline.data-v-1cf27b2a {
background: #ffeaea;
color: #f44336;
}
.status-tag.wait.data-v-1cf27b2a {
background: #ffeaea;
color: #f44336;
}
/* 加载状态 */
.loading-overlay.data-v-1cf27b2a {
@@ -395,4 +447,82 @@ to {
.phone-auth-popup .popup-content .popup-body .auth-cancel text.data-v-1cf27b2a {
font-size: 28rpx;
color: #999;
}
/* 操作步骤指引 */
.steps-guide.data-v-1cf27b2a {
align-items: center;
align-content: center;
background-color: rgba(255, 255, 255, 0.95);
border-radius: 20rpx;
padding: 0;
box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.12);
z-index: 10;
-webkit-backdrop-filter: blur(15rpx);
backdrop-filter: blur(15rpx);
border: 1rpx solid rgba(255, 255, 255, 0.9);
overflow: hidden;
width: 92%;
margin: 0 auto 20rpx;
}
.guide-header.data-v-1cf27b2a {
padding: 20rpx 24rpx;
background: linear-gradient(135deg, #2196F3, #1976D2);
border-bottom: 1rpx solid rgba(255, 255, 255, 0.2);
}
.guide-header .guide-title.data-v-1cf27b2a {
font-size: 32rpx;
font-weight: 600;
color: #ffffff;
text-align: center;
display: block;
}
.steps-container.data-v-1cf27b2a {
display: flex;
flex-direction: column;
gap: 16rpx;
padding: 24rpx;
background-color: rgba(255, 255, 255, 0.9);
}
.step-item.data-v-1cf27b2a {
display: flex;
align-items: flex-start;
width: 100%;
padding: 16rpx 0;
border-bottom: 1rpx solid rgba(0, 0, 0, 0.05);
}
.step-item.data-v-1cf27b2a:last-child {
border-bottom: none;
}
.step-item .step-number.data-v-1cf27b2a {
width: 40rpx;
height: 40rpx;
background: linear-gradient(135deg, #2196F3, #1976D2);
color: #ffffff;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 24rpx;
font-weight: bold;
margin-right: 20rpx;
flex-shrink: 0;
box-shadow: 0 4rpx 12rpx rgba(33, 150, 243, 0.4);
}
.step-item .step-content.data-v-1cf27b2a {
flex: 1;
padding-top: 4rpx;
}
.step-item .step-content .step-title.data-v-1cf27b2a {
font-size: 30rpx;
font-weight: 600;
color: #333;
margin-bottom: 8rpx;
display: block;
}
.step-item .step-content .step-desc.data-v-1cf27b2a {
font-size: 26rpx;
color: #666;
display: block;
line-height: 1.5;
}
+1 -1
View File
@@ -78,7 +78,7 @@ const _sfc_main = {
}, userInfo.value.avatar ? {
b: userInfo.value.avatar
} : {
c: common_assets._imports_0$1
c: common_assets._imports_0$2
}, {
d: userInfo.value.isAdmin
}, userInfo.value.isAdmin ? {} : {}, {
+1 -1
View File
@@ -90,7 +90,7 @@ const _sfc_main = {
c: common_vendor.t(orderInfo.value.deviceNo || "-"),
d: orderInfo.value.payWay === "wx_score_pay"
}, orderInfo.value.payWay === "wx_score_pay" ? {
e: common_assets._imports_0$2
e: common_assets._imports_0$3
} : {}, {
f: common_vendor.t(orderInfo.value.startTime || "-"),
g: orderInfo.value.endTime
+1 -1
View File
@@ -242,7 +242,7 @@ const _sfc_main = {
d: common_vendor.t(order.deviceId),
e: order.payWay == "wx_score_pay"
}, order.payWay == "wx_score_pay" ? {
f: common_assets._imports_0$2
f: common_assets._imports_0$3
} : {}, {
g: common_vendor.t(order.startTime),
h: common_vendor.t(order.endTime || "-"),
+1 -1
View File
@@ -357,7 +357,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
c: common_vendor.t($data.deviceId),
d: $data.orderInfo.payWay == "wx_score_pay"
}, $data.orderInfo.payWay == "wx_score_pay" ? {
e: common_assets._imports_0$2
e: common_assets._imports_0$3
} : {}, {
f: common_vendor.t($data.orderInfo.startTime),
g: common_vendor.t($data.orderInfo.usedTime),
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

-155
View File
@@ -1,155 +0,0 @@
"use strict";
const common_vendor = require("../common/vendor.js");
const AMAP_KEY = "4c513a688938fd89b88b296e867f66ec";
class AmapUtil {
constructor() {
this.key = AMAP_KEY;
}
// 逆地理编码 - 根据经纬度获取地址信息
async regeocode(longitude, latitude) {
try {
const res = await common_vendor.index.request({
url: "https://restapi.amap.com/v3/geocode/regeo",
method: "GET",
data: {
key: this.key,
location: `${longitude},${latitude}`,
poitype: "",
radius: 1e3,
extensions: "base",
batch: false,
roadlevel: 0
}
});
if (res.statusCode === 200 && res.data.status === "1") {
return {
success: true,
data: res.data.regeocode
};
} else {
return {
success: false,
message: res.data.info || "逆地理编码失败"
};
}
} catch (error) {
common_vendor.index.__f__("error", "at utils/amap.js:38", "逆地理编码异常:", error);
return {
success: false,
message: "网络异常"
};
}
}
// 地理编码 - 根据地址获取经纬度
async geocode(address, city = "") {
try {
const res = await common_vendor.index.request({
url: "https://restapi.amap.com/v3/geocode/geo",
method: "GET",
data: {
key: this.key,
address,
city
}
});
if (res.statusCode === 200 && res.data.status === "1" && res.data.geocodes.length > 0) {
return {
success: true,
data: res.data.geocodes[0]
};
} else {
return {
success: false,
message: res.data.info || "地理编码失败"
};
}
} catch (error) {
common_vendor.index.__f__("error", "at utils/amap.js:71", "地理编码异常:", error);
return {
success: false,
message: "网络异常"
};
}
}
// 搜索POI
async searchPOI(keywords, location = "", radius = 3e3, city = "") {
try {
const res = await common_vendor.index.request({
url: "https://restapi.amap.com/v3/place/text",
method: "GET",
data: {
key: this.key,
keywords,
location,
radius,
city,
citylimit: true
}
});
if (res.statusCode === 200 && res.data.status === "1") {
return {
success: true,
data: res.data.pois || []
};
} else {
return {
success: false,
message: res.data.info || "搜索失败"
};
}
} catch (error) {
common_vendor.index.__f__("error", "at utils/amap.js:107", "POI搜索异常:", error);
return {
success: false,
message: "网络异常"
};
}
}
// 路径规划
async getRoute(origin, destination, strategy = 0) {
try {
const res = await common_vendor.index.request({
url: "https://restapi.amap.com/v3/direction/driving",
method: "GET",
data: {
key: this.key,
origin,
destination,
strategy,
extensions: "base"
}
});
if (res.statusCode === 200 && res.data.status === "1") {
return {
success: true,
data: res.data.route
};
} else {
return {
success: false,
message: res.data.info || "路径规划失败"
};
}
} catch (error) {
common_vendor.index.__f__("error", "at utils/amap.js:142", "路径规划异常:", error);
return {
success: false,
message: "网络异常"
};
}
}
// 计算两点间距离
calculateDistance(lat1, lng1, lat2, lng2) {
const radLat1 = lat1 * Math.PI / 180;
const radLat2 = lat2 * Math.PI / 180;
const a = radLat1 - radLat2;
const b = lng1 * Math.PI / 180 - lng2 * Math.PI / 180;
let s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2)));
s = s * 6378.137;
s = Math.round(s * 1e4) / 1e4;
return s;
}
}
const AmapUtil$1 = new AmapUtil();
exports.AmapUtil = AmapUtil$1;
//# sourceMappingURL=../../.sourcemap/mp-weixin/utils/amap.js.map
+439
View File
@@ -0,0 +1,439 @@
"use strict";
const common_vendor = require("../common/vendor.js");
const QQMAP_KEY = "RO5BZ-ECZ63-7US3C-RT5QW-TIDZE-2FF35";
const QQMapWX = function() {
const ERROR_CONF = {
KEY_ERR: 311,
KEY_ERR_MSG: "key格式错误",
PARAM_ERR: 310,
PARAM_ERR_MSG: "请求参数信息有误",
SYSTEM_ERR: 600,
SYSTEM_ERR_MSG: "系统错误",
WX_ERR_CODE: 1e3,
WX_OK_CODE: 200
};
const BASE_URL = "https://apis.map.qq.com/ws/";
const URL_SEARCH = BASE_URL + "place/v1/search";
const URL_SUGGESTION = BASE_URL + "place/v1/suggestion";
const URL_GET_GEOCODER = BASE_URL + "geocoder/v1/";
const URL_DISTANCE = BASE_URL + "distance/v1/";
const Utils = {
// 获取location参数
getLocationParam(location) {
if (typeof location == "string") {
const locationArr = location.split(",");
if (locationArr.length === 2) {
location = {
latitude: location.split(",")[0],
longitude: location.split(",")[1]
};
} else {
location = {};
}
}
return location;
},
// 验证location值
checkLocation(param) {
const location = this.getLocationParam(param.location);
if (!location || !location.latitude || !location.longitude) {
const errconf = this.buildErrorConfig(ERROR_CONF.PARAM_ERR, ERROR_CONF.PARAM_ERR_MSG + " location参数格式有误");
param.fail(errconf);
param.complete(errconf);
return false;
}
return true;
},
// 构造错误数据结构
buildErrorConfig(errCode, errMsg) {
return {
status: errCode,
message: errMsg
};
},
// 回调函数默认处理
polyfillParam(param) {
param.success = param.success || function() {
};
param.fail = param.fail || function() {
};
param.complete = param.complete || function() {
};
},
// 处理用户参数是否传入坐标进行不同的处理
locationProcess(param, locationsuccess, locationfail, locationcomplete) {
const that = this;
locationfail = locationfail || function(res) {
res.statusCode = ERROR_CONF.WX_ERR_CODE;
param.fail(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg));
};
locationcomplete = locationcomplete || function(res) {
if (res.statusCode == ERROR_CONF.WX_ERR_CODE) {
param.complete(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg));
}
};
if (!param.location) {
common_vendor.wx$1.getLocation({
type: "gcj02",
success: locationsuccess,
fail: locationfail,
complete: locationcomplete
});
} else if (that.checkLocation(param)) {
const location = Utils.getLocationParam(param.location);
locationsuccess(location);
}
},
// 构造微信请求参数
buildWxRequestConfig(param, options, feature) {
const that = this;
options.header = { "content-type": "application/json" };
options.method = "GET";
options.success = function(res) {
const data = res.data;
if (data.status === 0) {
that.handleData(param, data, feature);
} else {
param.fail(data);
}
};
options.fail = function(res) {
res.statusCode = ERROR_CONF.WX_ERR_CODE;
param.fail(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg));
};
options.complete = function(res) {
const statusCode = +res.statusCode;
switch (statusCode) {
case ERROR_CONF.WX_ERR_CODE: {
param.complete(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg));
break;
}
case ERROR_CONF.WX_OK_CODE: {
const data = res.data;
if (data.status === 0) {
param.complete(data);
} else {
param.complete(that.buildErrorConfig(data.status, data.message));
}
break;
}
default: {
param.complete(that.buildErrorConfig(ERROR_CONF.SYSTEM_ERR, ERROR_CONF.SYSTEM_ERR_MSG));
}
}
};
return options;
},
// 数据处理函数
handleData(param, data, feature) {
if (feature == "search") {
const searchResult = data.data;
const searchSimplify = [];
for (let i = 0; i < searchResult.length; i++) {
searchSimplify.push({
id: searchResult[i].id || null,
title: searchResult[i].title || null,
latitude: searchResult[i].location && searchResult[i].location.lat || null,
longitude: searchResult[i].location && searchResult[i].location.lng || null,
address: searchResult[i].address || null,
category: searchResult[i].category || null,
tel: searchResult[i].tel || null,
adcode: searchResult[i].ad_info && searchResult[i].ad_info.adcode || null,
city: searchResult[i].ad_info && searchResult[i].ad_info.city || null,
district: searchResult[i].ad_info && searchResult[i].ad_info.district || null,
province: searchResult[i].ad_info && searchResult[i].ad_info.province || null
});
}
param.success(data, {
searchResult,
searchSimplify
});
} else if (feature == "suggest") {
const suggestResult = data.data;
const suggestSimplify = [];
for (let i = 0; i < suggestResult.length; i++) {
suggestSimplify.push({
adcode: suggestResult[i].adcode || null,
address: suggestResult[i].address || null,
category: suggestResult[i].category || null,
city: suggestResult[i].city || null,
district: suggestResult[i].district || null,
id: suggestResult[i].id || null,
latitude: suggestResult[i].location && suggestResult[i].location.lat || null,
longitude: suggestResult[i].location && suggestResult[i].location.lng || null,
province: suggestResult[i].province || null,
title: suggestResult[i].title || null,
type: suggestResult[i].type || null
});
}
param.success(data, {
suggestResult,
suggestSimplify
});
} else if (feature == "reverseGeocoder") {
const reverseGeocoderResult = data.result;
const reverseGeocoderSimplify = {
address: reverseGeocoderResult.address || null,
latitude: reverseGeocoderResult.location && reverseGeocoderResult.location.lat || null,
longitude: reverseGeocoderResult.location && reverseGeocoderResult.location.lng || null,
adcode: reverseGeocoderResult.ad_info && reverseGeocoderResult.ad_info.adcode || null,
city: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.city || null,
district: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.district || null,
nation: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.nation || null,
province: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.province || null,
street: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.street || null,
street_number: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.street_number || null,
recommend: reverseGeocoderResult.formatted_addresses && reverseGeocoderResult.formatted_addresses.recommend || null,
rough: reverseGeocoderResult.formatted_addresses && reverseGeocoderResult.formatted_addresses.rough || null
};
param.success(data, {
reverseGeocoderResult,
reverseGeocoderSimplify
});
} else if (feature == "calculateDistance") {
const calculateDistanceResult = data.result.elements;
const distance = [];
for (let i = 0; i < calculateDistanceResult.length; i++) {
distance.push(calculateDistanceResult[i].distance);
}
param.success(data, {
calculateDistanceResult,
distance
});
} else {
param.success(data);
}
}
};
class QQMapWX2 {
constructor(options) {
if (!options.key) {
throw Error("key值不能为空");
}
this.key = options.key;
}
// 逆地址解析
reverseGeocoder(options) {
const that = this;
options = options || {};
Utils.polyfillParam(options);
const requestParam = {
coord_type: options.coord_type || 5,
get_poi: options.get_poi || 0,
output: "json",
key: that.key
};
if (options.poi_options) {
requestParam.poi_options = options.poi_options;
}
const locationsuccess = function(result) {
requestParam.location = result.latitude + "," + result.longitude;
common_vendor.wx$1.request(Utils.buildWxRequestConfig(options, {
url: URL_GET_GEOCODER,
data: requestParam
}, "reverseGeocoder"));
};
Utils.locationProcess(options, locationsuccess);
}
// POI周边检索
search(options) {
const that = this;
options = options || {};
Utils.polyfillParam(options);
if (!options.keyword) {
const errconf = Utils.buildErrorConfig(ERROR_CONF.PARAM_ERR, ERROR_CONF.PARAM_ERR_MSG + " keyword参数格式有误");
options.fail(errconf);
options.complete(errconf);
return;
}
const requestParam = {
keyword: options.keyword,
orderby: options.orderby || "_distance",
page_size: options.page_size || 10,
page_index: options.page_index || 1,
output: "json",
key: that.key
};
if (options.address_format) {
requestParam.address_format = options.address_format;
}
if (options.filter) {
requestParam.filter = options.filter;
}
const distance = options.distance || "1000";
const auto_extend = options.auto_extend || 1;
const locationsuccess = function(result) {
requestParam.boundary = "nearby(" + result.latitude + "," + result.longitude + "," + distance + "," + auto_extend + ")";
common_vendor.wx$1.request(Utils.buildWxRequestConfig(options, {
url: URL_SEARCH,
data: requestParam
}, "search"));
};
Utils.locationProcess(options, locationsuccess);
}
// sug模糊检索
getSuggestion(options) {
const that = this;
options = options || {};
Utils.polyfillParam(options);
if (!options.keyword) {
const errconf = Utils.buildErrorConfig(ERROR_CONF.PARAM_ERR, ERROR_CONF.PARAM_ERR_MSG + " keyword参数格式有误");
options.fail(errconf);
options.complete(errconf);
return;
}
const requestParam = {
keyword: options.keyword,
region: options.region || "全国",
region_fix: options.region_fix || 0,
policy: options.policy || 0,
page_size: options.page_size || 10,
page_index: options.page_index || 1,
get_subpois: options.get_subpois || 0,
output: "json",
key: that.key
};
if (options.address_format) {
requestParam.address_format = options.address_format;
}
if (options.filter) {
requestParam.filter = options.filter;
}
if (options.location) {
const locationsuccess = function(result) {
requestParam.location = result.latitude + "," + result.longitude;
common_vendor.wx$1.request(Utils.buildWxRequestConfig(options, {
url: URL_SUGGESTION,
data: requestParam
}, "suggest"));
};
Utils.locationProcess(options, locationsuccess);
} else {
common_vendor.wx$1.request(Utils.buildWxRequestConfig(options, {
url: URL_SUGGESTION,
data: requestParam
}, "suggest"));
}
}
// 距离计算
calculateDistance(options) {
const that = this;
options = options || {};
Utils.polyfillParam(options);
if (!options.to) {
const errconf = Utils.buildErrorConfig(ERROR_CONF.PARAM_ERR, ERROR_CONF.PARAM_ERR_MSG + " to参数格式有误");
options.fail(errconf);
options.complete(errconf);
return;
}
const requestParam = {
mode: options.mode || "walking",
to: options.to,
output: "json",
key: that.key
};
if (options.from) {
options.location = options.from;
}
const locationsuccess = function(result) {
requestParam.from = result.latitude + "," + result.longitude;
common_vendor.wx$1.request(Utils.buildWxRequestConfig(options, {
url: URL_DISTANCE,
data: requestParam
}, "calculateDistance"));
};
Utils.locationProcess(options, locationsuccess);
}
}
return QQMapWX2;
}();
let qqmapInstance = null;
function initQQMap() {
if (!qqmapInstance) {
try {
qqmapInstance = new QQMapWX({
key: QQMAP_KEY
});
common_vendor.index.__f__("log", "at utils/mapUtils.js:398", "腾讯地图SDK初始化成功");
} catch (err) {
common_vendor.index.__f__("error", "at utils/mapUtils.js:400", "初始化腾讯地图SDK失败:", err);
}
}
return qqmapInstance;
}
function getQQMapInstance() {
return qqmapInstance || initQQMap();
}
function getUserLocation() {
return new Promise((resolve, reject) => {
common_vendor.wx$1.getLocation({
type: "gcj02",
success: (res) => {
resolve({
longitude: res.longitude,
latitude: res.latitude
});
},
fail: (error) => {
common_vendor.index.__f__("error", "at utils/mapUtils.js:423", "获取位置失败:", error);
reject(error);
}
});
});
}
function getRegeo(longitude, latitude) {
return new Promise((resolve, reject) => {
const qqmap = getQQMapInstance();
if (!qqmap) {
reject({ success: false, message: "腾讯地图SDK未初始化" });
return;
}
qqmap.reverseGeocoder({
location: {
latitude,
longitude
},
success: (data, result) => {
const reverseGeocoderSimplify = result.reverseGeocoderSimplify;
resolve({
success: true,
data: {
formatted_address: reverseGeocoderSimplify.address,
addressComponent: {
city: reverseGeocoderSimplify.city,
district: reverseGeocoderSimplify.district,
province: reverseGeocoderSimplify.province,
street: reverseGeocoderSimplify.street,
street_number: reverseGeocoderSimplify.street_number
}
}
});
},
fail: (error) => {
common_vendor.index.__f__("error", "at utils/mapUtils.js:462", "逆地理编码失败:", error);
reject({ success: false, message: error.message || "逆地理编码失败" });
}
});
});
}
function calculateDistanceSync(lat1, lng1, lat2, lng2) {
const R = 6371e3;
const dLat = (lat2 - lat1) * Math.PI / 180;
const dLng = (lng2 - lng1) * Math.PI / 180;
const a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.cos(lat1 * Math.PI / 180) * Math.cos(lat2 * Math.PI / 180) * Math.sin(dLng / 2) * Math.sin(dLng / 2);
const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
return Math.round(R * c);
}
function testDistanceCalculation() {
const tiananmen = { lat: 39.908823, lng: 116.39747 };
const gugong = { lat: 39.916527, lng: 116.397128 };
const distance = calculateDistanceSync(tiananmen.lat, tiananmen.lng, gugong.lat, gugong.lng);
common_vendor.index.__f__("log", "at utils/mapUtils.js:586", "天安门到故宫的距离:", distance, "米");
common_vendor.index.__f__("log", "at utils/mapUtils.js:587", "转换为公里:", (distance / 1e3).toFixed(2), "公里");
return distance;
}
exports.calculateDistanceSync = calculateDistanceSync;
exports.getRegeo = getRegeo;
exports.getUserLocation = getUserLocation;
exports.testDistanceCalculation = testDistanceCalculation;
//# sourceMappingURL=../../.sourcemap/mp-weixin/utils/mapUtils.js.map