对接公区收益

This commit is contained in:
zhouyanli
2026-07-22 17:38:59 +08:00
parent e68579a5d3
commit 6cb10fee08
7 changed files with 146 additions and 99 deletions

View File

@@ -1,65 +1,77 @@
<template>
<view class="container">
<!-- 内容区域 -->
<!-- <scroll-view class="content-scroll" scroll-y> -->
<view class="status-bar" :style="{ height: statusBarHeight + 'px' }"></view>
<uni-nav-bar title="收益详情" backgroundColor="transparent" :border="false" left-icon="left"
@click-left="goBack" />
<!-- 暂无数据 -->
<view v-if="isLoaded && !noticeDetail.noticeTitle" class="empty-state">
<uni-icons type="info" size="30" color="#ccc"></uni-icons>
<text class="empty-text">暂无数据</text>
</view>
<!-- 文章标题 -->
<view class="article-header">
<view class="article-header" v-if="noticeDetail.noticeTitle">
<view class="article-title">
{{noticeDetail.noticeTitle}}
</view>
</view>
<!-- 作者和日期 -->
<view class="notice-meta">
<view class="notice-meta" v-if="noticeDetail.noticeTitle">
<view class="notice-author">
<text class="author-name">{{noticeDetail.author}}</text>
<text class="separator">·</text>
<!-- <text class="author-name">{{noticeDetail.author}}</text> -->
<!-- <text class="separator">·</text> -->
<text class="publish-time">{{noticeDetail.publishTime}}</text>
</view>
</view>
<!-- 文章内容 -->
<view class="article-content">
<view class="article-content" v-if="noticeDetail.noticeTitle">
<view class="paragraph" v-html="noticeDetail.noticeContent"></view>
<view class="articleimg">
</view>
</view>
</view>
</template>
<script setup>
import { ref, onMounted } from 'vue'
import { onLoad, onShow } from '@dcloudio/uni-app'
import {getNoticeDetails} from '../api/api.js'
import {revenueDetails} from '../api/apiSub.js'
const isLoading = ref(false)
const isLoaded = ref(false)
const noticeDetail = ref({})
const currentNoticeId = ref('') // 接收公告跳转的id
const statusBarHeight = ref(uni.getSystemInfoSync().statusBarHeight || 0)
// =====方法====
onLoad((options) =>{
currentNoticeId.value = options?.id
// console.log('currentNoticeId',currentNoticeId.value)
console.log('收益id---------',currentNoticeId.value)
if(currentNoticeId.value){
getDetailsData(currentNoticeId.value)
} else {
isLoaded.value = true
}
// console.log('currentNoticeId',currentNoticeId.value)
})
// 获取详情数据
const getDetailsData = async (noticeId) =>{
try{
const res = await getNoticeDetails(noticeId)
const res = await revenueDetails({ id: noticeId })
if(res.code === 200){
noticeDetail.value = res.data || {}
noticeDetail.value = res.data
uni.$emit('noticeRead',{
noticeId:noticeId,
readStatus:noticeDetail.value.readStatus
})
}
}catch(err){
@@ -67,10 +79,16 @@
title: err.msg ||"网络异常",
icon:"none"
})
}finally{
isLoaded.value = true
}
}
// 返回
const goBack = () => {
uni.navigateBack()
}
</script>
<style lang="scss" scoped>
@@ -79,6 +97,25 @@
background-color: #ffffff;
padding: 20px;
}
.status-bar {
width: 100%;
flex-shrink: 0;
}
/* 暂无数据 */
.empty-state {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding-top: 200rpx;
.empty-text {
font-size: 28rpx;
color: #999;
margin-top: 20rpx;
}
}
/* 内容滚动区域 */
.content-scroll {
@@ -91,7 +128,7 @@
.article-header {
// padding: 24px 20px 20px;
// border-bottom: 1px solid #f0f0f0;
.article-title {
font-size: 32rpx;
font-weight: bold;
@@ -100,28 +137,28 @@
margin-bottom: 16px;
text-align: center;
}
.article-meta {
display: flex;
align-items: center;
justify-content: center;
color: #666666;
font-size: 14px;
.meta-item {
display: flex;
align-items: center;
.meta-icon {
font-size: 14px;
margin-right: 4px;
}
.meta-text {
font-size: 14px;
}
}
.meta-divider {
margin: 0 12px;
color: #cccccc;
@@ -137,29 +174,29 @@
color: #666;
font-size: 24rpx;
margin: 0 30rpx;
.notice-author {
display: flex;
align-items: center;
.author-name {
color: #666;
}
.separator {
margin: 0 6px;
color: #ccc;
}
.publish-time {
color: #999;
}
}
.notice-time {
display: flex;
align-items: center;
.date-text {
margin-left: 4px;
color: #999;
@@ -175,9 +212,9 @@
font-size: 28rpx;
.articleimg{
width: 100%;
height: 330rpx;
height: 330rpx;
}
.paragraph {
margin-bottom: 20px;
text-align: justify;
@@ -192,20 +229,20 @@
margin: 10px 0;
}
}
.bullet-list {
margin: 20px 0 20px 2em;
.bullet-item {
display: flex;
margin-bottom: 12px;
.bullet-dot {
color: #666666;
margin-right: 8px;
flex-shrink: 0;
}
.bullet-text {
flex: 1;
color: #333333;
@@ -221,12 +258,12 @@
border-top: 1px solid #f0f0f0;
border-bottom: 1px solid #f0f0f0;
margin-top: 20px;
.section-title {
display: flex;
align-items: center;
margin-bottom: 20px;
.title-text {
font-size: 18px;
font-weight: 600;
@@ -234,14 +271,14 @@
white-space: nowrap;
margin-right: 12px;
}
.title-line {
flex: 1;
height: 1px;
background-color: #e0e0e0;
}
}
.attachments-list {
.attachment-item {
display: flex;
@@ -252,33 +289,33 @@
border-radius: 8px;
margin-bottom: 12px;
border: 1px solid #e8e8e8;
&:active {
background-color: #f5f5f5;
}
&:last-child {
margin-bottom: 0;
}
.attachment-left {
display: flex;
align-items: center;
flex: 1;
.file-icon {
font-size: 24px;
margin-right: 12px;
&.doc-icon {
color: #2b579a; /* Word文档蓝色 */
}
&.pdf-icon {
color: #e74c3c; /* PDF红色 */
}
}
.file-info {
.file-name {
font-size: 16px;
@@ -286,14 +323,14 @@
margin-bottom: 4px;
font-weight: 500;
}
.file-size {
font-size: 13px;
color: #666666;
}
}
}
.download-btn {
width: 40px;
height: 40px;
@@ -302,7 +339,7 @@
display: flex;
align-items: center;
justify-content: center;
.download-icon {
font-size: 18px;
color: #333333;
@@ -318,23 +355,23 @@
display: flex;
flex-direction: column;
align-items: center;
.footer-text {
font-size: 16px;
color: #999999;
margin-bottom: 20px;
}
.footer-info {
display: flex;
align-items: center;
font-size: 13px;
color: #999999;
.info-item {
padding: 0 8px;
}
.info-divider {
color: #dddddd;
}
@@ -348,7 +385,7 @@
margin: 0 auto;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}
.article-header,
.article-content,
.attachments-section,
@@ -363,72 +400,72 @@
.container {
background-color: #1a1a1a;
}
.custom-navbar {
background-color: #1a1a1a;
border-bottom-color: #333333;
.nav-back,
.nav-title {
color: #ffffff;
}
.nav-actions .action-icon {
color: #ffffff;
}
}
.content-scroll {
background-color: #1a1a1a;
}
.article-header {
border-bottom-color: #333333;
.article-title {
color: #ffffff;
}
.article-meta {
color: #999999;
}
}
.article-content {
color: #e0e0e0;
.bullet-item .bullet-text {
color: #e0e0e0;
}
}
.attachments-section {
background-color: #2a2a2a;
border-top-color: #333333;
border-bottom-color: #333333;
.section-title .title-text {
color: #ffffff;
}
.attachment-item {
background-color: #2a2a2a;
border-color: #333333;
&:active {
background-color: #333333;
}
.file-info .file-name {
color: #ffffff;
}
.file-info .file-size {
color: #999999;
}
}
}
.page-footer {
.footer-text,
.footer-info {

View File

@@ -1,6 +1,6 @@
<template>
<view class="page">
<view class="status_bar"></view>
<view class="status_bar" :style="{ height: statusBarHeight + 'px' }"></view>
<!-- 固定导航栏 -->
<uni-nav-bar
left-icon="left"
@@ -30,11 +30,11 @@
:key="revenue.noticeId"
class="item">
<view class="title-box">
<view class="title">{{ revenue.title }}</view>
<view class="title">{{ revenue.noticeTitle }}</view>
<view class="dot" v-if="revenue.readStatus === '0'"></view>
</view>
<view class="info">{{ revenue.author }} · {{ revenue.publishTime }}</view>
<view class="content" v-html="revenue.content"></view>
<view class="info">{{ revenue.publishTime }}</view>
<view class="content" v-html="revenue.noticeContent"></view>
<view class="detail" @click="goToDetail(revenue)">
<text style="color:#2F77FD;font-size: 24rpx;">详情</text>
<uni-icons type="right" size="13" color="#007AFF"/>
@@ -56,12 +56,9 @@
<script setup>
import { ref } from 'vue'
import { onLoad ,onShow,onUnload} from '@dcloudio/uni-app'
// import { getRevenueList } from '../api/api.js'
import { getRevenueList } from '../api/apiSub.js'
const revenueList = ref([
{title:'公区收益告知书',author:'张三',publishTime:'2026-7-15',content:'费用明细'},
{title:'公区收益告知书',author:'张三',publishTime:'2026-7-15'},
])
const revenueList = ref([])
const refreshing = ref(false)
const loadingMore = ref(false)
const noMoreData = ref(false)
@@ -69,10 +66,11 @@ const loading = ref(false)
const pageNum = ref(1)
const pageSize = 10
const isFirstShow = ref(true) // 详情返回列表刷新状态
const statusBarHeight = ref(uni.getSystemInfoSync().statusBarHeight || 0)
const goToDetail = (notice) => {
uni.navigateTo({
url: `/pageSubPack/inspection-revenue/public-revenue-details`
url: `/pageSubPack/inspection-revenue/public-revenue-details?id=${notice.noticeId}`
})
}
@@ -98,13 +96,13 @@ const loadRevenue = async (isRefresh = false) => {
}
}
// 更新单条已读状态
const updateReadStatus = ({ revenueId, readStatus }) => {
const item = revenueList.value.find(n => String(n.revenueId) === revenueId)
const updateReadStatus = ({ noticeId, readStatus }) => {
const item = revenueList.value.find(n => String(n.noticeId) === String(noticeId))
if (item) {
item.readStatus = readStatus
}
}
onShow(() =>{
if(isFirstShow.value) return
// loadRevenue(true)
@@ -150,8 +148,8 @@ page {
flex-direction: column;
}
.status_bar {
height: 46px;
width: 100%;
flex-shrink: 0;
}
.scroll-box {
flex: 1;
@@ -231,7 +229,7 @@ page {
padding: 100rpx 0;
color: #ccc;
}
.empty-text {
font-size: 28rpx;
color: #999;