更新密码找回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

-14
View File
@@ -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 封装已弹出服务端错误提示
}
}
})
-1
View File
@@ -223,7 +223,6 @@ async function saveData() {
uni.showToast({ title: '保存成功', icon: 'success' })
setTimeout(() => uni.navigateBack(), 400)
} catch (e) {
// request 封装已弹出服务端错误提示
} finally {
saving.value = false
}
-23
View File
@@ -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 -21
View File
@@ -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;