Merge branch 'master' into newHost

pull/1/head
张萌 3 years ago
commit ed064fc688

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

@ -25,6 +25,8 @@ class API {
static _Pay pay = _Pay(); static _Pay pay = _Pay();
static _House house = _House(); static _House house = _House();
static _Bracelet bracelet = _Bracelet(); static _Bracelet bracelet = _Bracelet();
static _Intergral intergral = _Intergral();
} }
class _Bracelet { class _Bracelet {
@ -32,6 +34,14 @@ class _Bracelet {
String get data => '/user/aqg/getData'; String get data => '/user/aqg/getData';
} }
class _Intergral {
///
String get sign => '/user/points/sign';
///
String get info => '/user/points/getPointsInfo';
}
class _Login { class _Login {
// //
String get allCommunity => '/app/login/findAllCommunity'; String get allCommunity => '/app/login/findAllCommunity';

@ -1056,6 +1056,10 @@ class $AssetsImagesGen {
AssetGenImage get drawings => AssetGenImage get drawings =>
const AssetGenImage('assets/images/drawings.png'); const AssetGenImage('assets/images/drawings.png');
/// File path: assets/images/equipment_empty.png
AssetGenImage get equipmentEmpty =>
const AssetGenImage('assets/images/equipment_empty.png');
/// File path: assets/images/house_attestation.png /// File path: assets/images/house_attestation.png
AssetGenImage get houseAttestation => AssetGenImage get houseAttestation =>
const AssetGenImage('assets/images/house_attestation.png'); const AssetGenImage('assets/images/house_attestation.png');

@ -4,15 +4,17 @@ part 'clocked_record_list_model.g.dart';
@JsonSerializable() @JsonSerializable()
class ClockedRecordListModel { class ClockedRecordListModel {
final int day; final int id;
final String date; final int addNums;
final int addIntegral; final int serialNumber;
final String signDate;
factory ClockedRecordListModel.fromJson(Map<String, dynamic> json) => factory ClockedRecordListModel.fromJson(Map<String, dynamic> json) =>
_$ClockedRecordListModelFromJson(json); _$ClockedRecordListModelFromJson(json);
const ClockedRecordListModel({ const ClockedRecordListModel({
required this.day, required this.id,
required this.date, required this.addNums,
required this.addIntegral, required this.serialNumber,
required this.signDate,
}); });
} }

@ -9,7 +9,8 @@ part of 'clocked_record_list_model.dart';
ClockedRecordListModel _$ClockedRecordListModelFromJson( ClockedRecordListModel _$ClockedRecordListModelFromJson(
Map<String, dynamic> json) => Map<String, dynamic> json) =>
ClockedRecordListModel( ClockedRecordListModel(
day: json['day'] as int, id: json['id'] as int,
date: json['date'] as String, addNums: json['addNums'] as int,
addIntegral: json['addIntegral'] as int, serialNumber: json['serialNumber'] as int,
signDate: json['signDate'] as String,
); );

@ -0,0 +1,23 @@
import 'package:aku_new_community/models/integral/clocked_record_list_model.dart';
import 'package:json_annotation/json_annotation.dart';
part 'integral_info_model.g.dart';
@JsonSerializable()
class IntegralInfoModel {
final int points;
final String rewardSetting;
final int serialNumber;
final bool isSign;
final List<ClockedRecordListModel> signRecordList;
factory IntegralInfoModel.fromJson(Map<String, dynamic> json) =>
_$IntegralInfoModelFromJson(json);
const IntegralInfoModel({
required this.points,
required this.rewardSetting,
required this.serialNumber,
required this.isSign,
required this.signRecordList,
});
}

@ -0,0 +1,19 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'integral_info_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
IntegralInfoModel _$IntegralInfoModelFromJson(Map<String, dynamic> json) =>
IntegralInfoModel(
points: json['points'] as int,
rewardSetting: json['rewardSetting'] as String,
serialNumber: json['serialNumber'] as int,
isSign: json['isSign'] as bool,
signRecordList: (json['signRecordList'] as List<dynamic>)
.map(
(e) => ClockedRecordListModel.fromJson(e as Map<String, dynamic>))
.toList(),
);

@ -4,9 +4,12 @@ import 'package:aku_new_community/extensions/widget_list_ext.dart';
import 'package:aku_new_community/gen/assets.gen.dart'; import 'package:aku_new_community/gen/assets.gen.dart';
import 'package:aku_new_community/models/integral/add_integral_config_model.dart'; import 'package:aku_new_community/models/integral/add_integral_config_model.dart';
import 'package:aku_new_community/models/integral/clocked_record_list_model.dart'; import 'package:aku_new_community/models/integral/clocked_record_list_model.dart';
import 'package:aku_new_community/models/integral/integral_info_model.dart';
import 'package:aku_new_community/pages/personal/clock_in/clock_success_dialog.dart'; import 'package:aku_new_community/pages/personal/clock_in/clock_success_dialog.dart';
import 'package:aku_new_community/utils/network/net_util.dart';
import 'package:aku_new_community/widget/bee_back_button.dart'; import 'package:aku_new_community/widget/bee_back_button.dart';
import 'package:aku_new_community/widget/others/user_tool.dart'; import 'package:aku_new_community/widget/others/user_tool.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -21,31 +24,39 @@ class ClockInPage extends StatefulWidget {
} }
class _ClockInPageState extends State<ClockInPage> { class _ClockInPageState extends State<ClockInPage> {
List<AddIntegralConfigModel> _configs = [ IntegralInfoModel? _integralModel;
AddIntegralConfigModel(addIntegral: 1, hasClocked: false), List<AddIntegralConfigModel> _configs = [];
AddIntegralConfigModel(addIntegral: 2, hasClocked: false),
AddIntegralConfigModel(addIntegral: 3, hasClocked: false),
AddIntegralConfigModel(addIntegral: 5, hasClocked: false),
AddIntegralConfigModel(addIntegral: 8, hasClocked: false),
AddIntegralConfigModel(addIntegral: 15, hasClocked: false),
AddIntegralConfigModel(addIntegral: 50, hasClocked: false),
];
List<ClockedRecordListModel> _records = [ List<ClockedRecordListModel> _records = [];
ClockedRecordListModel(day: 1, date: '2021-12-29 13:29:24', addIntegral: 1),
ClockedRecordListModel(day: 2, date: '2021-12-28 13:29:24', addIntegral: 2),
ClockedRecordListModel(day: 3, date: '2021-12-27 13:29:24', addIntegral: 3),
ClockedRecordListModel(day: 4, date: '2021-12-26 13:29:24', addIntegral: 5),
ClockedRecordListModel(day: 5, date: '2021-12-25 13:29:24', addIntegral: 8),
ClockedRecordListModel(
day: 6, date: '2021-12-24 13:29:24', addIntegral: 15),
ClockedRecordListModel(
day: 7, date: '2021-12-23 13:29:24', addIntegral: 50),
ClockedRecordListModel(day: 1, date: '2021-12-22 13:29:24', addIntegral: 1),
];
bool _openRemind = false; // bool _openRemind = false; //
bool get hasClocked => _configs[0].hasClocked; bool get hasClocked => _integralModel?.isSign ?? false;
Future getData() async {
var base = await NetUtil().get(API.intergral.info);
if (base.status ?? false) {
_integralModel = IntegralInfoModel.fromJson(base.data);
} else {
BotToast.showText(text: base.message!);
}
}
@override
void initState() {
getData().then((value) {
if (_integralModel != null) {
_records = _integralModel!.signRecordList;
_configs = _integralModel!.rewardSetting
.split(',')
.mapIndexed((currentValue, index) => AddIntegralConfigModel(
addIntegral: int.parse(currentValue),
hasClocked: index < _integralModel!.serialNumber))
.toList();
setState(() {});
}
});
super.initState();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -94,7 +105,10 @@ class _ClockInPageState extends State<ClockInPage> {
Text.rich( Text.rich(
TextSpan(children: [ TextSpan(children: [
'已连续签到 '.textSpan.make(), '已连续签到 '.textSpan.make(),
'1'.textSpan.size(40.sp).make(), '${_integralModel?.serialNumber ?? 0}'
.textSpan
.size(40.sp)
.make(),
''.textSpan.make(), ''.textSpan.make(),
]), ]),
style: TextStyle( style: TextStyle(
@ -104,7 +118,9 @@ class _ClockInPageState extends State<ClockInPage> {
), ),
4.hb, 4.hb,
Text( Text(
'明日签到即可获得2积分', '明日签到即可获得'
'${_configs.isNotEmpty ? _configs[_integralModel!.serialNumber != 7 ? _integralModel!.serialNumber : 0].addIntegral : 0}'
'积分',
style: TextStyle( style: TextStyle(
fontSize: 24.sp, fontSize: 24.sp,
color: Colors.black.withOpacity(0.45), color: Colors.black.withOpacity(0.45),
@ -132,7 +148,11 @@ class _ClockInPageState extends State<ClockInPage> {
children: [ children: [
Assets.icons.intergral.image(width: 36.w, height: 36.w), Assets.icons.intergral.image(width: 36.w, height: 36.w),
12.wb, 12.wb,
'123'.text.size(32.sp).white.make(), '${_integralModel?.points ?? 0}'
.text
.size(32.sp)
.white
.make(),
], ],
), ),
), ),
@ -175,9 +195,9 @@ class _ClockInPageState extends State<ClockInPage> {
width: 72.w, width: 72.w,
height: 40.w, height: 40.w,
child: Switch( child: Switch(
value: _openRemind, value: UserTool.userProvider.userConfig.clockRemind,
onChanged: (value) { onChanged: (value) {
_openRemind = value; UserTool.userProvider.changeClockRemind();
setState(() {}); setState(() {});
}, },
)), )),
@ -201,12 +221,15 @@ class _ClockInPageState extends State<ClockInPage> {
onPressed: hasClocked onPressed: hasClocked
? null ? null
: () async { : () async {
await Get.dialog(ClockSuccessDialog( var base = await NetUtil().get(API.intergral.sign);
todayIntegral: _configs[0].addIntegral, if (base.status ?? false) {
tomorrowIntegral: _configs[1].addIntegral)); await Get.dialog(ClockSuccessDialog(
_configs[0] = AddIntegralConfigModel( todayIntegral: 1, tomorrowIntegral: 2));
addIntegral: _configs[0].addIntegral, hasClocked: true); await UserTool.userProvider.changeTodayClocked();
setState(() {}); await getData();
} else {
BotToast.showText(text: base.message!);
}
}, },
elevation: 0, elevation: 0,
color: kPrimaryColor, color: kPrimaryColor,
@ -246,9 +269,9 @@ class _ClockInPageState extends State<ClockInPage> {
children: [ children: [
..._records ..._records
.mapIndexed((currentValue, index) => recordListTile( .mapIndexed((currentValue, index) => recordListTile(
currentValue.day, currentValue.serialNumber,
currentValue.date, currentValue.signDate,
currentValue.addIntegral)) currentValue.addNums))
.toList(), .toList(),
Container( Container(
width: double.infinity, width: double.infinity,

@ -12,7 +12,9 @@ import 'package:aku_new_community/ui/profile/car_parking/car_parking_page.dart';
import 'package:aku_new_community/ui/profile/new_house/my_family_page.dart'; import 'package:aku_new_community/ui/profile/new_house/my_family_page.dart';
import 'package:aku_new_community/ui/profile/new_house/my_house_page.dart'; import 'package:aku_new_community/ui/profile/new_house/my_house_page.dart';
import 'package:aku_new_community/utils/headers.dart'; import 'package:aku_new_community/utils/headers.dart';
import 'package:aku_new_community/utils/network/net_util.dart';
import 'package:aku_new_community/widget/others/user_tool.dart'; import 'package:aku_new_community/widget/others/user_tool.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart';
@ -336,10 +338,16 @@ class _PersonalIndexState extends State<PersonalIndex>
Spacer(), Spacer(),
MaterialButton( MaterialButton(
onPressed: () async { onPressed: () async {
await Get.dialog(ClockSuccessDialog( var base =
todayIntegral: 1, tomorrowIntegral: 2)); await NetUtil().get(API.intergral.sign);
await UserTool.userProvider if (base.status ?? false) {
.changeTodayClocked(); await Get.dialog(ClockSuccessDialog(
todayIntegral: 1, tomorrowIntegral: 2));
await UserTool.userProvider
.changeTodayClocked();
} else {
BotToast.showText(text: base.message!);
}
}, },
elevation: 0, elevation: 0,
color: Colors.white, color: Colors.white,

@ -1,6 +1,7 @@
import 'package:aku_new_community/constants/api.dart'; import 'package:aku_new_community/constants/api.dart';
import 'package:aku_new_community/gen/assets.gen.dart'; import 'package:aku_new_community/gen/assets.gen.dart';
import 'package:aku_new_community/models/bracelet/bracelet_model.dart'; import 'package:aku_new_community/models/bracelet/bracelet_model.dart';
import 'package:aku_new_community/pages/services/old_age/add_equipment_page.dart';
import 'package:aku_new_community/pages/services/old_age/equipment_list_page.dart'; import 'package:aku_new_community/pages/services/old_age/equipment_list_page.dart';
import 'package:aku_new_community/utils/network/net_util.dart'; import 'package:aku_new_community/utils/network/net_util.dart';
import 'package:aku_new_community/widget/bee_divider.dart'; import 'package:aku_new_community/widget/bee_divider.dart';
@ -60,63 +61,68 @@ class _OldAgeSupportPageSimpleState extends State<OldAgeSupportPageSimple> {
.make(), .make(),
], ],
); );
return BeeScaffold( return _model == null
title: 'X5手环', ? _emptyScaffold()
extendBody: true, : BeeScaffold(
actions: [ title: 'X5手环',
IconButton( extendBody: true,
icon: Icon(CupertinoIcons.repeat), actions: [
iconSize: 30.w, IconButton(
color: Colors.black, icon: Icon(CupertinoIcons.repeat),
onPressed: () { iconSize: 30.w,
Get.to(() => EquipmentListPage()); color: Colors.black,
}, onPressed: () {
) Get.to(() => EquipmentListPage());
], },
body: Container( )
width: double.infinity, ],
height: double.infinity, body: Container(
decoration: BoxDecoration( width: double.infinity,
image: DecorationImage( height: double.infinity,
alignment: Alignment.topCenter, decoration: BoxDecoration(
image: AssetImage(Assets.static.braceletHeader.path)), image: DecorationImage(
gradient: LinearGradient( alignment: Alignment.topCenter,
begin: Alignment.topCenter, image: AssetImage(Assets.static.braceletHeader.path)),
end: Alignment.bottomCenter, gradient: LinearGradient(
colors: [Colors.white, Color(0xFFC0E5DC).withOpacity(0.355)]), begin: Alignment.topCenter,
), end: Alignment.bottomCenter,
child: _model == null colors: [
? Container() Colors.white,
: SafeArea( Color(0xFFC0E5DC).withOpacity(0.355)
child: ListView( ]),
padding: EdgeInsets.symmetric(horizontal: 32.w),
children: [
400.w.heightBox,
open,
16.w.heightBox,
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
'数据更新自 ${DateUtil.formatDate(_date!, format: DateFormats.full)}'
.text
.size(22.sp)
.color(Colors.black.withOpacity(0.25))
.make(),
40.w.heightBox,
],
),
40.w.heightBox,
overview(),
24.w.heightBox,
statusCard(),
40.w.heightBox,
bottomCard(),
40.w.heightBox,
],
),
), ),
), child: _model == null
); ? Container()
: SafeArea(
child: ListView(
padding: EdgeInsets.symmetric(horizontal: 32.w),
children: [
400.w.heightBox,
open,
16.w.heightBox,
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
'数据更新自 ${DateUtil.formatDate(_date!, format: DateFormats.full)}'
.text
.size(22.sp)
.color(Colors.black.withOpacity(0.25))
.make(),
40.w.heightBox,
],
),
40.w.heightBox,
overview(),
24.w.heightBox,
statusCard(),
40.w.heightBox,
bottomCard(),
40.w.heightBox,
],
),
),
),
);
} }
Future getData() async { Future getData() async {
@ -517,4 +523,39 @@ class _OldAgeSupportPageSimpleState extends State<OldAgeSupportPageSimple> {
), ),
); );
} }
Widget _emptyScaffold() {
return BeeScaffold(
title: '智慧养老',
body: SafeArea(
child: Center(
child: Column(
children: [
Assets.images.equipmentEmpty.image(width: 480.w, height: 480.w),
'当前没有绑定任何设备'
.text
.size(28.sp)
.color(Colors.black.withOpacity(0.25))
.make(),
],
),
),
),
bottomNavi: Padding(
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w),
child: MaterialButton(
onPressed: () {
Get.to(() => AddEquipmentPage());
},
color: Color(0xFF5096F1),
padding: EdgeInsets.symmetric(vertical: 24.w),
minWidth: 686.w,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.w),
),
child: '添加设备'.text.size(28.sp).white.make(),
),
),
);
}
} }

Loading…
Cancel
Save