建议咨询页面请求对接

hmxc
小赖 4 years ago
parent e9045979d9
commit 942f1a94f0

@ -84,6 +84,9 @@ class _Manager {
///
String get reportRepairDelete => '/user/reportRepair/falseDelete';
////app/ type (1.2.3.4.)
String get advice => '/user/advice/list';
}
class _Upload {

@ -0,0 +1,63 @@
import 'package:common_utils/common_utils.dart';
class SuggestionOrComplainModel {
int id;
int type;
int status;
String content;
int score;
DateTime createDate;
List<ImgUrls> imgUrls;
SuggestionOrComplainModel(
{this.id,
this.type,
this.status,
this.content,
this.score,
this.createDate,
this.imgUrls});
SuggestionOrComplainModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
type = json['type'];
status = json['status'];
content = json['content'];
score = json['score'];
createDate = DateUtil.getDateTime(json['createDate']);
if (json['imgUrls'] != null) {
imgUrls = new List<ImgUrls>();
json['imgUrls'].forEach((v) {
imgUrls.add(new ImgUrls.fromJson(v));
});
}
}
}
class ImgUrls {
String url;
String size;
int longs;
int paragraph;
int sort;
ImgUrls({this.url, this.size, this.longs, this.paragraph, this.sort});
ImgUrls.fromJson(Map<String, dynamic> json) {
url = json['url'];
size = json['size'];
longs = json['longs'];
paragraph = json['paragraph'];
sort = json['sort'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['url'] = this.url;
data['size'] = this.size;
data['longs'] = this.longs;
data['paragraph'] = this.paragraph;
data['sort'] = this.sort;
return data;
}
}

@ -0,0 +1,70 @@
import 'package:akuCommunity/constants/api.dart';
import 'package:akuCommunity/model/manager/suggestion_or_complain_model.dart';
import 'package:akuCommunity/pages/things_page/widget/bee_list_view.dart';
import 'package:akuCommunity/widget/bee_scaffold.dart';
import 'package:akuCommunity/utils/headers.dart';
import 'package:akuCommunity/widget/tab_bar/bee_tab_bar.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
enum AdviceType {
SUGGESTION,
COMPLAIN,
}
class AdvicePage extends StatefulWidget {
final AdviceType type;
AdvicePage({Key key, @required this.type}) : super(key: key);
@override
_AdvicePageState createState() => _AdvicePageState();
}
class _AdvicePageState extends State<AdvicePage> with TickerProviderStateMixin {
EasyRefreshController _refreshController = EasyRefreshController();
TabController _tabController;
@override
void initState() {
super.initState();
_tabController = TabController(length: 2, vsync: this);
}
@override
void dispose() {
_tabController?.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return BeeScaffold(
title: '建议咨询',
appBarBottom: BeeTabBar(
controller: _tabController,
tabs: ['您的建议', '您的咨询'],
),
body: TabBarView(
controller: _tabController,
children: List.generate(2, (index) {
return BeeListView(
path: API.manager.advice,
extraParams: {'adviceType': index == 0 ? 2 : 1},
controller: _refreshController,
convert: (model) => model.tableList
.map((e) => SuggestionOrComplainModel.fromJson(e))
.toList(),
builder: (items) {
return ListView.separated(
itemBuilder: (context, index) {
return SizedBox();
},
separatorBuilder: (_, __) => 20.hb,
itemCount: items.length,
);
},
);
}).toList(),
),
);
}
}

@ -0,0 +1,35 @@
import 'package:akuCommunity/base/base_style.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class BeeTabBar extends StatefulWidget with PreferredSizeWidget {
final TabController controller;
final List<String> tabs;
BeeTabBar({Key key, @required this.controller, @required this.tabs})
: super(key: key);
@override
_BeeTabBarState createState() => _BeeTabBarState();
@override
Size get preferredSize => Size.fromHeight(96.w);
}
class _BeeTabBarState extends State<BeeTabBar> {
@override
Widget build(BuildContext context) {
return TabBar(
controller: widget.controller,
unselectedLabelStyle: TextStyle(
fontSize: BaseStyle.fontSize28,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w600,
fontSize: BaseStyle.fontSize28,
),
indicatorColor: Color(0xffffc40c),
indicatorSize: TabBarIndicatorSize.label,
tabs: widget.tabs.map((e) => Tab(text: e)).toList(),
);
}
}
Loading…
Cancel
Save