更新若干
This commit is contained in:
1 parent
54c90072fb
commit
5682069553
59 files changed
+3813
-1617
No files matched your search
@@ -1,47 +1,6 @@
|
||||
<template>
|
||||
<view class="oa-dash">
|
||||
<template v-if="part !== 'bottom'">
|
||||
<view class="dash-card">
|
||||
<view class="dash-head">
|
||||
<view class="dash-head-left">
|
||||
<view class="head-icon hi-notice">
|
||||
<FaIcon name="bullhorn" color="#2563eb" :size="12" />
|
||||
</view>
|
||||
<text class="dash-title">公告</text>
|
||||
</view>
|
||||
<view class="dash-more" @tap="emit('view-notices')">
|
||||
<text class="dash-more-text">查看全部</text>
|
||||
<FaIcon name="chevron-right" color="#94a3b8" :size="11" />
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="!notices.length" class="dash-empty">
|
||||
<FaIcon name="bullhorn" color="#c0c4cc" :size="24" />
|
||||
<text class="dash-empty-text">暂无公告</text>
|
||||
</view>
|
||||
<swiper
|
||||
v-else
|
||||
class="notice-swiper"
|
||||
vertical
|
||||
autoplay
|
||||
circular
|
||||
:interval="3000"
|
||||
:duration="500"
|
||||
>
|
||||
<swiper-item v-for="n in notices" :key="n.id" @tap="emit('view-notices')">
|
||||
<view class="notice-line">
|
||||
<view class="notice-main">
|
||||
<text class="notice-tag" :class="'nt-' + (n.notice_type || 0)">
|
||||
{{ noticeTypeLabel(n.notice_type) }}
|
||||
</text>
|
||||
<text v-if="n.is_top === 1" class="notice-top">置顶</text>
|
||||
<text class="notice-title">{{ n.title }}</text>
|
||||
</view>
|
||||
<text class="notice-time">{{ noticeTime(n.publish_time) }}</text>
|
||||
</view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</view>
|
||||
|
||||
<view class="dash-card">
|
||||
<view class="dash-head">
|
||||
<view class="dash-head-left">
|
||||
@@ -148,7 +107,7 @@ const props = defineProps({
|
||||
data: { type: Object, default: () => ({}) },
|
||||
part: { type: String, default: 'top' }
|
||||
})
|
||||
const emit = defineEmits(['view-notices', 'view-schedules'])
|
||||
const emit = defineEmits(['view-schedules'])
|
||||
|
||||
const num = (v) => Number(v || 0)
|
||||
|
||||
@@ -187,22 +146,6 @@ const statusList = computed(() => {
|
||||
.map((x) => ({ ...x, pct: Math.round((num(x.count) / total) * 100) + '%' }))
|
||||
})
|
||||
|
||||
const notices = computed(() => props.data?.notices || [])
|
||||
|
||||
const noticeTypeLabel = (type) => ({ 1: '公告', 2: '活动' }[type] || '通知')
|
||||
|
||||
const pad2 = (n) => String(n).padStart(2, '0')
|
||||
const fmtDate = (d) => `${d.getFullYear()}-${pad2(d.getMonth() + 1)}-${pad2(d.getDate())}`
|
||||
function noticeTime(ts) {
|
||||
if (!ts) return ''
|
||||
const d = new Date(String(ts).replace(/-/g, '/'))
|
||||
if (Number.isNaN(d.getTime())) return String(ts).slice(5, 10)
|
||||
const now = new Date()
|
||||
if (fmtDate(d) === fmtDate(now)) return `${pad2(d.getHours())}:${pad2(d.getMinutes())}`
|
||||
if (d.getFullYear() === now.getFullYear()) return `${d.getMonth() + 1}/${d.getDate()}`
|
||||
return `${d.getFullYear()}-${d.getMonth() + 1}-${d.getDate()}`
|
||||
}
|
||||
|
||||
const money = (value) =>
|
||||
Number(value || 0).toLocaleString('zh-CN', { minimumFractionDigits: 2, maximumFractionDigits: 2 })
|
||||
</script>
|
||||
@@ -242,7 +185,6 @@ const money = (value) =>
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
&.hi-notice,
|
||||
&.hi-stat {
|
||||
background: $color-primary-bg;
|
||||
}
|
||||
@@ -277,19 +219,6 @@ const money = (value) =>
|
||||
color: $color-text-muted;
|
||||
}
|
||||
|
||||
.dash-empty {
|
||||
padding: 36rpx 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 12rpx;
|
||||
}
|
||||
|
||||
.dash-empty-text {
|
||||
font-size: 24rpx;
|
||||
color: $color-text-muted;
|
||||
}
|
||||
|
||||
.stat-tile {
|
||||
padding: 20rpx 20rpx 8rpx;
|
||||
border-radius: $radius-md;
|
||||
@@ -503,63 +432,4 @@ const money = (value) =>
|
||||
color: $color-text-muted;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.notice-swiper {
|
||||
height: 68rpx;
|
||||
}
|
||||
|
||||
.notice-line {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12rpx;
|
||||
height: 68rpx;
|
||||
|
||||
&:active {
|
||||
opacity: 0.6;
|
||||
}
|
||||
}
|
||||
|
||||
.notice-main {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10rpx;
|
||||
}
|
||||
|
||||
.notice-tag {
|
||||
flex-shrink: 0;
|
||||
font-size: 20rpx;
|
||||
padding: 2rpx 12rpx;
|
||||
border-radius: $radius-sm;
|
||||
background: $color-primary-bg;
|
||||
color: $color-primary;
|
||||
|
||||
&.nt-2 {
|
||||
background: #ecfdf5;
|
||||
color: $color-success;
|
||||
}
|
||||
}
|
||||
|
||||
.notice-top {
|
||||
flex-shrink: 0;
|
||||
font-size: 20rpx;
|
||||
color: $color-danger;
|
||||
}
|
||||
|
||||
.notice-title {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
font-size: 26rpx;
|
||||
color: $color-text;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.notice-time {
|
||||
flex-shrink: 0;
|
||||
font-size: 20rpx;
|
||||
color: $color-text-muted;
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user