160 lines
4.6 KiB
TypeScript
160 lines
4.6 KiB
TypeScript
/**
|
||
* Mock 评价数据
|
||
*/
|
||
|
||
import type { Evaluation } from '@/types'
|
||
|
||
// 模拟评价列表
|
||
export const mockEvaluations: Evaluation[] = [
|
||
{
|
||
id: 1,
|
||
tenantId: 1001,
|
||
orderId: 5,
|
||
orderNo: 'ORDER202512270001',
|
||
customerId: 10001,
|
||
customerName: '游戏玩家001',
|
||
customerAvatar: 'https://img1.baidu.com/it/u=1966616150,2146512490&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500',
|
||
playerId: 2,
|
||
playerName: '代练小李',
|
||
playerAvatar: 'https://img1.baidu.com/it/u=1966616150,2146512490&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500',
|
||
serviceId: 5,
|
||
serviceName: '原神深渊满星代打',
|
||
rating: 5,
|
||
content: '非常专业,很快就完成了,技术很好,下次还会找这位代练!',
|
||
images: [],
|
||
isAnonymous: false,
|
||
status: '0',
|
||
reply: '感谢您的好评,期待下次合作!',
|
||
replyTime: '2025-12-27 17:30:00',
|
||
createTime: '2025-12-27 17:00:00'
|
||
},
|
||
{
|
||
id: 2,
|
||
tenantId: 1001,
|
||
orderId: 3,
|
||
orderNo: 'ORDER202512280001',
|
||
customerId: 10001,
|
||
customerName: '匿名用户',
|
||
customerAvatar: 'https://img1.baidu.com/it/u=1966616150,2146512490&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500',
|
||
playerId: 3,
|
||
playerName: '代练小张',
|
||
playerAvatar: 'https://img0.baidu.com/it/u=3041958341,2863014610&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500',
|
||
serviceId: 3,
|
||
serviceName: 'LOL段位提升 - 黄金到铂金',
|
||
rating: 4,
|
||
content: '代练技术不错,但时间稍微长了一点,总体满意',
|
||
images: [],
|
||
isAnonymous: true,
|
||
status: '0',
|
||
createTime: '2025-12-28 19:30:00'
|
||
}
|
||
]
|
||
|
||
// 获取评价列表
|
||
export function getEvaluationList(params?: {
|
||
serviceId?: number
|
||
playerId?: number
|
||
}): Evaluation[] {
|
||
let list = [...mockEvaluations]
|
||
|
||
if (params?.serviceId) {
|
||
list = list.filter(e => e.serviceId === params.serviceId)
|
||
}
|
||
|
||
if (params?.playerId) {
|
||
list = list.filter(e => e.playerId === params.playerId)
|
||
}
|
||
|
||
// 按创建时间倒序
|
||
list.sort((a, b) => new Date(b.createTime).getTime() - new Date(a.createTime).getTime())
|
||
|
||
return list
|
||
}
|
||
|
||
/**
|
||
* Mock 消息数据
|
||
*/
|
||
|
||
import type { Message, SystemMessage } from '@/types'
|
||
|
||
// 模拟聊天消息
|
||
export const mockMessages: Message[] = [
|
||
{
|
||
id: 1,
|
||
tenantId: 1001,
|
||
fromUserId: 10001,
|
||
fromUserName: '游戏玩家001',
|
||
fromUserAvatar: 'https://img1.baidu.com/it/u=1966616150,2146512490&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500',
|
||
toUserId: 10003,
|
||
toUserName: '代练小王',
|
||
toUserAvatar: 'https://img2.baidu.com/it/u=2778471297,524912025&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500',
|
||
msgType: 'text',
|
||
content: '你好,请问什么时候可以开始代练?',
|
||
isRead: true,
|
||
createTime: '2025-12-29 16:05:00'
|
||
},
|
||
{
|
||
id: 2,
|
||
tenantId: 1001,
|
||
fromUserId: 10003,
|
||
fromUserName: '代练小王',
|
||
fromUserAvatar: 'https://img2.baidu.com/it/u=2778471297,524912025&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500',
|
||
toUserId: 10001,
|
||
toUserName: '游戏玩家001',
|
||
toUserAvatar: 'https://img1.baidu.com/it/u=1966616150,2146512490&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500',
|
||
msgType: 'text',
|
||
content: '您好,我现在就可以开始,请提供账号密码',
|
||
isRead: true,
|
||
createTime: '2025-12-29 16:06:00'
|
||
}
|
||
]
|
||
|
||
// 模拟系统消息
|
||
export const mockSystemMessages: SystemMessage[] = [
|
||
{
|
||
id: 1,
|
||
userId: 10001,
|
||
title: '订单已派单',
|
||
content: '您的订单【王者荣耀段位提升】已派单给代练小王,请等待代练接单',
|
||
type: 'order',
|
||
relatedId: 1,
|
||
isRead: true,
|
||
createTime: '2025-12-29 15:30:00'
|
||
},
|
||
{
|
||
id: 2,
|
||
userId: 10001,
|
||
title: '代练已接单',
|
||
content: '代练小王已接受您的订单,即将开始服务',
|
||
type: 'order',
|
||
relatedId: 1,
|
||
isRead: true,
|
||
createTime: '2025-12-29 15:35:00'
|
||
},
|
||
{
|
||
id: 3,
|
||
userId: 10001,
|
||
title: '系统通知',
|
||
content: '平台将于12月31日进行系统维护,请提前做好准备',
|
||
type: 'notice',
|
||
isRead: false,
|
||
createTime: '2025-12-30 10:00:00'
|
||
}
|
||
]
|
||
|
||
// 获取聊天消息
|
||
export function getChatMessages(userId1: number, userId2: number): Message[] {
|
||
return mockMessages.filter(
|
||
m =>
|
||
(m.fromUserId === userId1 && m.toUserId === userId2) ||
|
||
(m.fromUserId === userId2 && m.toUserId === userId1)
|
||
).sort((a, b) => new Date(a.createTime).getTime() - new Date(b.createTime).getTime())
|
||
}
|
||
|
||
// 获取系统消息
|
||
export function getSystemMessages(userId: number): SystemMessage[] {
|
||
return mockSystemMessages
|
||
.filter(m => !m.userId || m.userId === userId)
|
||
.sort((a, b) => new Date(b.createTime).getTime() - new Date(a.createTime).getTime())
|
||
}
|