feat: 公开商品页重设计 + web 上传修复 + 二维码配置
- 公开商品页(/product/:uuid)全面重设计:全宽正方形图片轮播、 左右滑动切图、点击放大全屏查看、商品参数含描述、页脚贴底 - 修复 Flutter web 文件上传无反应(path→bytes) - 修复 web 路由空白页(usePathUrlStrategy + 单层 MaterialApp.router) - 二维码 URL 改为从 STORAGE_PUBLIC_URL 环境变量读取 - 新增 PUBLIC_URL dart-define → AppConfig.publicBaseUrl - 新增 CI/CD workflows + NAS runner compose 配置 - seed S001 补充商品描述字段 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -87,11 +87,16 @@ class ProductRepository {
|
||||
}
|
||||
}
|
||||
|
||||
Future<ProductImage> uploadImage(int productId, String filePath) async {
|
||||
Future<ProductImage> uploadImage(int productId, String? filePath,
|
||||
{Uint8List? bytes, String? fileName}) async {
|
||||
try {
|
||||
final formData = FormData.fromMap({
|
||||
'file': await MultipartFile.fromFile(filePath),
|
||||
});
|
||||
final MultipartFile file;
|
||||
if (bytes != null) {
|
||||
file = MultipartFile.fromBytes(bytes, filename: fileName ?? 'image.jpg');
|
||||
} else {
|
||||
file = await MultipartFile.fromFile(filePath!);
|
||||
}
|
||||
final formData = FormData.fromMap({'file': file});
|
||||
final resp = await _client.post('/products/$productId/images', data: formData);
|
||||
return ProductImage.fromJson(
|
||||
(resp.data as Map<String, dynamic>)['data'] as Map<String, dynamic>);
|
||||
|
||||
Reference in New Issue
Block a user