diff --git a/README.md b/README.md
index cbc20081..aa4f7f4f 100644
--- a/README.md
+++ b/README.md
@@ -84,6 +84,9 @@ samples, guidance on mobile development, and a full API reference.
小米开放平台 83364300@qq.com 具体问 :(汪姐)
推送:使用腾讯云推送 tpns 需扫码登录 (有问题同华为➕微信||或重新注册账号替换相关appKey)
+
+ 友盟: wu_rong 密码:Zxc09876
+
https://pos.platform.lotus-wallet.com/app/ 生产环境
http://192.168.10.236:8765/app/ 测试环境
diff --git a/assets/image/2x/icon_by_bike.webp b/assets/image/2x/icon_by_bike.webp
new file mode 100644
index 00000000..50ccc0ed
Binary files /dev/null and b/assets/image/2x/icon_by_bike.webp differ
diff --git a/assets/image/2x/icon_drive.webp b/assets/image/2x/icon_drive.webp
new file mode 100644
index 00000000..972be59d
Binary files /dev/null and b/assets/image/2x/icon_drive.webp differ
diff --git a/assets/image/2x/icon_search.webp b/assets/image/2x/icon_search.webp
new file mode 100644
index 00000000..7aa75c66
Binary files /dev/null and b/assets/image/2x/icon_search.webp differ
diff --git a/assets/image/2x/icon_transit.webp b/assets/image/2x/icon_transit.webp
new file mode 100644
index 00000000..523aa8b0
Binary files /dev/null and b/assets/image/2x/icon_transit.webp differ
diff --git a/assets/image/2x/icon_walk.webp b/assets/image/2x/icon_walk.webp
new file mode 100644
index 00000000..38e49db1
Binary files /dev/null and b/assets/image/2x/icon_walk.webp differ
diff --git a/assets/image/2x/position_sort.webp b/assets/image/2x/position_sort.webp
new file mode 100644
index 00000000..afb9000e
Binary files /dev/null and b/assets/image/2x/position_sort.webp differ
diff --git a/assets/image/3x/icon_by_bike.webp b/assets/image/3x/icon_by_bike.webp
new file mode 100644
index 00000000..de4e78ae
Binary files /dev/null and b/assets/image/3x/icon_by_bike.webp differ
diff --git a/assets/image/3x/icon_drive.webp b/assets/image/3x/icon_drive.webp
new file mode 100644
index 00000000..098241c2
Binary files /dev/null and b/assets/image/3x/icon_drive.webp differ
diff --git a/assets/image/3x/icon_search.webp b/assets/image/3x/icon_search.webp
new file mode 100644
index 00000000..d3f8316e
Binary files /dev/null and b/assets/image/3x/icon_search.webp differ
diff --git a/assets/image/3x/icon_transit.webp b/assets/image/3x/icon_transit.webp
new file mode 100644
index 00000000..11283036
Binary files /dev/null and b/assets/image/3x/icon_transit.webp differ
diff --git a/assets/image/3x/icon_walk.webp b/assets/image/3x/icon_walk.webp
new file mode 100644
index 00000000..98d95216
Binary files /dev/null and b/assets/image/3x/icon_walk.webp differ
diff --git a/assets/image/3x/position_sort.webp b/assets/image/3x/position_sort.webp
new file mode 100644
index 00000000..b51630af
Binary files /dev/null and b/assets/image/3x/position_sort.webp differ
diff --git a/assets/image/icon_by_bike.webp b/assets/image/icon_by_bike.webp
new file mode 100644
index 00000000..d7871091
Binary files /dev/null and b/assets/image/icon_by_bike.webp differ
diff --git a/assets/image/icon_drive.webp b/assets/image/icon_drive.webp
new file mode 100644
index 00000000..67dcf346
Binary files /dev/null and b/assets/image/icon_drive.webp differ
diff --git a/assets/image/icon_end.png b/assets/image/icon_end.png
new file mode 100644
index 00000000..2f288f4c
Binary files /dev/null and b/assets/image/icon_end.png differ
diff --git a/assets/image/icon_search.webp b/assets/image/icon_search.webp
new file mode 100644
index 00000000..d785e21d
Binary files /dev/null and b/assets/image/icon_search.webp differ
diff --git a/assets/image/icon_start.png b/assets/image/icon_start.png
new file mode 100644
index 00000000..ffc9a673
Binary files /dev/null and b/assets/image/icon_start.png differ
diff --git a/assets/image/icon_transit.webp b/assets/image/icon_transit.webp
new file mode 100644
index 00000000..844c3f1b
Binary files /dev/null and b/assets/image/icon_transit.webp differ
diff --git a/assets/image/icon_walk.webp b/assets/image/icon_walk.webp
new file mode 100644
index 00000000..1ec11af8
Binary files /dev/null and b/assets/image/icon_walk.webp differ
diff --git a/assets/image/position_sort.webp b/assets/image/position_sort.webp
new file mode 100644
index 00000000..c0b20055
Binary files /dev/null and b/assets/image/position_sort.webp differ
diff --git a/assets/image/traffic_texture_smooth.png b/assets/image/traffic_texture_smooth.png
new file mode 100644
index 00000000..e4252dc4
Binary files /dev/null and b/assets/image/traffic_texture_smooth.png differ
diff --git a/assets/image/traffic_texture_unknown.png b/assets/image/traffic_texture_unknown.png
new file mode 100644
index 00000000..2e84a9cd
Binary files /dev/null and b/assets/image/traffic_texture_unknown.png differ
diff --git a/assets/map_style/chinese_cities.json b/assets/map_style/chinese_cities.json
new file mode 100644
index 00000000..b2a647be
--- /dev/null
+++ b/assets/map_style/chinese_cities.json
@@ -0,0 +1,14 @@
+{
+ "热门城市": [
+ {"area": "武汉"},
+ {"area": "北京"},
+ { "area": "郑州" }
+ ],
+ "B": [
+ { "area": "北京" }
+ ],
+ "W": [{ "area": "武汉" }],
+ "Z": [
+ { "area": "郑州" }
+ ]
+}
\ No newline at end of file
diff --git a/ios/Podfile.lock b/ios/Podfile.lock
index 9c6ea487..7dc542bd 100644
--- a/ios/Podfile.lock
+++ b/ios/Podfile.lock
@@ -49,8 +49,7 @@ PODS:
- image_pickers (0.0.1):
- AFNetworking
- Flutter
- - SDWebImage
- - ZLPhotoBrowser (~> 4.3.9)
+ - ZLPhotoBrowser-objc (= 1.0.4)
- mob_sharesdk (4.4.15):
- mob_sharesdk/ShareSDK (= 4.4.15)
- MOBFoundation (>= 3.2.9)
@@ -240,9 +239,8 @@ PODS:
- Flutter
- webview_flutter (0.0.1):
- Flutter
- - ZLPhotoBrowser (4.3.9):
- - ZLPhotoBrowser/Core (= 4.3.9)
- - ZLPhotoBrowser/Core (4.3.9)
+ - ZLPhotoBrowser-objc (1.0.4):
+ - SDWebImage
DEPENDENCIES:
- emoji_picker_flutter (from `.symlinks/plugins/emoji_picker_flutter/ios`)
@@ -283,7 +281,7 @@ SPEC REPOS:
- TPNS-iOS
- UMCommon
- UMDevice
- - ZLPhotoBrowser
+ - ZLPhotoBrowser-objc
EXTERNAL SOURCES:
emoji_picker_flutter:
@@ -347,7 +345,7 @@ SPEC CHECKSUMS:
flutter_baidu_mapapi_utils: f6a5d23da26b0e58f1ae9908da7ba87fd48384b1
flutter_bmflocation: 1bd73181196567fe1529f765aa4f8e2615a8a3cf
fluwx: 838466d89c1ba099f6eec36c514801658371cda5
- image_pickers: 4406949954a5eb4fac5ada5f13810e6419ef4467
+ image_pickers: 25c8916d358bc9d2707cb470ba3d57497f105773
mob_sharesdk: 0698d60b3c1549a5b0bcfdec6f407439dd2960c0
MOBFoundation: 6df2684b4db4f0f5bd71b0623f82e11271bf7ac8
number_precision: 26fa2be2212f9d1429f92d667d6b0aa4df0058d8
@@ -370,7 +368,7 @@ SPEC CHECKSUMS:
video_player_avfoundation: 6d971a232d72e6ee25368378d48a079dea01f1cf
wakelock: d0fc7c864128eac40eba1617cb5264d9c940b46f
webview_flutter: 5fb4def2bbd4339889ee14d045b605cefc5bc232
- ZLPhotoBrowser: 02b3569b8f702d2e153e8fdb1f6b32fef3a2867c
+ ZLPhotoBrowser-objc: c7657d3bc85ae231884e058d0e3638f619164736
PODFILE CHECKSUM: f8bac8842dd5d4f36a3709c129ae7a2ccd5be619
diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj
index 58e111ea..304ac515 100644
--- a/ios/Runner.xcodeproj/project.pbxproj
+++ b/ios/Runner.xcodeproj/project.pbxproj
@@ -617,7 +617,7 @@
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
- CURRENT_PROJECT_VERSION = 2;
+ CURRENT_PROJECT_VERSION = 14;
DEVELOPMENT_TEAM = YF3Q8DVP52;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
@@ -625,7 +625,6 @@
"$(PROJECT_DIR)/UniMPSDK/Libs",
);
GCC_INPUT_FILETYPE = automatic;
- GCC_NO_COMMON_BLOCKS = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
"COCOAPODS=1",
@@ -668,7 +667,7 @@
"$(PROJECT_DIR)/baidu",
"$(PROJECT_DIR)/Runner/baidu",
);
- MARKETING_VERSION = 3.2.19;
+ MARKETING_VERSION = 3.2.20;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = (
"$(inherited)",
@@ -820,16 +819,14 @@
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
- CURRENT_PROJECT_VERSION = 2;
+ CURRENT_PROJECT_VERSION = 14;
DEVELOPMENT_TEAM = YF3Q8DVP52;
ENABLE_BITCODE = NO;
- ENABLE_TESTABILITY = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/UniMPSDK/Libs",
);
GCC_INPUT_FILETYPE = automatic;
- GCC_NO_COMMON_BLOCKS = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
"COCOAPODS=1",
@@ -872,7 +869,7 @@
"$(PROJECT_DIR)/baidu",
"$(PROJECT_DIR)/Runner/baidu",
);
- MARKETING_VERSION = 3.2.19;
+ MARKETING_VERSION = 3.2.20;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = (
"$(inherited)",
@@ -915,7 +912,7 @@
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
- CURRENT_PROJECT_VERSION = 2;
+ CURRENT_PROJECT_VERSION = 14;
DEVELOPMENT_TEAM = YF3Q8DVP52;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
@@ -923,7 +920,6 @@
"$(PROJECT_DIR)/UniMPSDK/Libs",
);
GCC_INPUT_FILETYPE = automatic;
- GCC_NO_COMMON_BLOCKS = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
"COCOAPODS=1",
@@ -966,7 +962,7 @@
"$(PROJECT_DIR)/baidu",
"$(PROJECT_DIR)/Runner/baidu",
);
- MARKETING_VERSION = 3.2.19;
+ MARKETING_VERSION = 3.2.20;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = (
"$(inherited)",
diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist
index e12a98a1..173f6c23 100644
--- a/ios/Runner/Info.plist
+++ b/ios/Runner/Info.plist
@@ -177,5 +177,11 @@
location
+ LSApplicationQueriesSchemes
+
+ iosamap
+ qqmap
+ baidumap
+
diff --git a/lib/address/address_map_page.dart b/lib/address/address_map_page.dart
index f885d478..1324b146 100644
--- a/lib/address/address_map_page.dart
+++ b/lib/address/address_map_page.dart
@@ -80,6 +80,9 @@ class _AddressMapPage extends State {
BMFMapOptions(
center: latLng,
zoomLevel: 15,
+ showZoomControl: false,
+ showMapScaleBar: false,
+ rotateEnabled: false,
),
);
}
@@ -339,6 +342,9 @@ class _AddressMapPage extends State {
double.tryParse(value.getString("longitude")),
),
zoomLevel: 15,
+ showZoomControl: false,
+ showMapScaleBar: false,
+ rotateEnabled: false,
),
);
}
@@ -362,7 +368,10 @@ class _AddressMapPage extends State {
child: BMFMapWidget(
mapOptions: BMFMapOptions(
center: BMFCoordinate(30.553111, 114.342366),
- zoomLevel: 12,
+ zoomLevel: 15,
+ showZoomControl: false,
+ showMapScaleBar: false,
+ rotateEnabled: false,
),
onBMFMapCreated: onMapCreated,
// onCameraMoveEnd: (cameraPosition) {
diff --git a/lib/community/community_details.dart b/lib/community/community_details.dart
index e4cacff3..3051a971 100644
--- a/lib/community/community_details.dart
+++ b/lib/community/community_details.dart
@@ -100,7 +100,7 @@ class _CommunityDetails extends State
void initState() {
super.initState();
// comunity = widget.arguments["comment"];
- EasyLoading.show(status: S.current.zhengzaijiazai);
+ EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black);
businessId = widget.arguments["businessId"];
WidgetsBinding.instance.addObserver(this);
commentFocus.addListener(_focusNodeListener);
@@ -399,7 +399,7 @@ class _CommunityDetails extends State
///评论列表
_queryMemberCommentList(bool isOnRefresh) async {
- if (!isOnRefresh) EasyLoading.show(status: S.current.zhengzaijiazai);
+ if (!isOnRefresh) EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black);
SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
if (apiService == null)
apiService = ApiService(
diff --git a/lib/generated/intl/messages_en.dart b/lib/generated/intl/messages_en.dart
index a8f1f3e9..0a7d1dc0 100644
--- a/lib/generated/intl/messages_en.dart
+++ b/lib/generated/intl/messages_en.dart
@@ -193,6 +193,7 @@ class MessageLookup extends MessageLookupByLibrary {
"dianhua" : MessageLookupByLibrary.simpleMessage("电话"),
"dianjidenglu" : MessageLookupByLibrary.simpleMessage("点击登录,享受更多精彩信息"),
"dianneiyongcan" : MessageLookupByLibrary.simpleMessage("店内用餐"),
+ "dianpuchongzhi" : MessageLookupByLibrary.simpleMessage("店铺充值"),
"dianputuijian" : MessageLookupByLibrary.simpleMessage("店铺推荐"),
"dianpuyue" : MessageLookupByLibrary.simpleMessage("店铺余额"),
"dianwolingqu" : MessageLookupByLibrary.simpleMessage("点我领取"),
@@ -309,6 +310,7 @@ class MessageLookup extends MessageLookupByLibrary {
"huiyuanjifen" : MessageLookupByLibrary.simpleMessage("会员积分"),
"huiyuanka" : MessageLookupByLibrary.simpleMessage("会员卡"),
"huiyuankaxiangqing" : MessageLookupByLibrary.simpleMessage("会员卡详情"),
+ "huiyuanma" : MessageLookupByLibrary.simpleMessage("会员码"),
"huiyuanquanyi" : MessageLookupByLibrary.simpleMessage("会员权益"),
"huiyuanyue" : MessageLookupByLibrary.simpleMessage("会员余额"),
"huiyuanzhongxin" : MessageLookupByLibrary.simpleMessage("会员中心"),
@@ -468,6 +470,7 @@ class MessageLookup extends MessageLookupByLibrary {
"privacy_policy2" : MessageLookupByLibrary.simpleMessage("《一心回乡服务协议》"),
"privacy_policy3" : MessageLookupByLibrary.simpleMessage("《隐私服务》"),
"privacy_policy4" : MessageLookupByLibrary.simpleMessage("并使用本机号码登录"),
+ "qianbao" : MessageLookupByLibrary.simpleMessage("钱包"),
"qiandao" : MessageLookupByLibrary.simpleMessage("签到"),
"qiandaodejifen" : MessageLookupByLibrary.simpleMessage("签到得积分"),
"qiandaolingjifen" : MessageLookupByLibrary.simpleMessage("签到领积分"),
@@ -740,6 +743,7 @@ class MessageLookup extends MessageLookupByLibrary {
"yinsixieyi" : MessageLookupByLibrary.simpleMessage("《隐私协议》"),
"yinsizhengce1" : MessageLookupByLibrary.simpleMessage(" 感谢您使用一心回乡APP。我们非常重视您的个人信息和隐私保护。为了更好地保证您的个人权益,在您使用我们的产品前,请务必仔细阅读一心回乡"),
"yinsizhengce2" : MessageLookupByLibrary.simpleMessage(" 在您同意后,我们才会根据您的使用需求,收集部分可能涉及的数据(地理位置、相机、存储等信息)。"),
+ "yinzhang" : MessageLookupByLibrary.simpleMessage("印章"),
"yiqiandao" : MessageLookupByLibrary.simpleMessage("已签到"),
"yiqianshou" : MessageLookupByLibrary.simpleMessage("已签收"),
"yiquxiao" : MessageLookupByLibrary.simpleMessage(" 已取消 "),
@@ -812,6 +816,7 @@ class MessageLookup extends MessageLookupByLibrary {
"zhunongjifen" : MessageLookupByLibrary.simpleMessage("助农积分"),
"zhunongzhuanqu" : MessageLookupByLibrary.simpleMessage("助农专区"),
"zhuxiaotixing" : MessageLookupByLibrary.simpleMessage("再次提醒:注销帐号后不可恢复,相关数据和信息会永久删除。"),
+ "zhuxiaozhanghao" : MessageLookupByLibrary.simpleMessage("注销账号"),
"ziqu" : MessageLookupByLibrary.simpleMessage("自取"),
"ziti" : MessageLookupByLibrary.simpleMessage("自提"),
"zitidizhi" : MessageLookupByLibrary.simpleMessage("自提地址"),
diff --git a/lib/generated/intl/messages_en_US.dart b/lib/generated/intl/messages_en_US.dart
index c0f7c5af..baadf09e 100644
--- a/lib/generated/intl/messages_en_US.dart
+++ b/lib/generated/intl/messages_en_US.dart
@@ -193,6 +193,7 @@ class MessageLookup extends MessageLookupByLibrary {
"dianhua" : MessageLookupByLibrary.simpleMessage("Telephone"),
"dianjidenglu" : MessageLookupByLibrary.simpleMessage("Click login to enjoy more wonderful information"),
"dianneiyongcan" : MessageLookupByLibrary.simpleMessage("store dining"),
+ "dianpuchongzhi" : MessageLookupByLibrary.simpleMessage("Recharge"),
"dianputuijian" : MessageLookupByLibrary.simpleMessage("Store recommendation"),
"dianpuyue" : MessageLookupByLibrary.simpleMessage("Shop balance"),
"dianwolingqu" : MessageLookupByLibrary.simpleMessage("Click me to get it"),
@@ -309,6 +310,7 @@ class MessageLookup extends MessageLookupByLibrary {
"huiyuanjifen" : MessageLookupByLibrary.simpleMessage("Member Points"),
"huiyuanka" : MessageLookupByLibrary.simpleMessage("Membership Card"),
"huiyuankaxiangqing" : MessageLookupByLibrary.simpleMessage("Membership card details"),
+ "huiyuanma" : MessageLookupByLibrary.simpleMessage("vipCode"),
"huiyuanquanyi" : MessageLookupByLibrary.simpleMessage("Membership Rights"),
"huiyuanyue" : MessageLookupByLibrary.simpleMessage("Member Balance"),
"huiyuanzhongxin" : MessageLookupByLibrary.simpleMessage("Member Center"),
@@ -468,6 +470,7 @@ class MessageLookup extends MessageLookupByLibrary {
"privacy_policy2" : MessageLookupByLibrary.simpleMessage("《Service Agreement for Returning Home with One Heart》"),
"privacy_policy3" : MessageLookupByLibrary.simpleMessage("《privacy Services》"),
"privacy_policy4" : MessageLookupByLibrary.simpleMessage("Log in with your own number"),
+ "qianbao" : MessageLookupByLibrary.simpleMessage("Wallet"),
"qiandao" : MessageLookupByLibrary.simpleMessage("Sign in"),
"qiandaodejifen" : MessageLookupByLibrary.simpleMessage("Sign in and get points"),
"qiandaolingjifen" : MessageLookupByLibrary.simpleMessage("Sign in to receive points"),
@@ -740,6 +743,7 @@ class MessageLookup extends MessageLookupByLibrary {
"yinsixieyi" : MessageLookupByLibrary.simpleMessage("《Privacy Agreement》"),
"yinsizhengce1" : MessageLookupByLibrary.simpleMessage(" Thank you for using the Home bound APP. We attach great importance to your personal information and privacy protection. In order to better ensure your personal rights and interests, before you use our products, please carefully read"),
"yinsizhengce2" : MessageLookupByLibrary.simpleMessage(" With your consent, we will collect some possible data (geographic location, camera, storage and other information) according to your use needs。"),
+ "yinzhang" : MessageLookupByLibrary.simpleMessage("Seal"),
"yiqiandao" : MessageLookupByLibrary.simpleMessage("Signed in"),
"yiqianshou" : MessageLookupByLibrary.simpleMessage("Signed in"),
"yiquxiao" : MessageLookupByLibrary.simpleMessage(" Canceled "),
@@ -812,6 +816,7 @@ class MessageLookup extends MessageLookupByLibrary {
"zhunongjifen" : MessageLookupByLibrary.simpleMessage("Farming aid points"),
"zhunongzhuanqu" : MessageLookupByLibrary.simpleMessage("Special Area for Agricultural Aid"),
"zhuxiaotixing" : MessageLookupByLibrary.simpleMessage("Reminder again: After the account is logged off, it cannot be recovered, and relevant data and information will be permanently deleted。"),
+ "zhuxiaozhanghao" : MessageLookupByLibrary.simpleMessage("Account cancellation"),
"ziqu" : MessageLookupByLibrary.simpleMessage("self fetching"),
"ziti" : MessageLookupByLibrary.simpleMessage("Self mention"),
"zitidizhi" : MessageLookupByLibrary.simpleMessage("Self lifting address"),
diff --git a/lib/generated/intl/messages_zh_CN.dart b/lib/generated/intl/messages_zh_CN.dart
index 013804a2..494d70e7 100644
--- a/lib/generated/intl/messages_zh_CN.dart
+++ b/lib/generated/intl/messages_zh_CN.dart
@@ -193,6 +193,7 @@ class MessageLookup extends MessageLookupByLibrary {
"dianhua" : MessageLookupByLibrary.simpleMessage("电话"),
"dianjidenglu" : MessageLookupByLibrary.simpleMessage("点击登录,享受更多精彩信息"),
"dianneiyongcan" : MessageLookupByLibrary.simpleMessage("店内用餐"),
+ "dianpuchongzhi" : MessageLookupByLibrary.simpleMessage("店铺充值"),
"dianputuijian" : MessageLookupByLibrary.simpleMessage("店铺推荐"),
"dianpuyue" : MessageLookupByLibrary.simpleMessage("店铺余额"),
"dianwolingqu" : MessageLookupByLibrary.simpleMessage("点我领取"),
@@ -309,6 +310,7 @@ class MessageLookup extends MessageLookupByLibrary {
"huiyuanjifen" : MessageLookupByLibrary.simpleMessage("会员积分"),
"huiyuanka" : MessageLookupByLibrary.simpleMessage("会员卡"),
"huiyuankaxiangqing" : MessageLookupByLibrary.simpleMessage("会员卡详情"),
+ "huiyuanma" : MessageLookupByLibrary.simpleMessage("会员码"),
"huiyuanquanyi" : MessageLookupByLibrary.simpleMessage("会员权益"),
"huiyuanyue" : MessageLookupByLibrary.simpleMessage("会员余额"),
"huiyuanzhongxin" : MessageLookupByLibrary.simpleMessage("会员中心"),
@@ -468,6 +470,7 @@ class MessageLookup extends MessageLookupByLibrary {
"privacy_policy2" : MessageLookupByLibrary.simpleMessage("《一心回乡服务协议》"),
"privacy_policy3" : MessageLookupByLibrary.simpleMessage("《隐私服务》"),
"privacy_policy4" : MessageLookupByLibrary.simpleMessage("并使用本机号码登录"),
+ "qianbao" : MessageLookupByLibrary.simpleMessage("钱包"),
"qiandao" : MessageLookupByLibrary.simpleMessage("签到"),
"qiandaodejifen" : MessageLookupByLibrary.simpleMessage("签到得积分"),
"qiandaolingjifen" : MessageLookupByLibrary.simpleMessage("签到领积分"),
@@ -740,6 +743,7 @@ class MessageLookup extends MessageLookupByLibrary {
"yinsixieyi" : MessageLookupByLibrary.simpleMessage("《隐私协议》"),
"yinsizhengce1" : MessageLookupByLibrary.simpleMessage(" 感谢您使用一心回乡APP。我们非常重视您的个人信息和隐私保护。为了更好地保证您的个人权益,在您使用我们的产品前,请务必仔细阅读一心回乡"),
"yinsizhengce2" : MessageLookupByLibrary.simpleMessage(" 在您同意后,我们才会根据您的使用需求,收集部分可能涉及的数据(地理位置、相机、存储等信息)。"),
+ "yinzhang" : MessageLookupByLibrary.simpleMessage("印章"),
"yiqiandao" : MessageLookupByLibrary.simpleMessage("已签到"),
"yiqianshou" : MessageLookupByLibrary.simpleMessage("已签收"),
"yiquxiao" : MessageLookupByLibrary.simpleMessage(" 已取消 "),
@@ -812,6 +816,7 @@ class MessageLookup extends MessageLookupByLibrary {
"zhunongjifen" : MessageLookupByLibrary.simpleMessage("助农积分"),
"zhunongzhuanqu" : MessageLookupByLibrary.simpleMessage("助农专区"),
"zhuxiaotixing" : MessageLookupByLibrary.simpleMessage("再次提醒:注销帐号后不可恢复,相关数据和信息会永久删除。"),
+ "zhuxiaozhanghao" : MessageLookupByLibrary.simpleMessage("注销账号"),
"ziqu" : MessageLookupByLibrary.simpleMessage("自取"),
"ziti" : MessageLookupByLibrary.simpleMessage("自提"),
"zitidizhi" : MessageLookupByLibrary.simpleMessage("自提地址"),
diff --git a/lib/generated/intl/messages_zh_Hans_CN.dart b/lib/generated/intl/messages_zh_Hans_CN.dart
index 57dd765c..1952e3b2 100644
--- a/lib/generated/intl/messages_zh_Hans_CN.dart
+++ b/lib/generated/intl/messages_zh_Hans_CN.dart
@@ -193,6 +193,7 @@ class MessageLookup extends MessageLookupByLibrary {
"dianhua" : MessageLookupByLibrary.simpleMessage("电话"),
"dianjidenglu" : MessageLookupByLibrary.simpleMessage("点击登录,享受更多精彩信息"),
"dianneiyongcan" : MessageLookupByLibrary.simpleMessage("店内用餐"),
+ "dianpuchongzhi" : MessageLookupByLibrary.simpleMessage("店铺充值"),
"dianputuijian" : MessageLookupByLibrary.simpleMessage("店铺推荐"),
"dianpuyue" : MessageLookupByLibrary.simpleMessage("店铺余额"),
"dianwolingqu" : MessageLookupByLibrary.simpleMessage("点我领取"),
@@ -309,6 +310,7 @@ class MessageLookup extends MessageLookupByLibrary {
"huiyuanjifen" : MessageLookupByLibrary.simpleMessage("会员积分"),
"huiyuanka" : MessageLookupByLibrary.simpleMessage("会员卡"),
"huiyuankaxiangqing" : MessageLookupByLibrary.simpleMessage("会员卡详情"),
+ "huiyuanma" : MessageLookupByLibrary.simpleMessage("会员码"),
"huiyuanquanyi" : MessageLookupByLibrary.simpleMessage("会员权益"),
"huiyuanyue" : MessageLookupByLibrary.simpleMessage("会员余额"),
"huiyuanzhongxin" : MessageLookupByLibrary.simpleMessage("会员中心"),
@@ -468,6 +470,7 @@ class MessageLookup extends MessageLookupByLibrary {
"privacy_policy2" : MessageLookupByLibrary.simpleMessage("《一心回乡服务协议》"),
"privacy_policy3" : MessageLookupByLibrary.simpleMessage("《隐私服务》"),
"privacy_policy4" : MessageLookupByLibrary.simpleMessage("并使用本机号码登录"),
+ "qianbao" : MessageLookupByLibrary.simpleMessage("钱包"),
"qiandao" : MessageLookupByLibrary.simpleMessage("签到"),
"qiandaodejifen" : MessageLookupByLibrary.simpleMessage("签到得积分"),
"qiandaolingjifen" : MessageLookupByLibrary.simpleMessage("签到领积分"),
@@ -740,6 +743,7 @@ class MessageLookup extends MessageLookupByLibrary {
"yinsixieyi" : MessageLookupByLibrary.simpleMessage("《隐私协议》"),
"yinsizhengce1" : MessageLookupByLibrary.simpleMessage(" 感谢您使用一心回乡APP。我们非常重视您的个人信息和隐私保护。为了更好地保证您的个人权益,在您使用我们的产品前,请务必仔细阅读一心回乡"),
"yinsizhengce2" : MessageLookupByLibrary.simpleMessage(" 在您同意后,我们才会根据您的使用需求,收集部分可能涉及的数据(地理位置、相机、存储等信息)。"),
+ "yinzhang" : MessageLookupByLibrary.simpleMessage("印章"),
"yiqiandao" : MessageLookupByLibrary.simpleMessage("已签到"),
"yiqianshou" : MessageLookupByLibrary.simpleMessage("已签收"),
"yiquxiao" : MessageLookupByLibrary.simpleMessage(" 已取消 "),
@@ -812,6 +816,7 @@ class MessageLookup extends MessageLookupByLibrary {
"zhunongjifen" : MessageLookupByLibrary.simpleMessage("助农积分"),
"zhunongzhuanqu" : MessageLookupByLibrary.simpleMessage("助农专区"),
"zhuxiaotixing" : MessageLookupByLibrary.simpleMessage("再次提醒:注销帐号后不可恢复,相关数据和信息会永久删除。"),
+ "zhuxiaozhanghao" : MessageLookupByLibrary.simpleMessage("注销账号"),
"ziqu" : MessageLookupByLibrary.simpleMessage("自取"),
"ziti" : MessageLookupByLibrary.simpleMessage("自提"),
"zitidizhi" : MessageLookupByLibrary.simpleMessage("自提地址"),
diff --git a/lib/generated/intl/messages_zh_Hant_CN.dart b/lib/generated/intl/messages_zh_Hant_CN.dart
index 45688e01..af38e8de 100644
--- a/lib/generated/intl/messages_zh_Hant_CN.dart
+++ b/lib/generated/intl/messages_zh_Hant_CN.dart
@@ -189,6 +189,7 @@ class MessageLookup extends MessageLookupByLibrary {
"dianhua" : MessageLookupByLibrary.simpleMessage("電話"),
"dianjidenglu" : MessageLookupByLibrary.simpleMessage("點擊登錄,享受更多精彩信息"),
"dianneiyongcan" : MessageLookupByLibrary.simpleMessage("店内用餐"),
+ "dianpuchongzhi" : MessageLookupByLibrary.simpleMessage("店鋪充值"),
"dianputuijian" : MessageLookupByLibrary.simpleMessage("店鋪推薦"),
"dianpuyue" : MessageLookupByLibrary.simpleMessage("店鋪餘額"),
"dianwolingqu" : MessageLookupByLibrary.simpleMessage("點我領取"),
@@ -305,6 +306,7 @@ class MessageLookup extends MessageLookupByLibrary {
"huiyuanjifen" : MessageLookupByLibrary.simpleMessage("會員積分"),
"huiyuanka" : MessageLookupByLibrary.simpleMessage("會員卡"),
"huiyuankaxiangqing" : MessageLookupByLibrary.simpleMessage("會員卡詳情"),
+ "huiyuanma" : MessageLookupByLibrary.simpleMessage("會員碼"),
"huiyuanquanyi" : MessageLookupByLibrary.simpleMessage("會員權益"),
"huiyuanyue" : MessageLookupByLibrary.simpleMessage("會員餘額"),
"huiyuanzhongxin" : MessageLookupByLibrary.simpleMessage("會員中心"),
@@ -463,6 +465,7 @@ class MessageLookup extends MessageLookupByLibrary {
"privacy_policy2" : MessageLookupByLibrary.simpleMessage("《一心回鄉服務協議》"),
"privacy_policy3" : MessageLookupByLibrary.simpleMessage("《隱私服務》"),
"privacy_policy4" : MessageLookupByLibrary.simpleMessage("并使用本機號碼登錄"),
+ "qianbao" : MessageLookupByLibrary.simpleMessage("錢包"),
"qiandao" : MessageLookupByLibrary.simpleMessage("簽到"),
"qiandaodejifen" : MessageLookupByLibrary.simpleMessage("簽到得積分"),
"qiandaolingjifen" : MessageLookupByLibrary.simpleMessage("簽到領積分"),
@@ -734,6 +737,7 @@ class MessageLookup extends MessageLookupByLibrary {
"yinsixieyi" : MessageLookupByLibrary.simpleMessage("《隱私協議》"),
"yinsizhengce1" : MessageLookupByLibrary.simpleMessage(" 感謝您使用一心回鄉APP。我們非常的重視您的個人信息和隱私保護。為了更好地保證您的個人權益,在您使用我們的產品前,請務必仔細閱讀一心回鄉"),
"yinsizhengce2" : MessageLookupByLibrary.simpleMessage(" 在您同意後,我們才會根據您的使用需求,收集部分可能涉及(地理位置、相機、存儲等信息)的數據。"),
+ "yinzhang" : MessageLookupByLibrary.simpleMessage("印章"),
"yiqiandao" : MessageLookupByLibrary.simpleMessage("已簽到"),
"yiqianshou" : MessageLookupByLibrary.simpleMessage("已簽收"),
"yiquxiao" : MessageLookupByLibrary.simpleMessage(" 已取消 "),
@@ -806,6 +810,7 @@ class MessageLookup extends MessageLookupByLibrary {
"zhunongjifen" : MessageLookupByLibrary.simpleMessage("助農積分"),
"zhunongzhuanqu" : MessageLookupByLibrary.simpleMessage("助農專區"),
"zhuxiaotixing" : MessageLookupByLibrary.simpleMessage("再次提醒:註銷帳號後不可恢復,相關資料和資訊會永久删除。"),
+ "zhuxiaozhanghao" : MessageLookupByLibrary.simpleMessage("註銷帳號"),
"ziqu" : MessageLookupByLibrary.simpleMessage("自取"),
"ziti" : MessageLookupByLibrary.simpleMessage("自提"),
"zitidizhi" : MessageLookupByLibrary.simpleMessage("自提地址"),
diff --git a/lib/generated/intl/messages_zh_TW.dart b/lib/generated/intl/messages_zh_TW.dart
index 7a7bab93..3656596e 100644
--- a/lib/generated/intl/messages_zh_TW.dart
+++ b/lib/generated/intl/messages_zh_TW.dart
@@ -191,6 +191,7 @@ class MessageLookup extends MessageLookupByLibrary {
"dianhua" : MessageLookupByLibrary.simpleMessage("電話"),
"dianjidenglu" : MessageLookupByLibrary.simpleMessage("點擊登錄,享受更多精彩信息"),
"dianneiyongcan" : MessageLookupByLibrary.simpleMessage("店内用餐"),
+ "dianpuchongzhi" : MessageLookupByLibrary.simpleMessage("店鋪充值"),
"dianputuijian" : MessageLookupByLibrary.simpleMessage("店鋪推薦"),
"dianpuyue" : MessageLookupByLibrary.simpleMessage("店鋪餘額"),
"dianwolingqu" : MessageLookupByLibrary.simpleMessage("點我領取"),
@@ -307,6 +308,7 @@ class MessageLookup extends MessageLookupByLibrary {
"huiyuanjifen" : MessageLookupByLibrary.simpleMessage("會員積分"),
"huiyuanka" : MessageLookupByLibrary.simpleMessage("會員卡"),
"huiyuankaxiangqing" : MessageLookupByLibrary.simpleMessage("會員卡詳情"),
+ "huiyuanma" : MessageLookupByLibrary.simpleMessage("會員碼"),
"huiyuanquanyi" : MessageLookupByLibrary.simpleMessage("會員權益"),
"huiyuanyue" : MessageLookupByLibrary.simpleMessage("會員餘額"),
"huiyuanzhongxin" : MessageLookupByLibrary.simpleMessage("會員中心"),
@@ -465,6 +467,7 @@ class MessageLookup extends MessageLookupByLibrary {
"privacy_policy2" : MessageLookupByLibrary.simpleMessage("《一心回鄉服務協議》"),
"privacy_policy3" : MessageLookupByLibrary.simpleMessage("《隱私服務》"),
"privacy_policy4" : MessageLookupByLibrary.simpleMessage("并使用本機號碼登錄"),
+ "qianbao" : MessageLookupByLibrary.simpleMessage("錢包"),
"qiandao" : MessageLookupByLibrary.simpleMessage("簽到"),
"qiandaodejifen" : MessageLookupByLibrary.simpleMessage("簽到得積分"),
"qiandaolingjifen" : MessageLookupByLibrary.simpleMessage("簽到領積分"),
@@ -737,6 +740,7 @@ class MessageLookup extends MessageLookupByLibrary {
"yinsixieyi" : MessageLookupByLibrary.simpleMessage("《隱私協議》"),
"yinsizhengce1" : MessageLookupByLibrary.simpleMessage(" 感謝您使用一心回鄉APP。我們非常的重視您的個人信息和隱私保護。為了更好地保證您的個人權益,在您使用我們的產品前,請務必仔細閱讀一心回鄉"),
"yinsizhengce2" : MessageLookupByLibrary.simpleMessage(" 在您同意後,我們才會根據您的使用需求,收集部分可能涉及(地理位置、相機、存儲等信息)的數據。"),
+ "yinzhang" : MessageLookupByLibrary.simpleMessage("印章"),
"yiqiandao" : MessageLookupByLibrary.simpleMessage("已簽到"),
"yiqianshou" : MessageLookupByLibrary.simpleMessage("已簽收"),
"yiquxiao" : MessageLookupByLibrary.simpleMessage(" 已取消 "),
@@ -809,6 +813,7 @@ class MessageLookup extends MessageLookupByLibrary {
"zhunongjifen" : MessageLookupByLibrary.simpleMessage("助農積分"),
"zhunongzhuanqu" : MessageLookupByLibrary.simpleMessage("助農專區"),
"zhuxiaotixing" : MessageLookupByLibrary.simpleMessage("再次提醒:註銷帳號後不可恢復,相關資料和資訊會永久删除。"),
+ "zhuxiaozhanghao" : MessageLookupByLibrary.simpleMessage("註銷帳號"),
"ziqu" : MessageLookupByLibrary.simpleMessage("自取"),
"ziti" : MessageLookupByLibrary.simpleMessage("自提"),
"zitidizhi" : MessageLookupByLibrary.simpleMessage("自提地址"),
diff --git a/lib/generated/l10n.dart b/lib/generated/l10n.dart
index 1f610b1e..172f28ec 100644
--- a/lib/generated/l10n.dart
+++ b/lib/generated/l10n.dart
@@ -7145,6 +7145,56 @@ class S {
);
}
+ /// `钱包`
+ String get qianbao {
+ return Intl.message(
+ '钱包',
+ name: 'qianbao',
+ desc: '',
+ args: [],
+ );
+ }
+
+ /// `会员码`
+ String get huiyuanma {
+ return Intl.message(
+ '会员码',
+ name: 'huiyuanma',
+ desc: '',
+ args: [],
+ );
+ }
+
+ /// `印章`
+ String get yinzhang {
+ return Intl.message(
+ '印章',
+ name: 'yinzhang',
+ desc: '',
+ args: [],
+ );
+ }
+
+ /// `店铺充值`
+ String get dianpuchongzhi {
+ return Intl.message(
+ '店铺充值',
+ name: 'dianpuchongzhi',
+ desc: '',
+ args: [],
+ );
+ }
+
+ /// `注销账号`
+ String get zhuxiaozhanghao {
+ return Intl.message(
+ '注销账号',
+ name: 'zhuxiaozhanghao',
+ desc: '',
+ args: [],
+ );
+ }
+
/// `并使用本机号码登录`
String get privacy_policy4 {
return Intl.message(
diff --git a/lib/home/home_page.dart b/lib/home/home_page.dart
index 4f52ddb7..be6f7b3e 100644
--- a/lib/home/home_page.dart
+++ b/lib/home/home_page.dart
@@ -8,7 +8,6 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:flutter_swiper/flutter_swiper.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/home/home_view/discount_zone.dart';
-import 'package:huixiang/home/home_view/home_banner.dart';
import 'package:huixiang/home/home_view/home_recommend_goods.dart';
import 'package:huixiang/home/home_view/top_selling_list.dart';
import 'package:huixiang/home/home_view/union_entry.dart';
@@ -27,7 +26,6 @@ import 'package:huixiang/retrofit/data/goods.dart';
import 'package:huixiang/retrofit/data/goods_category.dart';
import 'package:huixiang/retrofit/data/home_rank.dart';
import 'package:huixiang/retrofit/data/login_info.dart';
-import 'package:huixiang/retrofit/data/msg_stats.dart';
import 'package:huixiang/retrofit/data/page.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/event_type.dart';
@@ -44,6 +42,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../retrofit/data/user_info.dart';
import '../utils/flutter_utils.dart';
import '../view_widget/channel_dialog.dart';
+import '../view_widget/custom_image.dart';
import 'home_view/happy_help_farmers.dart';
import 'home_view/shortcut_operation.dart';
@@ -54,7 +53,8 @@ class HomePage extends StatefulWidget {
final List firstLoginCouponList;
HomePage(Key key, this.changeTab,
- {this.invite, this.interviewCouponList, this.firstLoginCouponList}): super(key: key);
+ {this.invite, this.interviewCouponList, this.firstLoginCouponList})
+ : super(key: key);
@override
State createState() {
@@ -64,6 +64,32 @@ class HomePage extends StatefulWidget {
class HomePageState extends State with AutomaticKeepAliveClientMixin {
ApiService apiService;
+ final RefreshController refreshController = RefreshController();
+ String categoryId;
+ bool showInvite = false;
+ bool showNew = false;
+
+ //排序类型枚举:1-自然排序,2-销量,3-价格
+ int orderType = 1;
+
+ //是否降序排列
+ bool orderDesc = true;
+ List goods = [];
+ List gooodsCategorys = [];
+ List bannerData = [];
+ List activityBannerData = [];
+ List brandData = [];
+ List articles = [];
+ Founder founder;
+ bool isSigned = false;
+ int totalMsg = 0;
+ List coupons = [];
+ int state = 1;
+ HomeRank homeRank;
+ UserInfo userInfo;
+ dynamic mRaiseMoney = 0; //众筹金余额
+ int _loadCount = 0;
+ DioErrorType dioErrorType;
@override
void initState() {
@@ -74,8 +100,11 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin {
setState(() {});
}
});
- queryActivity();
- _onRefresh();
+ _onRefresh(isFirstIn: true);
+ if (showInvite) {
+ inviteShowAlertDialog(widget.invite, widget.interviewCouponList[0]);
+ showInvite = false;
+ }
if ((widget.invite ?? "") != "" ||
widget.interviewCouponList != null &&
@@ -84,7 +113,6 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin {
//判断新人弹窗
// if (widget.firstLoginCouponList != null && widget.firstLoginCouponList.length > 0)
// showNew = true;
-
}
///邀请成功
@@ -99,18 +127,21 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin {
}
///活动海报弹窗
- posterShowAlertDialog(ActivityPos activityPos,firstLoginCouponList) {
+ posterShowAlertDialog(ActivityPos activityPos, firstLoginCouponList) {
var today = DateTime.now().day;
SharedPreferences.getInstance().then((value) {
- if(value.getInt("today")==today && (value.getString("ActivityPosCode") ?? "").contains("${activityPos.code}_${value.getString("userId")};"))
+ if (value.getInt("today") == today &&
+ (value.getString("ActivityPosCode") ?? "")
+ .contains("${activityPos.code}_${value.getString("userId")};"))
return;
- value.setString("ActivityPosCode", "${(value.getString("ActivityPosCode")??"")}${activityPos.code}_${value.getString("userId")};");
+ value.setString("ActivityPosCode",
+ "${(value.getString("ActivityPosCode") ?? "")}${activityPos.code}_${value.getString("userId")};");
value.setInt("today", today);
//显示对话框
showDialog(
context: context,
builder: (BuildContext context) {
- return ActivityPoster(activityPos,firstLoginCouponList);
+ return ActivityPoster(activityPos, firstLoginCouponList);
},
);
});
@@ -127,178 +158,133 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin {
);
}
- final SwiperController controller = SwiperController();
-
- String categoryId;
- int pageNum = 1;
- int couponPageNum = 1;
- bool showInvite = false;
- bool showNew = false;
-
- //排序类型枚举:1-自然排序,2-销量,3-价格
- int orderType = 1;
-
- //是否降序排列
- bool orderDesc = true;
- List goods = [];
- List gooodsCategorys = [];
-
- List bannerData = [];
- List brandData = [];
- List articles = [];
- List gooods = [];
- Founder founder;
- bool isSigned = false;
- int totalMsg = 0;
- List coupons = [];
- int state = 1;
- HomeRank homeRank;
- UserInfo userInfo;
- dynamic mRaiseMoney = 0;//众筹金余额
-
- queryHome() async {
- // EasyLoading.show(status: S.of(context).zhengzaijiazai);
-
- final SharedPreferences value = await SharedPreferences.getInstance();
- apiService = ApiService(Dio(),
- context: context, token: value.getString('token'), showLoading: false);
-
- final BaseData brand =
- await apiService.queryHomeBrand().catchError((onError) {
- SmartDialog.showToast(AppUtils.dioErrorTypeToString(onError.type),
- alignment: Alignment.center);
- refreshController.refreshFailed();
- });
- if (brand != null && brand.isSuccess) {
- brandData.clear();
- brandData.addAll((brand.data["brandList"] as List)
- .map((e) => Brand.fromJson(e))
- .toList());
- founder = Founder.fromJson(brand.data["founder"]);
+ ///头部banner
+ queryBanner() async {
+ try {
+ BaseData> baseData = await apiService.queryBanner({
+ "model": {"type": "HOME_PAGE"},
+ }).catchError((onError) {
+ dioErrorType = onError.type;
+ });
+ if (baseData != null && baseData.isSuccess) {
+ bannerData = baseData.data.records;
+ // if (bannerData.length > 0) swiperController.move(0, animation: false);
+ }
+ } finally {
+ addLoadCount();
}
+ }
- final BaseData> article = await apiService.queryArticle({
- "pageNum": 1,
- "pageSize": 3,
- "searchKey": "",
- "state": 1,
- "type": 2
- }).catchError((onError) {
- refreshController.refreshFailed();
- });
- articles.clear();
- if (article != null && article.isSuccess) {
- articles.addAll(article.data.list);
+ ///宣传banner
+ queryActivityBanner() async {
+ try {
+ BaseData> baseData = await apiService.queryBanner({
+ "model": {"type": "HOME_STORE_PAGE"},
+ }).catchError((onError) {});
+ if (baseData != null && baseData.isSuccess) {
+ activityBannerData = baseData.data.records;
+ }
+ } finally {
+ addLoadCount();
}
+ }
- final BaseData rank = await apiService.recommendRank().catchError((onError) {});
- if (rank != null && rank.isSuccess) {
- homeRank = rank.data;
+ addLoadCount() {
+ _loadCount += 1;
+ if (_loadCount == 7) {
+ _loadCount = 0;
+ EasyLoading.dismiss();
+ if (dioErrorType == null)
+ refreshController.refreshCompleted();
+ else {
+ SmartDialog.showToast(AppUtils.dioErrorTypeToString(dioErrorType),
+ alignment: Alignment.center);
+ refreshController.refreshFailed();
+ }
+ if (mounted) setState(() {});
}
+ }
- final BaseData> goodsData = await apiService.creditGoods({
- "orderDesc": true,
- "orderType": 1,
- "pageNum": 1,
- "pageSize": 100,
- "state": 1
- }).catchError((onError) {
- refreshController.refreshFailed();
- });
- if (goodsData != null && goodsData.isSuccess) {
- gooods.clear();
- gooods.addAll(goodsData.data.list);
+ ///推荐排行
+ queryRecommendRank() async {
+ try {
+ BaseData rank =
+ await apiService.recommendRank().catchError((onError) {});
+ if (rank != null && rank.isSuccess) {
+ homeRank = rank.data;
+ }
+ } finally {
+ addLoadCount();
}
+ }
- BaseData> dataCategory =
- await apiService.goodsCategory({
- "current": 1,
- "map": {},
- "model": {"pageNum": 1, "pageSize": 20, "searchKey": ""},
- "order": "descending",
- "size": 20,
- "sort": "sortOrder"
- }).catchError((onError) {
- refreshController.loadFailed();
- refreshController.refreshFailed();
- });
-
- if (dataCategory != null &&
- dataCategory.isSuccess &&
- dataCategory.data != null &&
- dataCategory.data.records != null &&
- dataCategory.data.records.length > 0) {
- gooodsCategorys.clear();
- gooodsCategorys.add(GoodsCategory(name: S.of(context).quanbu));
- gooodsCategorys.addAll(dataCategory.data.records);
+ ///积分商城商品分類列表
+ queryGoodsCategory() async {
+ try {
+ BaseData> dataCategory =
+ await apiService.goodsCategory({
+ "current": 1,
+ "map": {},
+ "model": {"pageNum": 1, "pageSize": 20, "searchKey": ""},
+ "order": "descending",
+ "size": 20,
+ "sort": "sortOrder"
+ }).catchError((onError) {});
+ if (dataCategory != null &&
+ dataCategory.isSuccess &&
+ dataCategory.data != null &&
+ dataCategory.data.records != null &&
+ dataCategory.data.records.length > 0) {
+ gooodsCategorys.clear();
+ gooodsCategorys.add(GoodsCategory(name: S.of(context).quanbu));
+ gooodsCategorys.addAll(dataCategory.data.records);
+ }
+ } finally {
+ addLoadCount();
}
+ }
- var param = {
- "categoryId": categoryId ?? "",
- "orderDesc": orderDesc,
- "orderType": orderType,
- "pageNum": pageNum,
- "pageSize": 100,
- "state": 1
- };
- BaseData> pageGoods =
- await apiService.creditGoods(param).catchError((onError) {
- refreshController.loadFailed();
- refreshController.refreshFailed();
- });
- EasyLoading.dismiss();
- if (pageGoods != null && pageGoods.isSuccess) {
- if (pageNum == 1) {
- goods.clear();
+ ///积分商城商品列表
+ queryPointsProductList(bool isRefresh) async {
+ try {
+ if (!isRefresh)
+ EasyLoading.show(
+ status: S.current.zhengzaijiazai,
+ maskType: EasyLoadingMaskType.black);
+ var param = {
+ "categoryId": categoryId ?? "",
+ "orderDesc": orderDesc,
+ "orderType": orderType,
+ "pageNum": 1,
+ "pageSize": 100,
+ "state": 1
+ };
+ BaseData> pageGoods =
+ await apiService.creditGoods(param).catchError((onError) {});
+ if (pageGoods != null && pageGoods.isSuccess) {
+ goods = pageGoods.data.list;
}
- goods.addAll(pageGoods.data.list);
- refreshController.refreshCompleted();
- refreshController.loadComplete();
- if (pageGoods.data.pageNum == pageGoods.data.pages) {
- refreshController.loadNoData();
- } else {
- pageNum += 1;
+ } finally {
+ if (isRefresh)
+ addLoadCount();
+ else {
+ EasyLoading.dismiss();
+ setState(() {});
}
- } else {
- refreshController.loadFailed();
- refreshController.refreshFailed();
}
-
- final BaseData> baseData =
- await apiService.queryBanner({
- "model": {"type": "HOME_PAGE"},
- }).catchError((onError) {
- refreshController.refreshFailed();
- });
- if (baseData != null && baseData.isSuccess) {
- bannerData.clear();
- bannerData.addAll(baseData.data.records);
- refreshController.refreshCompleted();
- if (bannerData.length > 0) controller.move(0, animation: false);
- } else {
- refreshController.refreshFailed();
- }
- EasyLoading.dismiss();
- if (showInvite) {
- inviteShowAlertDialog(widget.invite, widget.interviewCouponList[0]);
- showInvite = false;
- }
-
- //判断新人弹窗
- // if (showNew) {
- // newShowAlertDialog(widget.firstLoginCouponList);
- // showNew = false;
- // }
}
///查询会员信息
queryUserBalance() async {
- BaseData baseData =
- await apiService.queryInfo().catchError((onError) {});
- if (baseData != null && baseData.isSuccess) {
- userInfo = baseData.data;
- mRaiseMoney = double.tryParse(userInfo.raiseMoney);
- if (mounted) setState(() {});
+ try {
+ BaseData baseData =
+ await apiService.queryInfo().catchError((onError) {});
+ if (baseData != null && baseData.isSuccess) {
+ userInfo = baseData.data;
+ mRaiseMoney = double.tryParse(userInfo.raiseMoney);
+ }
+ } finally {
+ addLoadCount();
}
}
@@ -326,35 +312,18 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin {
///活动弹窗
queryActivity() async {
- if (apiService == null) {
- SharedPreferences value = await SharedPreferences.getInstance();
- apiService = ApiService(
- Dio(),
- context: context,
- token: value.getString("token"),
- showLoading: true
- );
- }
BaseData baseData =
- await apiService.appPopup().catchError((onError) {
- });
+ await apiService.appPopup().catchError((onError) {});
if (baseData != null && baseData.isSuccess) {
- if(baseData.data?.enabled ?? true)
- posterShowAlertDialog(baseData.data,widget.firstLoginCouponList);
+ if (baseData.data?.enabled ?? true)
+ posterShowAlertDialog(baseData.data, widget.firstLoginCouponList);
}
}
///核销用户优惠券
queryWiped(memberCouponId) async {
- if (apiService == null) {
- SharedPreferences value = await SharedPreferences.getInstance();
- apiService = ApiService(
- Dio(),
- context: context,
- token: value.getString("token"),
- );
- }
- BaseData baseData = await apiService.wiped(memberCouponId).catchError((onError) {});
+ BaseData baseData =
+ await apiService.wiped(memberCouponId).catchError((onError) {});
if (baseData != null && baseData.isSuccess) {
SmartDialog.showToast("核销成功", alignment: Alignment.center);
} else {
@@ -363,6 +332,25 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin {
}
queryCoupon() async {
+ try {
+ BaseData> baseData = await apiService.queryCoupon({
+ "centre": true,
+ "pageNum": 1,
+ "pageSize": 10,
+ "searchKey": "",
+ "state": 0
+ }).catchError((onError) {});
+ if (baseData != null && baseData.isSuccess) {
+ coupons = baseData.data.list;
+ }
+ } finally {
+ addLoadCount();
+ }
+ }
+
+ _onRefresh({bool isFirstIn = false}) async {
+ EasyLoading.show(
+ status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black);
if (apiService == null) {
SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(
@@ -371,39 +359,16 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin {
token: value.getString("token"),
);
}
- BaseData> baseData = await apiService.queryCoupon({
- "centre": true,
- "pageNum": couponPageNum,
- "pageSize": 10,
- "searchKey": "",
- "state": 0
- }).catchError((onError) {
- refreshController.refreshFailed();
- refreshController.loadFailed();
- });
- if (couponPageNum == 1) coupons.clear();
- if (baseData != null && baseData.isSuccess) {
- coupons.addAll(baseData.data.list);
- refreshController.refreshCompleted();
- refreshController.loadComplete();
- if (baseData.data.pageNum == baseData.data.pages) {
- refreshController.loadNoData();
- } else {
- couponPageNum += 1;
- }
- setState(() {});
- }
- else {
- refreshController.refreshFailed();
- refreshController.loadFailed();
- }
- }
-
- _onRefresh() async{
- await queryHome();
- await queryUserBalance();
+ dioErrorType = null;
+ if (isFirstIn) queryActivity();
+ queryBanner();
+ queryActivityBanner();
+ queryRecommendRank();
+ queryGoodsCategory();
+ queryPointsProductList(true);
+ queryUserBalance();
// queryMsgStats();
- await queryCoupon();
+ queryCoupon();
}
@override
@@ -412,8 +377,6 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin {
if (refreshController != null) refreshController.dispose();
}
- final RefreshController refreshController = RefreshController();
-
@override
Widget build(BuildContext context) {
super.build(context);
@@ -502,99 +465,91 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin {
enablePullUp: false,
header: MyHeader(),
physics: BouncingScrollPhysics(),
- onRefresh: () {
- setState(() {_onRefresh();
- });
- },
+ onRefresh: _onRefresh,
child: SingleChildScrollView(
- physics: NeverScrollableScrollPhysics(),
- child: FutureBuilder(
- future: queryHome(),
- builder: (context, snapshot) {
- return Column(
- children: [
- ///banner
- HomeBanner(bannerData, controller),
-
- ///吃喝玩
- UnionEntry((int jpIndex) {
- widget.changeTab(1,jpIndex);
- }),
-
- ///快捷操作
- ShortcutOperation((int jpIndex) {
- widget.changeTab(1,jpIndex);
- }),
-
- ///推广图
- spread(),
-
- // ///签到
- // SignView(isSigned, (value) {
- // setState(() {
- // isSigned = value;
- // });
- // }),
-
- ///特惠专区
- if(coupons != null && coupons.length != 0)
- DiscountZone(coupons),
-
- ///特惠专区-推荐商品展示
- if(homeRank != null && homeRank.commodityZone.length != 0)
- HomeRecommendGoods(homeRank),
-
- if((homeRank?.commodityZone?.length ??0) == 0)
- SizedBox(height: 20.h,),
-
- ///助农专区
- // if(mRaiseMoney != 0)
- HappyHelpFarmers(),
-
- ///福利中心
- WelfareCore(),
-
- ///吃喝玩商品热销榜
- if(homeRank != null && homeRank.commodityList.length != 0)
- TopSellingList(homeRank),
-
- // ///店铺推荐
- // QuickOrder(),
-
- // ///超级优惠券
- // CouponView(),
-
- // ///精选活动
- // FeaturedActivity(),
-
- // ///积分商城
- // HomeIntegralStore(gooods),
-
- ///积分商品头Tab
- PointsGoodsTitle(
- gooodsCategorys,
- (orderType, orderDesc) {
- this.orderType = orderType;
- this.orderDesc = orderDesc;
- setState(() {});
- },
- (index) {
- categoryId = gooodsCategorys[index].id;
- pageNum = 1;
- setState(() {});
- },
- ),
-
- ///积分商品列表
- PointGoods(
- goods,
- (index) {
- _toDetails(index);
- },
- ),
- ],
- );})
- ),
+ physics: NeverScrollableScrollPhysics(),
+ child: Column(
+ children: [
+ ///banner
+ homeBanner(),
+
+ ///吃喝玩
+ UnionEntry((int jpIndex) {
+ widget.changeTab(1, jpIndex);
+ }),
+
+ ///快捷操作
+ ShortcutOperation((int jpIndex) {
+ widget.changeTab(1, jpIndex);
+ }),
+
+ ///推广图
+ if(activityBannerData.length > 0)
+ spread(),
+
+ // ///签到
+ // SignView(isSigned, (value) {
+ // setState(() {
+ // isSigned = value;
+ // });
+ // }),
+
+ ///特惠专区
+ if (coupons != null && coupons.length != 0)
+ DiscountZone(coupons),
+
+ ///特惠专区-推荐商品展示
+ if (homeRank != null &&
+ homeRank.commodityZone.length != 0)
+ HomeRecommendGoods(homeRank),
+
+ ///助农专区
+ // if(mRaiseMoney != 0)
+ HappyHelpFarmers(),
+
+ ///福利中心
+ WelfareCore(),
+
+ ///吃喝玩商品热销榜
+ if (homeRank != null &&
+ homeRank.commodityList.length != 0)
+ TopSellingList(homeRank),
+
+ // ///店铺推荐
+ // QuickOrder(),
+
+ // ///超级优惠券
+ // CouponView(),
+
+ // ///精选活动
+ // FeaturedActivity(),
+
+ // ///积分商城
+ // HomeIntegralStore(gooods),
+
+ ///积分商品头Tab
+ PointsGoodsTitle(
+ gooodsCategorys,
+ (orderType, orderDesc) {
+ this.orderType = orderType;
+ this.orderDesc = orderDesc;
+ queryPointsProductList(false);
+ },
+ (index) {
+ categoryId = gooodsCategorys[index].id;
+ queryPointsProductList(false);
+ },
+ ),
+
+ ///积分商品列表
+ PointGoods(
+ goods,
+ (index) {
+ _toDetails(index);
+ },
+ ),
+ ],
+ )),
),
),
),
@@ -605,57 +560,191 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin {
);
}
- Widget spread(){
+ Widget homeBanner() {
+ return Container(
+ child: AspectRatio(
+ aspectRatio: 1.25,
+ child: bannerData != null && bannerData.isNotEmpty
+ ? Swiper(
+ pagination: SwiperPagination(
+ margin: EdgeInsets.only(bottom: 12.h),
+ alignment: Alignment.bottomCenter,
+ builder: DotSwiperPaginationBuilder(
+ size: 8,
+ activeSize: 8,
+ space: 5,
+ activeColor: Colors.white,
+ color: Colors.white.withAlpha(76),
+ ),
+ ),
+ autoplay: true,
+ duration: 1000,
+ autoplayDelay: 2000,
+ physics: BouncingScrollPhysics(),
+ itemBuilder: (context, position) {
+ return InkWell(
+ onTap: () {
+ bannerClick(bannerData[position]);
+ },
+ child: Container(
+ child: MImage(
+ bannerData[position].imgUrl,
+ fit: BoxFit.cover,
+ errorSrc: "assets/image/default_2_1.webp",
+ fadeSrc: "assets/image/default_2_1.webp",
+ ),
+ ),
+ );
+ },
+ itemCount: bannerData.length,
+ )
+ : Image.asset(
+ "assets/image/default_2_1.webp",
+ fit: BoxFit.cover,
+ ),
+ ),
+ );
+ }
+
+ /// contentType 跳转类型(0:不跳转,1:积分商品,2:活动,3:文章,4:页面跳转,5:课程,7:门店跳转)
+ bannerClick(BannerData bannerData) async {
+ switch (bannerData.contentType) {
+ case 1:
+ Navigator.of(context).pushNamed('/router/integral_store_page',
+ arguments: {"goodsId": bannerData.content});
+ break;
+ case 2:
+ Navigator.of(context).pushNamed('/router/web_page', arguments: {
+ "activityId": bannerData.content,
+ });
+ break;
+ case 3:
+ Navigator.of(context).pushNamed('/router/web_page', arguments: {
+ "articleId": bannerData.content,
+ });
+ break;
+ case 4:
+ String router = bannerData.content;
+ // String router = "/router/store_order?{\"id\":\"1512378184161558528\",\"tenant\":\"1188\",\"storeName\":\"农场煮意\"}";
+ if (router.contains("?")) {
+ String params = router.substring(router.indexOf("?") + 1);
+ Map map = jsonDecode(params);
+ Navigator.of(context).pushNamed(
+ router.substring(0, router.indexOf("?")),
+ arguments: map);
+ } else {
+ Navigator.of(context).pushNamed(router);
+ }
+ break;
+ case 5:
+ Navigator.of(context).pushNamed('/router/class_details', arguments: {
+ "id": bannerData.content,
+ });
+ break;
+ case 7:
+ String params =
+ bannerData.content.substring(bannerData.content.indexOf("?") + 1);
+ Map map = jsonDecode(params);
+ Navigator.of(context).pushNamed(
+ bannerData.content.substring(0, bannerData.content.indexOf("?")),
+ arguments: map);
+ break;
+ }
+ }
+
+ Widget spread() {
return Container(
width: double.infinity,
+ // margin: EdgeInsets.symmetric(horizontal:14.w),
height: 85.h,
- child: Swiper(
- pagination: SwiperPagination(
- alignment: Alignment.bottomCenter,
- margin: EdgeInsets.only(top: 5.h),
- builder: DotSwiperPaginationBuilder(
- size: 8.w,
- activeSize: 8.w,
- space: 5.w,
- activeColor: Colors.white,
- color: Colors.white.withAlpha(76),
- ),
- ),
- autoplay:true,
- duration: 1000,
- autoplayDelay: 2000,
- itemBuilder: (context, position) {
- return GestureDetector(
- onTap: (){
- if(position == 0){
- Navigator.of(context).pushNamed('/router/invite_friends');
- }else if(position == 1){
- Navigator.of(context).pushNamed('/router/trading_card_page');
- }
- },
- child:Container(
- margin: EdgeInsets.symmetric(horizontal:14.w),
- child: ClipRRect(
- child:Image.asset(
- spreadItem[position],
- width:double.infinity,
- fit: BoxFit.fill,
- height:double.infinity,
+ child: activityBannerData != null && activityBannerData.isNotEmpty
+ ? Swiper(
+ pagination: SwiperPagination(
+ alignment: Alignment.bottomCenter,
+ margin: EdgeInsets.only(top: 5.h),
+ builder: DotSwiperPaginationBuilder(
+ size: 8.w,
+ activeSize: 8.w,
+ space: 5.w,
+ activeColor: Colors.white,
+ color: Colors.white.withAlpha(76),
),
- borderRadius: BorderRadius.circular(6.w),
),
+ autoplay: true,
+ duration: 1000,
+ autoplayDelay: 2000,
+ itemBuilder: (context, position) {
+ return InkWell(
+ onTap: () {
+ spreadBannerClick(activityBannerData[position]);
+ },
+ child: Container(
+ margin: EdgeInsets.symmetric(horizontal: 14.w),
+ child: MImage(
+ activityBannerData[position].imgUrl,
+ fit: BoxFit.cover,
+ radius: BorderRadius.circular(6),
+ errorSrc: "assets/image/default_2_1.webp",
+ fadeSrc: "assets/image/default_2_1.webp",
+ ),
+ ),
+ );
+ },
+ itemCount: activityBannerData.length,
+ )
+ : Image.asset(
+ "assets/image/default_2_1.webp",
+ fit: BoxFit.cover,
),
- );
- },
- itemCount:2,
- ),
);
}
- final List spreadItem = [
- "assets/image/welfare_spread.webp",
- "assets/image/welfare_yz.webp",
- ];
+ /// contentType 跳转类型(0:不跳转,1:积分商品,2:活动,3:文章,4:页面跳转,5:课程,7:门店跳转)
+ spreadBannerClick(BannerData activityBannerData) async {
+ switch (activityBannerData.contentType) {
+ case 1:
+ Navigator.of(context).pushNamed('/router/integral_store_page',
+ arguments: {"goodsId": activityBannerData.content});
+ break;
+ case 2:
+ Navigator.of(context).pushNamed('/router/web_page', arguments: {
+ "activityId": activityBannerData.content,
+ });
+ break;
+ case 3:
+ Navigator.of(context).pushNamed('/router/web_page', arguments: {
+ "articleId": activityBannerData.content,
+ });
+ break;
+ case 4:
+ String router = activityBannerData.content;
+ // String router = "/router/store_order?{\"id\":\"1512378184161558528\",\"tenant\":\"1188\",\"storeName\":\"农场煮意\"}";
+ if (router.contains("?")) {
+ String params = router.substring(router.indexOf("?") + 1);
+ Map map = jsonDecode(params);
+ Navigator.of(context).pushNamed(
+ router.substring(0, router.indexOf("?")),
+ arguments: map);
+ } else {
+ Navigator.of(context).pushNamed(router);
+ }
+ break;
+ case 5:
+ Navigator.of(context).pushNamed('/router/class_details', arguments: {
+ "id": activityBannerData.content,
+ });
+ break;
+ case 7:
+ String params = activityBannerData.content
+ .substring(activityBannerData.content.indexOf("?") + 1);
+ Map map = jsonDecode(params);
+ Navigator.of(context).pushNamed(
+ activityBannerData.content
+ .substring(0, activityBannerData.content.indexOf("?")),
+ arguments: map);
+ break;
+ }
+ }
///扫码
toScan() async {
@@ -681,20 +770,24 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin {
// 新版桌子码跳转
// http://miniscan.lotus-wallet.com/placeorder?tenant_code=1194&table_id=1669609340031467520&store_id=1637659387134738432
var result = await Navigator.of(context).pushNamed('/router/qr_scan');
- if(result.toString().contains("type\":\"coupon")){
+ if (result.toString().contains("type\":\"coupon")) {
///活动优惠券赠送弹窗
activityShowAlertDialog(result.toString());
return;
- }if(result.toString().contains("type\":\"wiped")){
+ }
+ if (result.toString().contains("type\":\"wiped")) {
///核销券
queryWiped(jsonDecode(result.toString())["memberCouponId"]);
return;
}
// String result = await scanner.scan();
Uri uri = Uri.parse(result);
- String tableId = uri.queryParameters["tableId"] ?? uri.queryParameters["table_id"];
- String tenantCode = uri.queryParameters["tenantCode"] ?? uri.queryParameters["tenant_code"];
- String shopId = uri.queryParameters["shopId"] ?? uri.queryParameters["store_id"];
+ String tableId =
+ uri.queryParameters["tableId"] ?? uri.queryParameters["table_id"];
+ String tenantCode = uri.queryParameters["tenantCode"] ??
+ uri.queryParameters["tenant_code"];
+ String shopId =
+ uri.queryParameters["shopId"] ?? uri.queryParameters["store_id"];
if (tableId != null &&
tableId != "" &&
tenantCode != null &&
diff --git a/lib/home/huixiang_brand_page.dart b/lib/home/huixiang_brand_page.dart
index 22ec8ead..af0a5425 100644
--- a/lib/home/huixiang_brand_page.dart
+++ b/lib/home/huixiang_brand_page.dart
@@ -44,7 +44,7 @@ class _BrandPage extends State
Founder founder;
queryHome() async {
- EasyLoading.show(status: S.current.zhengzaijiazai);
+ EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black);
final SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(
diff --git a/lib/home/points_mall_page.dart b/lib/home/points_mall_page.dart
index e3c86fba..4e0d55fe 100644
--- a/lib/home/points_mall_page.dart
+++ b/lib/home/points_mall_page.dart
@@ -95,7 +95,7 @@ class _PointsMallPage extends State
}
creditGoods() async {
- EasyLoading.show(status: S.current.zhengzaijiazai);
+ EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black);
final SharedPreferences value = await SharedPreferences.getInstance();
client = ApiService(Dio(),
diff --git a/lib/home/welfare_exchange.dart b/lib/home/welfare_exchange.dart
index 4fa8ecaa..b4ec8b8e 100644
--- a/lib/home/welfare_exchange.dart
+++ b/lib/home/welfare_exchange.dart
@@ -62,7 +62,7 @@ class _WelfareExchange extends State
}
queryUser() async {
- EasyLoading.show(status: S.current.zhengzaijiazai);
+ EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black);
BaseData baseData =
await apiService.queryInfo().catchError((onError) {});
if (baseData != null && baseData.isSuccess) {
diff --git a/lib/home/welfare_page.dart b/lib/home/welfare_page.dart
index 902a9511..a6cb8fdf 100644
--- a/lib/home/welfare_page.dart
+++ b/lib/home/welfare_page.dart
@@ -39,69 +39,48 @@ class _WelfarePage extends State {
List goods = [];
Goods goodsPrice;
List coupons = [];
- List> coupon=[];
+ List> coupon = [];
String categoryId;
bool orderDesc = true;
int orderType = 1;
int type = 1;
int couponIndex = 0;
int swiperIndex = 0;
+ int _loadCount = 0;
@override
void initState() {
super.initState();
- SharedPreferences.getInstance().then((value) => {
- apiService = ApiService(Dio(), context: context, token: value.getString("token")),
- _onRefresh(),
-
- });
+ _onRefresh();
}
queryGoods() async {
- if (apiService == null) {
- SharedPreferences value = await SharedPreferences.getInstance();
- apiService = ApiService(
- Dio(),
- context: context,
- token: value.getString("token"),
- );
- }
- var param = {
- "categoryId": categoryId ?? "",
- "orderDesc": orderDesc,
- "orderType": orderType,
- "pageNum": 1,
- "pageSize": 100,
- "state": 1
- };
- BaseData> pageGoods =
- await apiService.creditGoods(param).catchError((onError) {
- refreshController.loadFailed();
- refreshController.refreshFailed();
- });
- EasyLoading.dismiss();
- if (pageGoods != null && pageGoods.isSuccess) {
- setState(() {
+ try {
+ var param = {
+ "categoryId": categoryId ?? "",
+ "orderDesc": orderDesc,
+ "orderType": orderType,
+ "pageNum": 1,
+ "pageSize": 100,
+ "state": 1
+ };
+ BaseData> pageGoods =
+ await apiService.creditGoods(param).catchError((onError) {
+ refreshController.loadFailed();
+ refreshController.refreshFailed();
+ });
+ EasyLoading.dismiss();
+ if (pageGoods != null && pageGoods.isSuccess) {
goods.clear();
goods.addAll(pageGoods.data.list);
- });
- refreshController.refreshCompleted();
- refreshController.loadComplete();
- } else {
- refreshController.loadFailed();
- refreshController.refreshFailed();
+ }
+ } finally {
+ addLoadCount();
}
}
queryCoupon() async {
- if (apiService == null) {
- SharedPreferences value = await SharedPreferences.getInstance();
- apiService = ApiService(
- Dio(),
- context: context,
- token: value.getString("token"),
- );
- }
+ try{
BaseData> baseData = await apiService.queryCoupon({
"centre": true,
"pageNum": 1,
@@ -110,36 +89,48 @@ class _WelfarePage extends State {
"state": 0
}).catchError((onError) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(onError.type),
- alignment: Alignment.center);
- refreshController.refreshFailed();
- refreshController.loadFailed();
+ alignment: Alignment.center);
});
coupons.clear();
coupon.clear();
if (baseData != null && baseData.isSuccess) {
coupons.addAll(baseData.data.list);
- for(var i = 0;i < coupons.length~/3+1;i++){
+ for (var i = 0; i < coupons.length ~/ 3 + 1; i++) {
List con = [];
- con = coupons.skip(i*3).take((i*3 0 && coupon[coupon.length - 1].isEmpty)
- coupon.removeAt(coupon.length-1);
- refreshController.refreshCompleted();
- refreshController.loadComplete();
+ if (coupon.length > 0 && coupon[coupon.length - 1].isEmpty)
+ coupon.removeAt(coupon.length - 1);
setState(() {});
- } else {
- refreshController.refreshFailed();
- refreshController.loadFailed();
+ }}finally{
+ addLoadCount();
}
}
-
- _onRefresh(){
+ _onRefresh() async{
+ EasyLoading.show(status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black);
+ if (apiService == null) {
+ SharedPreferences value = await SharedPreferences.getInstance();
+ apiService =
+ ApiService(Dio(), context: context, token: value.getString("token"));
+ }
queryGoods();
queryCoupon();
}
+ addLoadCount() {
+ _loadCount += 1;
+ if (_loadCount == 2) {
+ _loadCount = 0;
+ EasyLoading.dismiss();
+ if (refreshController.isRefresh) refreshController.refreshCompleted();
+ if (mounted) setState(() {});
+ }
+ }
@override
Widget build(BuildContext context) {
@@ -157,7 +148,10 @@ class _WelfarePage extends State {
width: double.infinity,
height: 236.h,
),
- Expanded(child: Container(color: Colors.white,))
+ Expanded(
+ child: Container(
+ color: Colors.white,
+ ))
],
),
Scaffold(
@@ -170,7 +164,7 @@ class _WelfarePage extends State {
titleSize: 18.sp,
brightness: Brightness.dark,
),
- body:SmartRefresher(
+ body: SmartRefresher(
controller: refreshController,
enablePullDown: true,
enablePullUp: false,
@@ -180,18 +174,15 @@ class _WelfarePage extends State {
return MyFooter(mode);
},
),
- onRefresh:(){
- setState(() {
- _onRefresh();
- });
- },
+ onRefresh:_onRefresh,
physics: BouncingScrollPhysics(),
scrollController: ScrollController(),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(6),
- topRight: Radius.circular(6),),
+ topRight: Radius.circular(6),
+ ),
color: Colors.white,
boxShadow: [
BoxShadow(
@@ -213,12 +204,10 @@ class _WelfarePage extends State {
Container(
color: Colors.white,
- padding: EdgeInsets.only(left: 14,right: 14),
- child:Column(
+ padding: EdgeInsets.only(left: 14, right: 14),
+ child: Column(
children: [
-
inviteFriends(),
-
benefitExchange(),
],
),
@@ -242,7 +231,8 @@ class _WelfarePage extends State {
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(6),
- topRight: Radius.circular(6),),
+ topRight: Radius.circular(6),
+ ),
color: Colors.white,
boxShadow: [
BoxShadow(
@@ -253,14 +243,13 @@ class _WelfarePage extends State {
),
],
),
- child: Column(
+ child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
- padding: EdgeInsets.symmetric(horizontal: 17.w,vertical: 16.h),
- child:
- Row(
+ padding: EdgeInsets.symmetric(horizontal: 17.w, vertical: 16.h),
+ child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
@@ -282,81 +271,82 @@ class _WelfarePage extends State {
),
],
)),
- coupon.length == 0?
- NoDataView(
+ coupon.length == 0
+ ? NoDataView(
+ src: "assets/image/ka.webp",
+ isShowBtn: false,
+ text: S.of(context).haimeiyouyouhuiquankeyilingqu,
+ fontSize: 16.sp,
+ )
+ : AspectRatio(
+ aspectRatio: 1.10,
+ child: Swiper(
+ onIndexChanged: (it) {
+ swiperIndex = it;
+ },
+ index: couponIndex,
+ viewportFraction: 0.9,
+ scale: 0.7,
+ key: UniqueKey(),
+ pagination: SwiperPagination(
+ alignment: Alignment.bottomCenter,
+ builder: DotSwiperPaginationBuilder(
+ size: 8,
+ activeSize: 8,
+ space: 5,
+ activeColor: Colors.black,
+ color: Colors.black.withAlpha(76),
+ ),
+ ),
+ physics: BouncingScrollPhysics(),
+ itemBuilder: (context, position) {
+ return Column(
+ children: [
+ Container(
+ child: weekList(coupon[position]),
+ ),
+ ],
+ );
+ },
+ itemCount: coupon.length ?? 0,
+ ),
+ )
+ ],
+ ));
+ }
+
+ Widget weekList(List cops) {
+ return Expanded(
+ child: (cops == null && cops.length == 0)
+ ? NoDataView(
src: "assets/image/ka.webp",
isShowBtn: false,
text: S.of(context).haimeiyouyouhuiquankeyilingqu,
fontSize: 16.sp,
- ): AspectRatio(
- aspectRatio: 1.10,
- child: Swiper(
- onIndexChanged: (it){
- swiperIndex = it;
- },
- index: couponIndex,
- viewportFraction: 0.9,
- scale: 0.7,
- key: UniqueKey(),
- pagination: SwiperPagination(
- alignment: Alignment.bottomCenter,
- builder: DotSwiperPaginationBuilder(
- size: 8,
- activeSize: 8,
- space: 5,
- activeColor: Colors.black,
- color: Colors.black.withAlpha(76),
- ),
- ),
- physics: BouncingScrollPhysics(),
- itemBuilder: (context, position) {
- return Column(
- children: [
- Container(
- child: weekList(coupon[position]),
- ),
- ],
- );
- },
- itemCount:coupon.length ?? 0,
- ),
)
- ],
- )
+ : ListView.builder(
+ padding: EdgeInsets.zero,
+ itemCount: cops.length,
+ scrollDirection: Axis.vertical,
+ shrinkWrap: true,
+ physics: BouncingScrollPhysics(),
+ itemBuilder: (context, position) {
+ return GestureDetector(
+ onTap: () {},
+ child: weekCoupon(cops[position]),
+ );
+ },
+ ),
);
}
- Widget weekList(List cops){
- return Expanded(
- child:(cops == null && cops.length == 0)?
- NoDataView(
- src: "assets/image/ka.webp",
- isShowBtn: false,
- text: S.of(context).haimeiyouyouhuiquankeyilingqu,
- fontSize: 16.sp,
- ):ListView.builder(
- padding: EdgeInsets.zero,
- itemCount: cops.length,
- scrollDirection: Axis.vertical,
- shrinkWrap: true,
- physics: BouncingScrollPhysics(),
- itemBuilder: (context, position) {
- return GestureDetector(
- onTap: () {
- },
- child: weekCoupon(cops[position]),
- );
- },
- ),);
- }
-
///优惠券列表
Widget weekCoupon(Coupon cop) {
return Container(
height: 95.h,
width: double.infinity,
- margin: EdgeInsets.only(bottom:10),
- padding:EdgeInsets.symmetric(horizontal: 12),
+ margin: EdgeInsets.only(bottom: 10),
+ padding: EdgeInsets.symmetric(horizontal: 12),
decoration: BoxDecoration(
image: DecorationImage(
fit: BoxFit.fill,
@@ -367,8 +357,9 @@ class _WelfarePage extends State {
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Expanded(child: Container(
- margin: EdgeInsets.only(top: 12,bottom: 12),
+ Expanded(
+ child: Container(
+ margin: EdgeInsets.only(top: 12, bottom: 12),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
@@ -383,31 +374,37 @@ class _WelfarePage extends State {
color: Color(0xFF0D0D0D),
),
),
- SizedBox(height: 12,),
- (cop.status == 0)?
- Text(
- "发放时间: ${cop?.publishStartTime ?? ""}",
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- style: TextStyle(
- fontSize: 12.sp,
- fontWeight: MyFontWeight.regular,
- color: cop.status == 3 ? Color(0xFFB3B3B3) :Color(0xFF4D4D4D),
- ),
- ):Text(
- "有效期至 ${cop?.useEndTime ?? ""}",
- maxLines:1,
- overflow: TextOverflow.ellipsis,
- style: TextStyle(
- fontSize: 12.sp,
- fontWeight: MyFontWeight.regular,
- color: cop.status == 3 ? Color(0xFFB3B3B3) :Color(0xFF4D4D4D),
- ),
- )
+ SizedBox(
+ height: 12,
+ ),
+ (cop.status == 0)
+ ? Text(
+ "发放时间: ${cop?.publishStartTime ?? ""}",
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: TextStyle(
+ fontSize: 12.sp,
+ fontWeight: MyFontWeight.regular,
+ color: cop.status == 3
+ ? Color(0xFFB3B3B3)
+ : Color(0xFF4D4D4D),
+ ),
+ )
+ : Text(
+ "有效期至 ${cop?.useEndTime ?? ""}",
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: TextStyle(
+ fontSize: 12.sp,
+ fontWeight: MyFontWeight.regular,
+ color: cop.status == 3
+ ? Color(0xFFB3B3B3)
+ : Color(0xFF4D4D4D),
+ ),
+ )
],
),
)),
-
Column(
// mainAxisAlignment: MainAxisAlignment.start,
// crossAxisAlignment: CrossAxisAlignment.end,
@@ -441,7 +438,8 @@ class _WelfarePage extends State {
style: TextStyle(
fontSize: 16.sp,
fontWeight: MyFontWeight.medium,
- color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
+ color:
+ cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060),
),
),
SizedBox(
@@ -450,26 +448,25 @@ class _WelfarePage extends State {
Text(
coupon != null
? double.tryParse("${cop.discountAmount}" ?? "0")
- .toInt()
- .toString()
+ .toInt()
+ .toString()
: "",
style: TextStyle(
fontSize: 24.sp,
fontWeight: MyFontWeight.semi_bold,
- color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
+ color:
+ cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060),
),
),
],
),
Text(
- S.of(context).manyuankeyong(coupon != null
- ? ("${cop.fullAmount}" ?? "0")
- .toString()
- : ""),
+ S.of(context).manyuankeyong(
+ coupon != null ? ("${cop.fullAmount}" ?? "0").toString() : ""),
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.semi_bold,
- color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
+ color: cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060),
),
),
],
@@ -489,7 +486,8 @@ class _WelfarePage extends State {
style: TextStyle(
fontSize: 22.sp,
fontWeight: MyFontWeight.semi_bold,
- color:cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
+ color:
+ cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060),
),
),
],
@@ -500,7 +498,7 @@ class _WelfarePage extends State {
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.semi_bold,
- color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
+ color: cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060),
),
),
],
@@ -511,7 +509,7 @@ class _WelfarePage extends State {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
- padding: EdgeInsets.only(bottom:10,top: 7),
+ padding: EdgeInsets.only(bottom: 10, top: 7),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
@@ -520,7 +518,8 @@ class _WelfarePage extends State {
style: TextStyle(
fontSize: 26.sp,
fontWeight: MyFontWeight.semi_bold,
- color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
+ color:
+ cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060),
),
),
],
@@ -531,7 +530,7 @@ class _WelfarePage extends State {
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.semi_bold,
- color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
+ color: cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060),
),
),
],
@@ -547,31 +546,35 @@ class _WelfarePage extends State {
textBaseline: TextBaseline.alphabetic,
children: [
Text(
- cop.limitAmount != "0.00"?"¥":"",
+ cop.limitAmount != "0.00" ? "¥" : "",
style: TextStyle(
fontSize: 16.sp,
fontWeight: MyFontWeight.medium,
- color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
+ color:
+ cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060),
),
),
SizedBox(
height: 4.h,
),
Text(
- cop.limitAmount != "0.00"?(coupon != null
- ? "${AppUtils.calculateDouble(double.tryParse(cop.limitAmount) ?? 0)}"
- : "") :"",
+ cop.limitAmount != "0.00"
+ ? (coupon != null
+ ? "${AppUtils.calculateDouble(double.tryParse(cop.limitAmount) ?? 0)}"
+ : "")
+ : "",
style: TextStyle(
fontSize: 24.sp,
fontWeight: FontWeight.bold,
- color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
+ color:
+ cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060),
),
),
],
),
],
);
- }else{
+ } else {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
@@ -582,25 +585,29 @@ class _WelfarePage extends State {
textBaseline: TextBaseline.alphabetic,
children: [
Text(
- cop.discountPercent != 0 ? (coupon != null
- ? "${(cop.discountPercent / 10.0 >= 10) ? 10 : cop.discountPercent / 10.0}" ??
- "0"
- : ""):"",
+ cop.discountPercent != 0
+ ? (coupon != null
+ ? "${(cop.discountPercent / 10.0 >= 10) ? 10 : cop.discountPercent / 10.0}" ??
+ "0"
+ : "")
+ : "",
style: TextStyle(
fontSize: 30.sp,
fontWeight: MyFontWeight.semi_bold,
- color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
+ color:
+ cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060),
),
),
SizedBox(
height: 4.h,
),
Text(
- cop.discountPercent != 0 ? "折" :"",
+ cop.discountPercent != 0 ? "折" : "",
style: TextStyle(
fontSize: 16.sp,
fontWeight: MyFontWeight.semi_bold,
- color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
+ color:
+ cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060),
),
),
],
@@ -612,67 +619,66 @@ class _WelfarePage extends State {
///优惠券领取状态
Widget weekBtn(Coupon cop) {
- if(cop.status == 0)
- return Align(
- alignment: Alignment.centerRight,
- child: InkWell(
- onTap: () {
- receiveCoupon(cop.id);
- },
- child: Container(
- padding: EdgeInsets.symmetric(horizontal: 12.w,vertical: 2.h),
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(3),
- color: Color(0xFF32A060),
- ),
- child: Text(
- S.of(context).lingqu,
- style: TextStyle(
- fontSize: 12.sp,
- fontWeight: MyFontWeight.medium,
- color: Colors.white,
- ),
- ),
- ),
+ if (cop.status == 0)
+ return Align(
+ alignment: Alignment.centerRight,
+ child: InkWell(
+ onTap: () {
+ receiveCoupon(cop.id);
+ },
+ child: Container(
+ padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 2.h),
+ decoration: BoxDecoration(
+ borderRadius: BorderRadius.circular(3),
+ color: Color(0xFF32A060),
+ ),
+ child: Text(
+ S.of(context).lingqu,
+ style: TextStyle(
+ fontSize: 12.sp,
+ fontWeight: MyFontWeight.medium,
+ color: Colors.white,
),
- );
- if(cop.status == 1 || cop.status == 2)
+ ),
+ ),
+ ),
+ );
+ if (cop.status == 1 || cop.status == 2)
return Align(
- alignment: Alignment.centerRight,
- child: InkWell(
- onTap: () {
- if (cop.bizType == 5 || cop.bizType == 3) {
- Navigator.of(context).pushNamed(
- '/router/write_off_page',
- arguments: {
- "couponId": cop.id,
- "coupon": jsonEncode(cop.toJson()),
- });
- } else {
- showStoreSelector(cop.storeList);
- }
- },
- child: Container(
- // height: 19.h,
- padding: EdgeInsets.symmetric(horizontal:8.w,vertical: 1.h),
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(3),
- border: Border.all(
- width: 1, color: Color(0xFF32A060), style: BorderStyle.solid),
- color: Colors.transparent,
- ),
- alignment: Alignment.center,
- child:Text(
- S.of(context).qushiyong,
- style: TextStyle(
- fontSize: 12.sp,
- fontWeight: MyFontWeight.regular,
- color: Color(0xFF32A060),
- ),
- ),
- ),
+ alignment: Alignment.centerRight,
+ child: InkWell(
+ onTap: () {
+ if (cop.bizType == 5 || cop.bizType == 3) {
+ Navigator.of(context)
+ .pushNamed('/router/write_off_page', arguments: {
+ "couponId": cop.id,
+ "coupon": jsonEncode(cop.toJson()),
+ });
+ } else {
+ showStoreSelector(cop.storeList);
+ }
+ },
+ child: Container(
+ // height: 19.h,
+ padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 1.h),
+ decoration: BoxDecoration(
+ borderRadius: BorderRadius.circular(3),
+ border: Border.all(
+ width: 1, color: Color(0xFF32A060), style: BorderStyle.solid),
+ color: Colors.transparent,
+ ),
+ alignment: Alignment.center,
+ child: Text(
+ S.of(context).qushiyong,
+ style: TextStyle(
+ fontSize: 12.sp,
+ fontWeight: MyFontWeight.regular,
+ color: Color(0xFF32A060),
),
- );
+ ),
+ ),
+ ),
+ );
}
///领取优惠券
@@ -682,8 +688,8 @@ class _WelfarePage extends State {
if (baseData != null && baseData.isSuccess) {
queryCoupon();
showAlertDialog();
- }else{
- SmartDialog.showToast(baseData?.msg,alignment: Alignment.center);
+ } else {
+ SmartDialog.showToast(baseData?.msg, alignment: Alignment.center);
}
}
@@ -710,8 +716,8 @@ class _WelfarePage extends State {
///邀请好友
Widget inviteFriends() {
return Container(
- margin: EdgeInsets.only(top:24.h,bottom:20.h),
- child:Column(
+ margin: EdgeInsets.only(top: 24.h, bottom: 20.h),
+ child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@@ -723,17 +729,19 @@ class _WelfarePage extends State {
color: Color(0xFF0D0D0D),
),
),
- SizedBox(height: 12,),
+ SizedBox(
+ height: 12,
+ ),
GestureDetector(
- onTap: (){
+ onTap: () {
Navigator.of(context).pushNamed('/router/invite_friends');
},
- child:ClipRRect(
- child:Image.asset(
+ child: ClipRRect(
+ child: Image.asset(
"assets/image/welfare_spread.webp",
- width:double.infinity,
+ width: double.infinity,
fit: BoxFit.fill,
- height:80.h,
+ height: 80.h,
),
borderRadius: BorderRadius.circular(6.w),
),
@@ -747,28 +755,29 @@ class _WelfarePage extends State {
Widget benefitExchange() {
return Container(
width: double.infinity,
- margin: EdgeInsets.only(top:24.h,bottom:20.h),
- child:Column(
+ margin: EdgeInsets.only(top: 24.h, bottom: 20.h),
+ child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
GestureDetector(
- onTap: (){
+ onTap: () {
Navigator.of(context).pushNamed('/router/welfare_exchange');
},
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
- Expanded(child:
- Text(
- S.of(context).fuliduihuan,
- style: TextStyle(
- fontSize: 15.sp,
- fontWeight: MyFontWeight.bold,
- color: Color(0xFF0D0D0D),
+ Expanded(
+ child: Text(
+ S.of(context).fuliduihuan,
+ style: TextStyle(
+ fontSize: 15.sp,
+ fontWeight: MyFontWeight.bold,
+ color: Color(0xFF0D0D0D),
+ ),
),
- ),),
+ ),
Text(
S.of(context).gengduo,
style: TextStyle(
@@ -785,47 +794,50 @@ class _WelfarePage extends State {
],
),
),
- SizedBox(height: 12,),
- (goods == null || goods.length == 0)? NoDataView(
- src: "assets/image/xiao_fei.webp",
- isShowBtn: false,
- text: "暂无商品可兑换",
- fontSize: 16.sp,
- margin: EdgeInsets.all(60.h),
- )
- :GridView.builder(
- itemCount:goods.length>6?6:goods.length,
- padding: EdgeInsets.only(
- // left: 16.w,
- // right: 16.w,
- top: 18.h,
- bottom: 16.h,
- ),
- shrinkWrap: true,
- physics: BouncingScrollPhysics(),
- gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
- //一行的Widget数量
- crossAxisCount: 2,
- //水平子Widget之间间距
- crossAxisSpacing: 11.w,
- //垂直子Widget之间间距
- mainAxisSpacing: 16.w,
- //子Widget宽高比例 0.59
- childAspectRatio:
- 200 / (285 / 2 + (285 / 2) * AppUtils.textScale(context)),
- ),
- itemBuilder: (context, index) {
- return GestureDetector(
- onTap: () {
- Navigator.of(context).pushNamed(
- '/router/integral_store_page',
- arguments: {"goodsId": goods[index].id},
- );
- },
- child: exchangeItem(goods[index]),
- );
- },
- )
+ SizedBox(
+ height: 12,
+ ),
+ (goods == null || goods.length == 0)
+ ? NoDataView(
+ src: "assets/image/xiao_fei.webp",
+ isShowBtn: false,
+ text: "暂无商品可兑换",
+ fontSize: 16.sp,
+ margin: EdgeInsets.all(60.h),
+ )
+ : GridView.builder(
+ itemCount: goods.length > 6 ? 6 : goods.length,
+ padding: EdgeInsets.only(
+ // left: 16.w,
+ // right: 16.w,
+ top: 18.h,
+ bottom: 16.h,
+ ),
+ shrinkWrap: true,
+ physics: BouncingScrollPhysics(),
+ gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
+ //一行的Widget数量
+ crossAxisCount: 2,
+ //水平子Widget之间间距
+ crossAxisSpacing: 11.w,
+ //垂直子Widget之间间距
+ mainAxisSpacing: 16.w,
+ //子Widget宽高比例 0.59
+ childAspectRatio: 200 /
+ (285 / 2 + (285 / 2) * AppUtils.textScale(context)),
+ ),
+ itemBuilder: (context, index) {
+ return GestureDetector(
+ onTap: () {
+ Navigator.of(context).pushNamed(
+ '/router/integral_store_page',
+ arguments: {"goodsId": goods[index].id},
+ );
+ },
+ child: exchangeItem(goods[index]),
+ );
+ },
+ )
],
),
);
@@ -871,10 +883,8 @@ class _WelfarePage extends State {
margin: EdgeInsets.only(
right: 12.w,
top: 10.h,
- ),padding: EdgeInsets.only(
- bottom: 8,
- left: 8
- ),
+ ),
+ padding: EdgeInsets.only(bottom: 8, left: 8),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
@@ -894,12 +904,12 @@ class _WelfarePage extends State {
Text(
pointPrice(goods),
style: TextStyle(
- color: Color(0xFFE5600D),
- fontSize: 16.sp,
+ color: Color(0xFFE5600D),
+ fontSize: 16.sp,
fontFamily: 'JDZhengHT',
- fontWeight: MyFontWeight.semi_bold,
- ),
- ),
+ fontWeight: MyFontWeight.semi_bold,
+ ),
+ ),
],
),
),
@@ -912,16 +922,22 @@ class _WelfarePage extends State {
);
}
- String pointPrice(Goods goodsPrice){
- if(goodsPrice == null)
- return "";
- if(goodsPrice?.oneBean!=null && goodsPrice?.oneBean!="0"){
+ String pointPrice(Goods goodsPrice) {
+ if (goodsPrice == null) return "";
+ if (goodsPrice?.oneBean != null && goodsPrice?.oneBean != "0") {
return "${goodsPrice?.oneBean}印章";
- } else if(goodsPrice?.onePrice!=null && goodsPrice?.onePrice!="0"){
+ } else if (goodsPrice?.onePrice != null && goodsPrice?.onePrice != "0") {
return S.of(context).jifen_(goodsPrice?.onePrice);
- }else if((goodsPrice?.onePrice == null || goodsPrice?.onePrice == "0") && ((goodsPrice?.price != null && goodsPrice?.price != "0") || (goodsPrice?.money != null && goodsPrice?.money != "0.00"))){
- return (goodsPrice?.price== "0"|| goodsPrice?.price == null ? "" : S.of(context).jifen_(goodsPrice?.price)) + (goodsPrice?.money== "0"|| goodsPrice?.money == null ? "" : " + ${AppUtils.calculateDouble(double.tryParse(goodsPrice?.money) ?? 0)}元");
- }else if(goodsPrice.oneMoney != null && goodsPrice.oneMoney != "0.00"){
+ } else if ((goodsPrice?.onePrice == null || goodsPrice?.onePrice == "0") &&
+ ((goodsPrice?.price != null && goodsPrice?.price != "0") ||
+ (goodsPrice?.money != null && goodsPrice?.money != "0.00"))) {
+ return (goodsPrice?.price == "0" || goodsPrice?.price == null
+ ? ""
+ : S.of(context).jifen_(goodsPrice?.price)) +
+ (goodsPrice?.money == "0" || goodsPrice?.money == null
+ ? ""
+ : " + ${AppUtils.calculateDouble(double.tryParse(goodsPrice?.money) ?? 0)}元");
+ } else if (goodsPrice.oneMoney != null && goodsPrice.oneMoney != "0.00") {
return "${AppUtils.calculateDouble(double.tryParse(goodsPrice.oneMoney) ?? 0)}元";
}
}
@@ -929,8 +945,10 @@ class _WelfarePage extends State {
///活动任务
Widget activityTask() {
return Container(
- margin: EdgeInsets.only(bottom:20.h,),
- child:Column(
+ margin: EdgeInsets.only(
+ bottom: 20.h,
+ ),
+ child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@@ -956,17 +974,18 @@ class _WelfarePage extends State {
),
],
),
- SizedBox(height: 12.h,),
+ SizedBox(
+ height: 12.h,
+ ),
ListView.builder(
padding: EdgeInsets.zero,
- itemCount:6,
+ itemCount: 6,
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, position) {
return GestureDetector(
- onTap: () {
- },
+ onTap: () {},
child: taskItem(),
);
},
@@ -978,72 +997,76 @@ class _WelfarePage extends State {
Widget taskItem() {
return Container(
- width:double.infinity,
- height:95.h,
+ width: double.infinity,
+ height: 95.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6),
color: Colors.white,
boxShadow: [
- BoxShadow(
- color: Color(0x08213303).withAlpha(12),
- offset: Offset(0, 2),
- blurRadius: 3,
- spreadRadius: 0,
- ),
- ],
+ BoxShadow(
+ color: Color(0x08213303).withAlpha(12),
+ offset: Offset(0, 2),
+ blurRadius: 3,
+ spreadRadius: 0,
+ ),
+ ],
),
- padding: EdgeInsets.symmetric(horizontal: 12.w,vertical: 12.h),
+ padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 12.h),
margin: EdgeInsets.only(bottom: 10.h),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
- Expanded(child:Column(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- "海峡姐妹茶新品尝鲜(0/3)",
- style: TextStyle(
- fontSize: 14.sp,
- fontWeight: MyFontWeight.bold,
- color: Color(0xFF353535),
+ Expanded(
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ "海峡姐妹茶新品尝鲜(0/3)",
+ style: TextStyle(
+ fontSize: 14.sp,
+ fontWeight: MyFontWeight.bold,
+ color: Color(0xFF353535),
+ ),
),
- ),
- Text(
- "可获得¥10代金券",
- style: TextStyle(
- fontSize: 12.sp,
- fontWeight: MyFontWeight.regular,
- color: Color(0xFF4D4D4D),
+ Text(
+ "可获得¥10代金券",
+ style: TextStyle(
+ fontSize: 12.sp,
+ fontWeight: MyFontWeight.regular,
+ color: Color(0xFF4D4D4D),
+ ),
),
- ), Text(
- "购买任意3杯新品",
- style: TextStyle(
- fontSize: 10.sp,
- fontWeight: MyFontWeight.regular,
- color: Color(0xFFB3B3B3),
+ Text(
+ "购买任意3杯新品",
+ style: TextStyle(
+ fontSize: 10.sp,
+ fontWeight: MyFontWeight.regular,
+ color: Color(0xFFB3B3B3),
+ ),
),
- ),
- ],
- ),),
+ ],
+ ),
+ ),
Container(
width: 55.w,
height: 21.h,
decoration: BoxDecoration(
gradient: new LinearGradient(
- begin: Alignment.centerLeft,
- end: Alignment.centerRight,
- colors: [
- Color(0xFFFF2700),
- Color(0xFFFF4F00),
- ],),
+ begin: Alignment.centerLeft,
+ end: Alignment.centerRight,
+ colors: [
+ Color(0xFFFF2700),
+ Color(0xFFFF4F00),
+ ],
+ ),
// border: Border.all(color: Colors.white,width: 0.5),
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(3),
),
alignment: Alignment.center,
- child:Text(
+ child: Text(
"领取",
style: TextStyle(
fontSize: 12.sp,
@@ -1056,5 +1079,4 @@ class _WelfarePage extends State {
),
);
}
-
}
diff --git a/lib/integral/integral_page.dart b/lib/integral/integral_page.dart
index 06ae97a7..771ec56e 100644
--- a/lib/integral/integral_page.dart
+++ b/lib/integral/integral_page.dart
@@ -19,10 +19,10 @@ import 'package:huixiang/view_widget/sign_in_widget.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
+import '../utils/flutter_utils.dart';
import 'intergra_view/integral_task.dart';
class IntegralPage extends StatefulWidget {
-
@override
State createState() {
return _IntegralPage();
@@ -51,13 +51,17 @@ class _IntegralPage extends State {
);
userInfo = UserInfo.fromJson(jsonDecode(value.getString("user")));
- BaseData> rankData = await apiService.rankList()
- .catchError((onError) {});
+ BaseData> rankData =
+ await apiService.rankList().catchError((onError) {
+ SmartDialog.showToast(AppUtils.dioErrorTypeToString(onError.type),
+ alignment: Alignment.center);
+ refreshController.refreshFailed();
+ });
if (rankData != null && rankData.isSuccess) {
ranks.clear();
ranks.addAll(rankData.data);
refreshController.refreshCompleted();
- }else {
+ } else {
refreshController.refreshFailed();
}
@@ -112,7 +116,9 @@ class _IntegralPage extends State {
Scaffold(
backgroundColor: Colors.transparent,
appBar: MyAppBar(
- exit: (){Navigator.of(context).pop(signInfo.todayHasSignin ?? false);},
+ exit: () {
+ Navigator.of(context).pop(signInfo?.todayHasSignin ?? false);
+ },
background: Colors.transparent,
leadingColor: Colors.white,
title: "",
@@ -124,7 +130,9 @@ class _IntegralPage extends State {
margin: EdgeInsets.only(right: 16.w),
child: GestureDetector(
onTap: () {
- Navigator.of(context).pushNamed('/router/integral_detailed_page',arguments:{"titleType":2});
+ Navigator.of(context).pushNamed(
+ '/router/integral_detailed_page',
+ arguments: {"titleType": 2});
},
child: Text(
S.of(context).mingxi,
@@ -137,17 +145,17 @@ class _IntegralPage extends State {
),
),
),
- body:SmartRefresher(
+ body: SmartRefresher(
controller: refreshController,
enablePullDown: true,
enablePullUp: false,
- header: MyHeader(),
+ header: MyHeader(color: Colors.white,),
footer: CustomFooter(
builder: (context, mode) {
return MyFooter(mode);
},
),
- onRefresh:(){
+ onRefresh: () {
setState(() {
querySignInfo();
});
@@ -163,9 +171,19 @@ class _IntegralPage extends State {
return Column(
children: [
/// 上面的积分和VIP等级显示
- 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()),
+ 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),
@@ -191,7 +209,9 @@ class _IntegralPage extends State {
SmartDialog.showToast("今日已签到了", alignment: Alignment.center);
return;
}
- EasyLoading.show(status: S.of(context).zhengzaijiazai);
+ EasyLoading.show(
+ status: S.of(context).zhengzaijiazai,
+ maskType: EasyLoadingMaskType.black);
BaseData baseData = await apiService.signIn().catchError((onError) {});
if (baseData != null && baseData.isSuccess) {
setState(() {});
diff --git a/lib/integral/intergra_view/integral_task.dart b/lib/integral/intergra_view/integral_task.dart
index 408d8694..e9bb165a 100644
--- a/lib/integral/intergra_view/integral_task.dart
+++ b/lib/integral/intergra_view/integral_task.dart
@@ -6,6 +6,8 @@ import 'package:huixiang/utils/font_weight.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/view_widget/round_button.dart';
+import '../../view_widget/no_data_view.dart';
+
class IntegralTask extends StatefulWidget {
final SignInfo signInfo;
@@ -57,28 +59,38 @@ class _IntegralTask extends State {
),
Expanded(
child: Container(
- child: ListView.builder(
- padding: EdgeInsets.only(left: 10.w, top: 20.h),
- physics: BouncingScrollPhysics(),
- // loop: false,
- // pagination: SwiperPagination(
- // alignment: Alignment.bottomCenter,
- // builder: DotSwiperPaginationBuilder(
- // size: 8,
- // activeSize: 8,
- // space: 5,
- // activeColor: Colors.black,
- // color: Colors.black.withAlpha(76),
- // ),
- // ),
- itemBuilder: (context, position) {
- return taskItem(widget.signInfo.taskList[position]);
- },
- itemCount: (widget.signInfo != null &&
- widget.signInfo.taskList != null &&
- widget.signInfo.taskList.length > 0)
- ? widget.signInfo.taskList.length
- : 0),
+ child: (widget.signInfo != null &&
+ widget.signInfo.taskList != null &&
+ widget.signInfo.taskList.length > 0)
+ ? ListView.builder(
+ padding: EdgeInsets.only(left: 10.w, top: 20.h),
+ physics: BouncingScrollPhysics(),
+ // loop: false,
+ // pagination: SwiperPagination(
+ // alignment: Alignment.bottomCenter,
+ // builder: DotSwiperPaginationBuilder(
+ // size: 8,
+ // activeSize: 8,
+ // space: 5,
+ // activeColor: Colors.black,
+ // color: Colors.black.withAlpha(76),
+ // ),
+ // ),
+ itemBuilder: (context, position) {
+ return taskItem(widget.signInfo.taskList[position]);
+ },
+ itemCount: (widget.signInfo != null &&
+ widget.signInfo.taskList != null &&
+ widget.signInfo.taskList.length > 0)
+ ? widget.signInfo.taskList.length
+ : 0)
+ : NoDataView(
+ src: "assets/image/xiao_fei.webp",
+ isShowBtn: false,
+ text: "暂无任务可做~",
+ fontSize: 16.sp,
+ margin: EdgeInsets.only(left: 60.w, right: 60.w),
+ ),
),
flex: 1,
)
diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb
index 5cd89e23..eb55712d 100644
--- a/lib/l10n/intl_en.arb
+++ b/lib/l10n/intl_en.arb
@@ -743,6 +743,11 @@
"xiugai":"修改",
"bangdingshouji":"绑定手机",
"genggaibangdingshoujihao":"更改绑定手机号",
+ "qianbao":"钱包",
+ "huiyuanma":"会员码",
+ "yinzhang":"印章",
+ "dianpuchongzhi":"店铺充值",
+ "zhuxiaozhanghao":"注销账号",
diff --git a/lib/l10n/intl_en_US.arb b/lib/l10n/intl_en_US.arb
index bc843241..f049d607 100644
--- a/lib/l10n/intl_en_US.arb
+++ b/lib/l10n/intl_en_US.arb
@@ -744,6 +744,11 @@
"xiugai":"modify",
"bangdingshouji":"bind phone",
"genggaibangdingshoujihao":"modify bind phone",
+ "qianbao":"Wallet",
+ "huiyuanma":"vipCode",
+ "yinzhang":"Seal",
+ "dianpuchongzhi":"Recharge",
+ "zhuxiaozhanghao":"Account cancellation",
diff --git a/lib/l10n/intl_zh_CN.arb b/lib/l10n/intl_zh_CN.arb
index a106020b..bf3c8ef9 100644
--- a/lib/l10n/intl_zh_CN.arb
+++ b/lib/l10n/intl_zh_CN.arb
@@ -744,6 +744,11 @@
"xiugai":"修改",
"bangdingshouji":"绑定手机",
"genggaibangdingshoujihao":"更改绑定手机号",
+ "qianbao":"钱包",
+ "huiyuanma":"会员码",
+ "yinzhang":"印章",
+ "dianpuchongzhi":"店铺充值",
+ "zhuxiaozhanghao":"注销账号",
diff --git a/lib/l10n/intl_zh_Hans_CN.arb b/lib/l10n/intl_zh_Hans_CN.arb
index a5068c4a..557b7c95 100644
--- a/lib/l10n/intl_zh_Hans_CN.arb
+++ b/lib/l10n/intl_zh_Hans_CN.arb
@@ -744,6 +744,11 @@
"xiugai":"修改",
"bangdingshouji":"绑定手机",
"genggaibangdingshoujihao":"更改绑定手机号",
+ "qianbao":"钱包",
+ "huiyuanma":"会员码",
+ "yinzhang":"印章",
+ "dianpuchongzhi":"店铺充值",
+ "zhuxiaozhanghao":"注销账号",
diff --git a/lib/l10n/intl_zh_Hant_CN.arb b/lib/l10n/intl_zh_Hant_CN.arb
index 75d2921a..9565aa1d 100644
--- a/lib/l10n/intl_zh_Hant_CN.arb
+++ b/lib/l10n/intl_zh_Hant_CN.arb
@@ -735,6 +735,11 @@
"xiugai":"修改",
"bangdingshouji":"綁定手機",
"genggaibangdingshoujihao":"更改綁定手機號",
+ "qianbao":"錢包",
+ "huiyuanma":"會員碼",
+ "yinzhang":"印章",
+ "dianpuchongzhi":"店鋪充值",
+ "zhuxiaozhanghao":"註銷帳號",
diff --git a/lib/l10n/intl_zh_TW.arb b/lib/l10n/intl_zh_TW.arb
index 07916c48..cfefecc4 100644
--- a/lib/l10n/intl_zh_TW.arb
+++ b/lib/l10n/intl_zh_TW.arb
@@ -737,6 +737,11 @@
"xiugai":"修改",
"bangdingshouji":"綁定手機",
"genggaibangdingshoujihao":"更改綁定手機號",
+ "qianbao":"錢包",
+ "huiyuanma":"會員碼",
+ "yinzhang":"印章",
+ "dianpuchongzhi":"店鋪充值",
+ "zhuxiaozhanghao":"註銷帳號",
diff --git a/lib/login/captcha/block_puzzle_captcha.dart b/lib/login/captcha/block_puzzle_captcha.dart
new file mode 100644
index 00000000..9c4d6496
--- /dev/null
+++ b/lib/login/captcha/block_puzzle_captcha.dart
@@ -0,0 +1,552 @@
+import 'dart:convert';
+import 'dart:io';
+import 'dart:math';
+
+import 'package:dio/dio.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter_screenutil/flutter_screenutil.dart';
+
+import '../../retrofit/retrofit_api.dart';
+import '../../utils/captcha_util.dart';
+import '../../utils/widget_util.dart';
+import 'click_word_captcha.dart';
+
+typedef VoidSuccessCallback = dynamic Function(String v);
+
+class BlockPuzzleCaptchaPage extends StatefulWidget {
+ final VoidSuccessCallback onSuccess; //拖放完成后验证成功回调
+ final VoidCallback onFail; //拖放完成后验证失败回调
+
+ BlockPuzzleCaptchaPage({this.onSuccess, this.onFail});
+
+ @override
+ _BlockPuzzleCaptchaPageState createState() => _BlockPuzzleCaptchaPageState();
+}
+
+class _BlockPuzzleCaptchaPageState extends State
+ with TickerProviderStateMixin {
+// String baseImageBase64 =
+// "/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAARCADIAlgDASIAAhEBAxEB/8QAHAABAAMBAQEBAQAAAAAAAAAAAAUGBwQIAwIB/8QASBAAAQMDAQUEBQYLBQkAAAAAAAECAwQFEQYHEiExURMiQWEycYGRoQgUI0KCsRUkM1JicpLB0eHwNDVzorM3U2NkdZOy0vH/xAAaAQEA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brK/Fgx4Y2xVise6NgAHi0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAf//Z";
+ String baseImageBase64 = "";
+ String slideImageBase64 = "";
+ String captchaToken = "";
+ String secretKey = ""; //加密key
+
+ Size baseSize = Size.zero; //底部基类图片
+ Size slideSize = Size.zero; //滑块图片
+
+ var sliderColor = Colors.white; //滑块的背景色
+ var sliderIcon = Icons.arrow_forward; //滑块的图标
+ var movedXBorderColor = Colors.white; //滑块拖动时,左边已滑的区域边框颜色
+ double sliderStartX = 0; //滑块未拖前的X坐标
+ double sliderXMoved = 0;
+ bool sliderMoveFinish = false; //滑块拖动结束
+ bool checkResultAfterDrag = false; //拖动后的校验结果
+
+ //-------------动画------------
+ int _checkMilliseconds = 0; //滑动时间
+ bool _showTimeLine = false; //是否显示动画部件
+ bool _checkSuccess = false; //校验是否成功
+ AnimationController controller;
+
+ //高度动画
+ Animation offsetAnimation;
+
+ //底部部件key
+ GlobalKey _containerKey = new GlobalKey();
+
+ //背景图key
+ GlobalKey _baseImageKey = new GlobalKey();
+
+ //滑块
+ GlobalKey _slideImageKey = new GlobalKey();
+ double _bottomSliderSize = 60.h;
+
+ //------------动画------------
+
+ //校验通过
+ void checkSuccess(String content) {
+ setState(() {
+ checkResultAfterDrag = true;
+ _checkSuccess = true;
+ _showTimeLine = true;
+ });
+ _forwardAnimation();
+ updateSliderColorIcon();
+
+ //刷新验证码
+ Future.delayed(Duration(milliseconds: 1000)).then((v) {
+ _reverseAnimation().then((v) {
+ setState(() {
+ _showTimeLine = false;
+ });
+ //回调
+ if (widget.onSuccess != null) {
+ widget.onSuccess(content);
+ }
+ //关闭验证码
+ print(content);
+ Navigator.pop(context);
+ });
+ });
+ }
+
+ //校验失败
+ void checkFail() {
+ setState(() {
+ _showTimeLine = true;
+ _checkSuccess = false;
+ checkResultAfterDrag = false;
+ });
+ _forwardAnimation();
+ updateSliderColorIcon();
+
+ //刷新验证码
+ Future.delayed(Duration(milliseconds: 1000)).then((v) {
+ _reverseAnimation().then((v) {
+ setState(() {
+ _showTimeLine = false;
+ });
+ loadCaptcha();
+ //回调
+ if (widget.onFail != null) {
+ widget.onFail();
+ }
+ });
+ });
+ }
+
+ //重设滑动颜色与图标
+ void updateSliderColorIcon() {
+ var _sliderColor; //滑块的背景色
+ var _sliderIcon; //滑块的图标
+ var _movedXBorderColor; //滑块拖动时,左边已滑的区域边框颜色
+
+ //滑块的背景色
+ if (sliderMoveFinish) {
+ //拖动结束
+ _sliderColor = checkResultAfterDrag ? Colors.green : Colors.red;
+ _sliderIcon = checkResultAfterDrag ? Icons.check : Icons.close;
+ _movedXBorderColor = checkResultAfterDrag ? Colors.green : Colors.red;
+ } else {
+ //拖动未开始或正在拖动中
+ _sliderColor = sliderXMoved > 0 ? Color(0xff447ab2) : Colors.white;
+ _sliderIcon = Icons.arrow_forward;
+ _movedXBorderColor = Color(0xff447ab2);
+ }
+
+ sliderColor = _sliderColor;
+ sliderIcon = _sliderIcon;
+ movedXBorderColor = _movedXBorderColor;
+ setState(() {});
+ }
+
+ //加载验证码
+ void loadCaptcha() async {
+ setState(() {
+ _showTimeLine = false;
+ sliderMoveFinish = false;
+ checkResultAfterDrag = false;
+ sliderColor = Colors.white; //滑块的背景色
+ sliderIcon = Icons.arrow_forward; //滑块的图标
+ movedXBorderColor = Colors.white; //滑块拖动时,左边已滑的区域边框颜色
+ });
+ ApiService apiIpService = ApiService(Dio(), context: context);
+ ClickWordCaptchaModel baseData = await apiIpService
+ .captchaGet({"captchaType": "blockPuzzle"}).catchError((onError) {});
+ if (baseData == null) {
+ setState(() {
+ secretKey = "";
+ });
+ return;
+ }
+
+ sliderXMoved = 0;
+ sliderStartX = 0;
+ captchaToken = '';
+ checkResultAfterDrag = false;
+
+ baseImageBase64 = baseData.imgStr;
+ secretKey = baseData.secretKey;
+ baseImageBase64 = baseImageBase64.replaceAll('\n', '');
+ slideImageBase64 = baseData.jigsawImageBase64;
+ slideImageBase64 = slideImageBase64.replaceAll('\n', '');
+ captchaToken = baseData.token;
+
+ var baseR = await WidgetUtil.getImageWH(
+ image: Image.memory(Base64Decoder().convert(baseImageBase64)));
+ baseSize = baseR.size;
+
+ var silderR = await WidgetUtil.getImageWH(
+ image: Image.memory(Base64Decoder().convert(slideImageBase64)));
+ slideSize = silderR.size;
+
+ setState(() {});
+ }
+
+ //校验验证码
+ void checkCaptcha(sliderXMoved, captchaToken, {BuildContext myContext}) {
+ setState(() {
+ sliderMoveFinish = true;
+ });
+ //滑动结束,改变滑块的图标及颜色
+// updateSliderColorIcon();
+
+ //pointJson参数需要aes加密
+
+// MediaQueryData mediaQuery = MediaQuery.of(myContext);
+ var pointMap = {"x": sliderXMoved, "y": 5};
+ var pointStr = json.encode(pointMap);
+ var cryptedStr = pointStr;
+
+ // secretKey 不为空 进行as加密
+ if (!CaptchaUtil.isEmpty(secretKey)) {
+ cryptedStr = CaptchaUtil.aesEncode(key: secretKey, content: pointStr);
+ // var dcrypt = CaptchaUtil.aesDecode(key: secretKey, content: cryptedStr);
+ // json.decode(dcrypt);
+ }
+
+ ApiService apiIpService = ApiService(Dio(), context: context);
+ apiIpService
+ .captchaCheck({
+ "pointJson": cryptedStr,
+ "captchaType": "blockPuzzle",
+ "token": captchaToken
+ })
+ .catchError((onError) {})
+ .then((res) {
+ if (res) {
+ checkFail();
+ return;
+ }
+ //如果不加密 将 token 和 坐标序列化 通过 --- 链接成字符串
+ var captchaVerification = "$captchaToken---$pointStr";
+ if (!CaptchaUtil.isEmpty(secretKey)) {
+ //如果加密 将 token 和 坐标序列化 通过 --- 链接成字符串 进行加密 加密密钥为 _clickWordCaptchaModel.secretKey
+ captchaVerification = CaptchaUtil.aesEncode(
+ key: secretKey, content: captchaVerification);
+ }
+ checkSuccess(captchaVerification);
+ })
+ .catchError((error) {
+ loadCaptcha();
+ print(error);
+ });
+ }
+
+ @override
+ void initState() {
+ super.initState();
+ initAnimation();
+ loadCaptcha();
+ }
+
+ @override
+ void dispose() {
+ controller.dispose();
+ super.dispose();
+ }
+
+ // 初始化动画
+ void initAnimation() {
+ controller =
+ AnimationController(duration: Duration(milliseconds: 500), vsync: this);
+
+ offsetAnimation = Tween(begin: 0.5, end: 0)
+ .animate(CurvedAnimation(parent: controller, curve: Curves.ease))
+ ..addListener(() {
+ this.setState(() {});
+ });
+ }
+
+ // 反向执行动画
+ _reverseAnimation() async {
+ await controller.reverse();
+ }
+
+ // 正向执行动画
+ _forwardAnimation() async {
+ await controller.forward();
+ }
+
+ @override
+ void didUpdateWidget(BlockPuzzleCaptchaPage oldWidget) {
+ // TODO: implement didUpdateWidget
+ super.didUpdateWidget(oldWidget);
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return MaxScaleTextWidget(
+ child: buildContent(context),
+ );
+ }
+
+ Widget buildContent(BuildContext context) {
+ var mediaQuery = MediaQuery.of(context);
+ var dialogWidth = 0.9 * mediaQuery.size.width;
+ if (dialogWidth < 330) {
+ dialogWidth = mediaQuery.size.width;
+ }
+
+ return Scaffold(
+ backgroundColor: Colors.transparent,
+ body: Center(
+ child: Container(
+ key: _containerKey,
+ width: dialogWidth,
+ height: MediaQuery.of(context).size.height >= 750 ? 310.h:325.h,
+ color: Colors.white,
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.start,
+ crossAxisAlignment: CrossAxisAlignment.center,
+ children: [
+ _topContainer(),
+ _middleContainer(),
+ _bottomContainer(),
+ ],
+ ),
+ ),
+ ),
+ );
+ }
+
+ ///顶部,提示+关闭
+ _topContainer() {
+ return Container(
+ height: 50.h,
+ padding: EdgeInsets.fromLTRB(10.w, 0, 10.w, 0),
+ decoration: BoxDecoration(
+ border: Border(bottom: BorderSide(width: 1.w, color: Color(0xffe5e5e5))),
+ ),
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ Text(
+ '请完成安全验证',
+ style: TextStyle(fontSize: 18),
+ ),
+ IconButton(
+ icon: Icon(Icons.highlight_off),
+ iconSize: 30,
+ color: Colors.black38,
+ onPressed: () {
+ //退出
+ Navigator.pop(context);
+ }),
+ ],
+ ),
+ );
+ }
+
+ _middleContainer() {
+ ////显示验证码
+ return Container(
+ margin: EdgeInsets.symmetric(vertical: 10.h),
+ child: Stack(
+ children: [
+ ///底图 310*155
+ baseImageBase64.length > 0
+ ? Image.memory(
+ Base64Decoder().convert(baseImageBase64),
+ fit: BoxFit.fitWidth,
+ key: _baseImageKey,
+ gaplessPlayback: true,
+ )
+ : Container(
+ width: 310.w,
+ height: 155.h,
+ alignment: Alignment.center,
+ child: CircularProgressIndicator(),
+ ),
+
+ ///滑块图
+ (baseImageBase64.length > 0 && slideImageBase64.length > 0)
+ ? Container(
+ margin: EdgeInsets.fromLTRB(sliderXMoved, 0, 0, 0),
+ child: Image.memory(
+ Base64Decoder().convert(slideImageBase64),
+ fit: BoxFit.fitHeight,
+ key: _slideImageKey,
+ gaplessPlayback: true,
+ ),
+ )
+ : Container(),
+
+ //刷新按钮
+ Positioned(
+ top: 0,
+ right: 0,
+ child: IconButton(
+ icon: Icon(Icons.refresh),
+ iconSize: 30,
+ color: Colors.black54,
+ onPressed: () {
+ //刷新
+ loadCaptcha();
+ }),
+ ),
+ Positioned(
+ bottom: 0,
+ left: -10.w,
+ right: -10.w,
+ child: Offstage(
+ offstage: !_showTimeLine,
+ child: FractionalTranslation(
+ translation: Offset(0, offsetAnimation.value),
+ child: Container(
+ margin: EdgeInsets.only(left: 10.w, right: 10.w),
+ height: 40.h,
+ color: _checkSuccess
+ ? Color(0x7F66BB6A)
+ : Color.fromRGBO(200, 100, 100, 0.4),
+ alignment: Alignment.centerLeft,
+ child: Text(
+ _checkSuccess
+ ? "${(_checkMilliseconds / (60.0 * 12)).toStringAsFixed(2)}s验证成功"
+ : "验证失败",
+ style: TextStyle(color: Colors.white),
+ ),
+ ),
+ ),
+ )),
+ Positioned(
+ bottom: -20.h,
+ left: 0,
+ right: 0,
+ child: Offstage(
+ offstage: !_showTimeLine,
+ child: Container(
+ margin: EdgeInsets.only(left: 10.w, right: 10.w),
+ height: 20.h,
+ color: Colors.white,
+ ),
+ ))
+ ],
+ ),
+ );
+ }
+
+ ///底部,滑动区域
+ _bottomContainer() {
+ return baseSize.width > 0
+ ? Container(
+ height: 70.h,
+ width: baseSize.width,
+// color: Colors.cyanAccent,
+ child: Stack(
+ alignment: AlignmentDirectional.centerStart,
+ children: [
+ Container(
+ height: _bottomSliderSize,
+ decoration: BoxDecoration(
+ border: Border.all(
+ width: 1.w,
+ color: Color(0xffe5e5e5),
+ ),
+ color: Color(0xfff8f9fb),
+ ),
+ ),
+ Container(
+ alignment: Alignment.center,
+ child: Text(
+ '向右拖动滑块填充拼图',
+ style: TextStyle(fontSize: 14.sp),
+ ),
+ ),
+ Container(
+ width: sliderXMoved,
+ height: _bottomSliderSize - 2.h,
+ decoration: BoxDecoration(
+ border: Border.all(
+ width: sliderXMoved > 0 ? 1 : 0,
+ color: movedXBorderColor,
+ ),
+ color: Color(0xfff3fef1),
+ ),
+ ),
+ GestureDetector(
+ onPanStart: (startDetails) {
+ ///开始
+ _checkMilliseconds =
+ new DateTime.now().millisecondsSinceEpoch;
+ // print(startDetails.localPosition);
+ sliderStartX = startDetails.localPosition.dx;
+ },
+ onPanUpdate: (updateDetails) {
+ ///更新
+ // print(updateDetails.localPosition);
+ double _w1 = _baseImageKey.currentContext.size.width -
+ _slideImageKey.currentContext.size.width;
+ double offset =
+ updateDetails.localPosition.dx - sliderStartX;
+ if (offset < 0) {
+ offset = 0;
+ }
+ if (offset > _w1) {
+ offset = _w1;
+ }
+ // print("offset ------ $offset");
+ setState(() {
+ sliderXMoved = offset;
+ });
+ //滑动过程,改变滑块左边框颜色
+ updateSliderColorIcon();
+ },
+ onPanEnd: (endDetails) {
+ //结束
+ // print("endDetails");
+ checkCaptcha(sliderXMoved, captchaToken);
+ int _nowTime = new DateTime.now().millisecondsSinceEpoch;
+ _checkMilliseconds = _nowTime - _checkMilliseconds;
+ },
+ child: Container(
+ width: _bottomSliderSize,
+ height: _bottomSliderSize,
+ margin: EdgeInsets.only(
+ left: sliderXMoved > 0 ? sliderXMoved : 1),
+ decoration: BoxDecoration(
+ border: Border(
+ top: BorderSide(
+ width: 1.w,
+ color: Color(0xffe5e5e5),
+ ),
+ right: BorderSide(
+ width: 1.w,
+ color: Color(0xffe5e5e5),
+ ),
+ bottom: BorderSide(
+ width: 1.w,
+ color: Color(0xffe5e5e5),
+ ),
+ ),
+ color: sliderColor,
+ ),
+ child: IconButton(
+ icon: Icon(sliderIcon),
+ iconSize: 30,
+ color: Colors.black54,
+ onPressed: () {},
+ ),
+ ),
+ )
+ ],
+ ))
+ : Container();
+ }
+}
+
+class MaxScaleTextWidget extends StatelessWidget {
+ final double max;
+ final Widget child;
+
+ MaxScaleTextWidget({Key key, this.max = 1.0, this.child}) : super(key: key);
+
+ @override
+ Widget build(BuildContext context) {
+ var data = MediaQuery.of(context);
+ var textScaleFactor = min(max, data.textScaleFactor);
+ return MediaQuery(
+ data: data.copyWith(textScaleFactor: textScaleFactor), child: child);
+ }
+}
diff --git a/lib/login/captcha/click_word_captcha.dart b/lib/login/captcha/click_word_captcha.dart
new file mode 100644
index 00000000..1afba266
--- /dev/null
+++ b/lib/login/captcha/click_word_captcha.dart
@@ -0,0 +1,367 @@
+import 'dart:convert';
+
+import 'package:dio/dio.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter_screenutil/flutter_screenutil.dart';
+
+import '../../retrofit/retrofit_api.dart';
+import '../../utils/captcha_util.dart';
+import '../../utils/widget_util.dart';
+
+typedef VoidSuccessCallback = dynamic Function(String v);
+
+class ClickWordCaptcha extends StatefulWidget {
+ final VoidSuccessCallback onSuccess; //文字点击后验证成功回调
+ final VoidCallback onFail; //文字点击完成后验证失败回调
+
+ const ClickWordCaptcha({Key key, this.onSuccess, this.onFail})
+ : super(key: key);
+
+ @override
+ _ClickWordCaptchaState createState() => _ClickWordCaptchaState();
+}
+
+class _ClickWordCaptchaState extends State {
+ ClickWordCaptchaState _clickWordCaptchaState = ClickWordCaptchaState.none;
+ List _tapOffsetList = [];
+ ClickWordCaptchaModel _clickWordCaptchaModel = ClickWordCaptchaModel();
+
+ Color titleColor = Colors.black;
+ Color borderColor = Color(0xffdddddd);
+ String bottomTitle = "";
+ Size baseSize = Size(310.0, 155.0);
+
+ //改变底部样式及字段
+ _changeResultState() {
+ switch (_clickWordCaptchaState) {
+ case ClickWordCaptchaState.normal:
+ titleColor = Colors.black;
+ borderColor = Color(0xffdddddd);
+ break;
+ case ClickWordCaptchaState.success:
+ _tapOffsetList = [];
+ titleColor = Colors.green;
+ borderColor = Colors.green;
+ bottomTitle = "验证成功";
+ break;
+ case ClickWordCaptchaState.fail:
+ _tapOffsetList = [];
+ titleColor = Colors.red;
+ borderColor = Colors.red;
+ bottomTitle = "验证失败";
+ break;
+ default:
+ titleColor = Colors.black;
+ borderColor = Color(0xffdddddd);
+ bottomTitle = "数据加载中……";
+ break;
+ }
+ setState(() {});
+ }
+
+ @override
+ void initState() {
+ super.initState();
+ _loadCaptcha();
+ }
+
+ //加载验证码
+ _loadCaptcha() async {
+ _tapOffsetList = [];
+ _clickWordCaptchaState = ClickWordCaptchaState.none;
+ _changeResultState();
+ ApiService apiIpService = ApiService(Dio(), context: context);
+ ClickWordCaptchaModel baseData = await apiIpService.captchaGet({"captchaType": "clickWord"}).catchError((onError) {});
+ if (baseData == null) {
+ _clickWordCaptchaModel.secretKey = "";
+ bottomTitle = "加载失败,请刷新";
+ _clickWordCaptchaState = ClickWordCaptchaState.normal;
+ _changeResultState();
+ return;
+ }
+ else {
+ _clickWordCaptchaModel = baseData;
+ var baseR = await WidgetUtil.getImageWH(
+ image: Image.memory(
+ Base64Decoder().convert(_clickWordCaptchaModel.imgStr)));
+ baseSize = baseR.size;
+
+ bottomTitle = "请依次点击【${_clickWordCaptchaModel.wordStr}】";
+ }
+
+ _clickWordCaptchaState = ClickWordCaptchaState.normal;
+ _changeResultState();
+ }
+
+ //校验验证码
+ _checkCaptcha() async {
+ List