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(); refreshController.refreshFailed();
// SmartDialog.showToast(baseData.msg, alignment: Alignment.center); // SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
} }
SmartDialog.dismiss();
} }
/// ///
@ -101,7 +100,6 @@ class _CommunityCourse extends State<CommunityCourse>
}); });
queryClassList(""); 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:flutter_swiper_view/flutter_swiper_view.dart';
import 'package:huixiang/data/banner.dart'; import 'package:huixiang/data/banner.dart';
import 'package:huixiang/retrofit/retrofit_api.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/custom_image.dart';
import 'package:huixiang/view_widget/login_tips_dialog.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart';
class CourseBanner extends StatefulWidget { class CourseBanner extends StatefulWidget {
@ -73,11 +75,17 @@ class _CourseBanner extends State<CourseBanner> {
/// contentType 0123,4:,5:,7 /// contentType 0123,4:,5:,7
bannerClick(BannerData bannerData) async { bannerClick(BannerData bannerData) async {
if (SharedInstance.instance.token.isEmpty) {
LoginTipsDialog.instance.show(context);
return;
}
switch (bannerData.contentType) { switch (bannerData.contentType) {
case 1: case 1:
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(
'/router/integral_store_page', '/router/integral_store_page',
arguments: {"goodsId": bannerData.content}, arguments: {
"goodsId": bannerData.content,
},
); );
break; break;
case 2: case 2:
@ -125,7 +133,10 @@ class _CourseBanner extends State<CourseBanner> {
} }
String params = router!.substring(router.indexOf("?")+1); String params = router!.substring(router.indexOf("?")+1);
Map map = jsonDecode(params); 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; break;
} }
} }

16
lib/login/new_login_page.dart

@ -155,7 +155,7 @@ class _NewLoginPage extends State<NewLoginPage> {
Color statusCodeLineColor = Color(0xFFE7E3E3); Color statusCodeLineColor = Color(0xFFE7E3E3);
countdown() { countdown() {
if (_timer?.isActive ?? true) return; if (_timer?.isActive ?? false) return;
int countdown = 60; int countdown = 60;
_timer = Timer.periodic(Duration(seconds: 1), (timer) { _timer = Timer.periodic(Duration(seconds: 1), (timer) {
countdown--; countdown--;
@ -718,9 +718,11 @@ class _NewLoginPage extends State<NewLoginPage> {
}, },
child: Container( child: Container(
width: double.infinity, width: double.infinity,
height: 57.h, height: 57,
alignment: Alignment.center, alignment: Alignment.center,
margin: EdgeInsets.only(top: 14.h, bottom: 12.h), margin: EdgeInsets.only(
top: 14.h, bottom: 12.h,
),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6), borderRadius: BorderRadius.circular(6),
color: Color(0xFF32A060), color: Color(0xFF32A060),
@ -740,14 +742,14 @@ class _NewLoginPage extends State<NewLoginPage> {
// if (widget.arguments != null) { // if (widget.arguments != null) {
// Navigator.of(context).pop(); // Navigator.of(context).pop();
// } else { // } else {
ExamineInstance.instance.isExamine = true; ExamineInstance.instance.isExamine = false;
Navigator.of(context) Navigator.of(context)
.popAndPushNamed('/router/main_page'); .popAndPushNamed('/router/main_page');
// } // }
}, },
child: Container( child: Container(
width: double.infinity, width: double.infinity,
height: 57.h, height: 57,
alignment: Alignment.center, alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6), borderRadius: BorderRadius.circular(6),
@ -780,7 +782,7 @@ class _NewLoginPage extends State<NewLoginPage> {
"assets/image/login_bott.webp", "assets/image/login_bott.webp",
fit: BoxFit.fill, fit: BoxFit.fill,
width: double.infinity, width: double.infinity,
height: 120.h, height: 120,
), ),
) )
], ],
@ -976,8 +978,6 @@ class _NewLoginPage extends State<NewLoginPage> {
"mobile": mobile, "mobile": mobile,
"verification": v "verification": v
}).catchError((onError) { }).catchError((onError) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(onError.type),
alignment: Alignment.center);
return BaseData()..isSuccess = false; return BaseData()..isSuccess = false;
}); });
if (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 { queryOrder({bool isLoading = true}) async {
try {
if (isLoading) if (isLoading)
SmartDialog.showLoading( SmartDialog.showLoading(
msg: S.current.zhengzaijiazai, msg: S.current.zhengzaijiazai,
@ -180,17 +179,16 @@ class _OrderHistoryList extends State<OrderHistoryList>
return BaseData<PageInfo<OrderInfo>>()..isSuccess = false; return BaseData<PageInfo<OrderInfo>>()..isSuccess = false;
}); });
if (baseData?.isSuccess ?? false) { if (baseData?.isSuccess ?? false) {
if (baseData!.data != null && if ((baseData?.data?.records?.isNotEmpty ?? false)) {
(baseData.data!.records?.isNotEmpty ?? false)) {
if (current == 1) { if (current == 1) {
orderInfos.clear(); orderInfos.clear();
} }
orderInfos.addAll(baseData.data!.records!); orderInfos.addAll(baseData!.data!.records!);
} }
refreshController.refreshCompleted(); refreshController.refreshCompleted();
refreshController.loadComplete(); refreshController.loadComplete();
if (current * 10 > (int.tryParse("${baseData.data?.total}") ?? 0)) { if (current * 10 > (int.tryParse("${baseData?.data?.total}") ?? 0)) {
refreshController.loadNoData(); refreshController.loadNoData();
} else { } else {
current += 1; current += 1;
@ -198,16 +196,9 @@ class _OrderHistoryList extends State<OrderHistoryList>
setState(() {}); setState(() {});
networkStatus = 1; networkStatus = 1;
} else { } else {
if (baseData?.msg?.isNotEmpty ?? false)
SmartDialog.showToast(
"${baseData!.msg}",
alignment: Alignment.center,
);
refreshController.refreshFailed(); refreshController.refreshFailed();
refreshController.loadFailed(); refreshController.loadFailed();
} }
} finally {
}
} }
minLogin(OrderInfo orderInfo) { minLogin(OrderInfo orderInfo) {

4
lib/retrofit/min_api.dart

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

18
lib/retrofit/retrofit_api.dart

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

11
lib/view_widget/login_tips_dialog.dart

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

Loading…
Cancel
Save