fix: 修复通知公告铃铛图标加载错误

This commit is contained in:
weiwei committed 2025-08-14 11:29:53 +08:00
1 parent ccb2a8b31e
commit 0c2a68a43e
2 files changed
+164 -154

No files matched your search

+1 -1
View File
@@ -32,7 +32,7 @@ const getDetail = async () => {
</script>
<template>
<crud-layout title="订单详情" tabBarType="just-flot-back" bg="/static/page/blue-bg.png">
<crud-layout title="菜品详情" tabBarType="just-flot-back" bg="/static/page/blue-bg.png">
<view v-if="state.detail">
<image class="w-100vw" :src="filePath(state.detail.picUrl)" mode="widthFix" />
<view class="p-x-15rpx">
+163 -153
View File
@@ -1,220 +1,230 @@
<template>
<view class="notice-header">
<view class="back-btn" @click="goBack">
<text class="iconfont icon-fanhui"></text> 返回
</view>
</view>
<view class="notice-container">
<view class="notice-list">
<view v-if="noticeList.length === 0" class="empty-tip">
暂无公告
</view>
<view v-else>
<view
v-for="item in noticeList"
:key="item.id"
class="notice-item"
>
<view class="item-main">
<view class="icon-area">
<view class="icon-bell">
<view class="red-dot"></view>
<text class="iconfont icon-lingdang"></text>
</view>
</view>
<view class="content-area">
<view class="title">{{ item.title }}</view>
<view class="summary">{{ item.summary || item.content }}</view>
</view>
</view>
<view class="item-footer">
<view class="detail-btn" @click="viewDetail(item)">查看详情 &gt;</view>
<view class="date">{{ formatDate(item.createTime) }}</view>
</view>
</view>
</view>
</view>
<view v-if="hasMore" class="load-more" @click="loadMore">
<text>加载更多</text>
</view>
</view>
<view class="notice-header">
<view class="back-btn" @click="goBack"> <text class="iconfont icon-fanhui"></text> 返回 </view>
</view>
<view class="notice-container">
<view class="notice-list">
<view v-if="noticeList.length === 0" class="empty-tip"> 暂无公告 </view>
<view v-else>
<view v-for="item in noticeList" :key="item.id" class="notice-item">
<view class="item-main">
<view class="icon-area">
<view class="icon-bell">
<view class="red-dot"></view>
<text class="iconfont">
<svg
t="1755142010765"
class="icon"
viewBox="0 0 1024 1024"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
p-id="12392"
width="24"
height="24"
>
<path
d="M512 960c49.6 0 88-38.4 88-88H424c0 49.6 38.4 88 88 88z m288.8-286.4V444.8c0-137.6-97.6-252.8-224.8-283.2v-28.8c0-32-17.6-60.8-48-67.2-44-10.4-80 23.2-80 66.4v30.4C320.8 192 223.2 307.2 223.2 444.8v228.8L136 763.2v44.8h752v-44.8l-87.2-89.6z"
p-id="12393"
data-spm-anchor-id="a313x.search_index.0.i6.61dc3a812gyLD2"
class="selected"
fill="#3976DA"
></path>
</svg>
</text>
</view>
</view>
<view class="content-area">
<view class="title">{{ item.title }}</view>
<view class="summary">{{ item.summary || item.content }}</view>
</view>
</view>
<view class="item-footer">
<view class="detail-btn" @click="viewDetail(item)">查看详情 &gt;</view>
<view class="date">{{ formatDate(item.createTime) }}</view>
</view>
</view>
</view>
</view>
<view v-if="hasMore" class="load-more" @click="loadMore">
<text>加载更多</text>
</view>
</view>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue'
import { noticeApi } from '@/sheep/api'
import { ref, onMounted } from "vue"
import { noticeApi } from "@/sheep/api"
const noticeList = ref<any[]>([])
const currentPage = ref(1)
const hasMore = ref(true)
function formatDate(time: string) {
if (!time) return ''
const d = new Date(time)
const y = d.getFullYear()
const m = (d.getMonth() + 1).toString().padStart(2, '0')
const day = d.getDate().toString().padStart(2, '0')
return `${y}.${m}.${day}`
if (!time) return ""
const d = new Date(time)
const y = d.getFullYear()
const m = (d.getMonth() + 1).toString().padStart(2, "0")
const day = d.getDate().toString().padStart(2, "0")
return `${y}.${m}.${day}`
}
function viewDetail(item: any) {
uni.navigateTo({
url: `/pages/integrated/notice/detail?id=${item.id}`
})
uni.navigateTo({
url: `/pages/integrated/notice/detail?id=${item.id}`,
})
}
async function loadNoticeList(reset = false) {
try {
const params = {
current: currentPage.value,
size: 10
}
const response: any = await noticeApi.getNoticePage(params)
if (response.code === 0 && response.data) {
const records = response.data.records || []
if (reset) {
noticeList.value = records
} else {
noticeList.value = [...noticeList.value, ...records]
}
hasMore.value = records.length === 10
}
} catch (error) {
console.error('加载公告列表失败:', error)
}
try {
const params = {
current: currentPage.value,
size: 10,
}
const response: any = await noticeApi.getNoticePage(params)
if (response.code === 0 && response.data) {
const records = response.data.records || []
if (reset) {
noticeList.value = records
} else {
noticeList.value = [...noticeList.value, ...records]
}
hasMore.value = records.length === 10
}
} catch (error) {
console.error("加载公告列表失败:", error)
}
}
function loadMore() {
if (!hasMore.value) return
currentPage.value++
loadNoticeList()
if (!hasMore.value) return
currentPage.value++
loadNoticeList()
}
function goBack() {
uni.navigateBack()
uni.navigateBack()
}
onMounted(() => {
loadNoticeList(true)
loadNoticeList(true)
})
</script>
<style lang="scss" scoped>
@import url('//at.alicdn.com/t/font_1234567_lingdang.css'); /* 替换为你的iconfont地址 */
.notice-header {
display: flex;
align-items: center;
height: 88rpx;
background: #fff;
padding-left: 24rpx;
box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.04);
margin-bottom: 16rpx;
display: flex;
align-items: center;
height: 88rpx;
background: #fff;
padding-left: 24rpx;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.04);
margin-bottom: 16rpx;
}
.back-btn {
display: flex;
align-items: center;
font-size: 30rpx;
color: #1976d2;
cursor: pointer;
display: flex;
align-items: center;
font-size: 30rpx;
color: #1976d2;
cursor: pointer;
}
.back-btn .iconfont {
font-size: 36rpx;
margin-right: 8rpx;
font-size: 36rpx;
margin-right: 8rpx;
}
.notice-container {
background: #f5f5f5;
min-height: 100vh;
background: #f5f5f5;
min-height: 100vh;
}
.notice-list {
padding: 24rpx;
padding: 24rpx;
}
.notice-item {
background: #fff;
border-radius: 16rpx;
margin-bottom: 32rpx;
box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.04);
padding: 32rpx 32rpx 24rpx 32rpx;
background: #fff;
border-radius: 16rpx;
margin-bottom: 32rpx;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.04);
padding: 32rpx 32rpx 24rpx 32rpx;
}
.item-main {
display: flex;
align-items: flex-start;
display: flex;
align-items: flex-start;
}
.icon-area {
margin-right: 24rpx;
position: relative;
margin-right: 24rpx;
position: relative;
}
.icon-bell {
width: 48rpx;
height: 48rpx;
background: #e3f2fd;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
position: relative;
width: 48rpx;
height: 48rpx;
background: #e3f2fd;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
position: relative;
}
.icon-bell .iconfont {
font-size: 32rpx;
color: #1976d2;
font-size: 32rpx;
color: #1976d2;
}
.red-dot {
width: 14rpx;
height: 14rpx;
background: #f44336;
border-radius: 50%;
position: absolute;
top: 4rpx;
right: 4rpx;
border: 2rpx solid #fff;
width: 14rpx;
height: 14rpx;
background: #f44336;
border-radius: 50%;
position: absolute;
top: 4rpx;
right: 4rpx;
border: 2rpx solid #fff;
}
.content-area {
flex: 1;
min-width: 0;
flex: 1;
min-width: 0;
}
.title {
font-size: 30rpx;
font-weight: bold;
color: #222;
margin-bottom: 8rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 30rpx;
font-weight: bold;
color: #222;
margin-bottom: 8rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.summary {
font-size: 26rpx;
color: #888;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 26rpx;
color: #888;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.item-footer {
display: flex;
justify-content: space-between;
align-items: center;
border-top: 1rpx solid #f0f0f0;
margin-top: 18rpx;
padding-top: 12rpx;
display: flex;
justify-content: space-between;
align-items: center;
border-top: 1rpx solid #f0f0f0;
margin-top: 18rpx;
padding-top: 12rpx;
}
.detail-btn {
color: #1976d2;
font-size: 26rpx;
cursor: pointer;
color: #1976d2;
font-size: 26rpx;
cursor: pointer;
}
.date {
color: #999;
font-size: 24rpx;
color: #999;
font-size: 24rpx;
}
.empty-tip {
text-align: center;
color: #999;
font-size: 28rpx;
padding: 60rpx 0;
text-align: center;
color: #999;
font-size: 28rpx;
padding: 60rpx 0;
}
.load-more {
text-align: center;
color: #007aff;
font-size: 28rpx;
padding: 32rpx 0;
cursor: pointer;
text-align: center;
color: #007aff;
font-size: 28rpx;
padding: 32rpx 0;
cursor: pointer;
}
</style>
</style>