更新若干

This commit is contained in:
hero920103 committed 2026-11-17 17:16:02 +08:00
1 parent 54c90072fb
commit 5682069553
59 files changed
+3813 -1617

No files matched your search

+234 -2
View File
@@ -9,6 +9,10 @@
<text class="hero-name">{{ sub.title }}</text>
<text class="hero-desc">{{ sub.desc }}</text>
</view>
<view v-if="isOa" class="hero-notice" hover-class="hero-notice-on" @tap="openNotices">
<FaIcon name="bell" color="#ffffff" :size="20" />
<view v-if="noticeCount > 0" class="notice-badge">{{ noticeCount > 99 ? '99+' : noticeCount }}</view>
</view>
</view>
</view>
@@ -27,15 +31,49 @@
</scroll-view>
</view>
<view v-if="noticeVisible" class="popup-mask" @tap="closeNotices">
<view class="notice-sheet" @tap.stop>
<view class="notice-head">
<text class="notice-sheet-title">最新公告</text>
<view class="notice-more" @tap="goNoticeList">
<text class="notice-more-text">全部</text>
<FaIcon name="chevron-right" color="#8a94ad" :size="11" />
</view>
</view>
<scroll-view class="notice-body" scroll-y :show-scrollbar="false">
<view v-if="notices.length === 0" class="notice-empty">
<FaIcon name="bullhorn" color="#c0c4cc" :size="26" />
<text class="notice-empty-text">暂无公告</text>
</view>
<view
v-for="item in notices"
:key="item.id"
class="notice-item"
@tap="goNoticeDetail(item.id)"
>
<view class="notice-dot" :class="{ 'notice-dot-top': item.is_top }" />
<view class="notice-item-body">
<text class="notice-item-title">{{ item.title }}</text>
<text class="notice-item-time">{{ item.publish_time || item.publisher_name || '' }}</text>
</view>
<FaIcon name="chevron-right" color="#c0c4cc" :size="11" />
</view>
</scroll-view>
</view>
</view>
<AppTabbar variant="switch" :current="activeTab" :tabs="tabs" @change="onTabChange" />
</view>
</template>
<script setup>
import { ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { ref, computed } from 'vue'
import { onLoad, onShow } from '@dcloudio/uni-app'
import { getSubsystem } from '@/config/subsystems.js'
import { mpHeadPad } from '@/utils/mpHead.js'
import { fetchNotices } from '@/api/oa.js'
import { isLoggedIn } from '@/utils/auth.js'
import { getGuestToken } from '@/utils/guest.js'
import AppTabbar from '@/components/AppTabbar.vue'
import SubHome from '@/components/sub/SubHome.vue'
import SubFunctions from '@/components/sub/SubFunctions.vue'
@@ -55,12 +93,56 @@ const visited = ref({ home: true, functions: false, mine: false })
const headPad = mpHeadPad()
const isOa = computed(() => String((sub.value && sub.value.module) || '').toLowerCase() === 'oa')
const notices = ref([])
const noticeTotal = ref(0)
const noticeVisible = ref(false)
const noticeCount = computed(() => Number(noticeTotal.value) || notices.value.length)
async function loadNotices() {
if (!isOa.value) return
if (!isLoggedIn() && !getGuestToken()) return
try {
const res = await fetchNotices({ pageSize: 10 })
notices.value = res.list || []
noticeTotal.value = res.total || 0
} catch (e) {
notices.value = []
noticeTotal.value = 0
}
}
function openNotices() {
noticeVisible.value = true
if (!notices.value.length && noticeTotal.value > 0) loadNotices()
}
function closeNotices() {
noticeVisible.value = false
}
function goNoticeList() {
closeNotices()
uni.navigateTo({ url: '/pages/oa/notice/index' })
}
function goNoticeDetail(id) {
closeNotices()
uni.navigateTo({ url: `/pages/oa/notice/detail?id=${id}` })
}
onLoad((options) => {
slug.value = options && options.slug ? options.slug : 'crm'
sub.value = getSubsystem(slug.value)
if (!sub.value) uni.reLaunch({ url: '/pages/nav/nav' })
})
onShow(() => {
loadNotices()
})
function onTabChange(name) {
activeTab.value = name
if (!visited.value[name]) visited.value[name] = true
@@ -151,4 +233,154 @@ function goBackNav() {
.pane-bottom {
height: 32rpx;
}
.hero-notice {
position: relative;
margin-left: auto;
flex-shrink: 0;
width: 64rpx;
height: 64rpx;
border-radius: 50%;
background: rgba(255, 255, 255, 0.18);
border: 1rpx solid rgba(255, 255, 255, 0.28);
display: flex;
align-items: center;
justify-content: center;
&.hero-notice-on {
opacity: 0.7;
}
}
.notice-badge {
position: absolute;
top: -10rpx;
right: -10rpx;
min-width: 32rpx;
height: 32rpx;
padding: 0 8rpx;
box-sizing: border-box;
border-radius: $radius-full;
background: #f04438;
color: #ffffff;
font-size: 20rpx;
line-height: 32rpx;
text-align: center;
}
.popup-mask {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 999;
background: rgba(15, 23, 42, 0.5);
display: flex;
align-items: center;
justify-content: center;
padding: 60rpx;
}
.notice-sheet {
width: 100%;
max-height: 900rpx;
background: $color-card;
border-radius: $radius-lg;
box-shadow: $shadow-float;
display: flex;
flex-direction: column;
overflow: hidden;
@include sheet-responsive(560px);
}
.notice-head {
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: space-between;
padding: 26rpx 28rpx 18rpx;
border-bottom: 1rpx solid $color-divider;
}
.notice-sheet-title {
font-size: 30rpx;
font-weight: 600;
color: $color-text;
}
.notice-more {
display: flex;
align-items: center;
gap: 4rpx;
}
.notice-more-text {
font-size: 24rpx;
color: $color-text-muted;
}
.notice-body {
flex: 1;
height: 0;
padding: 8rpx 28rpx 20rpx;
}
.notice-empty {
display: flex;
flex-direction: column;
align-items: center;
gap: 12rpx;
padding: 80rpx 0;
}
.notice-empty-text {
font-size: 24rpx;
color: $color-text-muted;
}
.notice-item {
display: flex;
align-items: center;
gap: 14rpx;
padding: 22rpx 0;
border-bottom: 1rpx solid $color-divider;
&:last-child {
border-bottom: none;
}
}
.notice-dot {
flex-shrink: 0;
width: 12rpx;
height: 12rpx;
border-radius: 50%;
background: $color-primary-light;
&.notice-dot-top {
background: #f04438;
}
}
.notice-item-body {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
gap: 6rpx;
}
.notice-item-title {
font-size: 28rpx;
color: $color-text;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.notice-item-time {
font-size: 22rpx;
color: $color-text-muted;
}
</style>