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
d15d271d
Commit
d15d271d
authored
Oct 15, 2019
by
杜欣
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into dx/message
# Conflicts: # lib/TestPage.dart
parents
5ed9d645
256db5f0
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
378 additions
and
330 deletions
+378
-330
MainActivity.kt
...c/main/kotlin/com/example/gmalpha_flutter/MainActivity.kt
+1
-1
ReputationsModel.dart
lib/PrestigeModel/page/reputation/ReputationsModel.dart
+7
-3
ReputationsPage.dart
lib/PrestigeModel/page/reputation/ReputationsPage.dart
+1
-1
TestPage.dart
lib/TestPage.dart
+3
-4
BaseUtil.dart
lib/commonModel/base/BaseUtil.dart
+12
-0
DioUtil.dart
lib/commonModel/net/DioUtil.dart
+7
-143
main.dart
lib/main.dart
+1
-2
Anim.dart
lib/res/anim/Anim.dart
+86
-0
CommentModel.dart
lib/userModel/page/comment/CommentModel.dart
+30
-0
CommentSuggestPage.dart
lib/userModel/page/comment/CommentSuggestPage.dart
+41
-98
UserSettingModel.dart
lib/userModel/page/userSetting/UserSettingModel.dart
+39
-30
UserSettingPage.dart
lib/userModel/page/userSetting/UserSettingPage.dart
+7
-6
UserRepository.dart
lib/userModel/service/UserRepository.dart
+5
-0
UserRemote.dart
lib/userModel/service/remote/UserRemote.dart
+5
-0
UserApi.dart
lib/userModel/service/remote/api/UserApi.dart
+4
-0
UserApi.serv.dart
lib/userModel/service/remote/api/UserApi.serv.dart
+11
-0
CommentBean.dart
lib/userModel/service/remote/entity/CommentBean.dart
+59
-0
UserEntity.dart
lib/userModel/service/remote/entity/UserEntity.dart
+39
-35
UserEntity.user.dart
lib/userModel/service/remote/entity/UserEntity.user.dart
+6
-5
UserResultBean.dart
lib/userModel/service/remote/entity/UserResultBean.dart
+1
-2
JumpUtil.dart
lib/userModel/util/JumpUtil.dart
+13
-0
No files found.
android/app/src/main/kotlin/com/example/gmalpha_flutter/MainActivity.kt
View file @
d15d271d
...
...
@@ -65,7 +65,7 @@ class MainActivity : FlutterActivity() {
val
map
=
HashMap
<
String
,
String
>()
map
.
put
(
"buildConfig"
,
"debug"
)
//HERE
//
map.put("proxy", "172.30.9.84:6666");
map
.
put
(
"proxy"
,
"172.30.9.84:6666"
);
result
.
success
(
map
)
}
else
{
result
.
notImplemented
()
...
...
lib/PrestigeModel/page/reputation/ReputationsModel.dart
View file @
d15d271d
...
...
@@ -12,14 +12,18 @@ import 'package:gmalpha_flutter/commonModel/net/DioUtil.dart';
import
'package:gmalpha_flutter/commonModel/toast/toast.dart'
;
class
ReputationsModel
extends
BaseModel
{
LiveData
<
PrestigeEntity
>
prestigeLive
=
new
LiveData
();
LiveData
<
String
>
titleLive
=
new
LiveData
();
LiveData
<
PrestigeEntity
>
prestigeLive
;
LiveData
<
String
>
titleLive
;
final
int
userId
;
final
String
userName
;
final
String
fromPage
;
ReputationsModel
(
this
.
userId
,
this
.
userName
,
this
.
fromPage
);
ReputationsModel
(
this
.
userId
,
this
.
userName
,
this
.
fromPage
)
{
prestigeLive
=
new
LiveData
();
titleLive
=
new
LiveData
();
}
init
(
BuildContext
context
)
{
titleLive
.
notifyView
(
userName
);
...
...
lib/PrestigeModel/page/reputation/ReputationsPage.dart
View file @
d15d271d
...
...
@@ -232,8 +232,8 @@ class ReputationsState extends BasePage<ReputationsPage> {
@override
void
dispose
()
{
super
.
dispose
();
_model
.
dispose
();
super
.
dispose
();
}
@override
...
...
lib/TestPage.dart
View file @
d15d271d
...
...
@@ -7,6 +7,7 @@ import 'package:flutter/material.dart';
import
'package:gmalpha_flutter/Annotations/RouterCenterRestore.mark.dart'
;
import
'package:gmalpha_flutter/commonModel/base/BaseComponent.dart'
;
import
'package:gmalpha_flutter/commonModel/net/Api.dart'
;
import
'package:gmalpha_flutter/res/anim/Anim.dart'
;
class
TestPage
extends
StatelessWidget
{
TestPage
()
{
...
...
@@ -40,9 +41,7 @@ class TestPage extends StatelessWidget {
onPressed:
()
{
Navigator
.
push
(
context
,
new
MaterialPageRoute
(
builder:
(
context
)
=>
page
,
));
new
CustomRoute
(
page
));
},
child:
Text
(
itemName
),
),
...
...
@@ -89,7 +88,7 @@ class TestPage extends StatelessWidget {
context
,
RouterCenterImpl
()
.
findUserRouter
()
?.
getUserSettingPage
(
"241765
327
"
,
"NULL"
),
?.
getUserSettingPage
(
"241765
462
"
,
"NULL"
),
"设置页面"
);
}
}
lib/commonModel/base/BaseUtil.dart
0 → 100644
View file @
d15d271d
/*
* @author lsy
* @date 2019-10-14
**/
import
'package:flutter/material.dart'
;
void
jumpToPage
(
Widget
page
,
BuildContext
context
)
{
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
((
context
)
{
return
page
;
})));
}
lib/commonModel/net/DioUtil.dart
View file @
d15d271d
...
...
@@ -6,70 +6,6 @@ import 'package:gmalpha_flutter/commonModel/toast/toast.dart';
const
bool
inProduction
=
const
bool
.
fromEnvironment
(
"dart.vm.product"
);
/// <BaseResp<T> 返回 status code msg data.
class
BaseResp
<
T
>
{
String
status
;
int
code
;
String
msg
;
T
data
;
T
extra
;
T
userType
;
BaseResp
(
this
.
status
,
this
.
code
,
this
.
msg
,
this
.
data
,
this
.
extra
,
this
.
userType
);
@override
String
toString
()
{
StringBuffer
sb
=
new
StringBuffer
(
'{'
);
sb
.
write
(
"
\"
status
\"
:
\"
$status
\"
"
);
sb
.
write
(
",
\"
code
\"
:
$code
"
);
sb
.
write
(
",
\"
msg
\"
:
\"
$msg
\"
"
);
sb
.
write
(
",
\"
data
\"
:
\"
$data
\"
"
);
sb
.
write
(
",
\"
extra
\"
:
\"
$extra
\"
"
);
sb
.
write
(
",
\"
userType
\"
:
\"
$userType
\"
"
);
sb
.
write
(
'}'
);
return
sb
.
toString
();
}
}
/// <BaseRespR<T> 返回 status code msg data Response.
class
BaseRespR
<
T
>
{
String
status
;
int
code
;
String
msg
;
T
data
;
T
extra
;
T
userType
;
Response
response
;
BaseRespR
(
this
.
status
,
this
.
code
,
this
.
msg
,
this
.
data
,
this
.
extra
,
this
.
userType
,
this
.
response
);
@override
String
toString
()
{
StringBuffer
sb
=
new
StringBuffer
(
'{'
);
sb
.
write
(
"
\"
status
\"
:
\"
$status
\"
"
);
sb
.
write
(
",
\"
code
\"
:
$code
"
);
sb
.
write
(
",
\"
msg
\"
:
\"
$msg
\"
"
);
sb
.
write
(
",
\"
data
\"
:
\"
$data
\"
"
);
sb
.
write
(
",
\"
extra
\"
:
\"
$extra
\"
"
);
sb
.
write
(
",
\"
userType
\"
:
\"
$userType
\"
"
);
sb
.
write
(
'}'
);
return
sb
.
toString
();
;
}
}
/// 请求方法.
class
Method
{
static
final
String
get
=
"GET"
;
static
final
String
post
=
"POST"
;
static
final
String
put
=
"PUT"
;
static
final
String
head
=
"HEAD"
;
static
final
String
delete
=
"DELETE"
;
static
final
String
patch
=
"PATCH"
;
}
///Http配置.
class
HttpConfig
{
/// constructor.
...
...
@@ -179,7 +115,7 @@ class DioUtil {
});
}
},
onResponse:
(
response
)
{
print
(
"响应之前"
);
print
(
"响应之前
response
${response}
"
);
},
onError:
(
e
)
{
print
(
"网络错误
$e
message
${e.message}
"
);
});
...
...
@@ -253,6 +189,7 @@ class DioUtil {
*/
Future
<
Response
>
get
(
url
,
{
data
,
options
,
cancelToken
})
async
{
Response
response
;
print
(
"GET===> URL:
$url
data:
$data
"
);
try
{
response
=
await
_dio
.
get
(
url
,
queryParameters:
data
,
options:
options
,
cancelToken:
cancelToken
);
...
...
@@ -275,9 +212,12 @@ class DioUtil {
*/
Future
<
Response
>
post
(
url
,
{
data
,
options
,
cancelToken
})
async
{
Response
response
;
print
(
"POST===> URL:
$url
data:
$data
"
);
try
{
response
=
await
_dio
.
post
(
url
,
queryParameters:
data
,
options:
options
,
cancelToken:
cancelToken
);
data:
FormData
.
from
(
data
),
options:
options
,
cancelToken:
cancelToken
);
print
(
'post success---------
${response.statusCode}
${response.data}
'
);
}
on
DioError
catch
(
e
)
{
print
(
'post error---------
$e
message
${e.message}
'
);
...
...
@@ -305,60 +245,6 @@ class DioUtil {
return
response
.
data
;
}
Future
<
BaseRespR
<
T
>>
requestR
<
T
>(
String
method
,
String
path
,
{
data
,
Options
options
,
CancelToken
cancelToken
})
async
{
Response
response
=
await
_dio
.
request
(
path
,
data:
data
,
options:
_checkOptions
(
method
,
options
),
cancelToken:
cancelToken
);
_printHttpLog
(
response
);
String
_status
;
int
_code
;
String
_msg
;
T
_data
;
T
_extra
;
T
_userType
;
_status
=
response
.
statusCode
.
toString
();
if
(
response
.
statusCode
==
HttpStatus
.
ok
||
response
.
statusCode
==
HttpStatus
.
created
)
{
try
{
if
(
response
.
data
is
Map
)
{
_code
=
(
response
.
data
[
_codeKey
]
is
String
)
?
int
.
tryParse
(
response
.
data
[
_codeKey
])
:
response
.
data
[
_codeKey
];
_msg
=
response
.
data
[
_msgKey
];
_data
=
response
.
data
[
_dataKey
];
}
else
{
Map
<
String
,
dynamic
>
_dataMap
=
_decodeData
(
response
);
_code
=
(
_dataMap
[
_codeKey
]
is
String
)
?
int
.
tryParse
(
_dataMap
[
_codeKey
])
:
_dataMap
[
_codeKey
];
_msg
=
_dataMap
[
_msgKey
];
_data
=
_dataMap
[
_dataKey
];
_extra
=
response
.
data
[
_extraKey
];
_userType
=
response
.
data
[
_userType
];
}
return
new
BaseRespR
(
_status
,
_code
,
_msg
,
_data
,
_extra
,
_userType
,
response
);
}
catch
(
e
)
{
return
new
Future
.
error
(
new
DioError
(
response:
response
,
message:
"data parsing exception..."
,
type:
DioErrorType
.
RESPONSE
,
));
}
}
else
{
_code
=
1
;
_msg
=
'请求失败'
;
}
return
new
Future
.
error
(
new
DioError
(
response:
response
,
message:
"statusCode:
$response
.statusCode, service error"
,
type:
DioErrorType
.
RESPONSE
,
));
}
void
formatError
(
DioError
e
)
{
String
reason
=
""
;
if
(
e
.
type
==
DioErrorType
.
CONNECT_TIMEOUT
)
{
...
...
@@ -400,16 +286,6 @@ class DioUtil {
cancelToken:
cancelToken
,
data:
data
,
options:
options
);
}
/// decode response data.
Map
<
String
,
dynamic
>
_decodeData
(
Response
response
)
{
if
(
response
==
null
||
response
.
data
==
null
||
response
.
data
.
toString
().
isEmpty
)
{
return
new
Map
();
}
return
json
.
decode
(
response
.
data
.
toString
());
}
/// check Options.
Options
_checkOptions
(
method
,
options
)
{
if
(
options
==
null
)
{
...
...
@@ -509,16 +385,6 @@ class DioUtil {
return
dio
;
}
static
String
getBaseUrl
()
{
// if (inProduction) {
// //正式环境的
// return APP_HOST_RELEASE;
// } else {
// return APP_HOST_DEBUG;
// }
return
APP_HOST_DEBUG
;
}
/// get Def Options.
static
BaseOptions
getDefOptions
()
{
BaseOptions
options
=
BaseOptions
();
...
...
@@ -527,9 +393,7 @@ class DioUtil {
// options.contentType = ContentType.parse('application/x-www-form-urlencoded');
options
.
contentType
=
ContentType
.
json
;
options
.
responseType
=
ResponseType
.
plain
;
// options.baseUrl = 'https://earth.iyanzhi.com/';
// options.baseUrl = 'http://earth.gmapp.env/';
options
.
baseUrl
=
getBaseUrl
()
+
"/"
;
options
.
baseUrl
=
APP_HOST_DEBUG
+
"/"
;
Map
<
String
,
dynamic
>
headers
=
Map
<
String
,
dynamic
>();
headers
[
'Accept'
]
=
'application/json'
;
headers
[
'version'
]
=
'1.0.0'
;
...
...
lib/main.dart
View file @
d15d271d
...
...
@@ -12,7 +12,6 @@ import 'package:gmalpha_flutter/commonModel/cache/CacheManager.dart';
import
'package:gmalpha_flutter/commonModel/net/Api.dart'
;
import
'package:gmalpha_flutter/messageModel/home/message_home.dart'
;
import
'comment_suggest.dart'
;
void
main
(
)
{
initParams
(()
=>
runApp
(
MyApp
()));
...
...
@@ -28,7 +27,7 @@ class _MyAppState extends State<MyApp> {
void
initState
()
{
super
.
initState
();
FlutterBoost
.
singleton
.
registerPageBuilders
({
'comment_suggest'
:
(
pageName
,
params
,
_
)
=>
CommentSuggest
(
params
),
//
'comment_suggest': (pageName, params, _) => CommentSuggest(params),
'message_home'
:
(
pageName
,
params
,
_
)
=>
MessageHomePage
(
params
),
'album'
:
(
pageName
,
params
,
_
)
{
if
(
params
==
null
)
{
...
...
lib/res/anim/Anim.dart
0 → 100644
View file @
d15d271d
/*
* @author lsy
* @date 2019-10-14
**/
import
'package:flutter/material.dart'
;
class
CustomRoute
extends
PageRouteBuilder
{
final
Widget
widget
;
CustomRoute
(
this
.
widget
)
:
super
(
// 设置过度时间
transitionDuration:
Duration
(
milliseconds:
500
),
// 构造器
pageBuilder:
(
// 上下文和动画
BuildContext
context
,
Animation
<
double
>
animaton1
,
Animation
<
double
>
animaton2
,
){
return
widget
;
},
transitionsBuilder:
(
BuildContext
context
,
Animation
<
double
>
animaton1
,
Animation
<
double
>
animaton2
,
Widget
child
,
){
// 需要什么效果把注释打开就行了
// 渐变效果
// return FadeTransition(
// // 从0开始到1
// opacity: Tween(begin: 0.0,end: 1.0)
// .animate(CurvedAnimation(
// // 传入设置的动画
// parent: animaton1,
// // 设置效果,快进漫出 这里有很多内置的效果
// curve: Curves.fastOutSlowIn,
// )),
// child: child,
// );
// 缩放动画效果
// return ScaleTransition(
// scale: Tween(begin: 0.0,end: 1.0).animate(CurvedAnimation(
// parent: animaton1,
// curve: Curves.fastOutSlowIn
// )),
// child: child,
// );
// 旋转加缩放动画效果
// return RotationTransition(
// turns: Tween(begin: 0.0,end: 1.0)
// .animate(CurvedAnimation(
// parent: animaton1,
// curve: Curves.fastOutSlowIn,
// )),
// child: ScaleTransition(
// scale: Tween(begin: 0.0,end: 1.0)
// .animate(CurvedAnimation(
// parent: animaton1,
// curve: Curves.fastOutSlowIn
// )),
// child: child,
// ),
// );
// 左右滑动动画效果
return
SlideTransition
(
position:
Tween
<
Offset
>(
// 设置滑动的 X , Y 轴
begin:
Offset
(
1.0
,
0.0
),
end:
Offset
(
0.0
,
0.0
)
).
animate
(
CurvedAnimation
(
parent:
animaton1
,
curve:
Curves
.
fastOutSlowIn
)),
child:
child
,
);
}
);
}
\ No newline at end of file
lib/userModel/page/comment/CommentModel.dart
0 → 100644
View file @
d15d271d
/*
* @author lsy
* @date 2019-10-14
**/
import
'package:flutter/cupertino.dart'
;
import
'package:gmalpha_flutter/Annotations/RouterCenterRestore.mark.dart'
;
import
'package:gmalpha_flutter/commonModel/live/BaseModel.dart'
;
import
'package:gmalpha_flutter/commonModel/toast/toast.dart'
;
import
'package:gmalpha_flutter/userModel/service/UserRepository.dart'
;
class
CommentModel
extends
BaseModel
{
String
refer
;
CommentModel
(
this
.
refer
)
{}
@override
void
dispose
()
{}
void
confirmClick
(
BuildContext
context
,
String
content
,
String
phone
)
{
RouterCenterImpl
()
.
findBuriedRouter
()
?.
onEvent
(
'click_comment_suggest'
,
{
'comment_id'
:
'10086'
});
UserRepository
.
getInstance
().
commentSuggest
(
content
,
phone
).
listen
((
value
)
{
Navigator
.
pop
(
context
);
}).
onError
((
error
){
Toast
.
debugShow
(
context
,
error
.
message
);
print
(
error
.
message
);
});
}
}
lib/
comment_suggest
.dart
→
lib/
userModel/page/comment/CommentSuggestPage
.dart
View file @
d15d271d
...
...
@@ -9,77 +9,40 @@
import
'package:dio/dio.dart'
;
import
'package:flutter_boost/flutter_boost.dart'
;
import
'package:flutter/material.dart'
;
import
'commonModel/ui/ALColors.dart'
;
import
'commonModel/ui/ALDevice.dart'
;
import
'commonModel/net/DioUtil.dart'
;
import
'commonModel/toast/toast.dart'
;
//import 'package:native_flutter_transfer_plugin/native_flutter_transfer_plugin.dart';
class
CommentSuggest
extends
StatelessWidget
{
final
Map
params
;
CommentSuggest
(
this
.
params
);
Widget
build
(
BuildContext
context
)
{
return
MaterialApp
(
debugShowCheckedModeBanner:
false
,
title:
'意见与建议'
,
color:
Color
(
0xFFffffff
),
theme:
ThemeData
(
splashColor:
Colors
.
white10
,
//水波纹的颜色
),
home:
CommentSuggestPage
(
nativeCookie:
this
.
params
,
title:
'意见与建议'
,)
);
import
'package:gmalpha_flutter/commonModel/base/BaseComponent.dart'
;
import
'package:gmalpha_flutter/commonModel/base/BasePage.dart'
;
import
'package:gmalpha_flutter/commonModel/base/BaseState.dart'
;
import
'package:gmalpha_flutter/userModel/page/comment/CommentModel.dart'
;
import
'../../../commonModel/ui/ALColors.dart'
;
import
'../../../commonModel/ui/ALDevice.dart'
;
class
CommentSuggestPage
extends
StatefulWidget
{
var
_model
;
CommentSuggestPage
(
String
refer
)
{
_model
=
CommentModel
(
refer
);
}
}
class
CommentSuggestPage
extends
StatefulWidget
{
final
String
title
;
final
Map
nativeCookie
;
CommentSuggestPage
({
Key
key
,
this
.
title
,
this
.
nativeCookie
})
:
super
(
key:
key
);
@override
_CommentSuggestPageState
createState
()
=>
_CommentSuggestPageState
(
);
State
<
StatefulWidget
>
createState
()
=>
_CommentSuggestPageState
(
_model
);
}
class
_CommentSuggestPageState
extends
Stat
e
<
CommentSuggestPage
>
{
class
_CommentSuggestPageState
extends
BasePag
e
<
CommentSuggestPage
>
{
TextEditingController
opinionCtrl
=
TextEditingController
();
TextEditingController
telCtrl
=
TextEditingController
();
CommentModel
_model
;
_CommentSuggestPageState
(
this
.
_model
);
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
appBar:
AppBar
(
backgroundColor:
Color
(
0xFFffffff
),
title:
Text
(
'意见与建议'
,
style:
new
TextStyle
(
fontSize:
16.0
,
color:
ALColors
.
Color323232
),
),
elevation:
0
,
brightness:
Brightness
.
light
,
leading:
new
GestureDetector
(
child:
new
ImageIcon
(
AssetImage
(
'images/nav_back.png'
),
color:
ALColors
.
Color323232
,
),
onTap:
()
{
print
(
'123-------'
);
// FlutterBoost.singleton.closePageForContext(context);
FlutterBoost
.
singleton
.
closePageForContext
(
context
);
}),
),
// floatingActionButton: new FloatingActionButton(
// onPressed: () {
// print('33333-------');
// FlutterBoost.singleton.openPage('second', {});
// },
// child: new Icon(Icons.add_box),
// elevation: 3.0,
// highlightElevation: 2.0,
// backgroundColor: Colors.red, // 红色
// ),
appBar:
baseAppBar
(
title:
'意见与建议'
,
backClick:
()
{
Navigator
.
pop
(
context
);
}),
body:
new
SingleChildScrollView
(
child:
Center
(
child:
Column
(
...
...
@@ -114,7 +77,7 @@ class _CommentSuggestPageState extends State<CommentSuggestPage> {
margin:
EdgeInsets
.
only
(
left:
30
,
right:
30
,
top:
40
),
// padding: EdgeInsets.only(bottom: 10),
decoration:
BoxDecoration
(
border:
Border
(
border:
Border
(
bottom:
BorderSide
(
color:
ALColors
.
ColorC4C4C4
),
)),
alignment:
Alignment
.
centerLeft
,
...
...
@@ -138,12 +101,16 @@ class _CommentSuggestPageState extends State<CommentSuggestPage> {
decoration:
BoxDecoration
(
border:
Border
.
all
(
color:
ALColors
.
Color323232
,
width:
1.5
)),
margin:
EdgeInsets
.
only
(
left:
30
,
right:
30
,
bottom:
30
,
top:
180
),
margin:
EdgeInsets
.
only
(
left:
30
,
right:
30
,
bottom:
30
,
top:
180
),
// padding: EdgeInsets.all(0),
constraints:
BoxConstraints
(
minWidth:
ALDevice
.
width
,
minHeight:
45
),
child:
FlatButton
(
onPressed:
confirmClick
,
onPressed:
()
{
_model
.
confirmClick
(
context
,
opinionCtrl
.
text
??
""
,
telCtrl
.
text
??
""
);
},
child:
Text
(
'提交'
,
style:
...
...
@@ -157,44 +124,20 @@ class _CommentSuggestPageState extends State<CommentSuggestPage> {
));
}
@override
void
di
dUpdateWidget
(
CommentSuggestPage
oldWidget
)
{
super
.
di
dUpdateWidget
(
oldWidget
);
print
(
'aaaaaaaaa--------'
);
print
(
oldWidget
);
@override
void
di
spose
(
)
{
super
.
di
spose
(
);
opinionCtrl
.
dispose
(
);
telCtrl
.
dispose
(
);
}
void
confirmClick
()
{
// NativeFlutterTransferPlugin.track('click_comment_suggest', {'comment_id': '10086'});
confimSuggestInfo
();
@override
String
pageName
()
{
return
"comment_arguement"
;
}
void
confimSuggestInfo
()
{
BaseOptions
options
=
DioUtil
.
getDefOptions
();
final
cookie
=
new
Map
<
String
,
dynamic
>.
from
(
widget
.
nativeCookie
);
HttpConfig
config
=
new
HttpConfig
(
options:
options
,
nativeCookie:
cookie
);
DioUtil
().
setConfig
(
config
);
String
content
=
(
this
.
opinionCtrl
.
text
.
length
>
0
)?
this
.
opinionCtrl
.
text
:
''
;
String
phone
=
(
this
.
telCtrl
.
text
.
length
>
0
)?
this
.
telCtrl
.
text
:
''
;
DioUtil
().
requestR
(
Method
.
post
,
"api/v1/suggestion"
,
data:
{
"content"
:
content
,
"phone"
:
phone
}).
then
((
res
){
if
(
res
.
code
==
0
)
{
Toast
.
show
(
context
,
'提交成功'
);
FlutterBoost
.
singleton
.
closePageForContext
(
context
);
}
else
{
Toast
.
show
(
context
,
res
.
msg
);
}
}
).
then
((
error
){
if
(
error
!=
null
)
{
Toast
.
show
(
context
,
'提交失败'
);
print
(
error
);
}
else
{
// FlutterBoost.singleton.closePageForContext(context);
}
});
@override
String
referrer
()
{
return
_model
.
refer
;
}
}
lib/userModel/page/userSetting/UserSettingModel.dart
View file @
d15d271d
...
...
@@ -4,6 +4,9 @@
**/
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/material.dart'
;
import
'package:gmalpha_flutter/Annotations/RouterCenterRestore.mark.dart'
;
import
'package:gmalpha_flutter/commonModel/base/BaseUtil.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'
;
...
...
@@ -25,34 +28,42 @@ class UserSettingModel extends BaseModel {
UserSettingModel
(
this
.
userid
,
this
.
refere
);
init
(
BuildContext
context
)
{
if
(
UserEntityImpl
().
getuserId
()
==
null
||
UserEntityImpl
().
getuserId
()
!=
userid
)
{
UserRepository
.
getInstance
().
getUserInfo
(
userid
).
listen
((
data
)
{
print
(
data
);
}).
onError
((
error
)
{
print
(
error
);
Toast
.
show
(
context
,
"error"
);
});
}
else
{
UserEntityImpl
().
getnickName
().
listen
((
data
)
{
nameLive
.
notifyView
(
data
);
}).
onError
((
error
)
{
print
(
error
);
Toast
.
debugShow
(
context
,
error
);
});
UserEntityImpl
().
getcountryInfoName
().
listen
((
data
)
{
cityLive
.
notifyView
(
data
);
}).
onError
((
error
)
{
print
(
error
);
Toast
.
debugShow
(
context
,
error
);
});
UserEntityImpl
().
getprofilePic
().
listen
((
value
)
{
headImgLive
.
notifyView
(
value
);
}).
onError
((
error
)
{
print
(
error
);
Toast
.
debugShow
(
context
,
error
);
});
}
UserEntityImpl
().
getuserId
().
listen
((
value
)
{
print
(
"VALUEE
$value
"
);
if
(
value
==
null
||
value
!=
userid
)
{
UserRepository
.
getInstance
().
getUserInfo
(
userid
).
listen
((
data
)
{
print
(
data
);
nameLive
.
notifyView
(
data
?.
data
?.
nickName
);
cityLive
.
notifyView
(
data
?.
data
?.
countryInfo
?.
name
);
headImgLive
.
notifyView
(
data
?.
data
?.
profilePic
);
}).
onError
((
error
)
{
print
(
error
);
Toast
.
show
(
context
,
error
);
});
}
else
{
UserEntityImpl
().
getnickName
().
listen
((
data
)
{
print
(
"NICK
$data
"
);
nameLive
.
notifyView
(
data
);
}).
onError
((
error
)
{
print
(
error
);
Toast
.
debugShow
(
context
,
error
);
});
UserEntityImpl
().
getcountryInfoName
().
listen
((
data
)
{
print
(
"con
$data
"
);
cityLive
.
notifyView
(
data
);
}).
onError
((
error
)
{
print
(
error
);
Toast
.
debugShow
(
context
,
error
);
});
UserEntityImpl
().
getprofilePic
().
listen
((
value
)
{
print
(
"head
$value
"
);
headImgLive
.
notifyView
(
value
);
}).
onError
((
error
)
{
print
(
error
);
Toast
.
debugShow
(
context
,
error
);
});
}
});
}
@override
...
...
@@ -62,6 +73,4 @@ class UserSettingModel extends BaseModel {
cityLive
.
dispost
();
saveLive
.
dispost
();
}
void
gotoCommentPage
(
BuildContext
context
)
{}
}
lib/userModel/page/userSetting/UserSettingPage.dart
View file @
d15d271d
...
...
@@ -14,6 +14,7 @@ import 'package:gmalpha_flutter/commonModel/net/Responce/SimpleResponce.dart';
import
'package:gmalpha_flutter/userModel/page/userSetting/UserSettingModel.dart'
;
import
'package:gmalpha_flutter/userModel/service/remote/entity/TestUserEntity.dart'
;
import
'package:gmalpha_flutter/userModel/service/remote/entity/UserEntity.dart'
;
import
'package:gmalpha_flutter/userModel/util/JumpUtil.dart'
;
class
UserSettingPage
extends
StatefulWidget
{
UserSettingModel
_model
;
...
...
@@ -153,7 +154,7 @@ class UserState extends BasePage<UserSettingPage> {
true
),
divideLine
(),
baseItem
(()
{
_model
.
gotoCommentPage
(
context
);
jumpToComment
(
context
,
pageName
()
);
},
"意见与建议"
,
null
,
true
),
divideLine
(),
baseItem
(()
{},
"隐私声明"
,
null
,
true
),
...
...
@@ -165,7 +166,7 @@ class UserState extends BasePage<UserSettingPage> {
),
Container
(
width:
double
.
maxFinite
,
height:
ScreenUtil
.
instance
.
setHeight
(
45
)
,
height:
45
,
margin:
EdgeInsets
.
only
(
bottom:
ScreenUtil
.
instance
.
setHeight
(
30
),
left:
ScreenUtil
.
instance
.
setWidth
(
30
),
...
...
@@ -173,7 +174,7 @@ class UserState extends BasePage<UserSettingPage> {
child:
OutlineButton
(
onPressed:
()
{},
child:
baseText
(
"退出登入"
,
14
,
0xff323232
),
borderSide:
new
BorderSide
(
color:
Color
(
0xff323232
)),
borderSide:
new
BorderSide
(
color:
Color
(
0xff323232
)),
),
)
],
...
...
@@ -194,17 +195,17 @@ class UserState extends BasePage<UserSettingPage> {
baseItem
(
VoidCallback
ontap
,
String
left
,
Widget
center
,
bool
needRight
)
{
return
GestureDetector
(
onTap:
()
=>
ontap
,
onTap:
()
=>
ontap
()
,
child:
Container
(
margin:
EdgeInsets
.
only
(
right:
ScreenUtil
.
instance
.
setWidth
(
30
),
left:
ScreenUtil
.
instance
.
setWidth
(
30
)),
height:
ScreenUtil
.
instance
.
setHeight
(
60
)
,
height:
60
,
child:
Row
(
children:
<
Widget
>[
baseText
(
left
,
13
,
0xff323232
),
Expanded
(
child:
Container
(),
child:
SizedBox
(),
),
center
??
Container
(),
needRight
...
...
lib/userModel/service/UserRepository.dart
View file @
d15d271d
...
...
@@ -5,6 +5,7 @@
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/userModel/service/remote/entity/CommentBean.dart'
;
import
'package:gmalpha_flutter/userModel/service/remote/entity/TestUserEntity.dart'
;
import
'package:gmalpha_flutter/userModel/service/remote/entity/UserEntity.dart'
;
import
'package:gmalpha_flutter/userModel/service/remote/entity/UserEntity.user.dart'
;
...
...
@@ -37,4 +38,8 @@ class UserRepository {
return
value
;
});
}
Observable
<
CommentBean
>
commentSuggest
(
String
content
,
String
phone
)
{
return
_remote
.
commentSuggest
(
content
,
phone
);
}
}
lib/userModel/service/remote/UserRemote.dart
View file @
d15d271d
...
...
@@ -4,6 +4,7 @@
**/
import
'package:gmalpha_flutter/commonModel/net/Responce/SimpleResponce.dart'
;
import
'package:gmalpha_flutter/userModel/service/remote/api/UserApi.serv.dart'
;
import
'package:gmalpha_flutter/userModel/service/remote/entity/CommentBean.dart'
;
import
'package:gmalpha_flutter/userModel/service/remote/entity/TestUserEntity.dart'
;
import
'package:gmalpha_flutter/userModel/service/remote/entity/UserEntity.dart'
;
import
'package:gmalpha_flutter/userModel/service/remote/entity/UserResultBean.dart'
;
...
...
@@ -24,4 +25,8 @@ class UserRemote {
Observable
<
UserResultBean
>
getUserInfo
(
String
userID
)
{
return
UserApiImpl
().
getUserInfo
(
userID
);
}
Observable
<
CommentBean
>
commentSuggest
(
String
content
,
String
phone
)
{
return
UserApiImpl
().
comment
(
content
,
phone
);
}
}
lib/userModel/service/remote/api/UserApi.dart
View file @
d15d271d
...
...
@@ -7,6 +7,7 @@ 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/userModel/service/remote/entity/CommentBean.dart'
;
import
'package:gmalpha_flutter/userModel/service/remote/entity/TestUserEntity.dart'
;
import
'package:gmalpha_flutter/userModel/service/remote/entity/UserEntity.dart'
;
import
'package:gmalpha_flutter/userModel/service/remote/entity/UserResultBean.dart'
;
...
...
@@ -15,4 +16,7 @@ import 'package:gmalpha_flutter/userModel/service/remote/entity/UserResultBean.d
abstract
class
UserApi
{
@Get
(
"api/account/user_profile"
)
UserResultBean
getUserInfo
(
@Query
(
"user_id"
)
String
userID
);
@Post
(
"api/v1/suggestion"
)
CommentBean
comment
(
@Query
(
"content"
)
String
content
,
@Query
(
"phone"
)
String
phone
);
}
lib/userModel/service/remote/api/UserApi.serv.dart
View file @
d15d271d
...
...
@@ -11,6 +11,7 @@ import 'dart:io';
import
'package:rxdart/rxdart.dart'
;
import
'package:gmalpha_flutter/userModel/service/remote/entity/UserResultBean.dart'
;
import
'package:gmalpha_flutter/userModel/service/remote/entity/CommentBean.dart'
;
import
'package:gmalpha_flutter/commonModel/net/DioUtil.dart'
;
...
...
@@ -37,4 +38,14 @@ class UserApiImpl {
}
});
}
Observable
<
CommentBean
>
comment
(
String
content
,
String
phone
)
{
return
Observable
.
fromFuture
(
DioUtil
().
post
(
'api/v1/suggestion'
,
data:
{
'content'
:
content
,
'phone'
:
phone
})).
map
((
value
)
{
if
(
value
!=
null
&&
value
.
statusCode
==
200
)
{
Map
map
=
json
.
decode
(
value
.
toString
());
return
CommentBean
.
fromJson
(
map
);
}
});
}
}
lib/userModel/service/remote/entity/CommentBean.dart
0 → 100644
View file @
d15d271d
/*
* @author lsy
* @date 2019-10-14
**/
class
CommentBean
{
int
error
;
String
message
;
Null
extra
;
UserType
userType
;
Data
data
;
CommentBean
({
this
.
error
,
this
.
message
,
this
.
extra
,
this
.
userType
,
this
.
data
});
CommentBean
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
error
=
json
[
'error'
];
message
=
json
[
'message'
];
extra
=
json
[
'extra'
];
userType
=
json
[
'user_type'
]
!=
null
?
new
UserType
.
fromJson
(
json
[
'user_type'
])
:
null
;
data
=
json
[
'data'
]
!=
null
?
new
Data
.
fromJson
(
json
[
'data'
])
:
null
;
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
data
[
'error'
]
=
this
.
error
;
data
[
'message'
]
=
this
.
message
;
data
[
'extra'
]
=
this
.
extra
;
if
(
this
.
userType
!=
null
)
{
data
[
'user_type'
]
=
this
.
userType
.
toJson
();
}
if
(
this
.
data
!=
null
)
{
data
[
'data'
]
=
this
.
data
.
toJson
();
}
return
data
;
}
}
class
Data
{
Data
();
Data
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
return
data
;
}
}
class
UserType
{
UserType
();
UserType
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
return
data
;
}
}
lib/userModel/service/remote/entity/UserEntity.dart
View file @
d15d271d
...
...
@@ -24,88 +24,93 @@ class UserEntity {
*/
@User
(
USER_ID
,
""
)
String
userId
;
/**
* 用户昵称
*/
@User
(
NICKNAME
,
""
)
String
nickName
;
/**
* 用户头像
*/
@User
(
PORTRAIT
,
""
)
@User
(
PORTRAIT
,
""
)
String
profilePic
;
/**
* 是否需要答题
*/
@User
(
PERSONAL_QA
,
true
)
@User
(
PERSONAL_QA
,
true
)
bool
hasAnswered
=
true
;
/**
* 是否扫过脸
*/
@User
(
HAS_SCAN_FACE
,
true
)
@User
(
HAS_SCAN_FACE
,
true
)
bool
hasScanFace
=
false
;
String
id
;
@User
(
GENDER
,
""
)
@User
(
GENDER
,
""
)
String
gender
;
@User
(
CURRENT_CITY_ID
,
""
)
@User
(
CURRENT_CITY_ID
,
""
)
String
cityId
;
@User
(
BIRTHDAY
,
0
)
int
birth
;
@User
(
BIRTHDAY
,
0.
0
)
double
birth
;
@User
(
COUNTRY_ID
,
""
)
@User
(
COUNTRY_ID
,
""
)
String
countryId
;
bool
logined
;
// 用户是否设置过个人信息
@User
(
DETAIL_SETTED
,
true
)
@User
(
DETAIL_SETTED
,
true
)
bool
detailSetted
=
true
;
//用户是否选择了标签
bool
tagSetted
=
false
;
//注册流程中断后返回之前的登录页面
@User
(
QUESTION_URL
,
""
)
@User
(
QUESTION_URL
,
""
)
String
questionUrl
;
@User
(
USER_BIND_MOBILE
,
true
)
@User
(
USER_BIND_MOBILE
,
true
)
bool
isBind
;
@User
(
COUNTRY_NAME
,
""
)
@User
(
COUNTRY_NAME
,
""
)
String
countryInfoName
;
@User
(
COUNTRY_ID
,
""
)
@User
(
COUNTRY_ID
,
""
)
String
countryInfoId
;
@User
(
COUNTRY_LANGUAGE
,
""
)
@User
(
COUNTRY_LANGUAGE
,
""
)
String
countryInfoLanguage
;
String
insBindId
;
String
registerTime
;
UserEntity
(
{
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
});
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
});
UserEntity
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
userId
=
json
[
'user_id'
];
...
...
@@ -154,5 +159,4 @@ class UserEntity {
data
[
'register_time'
]
=
this
.
registerTime
;
return
data
;
}
}
lib/userModel/service/remote/entity/UserEntity.user.dart
View file @
d15d271d
...
...
@@ -22,6 +22,7 @@ class UserEntityImpl {
}
SpUtil
spUtil
=
SpUtil
.
getInstance
();
String
_userId
;
Observable
<
bool
>
saveuserId
(
String
userId
)
{
return
Observable
.
fromFuture
(
spUtil
.
saveStringKv
(
"user_uid"
,
userId
))
...
...
@@ -149,9 +150,9 @@ class UserEntityImpl {
return
Observable
.
fromFuture
(
spUtil
.
getStringKv
(
"current_city_id"
));
}
int
_birth
;
Observable
<
bool
>
savebirth
(
int
birth
)
{
return
Observable
.
fromFuture
(
spUtil
.
save
Int
Kv
(
"birthday"
,
birth
))
double
_birth
;
Observable
<
bool
>
savebirth
(
double
birth
)
{
return
Observable
.
fromFuture
(
spUtil
.
save
Double
Kv
(
"birthday"
,
birth
))
.
map
((
value
)
{
if
(
value
)
{
this
.
_birth
=
birth
;
...
...
@@ -160,11 +161,11 @@ class UserEntityImpl {
});
}
Observable
<
int
>
getbirth
()
{
Observable
<
double
>
getbirth
()
{
if
(
_birth
!=
null
)
{
return
Observable
.
fromFuture
(
Future
.
value
(
_birth
));
}
return
Observable
.
fromFuture
(
spUtil
.
get
Int
Kv
(
"birthday"
));
return
Observable
.
fromFuture
(
spUtil
.
get
Double
Kv
(
"birthday"
));
}
String
_countryId
;
...
...
lib/userModel/service/remote/entity/UserResultBean.dart
View file @
d15d271d
...
...
@@ -2,7 +2,6 @@
* @author lsy
* @date 2019-10-12
**/
class
UserResultBean
{
int
error
;
String
message
;
...
...
@@ -47,7 +46,7 @@ class Data {
int
gender
;
Null
age
;
Null
cityId
;
int
birth
;
double
birth
;
double
registerTime
;
bool
isBind
;
bool
logined
;
...
...
lib/userModel/util/JumpUtil.dart
0 → 100644
View file @
d15d271d
/*
* @author lsy
* @date 2019-10-14
**/
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/material.dart'
;
import
'package:gmalpha_flutter/res/anim/Anim.dart'
;
import
'package:gmalpha_flutter/userModel/page/comment/CommentSuggestPage.dart'
;
void
jumpToComment
(
BuildContext
context
,
String
refer
)
{
Navigator
.
push
(
context
,
new
CustomRoute
(
CommentSuggestPage
(
refer
)));
}
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