|
|
@@ -44,6 +44,29 @@
|
|
|
class="official-account"
|
|
|
></official-account>
|
|
|
|
|
|
+ <!-- 公告栏 -->
|
|
|
+ <view class="notice-bar" v-if="state.noticeList.length > 0" @click="handleNoticeClick">
|
|
|
+ <view class="notice-icon">
|
|
|
+ <text class="notice-icon-text">公告</text>
|
|
|
+ </view>
|
|
|
+ <swiper
|
|
|
+ class="notice-swiper"
|
|
|
+ vertical
|
|
|
+ circular
|
|
|
+ :autoplay="state.noticeList.length > 1"
|
|
|
+ :interval="3000"
|
|
|
+ :duration="600"
|
|
|
+ :disable-touch="true"
|
|
|
+ >
|
|
|
+ <swiper-item v-for="(item, idx) in state.noticeList" :key="idx">
|
|
|
+ <text class="notice-text">{{ item.title }}</text>
|
|
|
+ </swiper-item>
|
|
|
+ </swiper>
|
|
|
+ <view class="notice-arrow" v-if="state.noticeList.length > 1">
|
|
|
+ <text class="notice-arrow-text">丨</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+
|
|
|
<!-- 优化后的菜单区域 -->
|
|
|
<view class="menu-section">
|
|
|
<view class="menu-card">
|
|
|
@@ -148,6 +171,7 @@ const bannerHeight = ref(0)
|
|
|
const initState = () => ({
|
|
|
bannerList: [],
|
|
|
swiperList: [],
|
|
|
+ noticeList: [],
|
|
|
menuList: [
|
|
|
{name: "wash", auth: false, title: "洗车", icon: '/static/iconfont/default/fastwash.svg'},
|
|
|
{name: "charge", auth: true, title: "充值", icon: '/static/iconfont/default/recharge.svg'},
|
|
|
@@ -245,6 +269,7 @@ const loadInitData = () => {
|
|
|
}
|
|
|
|
|
|
loadBannerList();
|
|
|
+ loadNoticeList();
|
|
|
}
|
|
|
|
|
|
const addListener = () => {
|
|
|
@@ -272,6 +297,25 @@ const loadBannerList = () => {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+const loadNoticeList = () => {
|
|
|
+ get(`/notice/client/list`).then((res: any) => {
|
|
|
+ console.log('公告数据:', JSON.stringify(res));
|
|
|
+ state.noticeList = res || [];
|
|
|
+ }).catch((err: any) => {
|
|
|
+ console.error('公告加载失败:', err);
|
|
|
+ state.noticeList = [];
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+const handleNoticeClick = () => {
|
|
|
+ uni.showModal({
|
|
|
+ title: '公告详情',
|
|
|
+ content: state.noticeList.map((n: any, i: number) => `${i + 1}. ${n.title}\n${n.content || ''}`).join('\n\n'),
|
|
|
+ showCancel: false,
|
|
|
+ confirmText: '我知道了'
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
const handleBannerClick = (index: number) => {
|
|
|
let ele = state.bannerList[index];
|
|
|
if (ele && ele.linkUrl) {
|
|
|
@@ -467,6 +511,58 @@ page {
|
|
|
margin: 8rpx 0 16rpx;
|
|
|
}
|
|
|
|
|
|
+// 公告栏
|
|
|
+.notice-bar {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ margin: 0 24rpx 16rpx;
|
|
|
+ padding: 16rpx 20rpx;
|
|
|
+ background: #FFF7F0;
|
|
|
+ border-radius: 12rpx;
|
|
|
+ border: 1rpx solid rgba(198, 23, 30, 0.08);
|
|
|
+
|
|
|
+ .notice-icon {
|
|
|
+ flex-shrink: 0;
|
|
|
+ margin-right: 16rpx;
|
|
|
+
|
|
|
+ .notice-icon-text {
|
|
|
+ display: inline-block;
|
|
|
+ background: linear-gradient(135deg, #C6171E, #E84545);
|
|
|
+ color: #fff;
|
|
|
+ font-size: 20rpx;
|
|
|
+ font-weight: 600;
|
|
|
+ padding: 4rpx 12rpx;
|
|
|
+ border-radius: 6rpx;
|
|
|
+ line-height: 1.4;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .notice-swiper {
|
|
|
+ flex: 1;
|
|
|
+ height: 40rpx;
|
|
|
+ overflow: hidden;
|
|
|
+ }
|
|
|
+
|
|
|
+ .notice-text {
|
|
|
+ font-size: 26rpx;
|
|
|
+ color: #333;
|
|
|
+ line-height: 40rpx;
|
|
|
+ overflow: hidden;
|
|
|
+ text-overflow: ellipsis;
|
|
|
+ white-space: nowrap;
|
|
|
+ }
|
|
|
+
|
|
|
+ .notice-arrow {
|
|
|
+ flex-shrink: 0;
|
|
|
+ margin-left: 12rpx;
|
|
|
+
|
|
|
+ .notice-arrow-text {
|
|
|
+ font-size: 24rpx;
|
|
|
+ color: #ccc;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
// 优化后的菜单区域
|
|
|
.menu-section {
|
|
|
padding: 0 24rpx;
|