更新密码找回uniapp

This commit is contained in:
hero920103 committed 2026-11-16 17:22:50 +08:00
1 parent 7f9a66da0f
commit 3fdda89833
1304 files changed
+3503 -26132

No files matched your search

-49
View File
@@ -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;