no message
This commit is contained in:
parent
1c17e014a4
commit
5a43ccffcf
|
|
@ -0,0 +1,146 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:marking_app/common/mixin/common.dart';
|
||||
import 'package:marking_app/common/model/marking/marking_list_params.dart';
|
||||
import 'package:marking_app/utils/index.dart';
|
||||
import 'package:marking_app/utils/my_text.dart';
|
||||
|
||||
import '../../utils/my_future_builder.dart';
|
||||
|
||||
class JobHome extends StatefulWidget {
|
||||
const JobHome({super.key});
|
||||
|
||||
@override
|
||||
State<JobHome> createState() => _JobHomeState();
|
||||
}
|
||||
|
||||
class _JobHomeState extends State<JobHome> with CommonMixin, AutomaticKeepAliveClientMixin {
|
||||
@override
|
||||
bool get wantKeepAlive => true;
|
||||
|
||||
late Future _future;
|
||||
List<EntranceModel> entrances = [
|
||||
EntranceModel(
|
||||
title: '作业批阅',
|
||||
image: '',
|
||||
navigationUrl: '',
|
||||
),
|
||||
EntranceModel(
|
||||
title: '学生历史作业',
|
||||
image: '',
|
||||
navigationUrl: '',
|
||||
),
|
||||
EntranceModel(
|
||||
title: '知识点掌握',
|
||||
image: '',
|
||||
navigationUrl: '',
|
||||
),
|
||||
EntranceModel(
|
||||
title: '答题轨迹',
|
||||
image: '',
|
||||
navigationUrl: '',
|
||||
),
|
||||
EntranceModel(
|
||||
title: '优先批阅设定',
|
||||
image: '',
|
||||
navigationUrl: '',
|
||||
),
|
||||
EntranceModel(
|
||||
title: '批阅设置',
|
||||
image: '',
|
||||
navigationUrl: '',
|
||||
),
|
||||
];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_future = getData();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
Future getData() async {
|
||||
var _client = await getClient();
|
||||
var _result = await _client.getJobsByPage(MarkingListParams(
|
||||
isFinish: false,
|
||||
page: 1,
|
||||
limit: 1,
|
||||
pageType: 0,
|
||||
));
|
||||
if (_result == null) return 0;
|
||||
return _result.data?.total ?? 0;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
super.build(context);
|
||||
|
||||
return AnnotatedRegion(
|
||||
value: const SystemUiOverlayStyle(
|
||||
systemNavigationBarColor: Color(0xFF000000),
|
||||
systemNavigationBarDividerColor: null,
|
||||
statusBarColor: Colors.white,
|
||||
systemNavigationBarIconBrightness: Brightness.light,
|
||||
statusBarIconBrightness: Brightness.dark,
|
||||
statusBarBrightness: Brightness.light,
|
||||
),
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: Colors.white,
|
||||
centerTitle: true, // 标题居中
|
||||
title: quickText('我的作业管理'),
|
||||
systemOverlayStyle: SystemUiOverlayStyle.dark,
|
||||
),
|
||||
backgroundColor: Color.fromRGBO(244, 244, 244, 1),
|
||||
body: RefreshIndicator(
|
||||
onRefresh: () async {
|
||||
_future = getData();
|
||||
toUpState(setState, () {}, mounted);
|
||||
},
|
||||
child: MyFutureBuilder.buildFutureBuilderOfSingleInstance(context, _future, (data) {
|
||||
if (data == null)
|
||||
return Center(
|
||||
child: Container(
|
||||
child: TextButton(
|
||||
onPressed: () {
|
||||
_future = getData();
|
||||
toUpState(setState, () {}, mounted);
|
||||
},
|
||||
child: quickText('没有获取到数据,点击重试'),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
return Container(
|
||||
child: GridView(
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 2,
|
||||
mainAxisSpacing: 10.r,
|
||||
crossAxisSpacing: 10.r,
|
||||
childAspectRatio: 556 / 112,
|
||||
),
|
||||
children: entrances.map((e) {
|
||||
return Container(
|
||||
alignment: Alignment.center,
|
||||
child: Row(
|
||||
children: [
|
||||
quickText(e.title),
|
||||
],
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class EntranceModel extends Object {
|
||||
String title;
|
||||
String image;
|
||||
String navigationUrl;
|
||||
EntranceModel({required this.title, required this.image, required this.navigationUrl});
|
||||
}
|
||||
|
|
@ -16,11 +16,9 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|||
import 'package:marking_app/common/mixin/common.dart';
|
||||
import 'package:marking_app/common/model/common/base_structure_result.dart';
|
||||
import 'package:marking_app/common/model/user/user_info.dart';
|
||||
import 'package:marking_app/pages/homework_correction/index.dart';
|
||||
import 'package:marking_app/pages/reports/index.dart';
|
||||
import 'package:marking_app/provider/do_marking_provider.dart';
|
||||
import 'package:marking_app/provider/upload_file_provider.dart';
|
||||
import 'package:marking_app/routes/RouterManager.dart';
|
||||
import 'package:marking_app/utils/app_upgrade/UpdateDialog.dart';
|
||||
import 'package:marking_app/utils/app_upgrade/model/UpdateAppEvent.dart';
|
||||
import 'package:marking_app/common/model/sys/system_version.dart';
|
||||
|
|
@ -31,6 +29,8 @@ import 'package:marking_app/utils/index.dart';
|
|||
import 'package:marking_app/utils/request/rest_client.dart';
|
||||
import 'package:package_info/package_info.dart';
|
||||
|
||||
import 'homework_correction/job_home.dart';
|
||||
|
||||
class TheMainPage extends StatefulHookConsumerWidget {
|
||||
const TheMainPage({Key? key}) : super(key: key);
|
||||
|
||||
|
|
@ -49,7 +49,8 @@ class TheMainPageState extends ConsumerState<TheMainPage> with CommonMixin {
|
|||
final List<Widget> _bodyList = [
|
||||
const TheHomePage(),
|
||||
const TheMarking(),
|
||||
const HomeworkCorrection(),
|
||||
// const HomeworkCorrection(),
|
||||
const JobHome(),
|
||||
const TheReport()
|
||||
];
|
||||
int tabIndex = 0;
|
||||
|
|
@ -130,14 +131,8 @@ class TheMainPageState extends ConsumerState<TheMainPage> with CommonMixin {
|
|||
// String buildNumber = packageInfo.buildNumber; //小版本号
|
||||
|
||||
SystemVersion data = result.data!;
|
||||
Map json = {
|
||||
'downloadPath': data.apkUrl,
|
||||
'version': data.version,
|
||||
'systemType': deviceType,
|
||||
'description': data.description
|
||||
};
|
||||
UpdateAppEvent updateAppEvent =
|
||||
UpdateAppEvent.fromJson(json, localVersion, deviceInfo, appName, packageName, typeName: 'systemType');
|
||||
Map json = {'downloadPath': data.apkUrl, 'version': data.version, 'systemType': deviceType, 'description': data.description};
|
||||
UpdateAppEvent updateAppEvent = UpdateAppEvent.fromJson(json, localVersion, deviceInfo, appName, packageName, typeName: 'systemType');
|
||||
if (updateAppEvent.upgrade) {
|
||||
await UpdateDialog.showUpdateDialog(context, updateAppEvent);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue