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
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
463 additions
and
43 deletions
+463
-43
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
+0
-0
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
This diff is collapsed.
Click to expand it.
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