import 'dart:convert'; import 'dart:typed_data'; class VideoLogEntity { int? errorCode; String? description; String? errorMsg; List? data; VideoLogEntity({this.errorCode, this.description, this.errorMsg, this.data}); VideoLogEntity.fromJson(Map json) { errorCode = json['errorCode']; description = json['description']; errorMsg = json['errorMsg']; if (json['data'] != null) { data = []; json['data'].forEach((v) { data!.add(CloudStorageData.fromJson(v)); }); } } Map toJson() { final Map data = {}; data['errorCode'] = errorCode; data['description'] = description; data['errorMsg'] = errorMsg; if (this.data != null) { data['data'] = this.data!.map((v) => v.toJson()).toList(); } return data; } } class CloudStorageData { String? date; List? recordList; CloudStorageData({this.date, this.recordList}); CloudStorageData.fromJson(Map json) { date = json['date']; if (json['recordList'] != null) { recordList = []; json['recordList'].forEach((v) { recordList!.add(RecordListData.fromJson(v)); }); } } Map toJson() { final Map data = {}; data['date'] = date; if (recordList != null) { data['recordList'] = recordList!.map((v) => v.toJson()).toList(); } return data; } } class RecordListData { int? recordId; int? operateDate; String? imagesUrl; String? videoUrl; Uint8List? thumbnailData; // 将视频封面改为 Uint8List 类型 int? recordType; bool? isSelect = false; RecordListData({ this.recordId, this.operateDate, this.imagesUrl, this.videoUrl, this.thumbnailData, // 视频封面数据 this.recordType, }); RecordListData.fromJson(Map json) { recordId = json['recordId']; operateDate = json['operateDate']; imagesUrl = json['imagesUrl']; videoUrl = json['videoUrl']; // 如果 JSON 中包含 base64 编码的图片数据,可以解码为 Uint8List if (json['thumbnailData'] != null) { thumbnailData = base64Decode(json['thumbnailData']); } recordType = json['recordType']; } Map toJson() { final Map data = {}; data['recordId'] = recordId; data['operateDate'] = operateDate; data['imagesUrl'] = imagesUrl; data['videoUrl'] = videoUrl; // 将 Uint8List 编码为 base64 字符串 if (thumbnailData != null) { data['thumbnailData'] = base64Encode(thumbnailData!); } data['recordType'] = recordType; return data; } }