Commit 320ad415 authored by 林生雨's avatar 林生雨

Merge branch 'featrue/duxin' into 'test'

Featrue/duxin

See merge request !19
parents 0a7d6d5b f8b73bca
/*
* @author lsy
* @author dx
* @date 2020/6/29
**/
import 'dart:async';
......@@ -24,9 +24,12 @@ import 'package:gm_flutter/main.mark.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
class LevelTwoPage extends StatefulWidget {
int planId;
final String PAGE_NAME = "level_two_plan_deatil";
LevelTwoPage(Map<String, dynamic> params) {}
LevelTwoPage(Map<String, dynamic> params) {
planId = params['planId'];
}
@override
State<StatefulWidget> createState() => LevelTwoState();
......@@ -34,7 +37,6 @@ class LevelTwoPage extends StatefulWidget {
class LevelTwoState extends BaseState<LevelTwoPage>
with TickerProviderStateMixin {
int planId = 10;
LevelOneModel _model = new LevelOneModel();
RefreshController _refreshController = RefreshController();
GlobalKey keyTop = new GlobalKey();
......@@ -51,6 +53,7 @@ class LevelTwoState extends BaseState<LevelTwoPage>
void initState() {
DioUtil.getInstance().setProxy("172.30.8.245");
super.initState();
_model.plan_id = widget.planId;
_model.init(() {
_initTabBar();
});
......@@ -175,8 +178,8 @@ class LevelTwoState extends BaseState<LevelTwoPage>
for (int i = 0; i < _model.tabsList.length; i++) {
list.add(extend.NestedScrollViewInnerScrollPositionKeyWidget(
Key("Tab${i}"),
LevelOneList(1,widget.PAGE_NAME,
planId, _model.tabsList[i].tabType, kToolbarHeight + d)));
LevelOneList(1, widget.PAGE_NAME, widget.planId,
_model.tabsList[i].tabType, kToolbarHeight + d)));
}
final double statusBarHeight = MediaQuery.of(context).padding.top;
final double pinnedHeaderHeight = statusBarHeight + kToolbarHeight;
......@@ -208,6 +211,17 @@ class LevelTwoState extends BaseState<LevelTwoPage>
height: 40,
color: Colors.white,
child: baseTabBar(tabController, getTabs(), (index) {
Map<String, dynamic> map = {};
map["page_name"] = "level_two_plan_deatil";
map["referrer"] = "";
map["referrer_id"] = "";
map["referrer_link"] = ["plan_home"];
map["from_tab_name"] = "全部";
map["tab_name"] = index == 0 ? '机构' : '医生';
map["position"] = 1;
RouterCenterImpl()
.findMainRouter()
.buriedEvent("on_click_tab", map);
_model.selectTab(index);
}, scroll: false),
)),
......
......@@ -2,16 +2,25 @@ 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:flutter_common/commonModel/toast/NativeToast.dart';
import 'package:gm_flutter/ClueModel/page/levelOne/LevelOneListModel.dart';
import 'package:gm_flutter/ClueModel/server/entity/LevelOneFeedList.dart';
import 'package:gm_flutter/ClueModel/view/FiveStarView.dart';
import 'package:gm_flutter/commonModel/base/BaseComponent.dart';
import 'package:gm_flutter/ClueModel/page/mechanismBox/MechanismModel.dart';
import 'package:gm_flutter/commonModel/bean/Pair.dart';
import 'package:gm_flutter/main.mark.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
class MechanismBox implements IBottomPicker {
VoidCallback dismissCall;
TextEditingController textController = TextEditingController();
MechanismModel _model = new MechanismModel();
List<int> doctor_ids = new List();
List doctor_ids = new List();
LevelOneListModel _levelModel = LevelOneListModel();
RefreshController refreshController = RefreshController();
Function(String str) refresh;
@required
final int plan_id;
......@@ -20,8 +29,27 @@ class MechanismBox implements IBottomPicker {
@override
initState(dismissCall, BuildContext context) {
Map<String, dynamic> map = {
"business_id": "level_two_plan_compare_deatil",
"page_name": "",
"referrer": "",
"referrer_id": "",
"referrer_link": [],
"referrer_tab_name": "",
"in": "",
"out": "",
"is_push": 1,
"fake": 1,
"is_first": 1
};
RouterCenterImpl().findMainRouter().buriedEvent("page_view", map);
this.dismissCall = dismissCall;
_model.getQuestions(plan_id);
_levelModel.refreshView(true);
refresh = (str) {
_levelModel.stateLive.notifyView(LOADING);
_levelModel.refreshView(true);
};
}
Widget build(BuildContext context) {
......@@ -56,6 +84,9 @@ class MechanismBox implements IBottomPicker {
@override
void dispose() {
textController.dispose();
refreshController.dispose();
_levelModel.dispose();
_model.dispose();
}
setupHome(mq, keyHeight) {
......@@ -114,21 +145,64 @@ class MechanismBox implements IBottomPicker {
height: mq.size.height - 140 - 96 - 50 - keyHeight,
width: mq.size.width,
padding: EdgeInsets.only(left: 15, right: 15),
child: ListView.separated(
itemCount: 100,
itemBuilder: (BuildContext context, int index) {
return HospitalItem(context, index);
},
separatorBuilder: (BuildContext context, int index) {
return Divider(color: Color(0xffE5E5E5));
},
));
child: baseRefreshView(refreshController, () {}, null, null,
customScrollView: CustomScrollView(
// physics: NeverScrollableScrollPhysics(),
physics: ClampingScrollPhysics(),
// shrinkWrap: true,
slivers: <Widget>[
// SliverOverlapInjector(
// handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
// ),
StreamBuilder<List<Cards>>(
stream: _levelModel.cardsLive.stream,
initialData: _levelModel.cardsLive.data ?? [],
builder: (c, data) {
if (data.data.isEmpty && _levelModel.page > 1) {
refreshController.loadNoData();
} else {
refreshController.loadComplete();
}
return SliverList(
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
if (index == _levelModel.data.length) {
return Container(
height: 40,
color: Color(0xffF7F6FA),
);
}
if (_levelModel.data[index].cardType == 'hospital') {
Hospital hospital =
_levelModel.data[index].hospital;
return HospitalItem(hospital);
} else {
return Container();
}
},
childCount: _levelModel.data.length + 1,
),
);
},
),
],
), onLoading: () {
_levelModel.loadMore();
}, pullDown: false, pullUp: true));
}
// 机构卡片
Widget HospitalItem(BuildContext context, int index) {
Widget HospitalItem(Hospital hospital) {
return GestureDetector(
onTap: () {},
onTap: () {
if (doctor_ids.indexOf(hospital.hosiptalId) != -1) {
doctor_ids.remove(hospital.hosiptalId);
} else {
doctor_ids.add(hospital.hosiptalId);
}
hospital.isCheck = !hospital.isCheck;
_levelModel.cardsLive.notifyView(_levelModel.cardsLive.data);
},
child: Container(
height: 94.5,
child: Stack(
......@@ -139,7 +213,7 @@ class MechanismBox implements IBottomPicker {
child: Container(
height: 17,
width: 17,
child: true
child: hospital.isCheck
? Image.asset("assets/icon-checked.png")
: Image.asset("assets/icon-check.png"),
)),
......@@ -151,10 +225,8 @@ class MechanismBox implements IBottomPicker {
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',
),
// imageUrl: cards.hospital.portrait,
imageUrl: hospital.portrait),
),
),
),
......@@ -163,7 +235,8 @@ class MechanismBox implements IBottomPicker {
top: 17.5,
// child: baseText(cards.hospital.name, 15, Color(0xff333333),
// bold: true),
child: baseText('22222', 15, Color(0xff333333), bold: true),
child:
baseText(hospital.name, 15, Color(0xff333333), bold: true),
),
Positioned(
top: 42.5,
......@@ -173,7 +246,8 @@ class MechanismBox implements IBottomPicker {
mainAxisSize: MainAxisSize.min,
children: <Widget>[
baseText("¥", 12, Color(0xffFF5963)),
baseText("${1}-${2}", 15, Color(0xffFF5963)),
baseText("${hospital.minPrice}-${hospital.maxPrice}", 15,
Color(0xffFF5963)),
],
),
),
......@@ -181,12 +255,12 @@ class MechanismBox implements IBottomPicker {
bottom: 21,
left: 89,
// child: baseText(cards.hospital.address, 12, Color(0xff666666)),
child: baseText('dsssssssss', 12, Color(0xff666666)),
child: baseText(hospital.address, 12, Color(0xff666666)),
),
Positioned(
left: 89,
top: 38.5,
child: FiveStarView(2, 5),
child: FiveStarView(int.parse(hospital.star), 5),
)
],
),
......@@ -276,17 +350,17 @@ class MechanismBox implements IBottomPicker {
keyboardType: TextInputType.text,
textInputAction: TextInputAction.send,
onSubmitted: (txt) {
if (!(doctor_ids.length > 3 ||
doctor_ids.length < 1)) {
if (doctor_ids.length > 3 || doctor_ids.length < 1) {
NativeToast.showNativeToast('请选择1-3个机构咨询');
} else {
if (txt == '') {
NativeToast.showNativeToast('text');
} else {
_model.sendMessage(doctor_ids, txt, plan_id);
dismissCall();
textController.text = '';
NativeToast.showNativeToast('消息已发送成功');
if (txt != '') {
_model.sendMessage(doctor_ids, txt, plan_id, (i) {
if (i == 0) {
dismissCall();
textController.text = '';
NativeToast.showNativeToast('消息已发送成功');
}
});
}
}
},
......
......@@ -42,12 +42,14 @@ class MechanismModel extends BaseModel {
});
}
sendMessage(List<int> doctor_ids, String question, int plan_id) {
sendMessage(List<int> doctor_ids, String question, int plan_id,
Function(int state) func) {
ClueApiImpl.getInstance()
.sendMessage(
DioUtil.getInstance().getDio(), doctor_ids, question, plan_id)
.listen((event) {
if (event.error == 0) {
func(0);
messageLive.notifyView(event.data.success);
} else {
NativeToast.showNativeToast(event.message);
......
......@@ -10,14 +10,22 @@ class LevelOneFeedList {
UserType userType;
Data data;
LevelOneFeedList({this.error, this.message, this.extra, this.errorExtra, this.userType, this.data});
LevelOneFeedList(
{this.error,
this.message,
this.extra,
this.errorExtra,
this.userType,
this.data});
LevelOneFeedList.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;
userType = json['user_type'] != null
? new UserType.fromJson(json['user_type'])
: null;
data = json['data'] != null ? new Data.fromJson(json['data']) : null;
}
......@@ -38,17 +46,14 @@ class LevelOneFeedList {
}
class UserType {
UserType();
UserType.fromJson(Map<String, dynamic> json) {
}
UserType.fromJson(Map<String, dynamic> json) {}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
return data;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
return data;
}
}
class Data {
......@@ -59,7 +64,9 @@ class Data {
Data.fromJson(Map<String, dynamic> json) {
if (json['cards'] != null) {
cards = new List<Cards>();
json['cards'].forEach((v) { cards.add(new Cards.fromJson(v)); });
json['cards'].forEach((v) {
cards.add(new Cards.fromJson(v));
});
}
}
......@@ -84,8 +91,11 @@ class Cards {
Cards.fromJson(Map<String, dynamic> json) {
cardType = json['card_type'];
plan = json['plan'] != null ? new Plan.fromJson(json['plan']) : null;
hospital = json['hospital'] != null ? new Hospital.fromJson(json['hospital']) : null;
doctor = json['doctor'] != null ? new Doctor.fromJson(json['doctor']) : null;
hospital = json['hospital'] != null
? new Hospital.fromJson(json['hospital'])
: null;
doctor =
json['doctor'] != null ? new Doctor.fromJson(json['doctor']) : null;
diary = json['diary'] != null ? new Diary.fromJson(json['diary']) : null;
}
......@@ -119,7 +129,16 @@ class Plan {
String consultType;
String messageUrl;
Plan({this.planName, this.minPrice, this.maxPrice, this.positiveRate, this.salesCount, this.baseAttrs, this.projectImage, this.consultType, this.messageUrl});
Plan(
{this.planName,
this.minPrice,
this.maxPrice,
this.positiveRate,
this.salesCount,
this.baseAttrs,
this.projectImage,
this.consultType,
this.messageUrl});
Plan.fromJson(Map<String, dynamic> json) {
planName = json['plan_name'];
......@@ -129,7 +148,9 @@ class Plan {
salesCount = json['sales_count'];
if (json['base_attrs'] != null) {
baseAttrs = new List<BaseAttrs>();
json['base_attrs'].forEach((v) { baseAttrs.add(new BaseAttrs.fromJson(v)); });
json['base_attrs'].forEach((v) {
baseAttrs.add(new BaseAttrs.fromJson(v));
});
}
projectImage = json['project_image'];
consultType = json['consult_type'];
......@@ -174,6 +195,7 @@ class BaseAttrs {
class Hospital {
String portrait;
String hosiptalId;
String name;
String minPrice;
String maxPrice;
......@@ -181,11 +203,21 @@ class Hospital {
String address;
String consultType;
String messageUrl;
Hospital({this.portrait, this.name, this.minPrice, this.maxPrice, this.star, this.address, this.consultType, this.messageUrl});
bool isCheck = false;
Hospital(
{this.portrait,
this.name,
this.minPrice,
this.maxPrice,
this.star,
this.address,
this.consultType,
this.messageUrl});
Hospital.fromJson(Map<String, dynamic> json) {
portrait = json['portrait'];
hosiptalId = json['hosiptal_id'];
name = json['name'];
minPrice = json['min_price'];
maxPrice = json['max_price'];
......@@ -198,6 +230,7 @@ class Hospital {
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['portrait'] = this.portrait;
data['hosiptal_id'] = this.hosiptalId;
data['name'] = this.name;
data['min_price'] = this.minPrice;
data['max_price'] = this.maxPrice;
......@@ -219,7 +252,15 @@ class Doctor {
String consultType;
String messageUrl;
Doctor({this.portrait, this.name, this.minPrice, this.maxPrice, this.star, this.title, this.consultType, this.messageUrl});
Doctor(
{this.portrait,
this.name,
this.minPrice,
this.maxPrice,
this.star,
this.title,
this.consultType,
this.messageUrl});
Doctor.fromJson(Map<String, dynamic> json) {
portrait = json['portrait'];
......@@ -285,7 +326,44 @@ class Diary {
UserLevel userLevel;
int serviceId;
Diary({this.diaryNum, this.videoUrl, this.isIdentification, this.isLiked, this.titleStyleType, this.replyNum, this.lasestTopicCreatedTime, this.images, this.relationServiceSku, this.createdTime, this.latestTopicId, this.id, this.city, this.userId, this.title, this.isVoted, this.diaryId, this.preImageList, this.voteNum, this.tagsNewEra, this.content, this.videoPic, this.shortVideoUrl, this.diaryAmount, this.diaryTitle, this.authorType, this.tags, this.contentLevel, this.lastModified, this.user, this.isOnline, this.date, this.membershipLevel, this.viewNum, this.postImageList, this.userLevel, this.serviceId});
Diary(
{this.diaryNum,
this.videoUrl,
this.isIdentification,
this.isLiked,
this.titleStyleType,
this.replyNum,
this.lasestTopicCreatedTime,
this.images,
this.relationServiceSku,
this.createdTime,
this.latestTopicId,
this.id,
this.city,
this.userId,
this.title,
this.isVoted,
this.diaryId,
this.preImageList,
this.voteNum,
this.tagsNewEra,
this.content,
this.videoPic,
this.shortVideoUrl,
this.diaryAmount,
this.diaryTitle,
this.authorType,
this.tags,
this.contentLevel,
this.lastModified,
this.user,
this.isOnline,
this.date,
this.membershipLevel,
this.viewNum,
this.postImageList,
this.userLevel,
this.serviceId});
Diary.fromJson(Map<String, dynamic> json) {
diaryNum = json['diary_num'];
......@@ -297,9 +375,13 @@ class Diary {
lasestTopicCreatedTime = json['lasest_topic_created_time'];
if (json['images'] != null) {
images = new List<Images>();
json['images'].forEach((v) { images.add(new Images.fromJson(v)); });
json['images'].forEach((v) {
images.add(new Images.fromJson(v));
});
}
relationServiceSku = json['relation_service_sku'] != null ? new UserType.fromJson(json['relation_service_sku']) : null;
relationServiceSku = json['relation_service_sku'] != null
? new UserType.fromJson(json['relation_service_sku'])
: null;
createdTime = json['created_time'];
latestTopicId = json['latest_topic_id'];
id = json['id'];
......@@ -312,7 +394,9 @@ class Diary {
voteNum = json['vote_num'];
if (json['tags_new_era'] != null) {
tagsNewEra = new List<TagsNewEra>();
json['tags_new_era'].forEach((v) { tagsNewEra.add(new TagsNewEra.fromJson(v)); });
json['tags_new_era'].forEach((v) {
tagsNewEra.add(new TagsNewEra.fromJson(v));
});
}
content = json['content'];
videoPic = json['video_pic'];
......@@ -322,7 +406,9 @@ class Diary {
authorType = json['author_type'];
if (json['tags'] != null) {
tags = new List<Tags>();
json['tags'].forEach((v) { tags.add(new Tags.fromJson(v)); });
json['tags'].forEach((v) {
tags.add(new Tags.fromJson(v));
});
}
contentLevel = json['content_level'];
lastModified = json['last_modified'];
......@@ -332,7 +418,9 @@ class Diary {
membershipLevel = json['membership_level'];
viewNum = json['view_num'];
postImageList = json['post_image_list'].cast<String>();
userLevel = json['user_level'] != null ? new UserLevel.fromJson(json['user_level']) : null;
userLevel = json['user_level'] != null
? new UserLevel.fromJson(json['user_level'])
: null;
serviceId = json['service_id'];
}
......@@ -402,7 +490,16 @@ class Images {
String imageHalf;
String desc;
Images({this.imageWide, this.imageType, this.image, this.sImagePlatform, this.imageSlimwidth, this.smallWide, this.imageThumb, this.imageHalf, this.desc});
Images(
{this.imageWide,
this.imageType,
this.image,
this.sImagePlatform,
this.imageSlimwidth,
this.smallWide,
this.imageThumb,
this.imageHalf,
this.desc});
Images.fromJson(Map<String, dynamic> json) {
imageWide = json['image_wide'];
......@@ -465,7 +562,14 @@ class User {
String userName;
String membershipLevel;
User({this.city, this.userId, this.topicNumPosted, this.voteNumGained, this.portrait, this.userName, this.membershipLevel});
User(
{this.city,
this.userId,
this.topicNumPosted,
this.voteNumGained,
this.portrait,
this.userName,
this.membershipLevel});
User.fromJson(Map<String, dynamic> json) {
city = json['city'];
......@@ -536,4 +640,3 @@ class Tags {
return data;
}
}
......@@ -36,7 +36,7 @@ class TestState extends BaseState<TestPage> {
list.add(listItem("二级列表页", () {
RouterCenterImpl()
.findMainRouter()
.jumpPage(context, "level_two_plan_deatil", {"planId": 137}, false);
.jumpPage(context, "level_two_plan_deatil", {"planId": 192}, false);
}));
list.add(listItem("项目首页", () {
RouterCenterImpl()
......
......@@ -19,7 +19,7 @@ const String APP_HOST_RELEASE = "https://x6cgr5y5-gengmei.mock.coding.io";
*/
//const String APP_HOST_DEBUG = "http://backend.paas-merchant.envs";
//const String APP_HOST_DEBUG = "http://doctor.paas-merchant.env";
//const String APP_HOST_DEBUG = "https://x6cgr5y5-gengmei.mock.coding.io";
// const String APP_HOST_DEBUG = "https://x6cgr5y5-gengmei.mock.coding.io";
const String APP_HOST_DEBUG = "http://backend.paas-merchant.env";
//const String APP_HOST_DEBUG = "http://janus.paas-merchant.env";
......
......@@ -46,14 +46,14 @@ class DioUtil {
DioCookieManager.getInstance().clearCookie();
}
void setProxy(String proxy) {
void setProxy(String proxy, {String port}) {
_dio = new Dio(_options);
_dio.interceptors.add(DioInterceptorManager.getInstance().getIntercept());
_dio.interceptors.add(DioCookieManager.getInstance().getCookieManager());
(_dio.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate =
(client) {
client.findProxy = (url) {
return 'PROXY $proxy:8888';
return 'PROXY $proxy:${port??8888}';
};
};
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment