hookehuyr

feat(地图页面): 添加底部导航组件并调整地图高度

新增底部导航组件BottomNav,用于小程序web-view环境中的页面导航
动态计算地图高度以适应底部导航栏
添加相关图标资源并更新vite配置路径
更新组件类型声明文件
......@@ -12,6 +12,7 @@ declare module '@vue/runtime-core' {
AudioBackground: typeof import('./src/components/audioBackground.vue')['default']
AudioBackground1: typeof import('./src/components/audioBackground1.vue')['default']
AudioList: typeof import('./src/components/audioList.vue')['default']
BottomNav: typeof import('./src/components/BottomNav.vue')['default']
ElButton: typeof import('element-plus/es')['ElButton']
ElInput: typeof import('element-plus/es')['ElInput']
ElOption: typeof import('element-plus/es')['ElOption']
......
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1756303912062" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="21734" xmlns:xlink="http://www.w3.org/1999/xlink" width="256" height="256"><path d="M512 97.52381c228.912762 0 414.47619 185.563429 414.47619 414.47619s-185.563429 414.47619-414.47619 414.47619S97.52381 740.912762 97.52381 512 283.087238 97.52381 512 97.52381z m0 73.142857C323.486476 170.666667 170.666667 323.486476 170.666667 512s152.81981 341.333333 341.333333 341.333333 341.333333-152.81981 341.333333-341.333333S700.513524 170.666667 512 170.666667z m190.854095 160.572952l-86.186666 275.334095L341.333333 692.760381l86.211048-275.334095 275.309714-86.186667z m-216.941714 144.579048l-33.01181 105.374476 105.398858-32.987429-72.411429-72.411428z" p-id="21735"></path></svg>
\ No newline at end of file
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1756302772088" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8533" xmlns:xlink="http://www.w3.org/1999/xlink" width="256" height="256"><path d="M549.61981 133.022476l319.683047 203.605334A70.851048 70.851048 0 0 1 902.095238 396.361143v434.883047A70.89981 70.89981 0 0 1 831.146667 902.095238h-282.819048l0.024381-218.112h-71.826286v218.087619L192.853333 902.095238A70.89981 70.89981 0 0 1 121.904762 831.24419V390.241524c0-24.527238 12.678095-47.299048 33.54819-60.220953l318.659048-197.485714a70.972952 70.972952 0 0 1 75.50781 0.487619zM828.952381 828.952381V397.214476L511.488 195.047619 195.047619 391.119238V828.952381h211.309714v-216.551619h212.187429v216.527238L828.952381 828.952381z" p-id="8534"></path></svg>
\ No newline at end of file
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1756304253215" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="16498" xmlns:xlink="http://www.w3.org/1999/xlink" width="256" height="256"><path d="M853.333333 896a42.666667 42.666667 0 0 1-42.666666-42.666667 298.666667 298.666667 0 0 0-6.186667-60.16 289.066667 289.066667 0 0 0-17.28-56.106666 292.266667 292.266667 0 0 0-27.52-50.773334 313.386667 313.386667 0 0 0-36.48-44.16 301.653333 301.653333 0 0 0-44.16-36.48 42.666667 42.666667 0 1 1 47.573333-70.613333 375.253333 375.253333 0 0 1 56.96 46.72 395.52 395.52 0 0 1 46.72 56.746667A379.733333 379.733333 0 0 1 865.706667 704 386.773333 386.773333 0 0 1 896 853.333333a42.666667 42.666667 0 0 1-42.666667 42.666667zM741.973333 272.64a228.48 228.48 0 0 0-13.866666-43.946667 225.28 225.28 0 0 0-21.333334-39.893333 236.16 236.16 0 0 0-28.586666-34.773333 234.666667 234.666667 0 0 0-34.773334-28.586667 234.666667 234.666667 0 0 0-178.346666-35.413333 240.213333 240.213333 0 0 0-84.053334 35.413333 234.666667 234.666667 0 0 0-34.773333 28.586667 236.16 236.16 0 0 0-28.586667 34.773333 241.28 241.28 0 0 0-21.333333 39.893333 243.84 243.84 0 0 0-13.653333 43.946667 241.28 241.28 0 0 0 0 94.72 228.48 228.48 0 0 0 13.866666 43.946667 225.28 225.28 0 0 0 21.333334 39.893333 42.666667 42.666667 0 0 0 70.826666-47.786667 131.84 131.84 0 0 1-13.866666-25.173333 149.333333 149.333333 0 0 1-8.746667-28.16 152.96 152.96 0 0 1 0-60.16 141.653333 141.653333 0 0 1 8.746667-27.946667 138.24 138.24 0 0 1 13.653333-25.386666 166.186667 166.186667 0 0 1 18.346667-21.333334 151.253333 151.253333 0 0 1 21.333333-18.346666 138.24 138.24 0 0 1 25.386667-13.653334 141.653333 141.653333 0 0 1 27.946666-8.746666 149.333333 149.333333 0 0 1 60.16 0 141.653333 141.653333 0 0 1 27.946667 8.746666 138.24 138.24 0 0 1 25.386667 13.653334 147.84 147.84 0 0 1 40.32 40.533333 131.84 131.84 0 0 1 13.866666 25.173333 149.333333 149.333333 0 0 1 8.746667 28.16 152.96 152.96 0 0 1 0 60.16 141.653333 141.653333 0 0 1-8.746667 27.946667 138.24 138.24 0 0 1-13.653333 25.386667A166.186667 166.186667 0 0 1 618.666667 426.666667a151.253333 151.253333 0 0 1-21.333334 18.346666 138.24 138.24 0 0 1-25.386666 13.653334 141.653333 141.653333 0 0 1-27.946667 8.746666A156.373333 156.373333 0 0 1 512 469.333333a386.773333 386.773333 0 0 0-149.333333 30.293334 384 384 0 0 0-64 35.413333 375.253333 375.253333 0 0 0-56.96 46.72 395.52 395.52 0 0 0-46.72 56.746667A379.733333 379.733333 0 0 0 158.293333 704 386.773333 386.773333 0 0 0 128 853.333333a42.666667 42.666667 0 0 0 85.333333 0 298.666667 298.666667 0 0 1 6.186667-60.16 289.066667 289.066667 0 0 1 17.28-56.106666 292.266667 292.266667 0 0 1 27.52-50.773334 313.386667 313.386667 0 0 1 36.48-44.16 301.653333 301.653333 0 0 1 44.16-36.48 292.266667 292.266667 0 0 1 50.773333-27.52 305.28 305.28 0 0 1 56.106667-17.493333A314.453333 314.453333 0 0 1 512 554.666667a248.746667 248.746667 0 0 0 47.146667-4.693334 240.213333 240.213333 0 0 0 84.053333-35.413333 234.666667 234.666667 0 0 0 34.773333-28.586667 236.16 236.16 0 0 0 28.586667-34.773333 241.28 241.28 0 0 0 21.333333-39.893333 243.84 243.84 0 0 0 13.653334-43.946667 241.28 241.28 0 0 0 0-94.72z" fill="#333333" p-id="16499"></path></svg>
\ No newline at end of file
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1756303617166" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8875" xmlns:xlink="http://www.w3.org/1999/xlink" width="256" height="256"><path d="M584.655238 97.52381l7.753143 0.121904a127.024762 127.024762 0 0 1 109.592381 181.052953h152.064a73.142857 73.142857 0 0 1 73.142857 73.142857v86.625524a73.142857 73.142857 0 0 1-73.142857 73.142857h-4.510476v340.967619a73.142857 73.142857 0 0 1-73.142857 73.142857H223.963429a73.142857 73.142857 0 0 1-73.142858-73.142857l-0.024381-340.967619H146.285714a73.142857 73.142857 0 0 1-73.142857-73.142857v-86.625524a73.142857 73.142857 0 0 1 73.142857-73.142857h139.897905a127.024762 127.024762 0 0 1 109.568-181.077334L403.504762 97.52381a128.975238 128.975238 0 0 1 90.599619 37.010285A128.926476 128.926476 0 0 1 584.655238 97.52381zM223.963429 852.577524l237.397333-0.024381V511.609905H223.914667v340.967619z m552.472381-340.967619h-237.421715v340.943238h237.446095l-0.02438-340.943238zM461.336381 351.817143H146.285714v86.649905h4.486096v-2.218667l310.564571-0.024381V351.817143z m392.728381 0H538.989714v84.406857l310.588953 0.024381-0.024381 2.218667h4.510476v-86.625524zM403.504762 170.666667h-2.364952a53.881905 53.881905 0 0 0 0 107.763809h54.125714V226.937905c0-6.339048 0.463238-12.55619 1.340952-18.627048A56.246857 56.246857 0 0 0 403.504762 170.666667z m183.539809 0h-2.364952a56.295619 56.295619 0 0 0-53.126095 37.668571c0.902095 6.046476 1.365333 12.263619 1.365333 18.602667l-0.024381 51.492571h54.150095a53.881905 53.881905 0 0 0 53.76-50.029714l0.121905-3.852191c0-29.744762-24.137143-53.881905-53.881905-53.881904z" p-id="8876"></path></svg>
\ No newline at end of file
......@@ -30,6 +30,7 @@
"dependencies": {
"@amap/amap-jsapi-loader": "^1.0.1",
"@element-plus/icons-vue": "^2.3.1",
"@nutui/icons-vue": "^0.1.1",
"@photo-sphere-viewer/core": "^5.7.3",
"@photo-sphere-viewer/gallery-plugin": "^5.7.3",
"@photo-sphere-viewer/gyroscope-plugin": "^5.7.3",
......
<!--
* @Date: 2025-08-27 17:44:10
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-08-27 22:43:22
* @FilePath: /map-demo/src/components/BottomNav.vue
* @Description: 文件描述
-->
<template>
<div v-if="isMiniProgramWebView" class="bottom-nav">
<div
v-for="item in navItems"
:key="item.path"
@click="navigate(item.path)"
:class="['nav-item', isActive(item.path) ? 'nav-item-active' : 'nav-item-inactive']"
>
<img :src="item.icon" :class="['nav-icon', isActive(item.path) ? 'filter-blue' : 'filter-gray']" alt="" />
<span class="nav-label">{{ item.label }}</span>
<div v-if="isActive(item.path)" class="nav-indicator"></div>
</div>
</div>
</template>
<script setup>
import { computed, shallowRef } from 'vue';
import wx from 'weixin-js-sdk'
import homeIcon from '@images/icons/home.svg';
import rewardsIcon from '@images/icons/rewards.svg';
import activitiesIcon from '@images/icons/activities.svg';
import meIcon from '@images/icons/me.svg';
/**
* 检测是否在小程序web-view环境中
* @returns {boolean} 是否在小程序环境
*/
const isMiniProgramWebView = computed(() => {
return navigator.userAgent.includes('miniProgram');
});
const navItems = shallowRef([
{ path: '/pages/Dashboard/index', icon: homeIcon, label: '首页' },
{ path: '/pages/Activities/index', icon: activitiesIcon, label: '活动' },
{ path: '/pages/Rewards/index', icon: rewardsIcon, label: '兑换' },
{ path: '/pages/Profile/index', icon: meIcon, label: '我的' },
]);
const currentPage = computed(() => {
// const pages = Taro.getCurrentPages();
// return pages.length > 0 ? '/' + pages[pages.length - 1].route : '';
// 默认选中活动页面
return '/pages/Activities/index';
});
const isActive = (path) => {
return currentPage.value === path;
};
const navigate = (path) => {
wx.miniProgram.reLaunch({ url: path });
};
</script>
<style scoped>
/* 底部导航容器 */
.bottom-nav {
position: fixed;
bottom: 0;
left: 0;
right: 0;
background-color: white;
border-top: 1px solid #f3f4f6;
display: flex;
justify-content: space-around;
padding: 8px 0;
z-index: 50;
}
/* 导航项 */
.nav-item {
display: flex;
flex-direction: column;
align-items: center;
padding: 8px 20px;
position: relative;
}
/* 激活状态 */
.nav-item-active {
color: #2563eb;
}
/* 非激活状态 */
.nav-item-inactive {
color: #6b7280;
}
/* 图标样式 */
.nav-icon {
width: 24px;
height: 24px;
}
/* 标签样式 */
.nav-label {
font-size: 12px;
margin-top: 4px;
}
/* 激活指示器 */
.nav-indicator {
position: absolute;
bottom: 0;
width: 40px;
height: 4px;
background-color: #2563eb;
border-radius: 2px 2px 0 0;
}
/* 图标滤镜 */
.filter-blue {
filter: brightness(0) saturate(100%) invert(22%) sepia(100%) saturate(3441%) hue-rotate(229deg) brightness(101%) contrast(101%);
}
.filter-gray {
filter: brightness(0) saturate(100%) invert(91%) sepia(6%) saturate(394%) hue-rotate(201deg) brightness(50%) contrast(92%);
}
</style>
......@@ -2,7 +2,7 @@
* @Author: hookehuyr hookehuyr@gmail.com
* @Date: 2022-05-31 12:06:19
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-03-04 18:04:19
* @LastEditTime: 2025-08-27 22:20:35
* @FilePath: /map-demo/src/main.js
* @Description:
*/
......
<!--
* @Date: 2023-05-19 14:54:27
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-08-26 17:01:40
* @LastEditTime: 2025-08-27 22:38:11
* @FilePath: /map-demo/src/views/checkin/map.vue
* @Description: 公众地图主体页面
-->
<template>
<div ref="root" style="height: 100vh; position: relative; overflow: hidden;">
<div ref="root" :style="{ height: mapHeight, position: 'relative', overflow: 'hidden' }">
<div id="container"></div>
<!-- 添加导航面板容器 -->
<div id="walking-panel" style="position: absolute; bottom: 1rem; left: 1rem; padding: 1rem;"></div>
......@@ -86,6 +86,9 @@
<p style="padding: 0.5rem 1rem;">{{ toast_text }}</p>
</template>
</van-toast>
<!-- 底部导航组件 -->
<BottomNav />
</div>
</template>
......@@ -101,6 +104,7 @@ import { mapAPI } from '@/api/map.js'
import wx from 'weixin-js-sdk'
import pageInfo from '@/views/checkin/info.vue'
import audioBackground1 from '@/components/audioBackground1.vue'
import BottomNav from '@/components/BottomNav.vue'
import { mapState, mapActions } from 'pinia'
import { mainStore } from '@/store'
import { parseQueryString } from '@/utils/tools'
......@@ -169,7 +173,24 @@ window._AMapSecurityConfig = {
}
export default {
components: { pageInfo, audioBackground1 },
components: { pageInfo, audioBackground1, BottomNav },
computed: {
...mapState(mainStore, ['audio_entity', 'audio_src', 'audio_status']),
/**
* 检测是否在小程序web-view环境中
* @returns {boolean} 是否在小程序环境
*/
isMiniProgramWebView() {
return navigator.userAgent.includes('miniProgram');
},
/**
* 动态计算地图高度
* @returns {string} 地图容器高度
*/
mapHeight() {
return this.isMiniProgramWebView ? 'calc(100vh - 80px)' : '100vh';
}
},
data() {
return {
map: '',
......@@ -388,9 +409,7 @@ export default {
// deep: true // 如果 query 是嵌套对象,可以设置 deep 监听深层变化
// }
},
computed: {
...mapState(mainStore, ['audio_entity', 'audio_src', 'audio_status'])
},
methods: {
...mapActions(mainStore, ['changeAudio', 'changeAudioSrc', 'changeAudioStatus']),
initMap() {
......
......@@ -69,7 +69,7 @@ export default ({ command, mode }) => {
'@components': path.resolve(__dirname, 'src/components'),
'@composables': path.resolve(__dirname, 'src/composables'),
'@utils': path.resolve(__dirname, 'src/utils'),
'@images': path.resolve(__dirname, 'src/assets/images'),
'@images': path.resolve(__dirname, 'images'),
'@css': path.resolve(__dirname, 'src/assets/css'),
'@mock': path.resolve(__dirname, 'src/assets/mock'),
common: path.resolve(__dirname, 'src/common'),
......
......@@ -155,6 +155,11 @@
"@nodelib/fs.scandir" "2.1.5"
fastq "^1.6.0"
"@nutui/icons-vue@^0.1.1":
version "0.1.1"
resolved "https://registry.yarnpkg.com/@nutui/icons-vue/-/icons-vue-0.1.1.tgz#d90b3e5d5e109aebb775e4dd5167d702f3adcec1"
integrity sha512-ekn6R9GNHWNUcV4pxdhQzrI1g1VhZ5zknklXoUJrCzt0RkRRLU0bUXX3ouWT0sl0U3MNJClnXAzZe7iPAvgPtw==
"@photo-sphere-viewer/core@^5.7.3":
version "5.7.3"
resolved "https://mirrors.cloud.tencent.com/npm/@photo-sphere-viewer/core/-/core-5.7.3.tgz#b17523df65c1a57c86f023d9a8cc0819d026f4c2"
......