7 changed files with 77 additions and 35 deletions
Split View
Diff Options
-
8lib/config/env_config.dart
-
12lib/network/api_urls.dart
-
2lib/network/network_config.dart
-
16lib/network/user_api.dart
-
57lib/network/user_api.g.dart
-
15lib/pages/mine/login_controller.dart
-
2lib/pages/mine/login_page.dart
@ -0,0 +1,12 @@ |
|||
/// API端点URL配置文件 |
|||
/// 集中管理所有API接口路径,方便维护和修改 |
|||
class ApiUrls { |
|||
// 认证相关接口 |
|||
static const String login = 'dating-agency-uec/authorize/by-captcha'; |
|||
static const String getVerificationCode = 'dating-agency-uec/authorize/get/auth-captcha'; |
|||
|
|||
// 用户相关接口 |
|||
static const String getUserInfo = 'dating-agency-uec/user/get/base-info'; |
|||
|
|||
// 后续可以在此添加更多API端点 |
|||
} |
|||
@ -1,22 +1,24 @@ |
|||
import 'package:dating_touchme_app/network/response_model.dart'; |
|||
import 'package:dating_touchme_app/network/api_urls.dart'; |
|||
import 'package:retrofit/retrofit.dart'; |
|||
import 'package:dio/dio.dart'; |
|||
|
|||
part 'user_api.g.dart'; |
|||
|
|||
@RestApi(baseUrl: 'https://api.example.com/') |
|||
@RestApi(baseUrl: '') |
|||
abstract class UserApi { |
|||
factory UserApi(Dio dio) = _UserApi; |
|||
|
|||
@POST("dating-agency-uec/authorize/by-captcha") |
|||
Future<HttpResponse<dynamic>> login( |
|||
@POST(ApiUrls.login) |
|||
Future<HttpResponse<BaseResponse<dynamic>>> login( |
|||
@Body() Map<String, dynamic> data, |
|||
); |
|||
|
|||
@GET("user/info") |
|||
Future<HttpResponse<dynamic>> getUserInfo(); |
|||
@GET(ApiUrls.getUserInfo) |
|||
Future<HttpResponse<BaseResponse<dynamic>>> getUserInfo(); |
|||
|
|||
@POST("dating-agency-uec/authorize/get/auth-captcha") |
|||
Future<HttpResponse<dynamic>> getVerificationCode( |
|||
@POST(ApiUrls.getVerificationCode) |
|||
Future<HttpResponse<BaseResponse<dynamic>>> getVerificationCode( |
|||
@Body() Map<String, dynamic> data, |
|||
); |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save