fix:修复无网络下点击开锁会报错
This commit is contained in:
parent
26792c6c7f
commit
dafb40954a
@ -45,7 +45,7 @@ class _StarLockMainXHJPageState extends State<StarLockMainXHJPage>
|
|||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
body: Stack(
|
body: Stack(
|
||||||
children: [
|
children: <Widget>[
|
||||||
pageView(
|
pageView(
|
||||||
widget: StarLockMainPage(
|
widget: StarLockMainPage(
|
||||||
showAppBar: false,
|
showAppBar: false,
|
||||||
@ -102,7 +102,7 @@ class _StarLockMainXHJPageState extends State<StarLockMainXHJPage>
|
|||||||
child: SafeArea(
|
child: SafeArea(
|
||||||
top: false,
|
top: false,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: <Widget>[
|
||||||
navigationBarItem(Icons.key,
|
navigationBarItem(Icons.key,
|
||||||
TranslationLoader.lanKeys!.device!.tr, logic, 0, () {
|
TranslationLoader.lanKeys!.device!.tr, logic, 0, () {
|
||||||
logic.setIndex(0);
|
logic.setIndex(0);
|
||||||
@ -142,8 +142,8 @@ class _StarLockMainXHJPageState extends State<StarLockMainXHJPage>
|
|||||||
|
|
||||||
//底部按钮
|
//底部按钮
|
||||||
Widget navigationBarItem(IconData icon, String text, LockMainXHJLogic logic,
|
Widget navigationBarItem(IconData icon, String text, LockMainXHJLogic logic,
|
||||||
int index, var onTop) {
|
int index, GestureTapCallback? onTop) {
|
||||||
bool check = logic.state.index == index;
|
final bool check = logic.state.index == index;
|
||||||
return Expanded(
|
return Expanded(
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: onTop,
|
onTap: onTop,
|
||||||
@ -151,7 +151,7 @@ class _StarLockMainXHJPageState extends State<StarLockMainXHJPage>
|
|||||||
color: Colors.transparent,
|
color: Colors.transparent,
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.only(bottom: 8.h),
|
padding: EdgeInsets.only(bottom: 8.h),
|
||||||
child: Icon(
|
child: Icon(
|
||||||
|
|||||||
@ -11,7 +11,7 @@ class ApiProvider extends BaseProvider {
|
|||||||
jsonEncode({
|
jsonEncode({
|
||||||
'countryCode': countryCode,
|
'countryCode': countryCode,
|
||||||
'account': account,
|
'account': account,
|
||||||
"channel": channel,
|
'channel': channel,
|
||||||
'codeType': codeType,
|
'codeType': codeType,
|
||||||
'xWidth': xWidth,
|
'xWidth': xWidth,
|
||||||
}));
|
}));
|
||||||
@ -28,10 +28,10 @@ class ApiProvider extends BaseProvider {
|
|||||||
jsonEncode({
|
jsonEncode({
|
||||||
'receiverType': receiverType,
|
'receiverType': receiverType,
|
||||||
'countryCode': countryCode,
|
'countryCode': countryCode,
|
||||||
"account": account,
|
'account': account,
|
||||||
'password': password,
|
'password': password,
|
||||||
'verificationCode': verificationCode,
|
'verificationCode': verificationCode,
|
||||||
'platId': "2",
|
'platId': '2',
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// post(
|
// post(
|
||||||
@ -71,10 +71,10 @@ class ApiProvider extends BaseProvider {
|
|||||||
jsonEncode({
|
jsonEncode({
|
||||||
'loginType': loginType,
|
'loginType': loginType,
|
||||||
'password': password,
|
'password': password,
|
||||||
"platId": "2",
|
'platId': '2',
|
||||||
'uniqueid': "477E6814-289D-402A-9F49-F89A8BD05D63",
|
'uniqueid': '477E6814-289D-402A-9F49-F89A8BD05D63',
|
||||||
'countryCode': countryCode,
|
'countryCode': countryCode,
|
||||||
"username": username
|
'username': username
|
||||||
}));
|
}));
|
||||||
|
|
||||||
Future<Response> resetPassword(
|
Future<Response> resetPassword(
|
||||||
@ -89,9 +89,9 @@ class ApiProvider extends BaseProvider {
|
|||||||
jsonEncode({
|
jsonEncode({
|
||||||
'countryCode': countryCode,
|
'countryCode': countryCode,
|
||||||
'account': account,
|
'account': account,
|
||||||
"date": date,
|
'date': date,
|
||||||
'newPassword': newPassword,
|
'newPassword': newPassword,
|
||||||
"uniqueid": uniqueid,
|
'uniqueid': uniqueid,
|
||||||
'verificationCode': verificationCode,
|
'verificationCode': verificationCode,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ class ApiProvider extends BaseProvider {
|
|||||||
jsonEncode({
|
jsonEncode({
|
||||||
'endDate': endDate,
|
'endDate': endDate,
|
||||||
'keyId': keyId,
|
'keyId': keyId,
|
||||||
"keyStatus": keyStatus,
|
'keyStatus': keyStatus,
|
||||||
'lockId': lockId,
|
'lockId': lockId,
|
||||||
'pageNo': pageNo,
|
'pageNo': pageNo,
|
||||||
'pageSize': pageSize,
|
'pageSize': pageSize,
|
||||||
@ -178,13 +178,15 @@ class ApiProvider extends BaseProvider {
|
|||||||
bool isUnShowLoading,
|
bool isUnShowLoading,
|
||||||
) =>
|
) =>
|
||||||
post(
|
post(
|
||||||
uploadElectricQuantityURL.toUrl,
|
uploadElectricQuantityURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
'electricQuantity': electricQuantity,
|
'electricQuantity': electricQuantity,
|
||||||
'electricQuantityStandby': electricQuantityStandby,
|
'electricQuantityStandby': electricQuantityStandby,
|
||||||
'lockId': lockId,
|
'lockId': lockId,
|
||||||
}),
|
}),
|
||||||
isUnShowLoading: isUnShowLoading);
|
isUnShowLoading: isUnShowLoading,
|
||||||
|
isShowErrMsg: false,
|
||||||
|
);
|
||||||
|
|
||||||
Future<Response> modifyKeyName(
|
Future<Response> modifyKeyName(
|
||||||
String keyId,
|
String keyId,
|
||||||
@ -300,9 +302,9 @@ class ApiProvider extends BaseProvider {
|
|||||||
jsonEncode({
|
jsonEncode({
|
||||||
'lockId': lockId,
|
'lockId': lockId,
|
||||||
'lockEventType': lockEventType,
|
'lockEventType': lockEventType,
|
||||||
"pageNo": pageNo,
|
'pageNo': pageNo,
|
||||||
'pageSize': pageSize,
|
'pageSize': pageSize,
|
||||||
"startDate": startDate,
|
'startDate': startDate,
|
||||||
'endDate': endDate,
|
'endDate': endDate,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@ -317,11 +319,13 @@ class ApiProvider extends BaseProvider {
|
|||||||
|
|
||||||
// 查询锁记录最后时间
|
// 查询锁记录最后时间
|
||||||
Future<Response> getLockRecordLastUploadDataTime(String lockId) => post(
|
Future<Response> getLockRecordLastUploadDataTime(String lockId) => post(
|
||||||
getLockRecordLastUploadDataTimeURL.toUrl,
|
getLockRecordLastUploadDataTimeURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
'lockId': lockId,
|
'lockId': lockId,
|
||||||
}),
|
}),
|
||||||
isUnShowLoading: true);
|
isUnShowLoading: true,
|
||||||
|
isShowErrMsg: false,
|
||||||
|
);
|
||||||
|
|
||||||
// 获取手机联网token
|
// 获取手机联网token
|
||||||
Future<Response> getLockNetToken(String lockId) => post(
|
Future<Response> getLockNetToken(String lockId) => post(
|
||||||
@ -354,7 +358,7 @@ class ApiProvider extends BaseProvider {
|
|||||||
post(
|
post(
|
||||||
bindingBlueAdminURL.toUrl,
|
bindingBlueAdminURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
"lockAlias": lockAlias,
|
'lockAlias': lockAlias,
|
||||||
'position': position,
|
'position': position,
|
||||||
'bluetooth': bluetooth,
|
'bluetooth': bluetooth,
|
||||||
'lockInfo': lockInfo,
|
'lockInfo': lockInfo,
|
||||||
@ -370,7 +374,7 @@ class ApiProvider extends BaseProvider {
|
|||||||
getLockInfoURL.toUrl,
|
getLockInfoURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
'lastUpdateDate': lastUpdateDate,
|
'lastUpdateDate': lastUpdateDate,
|
||||||
"pageNo": pageNo,
|
'pageNo': pageNo,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// 获取锁信息列表
|
// 获取锁信息列表
|
||||||
@ -379,7 +383,7 @@ class ApiProvider extends BaseProvider {
|
|||||||
post(
|
post(
|
||||||
getStarLockInfoURL.toUrl,
|
getStarLockInfoURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
"pageNo": pageNo,
|
'pageNo': pageNo,
|
||||||
'pageSize': pageSize,
|
'pageSize': pageSize,
|
||||||
}),
|
}),
|
||||||
isUnShowLoading: isUnShowLoading);
|
isUnShowLoading: isUnShowLoading);
|
||||||
@ -529,8 +533,8 @@ class ApiProvider extends BaseProvider {
|
|||||||
'isCoerced': isCoerced,
|
'isCoerced': isCoerced,
|
||||||
'hoursStart': hoursStart,
|
'hoursStart': hoursStart,
|
||||||
'hoursEnd': hoursEnd,
|
'hoursEnd': hoursEnd,
|
||||||
"keyboardPwdType": keyboardPwdType,
|
'keyboardPwdType': keyboardPwdType,
|
||||||
"pwdRight": pwdRight
|
'pwdRight': pwdRight
|
||||||
}));
|
}));
|
||||||
|
|
||||||
Future<Response> clearOperationRecord(String lockId) =>
|
Future<Response> clearOperationRecord(String lockId) =>
|
||||||
@ -1283,11 +1287,11 @@ class ApiProvider extends BaseProvider {
|
|||||||
'startTime': startTime,
|
'startTime': startTime,
|
||||||
'endTime': endTime,
|
'endTime': endTime,
|
||||||
'faceType': faceType,
|
'faceType': faceType,
|
||||||
"weekDay": weekDay,
|
'weekDay': weekDay,
|
||||||
'faceName': faceName,
|
'faceName': faceName,
|
||||||
'addType': addType,
|
'addType': addType,
|
||||||
"isCoerced": isCoerced,
|
'isCoerced': isCoerced,
|
||||||
"faceRight": faceRight
|
'faceRight': faceRight
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// 删除人脸
|
// 删除人脸
|
||||||
@ -1631,7 +1635,7 @@ class ApiProvider extends BaseProvider {
|
|||||||
jsonEncode({
|
jsonEncode({
|
||||||
'countryCode': countryCode,
|
'countryCode': countryCode,
|
||||||
'account': account,
|
'account': account,
|
||||||
"channel": channel,
|
'channel': channel,
|
||||||
'codeType': codeType,
|
'codeType': codeType,
|
||||||
'xWidth': xWidth,
|
'xWidth': xWidth,
|
||||||
}));
|
}));
|
||||||
@ -1679,9 +1683,9 @@ class ApiProvider extends BaseProvider {
|
|||||||
post(
|
post(
|
||||||
changePasswordURL.toUrl,
|
changePasswordURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
"date": date,
|
'date': date,
|
||||||
'newPassword': newPassword,
|
'newPassword': newPassword,
|
||||||
"oldPassword": oldPassword,
|
'oldPassword': oldPassword,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
//获取安全信息列表
|
//获取安全信息列表
|
||||||
@ -1689,7 +1693,7 @@ class ApiProvider extends BaseProvider {
|
|||||||
post(
|
post(
|
||||||
getQuestionListURL.toUrl,
|
getQuestionListURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
"operatorUid": operatorUid,
|
'operatorUid': operatorUid,
|
||||||
'countryCode': countryCode,
|
'countryCode': countryCode,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@ -1700,12 +1704,12 @@ class ApiProvider extends BaseProvider {
|
|||||||
//设置安全信息
|
//设置安全信息
|
||||||
Future<Response> setSafeAnswer(List questionAndAnswerList) => post(
|
Future<Response> setSafeAnswer(List questionAndAnswerList) => post(
|
||||||
setSafeAnswerURL.toUrl,
|
setSafeAnswerURL.toUrl,
|
||||||
jsonEncode({"questionAndAnswerList": questionAndAnswerList}));
|
jsonEncode({'questionAndAnswerList': questionAndAnswerList}));
|
||||||
|
|
||||||
//修改安全信息
|
//修改安全信息
|
||||||
Future<Response> updateSafeAnswer(List questionAndAnswerList) => post(
|
Future<Response> updateSafeAnswer(List questionAndAnswerList) => post(
|
||||||
updateSafeAnswerURL.toUrl,
|
updateSafeAnswerURL.toUrl,
|
||||||
jsonEncode({"questionAndAnswerList": questionAndAnswerList}));
|
jsonEncode({'questionAndAnswerList': questionAndAnswerList}));
|
||||||
|
|
||||||
// 获取上传文件的upToken 再调用updateUserInfo
|
// 获取上传文件的upToken 再调用updateUserInfo
|
||||||
Future<Response> getUpHeadToken(
|
Future<Response> getUpHeadToken(
|
||||||
@ -1716,10 +1720,10 @@ class ApiProvider extends BaseProvider {
|
|||||||
post(
|
post(
|
||||||
getUpTokenURL.toUrl,
|
getUpTokenURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
"module": "avatar",
|
'module': 'avatar',
|
||||||
"userId": userId,
|
'userId': userId,
|
||||||
"filename": filename,
|
'filename': filename,
|
||||||
"size": size,
|
'size': size,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// 文件上传
|
// 文件上传
|
||||||
@ -1731,17 +1735,17 @@ class ApiProvider extends BaseProvider {
|
|||||||
//获取解绑手机号Token
|
//获取解绑手机号Token
|
||||||
Future<Response> unbindPhoneToken(String verificationCode) => post(
|
Future<Response> unbindPhoneToken(String verificationCode) => post(
|
||||||
unbindPhoneTokenURL.toUrl,
|
unbindPhoneTokenURL.toUrl,
|
||||||
jsonEncode({"verificationCode": verificationCode}));
|
jsonEncode({'verificationCode': verificationCode}));
|
||||||
|
|
||||||
//获取解绑邮箱Token
|
//获取解绑邮箱Token
|
||||||
Future<Response> unbindEmailToken(String verificationCode) => post(
|
Future<Response> unbindEmailToken(String verificationCode) => post(
|
||||||
unbindEmailTokenURL.toUrl,
|
unbindEmailTokenURL.toUrl,
|
||||||
jsonEncode({"verificationCode": verificationCode}));
|
jsonEncode({'verificationCode': verificationCode}));
|
||||||
|
|
||||||
//推送绑定DeviceID
|
//推送绑定DeviceID
|
||||||
Future<Response> pushBindAppId(String deviceId, int deviceType) => post(
|
Future<Response> pushBindAppId(String deviceId, int deviceType) => post(
|
||||||
pushBindAppIdURL.toUrl,
|
pushBindAppIdURL.toUrl,
|
||||||
jsonEncode({"deviceId": deviceId, "deviceType": deviceType}));
|
jsonEncode({'deviceId': deviceId, 'deviceType': deviceType}));
|
||||||
|
|
||||||
// 消息列表
|
// 消息列表
|
||||||
Future<Response> messageListLoadData(String pageNo, String pageSize) => post(
|
Future<Response> messageListLoadData(String pageNo, String pageSize) => post(
|
||||||
@ -2106,8 +2110,7 @@ class ApiProvider extends BaseProvider {
|
|||||||
'recordType': recordType,
|
'recordType': recordType,
|
||||||
'records': records
|
'records': records
|
||||||
}),
|
}),
|
||||||
isUnShowLoading: isUnShowLoading
|
isUnShowLoading: isUnShowLoading);
|
||||||
);
|
|
||||||
|
|
||||||
// 获取短信或者邮箱模板
|
// 获取短信或者邮箱模板
|
||||||
Future<Response<dynamic>> getNoticeTemplate(
|
Future<Response<dynamic>> getNoticeTemplate(
|
||||||
|
|||||||
@ -34,9 +34,10 @@ class BaseProvider extends GetConnect with Api {
|
|||||||
Progress? uploadProgress,
|
Progress? uploadProgress,
|
||||||
bool? isUnShowLoading = false, // 是否显示loading
|
bool? isUnShowLoading = false, // 是否显示loading
|
||||||
bool? isUserBaseUrl = true, // 文件上传不使用baseUrl
|
bool? isUserBaseUrl = true, // 文件上传不使用baseUrl
|
||||||
|
bool? isShowErrMsg = true, // 文件上传不使用baseUrl
|
||||||
}) async {
|
}) async {
|
||||||
AppLog.log('post: url:$url body:$body');
|
AppLog.log('post: url:$url body:$body');
|
||||||
if (isUnShowLoading == false){
|
if (isUnShowLoading == false) {
|
||||||
EasyLoading.show();
|
EasyLoading.show();
|
||||||
}
|
}
|
||||||
if (isUserBaseUrl == false) {
|
if (isUserBaseUrl == false) {
|
||||||
@ -54,8 +55,9 @@ class BaseProvider extends GetConnect with Api {
|
|||||||
if (EasyLoading.isShow) await EasyLoading.dismiss(animation: true);
|
if (EasyLoading.isShow) await EasyLoading.dismiss(animation: true);
|
||||||
|
|
||||||
// EasyLoading.showToast("Network Error!", duration: 2000.milliseconds);
|
// EasyLoading.showToast("Network Error!", duration: 2000.milliseconds);
|
||||||
if (res.statusCode == null) {
|
if (res.statusCode == null && isShowErrMsg!) {
|
||||||
EasyLoading.showToast('网络访问失败,请检查网络是否正常'.tr, duration: 2000.milliseconds);
|
EasyLoading.showToast('网络访问失败,请检查网络是否正常'.tr,
|
||||||
|
duration: 2000.milliseconds);
|
||||||
// EasyLoading.showToast("Network Error!", duration: 2000.milliseconds);
|
// EasyLoading.showToast("Network Error!", duration: 2000.milliseconds);
|
||||||
}
|
}
|
||||||
var rs = {
|
var rs = {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user