更新密码找回uniapp
This commit is contained in:
1 parent
7f9a66da0f
commit
3fdda89833
1304 files changed
+3503
-26132
No files matched your search
@@ -1,6 +1,5 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<!-- 平台信息 -->
|
||||
<view class="section-card">
|
||||
<view class="section-title">平台信息</view>
|
||||
|
||||
@@ -36,7 +35,6 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 挂载账号列表 -->
|
||||
<view class="section-card">
|
||||
<view class="section-head">
|
||||
<text class="section-title">挂载账号列表</text>
|
||||
@@ -115,7 +113,6 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 保存 -->
|
||||
<view class="footer">
|
||||
<u-button
|
||||
type="primary"
|
||||
@@ -222,7 +219,6 @@ async function onSubmit() {
|
||||
uni.showToast({ title: '保存成功', icon: 'success' })
|
||||
setTimeout(() => uni.navigateBack(), 400)
|
||||
} catch (e) {
|
||||
// 错误提示由 request 层统一处理
|
||||
} finally {
|
||||
saving.value = false
|
||||
}
|
||||
@@ -241,7 +237,6 @@ function onDelete() {
|
||||
uni.showToast({ title: '已删除', icon: 'none' })
|
||||
setTimeout(() => uni.navigateBack(), 400)
|
||||
} catch (e) {
|
||||
// 错误提示由 request 层统一处理
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<!-- 顶部工具栏 -->
|
||||
<view class="toolbar">
|
||||
<u-search
|
||||
v-model="keyword"
|
||||
@@ -12,17 +11,14 @@
|
||||
/>
|
||||
</view>
|
||||
|
||||
<!-- 统计 -->
|
||||
<view class="stats-row">
|
||||
<text class="stats-text">共 {{ total }} 条</text>
|
||||
</view>
|
||||
|
||||
<!-- 加载中 -->
|
||||
<view v-if="loading" class="loading-wrap">
|
||||
<u-loading-icon mode="circle" size="36" color="#2563eb"></u-loading-icon>
|
||||
</view>
|
||||
|
||||
<!-- 空态 -->
|
||||
<u-empty
|
||||
v-else-if="!list.length"
|
||||
mode="data"
|
||||
@@ -30,10 +26,8 @@
|
||||
margin-top="120"
|
||||
/>
|
||||
|
||||
<!-- 账号卡片列表 -->
|
||||
<view v-else class="store-list">
|
||||
<view v-for="store in list" :key="store.id" class="store-card">
|
||||
<!-- 平台头 -->
|
||||
<view class="store-head" @click="toggleExpand(store.id)">
|
||||
<view class="store-icon">
|
||||
<FaIcon name="key" color="#2563eb" :size="18" />
|
||||
@@ -60,10 +54,8 @@
|
||||
/>
|
||||
</view>
|
||||
|
||||
<!-- 平台备注 -->
|
||||
<view v-if="store.remark" class="store-remark">{{ store.remark }}</view>
|
||||
|
||||
<!-- 账号明细 -->
|
||||
<view v-if="expandedId === store.id" class="account-list">
|
||||
<view v-for="(acc, idx) in store.accounts" :key="idx" class="account-item">
|
||||
<view class="account-row">
|
||||
@@ -95,7 +87,6 @@
|
||||
<view v-if="!store.accounts.length" class="account-empty">该平台暂无账号</view>
|
||||
</view>
|
||||
|
||||
<!-- 操作行 -->
|
||||
<view class="actions-row">
|
||||
<view class="action-btn" @click.stop="goEdit(store.id)">
|
||||
<FaIcon name="pen-to-square" color="#2563eb" :size="14" />
|
||||
@@ -109,7 +100,6 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 悬浮新增 -->
|
||||
<view class="fab" @click="goEdit()">
|
||||
<FaIcon name="plus" color="#ffffff" :size="24" />
|
||||
</view>
|
||||
@@ -189,7 +179,6 @@ function onDelete(store) {
|
||||
uni.showToast({ title: '已删除', icon: 'none' })
|
||||
loadList()
|
||||
} catch (e) {
|
||||
// 错误提示由 request 层统一处理
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -197,7 +186,6 @@ function onDelete(store) {
|
||||
|
||||
onLoad(() => loadList())
|
||||
onShow(() => {
|
||||
// 从编辑页返回后刷新(首次进入由 onLoad 加载,避免重复请求)
|
||||
if (inited.value) loadList()
|
||||
inited.value = true
|
||||
})
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
<text class="state-text">加载中...</text>
|
||||
</view>
|
||||
<template v-else-if="detail">
|
||||
<!-- 单据信息 -->
|
||||
<view class="detail-card">
|
||||
<view class="head-row">
|
||||
<text class="head-amount">¥{{ moneyText(detail.total_amount) }}</text>
|
||||
@@ -35,7 +34,6 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 费用明细 -->
|
||||
<view class="block-card">
|
||||
<view class="block-head">
|
||||
<text class="block-title">费用明细</text>
|
||||
@@ -74,7 +72,6 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 审批记录(与审批中心一致的审批流样式) -->
|
||||
<view class="block-card">
|
||||
<view class="block-head">
|
||||
<text class="block-title">审批记录</text>
|
||||
@@ -112,7 +109,6 @@
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<!-- 操作按钮:草稿可删除/编辑/提交;审批通过后由报销人确认到账 -->
|
||||
<view v-if="detail && isDraft" class="footer">
|
||||
<view class="footer-btn">
|
||||
<u-button type="error" plain icon="trash" text="删除" @click="onDelete" />
|
||||
@@ -125,7 +121,6 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 审批通过:等待报销人确认款项是否已到账 -->
|
||||
<view v-else-if="detail && isApproved" class="footer">
|
||||
<view class="footer-btn">
|
||||
<u-button type="success" icon="checkmark-circle" text="确认到账" @click="onConfirmPaid" />
|
||||
@@ -162,7 +157,6 @@ const myTask = ref(null)
|
||||
const loading = ref(false)
|
||||
|
||||
const isDraft = computed(() => Number(detail.value?.status) === EXPENSE_STATUS.DRAFT)
|
||||
// 审批通过:等待报销人本人确认款项到账
|
||||
const isApproved = computed(() => Number(detail.value?.status) === EXPENSE_STATUS.APPROVED)
|
||||
|
||||
const descText = computed(() => {
|
||||
@@ -170,7 +164,6 @@ const descText = computed(() => {
|
||||
return desc || ''
|
||||
})
|
||||
|
||||
/** 审批记录 -> 审批流节点:每条记录一个节点,末尾补「流程结束」节点展示单据当前状态 */
|
||||
const flowNodes = computed(() => {
|
||||
const nodes = (records.value || []).map((record, index) => {
|
||||
const action = Number(record.action)
|
||||
@@ -199,7 +192,6 @@ const flowNodes = computed(() => {
|
||||
return nodes
|
||||
})
|
||||
|
||||
/** 末尾「流程结束」节点:显示单据当前状态,让申请人一眼看出流程是否走完 */
|
||||
function buildEndNode() {
|
||||
const status = Number(detail.value?.status)
|
||||
const map = {
|
||||
@@ -230,7 +222,6 @@ function avatarOf(name) {
|
||||
return text ? text.slice(0, 1) : '系'
|
||||
}
|
||||
|
||||
/** 动作角标:1提交/2通过 -> 绿✓;3驳回 -> 红✕;4转审 -> 橙;5撤回 -> 灰 */
|
||||
function badgeClassOfAction(action) {
|
||||
if (action === 3) return 'badge-reject'
|
||||
if (action === 1 || action === 2) return 'badge-pass'
|
||||
@@ -245,7 +236,6 @@ function badgeIconOfAction(action) {
|
||||
return '—'
|
||||
}
|
||||
|
||||
/** 时间只展示到分钟 */
|
||||
function shortTime(value) {
|
||||
if (!value) return ''
|
||||
return String(value).slice(0, 16)
|
||||
@@ -262,11 +252,8 @@ onShow(() => {
|
||||
if (expenseId.value) loadDetail()
|
||||
})
|
||||
|
||||
// 监听审批通过 / 确认到账后的刷新事件。
|
||||
// 新版 uni-app 已不再导出 onUniAppEvent,改用全局事件总线并在页面卸载时解绑。
|
||||
function handleExpenseUpdated(data) {
|
||||
if (data?.id === expenseId.value) {
|
||||
// 延迟一点刷新,确保后端数据已同步
|
||||
setTimeout(() => loadDetail(), 300)
|
||||
}
|
||||
}
|
||||
@@ -276,7 +263,6 @@ onUnload(() => {
|
||||
uni.$off('expense-updated', handleExpenseUpdated)
|
||||
})
|
||||
|
||||
/** 后端时间字段可能为 "YYYY-MM-DD HH:mm:ss" 格式,iOS 需转 T 分隔 */
|
||||
function formatTime(value) {
|
||||
if (!value) return ''
|
||||
return String(value).replace(' ', 'T').slice(0, 16).replace('T', ' ')
|
||||
@@ -294,7 +280,6 @@ async function loadDetail() {
|
||||
detail.value = data
|
||||
items.value = data.items || []
|
||||
records.value = await fetchExpenseRecords(expenseId.value)
|
||||
// 审批人视角:审批中的单据查询自己是否有待办任务(非审批人静默返回 null)
|
||||
try {
|
||||
myTask.value = Number(data.status) === EXPENSE_STATUS.APPROVING
|
||||
? await fetchMyApproveTask(expenseId.value)
|
||||
@@ -309,7 +294,6 @@ async function loadDetail() {
|
||||
}
|
||||
}
|
||||
|
||||
/** 图片预览:只把图片类发票给 previewImage,PDF 不参与 */
|
||||
function previewReceipt(receipts, index) {
|
||||
const current = receipts?.[index]
|
||||
const urls = (receipts || [])
|
||||
@@ -320,7 +304,6 @@ function previewReceipt(receipts, index) {
|
||||
uni.previewImage({ urls, current: current && !isPdfReceipt(current) ? current.url : urls[0] })
|
||||
}
|
||||
|
||||
/** PDF 发票:下载后用文档查看器打开(image 组件无法渲染 PDF,会被 ORB 拦截) */
|
||||
function openReceiptFile(file) {
|
||||
if (!file?.url) return
|
||||
uni.showLoading({ title: '打开中...' })
|
||||
@@ -354,13 +337,11 @@ function onSubmit() {
|
||||
uni.showToast({ title: '已提交审批', icon: 'success' })
|
||||
loadDetail()
|
||||
} catch (e) {
|
||||
// request 封装已弹出服务端错误提示
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/** 报销人确认款项已到账:确认后单据状态变为「已打款」 */
|
||||
async function onConfirmPaid() {
|
||||
const confirmed = await new Promise((resolve) => {
|
||||
uni.showModal({
|
||||
@@ -379,7 +360,6 @@ async function onConfirmPaid() {
|
||||
await loadDetail()
|
||||
uni.$emit('expense-updated', { id: expenseId.value })
|
||||
} catch (e) {
|
||||
// request 封装已弹出服务端错误提示
|
||||
}
|
||||
}
|
||||
|
||||
@@ -394,13 +374,11 @@ function onDelete() {
|
||||
uni.showToast({ title: '已删除', icon: 'success' })
|
||||
setTimeout(() => uni.navigateBack(), 400)
|
||||
} catch (e) {
|
||||
// request 封装已弹出服务端错误提示
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/** 通过当前审批节点:成功后按引擎提示刷新(会签等待/流转/完成) */
|
||||
function onApprove() {
|
||||
uni.showModal({
|
||||
title: '通过审批',
|
||||
@@ -412,13 +390,11 @@ function onApprove() {
|
||||
uni.showToast({ title: result?.message || '已通过', icon: 'none' })
|
||||
loadDetail()
|
||||
} catch (e) {
|
||||
// request 封装已弹出服务端错误提示
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/** 驳回报销单:填写审批意见(可空) */
|
||||
function onReject() {
|
||||
uni.showModal({
|
||||
title: '驳回',
|
||||
@@ -431,7 +407,6 @@ function onReject() {
|
||||
uni.showToast({ title: '已驳回', icon: 'none' })
|
||||
loadDetail()
|
||||
} catch (e) {
|
||||
// request 封装已弹出服务端错误提示
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -627,7 +602,6 @@ function onReject() {
|
||||
color: $color-text-muted;
|
||||
}
|
||||
|
||||
/* 审批记录沿用审批中心的审批流样式 */
|
||||
@include flow-timeline;
|
||||
|
||||
.footer {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<!-- 基本信息 -->
|
||||
<view class="form-card">
|
||||
<view class="field">
|
||||
<text class="field-label">申请日期 <text class="required">*</text></text>
|
||||
@@ -24,7 +23,6 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 费用明细 -->
|
||||
<view class="items-card">
|
||||
<view class="items-head">
|
||||
<text class="items-title">费用明细</text>
|
||||
@@ -73,7 +71,6 @@
|
||||
/>
|
||||
</view>
|
||||
|
||||
<!-- 明细编辑弹层 -->
|
||||
<view v-if="itemEditorVisible" class="mask" @tap="closeItemEditor">
|
||||
<view class="sheet" @tap.stop>
|
||||
<view class="sheet-head">
|
||||
@@ -187,7 +184,6 @@ const form = reactive({
|
||||
description: ''
|
||||
})
|
||||
|
||||
/** 本地明细列表:编辑已有明细时带 id,保存时全量重建 */
|
||||
const items = ref([])
|
||||
|
||||
const typeOptions = ref([])
|
||||
@@ -366,7 +362,6 @@ function onRemoveReceipt(index) {
|
||||
itemForm.receipts.splice(index, 1)
|
||||
}
|
||||
|
||||
/** 上传发票:选择图片(拍照/相册)或从聊天文件选 PDF */
|
||||
function onUploadReceipt() {
|
||||
if (uploading.value) return
|
||||
uni.showActionSheet({
|
||||
@@ -390,7 +385,6 @@ function chooseImageReceipt() {
|
||||
})
|
||||
}
|
||||
|
||||
/** 小程序沙箱内选择本地 PDF 只能走微信会话文件(chooseMessageFile) */
|
||||
function chooseFileReceipt() {
|
||||
if (typeof uni.chooseMessageFile !== 'function') {
|
||||
uni.showToast({ title: '当前环境不支持选择文件', icon: 'none' })
|
||||
@@ -406,7 +400,6 @@ function chooseFileReceipt() {
|
||||
await uploadReceipts(paths)
|
||||
},
|
||||
fail: () => {
|
||||
// 用户取消选择,静默处理
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -421,7 +414,6 @@ async function uploadReceipts(paths) {
|
||||
}
|
||||
uni.showToast({ title: '上传成功', icon: 'success' })
|
||||
} catch (e) {
|
||||
// 上传封装已提示错误
|
||||
} finally {
|
||||
uploading.value = false
|
||||
}
|
||||
@@ -439,7 +431,6 @@ async function onSave() {
|
||||
const payload = { applyDate: form.applyDate, description: form.description }
|
||||
if (id) {
|
||||
await updateExpense(id, payload)
|
||||
// 明细全量重建:先删旧再逐条新增(草稿单,明细量少)
|
||||
const oldItems = await getExpense(id)
|
||||
for (const item of oldItems?.items || []) {
|
||||
await deleteExpenseItem(id, item.id)
|
||||
@@ -453,7 +444,6 @@ async function onSave() {
|
||||
uni.showToast({ title: '保存成功', icon: 'success' })
|
||||
setTimeout(() => uni.navigateBack(), 400)
|
||||
} catch (e) {
|
||||
// request 封装已弹出服务端错误提示
|
||||
} finally {
|
||||
saving.value = false
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<!-- 搜索 + 状态筛选 -->
|
||||
<view class="filter-bar">
|
||||
<view class="search-box">
|
||||
<FaIcon name="magnifying-glass" color="#94a3b8" :size="16" />
|
||||
@@ -28,7 +27,6 @@
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
<!-- 报销单列表 -->
|
||||
<view v-if="loading && !list.length" class="state-box">
|
||||
<text class="state-text">加载中...</text>
|
||||
</view>
|
||||
@@ -61,7 +59,6 @@
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<!-- 新建入口 -->
|
||||
<view class="fab" @tap="openCreate">
|
||||
<FaIcon name="plus" color="#ffffff" :size="22" />
|
||||
<text>新建报销</text>
|
||||
@@ -82,7 +79,6 @@ import {
|
||||
|
||||
const PAGE_SIZE = 20
|
||||
|
||||
// -1 为「待我审批」约定值(后端按当前用户运行中审批待办过滤)
|
||||
const tabs = [{ value: -1, label: '待我审批' }, { value: '', label: '全部' }, ...EXPENSE_STATUS_OPTIONS]
|
||||
|
||||
const list = ref([])
|
||||
|
||||
@@ -79,7 +79,6 @@ const loading = ref(false)
|
||||
const pinnedCount = computed(() => notes.value.filter(item => item.pinned).length)
|
||||
|
||||
onMounted(() => {
|
||||
// 免登录页面:登录态或游客令牌均可用;两者皆无回门户触发授权/登录
|
||||
if (!isLoggedIn() && !getGuestToken()) {
|
||||
uni.reLaunch({ url: '/pages/nav/nav' })
|
||||
return
|
||||
|
||||
@@ -36,11 +36,6 @@
|
||||
<text class="info-value">{{ timeRangeText }}</text>
|
||||
</view>
|
||||
|
||||
<!-- <view class="info-row">
|
||||
<text class="info-label">优先级</text>
|
||||
<text class="info-value">{{ priorityLabel }}</text>
|
||||
</view> -->
|
||||
|
||||
<view
|
||||
v-if="item.images?.length || item.completed"
|
||||
class="image-block"
|
||||
@@ -118,13 +113,11 @@ const priorityLabel = computed(() => {
|
||||
return getOaPriorityLabel(item.value.priority)
|
||||
})
|
||||
|
||||
/** 标题即内容:标题作为正文主文本展示 */
|
||||
const headText = computed(() => {
|
||||
if (!item.value) return ''
|
||||
return (item.value.title || '').trim() || '无标题'
|
||||
})
|
||||
|
||||
/** content 与标题相同(或为空)时不重复展示,仅在有额外内容时补充显示 */
|
||||
const extraContent = computed(() => {
|
||||
if (!item.value) return ''
|
||||
const c = (item.value.content || '').trim()
|
||||
@@ -152,7 +145,6 @@ onShow(() => {
|
||||
if (scheduleId.value) loadDetail()
|
||||
})
|
||||
|
||||
/** 后端时间字段可能为 "YYYY-MM-DD HH:mm:ss" 格式,iOS 需转 T 分隔 */
|
||||
function formatTime(value) {
|
||||
if (!value) return ''
|
||||
return formatDate(new Date(String(value).replace(' ', 'T')), true)
|
||||
@@ -181,7 +173,6 @@ function previewImage(index) {
|
||||
uni.previewImage({ urls, current: urls[index] || urls[0] })
|
||||
}
|
||||
|
||||
/** 上传资料图片:选图 → 逐张上传 → 引用写回日程 */
|
||||
function onUploadMaterial() {
|
||||
if (uploading.value) return
|
||||
uni.chooseImage({
|
||||
@@ -202,7 +193,6 @@ function onUploadMaterial() {
|
||||
item.value.images = saved
|
||||
uni.showToast({ title: '上传成功', icon: 'success' })
|
||||
} catch (e) {
|
||||
// 上传/请求封装已提示错误
|
||||
} finally {
|
||||
uploading.value = false
|
||||
}
|
||||
@@ -210,7 +200,6 @@ function onUploadMaterial() {
|
||||
})
|
||||
}
|
||||
|
||||
/** 长按删除资料图片(仅移除引用,不动文件管理里的文件) */
|
||||
function onRemoveImage(index) {
|
||||
const img = item.value?.images?.[index]
|
||||
if (!img || uploading.value) return
|
||||
@@ -227,7 +216,6 @@ function onRemoveImage(index) {
|
||||
item.value.images = saved
|
||||
uni.showToast({ title: '已删除', icon: 'none' })
|
||||
} catch (e) {
|
||||
// request 封装已提示错误
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -248,7 +236,6 @@ async function onToggleComplete() {
|
||||
icon: 'none'
|
||||
})
|
||||
} catch (e) {
|
||||
// request 封装已弹出服务端错误提示
|
||||
}
|
||||
}
|
||||
|
||||
@@ -264,7 +251,6 @@ function onDelete() {
|
||||
uni.showToast({ title: '已删除', icon: 'success' })
|
||||
setTimeout(() => uni.navigateBack(), 400)
|
||||
} catch (e) {
|
||||
// request 封装已弹出服务端错误提示
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -223,7 +223,6 @@ async function saveData() {
|
||||
uni.showToast({ title: '保存成功', icon: 'success' })
|
||||
setTimeout(() => uni.navigateBack(), 400)
|
||||
} catch (e) {
|
||||
// request 封装已弹出服务端错误提示
|
||||
} finally {
|
||||
saving.value = false
|
||||
}
|
||||
|
||||
@@ -2,13 +2,10 @@
|
||||
<view class="page">
|
||||
<scroll-view class="body" scroll-y :show-scrollbar="false">
|
||||
<view class="body-inner">
|
||||
<!-- 本周概览横幅 -->
|
||||
<view class="hero-banner">
|
||||
<view class="hero-info">
|
||||
<view class="hero-title-row">
|
||||
<text class="hero-title">本周日程</text>
|
||||
<!-- <text class="hero-unit">(项)</text> -->
|
||||
<!-- <text class="hero-count">{{ weekCount }}</text> -->
|
||||
</view>
|
||||
<text class="hero-sub">{{ heroRangeLabel }}</text>
|
||||
</view>
|
||||
@@ -17,7 +14,6 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 可收缩日历 -->
|
||||
<view class="cal-card">
|
||||
<view v-if="expanded" class="cal-head">
|
||||
<text class="cal-title">{{ monthLabel }}</text>
|
||||
@@ -70,7 +66,6 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 选中日期的日程 -->
|
||||
<view class="day-head">
|
||||
<text class="day-title">{{ selectedLabel }}</text>
|
||||
<text class="day-count">{{ dayItems.length }} 项</text>
|
||||
@@ -132,12 +127,10 @@ import { fetchOaSchedules } from '@/api/oaSchedule.js'
|
||||
import { pad, startOfDay, isToday, isTomorrow, dayLabel } from '@/utils/date.js'
|
||||
import { isLoggedIn } from '@/utils/auth.js'
|
||||
|
||||
/** 周一为一周第一天 */
|
||||
const WEEK_LABELS = ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
|
||||
|
||||
const schedules = ref([])
|
||||
const loading = ref(false)
|
||||
/** 默认收缩,仅显示选中日所在周的一行 */
|
||||
const expanded = ref(false)
|
||||
const monthCursor = ref(new Date(new Date().getFullYear(), new Date().getMonth(), 1))
|
||||
const selectedDate = ref(startOfDay(new Date()))
|
||||
@@ -153,7 +146,6 @@ const monthLabel = computed(
|
||||
|
||||
const selectedKey = computed(() => dateKey(selectedDate.value))
|
||||
|
||||
/** 选中日所在周(周一~周日)的 7 个单元格 */
|
||||
const weekCells = computed(() => {
|
||||
const base = selectedDate.value
|
||||
const offset = (base.getDay() + 6) % 7
|
||||
@@ -171,7 +163,6 @@ const weekCells = computed(() => {
|
||||
return cells
|
||||
})
|
||||
|
||||
/** 月历 6×7 单元格,含上下月补齐日期 */
|
||||
const monthCells = computed(() => {
|
||||
const year = monthCursor.value.getFullYear()
|
||||
const month = monthCursor.value.getMonth()
|
||||
@@ -193,7 +184,6 @@ const monthCells = computed(() => {
|
||||
|
||||
const gridCells = computed(() => (expanded.value ? monthCells.value : weekCells.value))
|
||||
|
||||
/** 日程按日期聚合,key 为 YYYY-MM-DD(OA 日程的 schedule_date) */
|
||||
const dayMap = computed(() => {
|
||||
const map = {}
|
||||
schedules.value.forEach((item) => {
|
||||
@@ -204,7 +194,6 @@ const dayMap = computed(() => {
|
||||
return map
|
||||
})
|
||||
|
||||
/** 选中日期的日程:全天在前,其余按开始时间升序 */
|
||||
const dayItems = computed(() => {
|
||||
const list = dayMap.value[selectedKey.value] || []
|
||||
return list.slice().sort((a, b) => {
|
||||
@@ -214,7 +203,6 @@ const dayItems = computed(() => {
|
||||
})
|
||||
})
|
||||
|
||||
/** 本周(周一~周日)范围与日程数 */
|
||||
const weekRange = computed(() => {
|
||||
const now = startOfDay(new Date())
|
||||
const offset = (now.getDay() + 6) % 7
|
||||
@@ -246,7 +234,6 @@ const selectedLabel = computed(() => {
|
||||
return `${d.getMonth() + 1}月${d.getDate()}日 ${week}`
|
||||
})
|
||||
|
||||
/** 日历标记点:未完成(蓝)靠左优先排,已完成(绿)靠后,最多 3 个 */
|
||||
function dayDots(key) {
|
||||
const list = dayMap.value[key] || []
|
||||
const pending = list.filter((item) => !item.completed)
|
||||
@@ -254,14 +241,12 @@ function dayDots(key) {
|
||||
return pending.concat(done).slice(0, 3).map((item) => (item.completed ? 'done' : 'pending'))
|
||||
}
|
||||
|
||||
/** 时间展示:全天显示「全天」,其余显示开始时间或起止区间 */
|
||||
function timeRangeText(item) {
|
||||
if (item.allDay) return '全天'
|
||||
if (!item.start_time) return ''
|
||||
return item.end_time ? `${item.start_time} - ${item.end_time}` : item.start_time
|
||||
}
|
||||
|
||||
/** 数据加载区间:当前日历月前后各扩 7 天,覆盖周视图跨月格子 */
|
||||
function currentRange() {
|
||||
const year = monthCursor.value.getFullYear()
|
||||
const month = monthCursor.value.getMonth()
|
||||
@@ -289,7 +274,6 @@ function pickDay(cell) {
|
||||
cell.date.getMonth() !== monthCursor.value.getMonth()
|
||||
selectedDate.value = startOfDay(cell.date)
|
||||
monthCursor.value = new Date(cell.date.getFullYear(), cell.date.getMonth(), 1)
|
||||
// 月历里选完日期后自动收回周栏
|
||||
if (expanded.value) expanded.value = false
|
||||
if (monthChanged) loadSchedules()
|
||||
}
|
||||
@@ -309,7 +293,6 @@ onShow(() => {
|
||||
async function loadSchedules() {
|
||||
loading.value = true
|
||||
try {
|
||||
// OA 工作日程:按日历区间拉取(前后各扩 7 天),端上按天聚合
|
||||
const { startDate, endDate } = currentRange()
|
||||
const res = await fetchOaSchedules({ startDate, endDate, pageSize: 500 })
|
||||
schedules.value = res.list
|
||||
@@ -349,7 +332,6 @@ function openDetail(id) {
|
||||
padding: 20rpx $page-padding-x 0;
|
||||
}
|
||||
|
||||
/* ---------- 本周概览横幅 ---------- */
|
||||
.hero-banner {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -407,7 +389,6 @@ function openDetail(id) {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
/* ---------- 可收缩日历 ---------- */
|
||||
.cal-card {
|
||||
margin-top: 20rpx;
|
||||
padding: 16rpx 16rpx 8rpx;
|
||||
@@ -531,17 +512,14 @@ function openDetail(id) {
|
||||
border-radius: 50%;
|
||||
background: $color-danger;
|
||||
|
||||
/* 未完成:红色 */
|
||||
&.pending {
|
||||
background: $color-danger;
|
||||
}
|
||||
|
||||
/* 已完成:绿色 */
|
||||
&.done {
|
||||
background: $color-success;
|
||||
}
|
||||
|
||||
/* 选中日:红点转浅红、绿点转浅绿,保证在深蓝底上的对比度 */
|
||||
&.pending.on {
|
||||
background: #fca5a5;
|
||||
}
|
||||
@@ -565,7 +543,6 @@ function openDetail(id) {
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------- 当日日程 ---------- */
|
||||
.day-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
@@ -110,7 +110,6 @@ import { formatDate, pad } from '@/utils/date.js'
|
||||
const reminderId = ref('')
|
||||
const saving = ref(false)
|
||||
|
||||
// 渠道选择:Bark/APP 暂时隐藏,短信暂不可选
|
||||
const channelOptions = REMIND_CHANNEL_OPTIONS
|
||||
.filter(opt => opt.value !== 'bark' && opt.value !== 'app')
|
||||
.map(opt => ({ ...opt, disabled: opt.value === 'sms' }))
|
||||
@@ -265,7 +264,6 @@ async function onSave() {
|
||||
uni.showToast({ title: '保存成功', icon: 'success' })
|
||||
setTimeout(() => uni.navigateBack(), 400)
|
||||
} catch (e) {
|
||||
// request 封装已弹出服务端错误提示
|
||||
} finally {
|
||||
saving.value = false
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<!-- 本周概览 -->
|
||||
<view class="hero-card">
|
||||
<view class="hero-left">
|
||||
<text class="hero-sub">查看每周日程提醒</text>
|
||||
@@ -14,7 +13,6 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 月历(可下拉展开) -->
|
||||
<view class="cal-card">
|
||||
<view class="cal-header">
|
||||
<view class="cal-nav" @tap="switchMonth(-1)">
|
||||
@@ -30,7 +28,6 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 周历条 -->
|
||||
<view class="week-strip">
|
||||
<view
|
||||
v-for="d in weekDays"
|
||||
@@ -47,7 +44,6 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 月历展开 -->
|
||||
<view v-if="monthOpen" class="month-grid">
|
||||
<text v-for="n in WEEK_LABELS" :key="'w' + n" class="month-weekname">周{{ n }}</text>
|
||||
<view
|
||||
@@ -63,7 +59,6 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 我的日程 -->
|
||||
<view class="section-head">
|
||||
<text class="section-title">我的日程({{ shownItems.length }})</text>
|
||||
<view class="range-tabs">
|
||||
@@ -101,7 +96,6 @@
|
||||
|
||||
<view class="bottom-space" />
|
||||
|
||||
<!-- 新增按钮 -->
|
||||
<view class="fab" @tap="openCreate">
|
||||
<FaIcon name="plus" color="#ffffff" :size="20" />
|
||||
<text class="fab-text">新增</text>
|
||||
@@ -117,7 +111,6 @@ import { pad, startOfDay, isToday } from '@/utils/date.js'
|
||||
import { isLoggedIn } from '@/utils/auth.js'
|
||||
import { getGuestToken } from '@/utils/guest.js'
|
||||
|
||||
/** 周一为一周第一天 */
|
||||
const WEEK_LABELS = ['一', '二', '三', '四', '五', '六', '日']
|
||||
|
||||
const schedules = ref([])
|
||||
@@ -139,10 +132,9 @@ function startOfWeek(base = new Date()) {
|
||||
const weekStart = computed(() => startOfWeek(selectedDate.value))
|
||||
const selectedKey = computed(() => dateKey(selectedDate.value))
|
||||
|
||||
/* ---------- 月历(可下拉展开) ---------- */
|
||||
const monthOpen = ref(false)
|
||||
const viewYear = ref(new Date().getFullYear())
|
||||
const viewMonth = ref(new Date().getMonth()) // 0-based
|
||||
const viewMonth = ref(new Date().getMonth())
|
||||
|
||||
const monthLabel = computed(() => `${viewYear.value}年${viewMonth.value + 1}月`)
|
||||
|
||||
@@ -160,7 +152,6 @@ function switchMonth(step) {
|
||||
viewMonth.value = m
|
||||
}
|
||||
|
||||
/** 月历格子:从包含 1 号的那周周一起,固定 6 行 × 7 列 */
|
||||
const monthCells = computed(() => {
|
||||
const first = new Date(viewYear.value, viewMonth.value, 1)
|
||||
const offset = (first.getDay() + 6) % 7
|
||||
@@ -185,12 +176,10 @@ function pickMonthDay(cell) {
|
||||
range.value = 'day'
|
||||
}
|
||||
|
||||
/** 只保留已设置提醒渠道的日程 */
|
||||
const reminders = computed(() =>
|
||||
schedules.value.filter((item) => item.remindChannels && item.remindChannels.length > 0)
|
||||
)
|
||||
|
||||
/** 提醒按日期聚合,key 为 YYYY-MM-DD */
|
||||
const reminderMap = computed(() => {
|
||||
const map = {}
|
||||
reminders.value.forEach((item) => {
|
||||
@@ -218,7 +207,6 @@ const weekDays = computed(() => {
|
||||
})
|
||||
})
|
||||
|
||||
/** 本周(周一~周日)的提醒,按时间升序 */
|
||||
const weekItems = computed(() => {
|
||||
const base = weekStart.value
|
||||
const startTs = base.getTime()
|
||||
@@ -283,7 +271,6 @@ function openCreate() {
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
// 免登录页面:登录态或游客令牌均可用;两者皆无回门户触发授权/登录
|
||||
if (!isLoggedIn() && !getGuestToken()) {
|
||||
uni.reLaunch({ url: '/pages/nav/nav' })
|
||||
return
|
||||
@@ -291,7 +278,6 @@ onMounted(() => {
|
||||
loadReminders()
|
||||
})
|
||||
|
||||
// 新增/编辑返回后刷新列表
|
||||
onShow(() => {
|
||||
if (isLoggedIn() || getGuestToken()) loadReminders()
|
||||
})
|
||||
@@ -319,7 +305,6 @@ async function loadReminders() {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* ---------- 本周概览 ---------- */
|
||||
.hero-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -371,7 +356,6 @@ async function loadReminders() {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
/* ---------- 月历(可下拉展开) ---------- */
|
||||
.cal-card {
|
||||
margin-top: 20rpx;
|
||||
padding: 12rpx 8rpx 16rpx;
|
||||
@@ -425,7 +409,6 @@ async function loadReminders() {
|
||||
color: $color-primary;
|
||||
}
|
||||
|
||||
/* ---------- 周历条 ---------- */
|
||||
.week-strip {
|
||||
display: flex;
|
||||
padding: 8rpx 8rpx 4rpx;
|
||||
@@ -477,7 +460,6 @@ async function loadReminders() {
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------- 月历网格 ---------- */
|
||||
.month-grid {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
@@ -533,7 +515,6 @@ async function loadReminders() {
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
/* ---------- 我的日程 ---------- */
|
||||
.section-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -645,7 +626,6 @@ async function loadReminders() {
|
||||
height: 60rpx;
|
||||
}
|
||||
|
||||
/* ---------- 新增按钮 ---------- */
|
||||
.fab {
|
||||
position: fixed;
|
||||
right: 32rpx;
|
||||
|
||||
Reference in new issue
Block a user