更新若干

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

+56 -1
View File
@@ -43,7 +43,62 @@ const parsed = computed(() => {
return { name: raw.replace(/^fa-/, ''), brands: props.type === 'brands' }
})
const iconChar = computed(() => FA_ICONS[parsed.value.name] || '')
// Element Plus / 历史菜单使用的是 PascalCase 图标名,这里统一转换为 Font Awesome 名称
const ICON_ALIAS = {
notebook: 'book',
tickets: 'ticket',
ticket: 'ticket',
document: 'file-lines',
files: 'folder-open',
calendar: 'calendar-days',
reading: 'book-open',
postcard: 'envelope',
chatdotround: 'comments',
chatdot: 'comment',
editpen: 'pen',
pencil: 'pen',
pricetag: 'tag',
operation: 'sliders',
coin: 'coins',
goods: 'box',
setting: 'gear',
dataline: 'chart-line',
officebuilding: 'building',
fold: 'folder',
menu: 'bars',
search: 'magnifying-glass',
bell: 'bell',
notification: 'bell',
homefilled: 'house',
position: 'location-dot',
promotion: 'gift',
discount: 'tag',
userfilled: 'user',
documentcopy: 'copy',
memo: 'note-sticky',
management: 'list',
tools: 'wrench',
service: 'headset'
}
function toKebabCase(name) {
return String(name)
.replace(/([a-z0-9])([A-Z])/g, '$1-$2')
.replace(/([A-Z]+)([A-Z][a-z])/g, '$1-$2')
.replace(/[\s_]+/g, '-')
.toLowerCase()
}
const iconChar = computed(() => {
const name = parsed.value.name
if (!name) return ''
if (FA_ICONS[name]) return FA_ICONS[name]
const kebab = toKebabCase(name)
if (FA_ICONS[kebab]) return FA_ICONS[kebab]
const alias = ICON_ALIAS[kebab]
if (alias && FA_ICONS[alias]) return FA_ICONS[alias]
return ''
})
const fontClass = computed(() =>
parsed.value.brands ? 'fa-font-brands' : 'fa-font-solid'
+9 -9
View File
@@ -35,7 +35,6 @@
v-if="isOa && dash"
part="top"
:data="dash"
@view-notices="goNotices"
@view-schedules="goSchedules"
/>
@@ -87,7 +86,7 @@
</view>
</view>
<view v-if="isOa" class="block">
<view v-if="isOa && !embedded" class="block">
<view class="block-head">
<text class="block-title">最新公告</text>
<view class="block-more" @tap="goNotices">
@@ -158,7 +157,6 @@
v-if="isOa && dash"
part="bottom"
:data="dash"
@view-notices="goNotices"
@view-schedules="goSchedules"
/>
</view>
@@ -229,7 +227,7 @@ import { isLoggedIn } from '@/utils/auth.js'
import { getGuestToken } from '@/utils/guest.js'
import { request } from '@/api/request.js'
import { clearHomeCache } from '@/api/workspace.js'
import { openMenu } from '@/utils/nav.js'
import { openMenu, orderQuickMenus } from '@/utils/nav.js'
import { useSubsystem } from '@/utils/subsystem.js'
import AppTabbar from '@/components/AppTabbar.vue'
import SubOaDashboard from '@/components/sub/SubOaDashboard.vue'
@@ -268,10 +266,12 @@ function isDashboardMenu(m) {
}
const quickCandidates = computed(() =>
allMenus.value
.filter((m) => m.leaf !== false && !isDashboardMenu(m))
.slice()
.sort((a, b) => (a.sort || 0) - (b.sort || 0))
orderQuickMenus(
allMenus.value
.filter((m) => m.leaf !== false && !isDashboardMenu(m))
.slice()
.sort((a, b) => (a.sort || 0) - (b.sort || 0))
)
)
const QUICK_MAX = 7
@@ -419,7 +419,7 @@ async function loadTodo() {
}
async function loadNotices() {
if (!isOa.value) return
if (!isOa.value || props.embedded) return
try {
const data = await request({ url: '/api/oa/notice/list', data: { pageSize: 3 } })
notices.value = (data && data.list) || []
+1 -1
View File
@@ -152,7 +152,7 @@ function handleLogout() {
clearPendingAuth()
clearHomeCache()
logout()
uni.reLaunch({ url: '/pages/login/login' })
uni.reLaunch({ url: '/pages/nav/nav' })
}
})
}
+1 -131
View File
@@ -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>