Browse Source

社群更改

remove_uniapp
w-R 3 years ago
parent
commit
61bb9d7930
  1. 120
      lib/community/community_child_page.dart
  2. 964
      lib/mine/personal_page.dart
  3. 1
      lib/order/order_view/order_info.dart
  4. 2
      lib/store/store_view/shop_goods.dart

120
lib/community/community_child_page.dart

@ -36,7 +36,6 @@ class CommunityChildPageState extends State<CommunityChildPage> with AutomaticKe
bool isRefresh = true; bool isRefresh = true;
bool isLoadingData = false; bool isLoadingData = false;
ScrollController sc = ScrollController(); ScrollController sc = ScrollController();
List<Article> articles = []; List<Article> articles = [];
@override @override
@ -53,7 +52,7 @@ class CommunityChildPageState extends State<CommunityChildPage> with AutomaticKe
} }
/// ///
queryCommunity() async { queryCommunity(String searchKey) async {
if(!isRefresh){ if(!isRefresh){
isRefresh = true; isRefresh = true;
return; return;
@ -76,45 +75,70 @@ class CommunityChildPageState extends State<CommunityChildPage> with AutomaticKe
pageNum += 1; pageNum += 1;
isLoadMore = false; isLoadMore = false;
} }
else pageNum = 1; else if(searchKey == null)pageNum = 1;
BaseData<PageInfo<ComunityComment>> baseData = await apiService.trendList({ BaseData<PageInfo<ComunityComment>> baseData = await apiService.trendList({
"mid":"", "mid":"",
"onlyFollow": widget.typeStr == "关注" ? true : false, "onlyFollow": widget.typeStr == "关注" ? true : false,
"onlyMe": false, "onlyMe": false,
"pageNum": pageNum, "pageNum": searchKey == null?pageNum:1,
"pageSize": 10, "pageSize": 10,
"searchKey": "" "searchKey": searchKey??""
}).catchError((error) { }).catchError((error) {
refreshController.refreshFailed(); if(searchKey == null) {
refreshController.loadFailed(); refreshController.refreshFailed();
refreshController.loadFailed();
}
}); });
if(searchKey == null) {
refreshController.refreshCompleted(); refreshController.refreshCompleted();
refreshController.loadComplete(); refreshController.loadComplete();
}
if (baseData.isSuccess) { if (baseData.isSuccess) {
if (pageNum == 1) { if(searchKey != null){
articles.clear(); if(baseData?.data?.list != null && baseData.data.list.isNotEmpty)
} articles.forEach((element) {
baseData.data.list.forEach((element) { if(element.id == searchKey){
var article = Article(); element.content = jsonEncode(baseData.data.list[0].subjectInfo);
article.id = element.id; element.mainTitle =baseData.data.list[0].subject;
article.content = jsonEncode(element.subjectInfo); element.followed = baseData.data.list[0].selfFollow;
article.mainTitle =element.subject; element.authorHeadImg = baseData.data.list[0].memberInfo?.avatar;
article.followed = element.selfFollow; element.authorName = baseData.data.list[0].memberInfo?.nickname;
article.authorHeadImg = element.memberInfo?.avatar; element.location = baseData.data.list[0].location;
article.authorName = element.memberInfo?.nickname; element.createTime = baseData.data.list[0].createTime;
article.location = element.location; element.author = baseData.data.list[0].memberInfo?.mid;
article.createTime = element.createTime; element.viewers = baseData.data.list[0]?.viewers;
article.author = element.memberInfo?.mid; element.likes = baseData.data.list[0]?.likes;
article.viewers = element?.viewers; element.comments = baseData.data.list[0]?.comments;
article.likes = element?.likes; this.isRefresh = false;
article.comments = element?.comments; setState(() {
articles.add(article); });
}); }
// comments.sort((a,b)=>b.createTime.compareTo(a.createTime)); });
// print("comments: ${comments.length}"); }else{
if (int.tryParse(baseData.data.total) < (pageNum * 10)) { if (pageNum == 1) {
refreshController.loadNoData(); articles.clear();
}
baseData.data.list.forEach((element) {
var article = Article();
article.id = element.id;
article.content = jsonEncode(element.subjectInfo);
article.mainTitle =element.subject;
article.followed = element.selfFollow;
article.authorHeadImg = element.memberInfo?.avatar;
article.authorName = element.memberInfo?.nickname;
article.location = element.location;
article.createTime = element.createTime;
article.author = element.memberInfo?.mid;
article.viewers = element?.viewers;
article.likes = element?.likes;
article.comments = element?.comments;
articles.add(article);
});
// comments.sort((a,b)=>b.createTime.compareTo(a.createTime));
// print("comments: ${comments.length}");
if (int.tryParse(baseData.data.total) < (pageNum * 10)) {
refreshController.loadNoData();
}
} }
} }
@ -125,7 +149,7 @@ class CommunityChildPageState extends State<CommunityChildPage> with AutomaticKe
Widget build(BuildContext context) { Widget build(BuildContext context) {
super.build(context); super.build(context);
return FutureBuilder( return FutureBuilder(
future: queryCommunity(), future: queryCommunity(null),
builder: (context, position) { builder: (context, position) {
return SmartRefresher( return SmartRefresher(
controller: refreshController, controller: refreshController,
@ -172,7 +196,7 @@ class CommunityChildPageState extends State<CommunityChildPage> with AutomaticKe
"userId": userId, "userId": userId,
}, },
).then((value) { ).then((value) {
queryDetails(articles[position].id); queryCommunity(articles[position].id);
// onRefresh(); // onRefresh();
// setState(() {}); // setState(() {});
}); });
@ -187,32 +211,6 @@ class CommunityChildPageState extends State<CommunityChildPage> with AutomaticKe
); );
} }
///
queryDetails(id) async {
SharedPreferences value = await SharedPreferences.getInstance();
if (apiService == null)
apiService = ApiService(
Dio(),
context: context,
token: value.getString("token"),
);
BaseData<Article> baseData = await apiService.informationInfo(id)
.catchError((onError) {
debugPrint(onError.toString());
});
if (baseData != null && baseData.isSuccess) {
this.articles.forEach((element) {
if(element.id == id){
isRefresh = false;
setState(() {
element.likes = baseData.data.likes;
element.viewers = baseData.data.viewers;
});
}
});
}
}
@override @override
bool get wantKeepAlive => true; bool get wantKeepAlive => true;
} }

964
lib/mine/personal_page.dart

File diff suppressed because it is too large Load Diff

1
lib/order/order_view/order_info.dart

@ -102,6 +102,7 @@ class _OrderInfoView extends State<OrderInfoView> {
color: Color(0xFF353535), color: Color(0xFF353535),
), ),
), ),
SizedBox(width:10.w),
Expanded( Expanded(
child: Text( child: Text(
rightText, rightText,

2
lib/store/store_view/shop_goods.dart

@ -142,7 +142,7 @@ class _ShopGoods extends State<ShopGoods> {
text: S.of(context).xuanguige, text: S.of(context).xuanguige,
textColor: Colors.white, textColor: Colors.white,
fontWeight: MyFontWeight.medium, fontWeight: MyFontWeight.medium,
radius: 11, radius: 3,
backgroup: Color(0xFF32A060), backgroup: Color(0xFF32A060),
fontSize: 11.sp, fontSize: 11.sp,
padding: EdgeInsets.symmetric(vertical: 5.h), padding: EdgeInsets.symmetric(vertical: 5.h),

Loading…
Cancel
Save