pull/1/head
张萌 3 years ago
parent 59f8aa50b3
commit d88af28f6b

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 8.9 KiB

@ -114,6 +114,12 @@ class _Message {
} }
class _Community { class _Community {
///
String get deleteComment => '/app/user/community/comment/delete';
///
String get deleteDynamic => '/app/user/community/dynamic/delete';
/// ///
String get singleComment => '/app/user/community/comment/findById'; String get singleComment => '/app/user/community/comment/findById';

File diff suppressed because it is too large Load Diff

@ -12,7 +12,7 @@ class MyHouseModel {
final String unitName; final String unitName;
final String manageEstateTypeName; final String manageEstateTypeName;
final int identity; final int identity;
final String name; final String? name;
final String tel; final String tel;
final int isDefault; final int isDefault;
factory MyHouseModel.fromJson(Map<String, dynamic> json) => factory MyHouseModel.fromJson(Map<String, dynamic> json) =>
@ -27,7 +27,7 @@ class MyHouseModel {
required this.unitName, required this.unitName,
required this.manageEstateTypeName, required this.manageEstateTypeName,
required this.identity, required this.identity,
required this.name, this.name,
required this.tel, required this.tel,
required this.isDefault, required this.isDefault,
}); });

@ -15,7 +15,7 @@ MyHouseModel _$MyHouseModelFromJson(Map<String, dynamic> json) => MyHouseModel(
unitName: json['unitName'] as String, unitName: json['unitName'] as String,
manageEstateTypeName: json['manageEstateTypeName'] as String, manageEstateTypeName: json['manageEstateTypeName'] as String,
identity: json['identity'] as int, identity: json['identity'] as int,
name: json['name'] as String, name: json['name'] as String?,
tel: json['tel'] as String, tel: json['tel'] as String,
isDefault: json['isDefault'] as int, isDefault: json['isDefault'] as int,
); );

