fix: 保存故事时将 cover_url 写入后端,修复书架封面为空的问题
_addNewBookWithAnimation 新增 coverUrl 参数,POST /stories/ 时携带 cover_url 字段,两处调用均从 saveResult 传入生成好的封面 URL。 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
51f994a2cc
commit
73cffb704f
@ -474,6 +474,7 @@ class _DeviceControlPageState extends ConsumerState<DeviceControlPage>
|
||||
await _addNewBookWithAnimation(
|
||||
title: saveResult['title'] as String? ?? '新故事',
|
||||
content: saveResult['content'] as String? ?? '',
|
||||
coverUrl: saveResult['cover_url'] as String? ?? '',
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -601,6 +602,7 @@ class _DeviceControlPageState extends ConsumerState<DeviceControlPage>
|
||||
_addNewBookWithAnimation(
|
||||
title: saveResult['title'] as String? ?? '新故事',
|
||||
content: saveResult['content'] as String? ?? '',
|
||||
coverUrl: saveResult['cover_url'] as String? ?? '',
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -900,7 +902,7 @@ class _DeviceControlPageState extends ConsumerState<DeviceControlPage>
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _addNewBookWithAnimation({String title = '新故事', String content = ''}) async {
|
||||
Future<void> _addNewBookWithAnimation({String title = '新故事', String content = '', String coverUrl = ''}) async {
|
||||
// Find the first shelf that has space
|
||||
int? targetShelfId;
|
||||
for (final shelf in _shelves) {
|
||||
@ -923,6 +925,7 @@ class _DeviceControlPageState extends ConsumerState<DeviceControlPage>
|
||||
'title': title,
|
||||
'content': content,
|
||||
'shelf_id': targetShelfId,
|
||||
if (coverUrl.isNotEmpty) 'cover_url': coverUrl,
|
||||
});
|
||||
// Reload to get the new story
|
||||
await _loadShelves();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user