This commit is contained in:
2025-09-14 00:21:54 +08:00
commit d40b3bbd62
766 changed files with 36275 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
._cred {
display: inline;
}
._dflex button {
margin: 10px 0;
background-color: red;
color: white;
}

View File

@@ -0,0 +1,150 @@
Page({
onShareAppMessage() {
return {
title: 'map',
path: 'page/component/pages/map/map',
};
},
data: {
latitude: 31.215815,
longitude: 121.474845,
markers: [
{
latitude: 23.099994,
longitude: 113.32452,
name: 'T.I.T 创意园',
id: '1',
callout: {
content: 'ALWAYS callout',
color: 'red',
},
},
{
id: '2',
latitude: 23.099,
longitude: 113.324,
name: 'BYCLICK callout',
callout: {
content: 'BYCLICK',
color: 'red',
},
},
],
covers: [
{
latitude: 23.099994,
longitude: 113.34452,
iconPath: '/image/location.png',
},
{
latitude: 23.099994,
longitude: 113.30452,
iconPath: '/image/location.png',
},
],
polygons: [
{
points: [
{
latitude: 23.099994,
longitude: 113.32452,
},
{
latitude: 23.098994,
longitude: 113.32352,
},
{
latitude: 23.098994,
longitude: 113.32552,
},
],
strokeWidth: 3,
strokeColor: '#FFFFFFAA',
},
],
subKey: 'B5QBZ-7JTLU-DSSVA-2BRJ3-TNXLF-2TBR7',
enable3d: false,
showCompass: false,
enableOverlooking: false,
enableZoom: true,
enableScroll: true,
enableRotate: false,
drawPolygon: false,
enableSatellite: false,
enableTraffic: false,
},
toggle3d() {
this.setData({
enable3d: !this.data.enable3d,
});
},
toggleShowCompass() {
this.setData({
showCompass: !this.data.showCompass,
});
},
toggleOverlooking() {
this.setData({
enableOverlooking: !this.data.enableOverlooking,
});
},
toggleZoom() {
this.setData({
enableZoom: !this.data.enableZoom,
});
},
toggleScroll() {
this.setData({
enableScroll: !this.data.enableScroll,
});
},
toggleRotate() {
this.setData({
enableRotate: !this.data.enableRotate,
});
},
togglePolygon() {
this.setData({
drawPolygon: !this.data.drawPolygon,
});
},
toggleSatellite() {
this.setData({
enableSatellite: !this.data.enableSatellite,
});
},
toggleTraffic() {
this.setData({
enableTraffic: !this.data.enableTraffic,
});
},
onReady() {
setTimeout(() => {
this.mapContext = xhs.createMapContext('mapId');
this.mapContext?.getScale({
success: console.log,
});
this.mapContext?.getRegion({
success: console.log,
fail: console.error,
});
this.mapContext?.includePoints({
success: console.log,
fail: console.error,
});
}, 5000);
},
bindtap(e) {
console.log('bindtap ===>', e);
},
bindmarkertap(e) {
console.log('bindmarkertap ==>', e);
},
bindcallouttap(e) {
console.log('bindcallouttap ==>', e);
},
bindlabeltap(e) {
console.log('bindlabeltap ===>', e);
},
});

View File

@@ -0,0 +1,7 @@
{
"navigationBarTitleText": "地图",
"usingComponents": {
"showbox": "../../common/component/showbox/index",
"box": "../../common/component/container/index"
}
}

View File

@@ -0,0 +1,61 @@
<view class="container">
<showbox title="地图组件">
<box>
<view class="_ui-space">
<map
id="mapId"
data-testid="mapId"
subkey="{{subKey}}"
style="width: 100%; height: 300px;"
latitude="{{latitude}}"
longitude="{{longitude}}"
scale="{{18}}"
markers="{{markers}}"
covers="{{covers}}"
enable-3D="{{enable3d}}"
show-compass="{{showCompass}}"
enable-zoom="{{enableZoom}}"
enable-rotate="{{enableRotate}}"
enable-satellite="{{enableSatellite}}"
enable-traffic="{{enableTraffic}}"
enable-overlooking="{{enableOverlooking}}"
enable-scroll="{{enableScroll}}"
polygons="{{drawPolygon ? polygons : []}}"
bindtap="bindtap"
bindlabeltap="bindlabeltap"
bindmarkertap="bindmarkertap"
bindcallouttap="bindcallouttap"
>
</map>
<button class="_ui-button" hover-class="_ui-button-hover" bindtap="toggle3d">
{{ !enable3d ? '启用' : '关闭'}}3D效果
</button>
<button class="_ui-button" hover-class="_ui-button-hover" bindtap="toggleShowCompass">
{{ !showCompass ? '显示' : '关闭' }}指南针
</button>
<!-- <button class="_ui-button" hover-class="_ui-button-hover" bindtap="toggleOverlooking">
{{ !enableOverlooking ? '开启' : '关闭' }}俯视支持
</button> -->
<button class="_ui-button" hover-class="_ui-button-hover" bindtap="toggleRotate">
{{ !enableRotate ? '开启' : '关闭' }}旋转支持
</button>
<!-- <button class="_ui-button" hover-class="_ui-button-hover" bindtap="togglePolygon">
{{ !drawPolygon ? '绘制' : '清除' }}多边形
</button> -->
<!-- <button class="_ui-button" hover-class="_ui-button-hover" bindtap="toggleZoom">
{{ !enableZoom ? '开启' : '关闭' }}缩放支持
</button> -->
<button class="_ui-button" hover-class="_ui-button-hover" bindtap="toggleScroll">
{{ !enableScroll ? '开启' : '关闭' }}拖动支持
</button>
<button class="_ui-button" hover-class="_ui-button-hover" bindtap="toggleSatellite">
{{ !enableSatellite ? '开启' : '关闭' }}卫星图
</button>
<button class="_ui-button" hover-class="_ui-button-hover" bindtap="toggleTraffic">
{{ !enableTraffic ? '开启' : '关闭' }}实时路况
</button>
</view>
</box>
</showbox>
</view>