Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
gmalpha_flutter
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
mobile
gmalpha_flutter
Commits
325f43f0
Commit
325f43f0
authored
Sep 29, 2019
by
何碧荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加问卷
parent
769772e1
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
1008 additions
and
4 deletions
+1008
-4
local.properties
.android/local.properties
+2
-1
RouterCenterRestore.mark.dart
lib/Annotations/RouterCenterRestore.mark.dart
+10
-0
main.dart
lib/main.dart
+9
-3
QuestionRouter.dart
lib/questionModel/QuestionRouter.dart
+16
-0
QuestionRouterImpl.dart
lib/questionModel/QuestionRouterImpl.dart
+14
-0
Other.dart
lib/questionModel/page/Other.dart
+5
-0
QuestionPage.dart
lib/questionModel/page/question/QuestionPage.dart
+138
-0
QuestionPageModel.dart
lib/questionModel/page/question/QuestionPageModel.dart
+48
-0
QuestionRepository.dart
lib/questionModel/service/QuestionRepository.dart
+57
-0
QuestionLocal.dart
lib/questionModel/service/local/QuestionLocal.dart
+31
-0
QuestionRemote.dart
lib/questionModel/service/remote/QuestionRemote.dart
+35
-0
QuestionApi.dart
lib/questionModel/service/remote/api/QuestionApi.dart
+24
-0
QuestionApi.serv.dart
lib/questionModel/service/remote/api/QuestionApi.serv.dart
+72
-0
QuestionEntity.dart
lib/questionModel/service/remote/entity/QuestionEntity.dart
+160
-0
QuestionEntity.question.dart
...nModel/service/remote/entity/QuestionEntity.question.dart
+302
-0
TestQuestionEntity.dart
...estionModel/service/remote/entity/TestQuestionEntity.dart
+85
-0
No files found.
.android/local.properties
View file @
325f43f0
sdk.dir
=
/Users/apple/Library/Android/sdk
sdk.dir
=
/Users/apple/Library/Android/sdk
flutter.sdk
=
/Users/apple/
Download
s/flutter
flutter.sdk
=
/Users/apple/
Application
s/flutter
flutter.buildMode
=
debug
flutter.buildMode
=
debug
flutter.versionName
=
1.0.0
flutter.versionName
=
1.0.0
flutter.versionCode
=
1
flutter.versionCode
=
1
\ No newline at end of file
lib/Annotations/RouterCenterRestore.mark.dart
View file @
325f43f0
...
@@ -10,6 +10,8 @@ import "package:gmalpha_flutter/messageModel/MessageRouterImpl.dart";
...
@@ -10,6 +10,8 @@ import "package:gmalpha_flutter/messageModel/MessageRouterImpl.dart";
import
"package:gmalpha_flutter/messageModel/MessageRouter.dart"
;
import
"package:gmalpha_flutter/messageModel/MessageRouter.dart"
;
import
"package:gmalpha_flutter/userModel/UserRouterImpl.dart"
;
import
"package:gmalpha_flutter/userModel/UserRouterImpl.dart"
;
import
"package:gmalpha_flutter/userModel/UserRouter.dart"
;
import
"package:gmalpha_flutter/userModel/UserRouter.dart"
;
import
"package:gmalpha_flutter/questionModel/QuestionRouterImpl.dart"
;
import
"package:gmalpha_flutter/questionModel/QuestionRouter.dart"
;
import
"package:gmalpha_flutter/Annotations/RouterCenterRestore.dart"
;
import
"package:gmalpha_flutter/Annotations/RouterCenterRestore.dart"
;
import
"package:gmalpha_flutter/Annotations/RouterBaser.dart"
;
import
"package:gmalpha_flutter/Annotations/RouterBaser.dart"
;
...
@@ -41,6 +43,7 @@ class RouterCenterImpl {
...
@@ -41,6 +43,7 @@ class RouterCenterImpl {
map
.
putIfAbsent
(
"albumModel"
,
()
=>
AlbumRouterImpl
());
map
.
putIfAbsent
(
"albumModel"
,
()
=>
AlbumRouterImpl
());
map
.
putIfAbsent
(
"messageModel"
,
()
=>
MessageRouterImpl
());
map
.
putIfAbsent
(
"messageModel"
,
()
=>
MessageRouterImpl
());
map
.
putIfAbsent
(
"userModel"
,
()
=>
UserRouterImpl
());
map
.
putIfAbsent
(
"userModel"
,
()
=>
UserRouterImpl
());
map
.
putIfAbsent
(
"questionModel"
,
()
=>
QuestionRouterImpl
());
}
}
RouterBaser
getModel
(
String
modelName
)
{
RouterBaser
getModel
(
String
modelName
)
{
...
@@ -67,4 +70,11 @@ class RouterCenterImpl {
...
@@ -67,4 +70,11 @@ class RouterCenterImpl {
}
}
return
map
[
"userModel"
]
as
UserRouter
;
return
map
[
"userModel"
]
as
UserRouter
;
}
}
QuestionRouter
findQuestionRouter
()
{
if
(
map
[
"questionModel"
]
==
null
)
{
return
null
;
}
return
map
[
"questionModel"
]
as
QuestionRouter
;
}
}
}
lib/main.dart
View file @
325f43f0
...
@@ -60,9 +60,15 @@ class _MyAppState extends State<MyApp> {
...
@@ -60,9 +60,15 @@ class _MyAppState extends State<MyApp> {
// if (findMessageRouter == null) {
// if (findMessageRouter == null) {
// return null;
// return null;
// }
// }
// return findMessageRouter.getMessagePage({});
// return findMessageRouter.getMessagePage({});
// return RouterCenterImpl().findUserRouter()?.getUserPage();
//return RouterCenterImpl().findUserRouter()?.getUserPage();
return
RouterCenterImpl
().
findAlbumRouter
().
getAlbumPage
(
true
,
9
,
null
);
// return RouterCenterImpl().findAlbumRouter().getAlbumPage(true, 9, null);
var
findQuestionRouter
=
RouterCenterImpl
().
findQuestionRouter
();
if
(
findQuestionRouter
==
null
)
{
return
null
;
}
return
findQuestionRouter
.
getQuestionPage
();
// var findUserRouter = RouterCenterImpl().findUserRouter();
// var findUserRouter = RouterCenterImpl().findUserRouter();
// if(findUserRouter==null){
// if(findUserRouter==null){
// return null;
// return null;
...
...
lib/questionModel/QuestionRouter.dart
0 → 100644
View file @
325f43f0
/*
* @author lsy
* @date 2019-09-03
**/
import
'package:flutter/material.dart'
;
import
'package:gmalpha_flutter/Annotations/RouterBaser.dart'
;
import
'package:gmalpha_flutter/Annotations/anno/Router.dart'
;
import
'package:gmalpha_flutter/questionModel/QuestionRouterImpl.dart'
;
@Router
(
"questionModel"
,
QuestionRouterImpl
)
abstract
class
QuestionRouter
implements
RouterBaser
{
Widget
getQuestionPage
();
}
\ No newline at end of file
lib/questionModel/QuestionRouterImpl.dart
0 → 100644
View file @
325f43f0
/*
* @author lsy
* @date 2019-09-03
**/
import
'package:flutter/src/widgets/framework.dart'
;
import
'package:gmalpha_flutter/questionModel/QuestionRouter.dart'
;
import
'package:gmalpha_flutter/questionModel/page/question/QuestionPage.dart'
;
class
QuestionRouterImpl
implements
QuestionRouter
{
@override
Widget
getQuestionPage
()
{
return
QuestionWidget
();
}
}
lib/questionModel/page/Other.dart
0 → 100644
View file @
325f43f0
/*
* @author lsy
* @date 2019-09-04
**/
\ No newline at end of file
lib/questionModel/page/question/QuestionPage.dart
0 → 100644
View file @
325f43f0
/*
* @author hbr
* @date 2019-09-18
**/
import
'package:flutter/material.dart'
;
import
'package:gmalpha_flutter/commonModel/net/Responce/SimpleResponce.dart'
;
import
'package:gmalpha_flutter/questionModel/page/question/QuestionPageModel.dart'
;
import
'package:gmalpha_flutter/questionModel/service/remote/entity/TestQuestionEntity.dart'
;
class
QuestionWidget
extends
StatefulWidget
{
@override
State
<
StatefulWidget
>
createState
()
=>
UserState
();
}
class
UserState
extends
State
<
QuestionWidget
>
{
QuestionPageModel
_model
;
TextEditingController
_nameController
=
new
TextEditingController
();
TextEditingController
_wordController
=
new
TextEditingController
();
@override
void
initState
()
{
super
.
initState
();
_model
=
new
QuestionPageModel
();
}
@override
void
dispose
()
{
super
.
dispose
();
_model
.
dispose
();
_wordController
.
dispose
();
_nameController
.
dispose
();
}
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
appBar:
AppBar
(
title:
Text
(
"User"
,
style:
TextStyle
(
fontSize:
16
),
),
centerTitle:
true
,
),
body:
Column
(
children:
<
Widget
>[
Expanded
(
child:
StreamBuilder
<
SimpleResponce
>(
stream:
_model
.
logoutLive
.
stream
,
initialData:
_model
.
logoutLive
.
data
,
builder:
(
BuildContext
context
,
AsyncSnapshot
<
SimpleResponce
>
snapshot
)
{
if
(
snapshot
.
data
==
null
)
{
return
Center
(
child:
Text
(
"没有退出"
));
}
else
{
return
Center
(
child:
Text
(
"退出接口回掉成功!!"
));
}
},
),
),
Container
(
margin:
EdgeInsets
.
fromLTRB
(
16
,
10
,
16
,
20
),
child:
TextField
(
cursorColor:
Colors
.
black
,
controller:
_nameController
,
decoration:
InputDecoration
(
contentPadding:
EdgeInsets
.
all
(
10.0
),
icon:
Icon
(
Icons
.
text_fields
,
color:
Colors
.
black
),
labelText:
'name1'
,
labelStyle:
TextStyle
(
color:
Colors
.
black
)),
autofocus:
false
,
),
),
Container
(
margin:
EdgeInsets
.
fromLTRB
(
16
,
0
,
16
,
20
),
child:
TextField
(
cursorColor:
Colors
.
black
,
controller:
_wordController
,
decoration:
InputDecoration
(
contentPadding:
EdgeInsets
.
all
(
10.0
),
icon:
Icon
(
Icons
.
text_fields
,
color:
Colors
.
black
,
),
labelText:
'word2'
,
labelStyle:
TextStyle
(
color:
Colors
.
black
)),
autofocus:
false
,
),
),
Container
(
width:
double
.
maxFinite
,
margin:
EdgeInsets
.
fromLTRB
(
16
,
0
,
16
,
0
),
child:
OutlineButton
(
onPressed:
()
=>
_model
.
resignUser
(
context
,
_nameController
.
text
,
_wordController
.
text
),
child:
Text
(
"注册"
),
shape:
BeveledRectangleBorder
(
borderRadius:
BorderRadius
.
circular
(
3
),
),
)),
Container
(
width:
double
.
maxFinite
,
margin:
EdgeInsets
.
fromLTRB
(
16
,
0
,
16
,
0
),
child:
OutlineButton
(
onPressed:
()
=>
_model
.
logout
(
context
),
child:
Text
(
"退出"
),
shape:
BeveledRectangleBorder
(
borderRadius:
BorderRadius
.
circular
(
3
),
),
)),
Expanded
(
child:
StreamBuilder
<
TestQuestionEntity
>(
stream:
_model
.
resignLive
.
stream
,
initialData:
_model
.
resignLive
.
data
,
builder:
(
BuildContext
context
,
AsyncSnapshot
<
TestQuestionEntity
>
snapshot
)
{
if
(
snapshot
.
data
!=
null
)
{
return
Center
(
child:
snapshot
.
data
.
data
==
null
?
Text
(
"错误
${snapshot.data.errorMsg}
"
)
:
Text
(
"登入回掉 用户id:
${snapshot.data.data.id}
"
),
);
}
else
{
return
Center
(
child:
Text
(
"初始化~"
),
);
}
},
),
)
],
),
);
}
}
lib/questionModel/page/question/QuestionPageModel.dart
0 → 100644
View file @
325f43f0
/*
* @author lsy
* @date 2019-09-04
**/
import
'package:flutter/cupertino.dart'
;
import
'package:gmalpha_flutter/commonModel/live/BaseModel.dart'
;
import
'package:gmalpha_flutter/commonModel/net/Responce/SimpleResponce.dart'
;
import
'package:gmalpha_flutter/commonModel/toast/toast.dart'
;
import
'package:gmalpha_flutter/questionModel/service/QuestionRepository.dart'
;
import
'package:gmalpha_flutter/QuestionModel/service/remote/entity/TestQuestionEntity.dart'
;
import
'package:gmalpha_flutter/questionModel/service/remote/entity/QuestionEntity.dart'
;
import
'../../../commonModel/live/LiveData.dart'
;
class
QuestionPageModel
extends
BaseModel
{
LiveData
<
SimpleResponce
>
logoutLive
=
new
LiveData
();
LiveData
<
TestQuestionEntity
>
resignLive
=
new
LiveData
();
// LiveData<String> userTokenLive = new LiveData();
QuestionPageModel
()
{}
void
logout
(
BuildContext
context
)
{
QuestionRepository
.
getInstance
().
logout
().
listen
((
data
)
{
logoutLive
.
notifyView
(
data
);
}).
onError
((
error
)
{
Toast
.
show
(
context
,
"error
${error}
"
);
print
(
error
);
});
}
void
resignUser
(
BuildContext
context
,
String
name
,
String
word
)
{
QuestionRepository
.
getInstance
().
resignUser
(
name
,
word
,
word
).
listen
((
data
)
{
print
(
"data !! :
${data}
"
);
resignLive
.
notifyView
(
data
);
}).
onError
((
error
)
{
Toast
.
show
(
context
,
"error :
${error}
"
);
print
(
error
);
});
}
@override
void
dispose
()
{
logoutLive
.
dispost
();
resignLive
.
dispost
();
}
}
lib/questionModel/service/QuestionRepository.dart
0 → 100644
View file @
325f43f0
/*
* @author lsy
* @date 2019-09-04
**/
import
'package:gmalpha_flutter/commonModel/net/Responce/SimpleResponce.dart'
;
import
'package:gmalpha_flutter/userModel/service/local/UserLocal.dart'
;
import
'package:gmalpha_flutter/userModel/service/remote/UserRemote.dart'
;
import
'package:gmalpha_flutter/questionModel/service/remote/entity/TestQuestionEntity.dart'
;
import
'package:gmalpha_flutter/questionModel/service/remote/entity/QuestionEntity.dart'
;
import
'package:rxdart/rxdart.dart'
;
class
QuestionRepository
{
UserRemote
_remote
;
UserLocal
_local
;
static
QuestionRepository
_questionRepository
;
QuestionRepository
.
_
()
{
_remote
=
UserRemote
.
getInstance
();
_local
=
UserLocal
.
getInstance
();
}
static
QuestionRepository
getInstance
()
{
if
(
_questionRepository
==
null
)
{
_questionRepository
=
QuestionRepository
.
_
();
}
return
_questionRepository
;
}
Observable
<
QuestionEntity
>
getUserInfo
(
String
token
)
{
_remote
.
getUserInfo
(
token
).
map
((
value
)
{
if
(
value
!=
null
)
{
_local
.
saveUserInfo
(
value
);
}
return
value
;
});
}
Observable
<
TestQuestionEntity
>
resignUser
(
String
name
,
String
word
,
String
reword
)
{
return
_remote
.
resignUser
(
name
,
word
,
reword
).
map
((
value
)
{
if
(
value
!=
null
)
{
_local
.
saveUser
(
value
);
}
return
value
;
});
}
Observable
<
SimpleResponce
>
logout
()
{
return
_remote
.
logout
().
map
((
value
)
{
if
(
value
!=
null
)
{
_local
.
logout
();
}
return
value
;
});
}
}
lib/questionModel/service/local/QuestionLocal.dart
0 → 100644
View file @
325f43f0
/*
* @author lsy
* @date 2019-09-04
**/
import
'package:gmalpha_flutter/questionModel/service/remote/entity/TestQuestionEntity.dart'
;
import
'package:gmalpha_flutter/questionModel/service/remote/entity/QuestionEntity.dart'
;
class
UserLocal
{
static
UserLocal
_userRemote
;
UserLocal
.
_
()
{}
static
UserLocal
getInstance
()
{
if
(
_userRemote
==
null
)
{
_userRemote
=
new
UserLocal
.
_
();
}
return
_userRemote
;
}
void
saveUserInfo
(
QuestionEntity
value
)
{
//TODO
}
void
saveUser
(
TestQuestionEntity
value
)
{
//TODO
}
void
logout
()
{
//TODO
}
}
lib/questionModel/service/remote/QuestionRemote.dart
0 → 100644
View file @
325f43f0
/*
* @author lsy
* @date 2019-09-04
**/
import
'package:gmalpha_flutter/commonModel/net/Responce/SimpleResponce.dart'
;
import
'package:gmalpha_flutter/userModel/service/remote/api/UserLoginApi.serv.dart'
;
import
'package:gmalpha_flutter/questionModel/service/remote/entity/TestQuestionEntity.dart'
;
import
'package:gmalpha_flutter/questionModel/service/remote/entity/QuestionEntity.dart'
;
import
'package:rxdart/rxdart.dart'
;
class
QuestionRemote
{
static
QuestionRemote
_userRemote
;
QuestionRemote
.
_
()
{}
static
QuestionRemote
getInstance
()
{
if
(
_userRemote
==
null
)
{
_userRemote
=
new
QuestionRemote
.
_
();
}
return
_userRemote
;
}
Observable
<
QuestionEntity
>
getUserInfo
(
String
token
)
{
// return UserLoginApiImpl().getUserInfo(token);
}
Observable
<
TestQuestionEntity
>
resignUser
(
String
name
,
String
word
,
String
reWord
)
{
// return UserLoginApiImpl().resign(name, word, reWord);
}
Observable
<
SimpleResponce
>
logout
()
{
return
UserLoginApiImpl
().
logout
();
}
}
lib/questionModel/service/remote/api/QuestionApi.dart
0 → 100644
View file @
325f43f0
/*
* @author lsy
* @date 2019-09-04
**/
import
'package:gmalpha_flutter/Annotations/anno/Get.dart'
;
import
'package:gmalpha_flutter/Annotations/anno/Post.dart'
;
import
'package:gmalpha_flutter/Annotations/anno/Query.dart'
;
import
'package:gmalpha_flutter/Annotations/anno/ServiceCenter.dart'
;
import
'package:gmalpha_flutter/commonModel/net/Responce/SimpleResponce.dart'
;
import
'package:gmalpha_flutter/questionModel/service/remote/entity/TestQuestionEntity.dart'
;
import
'package:gmalpha_flutter/questionModel/service/remote/entity/QuestionEntity.dart'
;
@ServiceCenter
()
abstract
class
UserLoginApi
{
@Post
(
"user/register"
)
TestQuestionEntity
resign
(
@Query
(
"username"
)
String
name
,
@Query
(
"password"
)
String
word
,
@Query
(
"repassword"
)
String
repassword
);
@Get
(
"user/info"
)
QuestionEntity
getUserInfo
(
@Query
(
"token"
)
String
token
);
@Get
(
"user/logout/json"
)
SimpleResponce
logout
();
}
lib/questionModel/service/remote/api/QuestionApi.serv.dart
0 → 100644
View file @
325f43f0
// GENERATED CODE - DO NOT MODIFY BY HAND
// **************************************************************************
// ServiceGenerator
// **************************************************************************
import
'dart:convert'
;
import
'dart:io'
;
import
'package:rxdart/rxdart.dart'
;
import
'package:gmalpha_flutter/questionModel/service/remote/entity/TestQuestionEntity.dart'
;
import
'package:gmalpha_flutter/questionModel/service/remote/entity/QuestionEntity.dart'
;
import
'package:gmalpha_flutter/commonModel/net/Responce/SimpleResponce.dart'
;
import
'package:gmalpha_flutter/commonModel/net/DioUtil.dart'
;
class
UserLoginApiImpl
{
factory
UserLoginApiImpl
()
=>
_sharedInstance
();
static
UserLoginApiImpl
_instance
;
UserLoginApiImpl
.
_
()
{}
static
UserLoginApiImpl
_sharedInstance
()
{
if
(
_instance
==
null
)
{
_instance
=
UserLoginApiImpl
.
_
();
}
return
_instance
;
}
Observable
<
TestQuestionEntity
>
resign
(
String
name
,
String
word
,
String
repassword
)
{
return
Observable
.
fromFuture
(
DioUtil
().
post
(
'user/register'
,
data:
{
'username'
:
name
,
'password'
:
word
,
'repassword'
:
repassword
})).
map
((
value
)
{
if
(
value
.
statusCode
==
200
)
{
Map
map
=
json
.
decode
(
value
.
toString
());
return
TestQuestionEntity
.
fromJson
(
map
);
}
else
{
throw
HttpException
(
"statusCode error :
${value.statusCode}
"
);
}
});
}
Observable
<
QuestionEntity
>
getUserInfo
(
String
token
)
{
return
Observable
.
fromFuture
(
DioUtil
().
get
(
'user/info'
,
data:
{
'token'
:
token
})).
map
((
value
)
{
if
(
value
.
statusCode
==
200
)
{
Map
map
=
json
.
decode
(
value
.
toString
());
return
QuestionEntity
.
fromJson
(
map
);
}
else
{
throw
HttpException
(
"statusCode error :
${value.statusCode}
"
);
}
});
}
Observable
<
SimpleResponce
>
logout
()
{
return
Observable
.
fromFuture
(
DioUtil
().
get
(
'user/logout/json'
))
.
map
((
value
)
{
if
(
value
.
statusCode
==
200
)
{
Map
map
=
json
.
decode
(
value
.
toString
());
return
SimpleResponce
.
fromJson
(
map
);
}
else
{
throw
HttpException
(
"statusCode error :
${value.statusCode}
"
);
}
});
}
}
lib/questionModel/service/remote/entity/QuestionEntity.dart
0 → 100644
View file @
325f43f0
import
'package:gmalpha_flutter/Annotations/anno/User.dart'
;
import
'package:gmalpha_flutter/Annotations/anno/UserCenter.dart'
;
import
'package:json_annotation/json_annotation.dart'
;
const
String
USER_ID
=
"user_uid"
;
const
String
NICKNAME
=
"username"
;
const
String
PORTRAIT
=
"potrait"
;
const
String
GENDER
=
"gender"
;
const
String
PERSONAL_QA
=
"personal_qa"
;
const
String
HAS_SCAN_FACE
=
"has_scan_face"
;
const
String
CURRENT_CITY_ID
=
"current_city_id"
;
const
String
QUESTION_URL
=
"question_url"
;
const
String
DETAIL_SETTED
=
"detail_setted"
;
const
String
BIRTHDAY
=
"birthday"
;
const
String
COUNTRY_ID
=
"country_id"
;
const
String
USER_BIND_MOBILE
=
"user_bind_mobile"
;
const
String
COUNTRY_LANGUAGE
=
"country_language"
;
const
String
COUNTRY_NAME
=
"country_name"
;
@UserCenter
()
class
QuestionEntity
{
/**
* 用户id
*/
@User
(
USER_ID
,
""
)
String
userId
;
/**
* 用户昵称
*/
@User
(
NICKNAME
,
""
)
String
nickName
;
/**
* 用户头像
*/
@User
(
PORTRAIT
,
""
)
String
profilePic
;
/**
* 是否需要答题
*/
@User
(
PERSONAL_QA
,
true
)
bool
hasAnswered
=
true
;
/**
* 是否扫过脸
*/
@User
(
HAS_SCAN_FACE
,
true
)
bool
hasScanFace
=
false
;
String
id
;
@User
(
GENDER
,
""
)
String
gender
;
@User
(
CURRENT_CITY_ID
,
""
)
String
cityId
;
@User
(
BIRTHDAY
,
0
)
int
birth
;
@User
(
COUNTRY_ID
,
""
)
String
countryId
;
bool
logined
;
// 用户是否设置过个人信息
@User
(
DETAIL_SETTED
,
true
)
bool
detailSetted
=
true
;
//用户是否选择了标签
bool
tagSetted
=
false
;
//注册流程中断后返回之前的登录页面
@User
(
QUESTION_URL
,
""
)
String
questionUrl
;
@User
(
USER_BIND_MOBILE
,
true
)
bool
isBind
;
@User
(
COUNTRY_NAME
,
""
)
String
countryInfoName
;
@User
(
COUNTRY_ID
,
""
)
String
countryInfoId
;
@User
(
COUNTRY_LANGUAGE
,
""
)
String
countryInfoLanguage
;
String
insBindId
;
String
registerTime
;
QuestionEntity
(
{
this
.
userId
,
this
.
nickName
,
this
.
profilePic
,
this
.
hasAnswered
,
this
.
hasScanFace
,
this
.
id
,
this
.
gender
,
this
.
cityId
,
this
.
birth
,
this
.
countryId
,
this
.
logined
,
this
.
detailSetted
,
this
.
tagSetted
,
this
.
questionUrl
,
this
.
isBind
,
this
.
countryInfoName
,
this
.
countryInfoId
,
this
.
countryInfoLanguage
,
this
.
insBindId
,
this
.
registerTime
});
QuestionEntity
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
userId
=
json
[
'user_id'
];
nickName
=
json
[
'nick_name'
];
profilePic
=
json
[
'profile_pic'
];
hasAnswered
=
json
[
'has_answered'
];
hasScanFace
=
json
[
'has_scan_face'
];
id
=
json
[
'id'
];
gender
=
json
[
'gender'
];
cityId
=
json
[
'city_id'
];
birth
=
json
[
'birth'
];
countryId
=
json
[
'country_id'
];
logined
=
json
[
'logined'
];
detailSetted
=
json
[
'detail_setted'
];
tagSetted
=
json
[
'tag_setted'
];
questionUrl
=
json
[
'question_url'
];
isBind
=
json
[
'is_bind'
];
countryInfoName
=
json
[
'country_info_name'
];
countryInfoId
=
json
[
'country_info_id'
];
countryInfoLanguage
=
json
[
'country_info_language'
];
insBindId
=
json
[
'ins_bind_id'
];
registerTime
=
json
[
'register_time'
];
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
data
[
'user_id'
]
=
this
.
userId
;
data
[
'nick_name'
]
=
this
.
nickName
;
data
[
'profile_pic'
]
=
this
.
profilePic
;
data
[
'has_answered'
]
=
this
.
hasAnswered
;
data
[
'has_scan_face'
]
=
this
.
hasScanFace
;
data
[
'id'
]
=
this
.
id
;
data
[
'gender'
]
=
this
.
gender
;
data
[
'city_id'
]
=
this
.
cityId
;
data
[
'birth'
]
=
this
.
birth
;
data
[
'country_id'
]
=
this
.
countryId
;
data
[
'logined'
]
=
this
.
logined
;
data
[
'detail_setted'
]
=
this
.
detailSetted
;
data
[
'tag_setted'
]
=
this
.
tagSetted
;
data
[
'question_url'
]
=
this
.
questionUrl
;
data
[
'is_bind'
]
=
this
.
isBind
;
data
[
'country_info_name'
]
=
this
.
countryInfoName
;
data
[
'country_info_id'
]
=
this
.
countryInfoId
;
data
[
'country_info_language'
]
=
this
.
countryInfoLanguage
;
data
[
'ins_bind_id'
]
=
this
.
insBindId
;
data
[
'register_time'
]
=
this
.
registerTime
;
return
data
;
}
}
lib/questionModel/service/remote/entity/QuestionEntity.question.dart
0 → 100644
View file @
325f43f0
// GENERATED CODE - DO NOT MODIFY BY HAND
// **************************************************************************
// UserGenerator
// **************************************************************************
import
'package:rxdart/rxdart.dart'
;
import
'package:gmalpha_flutter/commonModel/app_module.dart'
;
class
QuestionEntityImpl
{
factory
QuestionEntityImpl
()
=>
_sharedInstance
();
static
QuestionEntityImpl
_instance
;
QuestionEntityImpl
.
_
()
{}
static
QuestionEntityImpl
_sharedInstance
()
{
if
(
_instance
==
null
)
{
_instance
=
QuestionEntityImpl
.
_
();
}
return
_instance
;
}
String
_userId
;
Observable
<
bool
>
saveuserId
(
String
userId
)
{
return
Observable
.
fromFuture
(
mmKvUtil
.
saveStringKv
(
"user_uid"
,
userId
))
.
map
((
value
)
{
if
(
value
)
{
this
.
_userId
=
userId
;
}
return
value
;
});
}
Observable
<
String
>
getuserId
()
{
if
(
_userId
!=
null
)
{
return
Observable
.
fromFuture
(
Future
.
value
(
_userId
));
}
return
Observable
.
fromFuture
(
mmKvUtil
.
getStringKv
(
"user_uid"
));
}
String
_nickName
;
Observable
<
bool
>
savenickName
(
String
nickName
)
{
return
Observable
.
fromFuture
(
mmKvUtil
.
saveStringKv
(
"username"
,
nickName
))
.
map
((
value
)
{
if
(
value
)
{
this
.
_nickName
=
nickName
;
}
return
value
;
});
}
Observable
<
String
>
getnickName
()
{
if
(
_nickName
!=
null
)
{
return
Observable
.
fromFuture
(
Future
.
value
(
_nickName
));
}
return
Observable
.
fromFuture
(
mmKvUtil
.
getStringKv
(
"username"
));
}
String
_profilePic
;
Observable
<
bool
>
saveprofilePic
(
String
profilePic
)
{
return
Observable
.
fromFuture
(
mmKvUtil
.
saveStringKv
(
"potrait"
,
profilePic
))
.
map
((
value
)
{
if
(
value
)
{
this
.
_profilePic
=
profilePic
;
}
return
value
;
});
}
Observable
<
String
>
getprofilePic
()
{
if
(
_profilePic
!=
null
)
{
return
Observable
.
fromFuture
(
Future
.
value
(
_profilePic
));
}
return
Observable
.
fromFuture
(
mmKvUtil
.
getStringKv
(
"potrait"
));
}
bool
_hasAnswered
;
Observable
<
bool
>
savehasAnswered
(
bool
hasAnswered
)
{
return
Observable
.
fromFuture
(
mmKvUtil
.
saveBoolKv
(
"personal_qa"
,
hasAnswered
))
.
map
((
value
)
{
if
(
value
)
{
this
.
_hasAnswered
=
hasAnswered
;
}
return
value
;
});
}
Observable
<
bool
>
gethasAnswered
()
{
if
(
_hasAnswered
!=
null
)
{
return
Observable
.
fromFuture
(
Future
.
value
(
_hasAnswered
));
}
return
Observable
.
fromFuture
(
mmKvUtil
.
getBoolKv
(
"personal_qa"
));
}
bool
_hasScanFace
;
Observable
<
bool
>
savehasScanFace
(
bool
hasScanFace
)
{
return
Observable
.
fromFuture
(
mmKvUtil
.
saveBoolKv
(
"has_scan_face"
,
hasScanFace
))
.
map
((
value
)
{
if
(
value
)
{
this
.
_hasScanFace
=
hasScanFace
;
}
return
value
;
});
}
Observable
<
bool
>
gethasScanFace
()
{
if
(
_hasScanFace
!=
null
)
{
return
Observable
.
fromFuture
(
Future
.
value
(
_hasScanFace
));
}
return
Observable
.
fromFuture
(
mmKvUtil
.
getBoolKv
(
"has_scan_face"
));
}
String
_gender
;
Observable
<
bool
>
savegender
(
String
gender
)
{
return
Observable
.
fromFuture
(
mmKvUtil
.
saveStringKv
(
"gender"
,
gender
))
.
map
((
value
)
{
if
(
value
)
{
this
.
_gender
=
gender
;
}
return
value
;
});
}
Observable
<
String
>
getgender
()
{
if
(
_gender
!=
null
)
{
return
Observable
.
fromFuture
(
Future
.
value
(
_gender
));
}
return
Observable
.
fromFuture
(
mmKvUtil
.
getStringKv
(
"gender"
));
}
String
_cityId
;
Observable
<
bool
>
savecityId
(
String
cityId
)
{
return
Observable
.
fromFuture
(
mmKvUtil
.
saveStringKv
(
"current_city_id"
,
cityId
))
.
map
((
value
)
{
if
(
value
)
{
this
.
_cityId
=
cityId
;
}
return
value
;
});
}
Observable
<
String
>
getcityId
()
{
if
(
_cityId
!=
null
)
{
return
Observable
.
fromFuture
(
Future
.
value
(
_cityId
));
}
return
Observable
.
fromFuture
(
mmKvUtil
.
getStringKv
(
"current_city_id"
));
}
int
_birth
;
Observable
<
bool
>
savebirth
(
int
birth
)
{
return
Observable
.
fromFuture
(
mmKvUtil
.
saveIntKv
(
"birthday"
,
birth
))
.
map
((
value
)
{
if
(
value
)
{
this
.
_birth
=
birth
;
}
return
value
;
});
}
Observable
<
int
>
getbirth
()
{
if
(
_birth
!=
null
)
{
return
Observable
.
fromFuture
(
Future
.
value
(
_birth
));
}
return
Observable
.
fromFuture
(
mmKvUtil
.
getIntKv
(
"birthday"
));
}
String
_countryId
;
Observable
<
bool
>
savecountryId
(
String
countryId
)
{
return
Observable
.
fromFuture
(
mmKvUtil
.
saveStringKv
(
"country_id"
,
countryId
))
.
map
((
value
)
{
if
(
value
)
{
this
.
_countryId
=
countryId
;
}
return
value
;
});
}
Observable
<
String
>
getcountryId
()
{
if
(
_countryId
!=
null
)
{
return
Observable
.
fromFuture
(
Future
.
value
(
_countryId
));
}
return
Observable
.
fromFuture
(
mmKvUtil
.
getStringKv
(
"country_id"
));
}
bool
_detailSetted
;
Observable
<
bool
>
savedetailSetted
(
bool
detailSetted
)
{
return
Observable
.
fromFuture
(
mmKvUtil
.
saveBoolKv
(
"detail_setted"
,
detailSetted
))
.
map
((
value
)
{
if
(
value
)
{
this
.
_detailSetted
=
detailSetted
;
}
return
value
;
});
}
Observable
<
bool
>
getdetailSetted
()
{
if
(
_detailSetted
!=
null
)
{
return
Observable
.
fromFuture
(
Future
.
value
(
_detailSetted
));
}
return
Observable
.
fromFuture
(
mmKvUtil
.
getBoolKv
(
"detail_setted"
));
}
String
_questionUrl
;
Observable
<
bool
>
savequestionUrl
(
String
questionUrl
)
{
return
Observable
.
fromFuture
(
mmKvUtil
.
saveStringKv
(
"question_url"
,
questionUrl
))
.
map
((
value
)
{
if
(
value
)
{
this
.
_questionUrl
=
questionUrl
;
}
return
value
;
});
}
Observable
<
String
>
getquestionUrl
()
{
if
(
_questionUrl
!=
null
)
{
return
Observable
.
fromFuture
(
Future
.
value
(
_questionUrl
));
}
return
Observable
.
fromFuture
(
mmKvUtil
.
getStringKv
(
"question_url"
));
}
bool
_isBind
;
Observable
<
bool
>
saveisBind
(
bool
isBind
)
{
return
Observable
.
fromFuture
(
mmKvUtil
.
saveBoolKv
(
"user_bind_mobile"
,
isBind
))
.
map
((
value
)
{
if
(
value
)
{
this
.
_isBind
=
isBind
;
}
return
value
;
});
}
Observable
<
bool
>
getisBind
()
{
if
(
_isBind
!=
null
)
{
return
Observable
.
fromFuture
(
Future
.
value
(
_isBind
));
}
return
Observable
.
fromFuture
(
mmKvUtil
.
getBoolKv
(
"user_bind_mobile"
));
}
String
_countryInfoName
;
Observable
<
bool
>
savecountryInfoName
(
String
countryInfoName
)
{
return
Observable
.
fromFuture
(
mmKvUtil
.
saveStringKv
(
"country_name"
,
countryInfoName
))
.
map
((
value
)
{
if
(
value
)
{
this
.
_countryInfoName
=
countryInfoName
;
}
return
value
;
});
}
Observable
<
String
>
getcountryInfoName
()
{
if
(
_countryInfoName
!=
null
)
{
return
Observable
.
fromFuture
(
Future
.
value
(
_countryInfoName
));
}
return
Observable
.
fromFuture
(
mmKvUtil
.
getStringKv
(
"country_name"
));
}
String
_countryInfoId
;
Observable
<
bool
>
savecountryInfoId
(
String
countryInfoId
)
{
return
Observable
.
fromFuture
(
mmKvUtil
.
saveStringKv
(
"country_id"
,
countryInfoId
))
.
map
((
value
)
{
if
(
value
)
{
this
.
_countryInfoId
=
countryInfoId
;
}
return
value
;
});
}
Observable
<
String
>
getcountryInfoId
()
{
if
(
_countryInfoId
!=
null
)
{
return
Observable
.
fromFuture
(
Future
.
value
(
_countryInfoId
));
}
return
Observable
.
fromFuture
(
mmKvUtil
.
getStringKv
(
"country_id"
));
}
String
_countryInfoLanguage
;
Observable
<
bool
>
savecountryInfoLanguage
(
String
countryInfoLanguage
)
{
return
Observable
.
fromFuture
(
mmKvUtil
.
saveStringKv
(
"country_language"
,
countryInfoLanguage
))
.
map
((
value
)
{
if
(
value
)
{
this
.
_countryInfoLanguage
=
countryInfoLanguage
;
}
return
value
;
});
}
Observable
<
String
>
getcountryInfoLanguage
()
{
if
(
_countryInfoLanguage
!=
null
)
{
return
Observable
.
fromFuture
(
Future
.
value
(
_countryInfoLanguage
));
}
return
Observable
.
fromFuture
(
mmKvUtil
.
getStringKv
(
"country_language"
));
}
}
lib/questionModel/service/remote/entity/TestQuestionEntity.dart
0 → 100644
View file @
325f43f0
/*
* @author lsy
* @date 2019-09-05
**/
class
TestQuestionEntity
{
Data
data
;
int
errorCode
;
String
errorMsg
;
TestQuestionEntity
({
this
.
data
,
this
.
errorCode
,
this
.
errorMsg
});
TestQuestionEntity
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
data
=
json
[
'data'
]
!=
null
?
new
Data
.
fromJson
(
json
[
'data'
])
:
null
;
errorCode
=
json
[
'errorCode'
];
errorMsg
=
json
[
'errorMsg'
];
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
if
(
this
.
data
!=
null
)
{
data
[
'data'
]
=
this
.
data
.
toJson
();
}
data
[
'errorCode'
]
=
this
.
errorCode
;
data
[
'errorMsg'
]
=
this
.
errorMsg
;
return
data
;
}
}
class
Data
{
bool
admin
;
List
<
String
>
chapterTops
;
List
<
String
>
collectIds
;
String
email
;
String
icon
;
int
id
;
String
nickname
;
String
password
;
String
token
;
int
type
;
String
username
;
Data
(
{
this
.
admin
,
this
.
chapterTops
,
this
.
collectIds
,
this
.
email
,
this
.
icon
,
this
.
id
,
this
.
nickname
,
this
.
password
,
this
.
token
,
this
.
type
,
this
.
username
});
Data
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
admin
=
json
[
'admin'
];
chapterTops
=
json
[
'chapterTops'
].
cast
<
String
>();
collectIds
=
json
[
'collectIds'
].
cast
<
String
>();
email
=
json
[
'email'
];
icon
=
json
[
'icon'
];
id
=
json
[
'id'
];
nickname
=
json
[
'nickname'
];
password
=
json
[
'password'
];
token
=
json
[
'token'
];
type
=
json
[
'type'
];
username
=
json
[
'username'
];
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
data
[
'admin'
]
=
this
.
admin
;
data
[
'chapterTops'
]
=
this
.
chapterTops
;
data
[
'collectIds'
]
=
this
.
collectIds
;
data
[
'email'
]
=
this
.
email
;
data
[
'icon'
]
=
this
.
icon
;
data
[
'id'
]
=
this
.
id
;
data
[
'nickname'
]
=
this
.
nickname
;
data
[
'password'
]
=
this
.
password
;
data
[
'token'
]
=
this
.
token
;
data
[
'type'
]
=
this
.
type
;
data
[
'username'
]
=
this
.
username
;
return
data
;
}
}
\ No newline at end of file
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