hookehuyr

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

调整InfoPopup组件和bieyuan/info页面的路由跳转逻辑,支持根据target参数跳转到不同页面
移除未使用的ElMessage全局声明
1 { 1 {
2 "globals": { 2 "globals": {
3 "EffectScope": true, 3 "EffectScope": true,
4 - "ElMessage": true,
5 "computed": true, 4 "computed": true,
6 "createApp": true, 5 "createApp": true,
7 "customRef": true, 6 "customRef": true,
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
2 export {} 2 export {}
3 declare global { 3 declare global {
4 const EffectScope: typeof import('vue')['EffectScope'] 4 const EffectScope: typeof import('vue')['EffectScope']
5 - const ElMessage: typeof import('element-plus/es')['ElMessage']
6 const computed: typeof import('vue')['computed'] 5 const computed: typeof import('vue')['computed']
7 const createApp: typeof import('vue')['createApp'] 6 const createApp: typeof import('vue')['createApp']
8 const customRef: typeof import('vue')['customRef'] 7 const customRef: typeof import('vue')['customRef']
......
...@@ -270,7 +270,20 @@ export default { ...@@ -270,7 +270,20 @@ export default {
270 clearInterval(this.play_timer); 270 clearInterval(this.play_timer);
271 }, 271 },
272 goToUrl(url) { 272 goToUrl(url) {
273 + console.warn(this.info);
274 + if (url) {
273 location.href = this.info.details[this.isActive].url; 275 location.href = this.info.details[this.isActive].url;
276 + } else {
277 + // 路由跳转到 详情页
278 + this.$router.push({
279 + path: '/bieyuan/info',
280 + query: {
281 + id: this.$router.currentRoute.value.query.id,
282 + marker_id: this.info.id,
283 + target: 'xys'
284 + }
285 + })
286 + }
274 }, 287 },
275 handleTitle (index) { 288 handleTitle (index) {
276 this.isActive = index; 289 this.isActive = index;
......
1 <!-- 1 <!--
2 * @Date: 2024-09-15 22:08:49 2 * @Date: 2024-09-15 22:08:49
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-11-06 11:49:42 4 + * @LastEditTime: 2025-08-07 10:32:26
5 * @FilePath: /map-demo/src/views/bieyuan/info.vue 5 * @FilePath: /map-demo/src/views/bieyuan/info.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
64 </van-config-provider> 64 </van-config-provider>
65 </div> 65 </div>
66 </div> 66 </div>
67 - <div class="info-logo" :style="{ marginBottom: audio_list_height ? `${audio_list_height * 1.5}px` : '3rem' }"> 67 + <div v-if="!page_target" class="info-logo" :style="{ marginBottom: audio_list_height ? `${audio_list_height * 1.5}px` : '3rem' }">
68 <van-image width="3rem" height="3rem" fit="contain" src="https://cdn.ipadbiz.cn/bieyuan/map/icon/scan_logo.png" /> 68 <van-image width="3rem" height="3rem" fit="contain" src="https://cdn.ipadbiz.cn/bieyuan/map/icon/scan_logo.png" />
69 </div> 69 </div>
70 70
...@@ -85,7 +85,7 @@ ...@@ -85,7 +85,7 @@
85 </template> 85 </template>
86 86
87 <script setup> 87 <script setup>
88 -import { ref, watch, watchEffect } from 'vue' 88 +import { ref, watch, watchEffect, computed } from 'vue'
89 import { useRoute, useRouter } from 'vue-router' 89 import { useRoute, useRouter } from 'vue-router'
90 import { showImagePreview } from 'vant'; 90 import { showImagePreview } from 'vant';
91 import { storeToRefs } from 'pinia' 91 import { storeToRefs } from 'pinia'
...@@ -102,6 +102,8 @@ const { audio_status, audio_entity, audio_list_status, audio_list_entity } = sto ...@@ -102,6 +102,8 @@ const { audio_status, audio_entity, audio_list_status, audio_list_entity } = sto
102 const $route = useRoute(); 102 const $route = useRoute();
103 const $router = useRouter(); 103 const $router = useRouter();
104 104
105 +const page_target = computed(() => $route.query.target);
106 +
105 const themeVars = ref({ 107 const themeVars = ref({
106 swipeIndicatorInactiveBackground: '#fff', 108 swipeIndicatorInactiveBackground: '#fff',
107 swipeIndicatorMargin: '1.5rem', 109 swipeIndicatorMargin: '1.5rem',
...@@ -313,12 +315,23 @@ const goTo = () => { // 打开标记地图显示 ...@@ -313,12 +315,23 @@ const goTo = () => { // 打开标记地图显示
313 } 315 }
314 316
315 const goBack = () => { // 返回首页 317 const goBack = () => { // 返回首页
318 + const target = page_target.value;
319 + if (target === 'xys') {
320 + $router.push({
321 + path: '/xys',
322 + query: {
323 + id: $route.query.id,
324 + }
325 + })
326 + } else {
316 $router.push({ 327 $router.push({
317 path: '/bieyuan/map', 328 path: '/bieyuan/map',
318 query: { 329 query: {
319 id: $route.query.id, 330 id: $route.query.id,
331 + marker_id: $route.query.marker_id
320 } 332 }
321 }) 333 })
334 + }
322 } 335 }
323 336
324 const showBack = computed(() => $router.currentRoute.value.path === '/bieyuan/info'); 337 const showBack = computed(() => $router.currentRoute.value.path === '/bieyuan/info');
......