Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
map-demo
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
hookehuyr
2024-09-21 12:03:51 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c3e7883c19bb55d76ef418f4786469be42327de8
c3e7883c
1 parent
b7ee3cf6
新增手动触发定位操作
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
6 deletions
components.d.ts
src/views/bieyuan/map.vue
components.d.ts
View file @
c3e7883
...
...
@@ -11,7 +11,6 @@ declare module '@vue/runtime-core' {
export
interface
GlobalComponents
{
AudioBackground
:
typeof
import
(
'./src/components/audioBackground.vue'
)[
'default'
]
AudioBackground1
:
typeof
import
(
'./src/components/audioBackground1.vue'
)[
'default'
]
copy
:
typeof
import
(
'./src/components/audioBackground copy.vue'
)[
'default'
]
Floor
:
typeof
import
(
'./src/components/Floor/index.vue'
)[
'default'
]
InfoPopup
:
typeof
import
(
'./src/components/InfoPopup.vue'
)[
'default'
]
InfoPopupLite
:
typeof
import
(
'./src/components/InfoPopupLite.vue'
)[
'default'
]
...
...
src/views/bieyuan/map.vue
View file @
c3e7883
<!--
* @Date: 2023-05-19 14:54:27
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-09-21 1
1:01:31
* @LastEditTime: 2024-09-21 1
2:03:00
* @FilePath: /map-demo/src/views/bieyuan/map.vue
* @Description: 公众地图主体页面
-->
...
...
@@ -59,6 +59,19 @@
<!-- 背景音乐控制 -->
<!-- <audioBackground1></audioBackground1> -->
<div class="operate-bar-wrapper">
<div class="box-wrapper">
<div v-if="open_current_location" class="item" @click="handleLocation(true)">
<van-icon name="https://cdn.ipadbiz.cn/xys/map/%E5%AE%9A%E4%BD%8Dloc@2x.png" size="1.5rem"
style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);;" />
</div>
<div v-else class="item" @click="handleLocation(false)">
<van-icon name="https://cdn.ipadbiz.cn/xys/map/%E5%AE%9A%E4%BD%8Dloc@2x.png" size="1.5rem"
style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);" />
</div>
</div>
</div>
</div>
</template>
...
...
@@ -203,6 +216,7 @@ export default {
current_safe_route: [],
route_safe_marker: [],
show_walk_route: true,
open_current_location: true,
}
},
async mounted() {
...
...
@@ -373,10 +387,10 @@ export default {
});
this.map.add(this.markerSum);
//
setTimeout(() => {
// 获取定位打标记
this.setLocation();
}, 1000);
//
setTimeout(() => {
//
// 获取定位打标记
//
this.setLocation();
//
}, 1000);
},
isPointInRing() { // 是否在景区范围
let isPointInRing = AMap.GeometryUtil.isPointInRing([this.current_lng, this.current_lat], [
...
...
@@ -763,7 +777,21 @@ export default {
console.warn(marker_id);
// 模拟新增路线
this.addSafeRoute(this.data_path_list[0]);
},
handleLocation(status) { // 打开/关闭 当前定位
if (status) {
this.setLocation()
this.open_current_location = false;
} else {
this.removeLocation()
this.open_current_location = true;
}
},
removeLocation() { // 移除定位标记
this.current_lng = '';
this.current_lat = '';
this.map.remove(this.location_marker); // 删除当前定位标记
},
}
}
</script>
...
...
Please
register
or
login
to post a comment