Browse Source

活动弹窗更改

remove_uniapp
w-R 3 years ago
parent
commit
e6a11a6bb0
  1. 4
      lib/address/edit_address_page.dart
  2. 2
      lib/community/release_dynamic.dart
  3. 40
      lib/home/home_page.dart
  4. 1
      lib/main.dart
  5. 50
      lib/retrofit/data/activity_pos.dart
  6. 6
      lib/retrofit/retrofit_api.dart
  7. 22
      lib/retrofit/retrofit_api.g.dart
  8. 113
      lib/view_widget/activity_poster.dart
  9. 8
      lib/view_widget/mine_vip_view.dart
  10. 57
      pubspec.lock
  11. 2
      pubspec.yaml

4
lib/address/edit_address_page.dart

@ -82,7 +82,7 @@ class _EditAddressPage extends State<EditAddressPage> {
bottomRight: Radius.circular(8), bottomRight: Radius.circular(8),
), ),
), ),
child: Expanded(flex: 1,child: Column( child:Column(
children: [ children: [
editItem( editItem(
S.of(context).xingming, S.of(context).xingming,
@ -114,7 +114,7 @@ class _EditAddressPage extends State<EditAddressPage> {
houseNumberController, houseNumberController,
false), false),
], ],
),), ),
), ),
InkWell( InkWell(

2
lib/community/release_dynamic.dart

@ -446,6 +446,8 @@ class _ReleaseDynamic extends State<ReleaseDynamic> {
); );
} }
/// ///
Widget buildEdit() { Widget buildEdit() {
return Container( return Container(

40
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_title.dart';
import 'package:huixiang/home/points_mall_view/points_goods_view.dart'; import 'package:huixiang/home/points_mall_view/points_goods_view.dart';
import 'package:huixiang/main.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/article.dart';
import 'package:huixiang/retrofit/data/banner.dart'; import 'package:huixiang/retrofit/data/banner.dart';
import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/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/event_type.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/activity_coupons.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/classic_header.dart';
import 'package:huixiang/view_widget/invite_success_dialog.dart'; import 'package:huixiang/view_widget/invite_success_dialog.dart';
import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/my_appbar.dart';
@ -71,6 +73,7 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
} }
}); });
queryMsgStats(); queryMsgStats();
queryActivity();
if ((widget.invite ?? "") != "" || if ((widget.invite ?? "") != "" ||
widget.interviewCouponList != null && widget.interviewCouponList != null &&
@ -78,6 +81,8 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
if (widget.firstLoginCouponList != null && widget.firstLoginCouponList.length > 0) if (widget.firstLoginCouponList != null && widget.firstLoginCouponList.length > 0)
showNew = true; showNew = true;
} }
/// ///
@ -102,6 +107,22 @@ class HomePageState extends State<HomePage> 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(); final SwiperController controller = SwiperController();
String categoryId; String categoryId;
@ -273,6 +294,25 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
EasyLoading.dismiss(); EasyLoading.dismiss();
} }
///
queryActivity() async {
if (apiService == null) {
SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(
Dio(),
context: context,
token: value.getString("token"),
);
}
BaseData<ActivityPos> baseData =
await apiService.appPopup().catchError((onError) {
});
if (baseData != null && baseData.isSuccess) {
if(baseData.data?.enabled ?? true)
posterShowAlertDialog(baseData.data);
}
}
/// ///
queryWiped(memberCouponId) async { queryWiped(memberCouponId) async {
if (apiService == null) { if (apiService == null) {

1
lib/main.dart

@ -56,6 +56,7 @@ import 'package:huixiang/settlement/settlement.dart';
import 'package:huixiang/test_page.dart'; import 'package:huixiang/test_page.dart';
import 'package:huixiang/union/location_map_page.dart'; import 'package:huixiang/union/location_map_page.dart';
import 'package:huixiang/utils/ImgCachePath.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/web/web_page.dart';
import 'package:huixiang/union/union_details_page.dart'; import 'package:huixiang/union/union_details_page.dart';

50
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<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['enabled'] = _enabled;
map['code'] = _code;
map['showImage'] = _showImage;
map['jumpType'] = _jumpType;
map['jumpUrl'] = _jumpUrl;
return map;
}
}

6
lib/retrofit/retrofit_api.dart

@ -19,6 +19,7 @@ import 'package:huixiang/view_widget/login_tips_dialog.dart';
import 'package:retrofit/retrofit.dart'; import 'package:retrofit/retrofit.dart';
import 'data/achievement_detail_list.dart'; import 'data/achievement_detail_list.dart';
import 'data/activity_pos.dart';
import 'data/address.dart'; import 'data/address.dart';
import 'data/banner.dart'; import 'data/banner.dart';
import 'data/brand_data.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_benefit_list.dart';
import 'data/vip_card.dart'; import 'data/vip_card.dart';
import 'data/vip_rule_details.dart'; import 'data/vip_rule_details.dart';
import 'data/wx_pay.dart';
part 'retrofit_api.g.dart'; part 'retrofit_api.g.dart';
@ -504,4 +504,8 @@ abstract class ApiService {
@GET("/member/detail/{id}") @GET("/member/detail/{id}")
Future<BaseData<MemberInfor>> memberDetail(@Path("id") String id); Future<BaseData<MemberInfor>> memberDetail(@Path("id") String id);
///
@GET("/home/appPopup")
Future<BaseData<ActivityPos>> appPopup();
} }

22
lib/retrofit/retrofit_api.g.dart

@ -1872,4 +1872,26 @@ class _ApiService implements ApiService {
); );
return value; return value;
} }
@override
Future<BaseData<ActivityPos>> appPopup() async {
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
final _result = await _dio.request<Map<String, dynamic>>(
'/home/appPopup',
queryParameters: queryParameters,
options: RequestOptions(
method: 'GET',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData<ActivityPos>.fromJson(
_result.data,
(json) => ActivityPos.fromJson(json),
);
return value;
}
} }

