250 lines
6.8 KiB
Plaintext
250 lines
6.8 KiB
Plaintext
/**
|
||
* Mock数据 - 开发阶段使用
|
||
* 后端开发完成后可关闭
|
||
*/
|
||
|
||
// 轮播图数据
|
||
const bannerList = [
|
||
{
|
||
id: '1',
|
||
image: '/static/mock/banner1.svg',
|
||
title: '专业沙发翻新服务',
|
||
link: '/pages/service/index'
|
||
},
|
||
{
|
||
id: '2',
|
||
image: '/static/mock/banner2.svg',
|
||
title: '十年品质保证',
|
||
link: '/pages/about/index'
|
||
},
|
||
{
|
||
id: '3',
|
||
image: '/static/mock/banner3.svg',
|
||
title: '免费上门评估',
|
||
link: '/pages/booking/index'
|
||
}
|
||
]
|
||
|
||
// 案例数据
|
||
const caseList = [
|
||
{
|
||
id: '1',
|
||
title: '欧式真皮沙发翻新',
|
||
category: 'leather',
|
||
categoryName: '皮沙发',
|
||
beforeImages: ['/static/mock/case1-before.svg'],
|
||
afterImages: ['/static/mock/case1-after.svg'],
|
||
coverImage: '/static/mock/case1-after.svg',
|
||
description: '这款欧式真皮沙发使用多年后出现皮面老化、褪色问题,经过我们专业的翻新处理,焕然一新。采用进口头层牛皮,色泽均匀,手感细腻。',
|
||
material: '进口头层牛皮',
|
||
duration: '7天',
|
||
price: '¥3800',
|
||
views: 1256,
|
||
likes: 89,
|
||
createTime: '2026-01-15'
|
||
},
|
||
{
|
||
id: '2',
|
||
title: '现代简约布艺沙发翻新',
|
||
category: 'fabric',
|
||
categoryName: '布艺沙发',
|
||
beforeImages: ['/static/mock/case2-before.svg'],
|
||
afterImages: ['/static/mock/case2-after.svg'],
|
||
coverImage: '/static/mock/case2-after.svg',
|
||
description: '布艺沙发使用时间长了容易脏污、起球,这款沙发经过整体换布处理,选用高品质科技布,防水防污,易于打理。',
|
||
material: '高品质科技布',
|
||
duration: '5天',
|
||
price: '¥2200',
|
||
views: 986,
|
||
likes: 67,
|
||
createTime: '2026-01-12'
|
||
},
|
||
{
|
||
id: '3',
|
||
title: '美式复古沙发改色翻新',
|
||
category: 'leather',
|
||
categoryName: '皮沙发',
|
||
beforeImages: ['/static/mock/case3-before.svg'],
|
||
afterImages: ['/static/mock/case3-after.svg'],
|
||
coverImage: '/static/mock/case3-after.svg',
|
||
description: '客户希望将原本深棕色的沙发改为更现代的米白色,我们采用专业改色工艺,色泽持久不脱落,触感保持柔软。',
|
||
material: '专业皮革改色',
|
||
duration: '6天',
|
||
price: '¥2800',
|
||
views: 756,
|
||
likes: 45,
|
||
createTime: '2026-01-10'
|
||
},
|
||
{
|
||
id: '4',
|
||
title: '功能沙发维修翻新',
|
||
category: 'functional',
|
||
categoryName: '功能沙发',
|
||
beforeImages: ['/static/mock/case4-before.svg'],
|
||
afterImages: ['/static/mock/case4-after.svg'],
|
||
coverImage: '/static/mock/case4-after.svg',
|
||
description: '功能沙发的电动机构出现故障,同时皮面也有磨损。我们更换了电机和控制系统,并对皮面进行了局部修复。',
|
||
material: '原装配件+局部修复',
|
||
duration: '4天',
|
||
price: '¥1800',
|
||
views: 623,
|
||
likes: 38,
|
||
createTime: '2026-01-08'
|
||
},
|
||
{
|
||
id: '5',
|
||
title: '中式红木沙发垫翻新',
|
||
category: 'antique',
|
||
categoryName: '古典沙发',
|
||
beforeImages: ['/static/mock/case5-before.svg'],
|
||
afterImages: ['/static/mock/case5-after.svg'],
|
||
coverImage: '/static/mock/case5-after.svg',
|
||
description: '红木沙发的坐垫和靠垫使用多年已经塌陷变形,我们重新填充高密度海绵,并更换了丝绸面料,古典韵味十足。',
|
||
material: '高密度海绵+丝绸面料',
|
||
duration: '5天',
|
||
price: '¥2500',
|
||
views: 512,
|
||
likes: 32,
|
||
createTime: '2026-01-05'
|
||
},
|
||
{
|
||
id: '6',
|
||
title: '办公室皮沙发组合翻新',
|
||
category: 'office',
|
||
categoryName: '办公沙发',
|
||
beforeImages: ['/static/mock/case6-before.svg'],
|
||
afterImages: ['/static/mock/case6-after.svg'],
|
||
coverImage: '/static/mock/case6-after.svg',
|
||
description: '企业办公室的沙发组合整体翻新,包括一套3+1+1沙发。采用耐磨商务皮革,简约大气,提升企业形象。',
|
||
material: '商务耐磨皮革',
|
||
duration: '10天',
|
||
price: '¥8800',
|
||
views: 445,
|
||
likes: 28,
|
||
createTime: '2026-01-02'
|
||
}
|
||
]
|
||
|
||
// 服务流程数据
|
||
const serviceProcess = [
|
||
{
|
||
step: 1,
|
||
title: '在线预约',
|
||
description: '通过小程序或电话预约上门服务',
|
||
icon: '/static/icons/step1.png'
|
||
},
|
||
{
|
||
step: 2,
|
||
title: '上门评估',
|
||
description: '专业师傅免费上门查看沙发状况',
|
||
icon: '/static/icons/step2.png'
|
||
},
|
||
{
|
||
step: 3,
|
||
title: '方案报价',
|
||
description: '根据沙发情况提供翻新方案和报价',
|
||
icon: '/static/icons/step3.png'
|
||
},
|
||
{
|
||
step: 4,
|
||
title: '确认订单',
|
||
description: '确认方案后签订服务合同',
|
||
icon: '/static/icons/step4.png'
|
||
},
|
||
{
|
||
step: 5,
|
||
title: '专业翻新',
|
||
description: '工厂或上门进行专业翻新作业',
|
||
icon: '/static/icons/step5.png'
|
||
},
|
||
{
|
||
step: 6,
|
||
title: '验收交付',
|
||
description: '翻新完成后客户验收,满意付款',
|
||
icon: '/static/icons/step6.png'
|
||
}
|
||
]
|
||
|
||
// 公司信息
|
||
const companyInfo = {
|
||
name: '优艺家沙发翻新',
|
||
slogan: '让旧沙发焕发新生',
|
||
description: '优艺家是一家专业从事沙发翻新、维修、改色的服务公司,拥有十余年行业经验。我们秉承"品质至上、客户第一"的服务理念,为千家万户提供专业的沙发翻新服务。',
|
||
phone: '400-888-8888',
|
||
wechat: 'youyijia2026',
|
||
address: '上海市浦东新区张江高科技园区',
|
||
workTime: '周一至周日 9:00-18:00',
|
||
features: [
|
||
{ title: '专业团队', desc: '10年+从业经验' },
|
||
{ title: '品质保证', desc: '质保期内免费维护' },
|
||
{ title: '上门服务', desc: '免费上门评估' },
|
||
{ title: '价格透明', desc: '无隐形消费' }
|
||
]
|
||
}
|
||
|
||
/**
|
||
* 获取Mock数据
|
||
*/
|
||
export const getMockData = (url : string, method : string, params ?: UTSJSONObject | null) : any | null => {
|
||
// 轮播图
|
||
if (url == '/banners') {
|
||
return bannerList
|
||
}
|
||
|
||
// 案例列表
|
||
if (url == '/cases' && method == 'GET') {
|
||
const category = params?.['category'] as string | null
|
||
const page = (params?.['page'] ?? 1) as number
|
||
const pageSize = (params?.['pageSize'] ?? 10) as number
|
||
|
||
let filteredList = caseList
|
||
if (category != null && category != '' && category != 'all') {
|
||
filteredList = caseList.filter((item) : boolean => item.category == category)
|
||
}
|
||
|
||
const start = (page - 1) * pageSize
|
||
const end = start + pageSize
|
||
const list = filteredList.slice(start, end)
|
||
|
||
return {
|
||
list: list,
|
||
total: filteredList.length,
|
||
page: page,
|
||
pageSize: pageSize
|
||
}
|
||
}
|
||
|
||
// 案例详情
|
||
if (url.startsWith('/cases/') && method == 'GET') {
|
||
const id = url.replace('/cases/', '')
|
||
const caseItem = caseList.find((item) : boolean => item.id == id)
|
||
return caseItem
|
||
}
|
||
|
||
// 热门案例
|
||
if (url == '/cases/hot') {
|
||
return caseList.slice(0, 4)
|
||
}
|
||
|
||
// 服务流程
|
||
if (url == '/service/process') {
|
||
return serviceProcess
|
||
}
|
||
|
||
// 公司信息
|
||
if (url == '/company/info') {
|
||
return companyInfo
|
||
}
|
||
|
||
// 提交预约
|
||
if (url == '/booking' && method == 'POST') {
|
||
return {
|
||
bookingId: 'BK' + Date.now().toString(),
|
||
status: 'pending',
|
||
message: '预约成功,我们会尽快与您联系'
|
||
}
|
||
}
|
||
|
||
return null
|
||
}
|