refactor: 重构存储与接口适配,统一金额单位与会话管理
- 新增配置、存储、金额转换工具服务 - 按userId隔离本地缓存,替换旧设备级存储 - 统一移动端金额单位为万元,新增转换适配逻辑 - 重构认证与请求逻辑,支持真实后端会话 - 调整搜索、帮助、融资模块的模拟开关与数据适配 - 更新文档说明开发状态与配置规则
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { yuanToWan } from '@/services/money.uts'
|
||||
|
||||
export type FinanceProduct = {
|
||||
id: string, bank: string, initials: string, color: string,
|
||||
amount: number, rate: number, term: string, score: number,
|
||||
@@ -12,10 +14,12 @@ export const demoProducts: FinanceProduct[] = [
|
||||
]
|
||||
|
||||
export function parseProduct(item: UTSJSONObject): FinanceProduct {
|
||||
// 接口额度使用元的十进制字符串,视图模型始终使用万元。
|
||||
const amountYuan = item['amountYuan'] as string | null
|
||||
return {
|
||||
id: item['id'] as string ?? '', bank: item['bank'] as string ?? '融资产品',
|
||||
initials: item['initials'] as string ?? '融', color: item['color'] as string ?? '#2869b7',
|
||||
amount: item['amount'] as number ?? 0, rate: item['rate'] as number ?? 0,
|
||||
amount: amountYuan != null ? parseFloat(yuanToWan(amountYuan)) : (item['amount'] as number ?? 0), rate: item['rate'] as number ?? 0,
|
||||
term: item['term'] as string ?? '以审批为准', score: item['score'] as number ?? 0,
|
||||
advantages: item['advantages'] as string[] ?? [], age: item['age'] as string ?? '以机构要求为准',
|
||||
work: item['work'] as string ?? '以机构要求为准', credit: item['credit'] as string ?? '以机构要求为准',
|
||||
|
||||
Reference in New Issue
Block a user