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
f3daabf2
Commit
f3daabf2
authored
Jul 02, 2020
by
杜欣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
二级方案
parent
8c323111
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
610 additions
and
136 deletions
+610
-136
icon-check.png
assets/icon-check.png
+0
-0
icon-checked.png
assets/icon-checked.png
+0
-0
LevelTwoModel.dart
lib/ClueModel/page/levelTwo/LevelTwoModel.dart
+17
-14
LevelTwoPage.dart
lib/ClueModel/page/levelTwo/LevelTwoPage.dart
+48
-22
MechanismBoxPage.dart
lib/ClueModel/page/mechanismBox/MechanismBoxPage.dart
+147
-93
MechanismModel.dart
lib/ClueModel/page/mechanismBox/MechanismModel.dart
+37
-0
ClueApi.dart
lib/ClueModel/server/api/ClueApi.dart
+22
-7
ClueApi.serv.dart
lib/ClueModel/server/api/ClueApi.serv.dart
+61
-0
ConsultQuestionsBean.dart
lib/ClueModel/server/entity/ConsultQuestionsBean.dart
+69
-0
PlanOverviewBean.dart
lib/ClueModel/server/entity/PlanOverviewBean.dart
+209
-0
No files found.
assets/icon-check.png
0 → 100644
View file @
f3daabf2
952 Bytes
assets/icon-checked.png
0 → 100644
View file @
f3daabf2
1.03 KB
lib/ClueModel/page/levelTwo/LevelTwoModel.dart
View file @
f3daabf2
...
...
@@ -10,6 +10,7 @@ import 'package:gm_flutter/ClueModel/server/entity/LevelOneFeedList.dart';
import
'package:gm_flutter/commonModel/GMBase.dart'
;
import
'package:gm_flutter/commonModel/bean/Pair.dart'
;
import
'package:gm_flutter/commonModel/rx/RxDispose.dart'
;
import
'package:gm_flutter/commonModel/util/PrintUtil.dart'
;
import
'package:pull_to_refresh/pull_to_refresh.dart'
;
class
LevelTwoModel
extends
BaseModel
{
...
...
@@ -24,9 +25,9 @@ class LevelTwoModel extends BaseModel {
LiveData
<
Pair
<
int
,
List
<
Cards
>>>
cardsLive
=
LiveData
();
Map
<
int
,
List
<
Cards
>>
data
=
new
Map
();
List
list
=
[
"
plan"
,
"hospital"
,
"doctor"
,
"diary
"
];
List
pageList
=
[
1
,
1
,
1
,
1
];
List
pageHeightList
=
[
1
18
,
149
,
118
,
118
];
List
list
=
[
"
hospital"
,
"doctor
"
];
List
pageList
=
[
1
,
1
];
List
pageHeightList
=
[
1
49
,
118
];
void
refreshView
(
bool
clear
,
{
RefreshController
refreshListener
})
{
Future
.
delayed
(
Duration
(
seconds:
1
),
()
{
...
...
@@ -57,17 +58,19 @@ class LevelTwoModel extends BaseModel {
cardsLive
.
notifyView
(
Pair
(
ENDLOADING
,
data
));
});
// int index = currentIndex;
// if (clear) {
// data.clear();
// pageList = [1, 1, 1, 1];
// }
// ClueApiImpl.getInstance()
// .getLevelOneList(
// DioUtil.getInstance().getDio(), 123, list[index], pageList[index])
// .listen((event) {})
// .addToDispose(rxDispose)
// .onError((err) {});
int
index
=
currentIndex
;
if
(
clear
)
{
data
.
clear
();
pageList
=
[
1
,
1
];
}
ClueApiImpl
.
getInstance
()
.
getLevelOneList
(
DioUtil
.
getInstance
().
getDio
(),
123
,
list
[
index
],
pageList
[
index
])
.
listen
((
event
)
{})
.
addToDispose
(
rxDispose
)
.
onError
((
err
)
{
PrintUtil
.
printBug
(
err
);
});
}
int
currentIndex
=
0
;
...
...
lib/ClueModel/page/levelTwo/LevelTwoPage.dart
View file @
f3daabf2
...
...
@@ -6,10 +6,8 @@
import
'dart:math'
;
import
'package:cached_network_image/cached_network_image.dart'
;
import
'package:flutter/gestures.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_common/commonModel/picker/base/BaseBottomPicker.dart'
;
import
'package:gm_flutter/ClueModel/page/levelOne/LevelOneItem.dart'
;
import
'package:gm_flutter/ClueModel/page/levelTwo/LevelTwoModel.dart'
;
import
'package:gm_flutter/ClueModel/page/mechanismBox/MechanismBoxPage.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/LevelOneFeedList.dart'
;
...
...
@@ -21,6 +19,11 @@ import 'package:pull_to_refresh/pull_to_refresh.dart';
import
'package:gm_flutter/commonModel/bean/Pair.dart'
;
class
LevelTwoPage
extends
StatefulWidget
{
@required
final
int
plan_id
;
const
LevelTwoPage
({
Key
key
,
this
.
plan_id
})
:
super
(
key:
key
);
@override
_LevelTwoPageState
createState
()
=>
_LevelTwoPageState
();
}
...
...
@@ -49,7 +52,21 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage>
@override
Widget
buildItem
(
BuildContext
context
)
{
return
Scaffold
(
body:
Stack
(
body:
StreamBuilder
<
bool
>(
stream:
_model
.
loadingLive
.
stream
,
initialData:
true
,
builder:
(
c
,
data
)
{
if
(!
data
.
data
)
{
return
loadingItem
();
}
else
{
return
home
();
}
},
));
}
Widget
home
()
{
return
Stack
(
children:
<
Widget
>[
CustomScrollView
(
slivers:
<
Widget
>[
SliverAppBar
(
...
...
@@ -81,14 +98,11 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage>
tabs:
<
Widget
>[
Tab
(
text:
'医院'
),
Tab
(
text:
'医生'
)]),
),
),
SliverFillRemaining
(
child:
TabBarView
(
controller:
this
.
tabController
,
children:
<
Widget
>[
pages
(),
pages
()]))
SliverFillRemaining
(
child:
pages
())
]),
Positioned
(
left:
0
,
right:
0
,
bottom:
0
,
child:
bottomWidget
())
],
)
)
;
);
}
Widget
good
()
{
...
...
@@ -277,7 +291,7 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage>
behavior:
HitTestBehavior
.
opaque
,
onTap:
()
{
BaseBottomPicker
()
..
setPicker
(
MechanismBox
())
..
setPicker
(
MechanismBox
(
12
))
..
show
(
context
);
},
child:
Container
(
...
...
@@ -312,20 +326,28 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage>
}
Widget
pages
()
{
return
StreamBuilder
<
Pair
<
int
,
List
<
Cards
>>>(
stream:
_model
.
cardsLive
.
stream
,
initialData:
_model
.
cardsLive
.
data
??
Pair
(
LOADING
,
null
),
builder:
(
c
,
data
)
{
return
Container
(
margin:
EdgeInsets
.
only
(
top:
5
),
width:
double
.
maxFinite
,
child:
ListView
.
builder
(
child:
TabBarView
(
controller:
tabController
,
children:
_model
.
data
[
tabController
.
index
].
map
((
e
)
{
return
ListView
.
builder
(
physics:
NeverScrollableScrollPhysics
(),
itemBuilder:
(
c
,
index
)
{
return
Text
(
'
$index
'
);
},
itemCount:
5
,
));
);
}).
toList
()));
});
}
}
Widget
DoctorItem
(
BuildContext
context
,
cards
)
{
Widget
DoctorItem
(
BuildContext
context
,
cards
)
{
if
(
cards
.
doctor
==
null
&&
isDebug
)
{
throw
new
Exception
();
}
...
...
@@ -354,7 +376,8 @@ Widget DoctorItem(BuildContext context, cards) {
mainAxisSize:
MainAxisSize
.
min
,
crossAxisAlignment:
CrossAxisAlignment
.
end
,
children:
<
Widget
>[
baseText
(
cards
.
doctor
.
name
,
15
,
Color
(
0xff333333
),
bold:
true
),
baseText
(
cards
.
doctor
.
name
,
15
,
Color
(
0xff333333
),
bold:
true
),
Container
(
margin:
EdgeInsets
.
only
(
left:
4
),
child:
baseText
(
cards
.
doctor
.
name
,
15
,
Color
(
0xff333333
),
...
...
@@ -390,9 +413,9 @@ Widget DoctorItem(BuildContext context, cards) {
),
),
);
}
}
Widget
HospitalItem
(
BuildContext
context
,
cards
)
{
Widget
HospitalItem
(
BuildContext
context
,
cards
)
{
if
(
cards
.
hospital
==
null
&&
isDebug
)
{
throw
new
Exception
();
}
...
...
@@ -460,34 +483,37 @@ Widget HospitalItem(BuildContext context, cards) {
],
),
));
}
}
Widget
lowPriceWidget
(
)
{
Widget
lowPriceWidget
()
{
return
GestureDetector
(
behavior:
HitTestBehavior
.
opaque
,
child:
Container
(
width:
122
,
height:
37
,
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
18.5
),
color:
Color
(
0xffFFF5F5
)),
borderRadius:
BorderRadius
.
circular
(
18.5
),
color:
Color
(
0xffFFF5F5
)),
alignment:
Alignment
.
center
,
child:
baseText
(
"获取底价"
,
14
,
Color
(
0xffFF5963
),
bold:
true
),
),
);
}
}
Widget
askWidget
(
)
{
Widget
askWidget
()
{
return
GestureDetector
(
behavior:
HitTestBehavior
.
opaque
,
child:
Container
(
width:
122
,
height:
37
,
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
18.5
),
color:
Color
(
0xffEEFDFD
)),
borderRadius:
BorderRadius
.
circular
(
18.5
),
color:
Color
(
0xffEEFDFD
)),
alignment:
Alignment
.
center
,
child:
baseText
(
"咨询"
,
14
,
Color
(
0xff3FB5AF
),
bold:
true
),
),
);
}
}
class
StickyTabBarDelegate
extends
SliverPersistentHeaderDelegate
{
...
...
lib/ClueModel/page/mechanismBox/MechanismBoxPage.dart
View file @
f3daabf2
import
'package:cached_network_image/cached_network_image.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_common/commonModel/picker/base/BaseBottomPicker.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/ConsultQuestionsBean.dart'
;
import
'package:gm_flutter/ClueModel/view/FiveStarView.dart'
;
import
'package:gm_flutter/commonModel/base/BaseComponent.dart'
;
import
'package:gm_flutter/commonModel/base/BaseUtil.dart'
;
import
'package:gm_flutter/ClueModel/page/mechanismBox/MechanismModel.dart'
;
class
MechanismBox
implements
IBottomPicker
{
VoidCallback
dismissCall
;
TextEditingController
textController
=
TextEditingController
();
MechanismModel
_model
=
new
MechanismModel
();
@required
final
int
plan_id
;
MechanismBox
(
this
.
plan_id
)
:
super
();
@override
initState
(
dismissCall
,
BuildContext
context
)
{
this
.
dismissCall
=
dismissCall
;
_model
.
getQuestions
(
plan_id
);
}
Widget
build
(
BuildContext
context
)
{
...
...
@@ -19,15 +34,30 @@ class MechanismBox implements IBottomPicker {
width:
mq
.
size
.
width
,
height:
mq
.
size
.
height
-
140
,
color:
Colors
.
white
,
child:
Stack
(
child:
Column
(
mainAxisSize:
MainAxisSize
.
max
,
children:
<
Widget
>[
Container
(
title
(
mq
),
mechanismList
(
mq
,
keyHeight
),
bottomMessage
()
],
)),
);
}
@override
void
dispose
()
{
textController
.
dispose
();
}
// 弹窗标题
Widget
title
(
mq
)
{
return
Container
(
margin:
EdgeInsets
.
only
(
left:
20
,
right:
20
),
width:
mq
.
size
.
width
,
decoration:
BoxDecoration
(
border:
Border
(
bottom:
BorderSide
(
width:
1
,
color:
Color
(
0xffE5E5E5
)))),
border:
Border
(
bottom:
BorderSide
(
width:
1
,
color:
Color
(
0xffE5E5E5
)))),
height:
50
,
child:
Stack
(
alignment:
Alignment
.
center
,
...
...
@@ -56,38 +86,107 @@ class MechanismBox implements IBottomPicker {
))
],
),
),
Container
(
height:
mq
.
size
.
height
-
140
-
96
-
50
,
);
}
// 机构列表
Widget
mechanismList
(
mq
,
keyHeight
)
{
return
Container
(
height:
mq
.
size
.
height
-
140
-
96
-
50
-
keyHeight
,
width:
mq
.
size
.
width
,
margin:
EdgeInsets
.
only
(
top:
50
),
padding:
EdgeInsets
.
only
(
left:
20
,
right:
20
),
padding:
EdgeInsets
.
only
(
left:
15
,
right:
15
),
child:
ListView
.
separated
(
itemCount:
100
,
itemBuilder:
(
BuildContext
context
,
int
index
)
{
return
ListTile
(
title:
Text
(
"
$index
"
)
);
return
HospitalItem
(
context
,
index
);
},
separatorBuilder:
(
BuildContext
context
,
int
index
)
{
return
Divider
(
color:
Color
(
0xffE5E5E5
));
},
)),
));
}
// 机构卡片
Widget
HospitalItem
(
BuildContext
context
,
int
index
)
{
return
GestureDetector
(
onTap:
()
{},
child:
Container
(
height:
94.5
,
child:
Stack
(
children:
<
Widget
>[
Positioned
(
bottom:
keyHeight
==
0
?
0
:
keyHeight
,
left:
0
,
width:
double
.
maxFinite
,
height:
96
,
top:
35
,
child:
Container
(
height:
17
,
width:
17
,
child:
true
?
Image
.
asset
(
"assets/icon-checked.png"
)
:
Image
.
asset
(
"assets/icon-check.png"
),
)),
Positioned
(
left:
32
,
top:
21
,
child:
Container
(
width:
45
,
height:
45
,
child:
ClipOval
(
child:
CachedNetworkImage
(
// imageUrl: cards.hospital.portrait,
imageUrl:
'https://img1.gamersky.com/image2019/07/20190725_ll_red_136_2/gamersky_07small_14_201972510258D0.jpg'
,
),
),
),
),
Positioned
(
left:
89
,
top:
17.5
,
// child: baseText(cards.hospital.name, 15, Color(0xff333333),
// bold: true),
child:
baseText
(
'22222'
,
15
,
Color
(
0xff333333
),
bold:
true
),
),
Positioned
(
top:
42.5
,
right:
0
,
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
end
,
mainAxisSize:
MainAxisSize
.
min
,
children:
<
Widget
>[
baseText
(
"¥"
,
12
,
Color
(
0xffFF5963
)),
baseText
(
"
${1}
-
${2}
"
,
15
,
Color
(
0xffFF5963
)),
],
),
),
Positioned
(
bottom:
21
,
left:
89
,
// child: baseText(cards.hospital.address, 12, Color(0xff666666)),
child:
baseText
(
'dsssssssss'
,
12
,
Color
(
0xff666666
)),
),
Positioned
(
left:
89
,
top:
38.5
,
child:
FiveStarView
(
2
,
5
),
)
],
),
));
}
// 底部输入框部分
Widget
bottomMessage
()
{
return
Container
(
height:
96
,
color:
Color
(
0xffF9F8FB
),
child:
Column
(
children:
<
Widget
>[
Container
(
height:
25
,
color:
Colors
.
black
,
width:
double
.
maxFinite
,
margin:
EdgeInsets
.
only
(
top:
12
),
child:
ListVie
w
(
scrollDirection:
Axis
.
horizontal
,
//横向滚动
child:
Ro
w
(
mainAxisSize:
MainAxisSize
.
max
,
children:
<
Widget
>[
Container
(
margin:
EdgeInsets
.
only
(
left:
15
,
right:
8
),
...
...
@@ -99,7 +198,19 @@ class MechanismBox implements IBottomPicker {
color:
Color
(
0xff666666
),
fontSize:
12
),
)),
Container
(
StreamBuilder
<
ConsultQuestionsBean
>(
stream:
_model
.
questionsLive
.
stream
,
initialData:
_model
.
questionsLive
.
data
,
builder:
(
c
,
data
)
{
List
<
String
>
questions
=
data
.
data
.
data
.
questions
;
return
ListView
.
builder
(
scrollDirection:
Axis
.
horizontal
,
//横向滚动
itemBuilder:
(
c
,
index
)
{
return
GestureDetector
(
onTap:
()
{
textController
.
text
+=
questions
[
index
];
},
child:
Container
(
height:
25
,
margin:
EdgeInsets
.
only
(
right:
12
),
padding:
EdgeInsets
.
only
(
left:
8
,
right:
8
),
...
...
@@ -109,77 +220,26 @@ class MechanismBox implements IBottomPicker {
color:
Color
(
0xffffffff
),
borderRadius:
BorderRadius
.
circular
(
20
)),
child:
Text
(
'有优惠活动吗?'
,
questions
[
index
]
,
style:
TextStyle
(
fontSize:
12
,
color:
Color
(
0xff666666
),
height:
1.8
),
),
),
Container
(
height:
25
,
margin:
EdgeInsets
.
only
(
right:
12
),
padding:
EdgeInsets
.
only
(
left:
8
,
right:
8
),
decoration:
BoxDecoration
(
border:
Border
.
all
(
color:
Color
(
0xffE5E5E5
),
width:
0.5
),
color:
Color
(
0xffffffff
),
borderRadius:
BorderRadius
.
circular
(
20
)),
child:
Text
(
'111有优惠活动吗?'
,
style:
TextStyle
(
fontSize:
12
,
color:
Color
(
0xff666666
),
height:
1.8
),
)),
Container
(
height:
25
,
margin:
EdgeInsets
.
only
(
right:
12
),
padding:
EdgeInsets
.
only
(
left:
8
,
right:
8
),
decoration:
BoxDecoration
(
border:
Border
.
all
(
color:
Color
(
0xffE5E5E5
),
width:
0.5
),
color:
Color
(
0xffffffff
),
borderRadius:
BorderRadius
.
circular
(
20
)),
child:
Text
(
'111有优惠活动吗?'
,
style:
TextStyle
(
fontSize:
12
,
color:
Color
(
0xff666666
),
height:
1.8
),
)),
Container
(
height:
25
,
margin:
EdgeInsets
.
only
(
right:
12
),
padding:
EdgeInsets
.
only
(
left:
8
,
right:
8
),
decoration:
BoxDecoration
(
border:
Border
.
all
(
color:
Color
(
0xffE5E5E5
),
width:
0.5
),
color:
Color
(
0xffffffff
),
borderRadius:
BorderRadius
.
circular
(
20
)),
child:
Text
(
'111有优惠活动吗?'
,
style:
TextStyle
(
fontSize:
12
,
color:
Color
(
0xff666666
),
height:
1.8
),
))
);
},
itemCount:
questions
.
length
,
);
}),
],
),
),
)),
Container
(
height:
35
,
margin:
EdgeInsets
.
only
(
top:
12
,
left:
15
,
right:
15
),
width:
double
.
maxFinite
,
margin:
EdgeInsets
.
only
(
top:
12
,
left:
15
,
right:
15
),
decoration:
BoxDecoration
(
border:
Border
.
all
(
color:
Color
(
0xffE5E5E5
),
width:
0.5
),
border:
Border
.
all
(
color:
Color
(
0xffE5E5E5
),
width:
0.5
),
color:
Color
(
0xffffffff
),
borderRadius:
BorderRadius
.
circular
(
35
)),
child:
TextField
(
...
...
@@ -187,20 +247,14 @@ class MechanismBox implements IBottomPicker {
keyboardType:
TextInputType
.
text
,
textInputAction:
TextInputAction
.
send
,
onSubmitted:
(
txt
)
{},
style:
TextStyle
(
fontSize:
12
),
maxLines:
1
,
decoration:
InputDecoration
(
contentPadding:
EdgeInsets
.
all
(
16.0
),
labelText:
'文案文案文案不知道文案是啥'
,
border:
InputBorder
.
none
)),
)
],
)))
contentPadding:
EdgeInsets
.
only
(
left:
16
,
top:
0
,
bottom:
12
,
right:
16
),
hintText:
'请输入您想了解的问题'
,
border:
InputBorder
.
none
)))
],
)),
);
}
@override
void
dispose
()
{
textController
.
dispose
();
));
}
}
lib/ClueModel/page/mechanismBox/MechanismModel.dart
0 → 100644
View file @
f3daabf2
/*
* @author lsy
* @date 2020/6/29
**/
import
'package:flutter/material.dart'
;
import
'package:flutter_common/commonModel/live/BaseModel.dart'
;
import
'package:flutter_common/commonModel/live/LiveData.dart'
;
import
'package:gm_flutter/ClueModel/server/api/ClueApi.serv.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/ConsultQuestionsBean.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'
;
class
MechanismModel
extends
BaseModel
{
LiveData
<
ConsultQuestionsBean
>
questionsLive
=
LiveData
();
RxDispose
rxDispose
=
RxDispose
();
getQuestions
(
int
plan_id
)
{
ClueApiImpl
.
getInstance
()
.
getConsultQuestions
(
DioUtil
.
getInstance
().
getDio
(),
plan_id
)
.
listen
((
event
)
{
print
(
'dadsadsa'
);
print
(
event
.
data
.
questions
.
toList
());
print
(
'dadsadsa'
);
questionsLive
.
data
=
event
;
})
.
addToDispose
(
rxDispose
)
.
onError
((
err
)
{
PrintUtil
.
printBug
(
err
);
});
}
@override
void
dispose
()
{
questionsLive
.
dispost
();
}
}
lib/ClueModel/server/api/ClueApi.dart
View file @
f3daabf2
...
...
@@ -3,14 +3,19 @@
* @date 2020/6/28
**/
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/ConsultQuestionsBean.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/LevelOneFeedList.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/PlanCompareDetail.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/PlanOverviewBean.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/PlansCompareFeed.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/ProjectDetailsItem.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/PlanBean.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/PlanFeedBean.dart'
;
import
'package:gm_flutter/commonModel/net/Responce/SimpleResponce.dart'
;
@ServiceCenter
()
abstract
class
ClueApi
{
@Get
(
"/api/janus/plans/plan_detail"
)
...
...
@@ -32,12 +37,22 @@ abstract class ClueApi {
@Get
(
"api/janus/plans/feed"
)
PlanFeedBean
getPlanFeed
(
@Query
(
"tag_id"
)
String
tag_id
,
@Query
(
"order_by"
)
String
order_by
,
@Query
(
"current_city_id"
)
String
current_city_id
,
@Query
(
"min_price"
)
String
min_price
,
@Query
(
"max_price"
)
String
max_price
,
@Query
(
"rank_type"
)
String
rank_type
,
@Query
(
"page"
)
int
page
,
@Query
(
"tag_id"
)
String
tag_id
,
@Query
(
"order_by"
)
String
order_by
,
@Query
(
"current_city_id"
)
String
current_city_id
,
@Query
(
"min_price"
)
String
min_price
,
@Query
(
"max_price"
)
String
max_price
,
@Query
(
"rank_type"
)
String
rank_type
,
@Query
(
"page"
)
int
page
,
);
@Get
(
"/api/janus/plans/plan_overview"
)
PlanOverviewBean
getPlanOverviewBean
(
@Query
(
"plan_id"
)
int
plan_id
);
@Get
(
"/api/janus/plans/consult_questions"
)
ConsultQuestionsBean
getConsultQuestions
(
@Query
(
"plan_id"
)
int
plan_id
);
@Post
(
"/api/janus/plans/plan_consult"
)
SimpleResponce
sendMessage
(
@Query
(
"doctor_ids"
)
List
<
int
>
doctor_ids
,
@Query
(
"question"
)
String
question
,
@Query
(
"plan_id"
)
int
plan_id
);
}
lib/ClueModel/server/api/ClueApi.serv.dart
View file @
f3daabf2
...
...
@@ -20,6 +20,9 @@ import 'package:gm_flutter/ClueModel/server/entity/LevelOneFeedList.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'
;
import
'package:gm_flutter/ClueModel/server/entity/PlanOverviewBean.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/ConsultQuestionsBean.dart'
;
import
'package:gm_flutter/commonModel/net/Responce/SimpleResponce.dart'
;
const
bool
inProduction
=
const
bool
.
fromEnvironment
(
"dart.vm.product"
);
...
...
@@ -139,6 +142,52 @@ class ClueApiImpl {
});
}
Stream
<
PlanOverviewBean
>
getPlanOverviewBean
(
Dio
_dio
,
int
plan_id
)
{
return
Stream
.
fromFuture
(
get
(
_dio
,
'/api/janus/plans/plan_overview'
,
data:
{
'plan_id'
:
plan_id
,
})).
flatMap
((
value
)
{
if
(
value
!=
null
&&
(
value
.
statusCode
>=
200
&&
value
.
statusCode
<
300
))
{
return
Stream
.
fromFuture
(
compute
(
parsePlanOverviewBean
,
value
.
toString
()));
}
else
{
throw
Exception
(
"--未知网络错误--"
);
}
});
}
Stream
<
ConsultQuestionsBean
>
getConsultQuestions
(
Dio
_dio
,
int
plan_id
)
{
return
Stream
.
fromFuture
(
get
(
_dio
,
'/api/janus/plans/consult_questions'
,
data:
{
'plan_id'
:
plan_id
,
})).
flatMap
((
value
)
{
if
(
value
!=
null
&&
(
value
.
statusCode
>=
200
&&
value
.
statusCode
<
300
))
{
return
Stream
.
fromFuture
(
compute
(
parseConsultQuestionsBean
,
value
.
toString
()));
}
else
{
throw
Exception
(
"--未知网络错误--"
);
}
});
}
Stream
<
SimpleResponce
>
sendMessage
(
Dio
_dio
,
List
<
int
>
doctor_ids
,
String
question
,
int
plan_id
)
{
return
Stream
.
fromFuture
(
post
(
_dio
,
'/api/janus/plans/plan_consult'
,
data:
{
'doctor_ids'
:
doctor_ids
,
'question'
:
question
,
'plan_id'
:
plan_id
,
})).
flatMap
((
value
)
{
if
(
value
!=
null
&&
(
value
.
statusCode
>=
200
&&
value
.
statusCode
<
300
))
{
return
Stream
.
fromFuture
(
compute
(
parseSimpleResponce
,
value
.
toString
()));
}
else
{
throw
Exception
(
"--未知网络错误--"
);
}
});
}
///==================base method==================
Future
<
Response
>
get
(
Dio
_dio
,
url
,
{
data
,
options
,
cancelToken
})
async
{
...
...
@@ -299,3 +348,15 @@ PlanBean parsePlanBean(String value) {
PlanFeedBean
parsePlanFeedBean
(
String
value
)
{
return
PlanFeedBean
.
fromJson
(
json
.
decode
(
value
));
}
PlanOverviewBean
parsePlanOverviewBean
(
String
value
)
{
return
PlanOverviewBean
.
fromJson
(
json
.
decode
(
value
));
}
ConsultQuestionsBean
parseConsultQuestionsBean
(
String
value
)
{
return
ConsultQuestionsBean
.
fromJson
(
json
.
decode
(
value
));
}
SimpleResponce
parseSimpleResponce
(
String
value
)
{
return
SimpleResponce
.
fromJson
(
json
.
decode
(
value
));
}
lib/ClueModel/server/entity/ConsultQuestionsBean.dart
0 → 100644
View file @
f3daabf2
class
ConsultQuestionsBean
{
int
error
;
String
message
;
Null
extra
;
Null
errorExtra
;
UserType
userType
;
Data
data
;
ConsultQuestionsBean
(
{
this
.
error
,
this
.
message
,
this
.
extra
,
this
.
errorExtra
,
this
.
userType
,
this
.
data
});
ConsultQuestionsBean
.
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
<
String
>
questions
;
Data
({
this
.
questions
});
Data
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
questions
=
json
[
'questions'
].
cast
<
String
>();
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
data
[
'questions'
]
=
this
.
questions
;
return
data
;
}
}
lib/ClueModel/server/entity/PlanOverviewBean.dart
0 → 100644
View file @
f3daabf2
class
PlanOverviewBean
{
int
error
;
String
message
;
Null
extra
;
Null
errorExtra
;
UserType
userType
;
Data
data
;
PlanOverviewBean
(
{
this
.
error
,
this
.
message
,
this
.
extra
,
this
.
errorExtra
,
this
.
userType
,
this
.
data
});
PlanOverviewBean
.
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
{
Banner
banner
;
String
name
;
String
positiveRate
;
String
salesCount
;
String
planDescription
;
List
<
OverviewAttrs
>
overviewAttrs
;
List
<
ExplanationAttrs
>
explanationAttrs
;
List
<
Tabs
>
tabs
;
Data
(
{
this
.
banner
,
this
.
name
,
this
.
positiveRate
,
this
.
salesCount
,
this
.
planDescription
,
this
.
overviewAttrs
,
this
.
explanationAttrs
,
this
.
tabs
});
Data
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
banner
=
json
[
'banner'
]
!=
null
?
new
Banner
.
fromJson
(
json
[
'banner'
])
:
null
;
name
=
json
[
'name'
];
positiveRate
=
json
[
'positive_rate'
];
salesCount
=
json
[
'sales_count'
];
planDescription
=
json
[
'plan_description'
];
if
(
json
[
'overview_attrs'
]
!=
null
)
{
overviewAttrs
=
new
List
<
OverviewAttrs
>();
json
[
'overview_attrs'
].
forEach
((
v
)
{
overviewAttrs
.
add
(
new
OverviewAttrs
.
fromJson
(
v
));
});
}
if
(
json
[
'explanation_attrs'
]
!=
null
)
{
explanationAttrs
=
new
List
<
ExplanationAttrs
>();
json
[
'explanation_attrs'
].
forEach
((
v
)
{
explanationAttrs
.
add
(
new
ExplanationAttrs
.
fromJson
(
v
));
});
}
if
(
json
[
'tabs'
]
!=
null
)
{
tabs
=
new
List
<
Tabs
>();
json
[
'tabs'
].
forEach
((
v
)
{
tabs
.
add
(
new
Tabs
.
fromJson
(
v
));
});
}
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
if
(
this
.
banner
!=
null
)
{
data
[
'banner'
]
=
this
.
banner
.
toJson
();
}
data
[
'name'
]
=
this
.
name
;
data
[
'positive_rate'
]
=
this
.
positiveRate
;
data
[
'sales_count'
]
=
this
.
salesCount
;
data
[
'plan_description'
]
=
this
.
planDescription
;
if
(
this
.
overviewAttrs
!=
null
)
{
data
[
'overview_attrs'
]
=
this
.
overviewAttrs
.
map
((
v
)
=>
v
.
toJson
()).
toList
();
}
if
(
this
.
explanationAttrs
!=
null
)
{
data
[
'explanation_attrs'
]
=
this
.
explanationAttrs
.
map
((
v
)
=>
v
.
toJson
()).
toList
();
}
if
(
this
.
tabs
!=
null
)
{
data
[
'tabs'
]
=
this
.
tabs
.
map
((
v
)
=>
v
.
toJson
()).
toList
();
}
return
data
;
}
}
class
Banner
{
String
type
;
String
imageUrl
;
String
videoUrl
;
Banner
({
this
.
type
,
this
.
imageUrl
,
this
.
videoUrl
});
Banner
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
type
=
json
[
'type'
];
imageUrl
=
json
[
'image_url'
];
videoUrl
=
json
[
'video_url'
];
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
data
[
'type'
]
=
this
.
type
;
data
[
'image_url'
]
=
this
.
imageUrl
;
data
[
'video_url'
]
=
this
.
videoUrl
;
return
data
;
}
}
class
OverviewAttrs
{
int
attrId
;
String
attrName
;
String
attrValue
;
OverviewAttrs
({
this
.
attrId
,
this
.
attrName
,
this
.
attrValue
});
OverviewAttrs
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
attrId
=
json
[
'attr_id'
];
attrName
=
json
[
'attr_name'
];
attrValue
=
json
[
'attr_value'
];
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
data
[
'attr_id'
]
=
this
.
attrId
;
data
[
'attr_name'
]
=
this
.
attrName
;
data
[
'attr_value'
]
=
this
.
attrValue
;
return
data
;
}
}
class
ExplanationAttrs
{
int
attrId
;
String
attrName
;
String
attrValue
;
ExplanationAttrs
({
this
.
attrId
,
this
.
attrName
,
this
.
attrValue
});
ExplanationAttrs
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
attrId
=
json
[
'attr_id'
];
attrName
=
json
[
'attr_name'
];
attrValue
=
json
[
'attr_value'
];
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
data
[
'attr_id'
]
=
this
.
attrId
;
data
[
'attr_name'
]
=
this
.
attrName
;
data
[
'attr_value'
]
=
this
.
attrValue
;
return
data
;
}
}
class
Tabs
{
String
tabType
;
String
name
;
Tabs
({
this
.
tabType
,
this
.
name
});
Tabs
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
tabType
=
json
[
'tab_type'
];
name
=
json
[
'name'
];
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
data
[
'tab_type'
]
=
this
.
tabType
;
data
[
'name'
]
=
this
.
name
;
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