From e228f07129888a02ce2186e3be4b42e2ce98ba0e Mon Sep 17 00:00:00 2001 From: huertian Date: Mon, 13 Jul 2026 16:23:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=82=AC=E5=8A=9E=E6=88=90?= =?UTF-8?q?=E5=8A=9F=E6=B6=88=E6=81=AF=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/BussApi.ts | 17 +++++++++++++++++ src/pages/lesson/index.vue | 19 ++++++++++++++----- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/src/api/BussApi.ts b/src/api/BussApi.ts index a1fd6f3..a71430f 100644 --- a/src/api/BussApi.ts +++ b/src/api/BussApi.ts @@ -361,6 +361,23 @@ export default class BussApi { .then((res) => res.data); } + /** + * 根据ID获取用户信息 + * @param id - 用户ID + * @returns Promise 返回用户信息 + */ + static getUserById(id: number): Promise { + const user = useUser(); + return http + .server() + .get(`users/${id}`, { + headers: { + Authorization: `Bearer ${user.token}`, + }, + }) + .then((res) => res.data.data); + } + /** * 检查当前用户是否需要任务提醒 * @returns Promise 返回是否需要提醒 diff --git a/src/pages/lesson/index.vue b/src/pages/lesson/index.vue index 40154e5..acc3248 100644 --- a/src/pages/lesson/index.vue +++ b/src/pages/lesson/index.vue @@ -31,23 +31,32 @@ const shouldCurrentUserHandle = () => { +// 获取催办成功提示文案 +const getReminderSuccessMsg = (): string => { + if (!lesson.value) return '催办信息已提交' + const role = getLessonRole(lesson.value) + if (role === 'teacher') return '催办信息已提交至课程教师' + if (role === 'admin') return '催办信息已提交至制作方' + return '催办信息已提交' +} + // 发送催办提醒 const sendReminder = async () => { if (!lesson.value) return try { toast.loading({ msg: '发送催办中...' }) await BussApi.sendReminder(lesson.value.id) - toast.success({ msg: '催办成功,已通知相关人员处理' }) - // 重新加载课程详情 + const successMsg = getReminderSuccessMsg() + // 先刷新数据(内部会覆盖 loading toast),再显示成功提示 await loadLesson() + uni.showToast({ title: successMsg, icon: 'none', duration: 2000 }) } catch (err: unknown) { + toast.close() if (err instanceof Error) { toast.error({ msg: err.message }) } else { toast.error({ msg: '催办失败' }) } - } finally { - toast.close() } } @@ -211,7 +220,7 @@ onLoad(() => {