113
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<StatefulWidget> createState() {
return _ActivityPoster();
}
}
class _ActivityPoster extends State<ActivityPoster> {
@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 0123,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;
}
}
}

8
lib/view_widget/mine_vip_view.dart

@ -183,7 +183,7 @@ class MineVipView extends StatelessWidget {
style: TextStyle( style: TextStyle(
color: textColor, color: textColor,
fontWeight: MyFontWeight.semi_bold, fontWeight: MyFontWeight.semi_bold,
fontSize: 23.sp, fontSize:22.sp,
), ),
), ),
), ),
@ -228,7 +228,7 @@ class MineVipView extends StatelessWidget {
style: TextStyle( style: TextStyle(
color: textColor, color: textColor,
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
fontSize: 14.sp, fontSize: 12.sp,
), ),
), ),
flex: 1, flex: 1,
@ -239,7 +239,7 @@ class MineVipView extends StatelessWidget {
TextSpan( TextSpan(
text: !(showRank??true)?(vipLevel == 3?"":rankMax.toString()):((vipLevel < curLevel)?rankMax.toString():rank.toString()), text: !(showRank??true)?(vipLevel == 3?"":rankMax.toString()):((vipLevel < curLevel)?rankMax.toString():rank.toString()),
style: TextStyle( style: TextStyle(
fontSize: 26.sp, fontSize: 20.sp,
fontWeight: MyFontWeight.semi_bold, fontWeight: MyFontWeight.semi_bold,
color: textColor, color: textColor,
), ),
@ -257,7 +257,7 @@ class MineVipView extends StatelessWidget {
TextSpan( TextSpan(
text: rankMax > 0 ? "/$rankMax" : "/0", text: rankMax > 0 ? "/$rankMax" : "/0",
style: TextStyle( style: TextStyle(
fontSize: 14.sp, fontSize: 12.sp,
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
color: textColor, color: textColor,
), ),

57
pubspec.lock

@ -70,7 +70,7 @@ packages:
name: chewie name: chewie
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.2.2" version: "1.1.0"
chewie_audio: chewie_audio:
dependency: "direct main" dependency: "direct main"
description: description:
@ -134,20 +134,6 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.0" 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: fake_async:
dependency: transitive dependency: transitive
description: description:
@ -229,7 +215,7 @@ packages:
name: flutter_html name: flutter_html
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.5" version: "2.2.1"
flutter_layout_grid: flutter_layout_grid:
dependency: transitive dependency: transitive
description: description:
@ -248,7 +234,7 @@ packages:
name: flutter_math_fork name: flutter_math_fork
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.3.3+1" version: "0.4.2+2"
flutter_page_indicator: flutter_page_indicator:
dependency: transitive dependency: transitive
description: description:
@ -350,20 +336,6 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.15.0" 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: http_parser:
dependency: transitive dependency: transitive
description: description:
@ -511,13 +483,6 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.5" version: "2.0.5"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.11.1"
permission_handler: permission_handler:
dependency: "direct main" dependency: "direct main"
description: description:
@ -539,13 +504,6 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "4.1.0" 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: photo_view:
dependency: "direct main" dependency: "direct main"
description: description:
@ -580,7 +538,7 @@ packages:
name: provider name: provider
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "5.0.0" version: "6.0.2"
pull_to_refresh: pull_to_refresh:
dependency: "direct main" dependency: "direct main"
description: description:
@ -889,13 +847,6 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.13" 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: win32:
dependency: transitive dependency: transitive
description: description:

2
pubspec.yaml

@ -60,8 +60,6 @@ dependencies:
#多图, 裁剪 #多图, 裁剪
image_pickers: ^2.0.0 image_pickers: ^2.0.0
wechat_assets_picker: any
# flutter_scankit: ^1.2.0 # flutter_scankit: ^1.2.0
# qrscan: ^0.3.1 # qrscan: ^0.3.1
scan: ^1.5.0 scan: ^1.5.0

Loading…
Cancel
Save