|
|
@@ -92,24 +92,15 @@ class ChangeUserInfoState extends State<ChangeUserInfo> {
|
|
|
Toast.show(context, '修改内容不能为空', 1500, 'info');
|
|
|
return;
|
|
|
}
|
|
|
- // Toast.show(context, '加载中', -1, 'loading');
|
|
|
- // FormData formdata = new FormData.from(
|
|
|
- // {changekey: changeText, "id": userInfo['id']});
|
|
|
- // final response = await Dio().post(
|
|
|
- // domain + 'userInfo/update',
|
|
|
- // data: formdata,
|
|
|
- // options: Options(headers: {
|
|
|
- // "token": StoreProvider.of<CountState>(context)
|
|
|
- // .state
|
|
|
- // .usetoken
|
|
|
- // }));
|
|
|
- // final res = json.decode(response.toString());
|
|
|
- // print(res);
|
|
|
- // if (res['success']) {
|
|
|
- // Toast.hide();
|
|
|
- // getUserInfo();
|
|
|
- // Toast.show(context, '修改成功', 1500, 'success');
|
|
|
- // }
|
|
|
+ Toast.show(context, '加载中', -1, 'loading');
|
|
|
+ Result res = await HttpManager.post('userInfo/update', data: {'id': userInfo.id, changekey: changeText});
|
|
|
+ Toast.hide();
|
|
|
+ if (res.success) {
|
|
|
+ Navigator.pop(context, true);
|
|
|
+ } else {
|
|
|
+ Toast.show(context, res.error, 1500, 'info');
|
|
|
+ Navigator.pop(context);
|
|
|
+ }
|
|
|
}),
|
|
|
),
|
|
|
],
|
|
|
@@ -117,22 +108,9 @@ class ChangeUserInfoState extends State<ChangeUserInfo> {
|
|
|
)),
|
|
|
onWillPop: () {
|
|
|
Toast.hide();
|
|
|
- Navigator.pop(context);
|
|
|
+ Navigator.pop(context, false);
|
|
|
return Future.value(false);
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
-
|
|
|
- // void getUserInfo() async {
|
|
|
- // final response = await Dio().get(domain + 'userInfo/getUserInfo',
|
|
|
- // options: Options(headers: {
|
|
|
- // "token": StoreProvider.of<CountState>(context).state.usetoken
|
|
|
- // }));
|
|
|
- // final res = json.decode(response.toString());
|
|
|
- // if (res['success']) {
|
|
|
- // StoreProvider.of<CountState>(context)
|
|
|
- // .dispatch({"action": Actions.updateUser, "val": res['data']});
|
|
|
- // Navigator.pop(context);
|
|
|
- // }
|
|
|
- // }
|
|
|
}
|