123456789101112131415161718192021222324252627
  1. import 'package:dio/dio.dart';
  2. import 'package:farmer_client/utils/Request.dart';
  3. import 'package:fluttertoast/fluttertoast.dart';
  4. Future getSMSCaptch(String phone) async {
  5. return request('/sms-captcha', options: Options(method: 'POST'), queryParameters: { 'phone': phone }).then((value) {
  6. Fluttertoast.showToast(
  7. msg: '验证码发送成功!'
  8. );
  9. }).catchError((error) {
  10. Fluttertoast.showToast(
  11. msg: error.error['message']
  12. );
  13. });
  14. }
  15. //登陆
  16. Future userLogin(String userName,String password) async {
  17. return request('/login', options: Options(method: 'POST'), data: { 'userName': userName,'password':password }, ).catchError((error)=>{ Fluttertoast.showToast(
  18. msg: error.error['message']
  19. ),});
  20. }