feat(add): 新增多页面新增和编辑表单功能
- 添加编辑和新增收货地址页面,支持表单数据加载和提交 - 新增应用密钥凭证、新增应用操作动态、新增应用成员、新增应用版本页面配置 - 实现文章新增及编辑页面,包含图片上传及多种文章属性配置 - 增加注册会员页面,支持头像上传、手机号获取和邀请人关系处理 - 引入统一表单提交成功和失败处理,支持编辑模式数据回显 - 配置统一eslint和editorconfig规则,增强代码规范和编辑体验 - 新增.gitignore规则,屏蔽无关文件和目录,优化版本管理
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { Notification, NotificationParam, UnreadCountResult } from './model';
|
||||
|
||||
const BASE = '/app/notification';
|
||||
|
||||
/** 分页查询通知列表 */
|
||||
export async function pageNotification(params: NotificationParam) {
|
||||
const res = await request.get<ApiResult<PageResult<Notification>>>(BASE + '/page', { params });
|
||||
if (res.code === 0) return res.data;
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/** 查询最近通知 */
|
||||
export async function listRecentNotification(params?: { type?: string; limit?: number }) {
|
||||
const res = await request.get<ApiResult<Notification[]>>(BASE + '/recent', { params });
|
||||
if (res.code === 0 && res.data) return res.data;
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/** 获取未读数量统计 */
|
||||
export async function getUnreadCount() {
|
||||
const res = await request.get<ApiResult<UnreadCountResult>>(BASE + '/unread-count');
|
||||
if (res.code === 0 && res.data) return res.data;
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/** 标记单条通知为已读 */
|
||||
export async function markNotificationRead(id: number) {
|
||||
const res = await request.put<ApiResult<unknown>>(BASE + `/read/${id}`);
|
||||
if (res.code === 0) return res.message;
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/** 标记全部已读 */
|
||||
export async function markAllNotificationRead(data?: { type?: string }) {
|
||||
const res = await request.put<ApiResult<unknown>>(BASE + '/read-all', data);
|
||||
if (res.code === 0) return res.message;
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/** 删除单条通知 */
|
||||
export async function removeNotification(id: number) {
|
||||
const res = await request.del<ApiResult<unknown>>(BASE + '/' + id);
|
||||
if (res.code === 0) return res.message;
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
Reference in New Issue
Block a user