UNPKG

press-plus

Version:
290 lines (275 loc) 7.03 kB
// Convert Record Cash Mock 数据 // // Tab ID 说明: // - Tab 1 (id: 1): 获得记录 - 展示完成任务获得的抽奖次数和积分 // - Tab 2 (id: 2): 获得奖励 - 展示所有获得的奖励(有 showViewButton 字段的记录会显示"查看奖励"按钮) // - Tab 3 (id: 3): 消耗记录 - 展示抽奖消耗次数、兑换扣除积分、过期清零积分 // // 查看奖励按钮显示逻辑: // - 如果记录的 showViewButton 字段为 true,则显示"查看奖励"按钮 // - 如果记录的 showViewButton 字段为 false 或不存在,则显示 record-text Slot 内容 // - 这样可以灵活控制每条记录是否显示按钮,不受 Tab 限制 // 类型定义 export interface TabItem { id: number; name: string; } export interface RecordItem { orderid: string; desc: string; time: string; opertype: number; // 1:获得次数 2:获得奖励 3:消耗抽奖次数 4:兑换扣除积分 5:过期清零 point?: string; // 积分数量或抽奖次数 showViewButton?: boolean; // 是否显示"查看奖励"按钮(仅获得奖励记录有此字段) rewardType?: string; // 奖励类型(用于业务逻辑,不影响按钮显示) consumeType?: '抽奖次数' | '积分'; // 消耗类型(仅消耗记录有此字段) } export interface MockData { show: boolean; zIndex: number; tabIndex: number; tabList: TabItem[]; styleName: string; moneyType: number; pointName: string; pointNum: string; pointAmount: string; expireTime: number; list: RecordItem[]; loading: boolean; finished: boolean; immediateCheck: boolean; } // 模拟Tab列表数据 export const TAB_LIST_MOCK_DATA: TabItem[] = [ { id: 1, name: '获得记录' }, { id: 2, name: '获得奖励' }, { id: 3, name: '消耗记录' }, ]; // 模拟获得记录数据(完成任务获得抽奖次数) export const GAIN_RECORD_LIST: RecordItem[] = [ { orderid: '001', desc: '完成学生认证', time: '2025-01-08 10:30:00', opertype: 1, // 1:获得次数 point: '2', // 抽奖次数 }, { orderid: '002', desc: '邀请好友成功', time: '2025-01-08 09:15:00', opertype: 1, point: '3', }, { orderid: '003', desc: '完成分享任务', time: '2025-01-07 18:45:00', opertype: 1, point: '1', }, { orderid: '004', desc: '完成每日签到', time: '2025-01-07 14:10:00', opertype: 1, point: '5', }, { orderid: '005', desc: '参与活动获得', time: '2025-01-06 12:15:00', opertype: 1, point: '2', }, { orderid: '006', desc: '观看广告获得', time: '2025-01-05 16:45:00', opertype: 1, point: '1', }, { orderid: '007', desc: '完成新手任务', time: '2025-01-05 10:00:00', opertype: 1, point: '10', }, ]; // 模拟获得奖励数据(兑换奖励、抽奖奖励、任务额外礼和进阶礼) export const REWARD_RECORD_LIST: RecordItem[] = [ { orderid: '201', desc: '亲密玫瑰*1', time: '2025-01-08 15:30:00', opertype: 2, // 2:获得奖励 showViewButton: true, // 显示"查看奖励"按钮 rewardType: '抽奖奖励', }, { orderid: '202', desc: '幸运币*50', time: '2025-01-08 14:20:00', opertype: 2, showViewButton: true, rewardType: '抽奖奖励', }, { orderid: '203', desc: '游戏道具礼包', time: '2025-01-07 11:20:00', opertype: 2, showViewButton: true, rewardType: '兑换奖励', }, { orderid: '204', desc: '限定皮肤*1', time: '2025-01-06 09:15:00', opertype: 2, showViewButton: true, rewardType: '任务额外礼', }, { orderid: '205', desc: '进阶大礼包', time: '2025-01-05 16:45:00', opertype: 2, showViewButton: true, rewardType: '进阶礼', }, { orderid: '206', desc: '幸运币*100', time: '2025-01-05 10:30:00', opertype: 2, showViewButton: true, rewardType: '抽奖奖励', }, { orderid: '207', desc: '10元话费券', time: '2025-01-04 14:20:00', opertype: 2, showViewButton: true, rewardType: '兑换奖励', }, ]; // 模拟消耗记录数据(抽奖消耗次数、兑换扣除积分、过期清零积分) export const CONSUME_RECORD_LIST: RecordItem[] = [ { orderid: '301', desc: '点击抽奖', time: '2025-01-08 15:35:00', opertype: 3, // 3:消耗抽奖次数 point: '1', consumeType: '抽奖次数', }, { orderid: '302', desc: '点击抽奖', time: '2025-01-08 14:25:00', opertype: 3, point: '1', consumeType: '抽奖次数', }, { orderid: '303', desc: '兑换游戏道具礼包', time: '2025-01-07 16:20:00', opertype: 4, // 4:兑换扣除积分 point: '300', consumeType: '积分', }, { orderid: '304', desc: '点击抽奖', time: '2025-01-06 20:30:00', opertype: 3, point: '1', consumeType: '抽奖次数', }, { orderid: '305', desc: '兑换10元话费券', time: '2025-01-05 14:15:00', opertype: 4, point: '500', consumeType: '积分', }, { orderid: '306', desc: '积分到期清零', time: '2025-01-04 00:00:00', opertype: 5, // 5:过期清零 point: '100', consumeType: '积分', }, { orderid: '307', desc: '点击抽奖', time: '2025-01-03 18:30:00', opertype: 3, point: '2', consumeType: '抽奖次数', }, { orderid: '308', desc: '积分到期清零', time: '2025-01-02 00:00:00', opertype: 5, point: '50', consumeType: '积分', }, ]; // 保留旧的导出以向后兼容 export const RECORD_LIST_MOCK_DATA: RecordItem[] = GAIN_RECORD_LIST; export const EXCHANGE_RECORD_LIST: RecordItem[] = REWARD_RECORD_LIST; // 向后兼容 // 获取基础Mock数据的函数 export function getMockData(tabId = 1): MockData { let list: RecordItem[] = GAIN_RECORD_LIST; // 根据Tab类型返回不同的数据列表 if (tabId === 2) { // 获得奖励 list = REWARD_RECORD_LIST; } else if (tabId === 3) { // 消耗记录 list = CONSUME_RECORD_LIST; } return { show: false, zIndex: 1000, tabIndex: tabId, tabList: TAB_LIST_MOCK_DATA, styleName: 'tip-vert', moneyType: 0, pointName: '幸运币', pointNum: '1270', // 我的总积分,固定值 pointAmount: '1280', // 我的总积分,固定值 expireTime: Date.now() + 7 * 24 * 60 * 60 * 1000, // 7天后失效 list, loading: false, finished: false, immediateCheck: false, }; } // 获取横版Mock数据的函数 export function getHorizontalMockData(tabId = 1): MockData { const mockData = getMockData(tabId); return { ...mockData, styleName: 'tip-hori', }; } // 获取空数据Mock数据的函数 export function getEmptyMockData(): MockData { const mockData = getMockData(); return { ...mockData, list: [], pointNum: '0', pointAmount: '0', }; }