feat: 添加通知公告功能和相关页面

refactor: 重构财务类型选项为独立变量

docs: 更新版本记录规则和文档

feat(workbench): 新增通知公告列表和详情页面

feat(h5office): 添加h5office文档预览组件和相关配置

style: 优化文章页面样式和布局

fix(update): 添加版本检查日志输出
This commit is contained in:
砂糖
2025-11-07 10:30:50 +08:00
parent 307b46b213
commit 884b1bb311
17 changed files with 2175 additions and 33 deletions

View File

@@ -1,22 +1,220 @@
<template>
<view>
</view>
<view class="article-container">
<!-- 加载状态 -->
<view class="loading" v-if="loading">
<uni-loading-icon size="24" color="#007aff"></uni-loading-icon>
<text class="loading-text">加载中...</text>
</view>
<!-- 文章内容加载完成后显示 -->
<view class="article-content" v-else-if="article">
<!-- 帖子标题 -->
<view class="post-title">{{ article.title || '无标题' }}</view>
<!-- 用户信息 -->
<view class="user-info">
<image v-if="article.avatar" class="user-avatar" :src="article.avatar || '/static/default-avatar.png'" mode="cover"></image>
<view class="user-meta">
<view class="user-name">
{{ article.author || '未知用户' }}
<!-- <view class="user-level">Lv.1</view> -->
</view>
<view class="user-time-area">
<text>{{ article.createTime || '未知时间' }}</text>
<text v-if="article.area"> · {{ article.area || '未知地区' }}</text>
</view>
</view>
<!-- <view class="follow-btn">+关注</view> -->
</view>
<!-- 富文本内容 -->
<mp-html :content="article.content"></mp-html>
</view>
<!-- 错误状态 -->
<view class="error" v-else>
<uni-icons type="warn" size="36" color="#ff4d4f"></uni-icons>
<text class="error-text">加载失败</text>
<button class="retry-btn" @click="reload">重试</button>
</view>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
}
}
import { getNotice } from '@/api/oa/notice';
export default {
data() {
return {
article: null,
loading: true,
};
},
onLoad(options) {
const { type, id } = options;
if (!type || !id) {
uni.showToast({ title: '参数错误', icon: 'none' });
setTimeout(() => uni.navigateBack(), 1000);
return;
}
this.fetchData(type, id);
},
methods: {
fetchData(type, id) {
this.loading = true;
switch (type) {
case 'notice':
getNotice(id)
.then(res => {
this.article = {
...res.data,
author: res.data.createBy,
title: res.data.noticeTitle,
content: res.data.noticeContent,
};
this.loading = false;
})
.catch(err => {
console.error('获取文章失败', err);
this.article = null;
this.loading = false;
uni.showToast({ title: '加载失败', icon: 'none' });
});
break;
default:
uni.showToast({ title: '未知类型', icon: 'none' });
setTimeout(() => uni.navigateBack(), 1000);
break;
}
},
reload() {
const { type, id } = this.$options.onLoad.options;
this.fetchData(type, id);
},
navigateBack() {
uni.navigateBack();
}
}
};
</script>
<style>
<style scoped>
.article-container {
min-height: 100vh;
background-color: #fff;
}
</style>
.loading {
display: flex;
flex-direction: column;
align-items: center;
padding: 50px 0;
}
.loading-text {
margin-top: 10px;
color: #666;
font-size: 14px;
}
.error {
display: flex;
flex-direction: column;
align-items: center;
padding: 50px 0;
}
.error-text {
margin: 15px 0;
color: #ff4d4f;
font-size: 16px;
}
.retry-btn {
background-color: #007aff;
color: #fff;
border-radius: 4px;
padding: 8px 20px;
font-size: 14px;
}
.article-content {
padding: 16px;
}
.post-title {
font-size: 18px;
font-weight: bold;
color: #333;
margin-bottom: 12px;
line-height: 1.4;
}
.user-info {
display: flex;
align-items: center;
margin-bottom: 16px;
}
.user-avatar {
width: 40px;
height: 40px;
border-radius: 50%;
margin-right: 10px;
}
.user-meta {
flex: 1;
}
.user-name {
display: flex;
align-items: center;
font-size: 14px;
color: #333;
margin-bottom: 4px;
}
.user-level {
background-color: #dff0d8;
color: #5cb85c;
font-size: 10px;
padding: 1px 4px;
border-radius: 3px;
margin-left: 6px;
}
.user-time-area {
font-size: 12px;
color: #999;
}
.follow-btn {
font-size: 12px;
color: #5cb85c;
background-color: #e8f5e9;
padding: 4px 8px;
border-radius: 12px;
}
.mp-html {
font-size: 15px;
color: #333;
line-height: 1.8;
}
.mp-html img {
max-width: 100%;
height: auto;
margin: 10px 0;
border-radius: 8px;
}
.interact-area {
display: flex;
justify-content: space-around;
margin-top: 20px;
padding: 10px 0;
border-top: 1px solid #eee;
}
.interact-item {
display: flex;
flex-direction: column;
align-items: center;
font-size: 12px;
color: #999;
}
.interact-count {
margin-top: 4px;
}
</style>

