Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
gm_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
林生雨
gm_flutter
Commits
733b0c1b
Commit
733b0c1b
authored
Jul 12, 2020
by
杜欣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ui走查
parent
3d2d9451
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
240 additions
and
16 deletions
+240
-16
LevelTwoPage.dart
lib/ClueModel/page/levelTwo/LevelTwoPage.dart
+8
-6
MechanismBoxPage.dart
lib/ClueModel/page/mechanismBox/MechanismBoxPage.dart
+0
-0
MechanismModel.dart
lib/ClueModel/page/mechanismBox/MechanismModel.dart
+67
-6
ClueApi.dart
lib/ClueModel/server/api/ClueApi.dart
+10
-2
ClueApi.serv.dart
lib/ClueModel/server/api/ClueApi.serv.dart
+25
-2
ConsultHospitalsBean.dart
lib/ClueModel/server/entity/ConsultHospitalsBean.dart
+130
-0
No files found.
lib/ClueModel/page/levelTwo/LevelTwoPage.dart
View file @
733b0c1b
...
...
@@ -58,6 +58,7 @@ class LevelTwoState extends BaseState<LevelTwoPage>
@override
void
initState
()
{
DioUtil
.
getInstance
().
setProxy
(
'172.30.9.253'
);
super
.
initState
();
_model
.
plan_id
=
widget
.
planId
;
_model
.
init
(()
{
...
...
@@ -340,8 +341,8 @@ class LevelTwoState extends BaseState<LevelTwoPage>
mainAxisSize:
MainAxisSize
.
min
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
<
Widget
>[
baseText
(
element
.
attr
Nam
e
,
14
,
Color
(
0xff282828
),
bold:
true
),
baseText
(
element
.
attr
Valu
e
,
11
,
Color
(
0xff999999
)),
baseText
(
element
.
attr
Valu
e
,
14
,
Color
(
0xff282828
),
bold:
true
),
baseText
(
element
.
attr
Nam
e
,
11
,
Color
(
0xff999999
)),
],
),
),
...
...
@@ -362,7 +363,7 @@ class LevelTwoState extends BaseState<LevelTwoPage>
),
width:
double
.
maxFinite
,
height:
62
,
margin:
EdgeInsets
.
only
(
left:
15
,
right:
15
,
bottom:
20
),
margin:
EdgeInsets
.
only
(
left:
15
,
right:
15
,
bottom:
12
),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
list
,
...
...
@@ -373,6 +374,7 @@ class LevelTwoState extends BaseState<LevelTwoPage>
Widget
explain
()
{
List
<
Widget
>
list
=
[];
list
.
add
(
Container
(
margin:
EdgeInsets
.
only
(
bottom:
4
),
height:
31
,
child:
Row
(
children:
<
Widget
>[
...
...
@@ -399,12 +401,12 @@ class LevelTwoState extends BaseState<LevelTwoPage>
if
(
_model
.
planoverItem
!=
null
)
{
_model
.
planoverItem
.
explanationAttrs
.
forEach
((
element
)
{
list
.
add
(
Container
(
margin:
EdgeInsets
.
only
(
bottom:
1
5
),
margin:
EdgeInsets
.
only
(
bottom:
1
0
),
child:
Row
(
children:
<
Widget
>[
Container
(
constraints:
BoxConstraints
(
maxWidth:
5
2
,
maxWidth:
5
4
,
),
child:
Text
(
element
.
attrName
,
...
...
@@ -444,7 +446,7 @@ class LevelTwoState extends BaseState<LevelTwoPage>
});
}
return
Container
(
margin:
EdgeInsets
.
only
(
left:
15
,
right:
15
,
bottom:
20
),
margin:
EdgeInsets
.
only
(
left:
15
,
right:
15
,
bottom:
3
),
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
children:
list
,
...
...
lib/ClueModel/page/mechanismBox/MechanismBoxPage.dart
View file @
733b0c1b
This diff is collapsed.
Click to expand it.
lib/ClueModel/page/mechanismBox/MechanismModel.dart
View file @
733b0c1b
...
...
@@ -2,17 +2,18 @@
* @author lsy
* @date 2020/6/29
**/
import
'dart:math'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_common/commonModel/live/BaseModel.dart'
;
import
'package:flutter_common/commonModel/live/LiveData.dart'
;
import
'package:flutter_common/commonModel/toast/NativeToast.dart'
;
import
'package:gm_flutter/ClueModel/server/api/ClueApi.serv.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/ConsultHospitalsBean.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/LevelOneFeedList.dart'
;
import
'package:gm_flutter/commonModel/net/DioUtil.dart'
;
import
'package:gm_flutter/commonModel/rx/RxDispose.dart'
;
import
'package:gm_flutter/commonModel/util/PrintUtil.dart'
;
import
'package:gm_flutter/commonModel/bean/Pair.dart'
;
import
'package:pull_to_refresh/pull_to_refresh.dart'
;
class
MechanismModel
extends
BaseModel
{
LiveData
<
List
<
String
>>
questionsLive
=
LiveData
();
...
...
@@ -21,6 +22,59 @@ class MechanismModel extends BaseModel {
LiveData
messageLive
=
LiveData
();
RxDispose
rxDispose
=
RxDispose
();
List
<
String
>
doctor_ids
=
new
List
();
List
<
String
>
hospital_ids
=
new
List
();
int
plan_id
;
String
tab_type
;
int
page
=
1
;
LiveData
<
int
>
levelStateLive
=
LiveData
();
LiveData
<
List
<
Hospitals
>>
cardsLive
=
LiveData
();
List
<
Hospitals
>
data
=
[];
void
refreshView
(
bool
clear
,
{
RefreshController
refreshListener
})
{
if
(
clear
)
{
data
.
clear
();
page
=
1
;
}
ClueApiImpl
.
getInstance
()
.
getLevelMechanismList
(
DioUtil
.
getInstance
().
getDio
(),
plan_id
,
page
)
.
listen
((
event
)
{
if
(
event
.
error
==
0
)
{
if
((
event
.
data
.
hospitals
==
null
||
event
.
data
.
hospitals
.
isEmpty
))
{
if
(
page
==
1
)
{
levelStateLive
.
notifyView
(
EMPTY
);
}
else
{
cardsLive
.
notifyView
([]);
}
}
else
{
if
(
page
==
1
)
{
for
(
var
i
=
0
;
i
<
event
.
data
.
hospitals
.
length
;
i
++)
{
if
(
i
<
3
)
{
event
.
data
.
hospitals
[
i
].
isCheck
=
true
;
doctor_ids
.
add
(
event
.
data
.
hospitals
[
i
].
doctorId
);
hospital_ids
.
add
(
event
.
data
.
hospitals
[
i
].
hospitalId
);
}
}
}
data
.
addAll
(
event
.
data
.
hospitals
);
cardsLive
.
notifyView
(
data
);
levelStateLive
.
notifyView
(
ENDLOADING
);
}
}
else
{
NativeToast
.
showNativeToast
(
event
.
message
);
levelStateLive
.
notifyView
(
FAIL
);
}
})
.
addToDispose
(
rxDispose
)
.
onError
((
err
)
{
PrintUtil
.
printBug
(
err
);
levelStateLive
.
notifyView
(
FAIL
);
});
}
getQuestions
(
int
plan_id
)
{
ClueApiImpl
.
getInstance
()
.
getConsultQuestions
(
DioUtil
.
getInstance
().
getDio
(),
plan_id
)
...
...
@@ -42,11 +96,11 @@ class MechanismModel extends BaseModel {
});
}
sendMessage
(
String
doctor_ids
,
String
question
,
int
plan_id
,
Function
(
int
state
)
func
)
{
sendMessage
(
String
doctor_ids
,
String
hospital_ids
,
String
question
,
int
plan_id
,
Function
(
int
state
)
func
)
{
ClueApiImpl
.
getInstance
()
.
sendMessage
(
DioUtil
.
getInstance
().
getDio
(),
doctor_ids
,
question
,
plan_id
)
.
sendMessage
(
DioUtil
.
getInstance
().
getDio
(),
doctor_ids
,
hospital_ids
,
question
,
plan_id
)
.
listen
((
event
)
{
print
(
event
.
toJson
());
if
(
event
.
error
==
0
)
{
...
...
@@ -67,5 +121,12 @@ class MechanismModel extends BaseModel {
questionsLive
.
dispost
();
stateLive
.
dispost
();
rxDispose
.
dispose
();
levelStateLive
.
dispost
();
cardsLive
.
dispost
();
}
void
loadMore
()
{
page
++;
refreshView
(
false
);
}
}
lib/ClueModel/server/api/ClueApi.dart
View file @
733b0c1b
...
...
@@ -6,6 +6,7 @@ import 'package:flutter_common/Annotations/anno/Get.dart';
import
'package:flutter_common/Annotations/anno/Post.dart'
;
import
'package:flutter_common/Annotations/anno/Query.dart'
;
import
'package:flutter_common/Annotations/anno/ServiceCenter.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/ConsultHospitalsBean.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/ConsultQuestionsBean.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/LevelOneFeedList.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/PlanBarBean.dart'
;
...
...
@@ -31,6 +32,10 @@ abstract class ClueApi {
LevelOneFeedList
getLevelOneList
(
@Query
(
"plan_id"
)
int
plan_id
,
@Query
(
"tab_type"
)
String
tab_type
,
@Query
(
"page"
)
int
page
);
@Get
(
"api/janus/plans/consult_hospitals"
)
ConsultHospitalsBean
getLevelMechanismList
(
@Query
(
"plan_id"
)
int
plan_id
,
@Query
(
"page"
)
int
page
);
@Get
(
"api/janus/plans/plan_compare"
)
PlanCompareDetail
getPlanCompareDetail
(
@Query
(
"plan_ids"
)
String
planIds
);
...
...
@@ -52,8 +57,11 @@ abstract class ClueApi {
ConsultQuestionsBean
getConsultQuestions
(
@Query
(
"plan_id"
)
int
plan_id
);
@Post
(
"api/janus/plans/plan_consult"
)
PlanConsultBean
sendMessage
(
@Query
(
"doctor_ids"
)
List
<
int
>
doctor_ids
,
@Query
(
"question"
)
String
question
,
@Query
(
"plan_id"
)
int
plan_id
);
PlanConsultBean
sendMessage
(
@Query
(
"doctor_ids"
)
String
doctor_ids
,
@Query
(
"hospital_ids"
)
String
hospital_ids
,
@Query
(
"question"
)
String
question
,
@Query
(
"plan_id"
)
int
plan_id
);
@Get
(
"api/janus/plans/rank"
)
PlanBarBean
getPlanBar
(
@Query
(
"rank_type"
)
String
rank_type
);
...
...
lib/ClueModel/server/api/ClueApi.serv.dart
View file @
733b0c1b
...
...
@@ -17,6 +17,7 @@ import 'package:flutter/foundation.dart';
import
'package:gm_flutter/ClueModel/server/entity/ProjectDetailsItem.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/PlansCompareFeed.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/LevelOneFeedList.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/ConsultHospitalsBean.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/PlanCompareDetail.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/PlanBean.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/PlanFeedBean.dart'
;
...
...
@@ -89,6 +90,23 @@ class ClueApiImpl {
});
}
Stream
<
ConsultHospitalsBean
>
getLevelMechanismList
(
Dio
_dio
,
int
plan_id
,
int
page
)
{
return
Stream
.
fromFuture
(
get
(
_dio
,
'api/janus/plans/consult_hospitals'
,
data:
{
'plan_id'
:
plan_id
,
'page'
:
page
,
})).
flatMap
((
value
)
{
if
(
value
!=
null
&&
(
value
.
statusCode
>=
200
&&
value
.
statusCode
<
300
))
{
return
Stream
.
fromFuture
(
compute
(
parseConsultHospitalsBean
,
value
.
toString
()));
}
else
{
throw
Exception
(
"--未知网络错误--"
);
}
});
}
Stream
<
PlanCompareDetail
>
getPlanCompareDetail
(
Dio
_dio
,
String
planIds
)
{
return
Stream
.
fromFuture
(
get
(
_dio
,
'api/janus/plans/plan_compare'
,
data:
{
'plan_ids'
:
planIds
,
...
...
@@ -159,10 +177,11 @@ class ClueApiImpl {
});
}
Stream
<
PlanConsultBean
>
sendMessage
(
Dio
_dio
,
String
doctor
_ids
,
String
question
,
int
plan_id
)
{
Stream
<
PlanConsultBean
>
sendMessage
(
Dio
_dio
,
String
doctor_ids
,
String
hospital
_ids
,
String
question
,
int
plan_id
)
{
return
Stream
.
fromFuture
(
post
(
_dio
,
'api/janus/plans/plan_consult'
,
data:
{
'doctor_ids'
:
doctor_ids
,
'hospital_ids'
:
hospital_ids
,
'question'
:
question
,
'plan_id'
:
plan_id
,
})).
flatMap
((
value
)
{
...
...
@@ -372,6 +391,10 @@ LevelOneFeedList parseLevelOneFeedList(String value) {
return
LevelOneFeedList
.
fromJson
(
json
.
decode
(
value
));
}
ConsultHospitalsBean
parseConsultHospitalsBean
(
String
value
)
{
return
ConsultHospitalsBean
.
fromJson
(
json
.
decode
(
value
));
}
PlanCompareDetail
parsePlanCompareDetail
(
String
value
)
{
return
PlanCompareDetail
.
fromJson
(
json
.
decode
(
value
));
}
...
...
lib/ClueModel/server/entity/ConsultHospitalsBean.dart
0 → 100644
View file @
733b0c1b
class
ConsultHospitalsBean
{
int
error
;
String
message
;
Map
extra
;
Map
errorExtra
;
UserType
userType
;
Data
data
;
ConsultHospitalsBean
(
{
this
.
error
,
this
.
message
,
this
.
extra
,
this
.
errorExtra
,
this
.
userType
,
this
.
data
});
ConsultHospitalsBean
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
error
=
json
[
'error'
];
message
=
json
[
'message'
];
extra
=
json
[
'extra'
];
errorExtra
=
json
[
'error_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
;
data
[
'error_extra'
]
=
this
.
errorExtra
;
if
(
this
.
userType
!=
null
)
{
data
[
'user_type'
]
=
this
.
userType
.
toJson
();
}
if
(
this
.
data
!=
null
)
{
data
[
'data'
]
=
this
.
data
.
toJson
();
}
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
;
}
}
class
Data
{
List
<
Hospitals
>
hospitals
;
Data
({
this
.
hospitals
});
Data
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
if
(
json
[
'hospitals'
]
!=
null
)
{
hospitals
=
new
List
<
Hospitals
>();
json
[
'hospitals'
].
forEach
((
v
)
{
hospitals
.
add
(
new
Hospitals
.
fromJson
(
v
));
});
}
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
if
(
this
.
hospitals
!=
null
)
{
data
[
'hospitals'
]
=
this
.
hospitals
.
map
((
v
)
=>
v
.
toJson
()).
toList
();
}
return
data
;
}
}
class
Hospitals
{
String
hospitalId
;
String
doctorId
;
String
portrait
;
String
name
;
String
minPrice
;
String
maxPrice
;
String
star
;
String
address
;
String
consultType
;
String
messageUrl
;
bool
isCheck
=
false
;
Hospitals
(
{
this
.
hospitalId
,
this
.
doctorId
,
this
.
portrait
,
this
.
name
,
this
.
minPrice
,
this
.
maxPrice
,
this
.
star
,
this
.
address
,
this
.
consultType
,
this
.
messageUrl
});
Hospitals
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
hospitalId
=
json
[
'hospital_id'
];
doctorId
=
json
[
'doctor_id'
];
portrait
=
json
[
'portrait'
];
name
=
json
[
'name'
];
minPrice
=
json
[
'min_price'
];
maxPrice
=
json
[
'max_price'
];
star
=
json
[
'star'
];
address
=
json
[
'address'
];
consultType
=
json
[
'consult_type'
];
messageUrl
=
json
[
'message_url'
];
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
data
[
'hosiptal_id'
]
=
this
.
hospitalId
;
data
[
'doctor_id'
]
=
this
.
doctorId
;
data
[
'portrait'
]
=
this
.
portrait
;
data
[
'name'
]
=
this
.
name
;
data
[
'min_price'
]
=
this
.
minPrice
;
data
[
'max_price'
]
=
this
.
maxPrice
;
data
[
'star'
]
=
this
.
star
;
data
[
'address'
]
=
this
.
address
;
data
[
'consult_type'
]
=
this
.
consultType
;
data
[
'message_url'
]
=
this
.
messageUrl
;
return
data
;
}
}
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