refactor: 重构项目分包结构与资源管理

1.  调整页面路由,将业务页面迁移到对应分包,主包仅保留首页
2.  拆分公共服务模块,将账户、融资相关逻辑移入对应分包
3.  统一资源路径,将专属静态资源放入各分包static目录,更新导航栏图标资源
4.  修复启动引导逻辑,实现仅首次冷启动显示引导页
5.  更新README文档,补充分包配置与开发规范说明
This commit is contained in:
hujun
2026-09-20 10:52:10 +08:00
parent 94a4558290
commit 69130d11e7
43 changed files with 278 additions and 180 deletions
+35
View File
@@ -0,0 +1,35 @@
import { API_BASE_URL, wait, requestJson } from '@/services/api.uts'
export { API_BASE_URL, saveSession } from '@/services/api.uts'
export async function requestSmsCode(phone: string): Promise<boolean> {
if (API_BASE_URL.length == 0) {
await wait(350)
return phone.length == 11
}
await requestJson('/auth/sms-code', 'POST', { phone })
return true
}
export async function loginWithSms(phone: string, code: string): Promise<string> {
if (API_BASE_URL.length == 0) {
await wait(300)
if (code.length != 6) throw new Error('验证码应为 6 位数字')
return 'demo-sms-token'
}
const result = await requestJson('/auth/sms-login', 'POST', { phone, code })
const token = result['token'] as string | null
if (token == null || token.length == 0) throw new Error('登录响应缺少 token')
return token
}
export async function loginWithPassword(phone: string, password: string): Promise<string> {
if (API_BASE_URL.length == 0) {
await wait(300)
return 'demo-password-token'
}
const result = await requestJson('/auth/password-login', 'POST', { phone, password })
const token = result['token'] as string | null
if (token == null || token.length == 0) throw new Error('登录响应缺少 token')
return token
}