View File

@@ -109,6 +109,12 @@ export default {
url: '/pages/workbench/customer/customer',
category: '信息中心'
},
{
text: '通知公告',
icon: '/static/images/notice.png',
url: '/pages/workbench/notice/notice',
category: '信息中心'
},
{
text: '库存盘点',
icon: '/static/images/stock.png',

View File

@@ -1,22 +1,98 @@
<template>
<view>
</view>
<!-- 通知公告列表展示noticeTitle createBy, createTime -->
<div class="notice-list-container">
<!-- 判空提示 -->
<div class="empty-tip" v-if="notices.length === 0">
暂无通知公告
</div>
<!-- 公告列表 -->
<div class="notice-list" v-else>
<div class="notice-item" v-for="(notice, index) in notices" :key="index" @click="toDetail(notice.noticeId)">
<div class="notice-title">{{ notice.noticeTitle }}</div>
<div class="notice-meta">
<span class="create-by">{{ notice.createBy || '未知发布人' }}</span>
<span class="create-time">{{ notice.createTime || '未知时间' }}</span>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
import { listNotice } from '@/api/oa/notice.js'
export default {
data() {
return {
notices: []
}
},
mounted() {
listNotice({ pageSize: 999, pageNum: 1 }).then(res => {
// 确保res.rows存在避免空数据报错
this.notices = res?.rows || [];
}).catch(err => {
console.error('获取通知公告失败', err);
this.notices = [];
});
},
methods: {
toDetail(id) {
uni.navigateTo({
url: '/pages/workbench/article/article?type=notice&id=' + id
})
}
}
}
</script>
<style>
<style scoped lang="scss">
.notice-list-container {
background-color: #f5f5f5; // 米色背景
padding: 15px;
min-height: 100vh; // 避免容器过矮
</style>
.empty-tip {
text-align: center;
padding: 30px 0;
color: #999;
font-size: 14px;
}
.notice-list {
.notice-item {
background-color: #fff; // 白色公告背景
padding: 12px 15px;
margin-bottom: 10px;
border-radius: 6px;
box-shadow: 0 1px 2px rgba(0,0,0,0.05); // 轻微阴影增强层次感
.notice-title {
font-size: 16px;
font-weight: 500;
color: #333;
margin-bottom: 8px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis; // 标题过长省略
}
.notice-meta {
display: flex;
justify-content: space-between; // 发布人和时间两端对齐
font-size: 13px;
color: #666;
.create-by {
&:after {
content: '|'; // 分隔符
margin: 0 8px;
color: #ccc;
}
}
}
}
}
}
</style>

View File

@@ -64,10 +64,7 @@
<uni-forms ref="financeForm" :model="form" :rules="rules" label-width="150rpx">
<uni-forms-item label="财务类型" name="financeType">
<uni-data-checkbox mode="tag" v-model="form.financeType" :localdata="[
{ value: "1", text: '出账' },
{ value: '2', text: '入账' }
]"></uni-data-checkbox>
<uni-data-checkbox mode="tag" v-model="form.financeType" :localdata="financeTypeOption"></uni-data-checkbox>
</uni-forms-item>
<uni-forms-item label="记录名称" name="financeTitle">
@@ -282,6 +279,10 @@ export default {
currentFinance: {
detailList: []
},
financeTypeOption: [
{ value: "1", text: '出账' },
{ value: '2', text: '入账' }
],
loading: false,
// 表单数据 - 默认包含一条空明细