Browse Source

首页更改,课程更改;积分ui更改

ff_new
w-R 3 years ago
parent
commit
9a48477902
  1. BIN
      assets/image/2x/integral_return.png
  2. BIN
      assets/image/3x/integral_return.png
  3. BIN
      assets/image/integral_return.png
  4. 16
      lib/community/community_course.dart
  5. 65
      lib/community/community_view/class_details.dart
  6. 9
      lib/community/community_view/course_banner.dart
  7. 15
      lib/home/home_page.dart
  8. 3
      lib/home/home_view/home_integral_store.dart
  9. 6
      lib/home/home_view/shortcut_operation.dart
  10. 67
      lib/integral_store/integral_store_details_page.dart
  11. 6
      lib/main_page.dart
  12. 37
      lib/order/exchange_order_page.dart
  13. 12
      lib/retrofit/retrofit_api.dart
  14. 6
      lib/retrofit/retrofit_api.g.dart
  15. 10
      lib/web/web_view/comment_list.dart

BIN
assets/image/2x/integral_return.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
assets/image/3x/integral_return.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
assets/image/integral_return.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 526 B

16
lib/community/community_course.dart

@ -61,14 +61,24 @@ class _CommunityCourse extends State<CommunityCourse>
setState(() {}); setState(() {});
} }
}); });
queryCourseBanner();
classListAsync(); classListAsync();
collectionList(); collectionList();
// courseDetails("1451753512101740544"); }
///banner
queryCourseBanner() async {
BaseData<PageInfo<BannerData>> banner = await apiService.queryBanner({
"model": {"type": "COURSE_BANNER"},
}).catchError((error) {
refreshController.refreshFailed();
});
bannerData.clear();
bannerData.addAll(banner.data.records);
} }
/// ///
classListAsync() async classListAsync() async {
{
if (apiService == null) { if (apiService == null) {
SharedPreferences value = await SharedPreferences.getInstance(); SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService( apiService = ApiService(

65
lib/community/community_view/class_details.dart

@ -1,3 +1,5 @@
import 'dart:io';
import 'package:chewie/chewie.dart'; import 'package:chewie/chewie.dart';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
@ -42,11 +44,9 @@ class _ClassDetails extends State<ClassDetails> with WidgetsBindingObserver{
var commentFocus = FocusNode(); var commentFocus = FocusNode();
String parenId = "0"; String parenId = "0";
String hintText = S.current.liuxianinjingcaidepinglunba; String hintText = S.current.liuxianinjingcaidepinglunba;
List<MemberCommentList> memberList = [];
final GlobalKey inputKey = GlobalKey(); final GlobalKey inputKey = GlobalKey();
final TextEditingController commentTextController = TextEditingController(); final TextEditingController commentTextController = TextEditingController();
int commentTotal = 0; int commentTotal = 0;
double commentHeight = 60.h;
CourseDetails course; CourseDetails course;
List<Chapter> chapterList = []; List<Chapter> chapterList = [];
bool isShowImg = true; bool isShowImg = true;
@ -149,6 +149,9 @@ class _ClassDetails extends State<ClassDetails> with WidgetsBindingObserver{
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
body: Container( body: Container(
child:Column(
children: [
Expanded(
child: SingleChildScrollView( child: SingleChildScrollView(
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
child: Column( child: Column(
@ -309,13 +312,16 @@ class _ClassDetails extends State<ClassDetails> with WidgetsBindingObserver{
CommentList( CommentList(
commentKey, commentKey,
course?.likes ?? course?.likes?? 0, course?.likes ?? course?.likes?? 0,
course?.id ?? course?.id ??"", widget.arguments["id"],
isKeyBoardShow, isKeyBoardShow,
_reply, _reply,
_delCommentTips, _delCommentTips,
12.sp, 12.sp,
requestApiFinish: (total){setState(() {
commentTotal = total;
});},
), ),
if (memberList == null || memberList.length == 0) if (commentTotal == 0)
Container( Container(
width: double.infinity, width: double.infinity,
alignment: Alignment.topCenter, alignment: Alignment.topCenter,
@ -332,6 +338,10 @@ class _ClassDetails extends State<ClassDetails> with WidgetsBindingObserver{
), ),
), ),
), ),
],
),
),
flex: 1,),
/// ///
InputComment( InputComment(
inputKey, inputKey,
@ -347,7 +357,6 @@ class _ClassDetails extends State<ClassDetails> with WidgetsBindingObserver{
], ],
), ),
), ),
),
); );
} }
@ -517,25 +526,9 @@ class _ClassDetails extends State<ClassDetails> with WidgetsBindingObserver{
); );
} }
contentHeight() {
double contentHeight = MediaQuery
.of(context)
.size
.height -
kToolbarHeight -
MediaQuery
.of(context)
.padding
.top -
160.h;
if ((contentHeight - 60.h) > (128.h * memberList.length)) {
commentHeight = contentHeight - (128.h * memberList.length);
}
}
//// ////
_queryInformationLikes() async { _queryInformationLikes() async {
BaseData baseData = await apiService.informationLikes("1455102859841372160"); BaseData baseData = await apiService.informationLikes(widget.arguments["id"]);
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
commentKey.currentState.setState(() {}); commentKey.currentState.setState(() {});
setState(() { setState(() {
@ -555,7 +548,7 @@ class _ClassDetails extends State<ClassDetails> with WidgetsBindingObserver{
BaseData baseData = await apiService.memberComment({ BaseData baseData = await apiService.memberComment({
"content": content, "content": content,
"parentId": parenId, "parentId": parenId,
"relationalId":course.id, "relationalId":widget.arguments["id"],
"relationalType": 1 "relationalType": 1
}).catchError((error) {}); }).catchError((error) {});
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
@ -563,32 +556,6 @@ class _ClassDetails extends State<ClassDetails> with WidgetsBindingObserver{
state.queryMemberCommentList(); state.queryMemberCommentList();
commentTextController.text = ""; commentTextController.text = "";
FocusScope.of(context).unfocus(); FocusScope.of(context).unfocus();
_queryMemberCommentList();
}
}
///
_queryMemberCommentList() async {
SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
if (apiService == null)
apiService = ApiService(
Dio(),
context: context,
token: sharedPreferences.getString("token"),
showLoading: false,
);
BaseData<PageInfo<MemberCommentList>> baseData =
await apiService.memberCommentList({
"pageNum": 1,
"pageSize": 100,
"relationalId":course.id,
"relationalType": 1,
}).catchError((error) {});
if (baseData != null && baseData.isSuccess) {
commentTotal = baseData.data.size;
memberList = baseData.data.list;
contentHeight();
if (mounted) setState(() {});
} }
} }

9
lib/community/community_view/course_banner.dart

@ -4,7 +4,11 @@ import 'dart:convert';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_swiper/flutter_swiper.dart'; import 'package:flutter_swiper/flutter_swiper.dart';
import 'package:huixiang/retrofit/data/banner.dart'; import 'package:huixiang/retrofit/data/banner.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/page.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/custom_image.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
class CourseBanner extends StatefulWidget { class CourseBanner extends StatefulWidget {
@ -20,6 +24,11 @@ class CourseBanner extends StatefulWidget {
} }
class _CourseBanner extends State<CourseBanner> { class _CourseBanner extends State<CourseBanner> {
ApiService apiService;
final RefreshController refreshController = RefreshController();
List<BannerData> bannerData = [];
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(

15
lib/home/home_page.dart

@ -35,21 +35,18 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'home_view/shortcut_operation.dart'; import 'home_view/shortcut_operation.dart';
class HomePage extends StatefulWidget { class HomePage extends StatefulWidget {
final GestureTapCallback callback; final Function changeTab;
HomePage(this.callback); HomePage(this.changeTab);
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
return _HomePage(callback); return _HomePage();
} }
} }
class _HomePage extends State<HomePage> with AutomaticKeepAliveClientMixin { class _HomePage extends State<HomePage> with AutomaticKeepAliveClientMixin {
ApiService apiService; ApiService apiService;
final GestureTapCallback callback;
_HomePage(this.callback);
@override @override
void initState() { void initState() {
@ -267,7 +264,9 @@ class _HomePage extends State<HomePage> with AutomaticKeepAliveClientMixin {
HomeBanner(bannerData, controller), HomeBanner(bannerData, controller),
/// ///
ShortcutOperation(), ShortcutOperation((){
widget.changeTab(1);
}),
/// ///
SignView(isSigned,(value){setState(() { SignView(isSigned,(value){setState(() {
@ -288,7 +287,7 @@ class _HomePage extends State<HomePage> with AutomaticKeepAliveClientMixin {
// CouponView(), // CouponView(),
/// ///
HomeIntegralStore(gooods, callback), HomeIntegralStore(gooods),
/// ///
FeaturedActivity(), FeaturedActivity(),

3
lib/home/home_view/home_integral_store.dart

@ -9,10 +9,9 @@ import 'package:huixiang/view_widget/item_title.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
class HomeIntegralStore extends StatefulWidget { class HomeIntegralStore extends StatefulWidget {
final GestureTapCallback callback;
final List<Goods> gooods; final List<Goods> gooods;
HomeIntegralStore(this.gooods, this.callback); HomeIntegralStore(this.gooods);
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {

6
lib/home/home_view/shortcut_operation.dart

@ -12,6 +12,10 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
class ShortcutOperation extends StatefulWidget { class ShortcutOperation extends StatefulWidget {
final Function goToOrder;
ShortcutOperation(this.goToOrder);
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
return _ShortcutOperation(); return _ShortcutOperation();
@ -38,7 +42,7 @@ class _ShortcutOperation extends State<ShortcutOperation> {
children: [ children: [
GestureDetector( GestureDetector(
onTap: (){ onTap: (){
widget.goToOrder();
}, },
child: Container( child: Container(
width: 106, width: 106,

67
lib/integral_store/integral_store_details_page.dart

@ -194,62 +194,67 @@ class _IntegralStoreDetailsPage extends State {
Container( Container(
padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Expanded( Text(
child: Text( goods == null ? "" : S.of(context).jifen_(goods.price),
goods == null ? "" : goods.name,
overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
fontWeight: MyFontWeight.semi_bold, fontWeight: MyFontWeight.semi_bold,
fontSize: 18.sp, fontSize: 18.sp,
color: Color(0xFF353535), color: Color(0xFF32A060),
), ),
), ),
flex: 1, SizedBox(
width: 10.w,
), ),
Text( Expanded(child: Text(
goods == null S.of(context).yuan_(goods.worth),
? ""
: S.of(context).yiduihuanjian("${goods.sales}"),
style: TextStyle( style: TextStyle(
fontSize: 10.sp, color: Color(0xFF585858),
decoration: TextDecoration.lineThrough,
decorationColor: Color(0xFF585858),
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
color: Color(0xFFA29E9E), fontSize: 14.sp,
),
),),
Text(
"库存:${goods.stock}",
style: TextStyle(
color: Color(0xFF585858),
decorationColor: Color(0xFF353535),
fontWeight: MyFontWeight.medium,
fontSize: 12.sp,
), ),
), ),
], ],
), ),
SizedBox( SizedBox(
height: 11.h, height: 8.h,
), ),
Row( Text(
mainAxisAlignment: MainAxisAlignment.spaceBetween, goods == null ? "" : goods.name,
crossAxisAlignment: CrossAxisAlignment.start, overflow: TextOverflow.ellipsis,
children: [
Expanded(
child: Text(
goods == null ? "" : goods.description,
style: TextStyle( style: TextStyle(
fontSize: 12.sp, fontWeight: MyFontWeight.semi_bold,
fontWeight: MyFontWeight.regular, fontSize: 15.sp,
color: Color(0xFF727272), color: Color(0xFF353535),
), ),
), ),
flex: 1, SizedBox(
height: 11.h,
), ),
Text( Text(
goods == null ? "" : S.of(context).jifen_(goods.price), goods == null ? "" : goods.description,
style: TextStyle( style: TextStyle(
fontWeight: MyFontWeight.semi_bold, fontSize: 12.sp,
fontSize: 16.sp, fontWeight: MyFontWeight.regular,
color: Color(0xFF32A060), color: Color(0xFF727272),
),
), ),
],
), ),
], ],
), ),

6
lib/main_page.dart

@ -78,7 +78,11 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
_widgetOptions = <Widget>[ _widgetOptions = <Widget>[
// BrandPage(), // BrandPage(),
HomePage(() {}), HomePage((index) {
setState(() {
pageController.jumpToPage(index);
});
}),
// MainHomePage(), // MainHomePage(),
UnionPage(), UnionPage(),
CommunityPage(), CommunityPage(),

37
lib/order/exchange_order_page.dart

@ -4,11 +4,14 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:fluwx/fluwx.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/user_info.dart'; import 'package:huixiang/retrofit/data/user_info.dart';
import 'package:huixiang/retrofit/data/wx_pay.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/utils/min.dart';
import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -662,10 +665,44 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
"goodsId": widget.arguments["goodsId"], "goodsId": widget.arguments["goodsId"],
"number": 1, "number": 1,
"useTyped": widget.arguments["useTyped"], "useTyped": widget.arguments["useTyped"],
"payChannel":checkIndex == 3?"1":"4",
if (widget.arguments["useTyped"] == 1) "storeId": storeId, if (widget.arguments["useTyped"] == 1) "storeId": storeId,
if (widget.arguments["useTyped"] == 2) "userAddressId": userAddressId, if (widget.arguments["useTyped"] == 2) "userAddressId": userAddressId,
}); });
if (baseDate.isSuccess) { if (baseDate.isSuccess) {
if(checkIndex == 3){
if (!(await Min.isInitialize())) {
// app的充值支付使用同一个WXPayEntryActivity回调
// getPackage空指针
//
await Min.initialize();
}
WxPay wxPay = WxPay.fromJson(baseDate.data);
await registerWxApi(
appId: wxPay.appId,
doOnAndroid: true,
universalLink: "https://hx.lotus-wallet.com/app/",
);
payWithWeChat(
appId: wxPay.appId,
partnerId: wxPay.partnerId,
prepayId: wxPay.prepayId,
packageValue: wxPay.packageValue,
nonceStr: wxPay.nonceStr,
timeStamp: int.tryParse(wxPay.timeStamp),
sign: wxPay.sign,
);
weChatResponseEventHandler.listen((event) async {
print("payCallback: ${event.errCode}");
Navigator.of(context).popAndPushNamed(
'/router/order_details',
arguments: {
"id": widget.arguments["goodsId"],
},
);
});
return;
}
await Navigator.of(context) await Navigator.of(context)
.pushNamed('/router/exchange_order_success_page', arguments: { .pushNamed('/router/exchange_order_success_page', arguments: {
"price": widget.arguments["price"], "price": widget.arguments["price"],

12
lib/retrofit/retrofit_api.dart

@ -45,15 +45,19 @@ import 'data/wx_pay.dart';
part 'retrofit_api.g.dart'; part 'retrofit_api.g.dart';
// const base_url = "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 baseUrl = "https://pos.platform.lotus-wallet.com/app/"; ///
const base_url = "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 baseUrl = "http://192.168.10.236:8766/app/"; ///
// const base_url = "http://192.168.10.37:8766/app/"; // const base_url = "http://192.168.10.37:8766/app/";
// const baseUrl = "http://192.168.10.37:8766/app/"; // const baseUrl = "http://192.168.10.37:8766/app/";
// const base_url = "http://192.168.10.130:8766/app/";///
// const baseUrl = "http://192.168.10.130:8766/app/";///
@RestApi(baseUrl: baseUrl) @RestApi(baseUrl: baseUrl)
abstract class ApiService { abstract class ApiService {
factory ApiService( factory ApiService(

6
lib/retrofit/retrofit_api.g.dart

@ -9,7 +9,7 @@ part of 'retrofit_api.dart';
class _ApiService implements ApiService { class _ApiService implements ApiService {
_ApiService(this._dio, {this.baseUrl}) { _ApiService(this._dio, {this.baseUrl}) {
ArgumentError.checkNotNull(_dio, '_dio'); ArgumentError.checkNotNull(_dio, '_dio');
baseUrl ??= 'http://192.168.10.236:8766/app/'; baseUrl ??= 'https://pos.platform.lotus-wallet.com/app/';
} }
final Dio _dio; final Dio _dio;
@ -346,13 +346,15 @@ class _ApiService implements ApiService {
const _extra = <String, dynamic>{}; const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{}; final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{}; final _data = <String, dynamic>{};
final _headers = <String, dynamic>{};
_headers.addAll({"Environment":"app"});
_data.addAll(param ?? <String, dynamic>{}); _data.addAll(param ?? <String, dynamic>{});
final _result = await _dio.request<Map<String, dynamic>>( final _result = await _dio.request<Map<String, dynamic>>(
'/creditOrder/create', '/creditOrder/create',
queryParameters: queryParameters, queryParameters: queryParameters,
options: RequestOptions( options: RequestOptions(
method: 'POST', method: 'POST',
headers: <String, dynamic>{}, headers: _headers,
extra: _extra, extra: _extra,
baseUrl: baseUrl), baseUrl: baseUrl),
data: _data); data: _data);

10
lib/web/web_view/comment_list.dart

@ -23,9 +23,10 @@ class CommentList extends StatefulWidget {
final double fontSize; final double fontSize;
final String relationalId; final String relationalId;
final int like; final int like;
final Function requestApiFinish;
CommentList(Key key, this.like, this.relationalId, CommentList(Key key, this.like, this.relationalId,
this.isKeyBoardShow, this.reply, this.delCommentTips, this.fontSize) this.isKeyBoardShow, this.reply, this.delCommentTips, this.fontSize,{this.requestApiFinish})
: super(key: key); : super(key: key);
@override @override
@ -197,6 +198,8 @@ class CommentListState extends State<CommentList> {
// //
queryMemberCommentList() async { queryMemberCommentList() async {
if(widget?.relationalId == null || widget.relationalId.isEmpty)
return;
SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
if (apiService == null) if (apiService == null)
apiService = ApiService( apiService = ApiService(
@ -213,10 +216,13 @@ class CommentListState extends State<CommentList> {
"relationalType": 1, "relationalType": 1,
}).catchError((error) {}); }).catchError((error) {});
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
setState(() {
commentTotal = baseData.data.size; commentTotal = baseData.data.size;
memberList = baseData.data.list; widget.requestApiFinish(commentTotal);
memberList.addAll(baseData.data.list);
contentHeight(); contentHeight();
setState(() {}); setState(() {});
});
} }
} }

Loading…
Cancel
Save