wengyeyulu/src/frontend/data/mock.ts
2025-12-15 12:45:54 +08:00

127 lines
3.2 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

export interface User {
id: string;
name: string;
avatar: string;
}
export interface Message {
id: string;
content: string;
senderId: string;
timestamp: number;
type: 'text' | 'image';
senderName?: string;
senderAvatar?: string;
}
export interface Conversation {
id: string;
user: User;
messages: Message[];
unreadCount: number;
}
export const currentUser: User = {
id: 'me',
name: '我',
avatar: 'https://api.dicebear.com/7.x/avataaars/svg?seed=Felix',
};
const user1: User = {
id: 'u1',
name: '老王',
avatar: 'https://api.dicebear.com/7.x/avataaars/svg?seed=Jack',
};
const user2: User = {
id: 'u2',
name: '李安',
avatar: 'https://api.dicebear.com/7.x/avataaars/svg?seed=Aneka',
};
const user3: User = {
id: 'u3',
name: '产品经理',
avatar: 'https://api.dicebear.com/7.x/avataaars/svg?seed=Trouble',
};
export const conversations: Conversation[] = [
{
id: 'c1',
user: user1,
unreadCount: 2,
messages: [
{
id: 'm1',
content: '周末有空去钓鱼吗?',
senderId: 'u1',
timestamp: Date.now() - 1000 * 60 * 60 * 2,
type: 'text',
},
{
id: 'm2',
content: '上次那个水库不错。',
senderId: 'u1',
timestamp: Date.now() - 1000 * 60 * 60 * 2 + 5000,
type: 'text',
},
{
id: 'm3',
content: '可以啊,几点出发?',
senderId: 'me',
timestamp: Date.now() - 1000 * 60 * 30,
type: 'text',
},
{
id: 'm4',
content: '早上6点吧老地方见。',
senderId: 'u1',
timestamp: Date.now() - 1000 * 60 * 5,
type: 'text',
},
],
},
{
id: 'c2',
user: user2,
unreadCount: 0,
messages: [
{
id: 'm21',
content: '方案我已经发你邮箱了,记得看一下。',
senderId: 'u2',
timestamp: Date.now() - 1000 * 60 * 60 * 24,
type: 'text',
},
{
id: 'm22',
content: '好的,我晚上回去看。',
senderId: 'me',
timestamp: Date.now() - 1000 * 60 * 60 * 23,
type: 'text',
},
],
},
{
id: 'c3',
user: user3,
unreadCount: 5,
messages: [
{
id: 'm31',
content: '这个需求还要再改一下。',
senderId: 'u3',
timestamp: Date.now() - 1000 * 60 * 10,
type: 'text',
},
{
id: 'm32',
content: '老板说要五彩斑斓的黑。',
senderId: 'u3',
timestamp: Date.now() - 1000 * 60 * 9,
type: 'text',
},
],
},
];