forked from alibaba/flutter-go
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
181 additions
and
28 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
class Api{ | ||
static const String BASE_URL = 'http://127.0.0.1:6001/'; | ||
|
||
static const String DO_LOGIN = BASE_URL+'doLogin'; | ||
static const String DO_LOGIN = BASE_URL+'doLogin';//登陆 | ||
|
||
static const String CHECK_LOGIN = BASE_URL+'checkLogin';//验证登陆 | ||
|
||
static const String LOGOUT = BASE_URL+'logout';//退出登陆 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/// @Author: 一凨 | ||
/// @Date: 2019-01-07 16:24:42 | ||
/// @Last Modified by: 一凨 | ||
/// @Last Modified time: 2019-01-08 17:37:42 | ||
import 'dart:async'; | ||
|
||
import 'package:flutter_go/utils/sql.dart'; | ||
|
||
abstract class UserInfoInterface { | ||
String get username; | ||
String get password; | ||
} | ||
|
||
class UserInfo implements UserInfoInterface { | ||
String username; | ||
String password; | ||
|
||
UserInfo({this.username, this.password}); | ||
|
||
factory UserInfo.fromJSON(Map json){ | ||
return UserInfo(username: json['username'],password: json['password']); | ||
} | ||
|
||
Object toMap() { | ||
return {'username': username, 'password': password}; | ||
} | ||
} | ||
|
||
class UserInfoControlModel { | ||
final String table = 'userInfo'; | ||
Sql sql; | ||
|
||
UserInfoControlModel() { | ||
sql = Sql.setTable(table); | ||
} | ||
|
||
// 获取所有的收藏 | ||
|
||
// 插入新的缓存 | ||
Future insert(UserInfo userInfo) { | ||
var result = | ||
sql.insert({'username': userInfo.username, 'password': userInfo.password}); | ||
return result; | ||
} | ||
|
||
// 获取用户信息 | ||
Future<List<UserInfo>> getAllInfo() async { | ||
List list = await sql.getByCondition(); | ||
List<UserInfo> resultList = []; | ||
list.forEach((item){ | ||
print(item); | ||
resultList.add(UserInfo.fromJSON(item)); | ||
}); | ||
return resultList; | ||
} | ||
|
||
// 清空表中数据 | ||
Future deleteAll() async{ | ||
return await sql.deleteAll(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters