Compare commits

..

2 Commits

Author SHA1 Message Date
iven
a1fa51206f feat(miniprogram): 个人中心添加我的预约+在线咨询入口
Some checks failed
CI / rust-check (push) Has been cancelled
CI / rust-test (push) Has been cancelled
CI / frontend-build (push) Has been cancelled
CI / security-audit (push) Has been cancelled
2026-05-01 18:19:23 +08:00
iven
0fb8b98c72 feat(miniprogram): 通知 Tab 对接 erp-message 消息 API — 替换空壳 2026-05-01 18:18:51 +08:00
3 changed files with 19 additions and 3 deletions

View File

@@ -2,6 +2,7 @@ import { useState } from 'react';
import { View, Text } from '@tarojs/components';
import Taro, { useDidShow } from '@tarojs/taro';
import { listConsultations, ConsultationSession } from '../../services/consultation';
import { notificationService } from '../../services/notification';
import Loading from '../../components/Loading';
import './index.scss';
@@ -32,9 +33,8 @@ export default function Messages() {
const res = await listConsultations({ page: 1, page_size: 20 });
setSessions(res.data || []);
} else {
// 通知目前从咨询中提取状态变化作为示例
// 后续可对接独立通知 API
setNotifications([]);
const res = await notificationService.list<{ data: unknown[] }>({ page: 1, page_size: 20 });
setNotifications((res as { data?: unknown[] })?.data || []);
}
} catch {
if (tab === 'consultation') setSessions([]);

View File

@@ -18,6 +18,8 @@ const MENU_ITEMS = [
{ label: '透析处方', icon: '💊', bg: '#E8F0E8' },
{ label: '知情同意', icon: '📋', bg: '#F3E8F8' },
{ label: '积分明细', icon: '📊', bg: '#F0DDD4' },
{ label: '我的预约', icon: '📅', bg: '#E8F0F8' },
{ label: '在线咨询', icon: '💬', bg: '#E8F0E8' },
{ label: '设置', icon: '⚙️', bg: '#f0f0f0' },
];
@@ -34,6 +36,8 @@ const MENU_PATHS: Record<string, string> = {
'透析记录': '/pages/pkg-profile/dialysis-records/index',
'透析处方': '/pages/pkg-profile/dialysis-prescriptions/index',
'知情同意': '/pages/pkg-profile/consents/index',
'我的预约': '/pages/pkg-appointment/index',
'在线咨询': '/pages/consultation/index',
'设置': '/pages/pkg-profile/settings/index',
};

View File

@@ -0,0 +1,12 @@
import { api } from './request';
export const notificationService = {
list: (params?: { page?: number; page_size?: number }) =>
api.get('/messages', params as Record<string, string | number | undefined>),
markRead: (id: string) =>
api.put(`/messages/${id}/read`),
markAllRead: () =>
api.put('/messages/read-all'),
getUnreadCount: () =>
api.get('/messages/unread-count'),
};