Files
ece.suwa3d.com/src/config/cartoon.ts
T
Linzm 6c55986337
continuous-integration/drone/push Build was killed
continuous-integration/drone/promote/prod Build is passing
修改:优化cartoon的裁剪比例
2026-11-03 16:05:50 +08:00

462 lines
11 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 const cartoonConfig = {
// 路由配置
routes: {
record: '/cartoon/photoAlbum',
myOrder: '/cartoon/myOrder',
preview: '/cartoon/previewOrder',
orderDetail: '/cartoon/orderDetail',
home: '/cartoon'
},
// 产品类型配置
productTypes: {
1: { name: '立体徽章', key: 'badge_3d' },
2: { name: '浮雕相框', key: 'relief_frame' },
3: { name: '3D冰箱贴', key: 'fridge_magnet' },
4: { name: '3D卡通手办', key: 'cartoon_figure' },
6: { name: '浮雕挂饰', key: 'relief_pendant' },
8: { name: '摇摇乐', key: 'shake_toy' }
},
// 主体类型配置
subjectTypes: {
person: {
id: 7,
name: '人物主体',
prodIds: [7, 1, 25], // 不同产品类型对应的人物产品ID
group: 'gp',
supportSubject: 1
},
pet: {
id: 8,
name: '宠物主体',
prodIds: [8, 2, 19, 24], // 不同产品类型对应的宠物产品ID
group: 'pet',
supportSubject: 2
}
},
// 产品ID映射配置(根据typeId和subjectId映射到实际产品ID)
productIdMapping: {
4: { // typeId == 4 (3D卡通手办)
person: 1,
pet: 19
},
6: { // typeId == 6 (浮雕挂饰)
person: 25,
pet: 24
},
3: { // typeId == 3 (3D冰箱贴)
person: 7,
pet: 8
},
default: { // 其他类型
person: 7,
pet: 8
}
},
// 产品限制配置
productLimits: {
// 根据产品ID配置是否支持多视角参考图
multiViewSupported: [19],
// 根据产品ID配置是否支持风格类型
kindListSupported: [4],
// 根据typeId配置是否显示照片示例
photoExampleTypes: ['3D真人肖像']
},
// 上传配置
upload: {
minWidth: 300,
minHeight: 300,
maxSize: 10 * 1024 * 1024, // 10MB
maxReferCount: 3,
/** 选图后强制 3:4;可缩放图片;允许框超出图片,超出区域白底填充 */
crop: {
ratio: [3, 4] as [number, number],
fillColor: '#ffffff',
outputType: 'jpeg' as const,
enlarge: 2,
}
},
// 图片资源路径配置(在组件中通过 import 导入)
assets: {
sheji: '@/assets/badge/sheji.png',
order: '@/assets/badge/order.png'
},
// 样式配置
styles: {
colors: {
primary: '#50cf54',
primaryGradient: 'linear-gradient(90deg, #D1ED8E 0%, #55E668 100%)',
textPrimary: '#222',
textSecondary: '#333',
textTertiary: '#888',
textDisabled: '#b0b0b0',
background: '#F0F2F5',
backgroundSecondary: '#F2F2F2',
border: '#E5E5E5',
success: '#15CF5F',
progressBar: '#6fdc8c'
},
spacing: {
pagePadding: '16px',
sectionMargin: '8px',
itemGap: '8px'
}
},
// Preview页面配置
preview: {
// 图片尺寸配置
imageSize: {
previewWidth: 320,
previewHeight: 320,
compareImageSize: 120
},
// 进度条配置
progress: {
maxProgress: 90,
interval: 300, // ms
thresholds: {
stage1: 25,
stage2: 50,
stage3: 75
},
stages: {
stage1: '照片数据分析中',
stage2: '提炼图像关键词',
stage3: '图像生成中',
stage4: '图像后处理与优化'
},
totalTime: 90 // 秒
},
// 形状ID配置
shapeIds: {
round: [1, 2], // 圆形形状
specialFrame: [15, 16], // 特殊相框
frame: [17, 18], // 相框
topBottomText: [27, 28] // 支持上下文字的形状
},
// 文字配置默认值
textConfig: {
front: {
x: 163,
y: 222,
width: 700,
height: 700,
radius: 350,
fontSize: 72,
maxLength: 18
},
back: {
x: 238,
y: 297,
width: 550,
height: 550,
radius: 275,
fontSize: 60,
maxLength: 56
},
defaultColor: '#000000',
defaultWeight: 'normal'
},
// 图片缩放比例
imageScale: 1,
// 默认值配置
defaults: {
group: 1,
imgKey: 101,
countryId: 45,
addrId: 0
},
// 轮询配置
polling: {
interval: 10000, // 10秒
compareImageDelay: 1000 // 1秒
},
// 特殊code配置(用于地址识别功能)
specialCodes: {
addressRecognition: 'ACAYOAAC3PFCPO3CD6DVM1'
},
// 产品名称映射(根据typeId和prodId)
productNames: {
1: { // typeId == 1 (立体徽章)
7: '人物立体徽章',
8: '宠物立体徽章'
},
2: { // typeId == 2 (浮雕相框)
7: '人物浮雕相框',
8: '宠物浮雕相框'
},
3: { // typeId == 3 (3D冰箱贴)
7: '人物3D冰箱贴',
8: '宠物3D冰箱贴'
},
4: { // typeId == 4 (3D卡通手办)
1: '人物卡通手办',
19: '宠物卡通手办'
},
6: { // typeId == 6 (浮雕挂饰)
25: '人物浮雕挂饰',
24: '宠物浮雕挂饰'
}
},
// 提示信息
messages: {
invalidInput: '输入的文字不能包含特殊符号!',
selectQuantity: '请先选择下单数量',
fillContactName: '请先填写收货人信息',
fillContactMobile: '请先填写收货人手机号',
selectArea: '请先选择地区',
fillAddress: '请先填写详细地址',
orderSuccess: '下单成功',
noRemainingCount: '当前次数已用完,请重新购买',
confirmRegenerate: '请确认是否重新生成。',
confirmOrder: '请再次确认是否选择这个模型下单,下单后预计需要10天完成生产发货。如对产品有疑问,可以联系客服咨询。',
addressPlaceholder: '请输入姓名、手机号、详细地址(如:张三 13800138000 广东省深圳市南山区科技园1号)',
addressRecognitionResult: '识别结果',
compareTip: '温馨提示:AI设计的徽章效果图是根据用户提供的照片机器学习生成的,多试几次就能找到你满意的徽章~',
saveImageTip: '长按图片 → 保存到相册',
designing: '设计中',
designFailed: '设计失败',
remainingExchange: '剩余兑换',
process: '工艺',
productType: '产品类型',
orderQuantity: '订购数量',
addressRecognition: '地址识别',
shippingAddress: '收货地址',
regenerate: '再次生成',
compare: '前后对比',
saveImage: '保存图片',
confirmSelect: '确认选择',
originalImage: '原图',
previewImage: '效果图',
badgePreview: '徽章预览'
}
},
// PhotoAlbum页面配置
photoAlbum: {
// 分页配置
pagination: {
pageSize: 20,
initialPage: 1
},
// 状态配置
status: {
success: 1, // 设计成功
designing: 0, // 设计中
failed: 2 // 设计失败
},
// 图片资源路径(在组件中通过 import 导入)
assets: {
nullData: '@/assets/badge/null-data.png'
},
// 样式配置
styles: {
gridColumns: 2, // 网格列数
gap: 16, // 间距
borderRadius: 12 // 圆角
},
// 提示信息
messages: {
title: '设计记录',
note: '注:可点击效果图进行下单打印',
noMore: '没有更多了',
loading: '加载中...',
noData: '暂无数据',
designing: '设计中',
designFailed: '设计失败',
getDataFailed: '获取数据失败'
}
},
// MyOrder页面配置
myOrder: {
// 分页配置
pagination: {
pageSize: 30,
initialPage: 1,
defaultStatus: 0 // 默认订单状态
},
// 订单状态配置
orderStatus: {
pending: 1, // 待支付
cancelled: 2, // 已取消
producing: 100, // 生产中
shipping: 200, // 待收货
completed: 300 // 已完成
},
// 订单状态文本映射
statusText: {
1: '待支付',
2: '已取消',
100: '生产中',
200: '待收货',
300: '已完成'
},
// 订单状态样式配置
statusStyles: {
processing: {
background: '#bdbdbd' // 处理中状态背景色
},
finished: {
background: '#8bc34a' // 完成状态背景色
},
default: {
background: '#bdbdbd',
color: '#fff',
opacity: 0.9
}
},
// 图片资源路径(在组件中通过 import 导入)
assets: {
nullData: '@/assets/badge/null-data.png'
},
// 样式配置
styles: {
gap: 8, // 间距
itemWidth: 'calc(50% - 4px)', // 订单项宽度
itemHeight: 'calc(50vw - 4px)', // 订单项高度
borderRadius: 12, // 圆角
padding: {
horizontal: 16,
vertical: 24
},
status: {
bottom: 5,
right: 5,
padding: {
vertical: 2,
horizontal: 12
},
borderRadius: 12,
fontSize: 12
},
shadow: '0 2px 8px rgba(0,0,0,0.08)' // 阴影
},
// 提示信息
messages: {
title: '我的订单',
noData: '暂无数据'
}
},
// OrderDetail页面配置
orderDetail: {
// 订单类型配置
orderTypes: {
shipping: 2 // 需要收货地址的订单类型
},
// 产品类型配置(需要特殊显示的产品类型)
productTypes: {
reliefPendant: 6 // 浮雕挂饰(需要显示双面)
},
// 图片尺寸配置
imageSize: {
width: 320,
height: 320,
borderRadius: 10
},
// 图片缩放比例
imageScale: 0.6,
// 样式配置
styles: {
padding: {
horizontal: 16,
vertical: 0
},
statusInfo: {
padding: {
horizontal: 16,
vertical: 0
},
title: {
fontSize: 18,
fontWeight: 'bold',
color: '#222',
marginBottom: 8
},
desc: {
fontSize: 10,
color: '#888'
}
},
productInfo: {
padding: {
horizontal: 16,
vertical: 0
},
title: {
fontSize: 15,
fontWeight: 'bold',
color: '#111',
marginBottom: 10
},
details: {
gap: 8
},
label: {
color: '#bdbdbd',
fontSize: 14
},
value: {
color: '#222',
fontSize: 14
}
},
avatar: {
gap: 10,
borderRadius: 10
},
bottomSpacing: 30
},
// 提示信息
messages: {
title: '订单详情',
statusDesc: '下单后预计需要10天完成生产发货。如对产品有疑问,可以联系客服咨询。',
shippingInfo: '收货信息',
contactInfo: '收货人信息',
shippingAddress: '收货地址',
productInfo: '产品信息',
productName: '产品名称',
size: '尺寸',
shape: '形状',
quantity: '购买数量',
orderInfo: '订单信息',
orderId: '购买订单id',
orderTime: '购买时间'
}
}
}