Browse Source

bug修改

dart3_last
fff 1 week ago
parent
commit
82631bbcd7
  1. 3
      lib/community/community_course.dart
  2. 15
      lib/community/community_view/course_banner.dart
  3. 16
      lib/login/new_login_page.dart
  4. 15
      lib/order/order_history_page.dart
  5. 4
      lib/retrofit/min_api.dart
  6. 18
      lib/retrofit/retrofit_api.dart
  7. 11
      lib/view_widget/login_tips_dialog.dart

3
lib/community/community_course.dart

@ -87,7 +87,6 @@ class _CommunityCourse extends State<CommunityCourse>
refreshController.refreshFailed();
// SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
}
SmartDialog.dismiss();
}
///
@ -101,7 +100,6 @@ class _CommunityCourse extends State<CommunityCourse>
});
queryClassList("");
}
SmartDialog.dismiss();
}
///
@ -153,7 +151,6 @@ class _CommunityCourse extends State<CommunityCourse>
});
});
}
SmartDialog.dismiss();
}
///

15
lib/community/community_view/course_banner.dart

@ -5,7 +5,9 @@ import 'package:flutter/material.dart';
import 'package:flutter_swiper_view/flutter_swiper_view.dart';
import 'package:huixiang/data/banner.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/shared_preference.dart';
import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/login_tips_dialog.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
class CourseBanner extends StatefulWidget {
@ -73,11 +75,17 @@ class _CourseBanner extends State<CourseBanner> {
/// contentType 0123,4:,5:,7
bannerClick(BannerData bannerData) async {
if (SharedInstance.instance.token.isEmpty) {
LoginTipsDialog.instance.show(context);
return;
}
switch (bannerData.contentType) {
case 1:
Navigator.of(context).pushNamed(
'/router/integral_store_page',
arguments: {"goodsId": bannerData.content},
arguments: {
"goodsId": bannerData.content,
},
);
break;
case 2:
@ -125,7 +133,10 @@ class _CourseBanner extends State<CourseBanner> {
}
String params = router!.substring(router.indexOf("?")+1);
Map map = jsonDecode(params);
Navigator.of(context).pushNamed(router.substring(0, router.indexOf("?")), arguments: map);
Navigator.of(context).pushNamed(
router.substring(0, router.indexOf("?")),
arguments: map,
);
break;
}
}

16
lib/login/new_login_page.dart

@ -155,7 +155,7 @@ class _NewLoginPage extends State<NewLoginPage> {
Color statusCodeLineColor = Color(0xFFE7E3E3);
countdown() {
if (_timer?.isActive ?? true) return;
if (_timer?.isActive ?? false) return;
int countdown = 60;
_timer = Timer.periodic(Duration(seconds: 1), (timer) {
countdown--;
@ -718,9 +718,11 @@ class _NewLoginPage extends State<NewLoginPage> {
},
child: Container(
width: double.infinity,
height: 57.h,
height: 57,
alignment: Alignment.center,
margin: EdgeInsets.only(top: 14.h, bottom: 12.h),
margin: EdgeInsets.only(
top: 14.h, bottom: 12.h,
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6),
color: Color(0xFF32A060),
@ -740,14 +742,14 @@ class _NewLoginPage extends State<NewLoginPage> {
// if (widget.arguments != null) {
// Navigator.of(context).pop();
// } else {
ExamineInstance.instance.isExamine = true;
ExamineInstance.instance.isExamine = false;
Navigator.of(context)
.popAndPushNamed('/router/main_page');
// }
},
child: Container(
width: double.infinity,
height: 57.h,
height: 57,
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6),
@ -780,7 +782,7 @@ class _NewLoginPage extends State<NewLoginPage> {
"assets/image/login_bott.webp",
fit: BoxFit.fill,
width: double.infinity,
height: 120.h,
height: 120,
),
)
],
@ -976,8 +978,6 @@ class _NewLoginPage extends State<NewLoginPage> {
"mobile": mobile,
"verification": v
}).catchError((onError) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(onError.type),
alignment: Alignment.center);
return BaseData()..isSuccess = false;
});
if (baseData?.isSuccess ?? false) {

15
lib/order/order_history_page.dart

@ -162,7 +162,6 @@ class _OrderHistoryList extends State<OrderHistoryList>
}
queryOrder({bool isLoading = true}) async {
try {
if (isLoading)
SmartDialog.showLoading(
msg: S.current.zhengzaijiazai,
@ -180,17 +179,16 @@ class _OrderHistoryList extends State<OrderHistoryList>
return BaseData<PageInfo<OrderInfo>>()..isSuccess = false;
});
if (baseData?.isSuccess ?? false) {
if (baseData!.data != null &&
(baseData.data!.records?.isNotEmpty ?? false)) {
if ((baseData?.data?.records?.isNotEmpty ?? false)) {
if (current == 1) {
orderInfos.clear();
}
orderInfos.addAll(baseData.data!.records!);
orderInfos.addAll(baseData!.data!.records!);
}
refreshController.refreshCompleted();
refreshController.loadComplete();
if (current * 10 > (int.tryParse("${baseData.data?.total}") ?? 0)) {
if (current * 10 > (int.tryParse("${baseData?.data?.total}") ?? 0)) {
refreshController.loadNoData();
} else {
current += 1;
@ -198,16 +196,9 @@ class _OrderHistoryList extends State<OrderHistoryList>
setState(() {});
networkStatus = 1;
} else {
if (baseData?.msg?.isNotEmpty ?? false)
SmartDialog.showToast(
"${baseData!.msg}",
alignment: Alignment.center,
);
refreshController.refreshFailed();
refreshController.loadFailed();
}
} finally {
}
}
minLogin(OrderInfo orderInfo) {

4
lib/retrofit/min_api.dart

@ -101,9 +101,7 @@ abstract class MinApiService {
Map map = response.data;
if (map["code"] == 40005 || map["code"] == 40001) {
if (!LoginTipsDialog().isShow) {
LoginTipsDialog().show(context);
}
LoginTipsDialog.instance.show(context);
}
debugPrint(
"======================= Min_响应数据结束 =======================\n");

18
lib/retrofit/retrofit_api.dart

@ -84,8 +84,7 @@ abstract class ApiService {
bool pay = true,
ParseErrorLogger? errorLogger,
}) {
Map<String, dynamic> headers =
(token == null || token == "") ? {} : {'token': "Bearer $token"};
Map<String, dynamic> headers = (token == null || token == "") ? {} : {'token': "Bearer $token"};
if (pay) {
headers["Environment"] = "app";
}
@ -107,8 +106,7 @@ abstract class ApiService {
RequestInterceptorHandler handler,
) {
try {
debugPrint(
"\n======================= 请求数据 =======================");
debugPrint("\n======================= 请求数据 =======================");
debugPrint("method = ${options.method.toString()}");
debugPrint("url = ${options.uri.toString()}");
debugPrint("headers = ${options.headers}");
@ -133,11 +131,8 @@ abstract class ApiService {
ResponseInterceptorHandler handler,
) {
try {
debugPrint(
"\n======================= 响应数据开始 =======================");
if (showLoading &&
SmartDialog.checkExist(
dialogTypes: {SmartAllDialogType.loading})) {
debugPrint("\n======================= 响应数据开始 =======================");
if (showLoading && SmartDialog.checkExist(dialogTypes: {SmartAllDialogType.loading})) {
SmartDialog.dismiss(status: SmartStatus.loading);
}
debugPrint("code = ${response.statusCode}");
@ -145,9 +140,8 @@ abstract class ApiService {
if (response.data is Map) {
Map map = response.data;
if (map["code"] == 40005 || map["code"] == 40001) {
if (context != null && !LoginTipsDialog().isShow) {
print("show: ${LoginTipsDialog().isShow}");
LoginTipsDialog().show(context);
if (context != null) {
LoginTipsDialog.instance.show(context);
}
}
debugPrint("======================= 响应数据结束 =======================\n");

11
lib/view_widget/login_tips_dialog.dart

@ -22,12 +22,14 @@ class LoginTipsDialog {
return _instance!;
}
bool isShow = false;
show(context) {
SmartDialog.dismiss();
isShow = true;
if (SmartDialog.checkExist(tag: "go-login")) {
return;
}
SmartDialog.show(
keepSingle: true,
tag: "go-login",
builder: (ctx) {
return LoginTips(
click: () {
@ -39,9 +41,6 @@ class LoginTipsDialog {
},
);
},
onDismiss: () {
isShow = false;
},
clickMaskDismiss: false,
);
}

Loading…
Cancel
Save