@ -558,7 +558,7 @@ class _HomePageState extends State<HomePage>
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
if (LoginUtil.isNotLogin) return; if (LoginUtil.isNotLogin) return;
// if (!LoginUtil.haveRoom(ao.title)) return; if (ao.title != '全部应用' && !LoginUtil.haveRealName(ao.title)) return;
if (ao.callback == null) { if (ao.callback == null) {
BotToast.showText( BotToast.showText(
text: '该功能正在准备上线中,敬请期待', align: Alignment(0, 0.5)); text: '该功能正在准备上线中,敬请期待', align: Alignment(0, 0.5));

@ -1,13 +1,11 @@
import 'package:aku_new_community/gen/assets.gen.dart';
import 'package:aku_new_community/pages/services/old_age/submit_equipment_code_page.dart';
import 'package:aku_new_community/widget/bee_back_button.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';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
import 'package:aku_new_community/gen/assets.gen.dart';
import 'package:aku_new_community/pages/services/old_age/submit_equipment_code_page.dart';
import 'package:aku_new_community/widget/bee_back_button.dart';
class AddEquipmentPage extends StatefulWidget { class AddEquipmentPage extends StatefulWidget {
const AddEquipmentPage({Key? key}) : super(key: key); const AddEquipmentPage({Key? key}) : super(key: key);

@ -30,7 +30,7 @@ class _OldAgeSupportPageSimpleState extends State<OldAgeSupportPageSimple> {
@override @override
void initState() { void initState() {
var cancel = BotToast.showLoading(); var cancel = BotToast.showLoading();
getData(); // getData();
cancel(); cancel();
super.initState(); super.initState();
} }

@ -147,4 +147,22 @@ class CommunityFunc {
.map((e) => HomeSwiperModel.fromJson(e)) .map((e) => HomeSwiperModel.fromJson(e))
.toList(); .toList();
} }
///
static Future deleteDynamic(int id) async {
var base = await NetUtil()
.get(SAASAPI.community.deleteDynamic, showMessage: true, params: {
'dynamicId': id,
});
return base.success;
}
///
static Future deleteComment(int id) async {
var base = await NetUtil()
.get(SAASAPI.community.deleteComment, showMessage: true, params: {
'commentId': id,
});
return base.success;
}
} }

@ -170,7 +170,7 @@ class _CommunityPageState extends State<CommunityPage>
..._newItems ..._newItems
.map((e) => ChatCard( .map((e) => ChatCard(
model: e, model: e,
onDelete: () { refresh: () {
_easyRefreshController.callRefresh(); _easyRefreshController.callRefresh();
setState(() {}); setState(() {});
})) }))

@ -6,6 +6,7 @@ import 'package:aku_new_community/model/common/img_model.dart';
import 'package:aku_new_community/models/community/comment_list_model.dart'; import 'package:aku_new_community/models/community/comment_list_model.dart';
import 'package:aku_new_community/models/community/dynamic_detail_model.dart'; import 'package:aku_new_community/models/community/dynamic_detail_model.dart';
import 'package:aku_new_community/provider/user_provider.dart'; import 'package:aku_new_community/provider/user_provider.dart';
import 'package:aku_new_community/ui/community/community_func.dart';
import 'package:aku_new_community/ui/community/community_views/widgets/chat_card.dart'; import 'package:aku_new_community/ui/community/community_views/widgets/chat_card.dart';
import 'package:aku_new_community/ui/community/community_views/widgets/chat_card_detail.dart'; import 'package:aku_new_community/ui/community/community_views/widgets/chat_card_detail.dart';
import 'package:aku_new_community/utils/bee_date_util.dart'; import 'package:aku_new_community/utils/bee_date_util.dart';
@ -25,12 +26,12 @@ import 'package:provider/provider.dart';
class EventDetailPage extends StatefulWidget { class EventDetailPage extends StatefulWidget {
final int dynamicId; final int dynamicId;
final VoidCallback? onDelete; final VoidCallback? refresh;
EventDetailPage({ EventDetailPage({
Key? key, Key? key,
required this.dynamicId, required this.dynamicId,
this.onDelete, this.refresh,
}) : super(key: key); }) : super(key: key);
@override @override
@ -43,7 +44,7 @@ class _EventDetailPageState extends State<EventDetailPage> {
bool get _isMyself { bool get _isMyself {
final userProvider = Provider.of<UserProvider>(context, listen: false); final userProvider = Provider.of<UserProvider>(context, listen: false);
return (userProvider.userInfoModel?.id ?? -1) == widget.dynamicId; return (userProvider.userInfoModel?.id ?? -1) == _model?.createId;
} }
TextEditingController _textEditingController = TextEditingController(); TextEditingController _textEditingController = TextEditingController();
@ -130,10 +131,9 @@ class _EventDetailPageState extends State<EventDetailPage> {
)); ));
if (result == true) { if (result == true) {
if (widget.onDelete != null) { await CommunityFunc.deleteDynamic(widget.dynamicId);
widget.onDelete!();
Get.back(); Get.back();
} widget.refresh!();
} }
} }
}, },
@ -185,6 +185,8 @@ class _EventDetailPageState extends State<EventDetailPage> {
_likes.add(element.isLike); _likes.add(element.isLike);
_likeNums.add(element.likes); _likeNums.add(element.likes);
}); });
} else {
_refreshController.finishLoadCallBack!(noMore: true);
} }
setState(() {}); setState(() {});
}, },
@ -337,7 +339,14 @@ class _EventDetailPageState extends State<EventDetailPage> {
], ],
), ),
Spacer(), Spacer(),
CommunityPopButton(isMyself: false, onSelect: (value) {}) CommunityPopButton(
isMyself: _isMyself,
onSelect: (value) async {
if (_isMyself) {
await CommunityFunc.deleteComment(model.id);
_refreshController.callRefresh();
}
})
].row(), ].row(),
40.hb, 40.hb,
model.content.text.size(28.sp).color(ktextSubColor).make(), model.content.text.size(28.sp).color(ktextSubColor).make(),
@ -608,7 +617,7 @@ class _EventDetailPageState extends State<EventDetailPage> {
if (_textEditingController.text.trim().isEmptyOrNull) { if (_textEditingController.text.trim().isEmptyOrNull) {
BotToast.showText(text: '请填写内容'); BotToast.showText(text: '请填写内容');
return; return;
}else{ } else {
var res = await NetUtil() var res = await NetUtil()
.post(SAASAPI.community.commentInsert, params: params); .post(SAASAPI.community.commentInsert, params: params);
if (res.success) { if (res.success) {

@ -1,11 +1,7 @@
import 'package:aku_new_community/constants/api.dart';
import 'package:aku_new_community/constants/saas_api.dart'; import 'package:aku_new_community/constants/saas_api.dart';
import 'package:aku_new_community/model/common/img_model.dart'; import 'package:aku_new_community/model/common/img_model.dart';
import 'package:aku_new_community/model/community/my_event_item_model.dart';
import 'package:aku_new_community/models/community/dynamic_my_list_body.dart'; import 'package:aku_new_community/models/community/dynamic_my_list_body.dart';
import 'package:aku_new_community/models/community/dynamic_my_list_head.dart'; import 'package:aku_new_community/models/community/dynamic_my_list_head.dart';
import 'package:aku_new_community/pages/things_page/widget/bee_list_view.dart';
import 'package:aku_new_community/ui/community/community_views/widgets/my_event_card.dart';
import 'package:aku_new_community/utils/headers.dart'; import 'package:aku_new_community/utils/headers.dart';
import 'package:aku_new_community/utils/login_util.dart'; import 'package:aku_new_community/utils/login_util.dart';
import 'package:aku_new_community/utils/network/base_list_model.dart'; import 'package:aku_new_community/utils/network/base_list_model.dart';
@ -180,27 +176,6 @@ class MyCommunityViewState extends State<MyCommunityView>
], ],
), ),
); );
BeeListView<MyEventItemModel>(
path: API.community.myEvent,
controller: _refreshController,
convert: (model) {
return model.rows.map((e) => MyEventItemModel.fromJson(e)).toList();
},
builder: (items) {
return ListView.separated(
padding: EdgeInsets.symmetric(vertical: 10.w),
itemBuilder: (context, index) {
final MyEventItemModel model = items[index];
MyEventItemModel? preModel;
if (index >= 1) preModel = items[index - 1];
return MyEventCard(model: model, preModel: preModel);
},
separatorBuilder: (_, __) => 8.hb,
itemCount: items.length,
);
},
);
} }
Widget _getMoments(DynamicMyListBody item) { Widget _getMoments(DynamicMyListBody item) {

@ -41,7 +41,7 @@ class NewCommunityViewState extends State<NewCommunityView>
final item = items[index] as AllDynamicListModel; final item = items[index] as AllDynamicListModel;
return ChatCard( return ChatCard(
model: item, model: item,
onDelete: () { refresh: () {
_refreshController.callRefresh(); _refreshController.callRefresh();
}, },
); );

@ -75,7 +75,7 @@ class _TopicDetailPageState extends State<TopicDetailPage> {
'pageNum': _page, 'pageNum': _page,
'size': 4, 'size': 4,
'topicId': widget.topicId, 'topicId': widget.topicId,
'type': _currentIndex 'type': _currentIndex + 1
}); });
_dynamicList = baseList.rows _dynamicList = baseList.rows
.map((e) => AllDynamicListModel.fromJson(e)) .map((e) => AllDynamicListModel.fromJson(e))
@ -137,7 +137,7 @@ class _TopicDetailPageState extends State<TopicDetailPage> {
padding: EdgeInsets.only(top: 20.w), padding: EdgeInsets.only(top: 20.w),
child: ChatCard( child: ChatCard(
model: _dynamicList[index], model: _dynamicList[index],
onDelete: () { refresh: () {
_refreshController.callRefresh(); _refreshController.callRefresh();
}, },
), ),

@ -1,11 +1,11 @@
import 'dart:math'; import 'dart:math';
import 'package:aku_new_community/base/base_style.dart'; import 'package:aku_new_community/base/base_style.dart';
import 'package:aku_new_community/constants/api.dart';
import 'package:aku_new_community/constants/saas_api.dart'; import 'package:aku_new_community/constants/saas_api.dart';
import 'package:aku_new_community/model/common/img_model.dart'; import 'package:aku_new_community/model/common/img_model.dart';
import 'package:aku_new_community/models/community/all_dynamic_list_model.dart'; import 'package:aku_new_community/models/community/all_dynamic_list_model.dart';
import 'package:aku_new_community/provider/user_provider.dart'; import 'package:aku_new_community/provider/user_provider.dart';
import 'package:aku_new_community/ui/community/community_func.dart';
import 'package:aku_new_community/ui/community/community_views/add_new_event_page.dart'; import 'package:aku_new_community/ui/community/community_views/add_new_event_page.dart';
import 'package:aku_new_community/ui/community/community_views/event_detail_page.dart'; import 'package:aku_new_community/ui/community/community_views/event_detail_page.dart';
import 'package:aku_new_community/utils/bee_date_util.dart'; import 'package:aku_new_community/utils/bee_date_util.dart';
@ -24,7 +24,7 @@ import 'package:velocity_x/velocity_x.dart';
class ChatCard extends StatefulWidget { class ChatCard extends StatefulWidget {
final AllDynamicListModel model; final AllDynamicListModel model;
final VoidCallback? onDelete; final VoidCallback refresh;
final bool hideLine; final bool hideLine;
final bool canTap; final bool canTap;
@ -32,7 +32,7 @@ class ChatCard extends StatefulWidget {
ChatCard({ ChatCard({
Key? key, Key? key,
required this.model, required this.model,
this.onDelete, required this.refresh,
this.hideLine = false, this.hideLine = false,
this.canTap = true, this.canTap = true,
}) : super(key: key); }) : super(key: key);
@ -143,7 +143,7 @@ class _ChatCardState extends State<ChatCard> {
), ),
20.wb, 20.wb,
GestureDetector( GestureDetector(
onTap: widget.model.isComment == 1 ? () async {} : () async {}, onTap: () => Get.to(EventDetailPage(dynamicId: widget.model.id)),
child: Material( child: Material(
color: Colors.transparent, color: Colors.transparent,
child: Row( child: Row(
@ -184,10 +184,11 @@ class _ChatCardState extends State<ChatCard> {
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
onPressed: widget.canTap onPressed: widget.canTap
? () async { ? () async {
Get.to(() => EventDetailPage( await Get.to(() => EventDetailPage(
dynamicId: widget.model.id, dynamicId: widget.model.id,
onDelete: widget.onDelete, refresh: widget.refresh,
)); ));
widget.refresh();
} }
: null, : null,
child: Column( child: Column(
@ -264,12 +265,8 @@ class _ChatCardState extends State<ChatCard> {
)); ));
if (result == true) { if (result == true) {
await NetUtil().get( await CommunityFunc.deleteDynamic(widget.model.id);
API.community.deleteMyEvent, widget.refresh();
params: {'themeId': widget.model.id},
showMessage: true,
);
if (widget.onDelete != null) widget.onDelete!();
} }
} }
}, },
@ -334,7 +331,7 @@ class CommunityPopButton extends StatelessWidget {
) )
: PopupMenuItem( : PopupMenuItem(
child: '举报'.text.isIntrinsic.make(), child: '举报'.text.isIntrinsic.make(),
value: 0, value: 1,
), ),
]; ];
}, },

