纸板小程序:订单/送货单:列表与详情功能

This commit is contained in:
2026-06-11 11:26:40 +08:00
commit ef9ede1605
2317 changed files with 61642 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
// types/api.d.ts
// import { ApiResponse } from './request';
/**
* 登录接口 - 请求参数类型
*/
export interface LoginRequest {
code: string; // 小程序登录码(wx.login获取)
phone?: string; // 可选:手机号(若需要手机号登录)
}
/**
* 登录接口 - 返回数据类型
*/
export interface LoginResponse {
token: string;
userId: string;
userName: string;
expires: number;
}
/**
* 获取用户信息接口 - 返回数据类型
*/
export interface UserInfoResponse {
id: string;
name: string;
avatar: string;
phone: string;
}
+28
View File
@@ -0,0 +1,28 @@
// types/request.d.ts
/**
* 后端统一响应格式
* T: data 字段的类型(泛型,适配不同接口的返回数据)
*/
export interface ApiResponse<T = any> {
code: number; // 业务状态码(200=成功,其他=失败)
data: T; // 接口返回的核心数据
msg: string; // 提示信息(失败时展示)
}
/**
* 请求配置类型(扩展 wx.request 的配置)
*/
export interface RequestOptions {
url: string; // 接口路径(相对路径/完整URL)
method: 'GET' | 'POST' | 'PUT' | 'DELETE'; // 请求方法
data?: Record<string, any>; // 请求参数(GET拼URL,POST放请求体)
header?: Record<string, string>; // 请求头(如Token、Content-Type)
timeout?: number; // 超时时间(默认10000ms)
showLoading?: boolean; // 是否显示加载中弹窗(默认true)
loadingText?: string; // 加载中提示文字(默认"加载中...")
}
/**
* 通用请求函数返回类型
*/
export type RequestPromise<T = any> = Promise<ApiResponse<T>>;