feat: 移动端双Token队列拦截器 + 通知列表 + 登录页 + TabBar红点 + v1.0.1
This commit is contained in:
24
track-uniapp/src/api/notification.js
Normal file
24
track-uniapp/src/api/notification.js
Normal file
@ -0,0 +1,24 @@
|
||||
/**
|
||||
* 消息通知 API — 获取列表、标记已读
|
||||
*/
|
||||
import { get, put } from "../utils/request";
|
||||
|
||||
/**
|
||||
* 获取当前用户的通知列表
|
||||
* @param {string} userId - 当前用户ID
|
||||
* @param {number} skip - 分页偏移
|
||||
* @param {number} limit - 每页条数
|
||||
* @returns {Promise<{notifications: Array, total: number, unread_count: number}>}
|
||||
*/
|
||||
export function getNotifications(userId, skip = 0, limit = 20) {
|
||||
return get("/notifications/", { user_id: userId, skip, limit });
|
||||
}
|
||||
|
||||
/**
|
||||
* 标记单条通知为已读
|
||||
* @param {string} notificationId - 通知ID
|
||||
* @returns {Promise<Object>}
|
||||
*/
|
||||
export function markNotificationRead(notificationId) {
|
||||
return put(`/notifications/${notificationId}/read`);
|
||||
}
|
||||
Reference in New Issue
Block a user