Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
N
netrain_flutter_app
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
邹志胜
netrain_flutter_app
Commits
d1cf6148
Commit
d1cf6148
authored
Jul 23, 2021
by
窦文
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of git.naiterui.com:zouzhisheng/netrain_flutter_app
parents
83c395a8
893122ed
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
105 additions
and
2 deletions
+105
-2
ExamListModel.dart
netrain_flutter_app/lib/zhangfeng/ExamListModel.dart
+25
-0
ExamListModel.g.dart
netrain_flutter_app/lib/zhangfeng/ExamListModel.g.dart
+36
-0
LoginApi.dart
netrain_flutter_app/lib/zhangfeng/LoginApi.dart
+9
-0
LoginPage.dart
netrain_flutter_app/lib/zhangfeng/LoginPage.dart
+34
-2
HttpManager.dart
netrain_flutter_app/lib/zhangfeng/Network/HttpManager.dart
+1
-0
No files found.
netrain_flutter_app/lib/zhangfeng/ExamListModel.dart
0 → 100644
View file @
d1cf6148
import
'package:json_annotation/json_annotation.dart'
;
part
'ExamListModel.g.dart'
;
@JsonSerializable
()
class
ExamListModel
{
///可考试总次数
int
totalCount
;
///已考次数
int
useCount
;
String
name
;
String
startTime
;
String
endTime
;
int
resultStatus
;
///考试时长
int
often
;
String
examUserId
;
int
status
;
///题目数
int
questionNo
;
ExamListModel
(
this
.
totalCount
,
this
.
useCount
,
this
.
name
,
this
.
startTime
,
this
.
endTime
,
this
.
resultStatus
,
this
.
often
,
this
.
examUserId
,
this
.
status
,
this
.
questionNo
);
factory
ExamListModel
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
=>
_$ExamListModelFromJson
(
json
);
Map
<
String
,
dynamic
>
toJson
()
=>
_$ExamListModelToJson
(
this
);
}
\ No newline at end of file
netrain_flutter_app/lib/zhangfeng/ExamListModel.g.dart
0 → 100644
View file @
d1cf6148
// GENERATED CODE - DO NOT MODIFY BY HAND
part of
'ExamListModel.dart'
;
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
ExamListModel
_$ExamListModelFromJson
(
Map
<
String
,
dynamic
>
json
)
{
return
ExamListModel
(
json
[
'totalCount'
]
as
int
,
json
[
'useCount'
]
as
int
,
json
[
'name'
]
as
String
,
json
[
'startTime'
]
as
String
,
json
[
'endTime'
]
as
String
,
json
[
'resultStatus'
]
as
int
,
json
[
'often'
]
as
int
,
json
[
'examUserId'
]
as
String
,
json
[
'status'
]
as
int
,
json
[
'questionNo'
]
as
int
,
);
}
Map
<
String
,
dynamic
>
_$ExamListModelToJson
(
ExamListModel
instance
)
=>
<
String
,
dynamic
>{
'totalCount'
:
instance
.
totalCount
,
'useCount'
:
instance
.
useCount
,
'name'
:
instance
.
name
,
'startTime'
:
instance
.
startTime
,
'endTime'
:
instance
.
endTime
,
'resultStatus'
:
instance
.
resultStatus
,
'often'
:
instance
.
often
,
'examUserId'
:
instance
.
examUserId
,
'status'
:
instance
.
status
,
'questionNo'
:
instance
.
questionNo
,
};
netrain_flutter_app/lib/zhangfeng/LoginApi.dart
View file @
d1cf6148
...
...
@@ -24,4 +24,13 @@ class LoginApi {
}
});
}
///请求列表数据
static
requestListData
(
Map
<
String
,
dynamic
>
param
,
OnResult
onResult
)
{
return
HttpManager
.
getInstance
().
request
(
'exam/user/0'
,
parameters:
param
,
onResult:
(
data
,
errorMsg
){
if
(
onResult
!=
null
){
onResult
(
data
,
errorMsg
);
}
});
}
}
netrain_flutter_app/lib/zhangfeng/LoginPage.dart
View file @
d1cf6148
...
...
@@ -7,6 +7,7 @@ import 'LoginApi.dart';
import
'package:netrain_flutter_app/common/Images.dart'
;
import
'package:image_picker/image_picker.dart'
;
//从相册里面选择图片或者拍照获取照片
import
'dart:io'
;
import
'ExamListModel.dart'
;
class
LoginRequestPage
extends
StatefulWidget
{
final
String
title
=
"登录页"
;
...
...
@@ -56,6 +57,10 @@ class _LoginState extends State<LoginRequestPage> {
}
Future
getImage
()
async
{
if
(
UserModel
.
getModel
()
==
null
){
Fluttertoast
.
showToast
(
msg:
'请登录'
);
return
;
}
var
image
=
await
ImagePicker
.
platform
.
pickImage
(
source
:
ImageSource
.
gallery
);
_upLoadImage
(
image
);
//上传图片
setState
(()
{
...
...
@@ -71,7 +76,25 @@ class _LoginState extends State<LoginRequestPage> {
}
});
}
void
_requestListData
()
{
if
(
UserModel
.
getModel
()
==
null
){
Fluttertoast
.
showToast
(
msg:
'请登录'
);
return
;
}
Map
<
String
,
String
>
map
=
new
Map
<
String
,
String
>();
map
[
'page'
]
=
'0'
;
LoginApi
.
requestListData
(
map
,
(
httpModel
,
error
)
{
if
(
error
!=
null
)
{
Fluttertoast
.
showToast
(
msg:
error
);
}
else
{
List
examList
=
httpModel
.
data
[
"content"
].
map
((
m
)
=>
new
ExamListModel
.
fromJson
(
m
)).
toList
();
if
(
examList
.
length
>
0
){
ExamListModel
model
=
examList
[
0
];
Fluttertoast
.
showToast
(
msg:
model
.
toJson
().
toString
(),
timeInSecForIos:
5
);
}
}
});
}
@override
...
...
@@ -144,11 +167,20 @@ class _LoginState extends State<LoginRequestPage> {
),
),
Container
(
margin:
EdgeInsets
.
only
(
top:
5
0
),
margin:
EdgeInsets
.
only
(
top:
0
),
width:
100
,
height:
100
,
child:
Image
.
asset
(
_image
!=
null
?
_image
.
path
:
Images
.
lake
),
),
Container
(
margin:
EdgeInsets
.
only
(
top:
10
),
width:
100
,
height:
50
,
child:
ElevatedButton
(
child:
Text
(
"请求列表数据"
),
onPressed:
_requestListData
,
)
),
],
),
),
// This trailing comma makes auto-formatting nicer for build methods.
...
...
netrain_flutter_app/lib/zhangfeng/Network/HttpManager.dart
View file @
d1cf6148
import
'dart:convert'
;
import
'dart:ffi'
;
import
'package:dio/dio.dart'
;
import
'package:netrain_flutter_app/zhangfeng/Network/BaseHttpModel.dart'
;
import
'package:netrain_flutter_app/zhangfeng/UserModel.dart'
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment