newHost
王亚玲 2 years ago
parent d373d9e528
commit c3e6506c1d

@ -1,3 +1,5 @@
import 'package:aku_new_community/pages/setting_page/blacklist_page/blacklist_page.dart';
class API { class API {
///HOST ///HOST
static const String host = 'http://121.41.26.225:8006'; static const String host = 'http://121.41.26.225:8006';

@ -100,6 +100,15 @@ class _User {
/// ///
String get updateAvatar => '/app/user/updateAvatarImg'; String get updateAvatar => '/app/user/updateAvatarImg';
///
String get blackList => '/app/user/community/blackList/list';
///
String get cancelBlock => '/app/user/community/blackList/cancelBlock';
///
String get Block => '/app/user/community/blackList/block';
} }
class _Login { class _Login {
@ -450,6 +459,7 @@ class _Facilities {
class _Updater { class _Updater {
///app ///app
String get findNewVersion => '/app/version/findNewVersion'; String get findNewVersion => '/app/version/findNewVersion';
///app ///app
String get insert => '/app/version/insert'; String get insert => '/app/version/insert';
} }

@ -0,0 +1,25 @@
import 'package:json_annotation/json_annotation.dart';
import 'package:equatable/equatable.dart';
part 'blacklist_model.g.dart';
@JsonSerializable()
class BlacklistModel extends Equatable {
int id;
List imgList;
String name;
factory BlacklistModel.fromJson(Map<String, dynamic> json) =>
_$BlacklistModelFromJson(json);
BlacklistModel({
required this.id,
required this.imgList,
required this.name,
});
@override
List<Object?> get props => [id, imgList, name,];
}

@ -0,0 +1,14 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'blacklist_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
BlacklistModel _$BlacklistModelFromJson(Map<String, dynamic> json) =>
BlacklistModel(
id: json['id'] as int,
imgList: json['imgList'] as List<dynamic>,
name: json['name'] as String,
);

@ -0,0 +1,40 @@
import 'package:aku_new_community/constants/saas_api.dart';
import 'package:aku_new_community/model/user/blacklist_model.dart';
import 'package:aku_new_community/utils/network/base_list_model.dart';
import 'package:aku_new_community/utils/network/base_model.dart';
import 'package:aku_new_community/utils/network/net_util.dart';
class BlackListFunc {
///
static Future<List<BlacklistModel>> getBlackList() async {
BaseListModel model = await NetUtil().getList(
SAASAPI.user.blackList,
params: {
'pageNum': 1,
'size': 9,
},
);
if (model.rows.length == 0) return [];
return model.rows.map((e) => BlacklistModel.fromJson(e)).toList();
}
///
static Future<bool> cancelBlock(int userId) async {
var base = await NetUtil().get(SAASAPI.user.cancelBlock,
params: {
'userId': userId,
},
showMessage: true);
return base.success;
}
///
static Future<bool> Block(int userId) async {
var base = await NetUtil().get(SAASAPI.user.Block,
params: {
'userId': userId,
},
showMessage: true);
return base.success;
}
}

@ -0,0 +1,216 @@
import 'package:aku_new_community/base/base_style.dart';
import 'package:aku_new_community/gen/assets.gen.dart';
import 'package:aku_new_community/model/user/blacklist_model.dart';
import 'package:aku_new_community/pages/setting_page/blacklist_page/blacklist_func.dart';
import 'package:aku_new_community/widget/dialog/bee_custom_dialog.dart';
import 'package:aku_new_community/widget/others/user_tool.dart';
import 'package:flutter/material.dart';
import 'package:aku_new_community/utils/headers.dart';
import 'package:aku_new_community/widget/bee_scaffold.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:get/get.dart';
class blackListPage extends StatefulWidget {
blackListPage({Key? key}) : super(key: key);
@override
_blackListPageState createState() => _blackListPageState();
}
class _blackListPageState extends State<blackListPage> {
List<BlacklistModel> blackList = [];
// List blackList2 = [
// {
// 'id': 1,
// 'name': '天天',
// 'img': [
// Assets.images.vegetableBanner.path,
// Assets.images.vegetableBanner.path
// ]
// },
// {
// 'id': 1,
// 'name': '天天',
// 'img': [
// Assets.images.vegetableBanner.path,
// Assets.images.vegetableBanner.path
// ]
// },
// {
// 'id': 1,
// 'name': '天天',
// 'img': [
// Assets.images.vegetableBanner.path,
// Assets.images.vegetableBanner.path
// ]
// }
// ];
final EasyRefreshController _refreshController = EasyRefreshController();
@override
void initState() {
super.initState();
// ///appbar refresh
// Future.delayed(Duration(milliseconds: 0), () async {
// await _refresh();
// setState(() {});
// });
}
@override
void dispose() {
_refreshController.dispose();
super.dispose();
}
// Future _refresh() async {
// blackList = await BlackListFunc.getBlackList();
// }
@override
Widget build(BuildContext context) {
return BeeScaffold(
title: '黑名单列表',
body: Column(
children: [
Container(
color: Color(0xF000000).withOpacity(0.06),
width: MediaQuery.of(context).size.width,
height: 75.w,
alignment: Alignment.center,
child: Text.rich(TextSpan(children: [
TextSpan(
text: '点击',
style:
TextStyle(fontSize: 24.sp, color: Color(0xA6000000))),
TextSpan(
text: ' 移出黑名单 ',
style: TextStyle(fontSize: 24.sp, color: Colors.blue)),
TextSpan(
text: '即可在社区中显示对方的动态',
style:
TextStyle(fontSize: 24.sp, color: Color(0xA6000000))),
])),
),
Expanded(
child: EasyRefresh(
firstRefresh: true,
header: MaterialHeader(),
footer: MaterialFooter(),
controller: _refreshController,
onRefresh: () async {
blackList = await BlackListFunc.getBlackList();
// blackList = [
// BlacklistModel(
// id: 0,
// imgList: [Assets.images.vegetableBanner.path],
// name: '张天天')
// ];
setState(() {});
// _page
},
onLoad: () async {},
child: ListView.builder(
itemBuilder: (context, index) {
return _blackList(blackList[index]);
},
itemCount: blackList.length,
)))
],
));
}
_blackList(BlacklistModel model) {
return Column(
children: [
ListTile(
leading: Container(
width: 88.w,
height: 88.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(40),
image: DecorationImage(
image: ExactAssetImage(
R.ASSETS_IMAGES_PLACEHOLDER_WEBP ?? model.imgList.first,
),
fit: BoxFit.cover)),
),
title: Text(
_getText(model.name),
style: TextStyle(fontSize: 28.sp, color: ktextSubColor),
),
trailing: GestureDetector(
onTap: () async {
await Get.dialog(
BeeCustomDialog(
height: 247.w,
content: Padding(
padding: EdgeInsets.only(top: 64.w),
child: Text(
'确认将该用户移出黑名单列表吗',
style: UserTool.myAppStyle.dialogContentText,
)),
actions: [
MaterialButton(
onPressed: () {
Get.back();
},
child: Text('考虑一下',
style: TextStyle(
fontSize: 28.w,
color: Colors.black.withOpacity(0.45))),
),
MaterialButton(
onPressed: () async {
var cancelBlock =
await BlackListFunc.cancelBlock(model.id);
if (cancelBlock) {
Get.back();
_refreshController.callRefresh();
}
},
child: Text('确认移出',
style: UserTool.myAppStyle.dialogActionButtonText),
),
],
),
// barrierDismissible: false,
);
},
child: '移出黑名单'.text.size(24.sp).color(Colors.blue).make()),
),
Divider()
],
);
}
_getText(String name) {
String name2 = name.substring(0, 1);
for (var i = 0; i < name.length - 1; i++) {
name2 += '*';
}
return name2;
}
// _blackList(BlacklistModel model) {
// return ListTile(
// leading: Container(
// width: 88.w,
// height: 88.w,
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(40),
// image: DecorationImage(
// image: ExactAssetImage(model.imgList.first),
// fit: BoxFit.cover)),
// ),
// title: model.name.text.size(20.sp).color(ktextSubColor).make(),
// subtitle: GestureDetector(
// onTap: () {},
// child: '移出黑名单'.text.size(24.sp).color(Colors.blue).make()),
// );
// }
}

@ -19,6 +19,7 @@ import 'package:aku_new_community/widget/bee_scaffold.dart';
import 'package:aku_new_community/widget/others/user_tool.dart'; import 'package:aku_new_community/widget/others/user_tool.dart';
import 'account_manager_page.dart'; import 'account_manager_page.dart';
import 'blacklist_page/blacklist_page.dart';
import 'feedback_page/feedback_page.dart'; import 'feedback_page/feedback_page.dart';
class SettingsPage extends StatefulWidget { class SettingsPage extends StatefulWidget {
@ -155,6 +156,10 @@ class _SettingsPageState extends State<SettingsPage> {
title: '隐私政策', title: '隐私政策',
onTap: () => Get.to(() => PrivacyPage()), onTap: () => Get.to(() => PrivacyPage()),
), ),
_buildTile(
title: '社区黑名单',
onTap: () => Get.to(() => blackListPage()),
),
].sepWidget( ].sepWidget(
separate: Divider( separate: Divider(
indent: 32.w, indent: 32.w,

@ -1,3 +1,4 @@
import 'package:aku_new_community/utils/headers.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:bot_toast/bot_toast.dart'; import 'package:bot_toast/bot_toast.dart';
@ -190,9 +191,15 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
BotToast.showText(text: base.msg); BotToast.showText(text: base.msg);
} }
}, },
text: clockTimer.timerStart text:
? '${clockTimer.second}秒后重新获取' clockTimer.timerStart ? '${clockTimer.second}秒后重新获取' : '获取验证码'),
: '获取验证码'), 32.hb,
IconButton(
icon: Icon(Icons.ac_unit_outlined),
onPressed: () {
//Get.to(() => RootPage());
},
),
24.w.heightBox, 24.w.heightBox,
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,

