From 6d4c5758810cb058cdccee470490bb01aeaeecec Mon Sep 17 00:00:00 2001 From: w-R <953969641@qq.com> Date: Fri, 5 Nov 2021 17:53:43 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/image/2x/ketang_play.png | Bin 0 -> 413 bytes assets/image/3x/ketang_play.png | Bin 0 -> 659 bytes assets/image/ketang_play.png | Bin 0 -> 243 bytes lib/community/community_course.dart | 6 +- .../community_view/class_details.dart | 54 ++-- .../community_view/class_list_view.dart | 111 +++++--- lib/community/community_view/home_class.dart | 267 ++++++++++-------- lib/home/home_view/shortcut_operation.dart | 18 +- .../integral_store_details_page.dart | 33 ++- lib/retrofit/data/course_details.dart | 72 ++++- lib/retrofit/min_api.dart | 11 +- lib/retrofit/min_api.g.dart | 2 +- lib/retrofit/retrofit_api.dart | 12 +- lib/retrofit/retrofit_api.g.dart | 24 +- lib/union/union_page.dart | 3 - 15 files changed, 391 insertions(+), 222 deletions(-) create mode 100644 assets/image/2x/ketang_play.png create mode 100644 assets/image/3x/ketang_play.png create mode 100644 assets/image/ketang_play.png diff --git a/assets/image/2x/ketang_play.png b/assets/image/2x/ketang_play.png new file mode 100644 index 0000000000000000000000000000000000000000..0329d21b466c37a6089c696e991f4845709bcacd GIT binary patch literal 413 zcmV;O0b>4%P)Px$S4l)cR9HvtmM=>LQ5400rqml@did(VJZ@V@}eY#Mlw)B$f=Q5-O{b>JAd09GY^{5HTI zupdNkfrX}n8_R(*fOEVCh?_bmQUSQ`C$J{T|0jJbC4h^50Xvco`w^rDa9!UF-;kb_ z8sHIFmUN#3;1t-bTgem-`0#B>I;q6-~K8PfCC00000NkvXX Hu0mjfUsk70 literal 0 HcmV?d00001 diff --git a/assets/image/3x/ketang_play.png b/assets/image/3x/ketang_play.png new file mode 100644 index 0000000000000000000000000000000000000000..300a2912c2355981f46049201ce3bf9fa84acfef GIT binary patch literal 659 zcmV;E0&M+>P)Px%O-V#SRA@u(nLTS2K@^6cSG3heE%h%LtCWhUf59S(kV4eP+CmXU1RL=Kl0pm3 z53n^F6+x^_S_Q!m3`9(!0Y&4-krU?1b;;%K9haF|*eQ2+cHifmnRCvZ6)hiXxqdo; z+#c*aP@D(M%)PP|I0#GvyMfJ_gsuSdz)j#Duq?^?wfwV$g7`7uB5(kT+2k&I7B~$o z^g~nuwgGp5{lJDyRv+})-@tv~u%wT@hpGS*!0ll9&%g~}TGG25FlM#`I0l>qwgB#l zBa&tY0XzcsgqyyM&Pw{3LwxU>X0{PH7nYA-ek^J4AON>|Z^Q1)W%;VXf+yaF>noDn z8*8Jwg#PYuNk!!dGh0_%2asxiB=vxq`94~e^sOntWB_KiFND6=z*R|$O+cgscnEly z`w_~3Lz3S7FGNa!1z=a7VE4pP;Hjivu^>4CT=Og7JTN24OM;O{ZU7hTmE|=Dk@S63 zf)W5+^C~bEAeKjgCZU9eSPlEUdF&Q~0 zfQQXnzy(R~>#XXig(v#I?;EE&%i5@8dyl^`OcoBD9(pkk%~u0ZOW9mxOy002ovPDHLkV1j-`C`kYS literal 0 HcmV?d00001 diff --git a/assets/image/ketang_play.png b/assets/image/ketang_play.png new file mode 100644 index 0000000000000000000000000000000000000000..73ce258a2c9dedfd4bf1d970e253288015cc6ebe GIT binary patch literal 243 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|)_S@)hFJJ7 zy>yV5F;JxS;s5uCbV8H@89JwW=&aG5x`2`Q#X&ET15V6BRsviHE{RU|QEHl*e(&4U znw{UDd7Mo@Yhx)OXq&)iqSch1uttyj0n3-GxuOb6Q3ssPaw%L{QmUkMzJ^sviP`Od z&))t1VXPU<(h00QS5IqCVzMc=Ua(k>TSasSV{GYP{sIQJS9YbXY6gtUUYY*vNUg2d q@Ay{f>guAKJNEyZ{OUJn6~ps}2EoYMr9XfUXYh3Ob6Mw<&;$Sz#9282 literal 0 HcmV?d00001 diff --git a/lib/community/community_course.dart b/lib/community/community_course.dart index 4cb77888..93ba3cf5 100644 --- a/lib/community/community_course.dart +++ b/lib/community/community_course.dart @@ -7,7 +7,6 @@ import 'package:huixiang/main.dart'; import 'package:huixiang/retrofit/data/banner.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/brand.dart'; -import 'package:huixiang/retrofit/data/brand_data.dart'; import 'package:huixiang/retrofit/data/category_select_list.dart'; import 'package:huixiang/retrofit/data/collect_class_list.dart'; import 'package:huixiang/retrofit/data/course_list.dart'; @@ -88,7 +87,6 @@ class _CommunityCourse extends State EasyLoading.dismiss(); } - ///课程分类列表 classListAsync() async { if (apiService == null) { @@ -258,8 +256,8 @@ class _CommunityCourse extends State SizedBox(height: 28), - ///回乡小课堂 - HomeClass(collect,collectList), + ///合集列表 + HomeClass(collect,collectList,), ///课程导航栏 ClassTitleTab(classSelectList,(index){ diff --git a/lib/community/community_view/class_details.dart b/lib/community/community_view/class_details.dart index d72a542d..706c4a34 100644 --- a/lib/community/community_view/class_details.dart +++ b/lib/community/community_view/class_details.dart @@ -10,8 +10,6 @@ import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/chapter.dart'; import 'package:huixiang/retrofit/data/course_details.dart'; -import 'package:huixiang/retrofit/data/member_comment_list.dart'; -import 'package:huixiang/retrofit/data/page.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/custom_image.dart'; @@ -176,13 +174,13 @@ class _ClassDetails extends State with WidgetsBindingObserver{ crossAxisAlignment: CrossAxisAlignment.center, children: [ GestureDetector( - child: Icon( - Icons.arrow_back_ios, - color: Colors.white, - size: 24, + child: Image.asset( + "assets/image/integral_return.png", + width: 24, + height: 24, ), onTap: () { - Navigator.of(context).pop(); + Navigator.of(context).pop(course.viewers+1); }, ), ], @@ -268,9 +266,7 @@ class _ClassDetails extends State with WidgetsBindingObserver{ ), )), Text( - "播放次数", - overflow: TextOverflow.ellipsis, - maxLines: 2, + "播放次数:", style: TextStyle( fontSize: 12.sp, fontWeight: MyFontWeight.regular, @@ -352,8 +348,8 @@ class _ClassDetails extends State with WidgetsBindingObserver{ commentTextController, _toComment, _queryMemberComment, - _queryInformationLikes, - isLike: false, + _queryCourseLikes, + isLike:course?.selfLiked, ), ], ), @@ -527,18 +523,34 @@ class _ClassDetails extends State with WidgetsBindingObserver{ ); } - ///给文章/活动点赞 - _queryInformationLikes() async { - BaseData baseData = await apiService.informationLikes(widget.arguments["id"]).catchError((onError) {}); + // ///给文章/活动点赞 + // _queryInformationLikes() async { + // BaseData baseData = await apiService.courseLikes(widget.arguments["id"]).catchError((onError) {}); + // if (baseData != null && baseData.isSuccess) { + // commentKey.currentState.setState(() {}); + // setState(() { + // comunity.likes -= 1; + // else + // comunity.likes += 1; + // + // }); + // } else { + // // SmartDialog.showToast(baseData.msg, alignment: Alignment.center); + // } + // } + + ///课程点赞 + _queryCourseLikes() async { + BaseData baseData = await apiService.courseLikes(widget.arguments["id"]).catchError((onError) {}); if (baseData != null && baseData.isSuccess) { - commentKey.currentState.setState(() {}); setState(() { - // if (comunity.selfLike ?? false) - // comunity.likes -= 1; - // else - // comunity.likes += 1; - // comunity.selfLike = !comunity.selfLike ?? false; + if (course.selfLiked ?? false) + course.likes -= 1; + else + course.likes += 1; + course.selfLiked = !course.selfLiked ?? false; }); + commentKey.currentState.setState(() {}); } else { // SmartDialog.showToast(baseData.msg, alignment: Alignment.center); } diff --git a/lib/community/community_view/class_list_view.dart b/lib/community/community_view/class_list_view.dart index 3879a322..884b6b50 100644 --- a/lib/community/community_view/class_list_view.dart +++ b/lib/community/community_view/class_list_view.dart @@ -31,19 +31,21 @@ class _ClassListView extends State { physics: NeverScrollableScrollPhysics(), gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( //一行的Widget数量 - crossAxisCount: 3, + crossAxisCount:2, //水平子Widget之间间距 crossAxisSpacing: 11.w, //垂直子Widget之间间距 mainAxisSpacing: 16.w, //子Widget宽高比例 0.59 childAspectRatio: - 166 / (281 / 2 + (281 / 2) * AppUtils.textScale(context)), + 260 / (281 / 2 + (281 / 2) * AppUtils.textScale(context)), ), itemBuilder: (context, index) { return GestureDetector( onTap: () { - Navigator.of(context).pushNamed('/router/class_details',arguments: {"id": widget.classList[index].id}); + Navigator.of(context).pushNamed('/router/class_details', + arguments: {"id": widget.classList[index].id}) + .then((value) => {widget.classList[index].viewers = value != null?value:widget.classList[index].viewers+1}); }, child: classListItem(widget.classList[index]), ); @@ -53,13 +55,23 @@ class _ClassListView extends State { Widget classListItem(CourseList classList) { return Container( - width: 106, - height: 189, + decoration: BoxDecoration( + borderRadius: BorderRadius.vertical( + bottom: Radius.circular(4), + ), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(10), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ) + ], + color: Colors.white, + ), margin: EdgeInsets.symmetric( - // horizontal: 6.w, vertical: 3, ), - color: Colors.white, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -67,15 +79,30 @@ class _ClassListView extends State { alignment: Alignment(0.9, 0.9), children: [ Container( - color: Color.fromARGB(80, 0, 0, 0), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(4), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(10), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ) + ], + color: Color.fromARGB(90, 0, 0, 0), + ), child: ClipRRect( - child: MImage( - classList.coverImg, - width: double.infinity, - height: 120, - fit: BoxFit.cover, - errorSrc: "assets/image/default_1.png", - fadeSrc: "assets/image/default_1.png", + child: + Opacity( + opacity: 0.6, + child:MImage( + classList.coverImg, + width: double.infinity, + height: 120, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", + ), ), borderRadius: BorderRadius.vertical( top: Radius.circular(4), @@ -91,14 +118,14 @@ class _ClassListView extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Image.asset( - "assets/image/ketang_like.png", + "assets/image/ketang_play.png", width: 16.w, height: 16.h, color: Colors.white, ), SizedBox(width: 5), Text( - classList.likes.toString(), + classList.viewers.toString(), style: TextStyle( fontSize: 12.sp, fontWeight: MyFontWeight.regular, @@ -108,47 +135,51 @@ class _ClassListView extends State { ], ), SizedBox(width: 8), - Row( - children: [ - Image.asset( - "assets/image/ketang_message.png", - width: 16.w, - height: 16.h, - color: Colors.white, - ), - SizedBox(width: 5), - Text( - classList.viewers.toString(), - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: Colors.white, - ), - ), - ], - ), + // Row( + // children: [ + // Image.asset( + // "assets/image/ketang_message.png", + // width: 16.w, + // height: 16.h, + // color: Colors.white, + // ), + // SizedBox(width: 5), + // Text( + // classList.viewers.toString(), + // style: TextStyle( + // fontSize: 12.sp, + // fontWeight: MyFontWeight.regular, + // color: Colors.white, + // ), + // ), + // ], + // ), ], ), ), ], ), - Container( - padding: EdgeInsets.only(left: 4, top: 3), + Expanded(child:Container( + padding: EdgeInsets.all(10), child: Column( mainAxisAlignment: MainAxisAlignment.spaceAround, crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( classList.subject, + overflow: TextOverflow.ellipsis, + maxLines: 2, style: TextStyle( fontSize: 14.sp, - fontWeight: MyFontWeight.medium, + fontWeight: MyFontWeight.semi_bold, color: Colors.black, ), ), SizedBox(height: 2), Text( "讲师:${classList.author.name}", + overflow: TextOverflow.ellipsis, + maxLines: 2, style: TextStyle( fontSize: 12.sp, fontWeight: MyFontWeight.regular, @@ -157,7 +188,7 @@ class _ClassListView extends State { ), ], ), - ), + ),) ], ), ); diff --git a/lib/community/community_view/home_class.dart b/lib/community/community_view/home_class.dart index b7b19f0c..a48984ea 100644 --- a/lib/community/community_view/home_class.dart +++ b/lib/community/community_view/home_class.dart @@ -76,7 +76,8 @@ class _HomeClass extends State { return GestureDetector( onTap: () { Navigator.of(context).pushNamed('/router/class_details', - arguments: {"id":widget.collect[position].id}); + arguments: {"id":widget.collect[position].id}) + .then((value) => {widget.collect[position].viewers = value != null?value:widget.collect[position].viewers+1}); }, child: classItem(widget.collect[position]), ); @@ -92,138 +93,170 @@ class _HomeClass extends State { return Container( width: 168, height: 189, + decoration: BoxDecoration( + borderRadius: BorderRadius.vertical( + bottom: Radius.circular(4), + ), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(10), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ) + ], + color: Colors.white, + ), margin: EdgeInsets.symmetric( - horizontal: 6.w, - vertical: 3, + horizontal:6, ), - color: Colors.white, child: Column( children: [ - Stack( - alignment: Alignment(0.9,0.9), - children: [ - Container( - color: Color.fromARGB(80, 0, 0, 0), - child: ClipRRect( - child: MImage( - collect.coverImg, - width: double.infinity, - height: 120, - fit: BoxFit.cover, - errorSrc: "assets/image/default_1.png", - fadeSrc: "assets/image/default_1.png", + Stack( + alignment: Alignment.topRight, + children: [ + Stack( + alignment: Alignment(0.9,0.9), + children: [ + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(4), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(10), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ) + ], + color: Color.fromARGB(90, 0, 0, 0), ), - borderRadius: BorderRadius.vertical( - top: Radius.circular(4), + child: ClipRRect( + child: Opacity( + opacity: 0.6, + child: MImage( + collect.coverImg, + width: double.infinity, + height: 120, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", + ), + ), + borderRadius: BorderRadius.vertical( + top: Radius.circular(4), + ), ), ), - ), - Container( - padding: EdgeInsets.only(left: 4), - child:Row( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, + Container( + padding: EdgeInsets.only(left: 4), + child:Row( children: [ - Image.asset( - "assets/image/ketang_like.png", - width: 16.w, - height: 16.h, - color: Colors.white, - ), - SizedBox(width:5), - Text( - collect.likes.toString(), - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: Colors.white, - ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Image.asset( + "assets/image/ketang_play.png", + width: 16.w, + height: 16.h, + color: Colors.white, + ), + SizedBox(width:5), + Text( + collect.viewers.toString(), + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Colors.white, + ), + ), + ], ), + SizedBox(width:8), + // Row( + // children: [ + // Image.asset( + // "assets/image/ketang_message.png", + // width: 16.w, + // height: 16.h, + // color: Colors.white, + // ), + // SizedBox(width:5), + // Text( + // collect.viewers.toString(), + // style: TextStyle( + // fontSize: 12.sp, + // fontWeight: MyFontWeight.regular, + // color: Colors.white, + // ), + // ), + // ], + // ), ], ), - SizedBox(width:8), - // Row( - // children: [ - // Image.asset( - // "assets/image/ketang_message.png", - // width: 16.w, - // height: 16.h, - // color: Colors.white, - // ), - // SizedBox(width:5), - // Text( - // collect.viewers.toString(), - // style: TextStyle( - // fontSize: 12.sp, - // fontWeight: MyFontWeight.regular, - // color: Colors.white, - // ), - // ), - // ], - // ), - ], + + ), + ], + ), + Container( + margin: EdgeInsets.only(top: 8,right: 8), + height: 16.h, + width: 30.w, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(2), + color: Color(0xFFFFCD00), ), + child: Text( + ( collect?.tags != null && collect.tags.length > 0 )?collect.tags[0] : "", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF634815), + ), ), - ], - ), - Container( - padding: EdgeInsets.only(left:4,top: 2), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox(height:2), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - height: 16.h, - width: 30.w, - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular(2), - border: Border.all( - width: 1, - color: Color(0xFFFF7A1A), - style: BorderStyle.solid, - ), - ), - child: Text( - ( collect?.tags != null && collect.tags.length > 0 )?collect.tags[0] : "", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.medium, - color: Color(0xFFFF7A1A), - ), - ), + ), + ], + ), + Expanded(child: + Container( + padding: EdgeInsets.all(10), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded(child: Text( + collect.subject, + overflow: TextOverflow.ellipsis, + maxLines: 2, + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.semi_bold, + color: Colors.black, ), - SizedBox(width:5), - Expanded(child: Text( - collect.subject, - style: TextStyle( - fontSize: 14.sp, - fontWeight: MyFontWeight.medium, - color: Colors.black, - ), - ),), - ], - ), - SizedBox(height:3), - Text( - "讲师:${collect.author.name}", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: Colors.black, - ), + ),), + ], + ), + SizedBox(height:5), + Text( + "讲师:${collect.author.name}", + overflow: TextOverflow.ellipsis, + maxLines: 2, + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Colors.black, ), - ], - ), + ), + ], ), + ),), ], ), ); diff --git a/lib/home/home_view/shortcut_operation.dart b/lib/home/home_view/shortcut_operation.dart index 4a23a3c2..2cfdaa20 100644 --- a/lib/home/home_view/shortcut_operation.dart +++ b/lib/home/home_view/shortcut_operation.dart @@ -47,7 +47,7 @@ class _ShortcutOperation extends State { child: Container( width: 106, color: Colors.white, - margin: EdgeInsets.only(left: 15,right: 15), + margin: EdgeInsets.only(right:10), padding: EdgeInsets.only(top: 8,bottom: 8), child: Column( children: [ @@ -69,11 +69,11 @@ class _ShortcutOperation extends State { ), ), SizedBox(height: 20), - Image.asset( + Expanded(child: Image.asset( "assets/image/home_order.png", width:70, height:70, - ), + ),), ], ), ), @@ -85,7 +85,7 @@ class _ShortcutOperation extends State { child: Container( width: 106, color: Colors.white, - margin: EdgeInsets.only(left: 15,right: 15), + margin: EdgeInsets.only(right:10), padding: EdgeInsets.only(top: 8,bottom: 8), child: Column( children: [ @@ -107,11 +107,11 @@ class _ShortcutOperation extends State { ), ), SizedBox(height: 20), - Image.asset( + Expanded(child:Image.asset( "assets/image/home_recharge.png", width:70, height:70, - ), + ),), ], ), ), @@ -123,7 +123,6 @@ class _ShortcutOperation extends State { child:Container( width: 106, color: Colors.white, - margin: EdgeInsets.only(left: 15,right: 15), padding: EdgeInsets.only(top: 8,bottom: 8), child: Column( children: [ @@ -145,11 +144,12 @@ class _ShortcutOperation extends State { ), ), SizedBox(height: 20), - Image.asset( + Expanded(child: Image.asset( "assets/image/home_coupon.png", width:70, height:70, - ), + ), ), + ], ), ), diff --git a/lib/integral_store/integral_store_details_page.dart b/lib/integral_store/integral_store_details_page.dart index e08f3d4e..3612cc6b 100644 --- a/lib/integral_store/integral_store_details_page.dart +++ b/lib/integral_store/integral_store_details_page.dart @@ -115,31 +115,34 @@ class _IntegralStoreDetailsPage extends State { ), GestureDetector( onTap: () { - if (goods != null && - points != null && - int.tryParse(goods.price) < int.tryParse(points)) { - toExchangeOrder(); - } + // if (goods != null && + // points != null && + // int.tryParse(goods.price) < int.tryParse(points)) { + // toExchangeOrder(); + // } }, child: Container( padding: EdgeInsets.only(top: 16.h, bottom: 16.h), decoration: BoxDecoration( - color: (goods != null && - points != null && - int.tryParse(goods.price) < int.tryParse(points)) - ? Color(0xFF32A060) - : Color(0xFFD8D8D8), + color: + // (goods != null && + // points != null && + // int.tryParse(goods.price) < int.tryParse(points)) + // ? Color(0xFF32A060) + // : + Color(0xFFD8D8D8), borderRadius: BorderRadius.vertical( top: Radius.circular(4), ), ), alignment: Alignment.center, child: Text( - (goods != null && - points != null && - int.tryParse(goods.price) < int.tryParse(points)) - ? S.of(context).duihuan - : S.of(context).jifenbuzu, + // (goods != null && + // points != null && + // int.tryParse(goods.price) < int.tryParse(points)) + // ? S.of(context).duihuan + // : S.of(context).jifenbuzu, + "兑换功能暂未开放", style: TextStyle( fontSize: 16.sp, color: Color(0xFFFFFFFF), diff --git a/lib/retrofit/data/course_details.dart b/lib/retrofit/data/course_details.dart index 5edf03e5..e1437279 100644 --- a/lib/retrofit/data/course_details.dart +++ b/lib/retrofit/data/course_details.dart @@ -28,7 +28,8 @@ class CourseDetails { Author author, String introduce, int viewers, - int likes, + int likes, + bool selfLiked, bool state, int isDelete,}){ _id = id; @@ -44,6 +45,7 @@ class CourseDetails { _introduce = introduce; _viewers = viewers; _likes = likes; + _selfLiked = selfLiked; _state = state; _isDelete = isDelete; } @@ -62,6 +64,7 @@ class CourseDetails { _introduce = json['introduce']; _viewers = json['viewers']; _likes = json['likes']; + _selfLiked = json['selfLiked']; _state = json['state']; _isDelete = json['isDelete']; } @@ -78,6 +81,7 @@ class CourseDetails { String _introduce; int _viewers; int _likes; + bool _selfLiked; bool _state; int _isDelete; @@ -94,9 +98,15 @@ class CourseDetails { String get introduce => _introduce; int get viewers => _viewers; int get likes => _likes; + bool get selfLiked => _selfLiked; bool get state => _state; int get isDelete => _isDelete; + + set id(String value) { + _id = value; + } + Map toJson() { final map = {}; map['id'] = _id; @@ -114,11 +124,71 @@ class CourseDetails { map['introduce'] = _introduce; map['viewers'] = _viewers; map['likes'] = _likes; + map['selfLiked'] = _selfLiked; map['state'] = _state; map['isDelete'] = _isDelete; return map; } + set createTime(String value) { + _createTime = value; + } + + set createUser(String value) { + _createUser = value; + } + + set updateTime(String value) { + _updateTime = value; + } + + set updateUser(String value) { + _updateUser = value; + } + + set categoryId(String value) { + _categoryId = value; + } + + set subject(String value) { + _subject = value; + } + + set tags(List value) { + _tags = value; + } + + set coverImg(String value) { + _coverImg = value; + } + + set author(Author value) { + _author = value; + } + + set introduce(String value) { + _introduce = value; + } + + set viewers(int value) { + _viewers = value; + } + + set likes(int value) { + _likes = value; + } + + set selfLiked(bool value) { + _selfLiked = value; + } + + set state(bool value) { + _state = value; + } + + set isDelete(int value) { + _isDelete = value; + } } /// name : "1" diff --git a/lib/retrofit/min_api.dart b/lib/retrofit/min_api.dart index bd386bcc..7c11a416 100644 --- a/lib/retrofit/min_api.dart +++ b/lib/retrofit/min_api.dart @@ -21,13 +21,12 @@ import 'data/shoppingCart.dart'; part 'min_api.g.dart'; -const base_url = "https://pos.api.lotus-wallet.com/app/"; ///正式 -const baseUrl = "https://pos.api.lotus-wallet.com/app/"; ///正式 +// const base_url = "https://pos.api.lotus-wallet.com/app/"; ///正式 +// const baseUrl = "https://pos.api.lotus-wallet.com/app/"; ///正式 + +const base_url = "http://192.168.10.236:8765/app/";///费韬 +const baseUrl = "http://192.168.10.236:8765/app/";///费韬 -// const base_url = "http://192.168.10.236:8765/app/"; -///费韬 -// const baseUrl = "http://192.168.10.236:8765/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/min_api.g.dart b/lib/retrofit/min_api.g.dart index 02d9988a..1c1cc751 100644 --- a/lib/retrofit/min_api.g.dart +++ b/lib/retrofit/min_api.g.dart @@ -9,7 +9,7 @@ part of 'min_api.dart'; class _MinApiService implements MinApiService { _MinApiService(this._dio, {this.baseUrl}) { ArgumentError.checkNotNull(_dio, '_dio'); - baseUrl ??= 'https://pos.api.lotus-wallet.com/app/'; + baseUrl ??= 'http://192.168.10.236:8765/app/'; } final Dio _dio; diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index c05a9209..10b18133 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/lib/retrofit/retrofit_api.dart @@ -45,11 +45,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/"; @@ -422,4 +422,8 @@ abstract class ApiService { @GET("/course/{id}") Future> course(@Path("id") String id); + ///给文章/活动点赞 + @GET("/course/likes/{courseId}") + Future courseLikes(@Path("courseId") String courseId); + } diff --git a/lib/retrofit/retrofit_api.g.dart b/lib/retrofit/retrofit_api.g.dart index f0cbde1f..8c3cf22b 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; @@ -1509,4 +1509,26 @@ class _ApiService implements ApiService { return value; } + @override + Future> courseLikes(courseId) async { + ArgumentError.checkNotNull(courseId, 'courseId'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>( + '/course/likes/$courseId', + queryParameters: queryParameters, + options: RequestOptions( + method: 'GET', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => json as dynamic, + ); + return value; + } + } diff --git a/lib/union/union_page.dart b/lib/union/union_page.dart index 31e9ec14..a3bfcf92 100644 --- a/lib/union/union_page.dart +++ b/lib/union/union_page.dart @@ -1,5 +1,4 @@ import 'dart:ui'; - import 'package:dio/dio.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/gestures.dart'; @@ -13,7 +12,6 @@ import 'package:huixiang/main.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/store.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; -import 'package:huixiang/store/scan.dart'; import 'package:huixiang/utils/event_type.dart'; import 'package:huixiang/utils/location.dart'; import 'package:huixiang/view_widget/border_text.dart'; @@ -93,7 +91,6 @@ class _UnionPage extends State startLocation() async { EasyLoading.show(status: S.current.zhengzaijiazai); - Location.getInstance() .aMapFlutterLocation .onResultCallback()