gameSeriveUniapp/mock/user.ts
2026-01-12 16:48:28 +08:00

125 lines
3.1 KiB
TypeScript

/**
* Mock 用户数据
*/
import type { User, UserProfile } from '@/types'
// 模拟用户列表
export const mockUsers: User[] = [
{
id: 10001,
openid: 'oXxxx_mock_user_001',
phone: '13800138001',
nickname: '游戏玩家001',
avatar: 'https://img1.baidu.com/it/u=1966616150,2146512490&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500',
userType: 'customer',
customerId: 1,
status: '0',
registerTime: '2025-01-01 10:00:00',
lastLoginTime: '2025-12-30 09:00:00'
},
{
id: 10002,
openid: 'oXxxx_mock_merchant_001',
phone: '13900139001',
nickname: '星辰工作室',
avatar: 'https://img0.baidu.com/it/u=3041958341,2863014610&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500',
userType: 'merchant',
merchantId: 1,
tenantId: 1001,
status: '0',
registerTime: '2024-12-01 10:00:00',
lastLoginTime: '2025-12-30 08:30:00'
},
{
id: 10003,
openid: 'oXxxx_mock_player_001',
phone: '13700137001',
nickname: '代练小王',
avatar: 'https://img2.baidu.com/it/u=2778471297,524912025&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500',
userType: 'player',
playerId: 1,
tenantId: 1001,
status: '0',
registerTime: '2025-01-15 14:00:00',
lastLoginTime: '2025-12-30 09:30:00'
}
]
// 模拟用户扩展信息
export const mockUserProfiles: UserProfile[] = [
{
id: 1,
userId: 10001,
realName: '张三',
gender: '1',
birthday: '1995-06-15',
province: '广东省',
city: '深圳市',
signature: '热爱游戏,享受生活',
backgroundImage: 'https://img1.baidu.com/it/u=2778471297,524912025&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=400',
gameTags: ['王者荣耀', '和平精英', 'LOL'],
privacySettings: {
showPhone: false,
showRealName: false,
allowMessage: true
},
notificationSettings: {
orderUpdate: true,
systemNotice: true,
promotions: false
}
},
{
id: 2,
userId: 10002,
realName: '李四',
gender: '1',
province: '广东省',
city: '广州市',
signature: '专业代练团队,品质保证',
privacySettings: {
showPhone: true,
showRealName: true,
allowMessage: true
},
notificationSettings: {
orderUpdate: true,
systemNotice: true,
promotions: true
}
},
{
id: 3,
userId: 10003,
realName: '王五',
gender: '1',
birthday: '1998-03-20',
province: '广东省',
city: '深圳市',
signature: '专业代练,效率第一',
gameTags: ['王者荣耀', 'LOL'],
privacySettings: {
showPhone: false,
showRealName: false,
allowMessage: true
},
notificationSettings: {
orderUpdate: true,
systemNotice: true,
promotions: false
}
}
]
// 获取当前用户(模拟)
export function getCurrentUser(): User {
const userType = uni.getStorageSync('mock_user_type') || 'customer'
return mockUsers.find(u => u.userType === userType) || mockUsers[0]
}
// 获取用户扩展信息
export function getUserProfile(userId: number): UserProfile | undefined {
return mockUserProfiles.find(p => p.userId === userId)
}