|
@@ -101,15 +101,25 @@ class PersonalCenterController extends FControllerBase {
|
|
|
|
|
|
Future<void> chooseImage() async {
|
|
|
final files = await FilePicker.platform.pickFiles(type: FileType.image);
|
|
|
- if (files != null && files.files.first.path.isNotNullOrEmpty) {
|
|
|
+ if (files != null && files.files.first.bytes != null) {
|
|
|
// 这里获取到的是一个File对象,你可以根据需要进行处理
|
|
|
// 例如,将文件路径传递给Image组件进行显示
|
|
|
- String imagePath = files.files.first.path!;
|
|
|
+ var imageBytes = files.files.first.bytes!;
|
|
|
// 接下来,你可以将imagePath传递给Image组件
|
|
|
// if (kIsWeb) {
|
|
|
- var imageBase64 = await imageToBase64(imagePath);
|
|
|
- final file = convertBase64ToFile(imageBase64);
|
|
|
- var url = await rpc.storage.webUpload(file!);
|
|
|
+ print(imageBytes);
|
|
|
+ String base64String = base64Encode(imageBytes);
|
|
|
+ final file = convertBase64ToFile(base64String);
|
|
|
+ var result = await rpc.storage.webUpload(file!);
|
|
|
+ if (result != null) {
|
|
|
+ final saved = await Get.find<IDoctorManager>().setSignature(result);
|
|
|
+ if (saved) {
|
|
|
+ _updateSignature(result);
|
|
|
+ } else {
|
|
|
+ PromptBox.toast("设置签名失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// }
|
|
|
}
|
|
|
}
|