实现业委会功能

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

@ -39,6 +39,7 @@ class SAASAPI {
static _Balance balance = _Balance(); static _Balance balance = _Balance();
static _CommunityIntroduce communityIntroduce = _CommunityIntroduce(); static _CommunityIntroduce communityIntroduce = _CommunityIntroduce();
static _ConveniencePhone conveniencePhone = _ConveniencePhone(); static _ConveniencePhone conveniencePhone = _ConveniencePhone();
static _CommitteeStaff committeeStaff = _CommitteeStaff();
/// ///
static _ProfileApi profile = _ProfileApi(); static _ProfileApi profile = _ProfileApi();
@ -352,3 +353,7 @@ class _ConveniencePhone {
///app便 ///app便
String get list => '/app/user/conveniencePhone/list'; 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: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 { class CommitteeItemModel {
int? id; final int? id;
int? positionId; final String? name;
String? name; final String? tel;
int? sexId; final String? industryCommitteeTypeName;
int? age; final String? buildingName;
int? educationId; final String? unitName;
String? roomName; final String? estateName;
String? profession; final String? appointmentStartTime;
String? roomNumber; final String? appointmentEndTime;
int? unitNo; final String? createDate;
int? estateNo; final List<ImgModel>? imgList;
List<ImgModel>? imgUrls;
String get sexValue { factory CommitteeItemModel.fromJson(Map<String, dynamic> json) =>
if (sexId == 0 || sexId == null) return '未设置'; _$CommitteeItemModel(json);
if (sexId == 1) return ''; DateTime? get appointmentStartDT => DateUtil.getDateTime(appointmentStartTime!);
if (sexId == 2) return ''; DateTime? get appointmentEndDT => DateUtil.getDateTime(appointmentEndTime!);
return '未设置'; DateTime? get createDateDT => DateUtil.getDateTime(createDate!);
} const CommitteeItemModel({
required this.id,
String get positionValue { required this.name,
switch (positionId) { required this.tel,
case 1: required this.industryCommitteeTypeName,
return '业委会主任'; required this.buildingName,
case 2: required this.unitName,
return '业委会副主任'; required this.estateName,
case 3: required this.appointmentStartTime,
return '业委会委员'; required this.appointmentEndTime,
default: required this.createDate,
return ''; required this.imgList,
}
}
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,
}); });
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/hive_store.dart';
import 'package:aku_new_community/utils/websocket/tips_dialog.dart'; import 'package:aku_new_community/utils/websocket/tips_dialog.dart';
import 'package:aku_new_community/widget/bee_scaffold.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/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';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
import '../../utils/network/net_util.dart';
class IndustryCommitteePage extends StatefulWidget { class IndustryCommitteePage extends StatefulWidget {
IndustryCommitteePage({Key? key}) : super(key: key); IndustryCommitteePage({Key? key}) : super(key: key);
@ -23,19 +26,20 @@ class IndustryCommitteePage extends StatefulWidget {
} }
class _IndustryCommitteePageState extends State<IndustryCommitteePage> { class _IndustryCommitteePageState extends State<IndustryCommitteePage> {
List<CommitteeItemModel> _models = [];
EasyRefreshController _refreshController = EasyRefreshController(); EasyRefreshController _refreshController = EasyRefreshController();
@override @override
void initState() { void initState() {
super.initState(); super.initState();
Future.delayed(Duration(milliseconds: 0), () async { // Future.delayed(Duration(milliseconds: 0), () async {
var agreement = // var agreement =
await HiveStore.appBox?.get('IndustryCommitteePage') ?? false; // await HiveStore.appBox?.get('IndustryCommitteePage') ?? false;
if (!agreement) { // if (!agreement) {
await TipsDialog.tipsDialog(); // await TipsDialog.tipsDialog();
HiveStore.appBox!.put('IndustryCommitteePage', true); // HiveStore.appBox!.put('IndustryCommitteePage', true);
} // }
}); // });
} }
Widget _buildBottomNavi() { Widget _buildBottomNavi() {
@ -95,7 +99,7 @@ class _IndustryCommitteePageState extends State<IndustryCommitteePage> {
borderRadius: BorderRadius.circular(4.w), borderRadius: BorderRadius.circular(4.w),
child: FadeInImage.assetNetwork( child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
image: SAASAPI.image(ImgModel.first(model.imgUrls)), image: SAASAPI.image(ImgModel.first(model.imgList)),
height: 150.w, height: 150.w,
width: 150.w, width: 150.w,
fit: BoxFit.cover, fit: BoxFit.cover,
@ -112,9 +116,10 @@ class _IndustryCommitteePageState extends State<IndustryCommitteePage> {
height: 44.w, height: 44.w,
padding: padding:
EdgeInsets.symmetric(horizontal: 22.w, vertical: 6.w), EdgeInsets.symmetric(horizontal: 22.w, vertical: 6.w),
child: model.positionValue.text child: model.industryCommitteeTypeName!.text
.size(24.sp) .size(24.sp)
.color(ktextPrimary) .color(ktextPrimary)
.bold
.make(), .make(),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(0xFFFFF3CD), color: Color(0xFFFFF3CD),
@ -123,17 +128,17 @@ class _IndustryCommitteePageState extends State<IndustryCommitteePage> {
), ),
), ),
].row(), ].row(),
6.hb, 15.hb,
...[ ...[
'住址:${model.roomName}' '住址:${model.buildingName}${model.unitName}单元${model.estateName}房间'
.text .text
.size(24.sp) .size(23.sp)
.color(ktextSubColor) .color(ktextSubColor)
.make(), .make(),
// '任职期限XXXXX'.text.size(24.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 .text
.size(24.sp) .size(23.sp)
.color(ktextSubColor) .color(ktextSubColor)
.make(), .make(),
].sepWidget(separate: 10.hb), ].sepWidget(separate: 10.hb),
@ -148,23 +153,54 @@ class _IndustryCommitteePageState extends State<IndustryCommitteePage> {
return BeeScaffold( return BeeScaffold(
title: '业委会', title: '业委会',
systemStyle: SystemStyle.genStyle(bottom: Color(0xFF2A2A2A)), systemStyle: SystemStyle.genStyle(bottom: Color(0xFF2A2A2A)),
body: BeeListView<CommitteeItemModel>( body: Container(
path: API.manager.commiteeStaff, child: EasyRefresh(
convert: (model) { firstRefresh: true,
return model.rows.map((e) => CommitteeItemModel.fromJson(e)).toList(); header: MaterialHeader(),
},
controller: _refreshController, controller: _refreshController,
builder: (items) { onRefresh: () async {
return ListView.separated( var base = await NetUtil().get(SAASAPI.committeeStaff.list);
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 20.w), 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) { itemBuilder: (context, index) {
return _buildCard(items[index]); return _buildCard(_models[index]);
}, },
separatorBuilder: (context, index) => 20.hb, separatorBuilder: (context, index) {
itemCount: items.length, 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(), bottomNavi: _buildBottomNavi(),
); );
} }

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

Loading…
Cancel
Save