@ -1,120 +0,0 @@
import 'package:aku_new_community/constants/saas_api.dart';
import 'package:aku_new_community/model/common/img_model.dart';
import 'package:aku_new_community/model/community/my_event_item_model.dart';
import 'package:aku_new_community/models/community/dynamic_detail_model.dart';
import 'package:aku_new_community/provider/user_provider.dart';
import 'package:aku_new_community/ui/community/community_views/event_detail_page.dart';
import 'package:aku_new_community/utils/bee_date_util.dart';
import 'package:aku_new_community/utils/headers.dart';
import 'package:aku_new_community/utils/network/base_model.dart';
import 'package:aku_new_community/utils/network/net_util.dart';
import 'package:aku_new_community/widget/picker/bee_image_preview.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';
import 'package:velocity_x/velocity_x.dart';
class MyEventCard extends StatelessWidget {
final MyEventItemModel model;
final MyEventItemModel? preModel;
const MyEventCard({
Key? key,
required this.model,
required this.preModel,
}) : super(key: key);
bool get isFirst => preModel == null;
bool get notSameYear => model.date!.year != (preModel?.date?.year ?? 0);
BeeDateUtil get beeDate => BeeDateUtil(model.date);
bool get sameDay =>
model.date!.year == (preModel?.date?.year ?? 0) &&
model.date!.month == (preModel?.date?.month ?? 0) &&
model.date!.day == (preModel?.date?.day ?? 0);
Widget title() {
if (beeDate.sameDay) return '今天'.text.size(52.sp).bold.make();
if (beeDate.isYesterday)
return '昨天'.text.size(52.sp).bold.make();
else
return Row(
mainAxisSize: MainAxisSize.min,
children: [
model.date!.day.toString().text.size(52.sp).bold.make(),
'${model.date!.month}'.text.size(36.sp).make(),
],
);
}
@override
Widget build(BuildContext context) {
final userProvider = Provider.of<UserProvider>(context);
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
(notSameYear && model.date!.year != DateTime.now().year)
? '${model.date!.year}'
.text
.bold
.size(52.sp)
.make()
.paddingOnly(left: 32.w, top: isFirst ? 0 : 64.w, bottom: 32.w)
: SizedBox(),
MaterialButton(
onPressed: () async {
BaseModel models = await NetUtil().get(
SAASAPI.community.dynamicDetail,
params: {'dynamicId': model.id},
);
DynamicDetailModel eventItemModel =
DynamicDetailModel.fromJson(models.data);
Get.to(() => EventDetailPage(
dynamicId: model.id ?? 0,
));
},
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: 200.w,
padding: EdgeInsets.only(left: 32.w),
alignment: Alignment.topLeft,
child: sameDay ? SizedBox() : title(),
),
model.imgUrl!.length == 0
? SizedBox(height: 152.w)
: GestureDetector(
onTap: () {
BeeImagePreview.toPath(
path: ImgModel.first(model.imgUrl),
tag: ImgModel.first(model.imgUrl),
);
},
child: Container(
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
color: Colors.black12,
borderRadius: BorderRadius.circular(8.w),
),
child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
image: SAASAPI.image(ImgModel.first(model.imgUrl)),
width: 152.w,
height: 152.w,
fit: BoxFit.cover,
),
),
),
10.wb,
model.content!.text.make().expand(),
],
),
),
],
);
}
}

