import 'package:dio/dio.dart'; import 'package:farmer_client/utils/Request.dart'; import 'package:fluttertoast/fluttertoast.dart'; Future getSMSCaptch(String phone) async { return request('/sms-captcha', options: Options(method: 'POST'), queryParameters: {'phone': phone}).then((value) { Fluttertoast.showToast(msg: '验证码发送成功!'); }).catchError((error) { Fluttertoast.showToast(msg: error.error['message']); }); } //登录 Future userLogin(String userName, String password) async { return request( '/login', options: Options(method: 'POST'), data: {'userName': userName, 'password': password}, ).catchError((error) => { Fluttertoast.showToast(msg: error['message']), }); } Future getCurrent() async { return request('/person/current'); } /** * 修改个人信息 * @param {*} * @returns */ Future updateInfo(String id, userdata) async { return request('/person/$id', options: Options(method: 'PUT'), data: userdata) .catchError((error) => { Fluttertoast.showToast(msg: error.error['message']), }); }