更新
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutterflow_ui/flutterflow_ui.dart';
|
||||
import 'package:vbvs_app/common/color/ServiceConstant.dart';
|
||||
import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/common/util/requestWithLog.dart';
|
||||
import 'package:vbvs_app/component/NullDataComponentWidget.dart';
|
||||
import 'package:vbvs_app/controller/repair/repair_controller.dart';
|
||||
import 'package:vbvs_app/model/api_response.dart';
|
||||
import 'package:vbvs_app/pages/repair/component/RepairHistoryInfoWidget.dart';
|
||||
|
||||
class RepairListPage extends StatefulWidget {
|
||||
@@ -13,6 +18,8 @@ class RepairListPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _RepairListPageState extends State<RepairListPage> {
|
||||
RepairController repairController = Get.find();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
@@ -92,26 +99,23 @@ class _RepairListPageState extends State<RepairListPage> {
|
||||
child: Padding(
|
||||
padding:
|
||||
EdgeInsetsDirectional.fromSTEB(30.rpx, 29.rpx, 30.rpx, 0),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
RepairHistoryInfoWidget(),
|
||||
RepairHistoryInfoWidget(),
|
||||
RepairHistoryInfoWidget(),
|
||||
RepairHistoryInfoWidget(),
|
||||
RepairHistoryInfoWidget(),
|
||||
RepairHistoryInfoWidget(),
|
||||
RepairHistoryInfoWidget(),
|
||||
]
|
||||
.divide(SizedBox(
|
||||
height: 25.rpx,
|
||||
))
|
||||
.addToEnd(SizedBox(
|
||||
height: 25.rpx,
|
||||
)),
|
||||
),
|
||||
),
|
||||
child: Obx(() {
|
||||
final isEmpty = repairController.repairHistory.value.isEmpty;
|
||||
if (isEmpty) {
|
||||
return Expanded(child: NullDataWidget());
|
||||
}
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: repairController.repairHistory.value
|
||||
.map((item) => RepairHistoryInfoWidget(
|
||||
data: item)) // 假设组件支持传 data
|
||||
.toList()
|
||||
.divide(SizedBox(height: 25.rpx))
|
||||
.addToEnd(SizedBox(height: 25.rpx)),
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -121,11 +125,14 @@ class _RepairListPageState extends State<RepairListPage> {
|
||||
}
|
||||
|
||||
Future<void> loadData() async {
|
||||
// repairController.repairHistory.value = [{}];
|
||||
// ApiResponse apiResponse = await requestWithLog(
|
||||
// logTitle: "请求维修列表", method: MyHttpMethod.get, queryUrl: "");
|
||||
// if (apiResponse.code == HttpStatusCodes.ok) {
|
||||
// //请求维修列表
|
||||
// }
|
||||
String serviceAddress = ServiceConstant.service_address;
|
||||
String serviceName = ServiceConstant.server_service;
|
||||
String serviceApi = ServiceConstant.submit_repair;
|
||||
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}";
|
||||
ApiResponse apiResponse = await requestWithLog(
|
||||
logTitle: "查询报修数据", method: MyHttpMethod.get, queryUrl: queryUrl);
|
||||
RepairController repairController = Get.find();
|
||||
repairController.repairHistory.value = apiResponse.data;
|
||||
repairController.updateAll();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user