建议继续提问

hmxc
小赖 4 years ago
parent 080b222b70
commit ee499642b9

@ -96,6 +96,9 @@ class _Manager {
/// ///
String get adviceDetail => '/user/advice/findAdviceDetailByAdviceId'; String get adviceDetail => '/user/advice/findAdviceDetailByAdviceId';
///
String get adviceQuestion => '/user/advice/reQuestion';
} }
class _Upload { class _Upload {

@ -0,0 +1,86 @@
import 'package:akuCommunity/constants/api.dart';
import 'package:akuCommunity/utils/headers.dart';
import 'package:akuCommunity/utils/network/base_model.dart';
import 'package:akuCommunity/utils/network/net_util.dart';
import 'package:akuCommunity/widget/bee_scaffold.dart';
import 'package:akuCommunity/widget/buttons/bottom_button.dart';
import 'package:common_utils/common_utils.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:velocity_x/velocity_x.dart';
class AdviceAddCommentPage extends StatefulWidget {
final int id;
AdviceAddCommentPage({Key key, @required this.id}) : super(key: key);
@override
_AdviceAddCommentPageState createState() => _AdviceAddCommentPageState();
}
class _AdviceAddCommentPageState extends State<AdviceAddCommentPage> {
TextEditingController _textEditingController = TextEditingController();
GlobalKey<FormState> _formKey = GlobalKey<FormState>();
@override
void dispose() {
_textEditingController?.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return BeeScaffold(
title: '继续回复',
body: ListView(
padding: EdgeInsets.all(32.w),
children: [
'请输入内容'.text.size(28.sp).make(),
24.hb,
Form(
key: _formKey,
child: TextFormField(
controller: _textEditingController,
validator: (text) {
if (TextUtil.isEmpty(text)) return '内容不能为空';
return null;
},
minLines: 7,
maxLines: 99,
decoration: InputDecoration(
border: OutlineInputBorder(
borderSide: BorderSide(
color: Color(0xFFD4CFBE),
width: 1.w,
),
),
contentPadding: EdgeInsets.symmetric(
vertical: 32.w,
horizontal: 22.w,
),
),
),
),
],
),
bottomNavi: BottomButton(
onPressed: () async {
if (_formKey.currentState.validate()) {
BaseModel baseModel = await NetUtil().post(
API.manager.adviceQuestion,
params: {
'adviceId': widget.id,
'content': _textEditingController.text,
'parentId': 0,
},
showMessage: true,
);
if (baseModel.status) {
Get.back(result: true);
}
}
},
child: '提交'.text.bold.make(),
),
);
}
}

@ -2,14 +2,17 @@ import 'package:akuCommunity/base/base_style.dart';
import 'package:akuCommunity/constants/api.dart'; import 'package:akuCommunity/constants/api.dart';
import 'package:akuCommunity/model/manager/advice_detail_model.dart'; import 'package:akuCommunity/model/manager/advice_detail_model.dart';
import 'package:akuCommunity/model/manager/suggestion_or_complain_model.dart'; import 'package:akuCommunity/model/manager/suggestion_or_complain_model.dart';
import 'package:akuCommunity/ui/manager/advice/advice_add_comment_page.dart';
import 'package:akuCommunity/utils/network/net_util.dart'; import 'package:akuCommunity/utils/network/net_util.dart';
import 'package:akuCommunity/widget/bee_scaffold.dart'; import 'package:akuCommunity/widget/bee_scaffold.dart';
import 'package:akuCommunity/utils/headers.dart'; import 'package:akuCommunity/utils/headers.dart';
import 'package:akuCommunity/widget/buttons/bottom_button.dart';
import 'package:akuCommunity/widget/views/bee_grid_image_view.dart'; import 'package:akuCommunity/widget/views/bee_grid_image_view.dart';
import 'package:common_utils/common_utils.dart'; import 'package:common_utils/common_utils.dart';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:get/get.dart' hide Response;
import 'package:shimmer/shimmer.dart'; import 'package:shimmer/shimmer.dart';
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
@ -79,6 +82,36 @@ class _AdviceDetailPageState extends State<AdviceDetailPage> {
); );
} }
_buildAdviceContent(AppAdviceContentVos item) {
String type = '';
switch (item.createUserType) {
case 1:
type = '';
break;
case 2:
type = '装修公司';
break;
case 3:
type = '物业';
break;
}
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
'$type\的回复'.text.size(38.sp).bold.make(),
28.hb,
item.content.text.size(28.sp).color(ktextSubColor).make(),
24.hb,
DateUtil.formatDate(item.date, format: 'yyyy年MM月dd日 HH:mm')
.text
.size(24.sp)
.color(Color(0xFF999999))
.make(),
50.hb,
],
);
}
_buildChild() { _buildChild() {
return ListView( return ListView(
padding: EdgeInsets.all(32.w), padding: EdgeInsets.all(32.w),
@ -93,7 +126,7 @@ class _AdviceDetailPageState extends State<AdviceDetailPage> {
DateUtil.formatDate( DateUtil.formatDate(
_model.appAdviceDetailVo.appAdviceVo.date, _model.appAdviceDetailVo.appAdviceVo.date,
format: 'yyyy年MM月dd日 HH:mm', format: 'yyyy年MM月dd日 HH:mm',
).text.make(), ).text.size(24.sp).color(Color(0xFF999999)).make(),
Divider( Divider(
height: 50.w, height: 50.w,
thickness: 1.w, thickness: 1.w,
@ -103,6 +136,14 @@ class _AdviceDetailPageState extends State<AdviceDetailPage> {
urls: widget.model.imgUrls.map((e) => e.url).toList(), urls: widget.model.imgUrls.map((e) => e.url).toList(),
padding: EdgeInsets.only(right: 100.w), padding: EdgeInsets.only(right: 100.w),
), ),
Divider(
height: 50.w,
thickness: 1.w,
color: Color(0xFFD8D8D8),
),
..._model.appAdviceDetailVo.appAdviceContentVos
.map((e) => _buildAdviceContent(e))
.toList(),
], ],
); );
} }
@ -117,6 +158,12 @@ class _AdviceDetailPageState extends State<AdviceDetailPage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BeeScaffold( return BeeScaffold(
title: '查看详情', title: '查看详情',
actions: [
FlatButton(
onPressed: () {},
child: '评价'.text.make(),
),
],
body: EasyRefresh( body: EasyRefresh(
firstRefresh: true, firstRefresh: true,
child: _loading ? _buildShimmer() : _buildChild(), child: _loading ? _buildShimmer() : _buildChild(),
@ -132,6 +179,13 @@ class _AdviceDetailPageState extends State<AdviceDetailPage> {
if (mounted) setState(() {}); if (mounted) setState(() {});
}, },
), ),
bottomNavi: BottomButton(
onPressed: () async {
bool result = await Get.to(AdviceAddCommentPage(id: widget.model.id));
if (result && mounted) _refreshController.callRefresh();
},
child: '继续提问'.text.bold.make(),
),
); );
} }
} }

Loading…
Cancel
Save