实现业委会功能

pull/1/head
戴余标 3 years ago
parent 4003bb1aab
commit 8829381ae9

@ -39,6 +39,7 @@ class SAASAPI {
static _Balance balance = _Balance();
static _CommunityIntroduce communityIntroduce = _CommunityIntroduce();
static _ConveniencePhone conveniencePhone = _ConveniencePhone();
static _CommitteeStaff committeeStaff = _CommitteeStaff();
///
static _ProfileApi profile = _ProfileApi();
@ -352,3 +353,7 @@ class _ConveniencePhone {
///app便
String get list => '/app/user/conveniencePhone/list';
}
class _CommitteeStaff {
///
String get list => '/app/user/industryCommittee/list';
}

@ -1,86 +1,53 @@
import 'package:aku_new_community/model/common/img_model.dart';
import 'package:common_utils/common_utils.dart';
import 'package:json_annotation/json_annotation.dart';
@JsonSerializable()
class CommitteeItemModel {
int? id;
int? positionId;
String? name;
int? sexId;
int? age;
int? educationId;
String? roomName;
String? profession;
String? roomNumber;
int? unitNo;
int? estateNo;
List<ImgModel>? imgUrls;
final int? id;
final String? name;
final String? tel;
final String? industryCommitteeTypeName;
final String? buildingName;
final String? unitName;
final String? estateName;
final String? appointmentStartTime;
final String? appointmentEndTime;
final String? createDate;
final List<ImgModel>? imgList;
String get sexValue {
if (sexId == 0 || sexId == null) return '未设置';
if (sexId == 1) return '';
if (sexId == 2) return '';
return '未设置';
}
String get positionValue {
switch (positionId) {
case 1:
return '业委会主任';
case 2:
return '业委会副主任';
case 3:
return '业委会委员';
default:
return '';
}
}
CommitteeItemModel({
this.id,
this.positionId,
this.name,
this.sexId,
this.age,
this.educationId,
this.roomName,
this.profession,
this.roomNumber,
this.unitNo,
this.estateNo,
this.imgUrls,
factory CommitteeItemModel.fromJson(Map<String, dynamic> json) =>
_$CommitteeItemModel(json);
DateTime? get appointmentStartDT => DateUtil.getDateTime(appointmentStartTime!);
DateTime? get appointmentEndDT => DateUtil.getDateTime(appointmentEndTime!);
DateTime? get createDateDT => DateUtil.getDateTime(createDate!);
const CommitteeItemModel({
required this.id,
required this.name,
required this.tel,
required this.industryCommitteeTypeName,
required this.buildingName,
required this.unitName,
required this.estateName,
required this.appointmentStartTime,
required this.appointmentEndTime,
required this.createDate,
required this.imgList,
});
CommitteeItemModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
positionId = json['positionId'];
name = json['name'];
sexId = json['sexId'];
age = json['age'];
educationId = json['educationId'];
roomName = json['roomName'];
profession = json['profession'];
roomNumber = json['roomNumber'];
unitNo = json['unitNo'];
estateNo = json['estateNo'];
if (json['imgUrls'] != null) {
imgUrls =
(json['imgUrls'] as List).map((e) => ImgModel.fromJson(e)).toList();
} else
imgUrls = [];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['positionId'] = this.positionId;
data['name'] = this.name;
data['sexId'] = this.sexId;
data['age'] = this.age;
data['educationId'] = this.educationId;
data['roomName'] = this.roomName;
data['profession'] = this.profession;
data['roomNumber'] = this.roomNumber;
data['unitNo'] = this.unitNo;
data['estateNo'] = this.estateNo;
return data;
}
}
CommitteeItemModel _$CommitteeItemModel(Map<String, dynamic> json) =>
CommitteeItemModel(
id: json['id'] as int,
name: json['name'] as String,
tel: json['tel'] as String,
industryCommitteeTypeName: json['industryCommitteeTypeName'] as String,
buildingName: json['buildingName'] as String,
unitName: json['unitName'] as String,
estateName: json['estateName'] as String,
appointmentStartTime: json['appointmentStartTime'] as String,
appointmentEndTime: json['appointmentEndTime'] as String,
createDate: json['createDate'] as String,
imgList: (json['imgList'] as List<dynamic>)
.map((e) => ImgModel.fromJson(e as Map<String, dynamic>))
.toList(),
);

@ -9,12 +9,15 @@ import 'package:aku_new_community/utils/headers.dart';
import 'package:aku_new_community/utils/hive_store.dart';
import 'package:aku_new_community/utils/websocket/tips_dialog.dart';
import 'package:aku_new_community/widget/bee_scaffold.dart';
import 'package:common_utils/common_utils.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:get/get.dart';
import 'package:url_launcher/url_launcher.dart';
import '../../utils/network/net_util.dart';
class IndustryCommitteePage extends StatefulWidget {
IndustryCommitteePage({Key? key}) : super(key: key);
@ -23,19 +26,20 @@ class IndustryCommitteePage extends StatefulWidget {
}
class _IndustryCommitteePageState extends State<IndustryCommitteePage> {
List<CommitteeItemModel> _models = [];
EasyRefreshController _refreshController = EasyRefreshController();
@override
void initState() {
super.initState();
Future.delayed(Duration(milliseconds: 0), () async {
var agreement =
await HiveStore.appBox?.get('IndustryCommitteePage') ?? false;
if (!agreement) {
await TipsDialog.tipsDialog();
HiveStore.appBox!.put('IndustryCommitteePage', true);
}
});
// Future.delayed(Duration(milliseconds: 0), () async {
// var agreement =
// await HiveStore.appBox?.get('IndustryCommitteePage') ?? false;
// if (!agreement) {
// await TipsDialog.tipsDialog();
// HiveStore.appBox!.put('IndustryCommitteePage', true);
// }
// });
}
Widget _buildBottomNavi() {
@ -95,7 +99,7 @@ class _IndustryCommitteePageState extends State<IndustryCommitteePage> {
borderRadius: BorderRadius.circular(4.w),
child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
image: SAASAPI.image(ImgModel.first(model.imgUrls)),
image: SAASAPI.image(ImgModel.first(model.imgList)),
height: 150.w,
width: 150.w,
fit: BoxFit.cover,
@ -112,9 +116,10 @@ class _IndustryCommitteePageState extends State<IndustryCommitteePage> {
height: 44.w,
padding:
EdgeInsets.symmetric(horizontal: 22.w, vertical: 6.w),
child: model.positionValue.text
child: model.industryCommitteeTypeName!.text
.size(24.sp)
.color(ktextPrimary)
.bold
.make(),
decoration: BoxDecoration(
color: Color(0xFFFFF3CD),
@ -123,17 +128,17 @@ class _IndustryCommitteePageState extends State<IndustryCommitteePage> {
),
),
].row(),
6.hb,
15.hb,
...[
'住址:${model.roomName}'
'住址:${model.buildingName}${model.unitName}单元${model.estateName}房间'
.text
.size(24.sp)
.size(23.sp)
.color(ktextSubColor)
.make(),
// '任职期限XXXXX'.text.size(24.sp).color(ktextSubColor).make(),
'从事岗位:${model.profession}'
'任职期限:${DateUtil.formatDate(model.appointmentStartDT, format: 'yyyy年MM月dd日')}-${DateUtil.formatDate(model.appointmentEndDT, format: 'yyyy年MM月dd日')}'
.text
.size(24.sp)
.size(23.sp)
.color(ktextSubColor)
.make(),
].sepWidget(separate: 10.hb),
@ -148,23 +153,54 @@ class _IndustryCommitteePageState extends State<IndustryCommitteePage> {
return BeeScaffold(
title: '业委会',
systemStyle: SystemStyle.genStyle(bottom: Color(0xFF2A2A2A)),
body: BeeListView<CommitteeItemModel>(
path: API.manager.commiteeStaff,
convert: (model) {
return model.rows.map((e) => CommitteeItemModel.fromJson(e)).toList();
},
body: Container(
child: EasyRefresh(
firstRefresh: true,
header: MaterialHeader(),
controller: _refreshController,
builder: (items) {
return ListView.separated(
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 20.w),
onRefresh: () async {
var base = await NetUtil().get(SAASAPI.committeeStaff.list);
if (base.success) {
print(base.success);
_models = (base.data as List)
.map((e) => CommitteeItemModel.fromJson(e))
.toList();
}
setState(() {});
},
child: ListView.separated(
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w),
itemBuilder: (context, index) {
return _buildCard(items[index]);
return _buildCard(_models[index]);
},
separatorBuilder: (context, index) => 20.hb,
itemCount: items.length,
separatorBuilder: (context, index) {
return Divider(
thickness: 1.w,
height: 40.w,
color: Color(0xFFD8D8D8),
);
},
itemCount: _models.length,
),
),
),
// BeeListView<CommitteeItemModel>(
// path: SAASAPI.committeeStaff.list,
// convert: (model) {
// return model.rows.map((e) => CommitteeItemModel.fromJson(e)).toList();
// },
// controller: _refreshController,
// builder: (items) {
// return ListView.separated(
// padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 20.w),
// itemBuilder: (context, index) {
// return _buildCard(items[index]);
// },
// separatorBuilder: (context, index) => 20.hb,
// itemCount: items.length,
// );
// },
// ),
bottomNavi: _buildBottomNavi(),
);
}

@ -71,8 +71,6 @@ class ApplicationUtil {
title: '业委会',
imgPath: Assets.newIcon.icYwh.path,
onTap: () {
BotToast.showText(text: '此功能暂未上线');
return;
Get.to(() => IndustryCommitteePage());
}),
// AppElement('建议咨询', R.ASSETS_ICONS_FUNC_JYZX_PNG,
@ -111,8 +109,6 @@ class ApplicationUtil {
title: '问卷调查',
imgPath: Assets.newIcon.icWjdc.path,
onTap: () {
BotToast.showText(text: '此功能暂未上线');
return;
Get.to(() => QuestionnairePage());
}),
AppElement(

Loading…
Cancel
Save