fix(diy-notice): 修复并优化公告组件交互与显示逻辑

1. 为横向滚动公告项添加点击跳转事件
2. 为上下滚动的swiper-item补充点击事件
3. 增加item.link存在性校验避免空指针
4. 点击无链接公告时优先显示content内容
This commit is contained in:
2026-07-06 11:56:20 +08:00
parent 960f4ebaaa
commit dd90d60a14

View File

@@ -9,7 +9,8 @@
<view class="notice-xian"></view>
<view class="main-wrap">
<!-- 横向滚动 -->
<view class="horizontal-wrap" v-if="value.scrollWay == 'horizontal'">
<view class="horizontal-wrap" v-if="value.scrollWay == 'horizontal'"
@tap="toLink(list[0])">
<view class="marquee-wrap">
<view class="marquee" :style="marqueeStyle">
<text v-for="(item, index) in list" :key="index"
@@ -27,7 +28,8 @@
<!-- 上下滚动 -->
<template v-if="value.scrollWay == 'upDown'">
<swiper :vertical="true" :duration="500" autoplay="true" circular="true">
<swiper-item v-for="(item, index) in list" :key="index" @touchmove.prevent.stop>
<swiper-item v-for="(item, index) in list" :key="index"
@touchmove.prevent.stop @tap="toLink(item)">
<text class="beyond-hiding using-hidden"
:style="{ color: value.textColor, fontSize: value.fontSize * 2 + 'rpx', fontWeight: value.fontWeight }">
{{ item.title }}
@@ -136,11 +138,11 @@ export default {
});
} else if (!item) {
this.$util.redirectTo('/pages_tool/notice/list');
} else if (Object.keys(item.link).length > 1) {
} else if (item.link && Object.keys(item.link).length > 1) {
this.$util.diyRedirectTo(item.link);
} else {
// 如果不设置跳转链接,则点击弹框展示
this.notice = item.title;
this.notice = item.content || item.title || '';
this.$refs.noticePopup.open();
}
},