更新密码找回uniapp
This commit is contained in:
1 parent
7f9a66da0f
commit
3fdda89833
1304 files changed
+3503
-26132
No files matched your search
@@ -23,14 +23,6 @@
|
||||
<script setup>
|
||||
import { computed } from 'vue'
|
||||
|
||||
/**
|
||||
* 底部 tabbar。
|
||||
*
|
||||
* variant = 'route':独立页模式。每个子系统(crm / erp / oa / cms / toolbox)有独立的页面组,
|
||||
* 通过 group(子系统目录名)解析路由并 redirectTo 跳转;导航页 nav.vue 不使用本组件。
|
||||
* variant = 'switch':页内模式。用于 pages/sub/tabs.vue,切换时只 emit change 由父页控制
|
||||
* 内容区显隐,避免页面栈堆积、保留各页签状态;tabs 可由父页传入。
|
||||
*/
|
||||
const props = defineProps({
|
||||
group: {
|
||||
type: String,
|
||||
@@ -56,15 +48,12 @@ const DEFAULT_TABS = [
|
||||
{ name: 'home', text: '概览', icon: 'gauge' },
|
||||
{ name: 'functions', text: '功能', icon: 'table-cells' },
|
||||
{ name: 'todo', text: '待办', icon: 'circle-check' },
|
||||
// 末位不再是「我的」,而是回平台(模块选择页);name 保留 mine 以兼容 current="mine"
|
||||
{ name: 'mine', text: '回平台', icon: 'arrow-left' }
|
||||
]
|
||||
|
||||
const list = computed(() => (props.tabs && props.tabs.length ? props.tabs : DEFAULT_TABS))
|
||||
|
||||
function onTap(name) {
|
||||
// 「回平台」:清空页面栈回到模块选择页。必须放在 current 判重之前,
|
||||
// 否则停在原「我的」页时点击会被判重拦下。
|
||||
if (name === 'mine' || name === 'platform') {
|
||||
uni.reLaunch({ url: '/pages/nav/nav' })
|
||||
return
|
||||
@@ -74,7 +63,6 @@ function onTap(name) {
|
||||
emit('change', name)
|
||||
return
|
||||
}
|
||||
// 子系统内部页面与 tab 一一对应,用 redirectTo 避免页面栈堆积
|
||||
uni.redirectTo({ url: `/pages/${props.group}/${name}/${name}` })
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<template>
|
||||
<view class="apv-head" :style="headPad">
|
||||
<!-- 左侧:返回按钮 + 可选标题前缀 -->
|
||||
<view class="apv-head-left">
|
||||
<view class="apv-back" hover-class="apv-back-active" @tap="onBack">
|
||||
<FaIcon name="chevron-left" color="#1f2b48" :size="20" />
|
||||
@@ -8,12 +7,10 @@
|
||||
<text v-if="backText" class="apv-back-text">{{ backText }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 中间:标题 -->
|
||||
<view class="apv-head-center">
|
||||
<text class="apv-title">{{ title }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 右侧:可选操作槽(默认占位,避免标题被挤偏) -->
|
||||
<view class="apv-head-right">
|
||||
<slot name="right" />
|
||||
</view>
|
||||
@@ -25,14 +22,8 @@ import { computed } from 'vue'
|
||||
import { mpHeadPad } from '@/utils/mpHead.js'
|
||||
|
||||
const props = defineProps({
|
||||
/** 标题 */
|
||||
title: { type: String, required: true },
|
||||
/** 返回按钮旁的文字(不传则只显示箭头图标)。常见「返回」「关闭」。 */
|
||||
backText: { type: String, default: '' },
|
||||
/**
|
||||
* 自定义返回行为。函数返回 false 时阻止默认 navigateBack。
|
||||
* 例:detail 页面有未保存修改时拦截。
|
||||
*/
|
||||
beforeBack: { type: Function, default: null }
|
||||
})
|
||||
|
||||
@@ -45,12 +36,10 @@ function onBack() {
|
||||
if (pages.length > 1) {
|
||||
uni.navigateBack({ delta: 1 })
|
||||
} else {
|
||||
// 栈内只有自己(直链进入),回到子系统首页
|
||||
uni.reLaunch({ url: '/pages/nav/nav' })
|
||||
}
|
||||
}
|
||||
|
||||
// 状态栏高度避让:胶囊可用则按胶囊底缘 + 8px,否则回退到 safe-area-inset-top
|
||||
const headPad = computed(() => mpHeadPad(8))
|
||||
</script>
|
||||
|
||||
|
||||
@@ -25,14 +25,9 @@ const props = defineProps({
|
||||
}
|
||||
})
|
||||
|
||||
// 菜单图标在数据库里常以完整 Font Awesome 类名字符串存储(如 "fas fa-dashboard"、
|
||||
// "fa-brands fa-cash-app"、"far fa-trash-can"),而 FA_ICONS 的键是去前缀的裸名字。
|
||||
// 这里统一归一化:解析出裸图标名与字重(solid/regular/brands),
|
||||
// 使同一份图标数据在移动端也能正确渲染;已是裸名字(如 "chevron-left")时原样返回。
|
||||
const parsed = computed(() => {
|
||||
const raw = String(props.name || '').trim()
|
||||
if (!raw) return { name: '', brands: false }
|
||||
// 完整类名:按空白拆 token,取以 fa- 开头且非样式字重(fa-solid/regular/brands)的最后一段
|
||||
if (/\bfa-(solid|regular|light|thin|duotone|brands)\b|\bfas\b|\bfar\b|\bfal\b|\bfab\b/.test(raw)) {
|
||||
const tokens = raw.split(/\s+/)
|
||||
let brands = false
|
||||
@@ -45,7 +40,6 @@ const parsed = computed(() => {
|
||||
}
|
||||
return { name: icon, brands }
|
||||
}
|
||||
// 裸名字:可能仍带一个 fa- 前缀,去掉后查表
|
||||
return { name: raw.replace(/^fa-/, ''), brands: props.type === 'brands' }
|
||||
})
|
||||
|
||||
|
||||
@@ -23,11 +23,6 @@
|
||||
<script setup>
|
||||
import { computed } from 'vue'
|
||||
|
||||
/**
|
||||
* 主 tabbar —— 默认「工作台 / 应用 / 我的」。
|
||||
* 传入 tabs 时按自定义页签渲染(个人中心用「我的 / 回平台」两项);
|
||||
* name=platform 为特殊动作:清空页面栈回到平台模块选择页。
|
||||
*/
|
||||
const props = defineProps({
|
||||
current: {
|
||||
type: String,
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<template>
|
||||
<view class="note-editor-wrapper">
|
||||
<!-- 通用富文本工具栏(H5 与 Android/iOS App 手机端均完整支持) -->
|
||||
<view class="editor-toolbar">
|
||||
<view class="toolbar-group">
|
||||
<view class="tb-btn" title="加粗" @tap="handleFormat('bold')">
|
||||
@@ -48,7 +47,6 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 表格操作组(全端支持插入与行列增删) -->
|
||||
<view class="toolbar-divider" />
|
||||
<view class="toolbar-group">
|
||||
<view class="tb-btn" title="插入表格" @tap="onInsertTable">
|
||||
@@ -97,7 +95,6 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 编辑区(H5 与 App-plus 均使用真正的 HTML5 Webview DOM 渲染与编辑表格) -->
|
||||
<!-- #ifdef H5 -->
|
||||
<div
|
||||
ref="h5EditorRef"
|
||||
@@ -157,7 +154,6 @@ const isInternalUpdate = ref(false)
|
||||
const lastAppliedHtml = ref('')
|
||||
const renderAction = ref(null)
|
||||
|
||||
// 响应 RenderJS 传递上来的内容更新
|
||||
function onContentChange(html) {
|
||||
lastAppliedHtml.value = html
|
||||
isInternalUpdate.value = true
|
||||
@@ -167,7 +163,6 @@ function onContentChange(html) {
|
||||
})
|
||||
}
|
||||
|
||||
// 供 template 绑定的 Renderjs 桥接方法
|
||||
function onRenderChange(html) {
|
||||
onContentChange(html)
|
||||
}
|
||||
@@ -224,7 +219,6 @@ function onInsertTable() {
|
||||
})
|
||||
}
|
||||
|
||||
// ================= H5 专属 DOM 操作 =================
|
||||
function execH5Format(cmd, value = null) {
|
||||
const el = h5EditorRef.value
|
||||
if (!el) return
|
||||
@@ -359,7 +353,6 @@ onMounted(() => {
|
||||
// #endif
|
||||
})
|
||||
|
||||
// 将 onRenderChange 挂载到组件实例供 Renderjs 调用
|
||||
defineExpose({
|
||||
onRenderChange
|
||||
})
|
||||
@@ -608,7 +601,6 @@ export default {
|
||||
<style lang="scss">
|
||||
@import '@/src/styles/rich-content.scss';
|
||||
|
||||
/* 小程序端用 class 选择器,避免标签选择器兼容性警告 */
|
||||
.note-rich-editor-table {
|
||||
display: table !important;
|
||||
border-collapse: collapse !important;
|
||||
|
||||
@@ -49,12 +49,6 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
/**
|
||||
* 移动端通用底部选择器(单选)。
|
||||
* 单据开单要选商品/仓库/客商/审批流,选项动辄上千条,
|
||||
* 原生 picker 无法搜索,这里统一用「搜索 + 列表 + 点选即回填」的抽屉。
|
||||
* 默认本地过滤;数据量大时传 remote 并监听 search,由页面做服务端搜索。
|
||||
*/
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import FaIcon from '@/components/FaIcon.vue'
|
||||
|
||||
@@ -63,12 +57,9 @@ const props = defineProps({
|
||||
title: { type: String, default: '请选择' },
|
||||
placeholder: { type: String, default: '搜索' },
|
||||
options: { type: Array, default: () => [] },
|
||||
/** 当前选中值,用于高亮(可选) */
|
||||
modelValue: { type: [String, Number, null], default: null },
|
||||
/** 服务端搜索:关键字变化时向外抛 search,不在本地过滤 */
|
||||
remote: { type: Boolean, default: false },
|
||||
loading: { type: Boolean, default: false },
|
||||
/** 列表顶部提示(如「仅显示前 50 条」) */
|
||||
tip: { type: String, default: '' }
|
||||
})
|
||||
|
||||
@@ -173,7 +164,6 @@ function close() {
|
||||
min-height: 0;
|
||||
max-height: 52vh;
|
||||
padding: 0 $page-padding-x 20rpx;
|
||||
/* scroll-view 默认 content-box,加左右内边距会把内容顶出屏幕右侧 */
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
<text class="empty-text">该子系统下暂无你可见的功能</text>
|
||||
</view>
|
||||
|
||||
<!-- 功能分组:每个分组一个 card,组内为功能 card(一行 4 个,仅图标 + 名称) -->
|
||||
<view v-else class="group-list">
|
||||
<view v-for="group in groups" :key="group.id" class="group-card">
|
||||
<view class="group-head">
|
||||
@@ -71,7 +70,6 @@ const emit = defineEmits(['switch-tab', 'back'])
|
||||
|
||||
const { sub, loading, loadError, allMenus, load } = useSubsystem(props.slug)
|
||||
|
||||
/** 模块 code → 图标,用于菜单自身没配图标时的兜底 */
|
||||
const fallbackIcon = computed(() => {
|
||||
const map = {
|
||||
crm: 'handshake',
|
||||
@@ -83,7 +81,6 @@ const fallbackIcon = computed(() => {
|
||||
return map[String(sub.module || '').toLowerCase()] || 'file-lines'
|
||||
})
|
||||
|
||||
/** 判断菜单项是否命中 WEB_RULES(小程序端不再展示,由 Web 端处理) */
|
||||
function isWebEntry(menu) {
|
||||
if (!menu) return false
|
||||
const title = String(menu.title || '')
|
||||
@@ -91,13 +88,7 @@ function isWebEntry(menu) {
|
||||
return WEB_RULES.some(kw => title.includes(kw) || path.includes(kw))
|
||||
}
|
||||
|
||||
/**
|
||||
* 按「一级分类目录」分组:
|
||||
* 菜单层级形如 模块根 → 个人办公 → 通讯录,分组取一级目录(个人办公 / 人事管理 …),
|
||||
* 组内为该目录下的全部可见功能。无分类归属的快捷功能不在功能页展示,由首页「常用功能」承载。
|
||||
*/
|
||||
const groups = computed(() => {
|
||||
// 先把命中 WEB_RULES 的菜单项过滤掉(这些是 Web 端入口,小程序功能页不展示)
|
||||
const menus = allMenus.value
|
||||
.filter(m => !isWebEntry(m))
|
||||
.slice()
|
||||
@@ -105,9 +96,7 @@ const groups = computed(() => {
|
||||
const byId = {}
|
||||
menus.forEach((m) => { byId[m.id] = m })
|
||||
|
||||
// 取该菜单所属的「一级分组」节点
|
||||
function groupNodeOf(m) {
|
||||
// 自底向上收集祖先链:chain[0] 为链上最顶层节点
|
||||
const chain = [m]
|
||||
let cur = m
|
||||
let guard = 0
|
||||
@@ -117,12 +106,9 @@ const groups = computed(() => {
|
||||
}
|
||||
const top = chain[0]
|
||||
if (top.pid === 0) {
|
||||
// 模块根在列表内:跳过根,取它下一层(个人办公 / 人事管理 …)
|
||||
if (chain.length >= 2) return chain[1]
|
||||
// 顶层节点自身:目录视为模块容器跳过,叶子无分类归属
|
||||
return top.leaf === false ? null : top
|
||||
}
|
||||
// 模块根不在列表内:链上顶层节点本身就是一级分组
|
||||
return top
|
||||
}
|
||||
|
||||
@@ -132,7 +118,6 @@ const groups = computed(() => {
|
||||
const g = groupNodeOf(m)
|
||||
if (!g) return
|
||||
if (g.id === m.id) {
|
||||
// 自身即分组节点:目录作组标题(不重复出现在组内),叶子无分类归属不展示
|
||||
if (g.leaf === false && !groupMap.has(g.id)) {
|
||||
groupMap.set(g.id, { id: g.id, title: g.title, sort: g.sort, items: [] })
|
||||
}
|
||||
@@ -144,14 +129,12 @@ const groups = computed(() => {
|
||||
groupMap.get(g.id).items.push(m)
|
||||
})
|
||||
|
||||
// 功能页只展示「归属分类目录且有可见功能」的分组;无归属功能由首页「常用功能」承载
|
||||
const list = []
|
||||
groupMap.forEach((g) => {
|
||||
if (g.items.length) list.push(g)
|
||||
})
|
||||
list.sort((a, b) => (a.sort || 0) - (b.sort || 0))
|
||||
|
||||
// 颜色下标按展开顺序统一编号,避免每个分组都从 tint-0 开始
|
||||
let colorIndex = 0
|
||||
return list.map((group) => ({
|
||||
...group,
|
||||
@@ -168,8 +151,6 @@ function goBackNav() {
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
// 菜单:登录走 /api/home,游客走公开免登录菜单(菜单级 require_login 控制),
|
||||
// 无免登录菜单的子系统游客看到空列表,不强制跳登录
|
||||
load()
|
||||
})
|
||||
|
||||
@@ -184,7 +165,6 @@ onShow(() => {
|
||||
.page {
|
||||
@include page-shell;
|
||||
|
||||
// 嵌入模式下由父页(tabs.vue)的 scroll-view 统一滚动,这里改为自然高度
|
||||
&.embedded {
|
||||
height: auto;
|
||||
}
|
||||
@@ -202,7 +182,6 @@ onShow(() => {
|
||||
|
||||
.head-title {
|
||||
display: block;
|
||||
/* 取消顶部返回按钮后,保留头部避让高度 */
|
||||
margin-top: 32rpx;
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
@@ -261,9 +240,6 @@ onShow(() => {
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
/* ============ 分组卡:白色卡片 + 一行 4 个功能宫格(图标在上、名称在下) ============
|
||||
cell 占 25% 宽并自带右侧间隙,容器用负 margin 抵消末列间隙,
|
||||
避免使用 calc 除法——小程序端 wxss 对复杂 calc 支持不稳。 */
|
||||
.group-card {
|
||||
@include card;
|
||||
padding: 24rpx 20rpx 8rpx;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<template>
|
||||
<view class="page" :class="{ embedded }">
|
||||
<!-- 顶部标识条(独立页模式使用;嵌入 tabs.vue 时由父页提供) -->
|
||||
<view v-if="!embedded" class="hero" :class="sub.tint" :style="headPad">
|
||||
<view class="hero-main">
|
||||
<view class="hero-icon">
|
||||
@@ -14,7 +13,6 @@
|
||||
</view>
|
||||
|
||||
<view class="body">
|
||||
<!-- 未开通 -->
|
||||
<view v-if="!enabled" class="lock-box">
|
||||
<FaIcon name="lock" color="#f04438" :size="28" />
|
||||
<text class="lock-title">该子系统未开通</text>
|
||||
@@ -22,7 +20,6 @@
|
||||
</view>
|
||||
|
||||
<block v-else>
|
||||
<!-- 加载失败 -->
|
||||
<view v-if="loadError" class="err-box" @tap="load(true)">
|
||||
<FaIcon name="triangle-exclamation" color="#f04438" :size="18" />
|
||||
<view class="err-body">
|
||||
@@ -33,9 +30,7 @@
|
||||
</view>
|
||||
|
||||
<block v-else>
|
||||
<!-- 首页卡片流:flex 纵向 + 统一 gap,避免跨组件 margin 不折叠导致间距不均 -->
|
||||
<view class="home-stack">
|
||||
<!-- OA 工作台仪表盘上半:公告 + 数据统计(常用功能插在下面) -->
|
||||
<SubOaDashboard
|
||||
v-if="isOa && dash"
|
||||
part="top"
|
||||
@@ -44,7 +39,6 @@
|
||||
@view-schedules="goSchedules"
|
||||
/>
|
||||
|
||||
<!-- 概览 / 日程待办 / 最新公告:非 OA 子系统,或 OA 仪表盘加载失败时兜底展示 -->
|
||||
<block v-if="!(isOa && dash)">
|
||||
<view class="kpi-card">
|
||||
<view class="kpi-item">
|
||||
@@ -65,7 +59,6 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 日程待办 -->
|
||||
<view class="block">
|
||||
<view class="block-head">
|
||||
<text class="block-title">日程待办</text>
|
||||
@@ -94,7 +87,6 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 最新公告(仅 OA 子系统) -->
|
||||
<view v-if="isOa" class="block">
|
||||
<view class="block-head">
|
||||
<text class="block-title">最新公告</text>
|
||||
@@ -124,7 +116,6 @@
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!-- 常用功能:与仪表盘卡片统一的样式,点「全部」切到功能页签 -->
|
||||
<view class="quick-card">
|
||||
<view class="quick-head">
|
||||
<view class="quick-head-left">
|
||||
@@ -152,7 +143,6 @@
|
||||
<text class="fn-name">{{ item.title }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 末位固定「+」:点击选择要加入常用功能的功能 -->
|
||||
<view class="cell">
|
||||
<view class="fn-card fn-add" @tap="openPicker">
|
||||
<view class="add-icon">
|
||||
@@ -164,7 +154,6 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- OA 工作台仪表盘下半:报销趋势 + 状态分布 -->
|
||||
<SubOaDashboard
|
||||
v-if="isOa && dash"
|
||||
part="bottom"
|
||||
@@ -181,7 +170,6 @@
|
||||
|
||||
<AppTabbar v-if="!embedded" :group="slug" current="home" />
|
||||
|
||||
<!-- 常用功能选择器:勾选 + 拖动手柄排序(顺序即首页宫格展示顺序) -->
|
||||
<view v-if="pickerVisible" class="picker-mask" @tap="pickerVisible = false">
|
||||
<view class="picker-sheet" @tap.stop>
|
||||
<view class="picker-head">
|
||||
@@ -194,7 +182,6 @@
|
||||
<view v-if="pickerItems.length === 0" class="picker-empty">
|
||||
当前子系统暂无可添加的功能
|
||||
</view>
|
||||
<!-- 整份列表:前 pickerSelectedCount 个为已选(高亮 + 序号),拖进/拖出前 N 个即加入/移出常用功能 -->
|
||||
<view
|
||||
v-for="(item, index) in pickerItems"
|
||||
:key="item.id"
|
||||
@@ -259,13 +246,10 @@ const { sub, loading, loadError, enabled, allMenus, leafMenus, quickMenuIds, loa
|
||||
const pending = ref([])
|
||||
const doneCount = ref(0)
|
||||
const notices = ref([])
|
||||
// OA 工作台仪表盘数据(仅 isOa 时加载)
|
||||
const dash = ref(null)
|
||||
|
||||
/** 是否 OA 子系统(决定是否展示「最新公告」卡片) */
|
||||
const isOa = computed(() => String(sub.module || '').toLowerCase() === 'oa')
|
||||
|
||||
/** 模块 code → 图标,用于菜单自身没配图标时的兜底 */
|
||||
const fallbackIcon = computed(() => {
|
||||
const map = {
|
||||
crm: 'handshake',
|
||||
@@ -277,14 +261,12 @@ const fallbackIcon = computed(() => {
|
||||
return map[String(sub.module || '').toLowerCase()] || 'file-lines'
|
||||
})
|
||||
|
||||
/** 仪表盘类菜单:不属于「常用功能」可选项,也不在宫格展示 */
|
||||
function isDashboardMenu(m) {
|
||||
const title = String(m.title || '').trim()
|
||||
const path = String(m.path || '')
|
||||
return title === '仪表盘' || /\/dashboard\/?$/.test(path)
|
||||
}
|
||||
|
||||
/** 可作为「常用功能」的候选:可跳转叶子菜单、排除仪表盘 */
|
||||
const quickCandidates = computed(() =>
|
||||
allMenus.value
|
||||
.filter((m) => m.leaf !== false && !isDashboardMenu(m))
|
||||
@@ -292,10 +274,8 @@ const quickCandidates = computed(() =>
|
||||
.sort((a, b) => (a.sort || 0) - (b.sort || 0))
|
||||
)
|
||||
|
||||
/** 宫格最多展示 7 个功能,末位固定留给「+」入口(共 8 格 = 2 行) */
|
||||
const QUICK_MAX = 7
|
||||
|
||||
/** 常用功能:优先用用户自定义顺序,未自定义时回落默认取前 QUICK_MAX 个 */
|
||||
const quickMenus = computed(() => {
|
||||
const base = quickCandidates.value
|
||||
const byId = {}
|
||||
@@ -305,14 +285,10 @@ const quickMenus = computed(() => {
|
||||
return base.slice(0, QUICK_MAX)
|
||||
})
|
||||
|
||||
// ============ 常用功能选择器(末位「+」) ============
|
||||
// 单一列表模型:pickerIds 为全部可选功能的顺序,前 pickerSelectedCount 个即「已选」,
|
||||
// 也就是首页宫格展示的常用功能——拖动改变顺序时,进出前 N 个即自动加入/移出常用功能。
|
||||
const pickerVisible = ref(false)
|
||||
const pickerIds = ref([])
|
||||
const pickerSelectedCount = ref(0)
|
||||
|
||||
/** 选择器列表(按当前顺序渲染全部功能) */
|
||||
const pickerItems = computed(() => {
|
||||
const byId = {}
|
||||
quickCandidates.value.forEach((m) => { byId[m.id] = m })
|
||||
@@ -329,7 +305,6 @@ function openPicker() {
|
||||
pickerVisible.value = true
|
||||
}
|
||||
|
||||
/** 点整行:已选→移出到已选区之后;未选→插到已选区末尾(最多 QUICK_MAX 个) */
|
||||
function togglePick(id) {
|
||||
const ids = pickerIds.value.slice()
|
||||
const i = ids.indexOf(id)
|
||||
@@ -350,9 +325,6 @@ function togglePick(id) {
|
||||
pickerIds.value = ids
|
||||
}
|
||||
|
||||
// ---- 列表拖动排序 ----
|
||||
// 行高与样式 .picker-row 的 height 保持同一数值;拖动只作用于右侧手柄,
|
||||
// 手柄上 catchtouchmove 阻止 scroll-view 跟随滚动,因此不会与列表滚动冲突。
|
||||
const SORT_ROW_RPX = 100
|
||||
const dragId = ref(null)
|
||||
const dragOffset = ref(0)
|
||||
@@ -360,7 +332,6 @@ let dragStartY = 0
|
||||
let dragRowH = 1
|
||||
let dragFromIndex = -1
|
||||
|
||||
/** 拖拽行跟随手指的残余位移(其余行由数组重排自然换位) */
|
||||
function dragRowStyle(item) {
|
||||
if (dragId.value !== item.id) return ''
|
||||
return `transform: translateY(${dragOffset.value}px);`
|
||||
@@ -392,7 +363,6 @@ function onDragMove(e) {
|
||||
ids.splice(target, 0, dragId.value)
|
||||
pickerIds.value = ids
|
||||
}
|
||||
// 抵消已经跨过的整行位移,剩余部分让行跟着手指走;越界时限制在一行内
|
||||
const residual = delta - (target - dragFromIndex) * dragRowH
|
||||
dragOffset.value = Math.max(-dragRowH, Math.min(dragRowH, residual))
|
||||
}
|
||||
@@ -423,13 +393,11 @@ async function savePicker() {
|
||||
}
|
||||
}
|
||||
|
||||
// ============ OA 工作台仪表盘 ============
|
||||
async function loadDashboard() {
|
||||
if (!isOa.value) return
|
||||
try {
|
||||
dash.value = await request({ url: '/api/oa/dashboard', method: 'GET', silent: true })
|
||||
} catch (e) {
|
||||
// 仪表盘失败不影响首页其余内容
|
||||
dash.value = null
|
||||
}
|
||||
}
|
||||
@@ -479,7 +447,6 @@ function goBackNav() {
|
||||
uni.reLaunch({ url: '/pages/nav/nav' })
|
||||
}
|
||||
|
||||
// 「功能」页签在 TAB_ORDER 中的下标为 1
|
||||
function goFunctions() {
|
||||
if (props.embedded) {
|
||||
emit('switch-tab', 1)
|
||||
@@ -501,8 +468,6 @@ function goNoticeDetail(id) {
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
// 菜单:登录走 /api/home,游客走公开免登录菜单(菜单级 require_login 控制);
|
||||
// 待办等受保护数据需登录或持游客令牌(手机号授权)才拉,失败不阻断外壳
|
||||
load()
|
||||
if (!isLoggedIn() && !getGuestToken()) return
|
||||
loadTodo()
|
||||
@@ -525,7 +490,6 @@ onShow(() => {
|
||||
.page {
|
||||
@include page-shell;
|
||||
|
||||
// 嵌入模式下由父页(tabs.vue)的 scroll-view 统一滚动,这里改为自然高度
|
||||
&.embedded {
|
||||
height: auto;
|
||||
}
|
||||
@@ -544,7 +508,6 @@ onShow(() => {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 20rpx;
|
||||
/* 取消顶部返回按钮后,补偿其占位,保证与状态栏/胶囊的间距 */
|
||||
margin-top: 40rpx;
|
||||
}
|
||||
|
||||
@@ -590,7 +553,6 @@ onShow(() => {
|
||||
padding: 28rpx $page-padding-x 0;
|
||||
}
|
||||
|
||||
/* 首页卡片流:统一纵向间距(跨组件 margin 不折叠,故用 flex gap) */
|
||||
.home-stack {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -616,7 +578,6 @@ onShow(() => {
|
||||
color: $color-text-muted;
|
||||
}
|
||||
|
||||
/* ============ 概览卡 ============ */
|
||||
.kpi-card {
|
||||
@include card;
|
||||
display: flex;
|
||||
@@ -658,7 +619,6 @@ onShow(() => {
|
||||
color: $color-text-muted;
|
||||
}
|
||||
|
||||
/* ============ 列表卡 ============ */
|
||||
.list-card {
|
||||
@include card;
|
||||
overflow: hidden;
|
||||
@@ -734,10 +694,6 @@ onShow(() => {
|
||||
color: $color-text-muted;
|
||||
}
|
||||
|
||||
/* ============ 常用功能宫格:一行 4 个 ============
|
||||
cell 占 25% 宽并自带右侧间隙,容器用负 margin 抵消末列间隙,
|
||||
避免使用 calc 除法——小程序端 wxss 对复杂 calc 支持不稳。 */
|
||||
/* 与 SubOaDashboard 的 dash-card 保持同一视觉语言 */
|
||||
.quick-card {
|
||||
@include card;
|
||||
padding: 26rpx 24rpx 10rpx;
|
||||
@@ -820,7 +776,6 @@ onShow(() => {
|
||||
color: $color-text-muted;
|
||||
}
|
||||
|
||||
/* 末位「+」添加格:虚线框,区别于普通功能 */
|
||||
.fn-card.fn-add {
|
||||
background: transparent;
|
||||
border: 1rpx dashed #c7cede;
|
||||
@@ -836,7 +791,6 @@ onShow(() => {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
/* ============ 常用功能选择器 ============ */
|
||||
.picker-mask {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
@@ -907,7 +861,6 @@ onShow(() => {
|
||||
color: $color-text-muted;
|
||||
}
|
||||
|
||||
/* 行高固定,拖动排序按行高换算目标位置;改这里需同步 SORT_ROW_RPX */
|
||||
.picker-row {
|
||||
position: relative;
|
||||
display: flex;
|
||||
@@ -918,7 +871,6 @@ onShow(() => {
|
||||
padding: 0 0 0 16rpx;
|
||||
border-bottom: 1rpx solid $color-divider;
|
||||
|
||||
/* 前 N 个(已选)高亮,拖动进出即加入/移出常用功能 */
|
||||
&.on {
|
||||
background: #f2f7ff;
|
||||
}
|
||||
@@ -974,7 +926,6 @@ onShow(() => {
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
/* 未选中行:空心圆(点击整行加入常用功能) */
|
||||
.picker-check {
|
||||
width: 36rpx;
|
||||
height: 36rpx;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<template>
|
||||
<view class="page" :class="{ embedded }">
|
||||
<!-- 独立页模式:渐变用户头部(嵌入 tabs.vue 时由父页提供顶部条) -->
|
||||
<view v-if="!embedded" class="head" :style="headPad">
|
||||
<view class="user">
|
||||
<view class="avatar">
|
||||
@@ -22,7 +21,6 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 用户卡(嵌入模式显示,独立页模式的用户信息已在头部) -->
|
||||
<view v-if="embedded" class="user-card" @tap="goProfile">
|
||||
<view class="avatar avatar-light">
|
||||
<text class="avatar-text avatar-text-dark">{{ avatarText }}</text>
|
||||
@@ -34,57 +32,51 @@
|
||||
<FaIcon name="chevron-right" color="#c8cfdf" :size="12" />
|
||||
</view>
|
||||
|
||||
<!-- 数据概览 -->
|
||||
<view class="kpi-card">
|
||||
<view class="kpi-item">
|
||||
<text class="kpi-value">{{ pendingCount }}</text>
|
||||
<text class="kpi-label">待办</text>
|
||||
</view>
|
||||
<view class="kpi-item">
|
||||
<text class="kpi-value">{{ doneCount }}</text>
|
||||
<text class="kpi-label">已完成</text>
|
||||
</view>
|
||||
<view class="kpi-item">
|
||||
<text class="kpi-value" :class="{ warn: overdue > 0 }">{{ overdue }}</text>
|
||||
<text class="kpi-label">已逾期</text>
|
||||
</view>
|
||||
<view class="kpi-item">
|
||||
<text class="kpi-value">{{ leafMenus.length }}</text>
|
||||
<text class="kpi-label">可用功能</text>
|
||||
<view class="menu-card">
|
||||
<view class="menu-row" @tap="onSubscribe">
|
||||
<view class="tint-icon row-icon tint-0">
|
||||
<FaIcon name="bell" color="#ffffff" :size="16" />
|
||||
</view>
|
||||
<view class="row-main">
|
||||
<text class="row-title">订阅消息提醒</text>
|
||||
<text class="row-sub">审批、日程与公告的微信通知</text>
|
||||
</view>
|
||||
<text class="row-value">去开启</text>
|
||||
<FaIcon name="chevron-right" color="#c8cfdf" :size="12" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 常用操作:分组卡片模板,一行 4 个 -->
|
||||
<view class="group-card">
|
||||
<view class="group-head">
|
||||
<view class="group-bar" />
|
||||
<text class="group-title">常用操作</text>
|
||||
<view class="menu-card">
|
||||
<view class="menu-row" @tap="goChangePassword">
|
||||
<view class="tint-icon row-icon tint-1">
|
||||
<FaIcon name="key" color="#ffffff" :size="16" />
|
||||
</view>
|
||||
<view class="row-main">
|
||||
<text class="row-title">修改密码</text>
|
||||
<text class="row-sub">定期更换密码,保障账号安全</text>
|
||||
</view>
|
||||
<FaIcon name="chevron-right" color="#c8cfdf" :size="12" />
|
||||
</view>
|
||||
<view class="grid">
|
||||
<view class="cell" @tap="goFunctions">
|
||||
<view class="fn-card">
|
||||
<view class="tint-icon fn-icon tint-0">
|
||||
<FaIcon name="table-cells" color="#ffffff" :size="18" />
|
||||
</view>
|
||||
<text class="fn-name">全部功能</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="menu-card">
|
||||
<view class="menu-row" @tap="goHelp">
|
||||
<view class="tint-icon row-icon tint-2">
|
||||
<FaIcon name="circle-question" color="#ffffff" :size="16" />
|
||||
</view>
|
||||
<view class="cell" @tap="goProfile">
|
||||
<view class="fn-card">
|
||||
<view class="tint-icon fn-icon tint-1">
|
||||
<FaIcon name="user" color="#ffffff" :size="18" />
|
||||
</view>
|
||||
<text class="fn-name">账号与安全</text>
|
||||
</view>
|
||||
<view class="row-main">
|
||||
<text class="row-title">帮助中心</text>
|
||||
</view>
|
||||
<!-- <view class="cell" @tap="goBackNav">
|
||||
<view class="fn-card">
|
||||
<view class="tint-icon fn-icon tint-2">
|
||||
<FaIcon name="arrow-right-arrow-left" color="#ffffff" :size="18" />
|
||||
</view>
|
||||
<text class="fn-name">切换子系统</text>
|
||||
</view>
|
||||
</view> -->
|
||||
<FaIcon name="chevron-right" color="#c8cfdf" :size="12" />
|
||||
</view>
|
||||
<view class="menu-row" @tap="goSettings">
|
||||
<view class="tint-icon row-icon tint-3">
|
||||
<FaIcon name="gear" color="#ffffff" :size="16" />
|
||||
</view>
|
||||
<view class="row-main">
|
||||
<text class="row-title">设置</text>
|
||||
</view>
|
||||
<FaIcon name="chevron-right" color="#c8cfdf" :size="12" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -100,15 +92,15 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { computed, onMounted } from 'vue'
|
||||
import { mpHeadPad } from '@/utils/mpHead.js'
|
||||
|
||||
const headPad = mpHeadPad()
|
||||
import { onShow } from '@dcloudio/uni-app'
|
||||
import { isLoggedIn, logout, isSSOEnabled, getToken, clearPendingAuth } from '@/utils/auth.js'
|
||||
import { logoutUAC, logoutApi } from '@/api/auth.js'
|
||||
import { request } from '@/api/request.js'
|
||||
import { clearHomeCache } from '@/api/workspace.js'
|
||||
import { requestSubscribeNotice } from '@/utils/subscribe.js'
|
||||
import { useSubsystem } from '@/utils/subsystem.js'
|
||||
import AppTabbar from '@/components/AppTabbar.vue'
|
||||
|
||||
@@ -117,68 +109,33 @@ const props = defineProps({
|
||||
embedded: { type: Boolean, default: false }
|
||||
})
|
||||
|
||||
const emit = defineEmits(['switch-tab', 'back'])
|
||||
|
||||
const { sub, loading, loadError, user, leafMenus, load } = useSubsystem(props.slug)
|
||||
|
||||
const pendingCount = ref(0)
|
||||
const overdue = ref(0)
|
||||
const doneCount = ref(0)
|
||||
const { loading, loadError, user, load } = useSubsystem(props.slug)
|
||||
|
||||
const avatarText = computed(() => {
|
||||
const name = user.value.name || user.value.account || '云'
|
||||
return String(name).charAt(0).toUpperCase()
|
||||
})
|
||||
|
||||
async function loadStats() {
|
||||
try {
|
||||
const [p, d] = await Promise.all([
|
||||
request({ url: '/api/schedule/list', data: { status: 'pending', pageSize: 50 } }),
|
||||
request({ url: '/api/schedule/list', data: { status: 'done', pageSize: 50 } })
|
||||
])
|
||||
const pending = (p && p.list) || []
|
||||
pendingCount.value = pending.length
|
||||
overdue.value = pending.filter((s) => isOverdue(s)).length
|
||||
doneCount.value = ((d && d.list) || []).length
|
||||
} catch (e) {
|
||||
pendingCount.value = 0
|
||||
overdue.value = 0
|
||||
doneCount.value = 0
|
||||
}
|
||||
}
|
||||
|
||||
function isOverdue(item) {
|
||||
const t = String(item.schedule_time || item.created_at || '')
|
||||
return t.length >= 10 && t.slice(0, 10) < todayStr()
|
||||
}
|
||||
|
||||
function todayStr() {
|
||||
const d = new Date()
|
||||
const p = (n) => String(n).padStart(2, '0')
|
||||
return d.getFullYear() + '-' + p(d.getMonth() + 1) + '-' + p(d.getDate())
|
||||
}
|
||||
|
||||
function goBackNav() {
|
||||
if (props.embedded) {
|
||||
emit('back')
|
||||
return
|
||||
}
|
||||
uni.reLaunch({ url: '/pages/nav/nav' })
|
||||
}
|
||||
|
||||
// 「功能」页签在 TAB_ORDER 中的下标为 1
|
||||
function goFunctions() {
|
||||
if (props.embedded) {
|
||||
emit('switch-tab', 1)
|
||||
return
|
||||
}
|
||||
uni.redirectTo({ url: `/pages/${props.slug}/functions/functions` })
|
||||
}
|
||||
|
||||
function goProfile() {
|
||||
uni.redirectTo({ url: '/pages/profile/profile' })
|
||||
}
|
||||
|
||||
function onSubscribe() {
|
||||
requestSubscribeNotice({ tip: '已开启消息提醒' })
|
||||
}
|
||||
|
||||
function goChangePassword() {
|
||||
uni.navigateTo({ url: '/pages/profile/changePassword' })
|
||||
}
|
||||
|
||||
function goHelp() {
|
||||
uni.navigateTo({ url: '/pages/common/developing?t=' + encodeURIComponent('帮助中心') })
|
||||
}
|
||||
|
||||
function goSettings() {
|
||||
uni.navigateTo({ url: '/pages/common/developing?t=' + encodeURIComponent('设置') })
|
||||
}
|
||||
|
||||
function handleLogout() {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
@@ -187,7 +144,6 @@ function handleLogout() {
|
||||
cancelText: '取消',
|
||||
success(res) {
|
||||
if (!res.confirm) return
|
||||
// 统一认证:先吊销服务端会话与令牌
|
||||
if (isSSOEnabled() && getToken()) {
|
||||
logoutUAC().catch(() => {})
|
||||
} else {
|
||||
@@ -202,16 +158,13 @@ function handleLogout() {
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
// 游客进入免登录模块:停留外壳,不拉受保护数据,也不强制跳登录
|
||||
if (!isLoggedIn()) return
|
||||
load()
|
||||
loadStats()
|
||||
})
|
||||
|
||||
onShow(() => {
|
||||
if (isLoggedIn() && !loading.value) {
|
||||
load()
|
||||
loadStats()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
@@ -222,13 +175,11 @@ onShow(() => {
|
||||
.page {
|
||||
@include page-shell;
|
||||
|
||||
// 嵌入模式下由父页(tabs.vue)的 scroll-view 统一滚动,这里改为自然高度
|
||||
&.embedded {
|
||||
height: auto;
|
||||
}
|
||||
}
|
||||
|
||||
/* ============ 独立页模式的渐变用户头部 ============ */
|
||||
.head {
|
||||
flex-shrink: 0;
|
||||
padding: calc(var(--status-bar-height, 44px) + 20rpx) $page-padding-x 40rpx;
|
||||
@@ -242,7 +193,6 @@ onShow(() => {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 20rpx;
|
||||
/* 取消顶部返回按钮后,补偿其占位 */
|
||||
margin-top: 42rpx;
|
||||
}
|
||||
|
||||
@@ -294,7 +244,6 @@ onShow(() => {
|
||||
padding: 28rpx $page-padding-x 0;
|
||||
}
|
||||
|
||||
/* ============ 嵌入模式的用户卡 ============ */
|
||||
.user-card {
|
||||
@include card;
|
||||
display: flex;
|
||||
@@ -329,126 +278,63 @@ onShow(() => {
|
||||
color: $color-text-muted;
|
||||
}
|
||||
|
||||
/* ============ 数据概览 ============ */
|
||||
.kpi-card {
|
||||
.menu-card {
|
||||
@include card;
|
||||
display: flex;
|
||||
padding: 30rpx 0;
|
||||
margin-bottom: 32rpx;
|
||||
padding: 0 24rpx;
|
||||
margin-bottom: 24rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.kpi-item {
|
||||
flex: 1;
|
||||
.menu-row {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 6rpx;
|
||||
position: relative;
|
||||
gap: 18rpx;
|
||||
padding: 26rpx 0;
|
||||
|
||||
& + &::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 6rpx;
|
||||
bottom: 6rpx;
|
||||
width: 1rpx;
|
||||
background: $color-divider;
|
||||
& + & {
|
||||
border-top: 1rpx solid $color-divider;
|
||||
}
|
||||
|
||||
&:active {
|
||||
opacity: 0.75;
|
||||
}
|
||||
}
|
||||
|
||||
.kpi-value {
|
||||
font-size: 40rpx;
|
||||
font-weight: 600;
|
||||
line-height: 1.1;
|
||||
color: $color-text;
|
||||
|
||||
&.warn {
|
||||
color: $color-danger;
|
||||
}
|
||||
}
|
||||
|
||||
.kpi-label {
|
||||
font-size: 22rpx;
|
||||
color: $color-text-muted;
|
||||
}
|
||||
|
||||
/* ============ 常用操作:分组卡 + 一行 4 个格子 ============ */
|
||||
.group-card {
|
||||
@include card;
|
||||
padding: 24rpx 20rpx 8rpx;
|
||||
}
|
||||
|
||||
.group-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 14rpx;
|
||||
padding: 0 4rpx 20rpx;
|
||||
}
|
||||
|
||||
.group-bar {
|
||||
width: 6rpx;
|
||||
height: 28rpx;
|
||||
border-radius: $radius-full;
|
||||
background: $color-primary;
|
||||
.row-icon {
|
||||
@include tint-icon(64rpx, 18rpx);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.group-title {
|
||||
.row-main {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.row-title {
|
||||
display: block;
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
color: $color-text;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* cell 占 25% 并自带右间隙,容器负 margin 抵消末列间隙 */
|
||||
.grid {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
margin-right: -16rpx;
|
||||
}
|
||||
|
||||
.cell {
|
||||
width: 25%;
|
||||
padding-right: 16rpx;
|
||||
margin-bottom: 16rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.fn-card {
|
||||
height: 100%;
|
||||
padding: 18rpx 6rpx 16rpx;
|
||||
border-radius: $radius-md;
|
||||
background: $color-bg-page;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 12rpx;
|
||||
transition: transform 0.15s ease;
|
||||
|
||||
&:active {
|
||||
transform: scale(0.95);
|
||||
}
|
||||
}
|
||||
|
||||
.fn-icon {
|
||||
@include tint-icon(64rpx, 18rpx);
|
||||
}
|
||||
|
||||
.fn-name {
|
||||
max-width: 100%;
|
||||
.row-sub {
|
||||
display: block;
|
||||
margin-top: 6rpx;
|
||||
font-size: 22rpx;
|
||||
line-height: 1.3;
|
||||
color: $color-text;
|
||||
text-align: center;
|
||||
color: $color-text-muted;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.row-value {
|
||||
flex-shrink: 0;
|
||||
font-size: 24rpx;
|
||||
color: $color-primary;
|
||||
}
|
||||
|
||||
.logout {
|
||||
@include card;
|
||||
margin-top: 40rpx;
|
||||
@@ -465,7 +351,6 @@ onShow(() => {
|
||||
color: $color-danger;
|
||||
}
|
||||
|
||||
/* ============ 错误态 ============ */
|
||||
.err-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -500,4 +385,4 @@ onShow(() => {
|
||||
.bottom-space {
|
||||
height: 32rpx;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
@@ -1,8 +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">
|
||||
@@ -20,7 +18,6 @@
|
||||
<FaIcon name="bullhorn" color="#c0c4cc" :size="24" />
|
||||
<text class="dash-empty-text">暂无公告</text>
|
||||
</view>
|
||||
<!-- 单行垂直轮播公告 -->
|
||||
<swiper
|
||||
v-else
|
||||
class="notice-swiper"
|
||||
@@ -45,7 +42,6 @@
|
||||
</swiper>
|
||||
</view>
|
||||
|
||||
<!-- 数据统计:待办 + 报销 -->
|
||||
<view class="dash-card">
|
||||
<view class="dash-head">
|
||||
<view class="dash-head-left">
|
||||
@@ -56,7 +52,6 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 待办 -->
|
||||
<view class="stat-tile" @tap="emit('view-schedules')">
|
||||
<view class="stat-tile-head">
|
||||
<view class="tile-icon ti-todo">
|
||||
@@ -85,7 +80,6 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 报销 -->
|
||||
<view class="stat-tile">
|
||||
<view class="stat-tile-head">
|
||||
<view class="tile-icon ti-money">
|
||||
@@ -107,7 +101,6 @@
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<!-- ============ 下半:报销趋势 + 状态分布 ============ -->
|
||||
<template v-else>
|
||||
<view v-if="trend.length || statusList.length" class="dash-card">
|
||||
<view class="dash-head">
|
||||
@@ -132,7 +125,6 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 状态分布 -->
|
||||
<view v-if="statusList.length" class="status-block">
|
||||
<text class="status-title">状态分布</text>
|
||||
<view v-for="s in statusList" :key="s.key" class="dist-row">
|
||||
@@ -154,21 +146,18 @@ import FaIcon from '@/components/FaIcon.vue'
|
||||
|
||||
const props = defineProps({
|
||||
data: { type: Object, default: () => ({}) },
|
||||
// top:公告 + 数据统计;bottom:报销趋势 + 状态分布(中间由首页插入「常用功能」)
|
||||
part: { type: String, default: 'top' }
|
||||
})
|
||||
const emit = defineEmits(['view-notices', 'view-schedules'])
|
||||
|
||||
const num = (v) => Number(v || 0)
|
||||
|
||||
// ---------- 待办概览 ----------
|
||||
const ss = computed(() => props.data?.schedule_stats || {})
|
||||
const overdue = computed(() => num(ss.value.overdue))
|
||||
const todayPending = computed(() => num(ss.value.today_total) - num(ss.value.today_done))
|
||||
const weekPending = computed(() => num(ss.value.week_total) - num(ss.value.week_done))
|
||||
const monthPending = computed(() => num(ss.value.month_total) - num(ss.value.month_done))
|
||||
|
||||
// ---------- 报销 ----------
|
||||
const emptyStat = () => ({ total: 0, paid: 0, unpaid: 0, count: 0 })
|
||||
const rb = computed(() => props.data?.reimburse || {})
|
||||
const moneyCards = computed(() => [
|
||||
@@ -177,7 +166,6 @@ const moneyCards = computed(() => [
|
||||
{ label: '本年', data: rb.value.year || emptyStat() }
|
||||
])
|
||||
|
||||
// ---------- 趋势(近6月,堆叠柱) ----------
|
||||
const trend = computed(() => rb.value.trend || [])
|
||||
const trendMax = computed(() => {
|
||||
let m = 1
|
||||
@@ -188,7 +176,6 @@ const MAX_BAR = 160
|
||||
const barH = (v) => Math.round((num(v) / trendMax.value) * MAX_BAR) + 'rpx'
|
||||
const monthLabel = (m) => String(m || '').slice(5) + '月'
|
||||
|
||||
// ---------- 状态分布 ----------
|
||||
const statusColors = { 0: '#94a3b8', 1: '#f59e0b', 2: '#10b981', 3: '#ef4444', 4: '#94a3b8', 5: '#2563eb' }
|
||||
const statusColor = (k) => statusColors[Number(k)] || '#94a3b8'
|
||||
const statusList = computed(() => {
|
||||
@@ -200,14 +187,12 @@ 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())}`
|
||||
// 公告右侧时间:今天显示 HH:mm,本年显示 M/D,跨年显示 YYYY-M-D
|
||||
function noticeTime(ts) {
|
||||
if (!ts) return ''
|
||||
const d = new Date(String(ts).replace(/-/g, '/'))
|
||||
@@ -305,7 +290,6 @@ const money = (value) =>
|
||||
color: $color-text-muted;
|
||||
}
|
||||
|
||||
/* ============ 数据统计:待办 / 报销 双磁贴 ============ */
|
||||
.stat-tile {
|
||||
padding: 20rpx 20rpx 8rpx;
|
||||
border-radius: $radius-md;
|
||||
@@ -397,7 +381,6 @@ const money = (value) =>
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* ============ 趋势柱状 ============ */
|
||||
.legend {
|
||||
display: flex;
|
||||
gap: 16rpx;
|
||||
@@ -470,7 +453,6 @@ const money = (value) =>
|
||||
color: $color-text-muted;
|
||||
}
|
||||
|
||||
/* ============ 状态分布 ============ */
|
||||
.status-block {
|
||||
margin-top: 26rpx;
|
||||
padding-top: 22rpx;
|
||||
@@ -522,7 +504,6 @@ const money = (value) =>
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* ============ 公告(单行垂直轮播) ============ */
|
||||
.notice-swiper {
|
||||
height: 68rpx;
|
||||
}
|
||||
|
||||
@@ -112,7 +112,6 @@ function goSchedules() {
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
// 游客进入免登录模块:停留外壳,不拉受保护数据,也不强制跳登录
|
||||
if (!isLoggedIn()) return
|
||||
load()
|
||||
loadTodo()
|
||||
@@ -129,7 +128,6 @@ onShow(() => {
|
||||
.page {
|
||||
@include page-shell;
|
||||
|
||||
// 嵌入模式下由父页(tabs.vue)的 scroll-view 统一滚动,这里改为自然高度
|
||||
&.embedded {
|
||||
height: auto;
|
||||
}
|
||||
@@ -147,7 +145,6 @@ onShow(() => {
|
||||
|
||||
.head-title {
|
||||
display: block;
|
||||
/* 取消顶部返回按钮后,保留头部避让高度 */
|
||||
margin-top: 32rpx;
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
|
||||
Reference in new issue
Block a user