no message
This commit is contained in:
parent
f13bdbcf5f
commit
8287518fc1
|
|
@ -146,7 +146,7 @@ class MarkingTextQuestion extends Object {
|
||||||
for (var i = 0; i < commentImageUrl.length; i++) {
|
for (var i = 0; i < commentImageUrl.length; i++) {
|
||||||
var element = commentImageUrl[i];
|
var element = commentImageUrl[i];
|
||||||
var originalImage = studentAnswerList[i];
|
var originalImage = studentAnswerList[i];
|
||||||
commentImageUrlMap[originalImage] = '$element?${DateTime.now().millisecondsSinceEpoch}';
|
commentImageUrlMap[originalImage] = 'https:$element?${DateTime.now().millisecondsSinceEpoch}';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (var element in studentAnswerList) {
|
for (var element in studentAnswerList) {
|
||||||
|
|
|
||||||
|
|
@ -216,7 +216,8 @@ class PictureOverviewState extends ConsumerState<PictureOverview> with CommonMix
|
||||||
|
|
||||||
crypto.Digest fileMd5 = crypto.md5.convert(await temFile!.readAsBytes());
|
crypto.Digest fileMd5 = crypto.md5.convert(await temFile!.readAsBytes());
|
||||||
RestClient _client = await getClient();
|
RestClient _client = await getClient();
|
||||||
BaseStructureResult<UploadFileInterfaceConfig> resUploadConfig = await _client.getUploadFile(UploadFileInterfaceConfigParams(
|
|
||||||
|
BaseStructureResult<UploadFileInterfaceConfig> resUploadConfig = await _client.getMarkingUploadFile(UploadFileInterfaceConfigParams(
|
||||||
fileName: '1.png',
|
fileName: '1.png',
|
||||||
fileMd5: fileMd5.toString(),
|
fileMd5: fileMd5.toString(),
|
||||||
contentLength: temFile!.lengthSync(),
|
contentLength: temFile!.lengthSync(),
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ class TheMainPageState extends ConsumerState<TheMainPage> with CommonMixin {
|
||||||
}
|
}
|
||||||
|
|
||||||
void getAppUpgrade(UserInfo user) async {
|
void getAppUpgrade(UserInfo user) async {
|
||||||
// if (!bool.fromEnvironment('dart.vm.product')) return;
|
if (!bool.fromEnvironment('dart.vm.product')) return;
|
||||||
try {
|
try {
|
||||||
showUpgrade = true;
|
showUpgrade = true;
|
||||||
if (['18888888888'].contains(user.loginName)) return;
|
if (['18888888888'].contains(user.loginName)) return;
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,8 @@ import 'package:marking_app/utils/request/rest_client.dart';
|
||||||
|
|
||||||
// API
|
// API
|
||||||
|
|
||||||
final uploadFileProvider = StateNotifierProvider<UploadFileProviderHandle, UploadImgSecretKey>(
|
final uploadFileProvider =
|
||||||
(ref) => UploadFileProviderHandle(UploadImgSecretKey()));
|
StateNotifierProvider<UploadFileProviderHandle, UploadImgSecretKey>((ref) => UploadFileProviderHandle(UploadImgSecretKey()));
|
||||||
|
|
||||||
class UploadFileProviderHandle extends StateNotifier<UploadImgSecretKey> with CommonMixin {
|
class UploadFileProviderHandle extends StateNotifier<UploadImgSecretKey> with CommonMixin {
|
||||||
// Minio? _minio;
|
// Minio? _minio;
|
||||||
|
|
@ -109,24 +109,35 @@ class UploadFileProviderHandle extends StateNotifier<UploadImgSecretKey> with Co
|
||||||
|
|
||||||
Future<FileResult?> getUploadFileConfig(UploadFileInterfaceConfig uploadConfig, File fileData) async {
|
Future<FileResult?> getUploadFileConfig(UploadFileInterfaceConfig uploadConfig, File fileData) async {
|
||||||
Dio dio = Dio();
|
Dio dio = Dio();
|
||||||
|
dio.options.contentType = null;
|
||||||
try {
|
try {
|
||||||
late Response response;
|
late Response response;
|
||||||
final bytes = await fileData.readAsBytes();
|
final bytes = await fileData.readAsBytes();
|
||||||
|
|
||||||
if (uploadConfig.uploadMethod == "PUT") {
|
if (uploadConfig.uploadMethod == "PUT") {
|
||||||
response = await dio.put(uploadConfig.uploadUri!,
|
response = await dio.put(
|
||||||
|
uploadConfig.uploadUri!,
|
||||||
data: Stream.fromIterable(bytes.map((e) => [e])),
|
data: Stream.fromIterable(bytes.map((e) => [e])),
|
||||||
options: Options(headers: {
|
options: Options(
|
||||||
|
contentType: null,
|
||||||
|
headers: {
|
||||||
Headers.contentLengthHeader: bytes.length, // Set the content-length.
|
Headers.contentLengthHeader: bytes.length, // Set the content-length.
|
||||||
HttpHeaders.contentTypeHeader: 'image/png',
|
// HttpHeaders.contentTypeHeader: 'image/png',
|
||||||
}));
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
} else if (uploadConfig.uploadMethod == "POST") {
|
} else if (uploadConfig.uploadMethod == "POST") {
|
||||||
response = await dio.post(uploadConfig.uploadUri!,
|
response = await dio.post(
|
||||||
|
uploadConfig.uploadUri!,
|
||||||
data: Stream.fromIterable(bytes.map((e) => [e])),
|
data: Stream.fromIterable(bytes.map((e) => [e])),
|
||||||
options: Options(headers: {
|
options: Options(
|
||||||
|
contentType: null,
|
||||||
|
headers: {
|
||||||
Headers.contentLengthHeader: bytes.length, // Set the content-length.
|
Headers.contentLengthHeader: bytes.length, // Set the content-length.
|
||||||
HttpHeaders.contentTypeHeader: 'image/png',
|
// HttpHeaders.contentTypeHeader: 'image/png',
|
||||||
}));
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
print('文件上传成功:${response.data}');
|
print('文件上传成功:${response.data}');
|
||||||
if ([200, 201, 204].contains(response.statusCode)) {
|
if ([200, 201, 204].contains(response.statusCode)) {
|
||||||
|
|
|
||||||
|
|
@ -190,6 +190,10 @@ abstract class RestClient {
|
||||||
@the_retrofit.GET("/api/marking/rating-info")
|
@the_retrofit.GET("/api/marking/rating-info")
|
||||||
Future<BaseStructureResult<List<RatingProgressModel>>> getMarkingRatingInfo(@the_retrofit.Query("markingUserId") int id);
|
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);
|
||||||
|
|
||||||
// ------------------------------------------ 作业 ------------------------------------------
|
// ------------------------------------------ 作业 ------------------------------------------
|
||||||
|
|
||||||
// 作业 => 作业列表
|
// 作业 => 作业列表
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue