no message

This commit is contained in:
1147192855@qq.com 2024-05-15 14:00:37 +08:00
parent f13bdbcf5f
commit 8287518fc1
5 changed files with 31 additions and 15 deletions

View File

@ -146,7 +146,7 @@ class MarkingTextQuestion extends Object {
for (var i = 0; i < commentImageUrl.length; i++) {
var element = commentImageUrl[i];
var originalImage = studentAnswerList[i];
commentImageUrlMap[originalImage] = '$element?${DateTime.now().millisecondsSinceEpoch}';
commentImageUrlMap[originalImage] = 'https:$element?${DateTime.now().millisecondsSinceEpoch}';
}
} else {
for (var element in studentAnswerList) {

View File

@ -216,7 +216,8 @@ class PictureOverviewState extends ConsumerState<PictureOverview> with CommonMix
crypto.Digest fileMd5 = crypto.md5.convert(await temFile!.readAsBytes());
RestClient _client = await getClient();
BaseStructureResult<UploadFileInterfaceConfig> resUploadConfig = await _client.getUploadFile(UploadFileInterfaceConfigParams(
BaseStructureResult<UploadFileInterfaceConfig> resUploadConfig = await _client.getMarkingUploadFile(UploadFileInterfaceConfigParams(
fileName: '1.png',
fileMd5: fileMd5.toString(),
contentLength: temFile!.lengthSync(),

View File

@ -107,7 +107,7 @@ class TheMainPageState extends ConsumerState<TheMainPage> with CommonMixin {
}
void getAppUpgrade(UserInfo user) async {
// if (!bool.fromEnvironment('dart.vm.product')) return;
if (!bool.fromEnvironment('dart.vm.product')) return;
try {
showUpgrade = true;
if (['18888888888'].contains(user.loginName)) return;

View File

@ -22,8 +22,8 @@ import 'package:marking_app/utils/request/rest_client.dart';
// API
final uploadFileProvider = StateNotifierProvider<UploadFileProviderHandle, UploadImgSecretKey>(
(ref) => UploadFileProviderHandle(UploadImgSecretKey()));
final uploadFileProvider =
StateNotifierProvider<UploadFileProviderHandle, UploadImgSecretKey>((ref) => UploadFileProviderHandle(UploadImgSecretKey()));
class UploadFileProviderHandle extends StateNotifier<UploadImgSecretKey> with CommonMixin {
// Minio? _minio;
@ -109,24 +109,35 @@ class UploadFileProviderHandle extends StateNotifier<UploadImgSecretKey> with Co
Future<FileResult?> getUploadFileConfig(UploadFileInterfaceConfig uploadConfig, File fileData) async {
Dio dio = Dio();
dio.options.contentType = null;
try {
late Response response;
final bytes = await fileData.readAsBytes();
if (uploadConfig.uploadMethod == "PUT") {
response = await dio.put(uploadConfig.uploadUri!,
data: Stream.fromIterable(bytes.map((e) => [e])),
options: Options(headers: {
response = await dio.put(
uploadConfig.uploadUri!,
data: Stream.fromIterable(bytes.map((e) => [e])),
options: Options(
contentType: null,
headers: {
Headers.contentLengthHeader: bytes.length, // Set the content-length.
HttpHeaders.contentTypeHeader: 'image/png',
}));
// HttpHeaders.contentTypeHeader: 'image/png',
},
),
);
} else if (uploadConfig.uploadMethod == "POST") {
response = await dio.post(uploadConfig.uploadUri!,
data: Stream.fromIterable(bytes.map((e) => [e])),
options: Options(headers: {
response = await dio.post(
uploadConfig.uploadUri!,
data: Stream.fromIterable(bytes.map((e) => [e])),
options: Options(
contentType: null,
headers: {
Headers.contentLengthHeader: bytes.length, // Set the content-length.
HttpHeaders.contentTypeHeader: 'image/png',
}));
// HttpHeaders.contentTypeHeader: 'image/png',
},
),
);
}
print('文件上传成功:${response.data}');
if ([200, 201, 204].contains(response.statusCode)) {

View File

@ -190,6 +190,10 @@ abstract class RestClient {
@the_retrofit.GET("/api/marking/rating-info")
Future<BaseStructureResult<List<RatingProgressModel>>> getMarkingRatingInfo(@the_retrofit.Query("markingUserId") int id);
// =>
@the_retrofit.GET("/api/Upload")
Future<BaseStructureResult<UploadFileInterfaceConfig>> getMarkingUploadFile(@the_retrofit.Queries() UploadFileInterfaceConfigParams params);
// ------------------------------------------ ------------------------------------------
// =>