Browse Source

通知公告类别,搜索,详情

master
ZhaoYang 2 months ago
parent
commit
48474197e5
  1. 3
      app.json
  2. 2
      pages/home/home.wxss
  3. 7
      pagesA/pages/expertChat/expertChat.wxml
  4. 15
      pagesA/pages/expertChat/expertChat.wxss
  5. 274
      pagesA/pages/noticeList/noticeList.js
  6. 44
      pagesA/pages/noticeList/noticeList.wxml
  7. 101
      pagesA/pages/noticeList/noticeList.wxss
  8. 100
      pagesA/pages/noticeListDetails/noticeListDetails.js
  9. 4
      pagesA/pages/noticeListDetails/noticeListDetails.json
  10. 102
      pagesA/pages/noticeListDetails/noticeListDetails.wxml
  11. 353
      pagesA/pages/noticeListDetails/noticeListDetails.wxss
  12. 14
      utils/api.js
  13. 4
      utils/baseUrl.js

3
app.json

@ -19,7 +19,8 @@
"pages/medicine/medicine",
"pages/medicineDetails/medicineDetails",
"pages/attestation/attestation",
"pages/noticeList/noticeList"
"pages/noticeList/noticeList",
"pages/noticeListDetails/noticeListDetails"
]
},
{

2
pages/home/home.wxss

@ -360,7 +360,7 @@
.notice-more {
font-size: 24rpx;
color: #96DBD4;
color: #6ddacf;
padding: 8rpx 16rpx;
background: rgba(150, 219, 212, 0.1);
border-radius: 20rpx;

7
pagesA/pages/expertChat/expertChat.wxml

@ -35,7 +35,7 @@
<!-- 对方消息 -->
<view class="message-item message-left" wx:if="{{item.sender === 'expert'}}">
<view class="message-avatar">
<image src="/pagesA/images/1.png" class="avatar-img"></image>
<image src="/pagesA/images/name.png" class="avatar-img"></image>
</view>
<view class="message-content-wrapper">
@ -139,7 +139,7 @@
</view>
<view class="message-avatar">
<image src="/pagesA/images/2.png" class="avatar-img"></image>
<image src="/pages/images/tx.png" class="avatar-img"></image>
</view>
</view>
</block>
@ -151,7 +151,6 @@
</view>
<view class="empty-tip" wx:if="{{messageList.length === 0 && !loading}}">
<image src="/images/icons/empty_chat.png" class="empty-icon"></image>
<text class="empty-text">暂无聊天记录,开始咨询吧</text>
</view>
</scroll-view>
@ -186,7 +185,7 @@
<!-- 清空按钮 - 垂直居中 -->
<view class="input-actions" wx:if="{{inputValue}}">
<button class="clear-btn" bindtap="clearInput">
<image src="/images/icons/clear.png" class="clear-icon"></image>
<image src="/pagesA/images/ch.png" class="clear-icon"></image>
</button>
</view>
</view>

15
pagesA/pages/expertChat/expertChat.wxss

@ -366,12 +366,7 @@
color: #999999;
}
.empty-icon {
width: 200rpx;
height: 200rpx;
margin-bottom: 30rpx;
opacity: 0.6;
}
.empty-text {
font-size: 28rpx;
@ -419,7 +414,7 @@
flex: 1;
position: relative;
background: #f5f5f5;
border-radius: 36rpx;
border-radius: 10rpx;
min-height: 72rpx;
display: flex;
align-items: center;
@ -500,11 +495,11 @@
.send-btn {
background: linear-gradient(135deg, #07c160 0%, #06ae56 100%);
width: 112rpx;
height: 72rpx;
border-radius: 36rpx;
height: 66rpx;
border-radius: 10rpx;
border: none;
display: flex;
align-items: center;
align-items: center;s
justify-content: center;
transition: all 0.3s ease;
padding: 0;

274
pagesA/pages/noticeList/noticeList.js

@ -1,97 +1,279 @@
import http from '../../../utils/api'
Page({
data: {
// 分类数据
categories: [
{ name: '全部', value: 'all' },
{ name: '系统公告', value: 'system', tagBg: '#e9efff', importanceColor: '#3b82f6' },
{ name: '活动通知', value: 'activity', tagBg: '#f3e8ff', importanceColor: '#8b5cf6' },
{ name: '紧急提醒', value: 'urgent', tagBg: '#ffe4e2', importanceColor: '#ef4444' },
{ name: '学术讲座', value: 'academic', tagBg: '#dcfce7', importanceColor: '#10b981' },
{ name: '校园生活', value: 'campus', tagBg: '#fff3cd', importanceColor: '#f59e0b' },
],
currentCategory: 'all', // 当前选中分类
categories: [],
currentCategory: '全部', // 当前选中分类
currentType: '', // 当前选中的分类值
searchKeyword: '', // 搜索关键字
noticeList: [], // 渲染列表数据
pageIndex: 1, // 页码
pageSize: 8, // 每页条数
hasMore: true, // 是否有更多
loading: false, // 首次加载/加载中
loading: false, // 加载中
refreshing: false, // 下拉刷新状态
mockTotal: 28, // 模拟总条数
total: 0, // 总条数
searchTimer: null, // 搜索防抖定时器
isSearching: false, // 是否正在搜索
},
onLoad() {
// this.loadFirstPage();
this.getdisaster()
this.getwarningType()
this.fetchNotices(true)
},
onUnload() {
// 页面卸载时清除定时器
if (this.data.searchTimer) {
clearTimeout(this.data.searchTimer)
}
},
// 通知公告
getdisaster(){
http.disaster({
data:{},
// 获取分类数据
getwarningType() {
http.warningType({
data: {
dictType: 'warning_type'
},
success: res => {
console.log(111,res);
console.log('分类数据:', res)
this.setData({
noticeList:res.rows
categories: res.rows || []
})
},
fail: err => {
console.error('获取分类失败:', err)
}
})
},
// 获取通知公告列表
fetchNotices(isRefresh = false) {
const { pageIndex, pageSize, searchKeyword, currentType, loading, hasMore } = this.data
// 如果是刷新或者没有更多数据且不是刷新,则返回
if (!isRefresh && !hasMore) return
if (loading) return
this.setData({ loading: true })
// 构建请求参数
const params = {
pageNum: isRefresh ? 1 : pageIndex,
pageSize: pageSize,
}
// 添加搜索关键字(如果有关键字)
if (searchKeyword && searchKeyword.trim() !== '') {
params.keyword = searchKeyword.trim()
}
// 添加分类筛选(如果有分类且不是"全部")
if (currentType) {
params.warningType = currentType
}
console.log('请求参数:', params, '当前分类:', this.data.currentCategory, '当前类型:', currentType)
http.disaster({
data: params,
success: res => {
console.log('公告数据:', res)
const newList = res.rows || []
const total = res.total || 0
this.setData({
noticeList: isRefresh ? newList : [...this.data.noticeList, ...newList],
total: total,
hasMore: newList.length >= pageSize,
pageIndex: isRefresh ? 2 : pageIndex + 1,
loading: false,
refreshing: false,
isSearching: false
})
},
fail: err => {
console.error('获取公告失败:', err)
this.setData({
loading: false,
refreshing: false,
isSearching: false
})
wx.showToast({
title: '加载失败',
icon: 'none'
})
}
})
},
// 切换分类
switchCategory(e) {
const category = e.currentTarget.dataset.category;
if (category === this.data.currentCategory) return;
this.setData({ currentCategory: category });
this.loadFirstPage();
const category = e.currentTarget.dataset.category
const type = e.currentTarget.dataset.type || ''
if (category === this.data.currentCategory) return
console.log('切换分类:', category, type)
this.setData({
currentCategory: category,
currentType: type,
pageIndex: 1,
hasMore: true,
noticeList: []
}, () => {
// 切换分类后立即加载数据(保留当前搜索关键词)
this.fetchNotices(true)
})
},
// 搜索输入
// 搜索输入 - 实时搜索
onSearchInput(e) {
this.setData({ searchKeyword: e.detail.value });
const keyword = e.detail.value
this.setData({
searchKeyword: keyword,
isSearching: true
})
// 清除之前的定时器
if (this.data.searchTimer) {
clearTimeout(this.data.searchTimer)
}
// 设置新的定时器,300ms后执行搜索
const timer = setTimeout(() => {
this.performSearch()
}, 300)
this.setData({
searchTimer: timer
})
},
// 执行搜索
performSearch() {
const { searchKeyword } = this.data
console.log('执行搜索:', searchKeyword)
// 重置列表并加载新数据
this.setData({
pageIndex: 1,
hasMore: true,
noticeList: []
}, () => {
this.fetchNotices(true)
})
},
// 执行搜索(确认或点击清空后也会触发重置)
// 手动搜索(点击确认时
handleSearch() {
this.loadFirstPage();
// 清除防抖定时器
if (this.data.searchTimer) {
clearTimeout(this.data.searchTimer)
}
// 立即执行搜索
this.setData({
pageIndex: 1,
hasMore: true,
noticeList: []
}, () => {
this.fetchNotices(true)
})
},
// 清空搜索框
clearSearch() {
this.setData({ searchKeyword: '' }, () => {
this.loadFirstPage();
});
// 清除防抖定时器
if (this.data.searchTimer) {
clearTimeout(this.data.searchTimer)
}
this.setData({
searchKeyword: '',
pageIndex: 1,
hasMore: true,
noticeList: []
}, () => {
// 清空搜索后重新加载数据(保持当前分类)
this.fetchNotices(true)
})
},
// 上拉加载更多
loadMore() {
const { hasMore, loading, refreshing } = this.data;
if (!hasMore || loading || refreshing) return;
this.setData({ loading: true });
this.fetchNotices(false);
const { hasMore, loading, refreshing, isSearching } = this.data
if (!hasMore || loading || refreshing || isSearching) return
this.fetchNotices(false)
},
// 下拉刷新
onRefresh() {
this.setData({ refreshing: true });
// 重置到第一页
this.setData({ pageIndex: 1, hasMore: true }, () => {
this.fetchNotices(true);
});
// 清除防抖定时器
if (this.data.searchTimer) {
clearTimeout(this.data.searchTimer)
}
this.setData({
refreshing: true,
pageIndex: 1,
hasMore: true
}, () => {
this.fetchNotices(true)
})
},
// 查看详情 (仅跳转示意)
// 查看详情
viewDetail(e) {
const id = e.currentTarget.dataset.id;
wx.showToast({
title: `查看公告 ${id}`,
icon: 'none'
});
// 实际开发: wx.navigateTo...
const id = e.currentTarget.dataset.id
//跳转详情页
wx.navigateTo({
url: `/pagesA/pages/noticeListDetails/noticeListDetails?id=${id}`,
})
},
// 根据重要性获取颜色
getImportanceColor(level) {
const colorMap = {
'紧急': '#f43f5e',
'重要': '#f97316',
'一般': '#3b82f6'
}
return colorMap[level] || '#3b82f6'
},
// 获取标签背景色
getTagBg(level) {
const bgMap = {
'紧急': '#fee2e2',
'重要': '#fff3e0',
'一般': '#eef2ff'
}
return bgMap[level] || '#eef2ff'
},
// 获取级别文字颜色
getLevelColor(level) {
const colorMap = {
'紧急': '#f43f5e',
'重要': '#f97316',
'一般': '#3b82f6'
}
return colorMap[level] || '#3b82f6'
},
// 获取级别背景色
getLevelBg(level) {
const bgMap = {
'紧急': 'rgba(244, 63, 94, 0.1)',
'重要': 'rgba(249, 115, 22, 0.1)',
'一般': 'rgba(59, 130, 246, 0.1)'
}
return bgMap[level] || 'rgba(59, 130, 246, 0.1)'
}
})

44
pagesA/pages/noticeList/noticeList.wxml

@ -1,5 +1,5 @@
<view class="notice-page">
<!-- 毛玻璃背景装饰 -->
<!-- 背景 -->
<view class="bg-blur"></view>
<!-- 主内容区 -->
@ -22,18 +22,28 @@
</view>
</view>
<!-- 分类导航 - 滑动流畅 -->
<!-- 分类导航-->
<scroll-view class="category-scroll" scroll-x show-scrollbar="{{false}}" enhanced>
<view class="category-list">
<view
class="category-item {{currentCategory === '全部' ? 'active' : ''}}"
bindtap="switchCategory"
data-category="全部"
data-type=""
>
<text>全部</text>
<text class="dot" wx:if="{{currentCategory === '全部'}}"></text>
</view>
<view
wx:for="{{categories}}"
wx:key="index"
class="category-item {{currentCategory === item.value ? 'active' : ''}}"
class="category-item {{currentCategory === item.dictLabel ? 'active' : ''}}"
bindtap="switchCategory"
data-category="{{item.value}}"
data-category="{{item.dictLabel}}"
data-type="{{item.dictValue}}"
>
<text>{{item.name}}</text>
<text class="dot" wx:if="{{currentCategory === item.value}}"></text>
<text>{{item.dictLabel}}</text>
<text class="dot" wx:if="{{currentCategory === item.dictLabel}}"></text>
</view>
</view>
</scroll-view>
@ -68,18 +78,21 @@
data-id="{{item.id}}"
>
<!-- 重要性标记装饰 -->
<view class="card-left-bar" style="background: {{item.importanceColor}};"></view>
<view class="card-left-bar" style="background: {{getImportanceColor(item.warningLevel)}};"></view>
<view class="card-content">
<view class="card-header">
<text class="notice-title">{{item.title}}</text>
<text class="notice-tag" style="background: {{item.tagBg}};">{{item.warningType}}</text>
<text class="notice-tag" style="background: {{getTagBg(item.warningLevel)}};">{{item.warningType}}</text>
</view>
<view class="notice-abstract">{{item.responseMeasures}}</view>
<view class="notice-abstract">{{item.responseMeasures || '暂无摘要'}}</view>
<view class="card-footer">
<view class="date-time">
<text class="date-icon">📅</text>
<text>{{item.createdTime}}</text>
</view>
<view class="warning-level" style="color: {{getLevelColor(item.warningLevel)}}; background: {{getLevelBg(item.warningLevel)}};">
{{item.warningLevel || '一般'}}
</view>
</view>
</view>
</view>
@ -87,9 +100,13 @@
<!-- 上拉加载更多状态 -->
<view class="load-more" wx:if="{{noticeList.length > 0}}">
<block wx:if="{{hasMore}}">
<block wx:if="{{loading}}">
<text class="loading-icon">⋯</text>
<text>加载更多</text>
<text>加载中...</text>
</block>
<block wx:elif="{{hasMore}}">
<text class="loading-icon">↓</text>
<text>上拉加载更多</text>
</block>
<block wx:else>
<text>—— 已经到底了 ——</text>
@ -98,9 +115,10 @@
<!-- 空状态展示 -->
<view class="empty-state" wx:if="{{!loading && noticeList.length === 0}}">
<image src="/images/empty-notice.png" mode="aspectFit" style="width: 160rpx; height: 160rpx;" wx:if="{{false}}"></image>
<text>📭 暂无相关公告</text>
<text style="font-size: 28rpx; color: #999; margin-top: 16rpx;">试试其他关键词或分类</text>
<text style="font-size: 28rpx; color: #999; margin-top: 16rpx;">
{{searchKeyword ? '试试其他关键词' : currentCategory !== '全部' ? '试试其他分类' : '暂无数据'}}
</text>
</view>
</scroll-view>
</view>

101
pagesA/pages/noticeList/noticeList.wxss

@ -1,12 +1,14 @@
.page {
background: linear-gradient(145deg, #f5f7fa 0%, #f0f2f5 100%);
}
.notice-page {
min-height: 100vh;
background: transparent;
position: relative;
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, sans-serif;
}
.bg-blur {
position: fixed;
top: 0;
@ -19,6 +21,7 @@
z-index: 0;
pointer-events: none;
}
.content {
position: relative;
z-index: 2;
@ -32,6 +35,7 @@
.header {
margin-bottom: 36rpx;
}
.title {
font-size: 48rpx;
font-weight: 700;
@ -41,6 +45,7 @@
margin-bottom: 24rpx;
text-shadow: 0 4rpx 12rpx rgba(0,0,0,0.02);
}
.search-box {
background: rgba(255,255,255,0.7);
backdrop-filter: blur(8px);
@ -53,26 +58,31 @@
box-shadow: 0 8rpx 20rpx rgba(0,0,0,0.02), 0 2rpx 4rpx rgba(0,0,0,0.02);
transition: all 0.2s;
}
.search-box:focus-within {
border-color: #b2d9ff;
background: rgba(255,255,255,0.9);
box-shadow: 0 12rpx 28rpx rgba(0,120,255,0.08);
}
.search-box .icon {
font-size: 32rpx;
color: #7c8ea0;
margin-right: 16rpx;
}
.search-box input {
flex: 1;
font-size: 30rpx;
padding: 8rpx 0;
color: #1e293b;
}
.placeholder {
color: #9aa6b2;
font-weight: 400;
}
.clear-icon {
font-size: 36rpx;
color: #8e9dac;
@ -86,7 +96,7 @@
justify-content: center;
}
/* 分类导航 — 磨砂质感 */
/* 分类导航 */
.category-scroll {
white-space: nowrap;
margin-bottom: 32rpx;
@ -97,10 +107,12 @@
padding: 8rpx 0;
border: 1rpx solid rgba(255,255,255,0.8);
}
.category-list {
display: inline-flex;
padding: 0 24rpx;
}
.category-item {
display: inline-flex;
flex-direction: column;
@ -116,12 +128,14 @@
position: relative;
font-weight: 500;
}
.category-item.active {
background: #ffffff;
color: #1e4bd2;
font-weight: 600;
box-shadow: 0 6rpx 14rpx rgba(0,80,255,0.1);
}
.dot {
width: 8rpx;
height: 8rpx;
@ -138,16 +152,19 @@
border-radius: 40rpx 40rpx 0 0;
margin-top: 8rpx;
}
.notice-scroll {
height: 100%;
padding-bottom: 20rpx;
}
.notice-list {
display: flex;
flex-direction: column;
gap: 28rpx;
}
/* 卡片设计 — 轻盈毛玻璃 */
/* 卡片设计 */
.notice-card {
background: rgba(255,255,255,0.7);
backdrop-filter: blur(16px);
@ -159,25 +176,30 @@
overflow: hidden;
transition: transform 0.2s, box-shadow 0.3s;
}
.notice-card:active {
transform: scale(0.99);
box-shadow: 0 4rpx 12rpx rgba(0,0,0,0.04);
}
.card-left-bar {
width: 12rpx;
flex-shrink: 0;
background: #3b82f6;
}
.card-content {
flex: 1;
padding: 32rpx 28rpx;
}
.card-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 16rpx;
}
.notice-title {
font-size: 34rpx;
font-weight: 600;
@ -187,6 +209,7 @@
text-overflow: ellipsis;
white-space: nowrap;
}
.notice-tag {
font-size: 24rpx;
padding: 8rpx 24rpx;
@ -196,6 +219,7 @@
font-weight: 500;
letter-spacing: 1rpx;
}
.notice-abstract {
font-size: 28rpx;
color: #55657a;
@ -207,6 +231,7 @@
overflow: hidden;
text-overflow: ellipsis;
}
.card-footer {
display: flex;
justify-content: space-between;
@ -214,13 +239,22 @@
color: #778a9b;
font-size: 26rpx;
}
.date-time, .view-count {
.date-time {
display: flex;
align-items: center;
gap: 8rpx;
}
/* 加载更多 / 状态 */
.warning-level {
font-size: 26rpx;
font-weight: 500;
padding: 4rpx 16rpx;
border-radius: 30rpx;
background: rgba(255,255,255,0.5);
}
/* 加载更多*/
.load-more {
text-align: center;
padding: 48rpx 0 36rpx;
@ -231,11 +265,13 @@
justify-content: center;
gap: 12rpx;
}
.loading-icon {
font-size: 48rpx;
line-height: 1;
animation: pulse 1.2s infinite;
}
@keyframes pulse {
0%, 100% { opacity: 0.6; }
50% { opacity: 1; }
@ -245,6 +281,7 @@
.skeleton-list {
padding: 0 8rpx;
}
.skeleton-item {
background: rgba(255,255,255,0.6);
border-radius: 32rpx;
@ -253,6 +290,7 @@
position: relative;
overflow: hidden;
}
.skeleton-item::after {
content: "";
position: absolute;
@ -263,6 +301,7 @@
background: linear-gradient(90deg, transparent, rgba(255,255,255,0.7), transparent);
animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
100% { left: 100%; }
}
@ -282,8 +321,60 @@
margin-top: 60rpx;
}
/* 模拟图片(无实际图片用文字代替) */
.empty-state text:first-of-type {
font-size: 64rpx;
margin-bottom: 24rpx;
}
.warning-level {
font-size: 26rpx;
font-weight: 500;
padding: 6rpx 20rpx;
border-radius: 30rpx;
background: rgba(59, 130, 246, 0.1);
backdrop-filter: blur(4px);
-webkit-backdrop-filter: blur(4px);
}
/* 搜索状态提示 */
.searching-indicator {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: rgba(0, 0, 0, 0.7);
color: white;
padding: 20rpx 40rpx;
border-radius: 60rpx;
font-size: 28rpx;
z-index: 100;
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
}
/* 优化空状态提示 */
.empty-state {
background: rgba(255, 255, 255, 0.5);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
border-radius: 40rpx;
margin-top: 80rpx;
padding: 80rpx 40rpx;
}
.empty-state text:first-of-type {
font-size: 60rpx;
margin-bottom: 24rpx;
opacity: 0.8;
}
.empty-state text:last-of-type {
background: rgba(255, 255, 255, 0.6);
padding: 12rpx 32rpx;
border-radius: 60rpx;
color: #666;
font-size: 28rpx;
margin-top: 24rpx;
}

100
pagesA/pages/noticeListDetails/noticeListDetails.js

@ -0,0 +1,100 @@
import http from '../../../utils/api'
Page({
data: {
noticeDetail: {}, // 公告详情
loading: true, // 加载中
},
onLoad(options) {
const { id } = options
if (id) {
this.fetchNoticeDetail(id)
} else {
this.setData({ loading: false })
wx.showToast({
title: '参数错误',
icon: 'none'
})
}
},
// 获取公告详情
fetchNoticeDetail(id) {
http.disasterDetail({
data: { id },
success: res => {
console.log('详情数据:', res)
if (res.code === 200 && res.data) {
this.setData({
noticeDetail: res.data,
loading: false
})
} else {
this.setData({ loading: false })
wx.showToast({
title: res.msg || '数据加载失败',
icon: 'none'
})
}
},
fail: err => {
console.error('获取详情失败:', err)
this.setData({ loading: false })
wx.showToast({
title: '网络错误',
icon: 'none'
})
}
})
},
// 返回上一页
goBack() {
wx.navigateBack({
delta: 1
})
},
// 格式化应对措施
formatMeasures(measures) {
if (!measures) return []
// 按数字序号分割
const items = measures.split(/[0-9]+\./).filter(item => item.trim() !== '')
return items.map(item => item.trim())
},
// 获取分类标签背景色
getTagBg(type) {
const bgMap = {
'天气预警': '#e0f2fe',
'安全提醒': '#f3e8ff',
'通知公告': '#eef2ff',
'重要通知': '#fff3e0',
'紧急通知': '#fee2e2'
}
return bgMap[type] || '#eef2ff'
},
// 获取级别标签背景色
getLevelBg(level) {
const bgMap = {
'紧急': '#fee2e2',
'重要': '#fff3e0',
'通知': '#eef2ff',
'一般': '#f1f5f9'
}
return bgMap[level] || '#f1f5f9'
},
// 获取级别文字颜色
getLevelColor(level) {
const colorMap = {
'紧急': '#b91c1c',
'重要': '#b45309',
'通知': '#1e40af',
'一般': '#334155'
}
return colorMap[level] || '#334155'
}
})

4
pagesA/pages/noticeListDetails/noticeListDetails.json

@ -0,0 +1,4 @@
{
"navigationBarTitleText":"通知公告详情",
"usingComponents": {}
}

102
pagesA/pages/noticeListDetails/noticeListDetails.wxml

@ -0,0 +1,102 @@
<view class="detail-page">
<!-- 背景 -->
<view class="bg-blur"></view>
<!-- 加载中状态 -->
<view class="loading-container" wx:if="{{loading}}">
<view class="loading-spinner"></view>
<text>加载中...</text>
</view>
<!-- 主要内容 -->
<scroll-view
class="detail-scroll"
scroll-y
enhanced
show-scrollbar="{{false}}"
wx:else
>
<view class="detail-content" wx:if="{{noticeDetail.id}}">
<!-- 标题卡片 -->
<view class="title-card">
<!-- 分类标签 -->
<view class="category-wrap">
<view class="category-tag" style="background: {{getTagBg(noticeDetail.warningType)}}; color: {{getLevelColor(noticeDetail.warningLevel)}};">
{{noticeDetail.warningType || '通知公告'}}
</view>
<view class="level-tag" style="background: {{getLevelBg(noticeDetail.warningLevel)}}; color: {{getLevelColor(noticeDetail.warningLevel)}};">
{{noticeDetail.warningLevel}}
</view>
</view>
<!-- 标题 -->
<text class="title">{{noticeDetail.title}}</text>
<!-- 时间信息 -->
<view class="time-info">
<text class="time-icon">📅</text>
<text class="time-text">发布时间:{{noticeDetail.createdTime || noticeDetail.lastUpdated || '未知时间'}}</text>
</view>
</view>
<!-- 影响区域卡片 -->
<view class="info-card" wx:if="{{noticeDetail.affectedRegions}}">
<view class="info-header">
<text class="info-icon">📍</text>
<text class="info-title">影响区域</text>
</view>
<view class="region-tags">
<text class="region-tag">
{{noticeDetail.affectedRegions}}
</text>
</view>
</view>
<!-- 简要内容卡片 -->
<view class="content-card" wx:if="{{noticeDetail.briefContent}}">
<view class="content-header">
<text class="content-icon">📋</text>
<text class="content-title">简要内容</text>
</view>
<view class="brief-content">
<rich-text nodes="{{noticeDetail.briefContent}}" space="emsp"></rich-text>
</view>
</view>
<!-- 详细内容卡片 -->
<view class="content-card" wx:if="{{noticeDetail.detailContent}}">
<view class="content-header">
<text class="content-icon">📄</text>
<text class="content-title">详细内容</text>
</view>
<view class="detail-body">
<rich-text nodes="{{noticeDetail.detailContent}}" space="emsp"></rich-text>
</view>
</view>
<!-- 应对措施卡片 -->
<view class="measures-card" wx:if="{{noticeDetail.responseMeasures}}">
<view class="measures-header">
<text class="measures-icon">🛡️</text>
<text class="measures-title">应对措施</text>
</view>
<view class="measures-list">
<view class="measure-item" >
<text class="measure-text">{{noticeDetail.responseMeasures}}</text>
</view>
</view>
</view>
<!-- 底部留白 -->
<view class="bottom-space"></view>
</view>
<!-- 错误状态 -->
<view class="error-state" wx:else>
<image src="/images/empty-notice.png" mode="aspectFit" style="width: 240rpx; height: 240rpx;" wx:if="{{false}}"></image>
<text class="error-emoji">📭</text>
<text class="error-text">公告不存在或已删除</text>
<button class="back-btn" bindtap="goBack">返回列表</button>
</view>
</scroll-view>
</view>

353
pagesA/pages/noticeListDetails/noticeListDetails.wxss

@ -0,0 +1,353 @@
.detail-page {
min-height: 100vh;
background: transparent;
position: relative;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}
.bg-blur {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: linear-gradient(145deg, #f8fafd 0%, #f1f5f9 100%);
z-index: 0;
pointer-events: none;
}
/* 加载状态 */
.loading-container {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
display: flex;
flex-direction: column;
align-items: center;
gap: 24rpx;
color: #64748b;
font-size: 28rpx;
}
.loading-spinner {
width: 80rpx;
height: 80rpx;
border: 4rpx solid #e2e8f0;
border-top-color: #3b82f6;
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
/* 滚动内容 */
.detail-scroll {
height: 100vh;
position: relative;
z-index: 2;
}
.detail-content {
padding: 24rpx 32rpx 40rpx;
}
/* 卡片通用样式 */
.title-card,
.info-card,
.content-card,
.measures-card {
background: rgba(255, 255, 255, 0.9);
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
border-radius: 32rpx;
padding: 32rpx;
margin-bottom: 24rpx;
box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.02), 0 2rpx 4rpx rgba(0, 0, 0, 0.02);
border: 1rpx solid rgba(255, 255, 255, 0.8);
}
/* 标题卡片 */
.title-card {
margin-top: 8rpx;
}
.category-wrap {
display: flex;
align-items: center;
gap: 16rpx;
margin-bottom: 24rpx;
}
.category-tag,
.level-tag {
display: inline-block;
padding: 8rpx 24rpx;
border-radius: 60rpx;
font-size: 24rpx;
font-weight: 500;
background: #eef2ff;
}
.title {
font-size: 44rpx;
font-weight: 700;
color: #0f172a;
line-height: 1.4;
margin-bottom: 24rpx;
display: block;
letter-spacing: 0.5rpx;
}
.time-info {
display: flex;
align-items: center;
gap: 8rpx;
padding-top: 24rpx;
border-top: 1rpx solid #e2e8f0;
}
.time-icon {
font-size: 32rpx;
opacity: 0.6;
}
.time-text {
font-size: 26rpx;
color: #64748b;
}
/* 卡片头部 */
.info-header,
.content-header,
.measures-header {
display: flex;
align-items: center;
gap: 12rpx;
margin-bottom: 24rpx;
}
.info-icon,
.content-icon,
.measures-icon {
font-size: 36rpx;
}
.info-title,
.content-title,
.measures-title {
font-size: 32rpx;
font-weight: 600;
color: #1e293b;
}
/* 影响区域 */
.region-tags {
display: flex;
flex-wrap: wrap;
gap: 16rpx;
}
.region-tag {
font-size: 28rpx;
display: block;
}
/* 内容卡片 */
.brief-content,
.detail-body {
font-size: 32rpx;
color: #334155;
line-height: 1.7;
background: #f8fafc;
padding: 28rpx;
border-radius: 24rpx;
border: 1rpx solid #e2e8f0;
}
/* 应对措施卡片 */
.measures-list {
display: flex;
flex-direction: column;
gap: 20rpx;
}
.measure-item {
display: flex;
align-items: flex-start;
gap: 16rpx;
background: #f8fafc;
padding: 24rpx;
border-radius: 20rpx;
border: 1rpx solid #e2e8f0;
}
.measure-number {
width: 40rpx;
height: 40rpx;
background: #3b82f6;
color: white;
font-size: 24rpx;
font-weight: 600;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}
.measure-text {
flex: 1;
font-size: 30rpx;
color: #334155;
line-height: 1.5;
}
/* 底部留白 */
.bottom-space {
height: 40rpx;
}
/* 错误状态 */
.error-state {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background: rgba(255, 255, 255, 0.9);
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
padding: 60rpx 80rpx;
border-radius: 48rpx;
border: 1rpx solid rgba(255, 255, 255, 0.8);
box-shadow: 0 20rpx 40rpx rgba(0, 0, 0, 0.02);
min-width: 500rpx;
}
.error-emoji {
font-size: 120rpx;
margin-bottom: 24rpx;
opacity: 0.8;
}
.error-text {
font-size: 32rpx;
color: #475569;
margin-bottom: 48rpx;
}
.back-btn {
background: #3b82f6;
color: white;
font-size: 30rpx;
padding: 20rpx 60rpx;
border-radius: 48rpx;
border: none;
box-shadow: 0 8rpx 24rpx rgba(59, 130, 246, 0.3);
}
.back-btn:active {
opacity: 0.8;
transform: scale(0.98);
}
/* 富文本样式 */
rich-text {
width: 100%;
}
rich-text p {
margin-bottom: 16rpx;
}
rich-text h1,
rich-text h2,
rich-text h3,
rich-text h4 {
font-weight: 600;
color: #0f172a;
margin: 24rpx 0 16rpx;
}
rich-text h1 { font-size: 40rpx; }
rich-text h2 { font-size: 36rpx; }
rich-text h3 { font-size: 34rpx; }
rich-text h4 { font-size: 32rpx; }
rich-text ul,
rich-text ol {
padding-left: 40rpx;
margin: 16rpx 0;
}
rich-text li {
margin-bottom: 8rpx;
color: #334155;
}
rich-text a {
color: #3b82f6;
text-decoration: underline;
}
rich-text img {
max-width: 100%;
border-radius: 20rpx;
margin: 20rpx 0;
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05);
}
rich-text blockquote {
border-left: 6rpx solid #3b82f6;
background: #f1f5f9;
padding: 20rpx 24rpx;
margin: 20rpx 0;
border-radius: 12rpx;
color: #475569;
font-style: italic;
}
rich-text table {
width: 100%;
border-collapse: collapse;
margin: 20rpx 0;
background: white;
border-radius: 16rpx;
overflow: hidden;
}
rich-text td,
rich-text th {
border: 1rpx solid #e2e8f0;
padding: 16rpx;
text-align: left;
}
rich-text th {
background: #f8fafc;
font-weight: 600;
color: #1e293b;
}
rich-text code {
background: #f1f5f9;
padding: 4rpx 12rpx;
border-radius: 8rpx;
font-family: monospace;
color: #dc2626;
}
rich-text pre {
background: #1e293b;
color: #e2e8f0;
padding: 24rpx;
border-radius: 20rpx;
overflow-x: auto;
margin: 20rpx 0;
}

14
utils/api.js

@ -21,6 +21,11 @@ function disaster(params) {
http('/muhu/warning/list', 'get', params)
}
// 通知公告详情
function disasterDetail(params) {
http('/muhu/warning/' + params.data.id, 'get', params)
}
// 地图导航药店诊所
function pharmacy(params) {
http('/muhu/info/list', 'get', params)
@ -212,6 +217,12 @@ function feedback(params) {
http('/muhu/feedback', 'post', params)
}
// 预警类型
function warningType(params) {
http('/system/dict/data/list', 'get', params)
}
export default { // 暴露接口
@ -219,5 +230,6 @@ export default { // 暴露接口
search,trend,feed,sales,wzd,wzdxq,wzdAdd,expertsList,recommendationList,policyeZd,
recommendationXq,queryList,tipList,article,articleDetails,articleZd,policyelucidation,
areaChildren,userCode,UserInfo,videoList,videoZd,videoDetails,forumList,forumAdd,forumDetails,
forumReply,commentReply,experience,experiencezd,experienceDetails,realName,revise,feedback
forumReply,commentReply,experience,experiencezd,experienceDetails,realName,revise,feedback,
warningType,disasterDetail
}

4
utils/baseUrl.js

@ -1,5 +1,5 @@
var baseUrl = 'https://wx.chenhaitech.com/ymtx-prod-api'
// var baseUrl = 'http://192.168.101.109:8080'
// var baseUrl = 'https://wx.chenhaitech.com/ymtx-prod-api'
var baseUrl = 'http://192.168.101.109:8080'
// var baseUrl = 'http://192.168.101.105:8082'
// var baseUrl = 'http://192.168.101.111:8081'
module.exports = baseUrl
Loading…
Cancel
Save