hookehuyr

fix(路由): 修复信息弹窗和详情页的路由跳转逻辑

调整InfoPopup组件和bieyuan/info页面的路由跳转逻辑,支持根据target参数跳转到不同页面
移除未使用的ElMessage全局声明
{
"globals": {
"EffectScope": true,
"ElMessage": true,
"computed": true,
"createApp": true,
"customRef": true,
......
......@@ -2,7 +2,6 @@
export {}
declare global {
const EffectScope: typeof import('vue')['EffectScope']
const ElMessage: typeof import('element-plus/es')['ElMessage']
const computed: typeof import('vue')['computed']
const createApp: typeof import('vue')['createApp']
const customRef: typeof import('vue')['customRef']
......
......@@ -270,7 +270,20 @@ export default {
clearInterval(this.play_timer);
},
goToUrl(url) {
console.warn(this.info);
if (url) {
location.href = this.info.details[this.isActive].url;
} else {
// 路由跳转到 详情页
this.$router.push({
path: '/bieyuan/info',
query: {
id: this.$router.currentRoute.value.query.id,
marker_id: this.info.id,
target: 'xys'
}
})
}
},
handleTitle (index) {
this.isActive = index;
......
<!--
* @Date: 2024-09-15 22:08:49
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-11-06 11:49:42
* @LastEditTime: 2025-08-07 10:32:26
* @FilePath: /map-demo/src/views/bieyuan/info.vue
* @Description: 文件描述
-->
......@@ -64,7 +64,7 @@
</van-config-provider>
</div>
</div>
<div class="info-logo" :style="{ marginBottom: audio_list_height ? `${audio_list_height * 1.5}px` : '3rem' }">
<div v-if="!page_target" class="info-logo" :style="{ marginBottom: audio_list_height ? `${audio_list_height * 1.5}px` : '3rem' }">
<van-image width="3rem" height="3rem" fit="contain" src="https://cdn.ipadbiz.cn/bieyuan/map/icon/scan_logo.png" />
</div>
......@@ -85,7 +85,7 @@
</template>
<script setup>
import { ref, watch, watchEffect } from 'vue'
import { ref, watch, watchEffect, computed } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { showImagePreview } from 'vant';
import { storeToRefs } from 'pinia'
......@@ -102,6 +102,8 @@ const { audio_status, audio_entity, audio_list_status, audio_list_entity } = sto
const $route = useRoute();
const $router = useRouter();
const page_target = computed(() => $route.query.target);
const themeVars = ref({
swipeIndicatorInactiveBackground: '#fff',
swipeIndicatorMargin: '1.5rem',
......@@ -313,12 +315,23 @@ const goTo = () => { // 打开标记地图显示
}
const goBack = () => { // 返回首页
const target = page_target.value;
if (target === 'xys') {
$router.push({
path: '/xys',
query: {
id: $route.query.id,
}
})
} else {
$router.push({
path: '/bieyuan/map',
query: {
id: $route.query.id,
marker_id: $route.query.marker_id
}
})
}
}
const showBack = computed(() => $router.currentRoute.value.path === '/bieyuan/info');
......