diff --git a/lib/community/community_course.dart b/lib/community/community_course.dart index 70a4720e..2b833d3b 100644 --- a/lib/community/community_course.dart +++ b/lib/community/community_course.dart @@ -214,7 +214,7 @@ class _CommunityCourse extends State enablePullDown: true, enablePullUp: false, header: MyHeader(), - physics: ClampingScrollPhysics(), + physics: BouncingScrollPhysics(), onRefresh: _onRefresh, scrollController: scrollController, child: Container( diff --git a/lib/community/headlines/article_list.dart b/lib/community/headlines/article_list.dart index f9e733b9..ab83e21b 100644 --- a/lib/community/headlines/article_list.dart +++ b/lib/community/headlines/article_list.dart @@ -124,10 +124,7 @@ class _ArticleList extends State { Row( children: [ Text( - (widget.articles[position] != null && - widget.articles[position].author != null) - ? widget.articles[position].author.name - : "", + widget.articles != null?widget.articles[position]?.author?.name??"":"", style: TextStyle( fontSize: 12.sp, fontWeight: MyFontWeight.medium, diff --git a/lib/community/headlines/article_page.dart b/lib/community/headlines/article_page.dart index ae63500a..ded44c87 100644 --- a/lib/community/headlines/article_page.dart +++ b/lib/community/headlines/article_page.dart @@ -20,6 +20,7 @@ import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/utils/event_type.dart'; import 'package:huixiang/view_widget/classic_header.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:huixiang/view_widget/my_footer.dart'; import 'package:huixiang/view_widget/store_title_tab.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:shared_preferences/shared_preferences.dart'; @@ -164,8 +165,7 @@ class _ArticlePage extends State @override Widget build(BuildContext context) { super.build(context); - return - Stack( + return Stack( children: [ Positioned( child: Container( @@ -174,7 +174,7 @@ class _ArticlePage extends State enablePullDown: true, enablePullUp: false, header: MyHeader(), - physics: ClampingScrollPhysics(), + physics: BouncingScrollPhysics(), onRefresh: _onRefresh, scrollController: scrollController, child: Container( diff --git a/lib/community/headlines/headlines_collection.dart b/lib/community/headlines/headlines_collection.dart index f5041e40..8b493968 100644 --- a/lib/community/headlines/headlines_collection.dart +++ b/lib/community/headlines/headlines_collection.dart @@ -48,7 +48,7 @@ class _HeadlinesCollection extends State { onTap: () { Navigator.of(context).pushNamed( '/router/headlines_column_details', - arguments: {"id":widget.headlines[position].id, + arguments: {"categoryId":widget.articles[position].categoryId, "articles":widget.articles}); }, child: headlinesCollectionItem(widget.headlines[position]), diff --git a/lib/community/headlines/headlines_column_details.dart b/lib/community/headlines/headlines_column_details.dart index c15bb927..cbe1513d 100644 --- a/lib/community/headlines/headlines_column_details.dart +++ b/lib/community/headlines/headlines_column_details.dart @@ -6,10 +6,13 @@ import 'package:huixiang/retrofit/data/article.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/headlines_list.dart'; import 'package:huixiang/retrofit/data/headlines_list_details.dart'; +import 'package:huixiang/retrofit/data/page.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:huixiang/view_widget/classic_header.dart'; import 'package:huixiang/view_widget/custom_image.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:shared_preferences/shared_preferences.dart'; class HeadlinesColumnDetails extends StatefulWidget { @@ -29,14 +32,17 @@ class _HeadlinesColumnDetails extends State List
articles; HeadlinesListDetails headlinesListDetails; List headlines = []; + final RefreshController refreshController = RefreshController(); + int pageNum = 1; + final ScrollController scrollController = ScrollController(); @override void initState() { super.initState(); articles = widget.arguments["articles"]; WidgetsBinding.instance.addObserver(this); - queryHeadlinesDetails(widget.arguments["id"]); - queryHeadlinesList(widget.arguments["id"]); + queryHeadlinesDetails(widget.arguments["categoryId"]); + queryArticleList(widget.arguments["categoryId"]); } ///文章合集详情 @@ -58,8 +64,8 @@ class _HeadlinesColumnDetails extends State } } - ///文章合集列表 - queryHeadlinesList(id) async { + ///文章列表 + queryArticleList(categoryId) async { if (apiService == null) { SharedPreferences value = await SharedPreferences.getInstance(); apiService = ApiService( @@ -68,24 +74,54 @@ class _HeadlinesColumnDetails extends State token: value.getString("token"), ); } - BaseData> baseData = await apiService.headlinesList().catchError((onError) {}); + BaseData> baseData = await apiService.queryArticle({ + "pageNum": pageNum, + "pageSize": 10, + "searchKey": "", + "state": 1, + "type": 2, + "categoryId":widget.arguments["categoryId"] + }).catchError((onError){ + refreshController.refreshFailed(); + refreshController.loadFailed(); + }); if (baseData != null && baseData.isSuccess) { - setState(() { - headlines.clear(); - headlines.addAll(baseData.data); - headlines.forEach((element) { - // collectCourse(element.id); - }); - }); + refreshController.refreshCompleted(); + refreshController.loadComplete(); + if(pageNum == 1) { + articles.clear(); + } + articles.addAll(baseData.data.list); + if (baseData.data.pageNum == baseData.data.pages) { + refreshController.loadNoData(); + } else { + pageNum += 1; + } + setState(() {}); + } else { + refreshController.refreshFailed(); + refreshController.loadFailed(); } - EasyLoading.dismiss(); + } + + _onRefresh(){ + queryHeadlinesDetails(widget.arguments["categoryId"]); + queryArticleList(widget.arguments["categoryId"]);//分类列表 } @override Widget build(BuildContext context) { return Scaffold( body: Container( - child: Column( + child: SmartRefresher( + controller: refreshController, + enablePullDown: true, + enablePullUp: false, + header: MyHeader(), + physics: ClampingScrollPhysics(), + onRefresh: _onRefresh, + scrollController: scrollController, + child:Column( children: [ Expanded( child: SingleChildScrollView( @@ -215,7 +251,7 @@ class _HeadlinesColumnDetails extends State ), ListView.builder( padding: EdgeInsets.zero, - itemCount:headlines == null ? 0 : headlines.length, + itemCount:articles.length, scrollDirection: Axis.vertical, shrinkWrap: true, physics: NeverScrollableScrollPhysics(), @@ -240,7 +276,7 @@ class _HeadlinesColumnDetails extends State ), ], ), - ), + ),) ); } @@ -289,10 +325,7 @@ class _HeadlinesColumnDetails extends State Row( children: [ Text( - (articles != null && - articles.author != null) - ? articles.author.name - : "", + articles?.author?.name ?? "", style: TextStyle( fontSize: 12.sp, fontWeight: MyFontWeight.medium, diff --git a/lib/integral/integral_page.dart b/lib/integral/integral_page.dart index e4f037e1..8cdb25df 100644 --- a/lib/integral/integral_page.dart +++ b/lib/integral/integral_page.dart @@ -127,7 +127,9 @@ class _IntegralPage extends State { return Column( children: [ /// 上面的积分和VIP等级显示 - IntegralVip(rankLevel, signInfo, userInfo), + IntegralVip(rankLevel, signInfo, userInfo,"${ (signInfo?.signInList?.length ) ?? "0"}", + ((signInfo?.rewardList != null && signInfo.rewardList.length > (signInfo?.signInList?.length ?? 0)) ? + signInfo.rewardList[signInfo?.signInList?.length ?? 0]:0).toString()), ///立即签到 InForPoints(signInfo, _signIn), diff --git a/lib/integral/intergra_view/integral_vip.dart b/lib/integral/intergra_view/integral_vip.dart index 04ddbf76..79ce636e 100644 --- a/lib/integral/intergra_view/integral_vip.dart +++ b/lib/integral/intergra_view/integral_vip.dart @@ -4,14 +4,17 @@ import 'package:huixiang/retrofit/data/sign_info.dart'; import 'package:huixiang/retrofit/data/user_info.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:huixiang/view_widget/custom_image.dart'; class IntegralVip extends StatefulWidget { final SignInfo signInfo; final UserInfo userinfo; final rankLevel; + final String day; + final String integral; - IntegralVip(this.rankLevel, this.signInfo, this.userinfo); + IntegralVip(this.rankLevel, this.signInfo, this.userinfo,this.day,this.integral); @override State createState() { @@ -25,83 +28,119 @@ class _IntegralVip extends State { @override Widget build(BuildContext context) { return Container( - padding: EdgeInsets.symmetric(vertical: 16.h), + padding: EdgeInsets.symmetric(vertical: 16.h,horizontal: 16.w), child: Row( children: [ + MImage( + widget.userinfo != null ? widget.userinfo.headimg : "", + width: 50, + height: 50, + isCircle: true, + fit: BoxFit.cover, + errorSrc: "assets/image/default_user.png", + fadeSrc: "assets/image/default_user.png", + ), Expanded( - flex: 1, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Text( - widget.signInfo != null ? "${widget.signInfo.point}" : "0", - style: TextStyle( - fontWeight: MyFontWeight.medium, - fontSize: 21.sp, - color: Colors.white, + child: Container( + margin: EdgeInsets.only(left: 15.w), + height: 50.h, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + S.of(context).ninyilianxuqiandaotian(widget.day), + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), ), - ), - SizedBox( - height: 6.h, - ), - Text( - S.of(context).wodejifenzhi, - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: Color(0xFFF2F2F2), + Text( + "明日签到可获得${widget.integral}积分", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Colors.white, + ), ), - ) - ], + ], + ), ), + flex: 1, ), Container( - width: 2.w, - height: 32.h, - color: Color(0xFFFFFFFF), - ), - Expanded( - flex: 1, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, + margin: EdgeInsets.only(left: 15.w), + height: 50.h, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, crossAxisAlignment: CrossAxisAlignment.center, children: [ + Image.asset( + "assets/image/icon_gold_coin.png", + width: 20, + height: 20, + ), + SizedBox( + width:6.w, + ), Text( - (widget?.signInfo?.rank?.rankName != null) - ? "${widget.signInfo.rank.rankName.replaceAll("会员", "")}" - : "", + widget?.userinfo?.points ?? "", style: TextStyle( - fontWeight: MyFontWeight.medium, - fontSize: 21.sp, + fontSize: 14.sp, color: Colors.white, + fontWeight: FontWeight.bold, ), ), - SizedBox( - height: 6.h, - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Text( - S.of(context).wodehuiyuandengji, - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: Color(0xFFF2F2F2), - ), - ), - // Icon( - // Icons.keyboard_arrow_right, - // color: Colors.white, - // size: 15, - // ), - ], - ), ], ), - ), + ) + // Container( + // width: 2.w, + // height: 32.h, + // color: Color(0xFFFFFFFF), + // ), + // Expanded( + // flex: 1, + // child: Column( + // mainAxisAlignment: MainAxisAlignment.center, + // crossAxisAlignment: CrossAxisAlignment.center, + // children: [ + // Text( + // (widget?.signInfo?.rank?.rankName != null) + // ? "${widget.signInfo.rank.rankName.replaceAll("会员", "")}" + // : "", + // style: TextStyle( + // fontWeight: MyFontWeight.medium, + // fontSize: 21.sp, + // color: Colors.white, + // ), + // ), + // SizedBox( + // height: 6.h, + // ), + // Row( + // mainAxisAlignment: MainAxisAlignment.center, + // crossAxisAlignment: CrossAxisAlignment.center, + // children: [ + // Text( + // S.of(context).wodehuiyuandengji, + // style: TextStyle( + // fontSize: 12.sp, + // fontWeight: MyFontWeight.regular, + // color: Color(0xFFF2F2F2), + // ), + // ), + // // Icon( + // // Icons.keyboard_arrow_right, + // // color: Colors.white, + // // size: 15, + // // ), + // ], + // ), + // ], + // ), + // ), ], ), ); diff --git a/lib/mine/mine_vip/mine_vip_core.dart b/lib/mine/mine_vip/mine_vip_core.dart index cf2ea8ae..c92bc3d6 100644 --- a/lib/mine/mine_vip/mine_vip_core.dart +++ b/lib/mine/mine_vip/mine_vip_core.dart @@ -520,39 +520,6 @@ class _MineVipCore extends State { ], ), ), - if (ranks.length > checkIndex && - widget.arguments["rankLevel"] < ranks[checkIndex].level && - ranks[checkIndex].price != "0.00") - InkWell( - onTap: () { - setState(() { - buyRank(); - }); - }, - child: Container( - decoration: BoxDecoration( - gradient: new LinearGradient( - begin: Alignment.centerLeft, - end: Alignment.centerRight, - colors: [ - Color(0xFFFFDCA1), - Color(0xFFFAE4C0), - ]), - ), - width: MediaQuery.of(context).size.width, - padding: EdgeInsets.all(16), - height: 54, - alignment: Alignment.center, - child: Text( - "${S.of(context).lijikaitong}¥${ranks.length > checkIndex ? ranks[checkIndex].price : ""}/永久", - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 16.sp, - color: Color(0xFF4A4748), - ), - ), - ), - ), ], ), ), @@ -561,6 +528,43 @@ class _MineVipCore extends State { )), ], ), + if (ranks.length > checkIndex && + widget.arguments["rankLevel"] < ranks[checkIndex].level && + ranks[checkIndex].price != "0.00") + Align( + alignment: Alignment.bottomCenter, + child: InkWell( + onTap: () { + setState(() { + buyRank(); + }); + }, + child: Container( + decoration: BoxDecoration( + gradient: new LinearGradient( + begin: Alignment.centerLeft, + end: Alignment.centerRight, + colors: [ + Color(0xFFFFDCA1), + Color(0xFFFAE4C0), + ]), + ), + width: MediaQuery.of(context).size.width, + padding: EdgeInsets.all(16), + height: 54, + alignment: Alignment.center, + child: Text( + "${S.of(context).lijikaitong}¥${ranks.length > checkIndex ? ranks[checkIndex].price : ""}/永久", + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 16.sp, + color: Color(0xFF4A4748), + ), + ), + ), + ), + ) + ], ); diff --git a/lib/retrofit/data/activity.dart b/lib/retrofit/data/activity.dart index b49bd053..4f718fa2 100644 --- a/lib/retrofit/data/activity.dart +++ b/lib/retrofit/data/activity.dart @@ -13,6 +13,7 @@ class Activity { String coverImg; String startTime; String endTime; + String categoryId; int state; int isDelete; int likes; @@ -33,6 +34,7 @@ class Activity { ..coverImg = json['coverImg'] ..startTime = json['startTime'] ..endTime = json['endTime'] + ..categoryId = json['categoryId'] ..state = json['state'] ..isDelete = json['isDelete'] ..likes = json["likes"] @@ -53,6 +55,7 @@ class Activity { 'coverImg': this.coverImg, 'startTime': this.startTime, 'endTime': this.endTime, + 'categoryId': this.categoryId, 'state': this.state, 'isDelete': this.isDelete, 'likes': this.likes, diff --git a/lib/retrofit/data/article.dart b/lib/retrofit/data/article.dart index e199a6c3..72a130e3 100644 --- a/lib/retrofit/data/article.dart +++ b/lib/retrofit/data/article.dart @@ -17,6 +17,7 @@ class Article { Author _author; int _type; String _startTime; + String _categoryId; String _endTime; int _state; int _isDelete; @@ -41,6 +42,7 @@ class Article { Author get author => _author; int get type => _type; String get startTime => _startTime; + String get categoryId => _categoryId; String get endTime => _endTime; int get state => _state; int get isDelete => _isDelete; @@ -102,6 +104,7 @@ class Article { _author = author; _type = type; _startTime = startTime; + _categoryId = categoryId; _endTime = endTime; _state = state; _isDelete = isDelete; @@ -127,6 +130,7 @@ class Article { _author = json["author"] == null ? null : Author.fromJson(jsonDecode(json["author"])); _type = json["type"]; _startTime = json["startTime"]; + _categoryId = json["categoryId"]; _endTime = json["endTime"]; _state = json["state"]; _isDelete = json["isDelete"]; @@ -153,6 +157,7 @@ class Article { map["author"] = _author.toJson(); map["type"] = _type; map["startTime"] = _startTime; + map["categoryId"] = _categoryId; map["endTime"] = _endTime; map["state"] = _state; map["isDelete"] = _isDelete; diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index aac0a961..699cf918 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/lib/retrofit/retrofit_api.dart @@ -53,11 +53,11 @@ import 'data/wx_pay.dart'; part 'retrofit_api.g.dart'; -const base_url = "https://pos.platform.lotus-wallet.com/app/"; ///正式 -const baseUrl = "https://pos.platform.lotus-wallet.com/app/"; ///正式 +// const base_url = "https://pos.platform.lotus-wallet.com/app/"; ///正式 +// const baseUrl = "https://pos.platform.lotus-wallet.com/app/"; ///正式 -// const base_url = "http://192.168.10.236:8766/app/"; ///费韬 -// const baseUrl = "http://192.168.10.236:8766/app/"; ///费韬 +const base_url = "http://192.168.10.236:8766/app/"; ///费韬 +const baseUrl = "http://192.168.10.236:8766/app/"; ///费韬 // const base_url = "http://192.168.10.37:8766/app/"; // const baseUrl = "http://192.168.10.37:8766/app/"; diff --git a/lib/retrofit/retrofit_api.g.dart b/lib/retrofit/retrofit_api.g.dart index d1a64c02..1eb48e20 100644 --- a/lib/retrofit/retrofit_api.g.dart +++ b/lib/retrofit/retrofit_api.g.dart @@ -9,7 +9,7 @@ part of 'retrofit_api.dart'; class _ApiService implements ApiService { _ApiService(this._dio, {this.baseUrl}) { ArgumentError.checkNotNull(_dio, '_dio'); - baseUrl ??= 'https://pos.platform.lotus-wallet.com/app/'; + baseUrl ??= 'http://192.168.10.236:8766/app/'; } final Dio _dio; diff --git a/lib/view_widget/mine_vip_view.dart b/lib/view_widget/mine_vip_view.dart index 81596f5a..aa4693cb 100644 --- a/lib/view_widget/mine_vip_view.dart +++ b/lib/view_widget/mine_vip_view.dart @@ -244,9 +244,9 @@ class MineVipView extends StatelessWidget { color: textColor, ), ), - if(vipLevel == 3) + if(vipLevel == 3 && !(showRank??true)) TextSpan( - text: "${S.of(context).lijikaitong}¥${price??""}/永久", + text: "¥${price??""}/永久" , style: TextStyle( fontSize: 14.sp, fontWeight: MyFontWeight.regular, @@ -289,7 +289,6 @@ class MineVipView extends StatelessWidget { (createTime != null && createTime != "") ? createTime.split(" ")[0] : "$createTime" - // createTime ?? "" ), style: TextStyle( color: textColor,