Skip to content

Commit f75e1a3

Browse files
committed
fix:修复多语言问题,没登录请求报错问题
1 parent 4b0863d commit f75e1a3

File tree

6 files changed

+18
-13
lines changed

6 files changed

+18
-13
lines changed

lib/controller/index.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ void initState() {
77
// 获取版本号
88
Store.valueNotCtx<ConfigModel>().$getAppVersion();
99
// 登录
10-
Store.valueNotCtx<UserModel>().getLocalUserInfo();
10+
//Store.valueNotCtx<UserModel>().getLocalUserInfo();
1111
Future.delayed(Duration(seconds: 3), () {
1212
AppVersion().check(Store.widgetCtx);
1313
});

lib/http/index.dart

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,12 @@ Dio getDio({options, loading}) {
4747
print("返回值 ${response.data}");
4848
print('=========【请求成功】End============');
4949
await AppLoading.afterResponse(response.request.uri, loading);
50-
return response;
50+
return response;
5151
},
5252
onError: (DioError e) async {
53-
await AppLoading.afterResponse(e.request.uri, loading);
53+
print('e.request.uri=======================${e.request}');
54+
if (e.request != null && e.request.uri != null)
55+
await AppLoading.afterResponse(e.request.uri, loading);
5456
dynamic msg = e.message;
5557
dynamic code = 0; // 错误码
5658
dynamic status = e.type; // http请求状态
@@ -60,21 +62,20 @@ Dio getDio({options, loading}) {
6062
status = e.response.statusCode;
6163
}
6264
print('========【请求失败 Start】=============');
63-
print("请求地址 ${e.request.uri}");
65+
print("请求地址 ${e.request}");
6466
print("状态码 ${status}");
6567
print("返回msg ${msg}");
6668
print('=========【请求失败 End】============');
6769
return dio.reject({'msg': msg, 'code': code, 'status': status});
6870
},
6971
));
7072
dio.interceptors.add(LogInterceptor(responseBody: false)); //开启请求日志
71-
73+
7274
return dio;
7375
}
7476

7577
Future<dynamic> get({url, data = const {}, options, loading}) async {
76-
return getDio(options: options, loading: loading ?? Map())
77-
.get(url);
78+
return getDio(options: options, loading: loading ?? Map()).get(url);
7879
}
7980

8081
Future post({url, data = const {}, options, loading}) async {

lib/page/mine/index.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,9 @@ class _IndexState extends State<Index> {
116116
Store.value<ConfigModel>(context).$setIsPro();
117117
},
118118
leading: Icon(Icons.verified_user),
119-
title: Text(
120-
Store.value<ConfigModel>(context).isPro ? '线上环境' : '本地环境'
121-
),
119+
title: Text(Store.value<ConfigModel>(context).isPro
120+
? AppLocalizations.$t('common_mine_1.doc_online')
121+
: AppLocalizations.$t('common_mine_1.doc_offline')),
122122
),
123123
Divider(
124124
color: Color(AppTheme.lineColor),

lib/store/objects/user_info.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import 'dart:convert';
1+
//import 'dart:convert';
22

33
class UserInfo extends Object {
44
String login;

locale/en.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
"compProgress": "Components Progress",
1414
"success": "Success To Change ",
1515
"theme": "Select Theme",
16-
"version": "Version"
16+
"version": "Version",
17+
"doc_online": "document online",
18+
"doc_offline": "document offline"
1719
},
1820
"mine": {
1921
"loadNetwork": "Load Network Document Resources",

locale/zh.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
"compProgress": "组件进度",
1414
"success": "切换成功",
1515
"theme": "选择主题",
16-
"version": "版本"
16+
"version": "版本",
17+
"doc_online": "线上文档",
18+
"doc_offline": "离线文档"
1719
},
1820
"mine": {
1921
"loadNetwork": "网络优良,可选择加载线上文档资源",

0 commit comments

Comments
 (0)