From 23793051537e43cead97c1b62b9e70964a61997e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cyanghuaxuan=E2=80=9D?= <“646903573@qq.com”> Date: Wed, 3 Feb 2021 15:57:06 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BC=98=E5=8C=96=E5=95=86=E5=93=81=E5=88=97?= =?UTF-8?q?=E8=A1=A8TabBar=E7=82=B9=E5=87=BB=E5=A4=9A=E6=AC=A1=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=E9=A1=B5=E6=95=B0=E5=A2=9E=E5=8A=A0=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=202.=E4=BC=98=E5=8C=96=E8=AE=A2=E5=8D=95=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/android/app/build.gradle | 54 +++++----- example/pubspec.yaml | 2 +- .../intellect_search_goods_dialog.dart | 8 +- .../orders_page/views/order_item_widget.dart | 98 +++++++++++++++---- .../home/home_goods/bloc/home_goods_bloc.dart | 23 +++-- lib/widgets/home/home_goods/home_goods.dart | 1 + 6 files changed, 131 insertions(+), 55 deletions(-) diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 82f147d..f0c98e2 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -108,33 +108,33 @@ android { // 应用信息配置 -// productFlavors { -// // 智夜生活 -// zhiying { -// applicationId "cn.zhios.zhiying" -// versionCode 37 -// dimension "app" -// versionName '1.2.37' -// // 签名信息 -// signingConfig signingConfigs.zhiying -// } -// } -// -// // 打包脚本 -// android.applicationVariants.all { variant -> -// if (variant.buildType.name != "debug") { -// variant.getPackageApplicationProvider().get().outputDirectory = new File(project.rootDir.absolutePath + "/app/build/outputs/apk") -// } -// -// variant.outputs.all { output -> -// def outputFile = output.outputFile -// if (outputFile != null && outputFile.name.endsWith('.apk')) { -// //这里修改apk文件名 -// def fileName = "${variant.productFlavors[0].name}_${releaseTime()}01_&V${variant.productFlavors[0].versionCode}.apk" -// outputFileName = fileName -// } -// } -// } + productFlavors { + // 智夜生活 + zhiying { + applicationId "cn.zhios.zhiying" + versionCode 38 + dimension "app" + versionName '1.2.38' + // 签名信息 + signingConfig signingConfigs.zhiying + } + } + + // 打包脚本 + android.applicationVariants.all { variant -> + if (variant.buildType.name != "debug") { + variant.getPackageApplicationProvider().get().outputDirectory = new File(project.rootDir.absolutePath + "/app/build/outputs/apk") + } + + variant.outputs.all { output -> + def outputFile = output.outputFile + if (outputFile != null && outputFile.name.endsWith('.apk')) { + //这里修改apk文件名 + def fileName = "${variant.productFlavors[0].name}_${releaseTime()}01_&V${variant.productFlavors[0].versionCode}.apk" + outputFileName = fileName + } + } + } configurations.all { resolutionStrategy.eachDependency { DependencyResolveDetails details -> diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 353f151..a8d1f73 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -38,7 +38,7 @@ dev_dependencies: zhiying_moments: #path: ../zhiying_moments git: - ref: 0.0.4 + ref: 0.0.5 url: http://192.168.0.138:3000/FnuoOS_ZhiYing/zhiying_moments.git # For information on the generic Dart part of this file, see the diff --git a/lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_search_goods_dialog.dart b/lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_search_goods_dialog.dart index 20d2fb0..3268f86 100644 --- a/lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_search_goods_dialog.dart +++ b/lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_search_goods_dialog.dart @@ -353,18 +353,20 @@ class _IntellectSearchGoodsDialogState return; } else { print("平台" + widget?.model?.provider ?? ""); + if(!widget?.model?.couponUrl.contains("http")){ + widget?.model?.couponUrl="https:"+widget?.model?.couponUrl; + } + widget?.model?.couponUrl=widget?.model?.couponUrl.replaceAll("\\", ""); print("链接" + widget?.model?.couponUrl ?? ""); if (widget?.model?.provider == 'taobao') { TradeResult result; if (Platform.isAndroid) { result = await FlutterAlibc.openByUrl( url: widget?.model?.couponUrl ?? "", - openType: AlibcOpenType.AlibcOpenTypeNative, backUrl: "alisdk://"); } else if (Platform.isIOS) { result = await FlutterAlibc.openByUrl( - url: widget?.model?.couponUrl ?? "", - openType: AlibcOpenType.AlibcOpenTypeNative, + url: widget?.model?.couponUrl ?? "" ); } Logger.debug('${result.errorCode} ${result.errorMessage} '); diff --git a/lib/pages/orders_page/views/order_item_widget.dart b/lib/pages/orders_page/views/order_item_widget.dart index 3b28e02..7527de1 100644 --- a/lib/pages/orders_page/views/order_item_widget.dart +++ b/lib/pages/orders_page/views/order_item_widget.dart @@ -1,4 +1,5 @@ import 'dart:io'; +import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -66,7 +67,7 @@ class OrderItemWidget extends StatelessWidget { color: Color(0xff333333), ), ), - (model?.priceName == null|| model?.priceName.length==0) + (model?.priceName == null || model?.priceName.length == 0) ? Container() : Container( decoration: BoxDecoration(color: Colors.red, borderRadius: BorderRadius.circular(4)), @@ -95,6 +96,8 @@ class OrderItemWidget extends StatelessWidget { } Widget _createCenter() { + List states = style.list.orderState; + OrderStateModel state = states.firstWhere((element) => element.type == model.state.toString()); return Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -147,21 +150,34 @@ class OrderItemWidget extends StatelessWidget { ], ), _creteText('${style?.list?.textOrderTime ?? ''}${model?.createAt ?? ''}'), - _creteText('${style?.list?.textFinishTime ?? ''}${model?.confirmAt ?? ''}'), - Row( + _creteText('${style?.list?.textFinishTime ?? ''}${model?.confirmAt ?? '---'}'), + state.type!='4' ? Row( + crossAxisAlignment: CrossAxisAlignment.baseline, + textBaseline: TextBaseline.alphabetic, children: [ - _cretePriceText('订单金额:${model?.itemPrice??''}'), + _cretePriceText('${state?.amountText}${model?.paidPrice ?? ''}'), Spacer(), Row( crossAxisAlignment: CrossAxisAlignment.baseline, - textBaseline: TextBaseline.ideographic, + textBaseline: TextBaseline.alphabetic, children: [ - Text("收益:¥",style: TextStyle(color: HexColor.fromHex("#FFFF4242"),fontSize: 10),), - Text(model?.userCommission??"",style: TextStyle(color: HexColor.fromHex("#FFFF4242"),fontSize: 18),) + Text( + '${state?.incomeText??""}', + style: TextStyle(color: HexColor.fromHex("#FFFF4242"), fontSize: 10), + ), + Text( + model?.userCommission ?? "", + style: TextStyle(color: HexColor.fromHex("#FFFF4242"), fontSize: 18), + ) ], ) ], - ) + ): + Row( + children: [ + Text(state?.tips.replaceAll(state?.tipsReplaceKey, model?.reason??""),style: TextStyle(color: HexColor.fromHex("#FFFF4242"),fontSize: 12),) + ], + ) ], ), ) @@ -224,15 +240,15 @@ class OrderItemWidget extends StatelessWidget { return text == null || text == '' ? Container() : Padding( - padding: EdgeInsets.only(top: 2, bottom: 2), - child: Text( - text, - style: TextStyle( - fontSize: 10, - color: HexColor.fromHex("#FF333333"), - ), - ), - ); + padding: EdgeInsets.only(top: 2, bottom: 2), + child: Text( + text, + style: TextStyle( + fontSize: 10, + color: HexColor.fromHex("#FF333333"), + ), + ), + ); } Widget _createTips() { @@ -241,13 +257,59 @@ class OrderItemWidget extends StatelessWidget { if (state == null || state.tips == null || state.tips == '') { return Container(); } + Widget centerWidget; + String str1; + String str2; + if (state.type == '3' || state.type == '4') { + // state?.tips=(state?.tips ?? '').replaceAll(state?.tipsReplaceKey,model?.reason); + // state?.tips=(state?.tips ?? '').replaceAll(state?.tipsReplaceKey,"2007-0808"); + + var strs = state.tips.split(state?.tipsReplaceKey); + if (strs.length >= 1) { + str1 = strs[0]; + } + if (strs.length >= 2) { + str2 = strs[1]; + } + + ///时间 + if (state.type == '3') { + centerWidget = Text( + (model.settleAt ?? ''), + style: TextStyle(color: HexColor.fromHex(state?.tipsReplaceColor ?? ""), fontSize: 10), + ); + } + + ///失效原因 + if (state.type == '4') { + centerWidget = Text( + (model.reason ?? ''), + style: TextStyle(color: HexColor.fromHex(state?.tipsReplaceColor ?? ""), fontSize: 10), + ); + + } + } + + if (centerWidget != null) { + return Container( + margin: EdgeInsets.only(top: 8), + padding: EdgeInsets.only(left: 8, right: 8, top: 2, bottom: 2), + width: double.infinity, + decoration: BoxDecoration(color: HexColor.fromHex(style.list.colorTipsBg ?? '#f5f5f5'), borderRadius: BorderRadius.circular(4)), + child: Row(children: [ + Text(str1 ?? "", style: TextStyle(color: Color(0xff666666), fontSize: 10)), + centerWidget, + Text(str2 ?? "", style: TextStyle(color: Color(0xff666666), fontSize: 10)), + ])); + } + return Container( margin: EdgeInsets.only(top: 8), padding: EdgeInsets.only(left: 8, right: 8, top: 2, bottom: 2), width: double.infinity, decoration: BoxDecoration(color: HexColor.fromHex(style.list.colorTipsBg ?? '#f5f5f5'), borderRadius: BorderRadius.circular(4)), child: Text( - state?.tips ?? '', + (state?.tips ?? ''), style: TextStyle(color: Color(0xff666666), fontSize: 10), ), ); diff --git a/lib/widgets/home/home_goods/bloc/home_goods_bloc.dart b/lib/widgets/home/home_goods/bloc/home_goods_bloc.dart index 0e92617..832392d 100644 --- a/lib/widgets/home/home_goods/bloc/home_goods_bloc.dart +++ b/lib/widgets/home/home_goods/bloc/home_goods_bloc.dart @@ -12,7 +12,7 @@ class HomeGoodsBloc extends BlocBase implements CategoryGoodsOnClickCallBack { dynamic _provider; String providerss = ''; - int _page = 1; + int page = 1; StreamController> _goodsController = StreamController>(); @@ -24,20 +24,30 @@ class HomeGoodsBloc extends BlocBase implements CategoryGoodsOnClickCallBack { _goodsController = null; } + bool loading=false; + void loadMore(dynamic provider) { + ///避免多次下拉刷新出现跳页加载的情况 + if(loading){ + return ; + } + loading=true; + Timer(Duration(milliseconds: 2000), (){ + loading=false; + }); if (provider != _provider) { - _page = 1; + page = 1; } _provider = provider; - if (_page == 1) { + if (page == 1) { _goods.clear(); } - NetUtil.request('/api/v1/rec?page=${_page.toString()}', + NetUtil.request('/api/v1/rec?page=${page.toString()}', queryParameters: _provider, method: NetMethod.GET, - onCache: _page == 1 + onCache: page == 1 ? (data) { if (!EmptyUtil.isEmpty(data)) { if (data.containsKey('good')) { @@ -65,7 +75,7 @@ class HomeGoodsBloc extends BlocBase implements CategoryGoodsOnClickCallBack { return HomeGoodsModel.fromJson(Map.from(item)); }).toList(); if (goods.length > 0) { - _page++; + page++; } _goods.addAll(goods); } @@ -78,6 +88,7 @@ class HomeGoodsBloc extends BlocBase implements CategoryGoodsOnClickCallBack { void onTap(int index, String providerType) { Logger.error('index = $index, providerType = $providerType'); _provider = providerType; + page=1; loadMore(providerType); } } diff --git a/lib/widgets/home/home_goods/home_goods.dart b/lib/widgets/home/home_goods/home_goods.dart index 7bb1d6d..6bc855a 100644 --- a/lib/widgets/home/home_goods/home_goods.dart +++ b/lib/widgets/home/home_goods/home_goods.dart @@ -70,6 +70,7 @@ class _HomeGoodsContainerState extends State<_HomeGoodsContainer> { // } _isFirstLoading = false; _provider = data.provider; + _bloc.page=1; _bloc.loadMore(_provider); });