@ -1,5 +1,6 @@
import 'dart:math'; import 'dart:math';
import 'package:aku_new_community/pages/setting_page/blacklist_page/blacklist_func.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -120,8 +121,29 @@ class _EventDetailPageState extends State<EventDetailPage> {
actions: [ actions: [
(CommunityPopButton( (CommunityPopButton(
isMyself: _isMyself, isMyself: _isMyself,
onSelect: (dynamic _) async { onSelect: (int value) async {
if (LoginUtil.isNotLogin) return; if (LoginUtil.isNotLogin) return;
if (value == 3) {
await Get.dialog(CupertinoAlertDialog(
title: '你确定要拉黑他吗'.text.isIntrinsic.make(),
actions: [
CupertinoDialogAction(
child: '取消'.text.black.isIntrinsic.make(),
onPressed: () => Get.back(),
),
CupertinoDialogAction(
child: '确定'.text.color(Colors.orange).isIntrinsic.make(),
onPressed: () async {
var isShielding =
await BlackListFunc.Block(widget.dynamicId);
if (isShielding) {
Get.back();
}
},
),
],
));
} else {
if (!_isMyself) { if (!_isMyself) {
VoidCallback cancel = BotToast.showLoading(); VoidCallback cancel = BotToast.showLoading();
await Future.delayed( await Future.delayed(
@ -149,6 +171,7 @@ class _EventDetailPageState extends State<EventDetailPage> {
widget.refresh!(); widget.refresh!();
} }
} }
}
}, },
)).paddingOnly(right: 32.w), )).paddingOnly(right: 32.w),
], ],

@ -1,5 +1,6 @@
import 'dart:math'; import 'dart:math';
import 'package:aku_new_community/pages/setting_page/blacklist_page/blacklist_func.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -144,7 +145,10 @@ class _ChatCardState extends State<ChatCard> {
), ),
20.wb, 20.wb,
GestureDetector( GestureDetector(
onTap: () => Get.to(EventDetailPage(dynamicId: widget.model.id,createId: widget.model.createId,)), onTap: () => Get.to(EventDetailPage(
dynamicId: widget.model.id,
createId: widget.model.createId,
)),
child: Material( child: Material(
color: Colors.transparent, color: Colors.transparent,
child: Row( child: Row(
@ -247,11 +251,32 @@ class _ChatCardState extends State<ChatCard> {
], ],
), ),
Spacer(), Spacer(),
CommunityPopButton( CommunityPopButton(
isMyself: _isMyself, isMyself: _isMyself,
onSelect: (dynamic _) async { onSelect: (int value) async {
if (LoginUtil.isNotLogin) return; if (LoginUtil.isNotLogin) return;
if (value == 3) {
await Get.dialog(CupertinoAlertDialog(
title: '你确定要拉黑他吗'.text.isIntrinsic.make(),
actions: [
CupertinoDialogAction(
child: '取消'.text.black.isIntrinsic.make(),
onPressed: () => Get.back(),
),
CupertinoDialogAction(
child:
'确定'.text.color(Colors.orange).isIntrinsic.make(),
onPressed: () async {
var isShielding =
await BlackListFunc.Block(widget.model.id);
if (isShielding) {
Get.back();
}
},
),
],
));
} else {
if (!_isMyself) { if (!_isMyself) {
VoidCallback cancel = BotToast.showLoading(); VoidCallback cancel = BotToast.showLoading();
await Future.delayed( await Future.delayed(
@ -267,18 +292,21 @@ class _ChatCardState extends State<ChatCard> {
onPressed: () => Get.back(), onPressed: () => Get.back(),
), ),
CupertinoDialogAction( CupertinoDialogAction(
child: child: '确定'
'确定'.text.color(Colors.orange).isIntrinsic.make(), .text
.color(Colors.orange)
.isIntrinsic
.make(),
onPressed: () => Get.back(result: true), onPressed: () => Get.back(result: true),
), ),
], ],
)); ));
if (result == true) { if (result == true) {
await CommunityFunc.deleteDynamic(widget.model.id); await CommunityFunc.deleteDynamic(widget.model.id);
widget.refresh(); widget.refresh();
} }
} }
}
}, },
).paddingOnly(right: 32.w), ).paddingOnly(right: 32.w),
].row(crossAlignment: CrossAxisAlignment.start), ].row(crossAlignment: CrossAxisAlignment.start),
@ -334,6 +362,10 @@ class CommunityPopButton extends StatelessWidget {
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8.w)), shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8.w)),
itemBuilder: (context) { itemBuilder: (context) {
return [ return [
PopupMenuItem(
child: '拉黑'.text.isIntrinsic.make(),
value: 3,
),
isMyself isMyself
? PopupMenuItem( ? PopupMenuItem(
child: '删除'.text.isIntrinsic.make(), child: '删除'.text.isIntrinsic.make(),

@ -1,6 +1,8 @@
import 'dart:ui' as ui; import 'dart:ui' as ui;
import 'package:aku_new_community/provider/user_provider.dart';
import 'package:aku_new_community/ui/market/vegetable_market/seasonal_vegetables.dart'; import 'package:aku_new_community/ui/market/vegetable_market/seasonal_vegetables.dart';
import 'package:aku_new_community/utils/hive_store.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:card_swiper/card_swiper.dart'; import 'package:card_swiper/card_swiper.dart';
@ -493,7 +495,9 @@ class _MarketPageState extends State<MarketPage>
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
/// ///
Get.to(() => SeasonalVegetables()); Get.to(() => SeasonalVegetables(
searchText: '',
));
}, },
child: Assets.images.vegetableBanner.image(width: 712.w, height: 200.w), child: Assets.images.vegetableBanner.image(width: 712.w, height: 200.w),
); );
@ -1048,6 +1052,15 @@ class _MarketPageState extends State<MarketPage>
)); ));
} }
///
saveSearchListToSharedPreferences(String value) async {
final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
HiveStore.appBox!.put(
userProvider.userInfoModel?.id.toString() ?? '' + "userSearhHistory",
value);
}
_goodsTitle( _goodsTitle(
Widget normalTypeButton, Widget normalTypeButton,
Widget salesTypeButton, Widget salesTypeButton,

@ -556,6 +556,7 @@ class SearchGoodsPageState extends State<SearchGoodsPage> {
setState(() {}); setState(() {});
} }
///
_hotGoodsCard(GoodsPopularModel goodsItem, int index) { _hotGoodsCard(GoodsPopularModel goodsItem, int index) {
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {

@ -17,7 +17,10 @@ import '../../../gen/assets.gen.dart';
import '../search/search_goods_page.dart'; import '../search/search_goods_page.dart';
class SeasonalVegetables extends StatefulWidget { class SeasonalVegetables extends StatefulWidget {
const SeasonalVegetables({Key? key}) : super(key: key); final String searchText;
const SeasonalVegetables({Key? key, required this.searchText})
: super(key: key);
@override @override
_SeasonalVegetablesState createState() => _SeasonalVegetablesState(); _SeasonalVegetablesState createState() => _SeasonalVegetablesState();
@ -53,7 +56,7 @@ class _SeasonalVegetablesState extends State<SeasonalVegetables> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final userProvider = Provider.of<UserProvider>(context, listen: false); //final userProvider = Provider.of<UserProvider>(context, listen: false);
final normalTypeButton = MaterialButton( final normalTypeButton = MaterialButton(
onPressed: () { onPressed: () {
_orderType = OrderType.NORMAL; _orderType = OrderType.NORMAL;
@ -137,10 +140,10 @@ class _SeasonalVegetablesState extends State<SeasonalVegetables> {
_orderType == OrderType.PRICE_LOW _orderType == OrderType.PRICE_LOW
? 32.sp ? 32.sp
: 28.sp, : 28.sp,
// fontWeight: _orderType == OrderType.PRICE_HIGH || fontWeight: _orderType == OrderType.PRICE_HIGH ||
// _orderType == OrderType.PRICE_LOW _orderType == OrderType.PRICE_LOW
// ? FontWeight.bold ? FontWeight.bold
// : FontWeight.normal, : FontWeight.normal,
), ),
), ),
// Icon( // Icon(
@ -272,15 +275,14 @@ class _SeasonalVegetablesState extends State<SeasonalVegetables> {
20.wb, 20.wb,
GestureDetector( GestureDetector(
onTap: () { onTap: () {
if (TextUtils.isEmpty(_searchText)) return;
_startSearch = true;
_contentFocusNode.unfocus();
_searchText = _searchText.trimLeft();
_searchText = _searchText.trimRight();
remember();
saveSearchListToSharedPreferences(_searchHistory);
_refreshController.callRefresh(); _refreshController.callRefresh();
// if (TextUtils.isEmpty(_searchText)) return;
// _startSearch = true;
// _contentFocusNode.unfocus();
// _searchText = _searchText.trimLeft();
// _searchText = _searchText.trimRight();
// remember();
// saveSearchListToSharedPreferences(_searchHistory);
setState(() {}); setState(() {});
}, },
child: Text( child: Text(
@ -299,6 +301,8 @@ class _SeasonalVegetablesState extends State<SeasonalVegetables> {
child: _goodsTitle(normalTypeButton, salesTypeButton, child: _goodsTitle(normalTypeButton, salesTypeButton,
priceButton, listButton)), priceButton, listButton)),
), ),
_searchHistoryWidget(),
10.hb,
Expanded( Expanded(
child: EasyRefresh( child: EasyRefresh(
firstRefresh: true, firstRefresh: true,
@ -326,18 +330,17 @@ class _SeasonalVegetablesState extends State<SeasonalVegetables> {
)); ));
} }
_goodsTitle(Widget normalTypeButton, _goodsTitle(
Widget normalTypeButton,
Widget salesTypeButton, Widget salesTypeButton,
Widget priceButton, Widget priceButton,
Widget listButton,) { Widget listButton,
) {
return Container( return Container(
height: 90.w, height: 90.w,
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
color: Colors.white, color: Colors.white,
width: MediaQuery width: MediaQuery.of(context).size.width,
.of(context)
.size
.width,
child: Container( child: Container(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
height: 60.w, height: 60.w,
@ -389,9 +392,8 @@ class _SeasonalVegetablesState extends State<SeasonalVegetables> {
_editingController.text = text; _editingController.text = text;
_searchText = text; _searchText = text;
setState(() {}); setState(() {});
FocusManager.instance.primaryFocus!.unfocus(); FocusManager.instance.primaryFocus!.unfocus();
_refreshController1.callRefresh(); _refreshController.callRefresh();
}, },
label: Text(text), label: Text(text),
selected: false, selected: false,
@ -441,10 +443,7 @@ class _SeasonalVegetablesState extends State<SeasonalVegetables> {
)), )),
), ),
Container( Container(
width: MediaQuery width: MediaQuery.of(context).size.width,
.of(context)
.size
.width,
padding: EdgeInsets.only(left: 10, right: 10), padding: EdgeInsets.only(left: 10, right: 10),
child: Wrap( child: Wrap(
children: choiceChipList, children: choiceChipList,

@ -74,7 +74,6 @@ class BeeScaffold extends StatelessWidget {
actions: actions, actions: actions,
bottom: appBarBottom, bottom: appBarBottom,
titleSpacing: titleSpacing, titleSpacing: titleSpacing,
); );
return AnnotatedRegion<SystemUiOverlayStyle>( return AnnotatedRegion<SystemUiOverlayStyle>(

@ -7,8 +7,13 @@ class BeeCustomDialog extends StatelessWidget {
final Widget content; final Widget content;
final double? width; final double? width;
final double? height; final double? height;
const BeeCustomDialog( const BeeCustomDialog(
{Key? key, required this.actions, required this.content, this.width, this.height}) {Key? key,
required this.actions,
required this.content,
this.width,
this.height})
: super(key: key); : super(key: key);
@override @override
@ -30,11 +35,13 @@ class BeeCustomDialog extends StatelessWidget {
end: Alignment.bottomCenter, end: Alignment.bottomCenter,
stops: [ stops: [
0, 0,
0.3, 0.35,
], ],
colors: [ colors: [
Color(0x33FBE541), Color(0x33FBE541),
Colors.white, Color(0x33FBE541).withOpacity(0.01),
//Colors.white,
])), ])),
child: Column( child: Column(
children: [ children: [

Loading…
Cancel
Save