59 lines
1.5 KiB
Dart
59 lines
1.5 KiB
Dart
import 'package:ef/ef.dart';
|
|
import 'package:json_annotation/json_annotation.dart';
|
|
import 'package:vbvs_app/common/color/ServiceConstant.dart';
|
|
import 'package:vbvs_app/common/color/appConstants.dart';
|
|
import 'package:vbvs_app/common/util/requestWithLog.dart';
|
|
|
|
part 'issue_controller.g.dart';
|
|
|
|
@JsonSerializable()
|
|
class IssueListModel {
|
|
List issueList = [];
|
|
|
|
int limit = AppConstants.limit;
|
|
int offset = 0;
|
|
bool isLoading = false;
|
|
bool hasMore = true;
|
|
|
|
int? selectedIndex;
|
|
|
|
IssueListModel();
|
|
static IssueListModel fromJson(Map<String, dynamic> json) =>
|
|
_$IssueListModelFromJson(json);
|
|
Map<String, dynamic> toJson() => _$IssueListModelToJson(this);
|
|
}
|
|
|
|
class IssueListController extends GetControllerEx<IssueListModel> {
|
|
IssueListController() {
|
|
attr = GetModel(IssueListModel()).obs;
|
|
}
|
|
// void onInit() async {
|
|
// super.onInit();
|
|
// await getIssueList();
|
|
// }
|
|
|
|
getIssueList() async {
|
|
model.isLoading = true;
|
|
updateAll();
|
|
|
|
String serviceAddress = ServiceConstant.service_address;
|
|
String serviceName = ServiceConstant.server_service;
|
|
String serviceApi = ServiceConstant.issue_list;
|
|
String queryUrl = "$serviceAddress$serviceName$serviceApi";
|
|
requestWithLog(
|
|
logTitle: '获取所有的问题与帮助列表',
|
|
method: MyHttpMethod.get,
|
|
queryUrl: queryUrl,
|
|
onSuccess: (res) {
|
|
model.issueList = res.data;
|
|
model.isLoading = false;
|
|
updateAll();
|
|
},
|
|
onFailure: (e) {
|
|
model.isLoading = false;
|
|
updateAll();
|
|
},
|
|
);
|
|
}
|
|
}
|