105 lines
1.9 KiB
TypeScript
105 lines
1.9 KiB
TypeScript
// app.ts 的类型定义
|
|
import { ApiManager } from '../utils/api'
|
|
|
|
// 用户信息接口
|
|
export interface IUserInfo {
|
|
id: string
|
|
nickname?: string
|
|
avatar_url?: string
|
|
gender?: number
|
|
country?: string
|
|
province?: string
|
|
city?: string
|
|
language?: string
|
|
}
|
|
|
|
// 登录响应接口
|
|
export interface ILoginResponse {
|
|
access_token: string
|
|
access_token_expire_time: string
|
|
session_uuid: string
|
|
dict_level?: string
|
|
}
|
|
|
|
// API响应接口
|
|
export interface IApiResponse<T> {
|
|
code: number
|
|
message?: string
|
|
msg?: string
|
|
data: T
|
|
}
|
|
|
|
// 识别结果接口
|
|
export interface IRecognitionResult {
|
|
text: string
|
|
words: Array<{
|
|
word: string
|
|
start: number
|
|
end: number
|
|
}>
|
|
}
|
|
|
|
// 单词详情接口
|
|
export interface ExtendedWordDetail {
|
|
word: string
|
|
phonetic: string
|
|
definition: string
|
|
translation: string
|
|
pos: string
|
|
collins: number
|
|
oxford: number
|
|
tag: string
|
|
bnc: number
|
|
frq: number
|
|
exchange: Record<string, string[]>
|
|
detail: string
|
|
audio: string
|
|
}
|
|
|
|
// 审核历史记录接口
|
|
export interface IAuditHistoryResponse {
|
|
total: number
|
|
items: Array<{
|
|
id: string
|
|
image_url: string
|
|
text: string
|
|
created_at: string
|
|
}>
|
|
}
|
|
|
|
// 每日总结接口
|
|
export interface IDailySummaryResponse {
|
|
total: number
|
|
items: Array<{
|
|
date: string
|
|
count: number
|
|
images: Array<{
|
|
id: string
|
|
url: string
|
|
}>
|
|
}>
|
|
}
|
|
|
|
// 全局数据接口
|
|
export interface IGlobalData {
|
|
isLoggedIn: boolean
|
|
userInfo?: IUserInfo
|
|
token?: string
|
|
dictLevel?: string
|
|
apiManager: ApiManager
|
|
}
|
|
|
|
// 小程序选项接口
|
|
export interface IAppOption {
|
|
globalData: IGlobalData
|
|
userInfoReadyCallback?: WechatMiniprogram.GetUserInfoSuccessCallback
|
|
initLoginStatus: () => void
|
|
updateLoginStatus: (loginData: {
|
|
access_token: string
|
|
access_token_expire_time: string
|
|
session_uuid: string
|
|
userInfo?: IUserInfo
|
|
dict_level?: string
|
|
}) => void
|
|
clearLoginData: () => void
|
|
} |