@ -130,10 +130,11 @@ class _PublishTaskPageState extends State<PublishTaskPage> {
BotToast.showText(text: base.msg); BotToast.showText(text: base.msg);
} }
} catch (e) { } catch (e) {
print(22222);
print(e.toString()); print(e.toString());
} }
} }
var imgs; var imgs = <String>[];
if (_photos.isNotEmpty) { if (_photos.isNotEmpty) {
try { try {
imgs = await NetUtil() imgs = await NetUtil()

@ -38,7 +38,7 @@ class _AllApplicationPageState extends State<AllApplicationPage> {
? null ? null
: () { : () {
if (LoginUtil.isNotLogin) return; if (LoginUtil.isNotLogin) return;
if (!LoginUtil.haveRoom(object.title)) return; if (!LoginUtil.haveRealName(object.title)) return;
if (object.callback == null || !online) { if (object.callback == null || !online) {
BotToast.showText( BotToast.showText(
text: '正在准备上线中,敬请期待', align: Alignment(0, 0.5)); text: '正在准备上线中,敬请期待', align: Alignment(0, 0.5));

@ -77,7 +77,7 @@ class _BeeSearchState extends State<BeeSearch> {
return MaterialButton( return MaterialButton(
onPressed: () { onPressed: () {
if (LoginUtil.isNotLogin) return; if (LoginUtil.isNotLogin) return;
if (!LoginUtil.haveRoom(e.title)) return; if (!LoginUtil.haveRealName(e.title)) return;
if (e.callback == null) { if (e.callback == null) {
BotToast.showText(text: '该功能正在准备上线中,敬请期待', align: Alignment(0, 0.5)); BotToast.showText(text: '该功能正在准备上线中,敬请期待', align: Alignment(0, 0.5));
} else { } else {

@ -30,15 +30,21 @@ class LoginUtil {
/// ///
static bool get isNotLogin => !isLogin; static bool get isNotLogin => !isLogin;
static bool haveRoom(String name) { static bool haveRealName(String name) {
if (!name.contains(RegExp('访客邀请|报事报修|建议咨询|生活缴费|物品出门|投诉表扬|我的访客|我的报修|我的缴费'))) // if (!name.contains(RegExp('访客邀请|报事报修|建议咨询|生活缴费|物品出门|投诉表扬|我的访客|我的报修|我的缴费')))
return true; // return true;
final userProvider = Provider.of<UserProvider>(Get.context!, listen: false); final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
if (userProvider.userInfoModel!.name == null) { if (userProvider.userInfoModel!.name == null) {
BotToast.showText(text: '请先实名认证');
Get.dialog(CertificationDialog()); Get.dialog(CertificationDialog());
return false; return false;
} }
return true;
}
static bool haveRoom(String name) {
// if (!name.contains(RegExp('访客邀请|报事报修|建议咨询|生活缴费|物品出门|投诉表扬|我的访客|我的报修|我的缴费')))
// return true;
final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
if (userProvider.defaultHouse == null) { if (userProvider.defaultHouse == null) {
BotToast.showText(text: '请先选择默认房屋'); BotToast.showText(text: '请先选择默认房屋');
Get.to(() => MyHousePage()); Get.to(() => MyHousePage());

@ -9,14 +9,14 @@ class StackAvatar extends StatelessWidget {
double get offset => 35.w; double get offset => 35.w;
int get length => avatars.length; int get length => avatars.length > 3 ? 3 : avatars.length;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Stack( return Stack(
children: [ children: [
SizedBox( SizedBox(
width: 44.w * 2 + 26.w, width: 44.w * length + 26.w,
height: 44.w + 6.w, height: 44.w + 6.w,
), ),
...List.generate(length, (index) { ...List.generate(length, (index) {

@ -34,7 +34,7 @@ class _ApplicationViewState extends State<ApplicationView> {
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
onPressed: () { onPressed: () {
if (LoginUtil.isNotLogin) return; if (LoginUtil.isNotLogin) return;
if (!LoginUtil.haveRoom(object.title)) return; if (!LoginUtil.haveRealName(object.title)) return;
if (object.callback == null) { if (object.callback == null) {
BotToast.showText(text: '该功能正在准备上线中,敬请期待', align: Alignment(0, 0.5)); BotToast.showText(text: '该功能正在准备上线中,敬请期待', align: Alignment(0, 0.5));
} else { } else {

Loading…
Cancel
Save