diff --git a/lib/address/edit_address_page.dart b/lib/address/edit_address_page.dart index ab40d4ee..fde97953 100644 --- a/lib/address/edit_address_page.dart +++ b/lib/address/edit_address_page.dart @@ -82,7 +82,7 @@ class _EditAddressPage extends State { bottomRight: Radius.circular(8), ), ), - child: Expanded(flex: 1,child: Column( + child:Column( children: [ editItem( S.of(context).xingming, @@ -114,7 +114,7 @@ class _EditAddressPage extends State { houseNumberController, false), ], - ),), + ), ), InkWell( diff --git a/lib/community/release_dynamic.dart b/lib/community/release_dynamic.dart index 1b3833a7..6360522b 100644 --- a/lib/community/release_dynamic.dart +++ b/lib/community/release_dynamic.dart @@ -446,6 +446,8 @@ class _ReleaseDynamic extends State { ); } + + ///动态输入框 Widget buildEdit() { return Container( diff --git a/lib/home/home_page.dart b/lib/home/home_page.dart index 52e69705..0c1e8ebe 100644 --- a/lib/home/home_page.dart +++ b/lib/home/home_page.dart @@ -16,6 +16,7 @@ import 'package:huixiang/home/home_view/sign_view.dart'; import 'package:huixiang/home/points_mall_view/points_goods_title.dart'; import 'package:huixiang/home/points_mall_view/points_goods_view.dart'; import 'package:huixiang/main.dart'; +import 'package:huixiang/retrofit/data/activity_pos.dart'; import 'package:huixiang/retrofit/data/article.dart'; import 'package:huixiang/retrofit/data/banner.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; @@ -30,6 +31,7 @@ import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/utils/event_type.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/activity_coupons.dart'; +import 'package:huixiang/view_widget/activity_poster.dart'; import 'package:huixiang/view_widget/classic_header.dart'; import 'package:huixiang/view_widget/invite_success_dialog.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; @@ -71,6 +73,7 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin { } }); queryMsgStats(); + queryActivity(); if ((widget.invite ?? "") != "" || widget.interviewCouponList != null && @@ -78,6 +81,8 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin { if (widget.firstLoginCouponList != null && widget.firstLoginCouponList.length > 0) showNew = true; + + } ///邀请成功弹窗 @@ -102,6 +107,22 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin { ); } + ///活动海报弹窗 + posterShowAlertDialog(ActivityPos activityPos) { + SharedPreferences.getInstance().then((value) { + if((value.getString("ActivityPosCode") ?? "").contains("${activityPos.code}_${value.getString("userId")};")) + return; + value.setString("ActivityPosCode", "${(value.getString("ActivityPosCode")??"")}${activityPos.code}_${value.getString("userId")};"); + //显示对话框 + showDialog( + context: context, + builder: (BuildContext context) { + return ActivityPoster(activityPos); + }, + ); + }); + } + final SwiperController controller = SwiperController(); String categoryId; @@ -273,6 +294,25 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin { EasyLoading.dismiss(); } + ///活动弹窗 + queryActivity() async { + if (apiService == null) { + SharedPreferences value = await SharedPreferences.getInstance(); + apiService = ApiService( + Dio(), + context: context, + token: value.getString("token"), + ); + } + BaseData baseData = + await apiService.appPopup().catchError((onError) { + }); + if (baseData != null && baseData.isSuccess) { + if(baseData.data?.enabled ?? true) + posterShowAlertDialog(baseData.data); + } + } + ///核销用户优惠券 queryWiped(memberCouponId) async { if (apiService == null) { diff --git a/lib/main.dart b/lib/main.dart index 351fc260..c51e7055 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -56,6 +56,7 @@ import 'package:huixiang/settlement/settlement.dart'; import 'package:huixiang/test_page.dart'; import 'package:huixiang/union/location_map_page.dart'; import 'package:huixiang/utils/ImgCachePath.dart'; +import 'package:huixiang/view_widget/activity_poster.dart'; import 'package:huixiang/web/web_page.dart'; import 'package:huixiang/union/union_details_page.dart'; diff --git a/lib/retrofit/data/activity_pos.dart b/lib/retrofit/data/activity_pos.dart new file mode 100644 index 00000000..2578591b --- /dev/null +++ b/lib/retrofit/data/activity_pos.dart @@ -0,0 +1,50 @@ +/// enabled : true +/// code : "1111" +/// showImage : "https://pos.upload.gznl.top/0000/2022/03/4ca95160-aa19-46e5-ad07-8a16ca11c697.jpg" +/// jumpType : 1 +/// jumpUrl : "1417675188681572352" + +class ActivityPos { + ActivityPos({ + bool enabled, + String code, + String showImage, + int jumpType, + String jumpUrl,}){ + _enabled = enabled; + _code = code; + _showImage = showImage; + _jumpType = jumpType; + _jumpUrl = jumpUrl; +} + + ActivityPos.fromJson(dynamic json) { + _enabled = json['enabled']; + _code = json['code']; + _showImage = json['showImage']; + _jumpType = json['jumpType']; + _jumpUrl = json['jumpUrl']; + } + bool _enabled; + String _code; + String _showImage; + int _jumpType; + String _jumpUrl; + + bool get enabled => _enabled; + String get code => _code; + String get showImage => _showImage; + int get jumpType => _jumpType; + String get jumpUrl => _jumpUrl; + + Map toJson() { + final map = {}; + map['enabled'] = _enabled; + map['code'] = _code; + map['showImage'] = _showImage; + map['jumpType'] = _jumpType; + map['jumpUrl'] = _jumpUrl; + return map; + } + +} \ No newline at end of file diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index 287592f9..bf919926 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/lib/retrofit/retrofit_api.dart @@ -19,6 +19,7 @@ import 'package:huixiang/view_widget/login_tips_dialog.dart'; import 'package:retrofit/retrofit.dart'; import 'data/achievement_detail_list.dart'; +import 'data/activity_pos.dart'; import 'data/address.dart'; import 'data/banner.dart'; import 'data/brand_data.dart'; @@ -53,7 +54,6 @@ import 'data/vip_badges_list.dart'; import 'data/vip_benefit_list.dart'; import 'data/vip_card.dart'; import 'data/vip_rule_details.dart'; -import 'data/wx_pay.dart'; part 'retrofit_api.g.dart'; @@ -504,4 +504,8 @@ abstract class ApiService { @GET("/member/detail/{id}") Future> memberDetail(@Path("id") String id); + ///活动弹窗 + @GET("/home/appPopup") + Future> appPopup(); + } diff --git a/lib/retrofit/retrofit_api.g.dart b/lib/retrofit/retrofit_api.g.dart index 205b7a37..7b2bc2e6 100644 --- a/lib/retrofit/retrofit_api.g.dart +++ b/lib/retrofit/retrofit_api.g.dart @@ -1872,4 +1872,26 @@ class _ApiService implements ApiService { ); return value; } + + + @override + Future> appPopup() async { + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>( + '/home/appPopup', + queryParameters: queryParameters, + options: RequestOptions( + method: 'GET', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => ActivityPos.fromJson(json), + ); + return value; + } } diff --git a/lib/view_widget/activity_poster.dart b/lib/view_widget/activity_poster.dart new file mode 100644 index 00000000..c4baf746 --- /dev/null +++ b/lib/view_widget/activity_poster.dart @@ -0,0 +1,113 @@ + + +import 'dart:convert'; + +import 'package:flutter/material.dart'; +import 'package:huixiang/retrofit/data/activity_pos.dart'; + +import 'custom_image.dart'; + +class ActivityPoster extends StatefulWidget { + final ActivityPos activityPos; + + ActivityPoster(this.activityPos); + + @override + State createState() { + return _ActivityPoster(); + } +} + +class _ActivityPoster extends State { + @override + Widget build(BuildContext context) { + return Container( + width: double.infinity, + height: 289, + alignment: Alignment.center, + margin: EdgeInsets.only( + left:37, + right:37, + ), + child: Stack( + children: [ + GestureDetector( + onTap: (){ + jumpClick(widget.activityPos); + }, + child: + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + ), + child:MImage( + widget?.activityPos?.showImage ?? "", + width: double.infinity, + height: MediaQuery.of(context).size.height / 2, + fit: BoxFit.cover, + radius: BorderRadius.all(Radius.circular(12)), + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", + ),), + ), + Container( + padding: EdgeInsets.only(top: 8,right: 8,bottom:8), + child:GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: (){ + Navigator.of(context).pop(); + }, + child: Row(children: [ + Spacer(), + Image.asset( + "assets/image/cancel.png", + width: 24, + height: 24, + color: Colors.white, + ) + ],) + ) ) + ], + ), + ); + } + + /// contentType 跳转类型(0:不跳转,1:积分商品,2:活动,3:文章,4:页面跳转,5:课程) + jumpClick(ActivityPos activityPos) async { + switch (activityPos.jumpType) { + case 1: + Navigator.of(context).pushNamed('/router/integral_store_page', + arguments: {"goodsId": widget.activityPos.jumpUrl}); + break; + case 2: + Navigator.of(context) + .pushNamed('/router/web_page', arguments: { + "activityId": widget.activityPos.jumpUrl, + }); + break; + case 3: + Navigator.of(context) + .pushNamed('/router/web_page', arguments: { + "articleId": widget.activityPos.jumpUrl, + }); + break; + case 4: + String router = widget.activityPos.jumpUrl; + if (router.contains("?")) { + String params = router.substring(router.indexOf("?")); + params = params.replaceAll("?", ""); + Map map = jsonDecode(params); + Navigator.of(context).pushNamed(router, arguments: map); + } else { + Navigator.of(context).pushNamed(router); + } + break; + case 5: + Navigator.of(context) + .pushNamed('/router/class_details', arguments: { + "id": widget.activityPos.jumpUrl, + }); + break; + } + } +} diff --git a/lib/view_widget/mine_vip_view.dart b/lib/view_widget/mine_vip_view.dart index 6766255e..7cc2e01b 100644 --- a/lib/view_widget/mine_vip_view.dart +++ b/lib/view_widget/mine_vip_view.dart @@ -183,7 +183,7 @@ class MineVipView extends StatelessWidget { style: TextStyle( color: textColor, fontWeight: MyFontWeight.semi_bold, - fontSize: 23.sp, + fontSize:22.sp, ), ), ), @@ -228,7 +228,7 @@ class MineVipView extends StatelessWidget { style: TextStyle( color: textColor, fontWeight: MyFontWeight.regular, - fontSize: 14.sp, + fontSize: 12.sp, ), ), flex: 1, @@ -239,7 +239,7 @@ class MineVipView extends StatelessWidget { TextSpan( text: !(showRank??true)?(vipLevel == 3?"":rankMax.toString()):((vipLevel < curLevel)?rankMax.toString():rank.toString()), style: TextStyle( - fontSize: 26.sp, + fontSize: 20.sp, fontWeight: MyFontWeight.semi_bold, color: textColor, ), @@ -257,7 +257,7 @@ class MineVipView extends StatelessWidget { TextSpan( text: rankMax > 0 ? "/$rankMax" : "/0", style: TextStyle( - fontSize: 14.sp, + fontSize: 12.sp, fontWeight: MyFontWeight.regular, color: textColor, ), diff --git a/pubspec.lock b/pubspec.lock index 23dc9aa5..b3474fc4 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -70,7 +70,7 @@ packages: name: chewie url: "https://pub.flutter-io.cn" source: hosted - version: "1.2.2" + version: "1.1.0" chewie_audio: dependency: "direct main" description: @@ -134,20 +134,6 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "2.0.0" - extended_image: - dependency: transitive - description: - name: extended_image - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.6.0" - extended_image_library: - dependency: transitive - description: - name: extended_image_library - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.3.1" fake_async: dependency: transitive description: @@ -229,7 +215,7 @@ packages: name: flutter_html url: "https://pub.flutter-io.cn" source: hosted - version: "2.1.5" + version: "2.2.1" flutter_layout_grid: dependency: transitive description: @@ -248,7 +234,7 @@ packages: name: flutter_math_fork url: "https://pub.flutter-io.cn" source: hosted - version: "0.3.3+1" + version: "0.4.2+2" flutter_page_indicator: dependency: transitive description: @@ -350,20 +336,6 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "0.15.0" - http: - dependency: transitive - description: - name: http - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.12.2" - http_client_helper: - dependency: transitive - description: - name: http_client_helper - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.2.1" http_parser: dependency: transitive description: @@ -511,13 +483,6 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "2.0.5" - pedantic: - dependency: transitive - description: - name: pedantic - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.11.1" permission_handler: dependency: "direct main" description: @@ -539,13 +504,6 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "4.1.0" - photo_manager: - dependency: transitive - description: - name: photo_manager - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.3.10" photo_view: dependency: "direct main" description: @@ -580,7 +538,7 @@ packages: name: provider url: "https://pub.flutter-io.cn" source: hosted - version: "5.0.0" + version: "6.0.2" pull_to_refresh: dependency: "direct main" description: @@ -889,13 +847,6 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "2.0.13" - wechat_assets_picker: - dependency: "direct main" - description: - name: wechat_assets_picker - url: "https://pub.flutter-io.cn" - source: hosted - version: "5.0.0-nullsafety.5" win32: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 49d60b47..6f6affec 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -60,8 +60,6 @@ dependencies: #多图, 裁剪 image_pickers: ^2.0.0 - wechat_assets_picker: any - # flutter_scankit: ^1.2.0 # qrscan: ^0.3.1 scan: ^1.5.0