增加广告组件,个人中心
This commit is contained in:
@@ -1,22 +0,0 @@
|
||||
import 'dart:convert';
|
||||
import 'package:http/http.dart' as Http;
|
||||
|
||||
class HttpApi {
|
||||
final String BaseApi = 'http://api.gl.shangkelian.cn/api/';
|
||||
|
||||
/// post
|
||||
ApiPost(String api, {Map? body}) async {
|
||||
String apiUrl = BaseApi + api;
|
||||
var url = Uri.parse(apiUrl);
|
||||
var response = await Http.post(url, body: body);
|
||||
int newCode = response.statusCode;
|
||||
Map data = jsonDecode(response.body);
|
||||
|
||||
if (newCode == 200) {
|
||||
print('请求成功返回值$data');
|
||||
return data;
|
||||
}
|
||||
// print(apiUrl);
|
||||
// print('可选参数${body}');
|
||||
}
|
||||
}
|
||||
7
lib/https/config.dart
Normal file
7
lib/https/config.dart
Normal file
@@ -0,0 +1,7 @@
|
||||
class HttpConfig {
|
||||
static const bool isDebug = false;
|
||||
static const bool offSsl = false;
|
||||
static const String baseUrl = 'http://api.zh.shangkelian.cn/api/';
|
||||
static const int connectTimeout = 5000;
|
||||
static const int receiveTimeout = 5000;
|
||||
}
|
||||
14
lib/https/http.dart
Normal file
14
lib/https/http.dart
Normal file
@@ -0,0 +1,14 @@
|
||||
import 'package:dio/dio.dart';
|
||||
import 'config.dart';
|
||||
|
||||
class HttpApi {
|
||||
static HttpApi? instance;
|
||||
|
||||
HttpApi() {
|
||||
print('回家啊哈哈');
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
HttpApi();
|
||||
}
|
||||
Reference in New Issue
Block a user