feat 搭建架构骨架

This commit is contained in:
Ironsp
2026-09-24 09:09:47 +08:00
parent dd9f6b77a4
commit 7a2efa3fea
180 changed files with 18967 additions and 9 deletions

25
src/api/demand.ts Normal file
View File

@@ -0,0 +1,25 @@
import type { Demand } from '@/types/business/demand'
import { storage } from '@/utils/storage'
// TODO(api): 待接口文档到位后,将以下 mock 替换为 request<T> 调用(页面 → store → api 数据流不变)
const DRAFT_KEY = 'demand-draft'
/** 提交需求(mock:返回提报单 id) */
export function submitDemand(demand: Demand): Promise<{ id: string }> {
if (!demand.businessType || !demand.projectName || !demand.coreDescription) {
return Promise.reject(new Error('需求信息不完整,无法提交'))
}
return Promise.resolve({ id: `demand-${Date.now()}` })
}
/** 读取本地草稿(无草稿返回 null) */
export function getDraftDemand(): Promise<Demand | null> {
return Promise.resolve(storage.sessionGet<Demand>(DRAFT_KEY))
}
/** 保存草稿到本地 */
export function saveDraft(demand: Demand): Promise<void> {
storage.sessionSet(DRAFT_KEY, { ...demand, status: 'draft' })
return Promise.resolve()
}