Commit ace849c49c1c92218b9ca45b0f39bd5edd2c1442

Authored by wdn127929
1 parent f9174cee

评价管理OK---差评论接口调整

... ... @@ -47,6 +47,10 @@ class CommentsSunModel {
String isnoshow;
Reply reply;
String ddate;
String ddateSolt;
String tableinfo;
String get createTimeStr {
DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(
int.parse(createTime.toString()) * 1000);
... ... @@ -67,7 +71,10 @@ class CommentsSunModel {
this.createTime,
this.enclosure,
this.isnoshow,
this.reply});
this.reply,
this.ddate,
this.ddateSolt,
this.tableinfo});
CommentsSunModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
... ... @@ -93,6 +100,10 @@ class CommentsSunModel {
isnoshow = json['isnoshow'];
reply = json['reply'] != null ? new Reply.fromJson(json['reply']) : null;
ddate = json['ddate'];
ddateSolt = json['ddate_solt'];
tableinfo = json['tableinfo'];
}
Map<String, dynamic> toJson() {
... ... @@ -116,6 +127,10 @@ class CommentsSunModel {
if (this.enclosure != null) {
data['enclosure'] = jsonEncode(this.enclosure);
}
data['ddate'] = this.ddate;
data['ddate_solt'] = this.ddateSolt;
data['tableinfo'] = this.tableinfo;
return data;
}
}
... ...
... ... @@ -3,6 +3,8 @@ import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:one_key/models/comments_label_model.dart';
import 'package:one_key/models/comments_model.dart';
import 'package:one_key/pages/my/comment_manage/input_buttom_widget.dart';
import 'package:one_key/pages/my/comment_manage/pop_route.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/utils/dialog_util.dart';
... ... @@ -36,7 +38,8 @@ class _CommentManageHomePageState extends State<CommentManageHomePage> {
Map<String, String> starTextMap = {};
bool allSelect = true;
String label = '';
bool showInput = false;
TextEditingController replyController = TextEditingController();
@override
void initState() {
super.initState();
... ... @@ -81,6 +84,24 @@ class _CommentManageHomePageState extends State<CommentManageHomePage> {
isShowLoading: isShowLoading);
}
_setComment(String pid, String rid, String text,
{bool isShowLoading = true}) async {
Map<String, String> pramas = {
'sid': Provider.of<UserModel>(context, listen: false).user.sellerid,
'identity': '0',
'pid': pid,
'rid': rid,
'text': text,
};
bool success = await commentManageProvider.setComment(context, pramas,
isShowLoading: isShowLoading);
if (success) {
//成功 刷新列表
_getSellerComments(isShowLoading: false);
}
}
List<Widget> _labelWidget() {
List<Widget> data = [];
data.add(InkWell(
... ... @@ -145,6 +166,7 @@ class _CommentManageHomePageState extends State<CommentManageHomePage> {
/// 九宫格
Widget _getGridImg(List<CommentsImageModel> imags) {
imags.removeWhere((element) => element.url == null || element.url == '');
return GridView.builder(
controller: controller,
padding: EdgeInsets.symmetric(vertical: w(7)),
... ... @@ -253,287 +275,298 @@ class _CommentManageHomePageState extends State<CommentManageHomePage> {
itemBuilder: (context, index) {
CommentsSunModel sunModel =
commentManageProvider.commentsData[index];
return Container(
margin: EdgeInsets.only(top: w(10)),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
width: w(0.5),
color: MyColours.color_DBDBDB))),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: w(50),
height: w(50),
margin: EdgeInsets.only(
left: w(8),
right: w(8),
top: w(20)),
child: ClipRRect(
borderRadius:
BorderRadius.circular(w(50)),
child: sunModel.authorImage !=
null &&
sunModel.authorImage != ''
? CachedNetworkImage(
imageUrl:
sunModel.authorImage,
width: w(50),
height: w(50),
)
: Container(
width: w(50),
height: w(50),
decoration: BoxDecoration(
color: MyColours
.color_d9d9d9,
borderRadius:
BorderRadius
.circular(
r(50))),
))),
HEmptyView(34),
Expanded(
child: Padding(
padding: EdgeInsets.symmetric(
vertical: w(4)),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Row(
children: [
Container(
padding: EdgeInsets
.symmetric(
vertical:
w(4)),
constraints:
BoxConstraints(
maxWidth:
w(120)),
child: Text(
sunModel.author ??
'',
maxLines: 10,
overflow:
TextOverflow
.ellipsis,
style: TextStyle(
fontSize:
font(14),
fontWeight:
FontWeight
.bold,
color: MyColours
.color_515151),
)),
Spacer(),
Container(
width: w(75),
height: w(24),
child:
ListView.builder(
itemCount: 5,
shrinkWrap:
true,
scrollDirection:
Axis
.horizontal,
itemBuilder:
(context,
index) {
return Image
.asset(
Utils.getImgPath(index <=
int.parse(sunModel.grade) - 1
? 'zwzp'
: 'apple'),
width:
w(15),
);
})),
return Stack(children: [
Container(
margin: EdgeInsets.only(top: w(10)),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
width: w(0.5),
color: MyColours.color_DBDBDB))),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Container(
width: w(50),
height: w(50),
margin: EdgeInsets.only(
left: w(8),
right: w(8),
top: w(20)),
child: ClipRRect(
borderRadius:
BorderRadius.circular(w(50)),
child: sunModel.authorImage !=
null &&
sunModel.authorImage !=
'' &&
!sunModel.authorImage
.endsWith('.mp4')
? CachedNetworkImage(
imageUrl:
sunModel.authorImage,
width: w(50),
height: w(50),
)
: Container(
width: w(50),
height: w(50),
decoration: BoxDecoration(
color: MyColours
.color_d9d9d9,
borderRadius:
BorderRadius
.circular(
r(50))),
))),
HEmptyView(34),
Expanded(
child: Padding(
padding: EdgeInsets.symmetric(
vertical: w(4)),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Row(
children: [
Container(
padding: EdgeInsets
.symmetric(
vertical:
w(4)),
constraints:
BoxConstraints(
maxWidth:
w(120)),
child: Text(
sunModel.author ??
'',
maxLines: 10,
overflow:
TextOverflow
.ellipsis,
style: TextStyle(
fontSize:
font(14),
fontWeight:
FontWeight
.bold,
color: MyColours
.color_515151),
)),
Spacer(),
Container(
width: w(75),
height: w(24),
child: ListView
.builder(
itemCount:
5,
shrinkWrap:
true,
scrollDirection:
Axis
.horizontal,
itemBuilder:
(context,
index) {
return Image
.asset(
Utils.getImgPath(index <=
int.parse(sunModel.grade) - 1
? 'zwzp'
: 'apple'),
width: w(
15),
);
})),
Container(
padding: EdgeInsets
.symmetric(
vertical:
w(4)),
child: Text(
starTextMap[
'${sunModel.grade}'] ??
'',
maxLines: 2,
overflow:
TextOverflow
.ellipsis,
style: TextStyle(
fontSize:
font(12),
color: MyColours
.color_999999),
)),
],
),
VEmptyView(8),
Container(
padding: EdgeInsets
.symmetric(
vertical: w(4)),
child: Text(
'就餐于 ${sunModel.ddate} ${sunModel.ddateSolt} ${sunModel.tableinfo}',
maxLines: 10,
overflow: TextOverflow
.ellipsis,
style: TextStyle(
fontSize:
font(12),
color: MyColours
.color_999999),
)),
Container(
padding: EdgeInsets
.symmetric(
vertical: w(4)),
child: Text(
'发表于 ${sunModel.createTimeStr}',
maxLines: 10,
overflow: TextOverflow
.ellipsis,
style: TextStyle(
fontSize:
font(12),
color: MyColours
.color_999999),
)),
VEmptyView(8),
if (sunModel.text != null &&
sunModel.text.length >
0)
Container(
padding: EdgeInsets
.symmetric(
vertical:
w(4)),
child: Text(
starTextMap[
'${sunModel.grade}'] ??
'',
maxLines: 2,
overflow:
TextOverflow
.ellipsis,
sunModel.text ?? '',
style: TextStyle(
height: 1.8,
fontSize:
font(12),
color: MyColours
.color_999999),
.color_515151),
)),
],
),
VEmptyView(8),
Container(
padding:
EdgeInsets.symmetric(
vertical: w(4)),
child: Text(
'就餐于 2023-8-24 午餐 二楼205',
maxLines: 10,
overflow: TextOverflow
.ellipsis,
style: TextStyle(
fontSize: font(12),
color: MyColours
.color_999999),
)),
Container(
padding:
EdgeInsets.symmetric(
vertical: w(4)),
child: Text(
'发表于 ${sunModel.createTimeStr}',
maxLines: 10,
overflow: TextOverflow
.ellipsis,
style: TextStyle(
fontSize: font(12),
color: MyColours
.color_999999),
)),
VEmptyView(8),
if (sunModel.text != null &&
sunModel.text.length > 0)
Container(
padding: EdgeInsets
.symmetric(
vertical: w(4)),
child: Text(
sunModel.text ?? '',
'#${sunModel.evalLabel ?? ''}',
style: TextStyle(
height: 1.8,
fontSize:
font(12),
color: MyColours
.color_515151),
.color_438E93),
)),
Container(
padding:
EdgeInsets.symmetric(
vertical: w(4)),
child: Text(
'#${sunModel.evalLabel ?? ''}',
style: TextStyle(
height: 1.8,
fontSize: font(12),
color: MyColours
.color_438E93),
)),
if (sunModel
.enclosure.length >
0)
_getGridImg(
sunModel.enclosure),
VEmptyView(8),
sunModel.reply != null
? Container(
width:
double.infinity,
padding:
EdgeInsets.all(
w(4)),
decoration: BoxDecoration(
color: MyColours
.color_33438E93,
borderRadius:
BorderRadius
.circular(
r(8))),
child: Column(
crossAxisAlignment:
CrossAxisAlignment
.start,
children: [
Text(
'回复内容',
style: TextStyle(
color: MyColours
.color_515151,
fontWeight:
FontWeight
.bold,
fontSize:
font(
12)),
),
VEmptyView(6),
Container(
padding: EdgeInsets
.symmetric(
vertical:
w(4)),
child: Text(
sunModel.reply
.text ??
"",
style: TextStyle(
height:
1.8,
fontSize:
font(
12),
color: MyColours
.color_515151),
)),
],
),
)
:
// showInput
// ? SlidingUpPanel(
// panel: Center(
// child: Text(
// "This is the sliding Widget"),
// ),
// )
// :
Align(
alignment: Alignment
.centerRight,
child: RoundButton(
text: '回复',
width: w(54),
height: w(24),
gradientStart:
MyColours
.color_ffffff,
gradientEnd: MyColours
.color_ffffff,
textColor: MyColours
.color_000000,
fontSize: 24,
borderColor: MyColours
.color_999999,
radius: r(15),
onPressed: () {
setState(() {
showInput =
!showInput;
});
DialogUtil
.openCommentsModalBottomSheet(
context);
},
if (sunModel
.enclosure.length >
0)
_getGridImg(
sunModel.enclosure),
VEmptyView(8),
sunModel.reply != null
? Container(
width:
double.infinity,
padding:
EdgeInsets.all(
w(4)),
decoration: BoxDecoration(
color: MyColours
.color_33438E93,
borderRadius:
BorderRadius
.circular(
r(8))),
child: Column(
crossAxisAlignment:
CrossAxisAlignment
.start,
children: [
Text(
'回复内容',
style: TextStyle(
color: MyColours
.color_515151,
fontWeight:
FontWeight
.bold,
fontSize:
font(
12)),
),
VEmptyView(6),
Container(
padding: EdgeInsets.symmetric(
vertical:
w(4)),
child: Text(
sunModel.reply
.text ??
"",
style: TextStyle(
height:
1.8,
fontSize: font(
12),
color:
MyColours.color_515151),
)),
],
),
)
: Align(
alignment: Alignment
.centerRight,
child: RoundButton(
text: '回复',
width: w(54),
height: w(24),
gradientStart:
MyColours
.color_ffffff,
gradientEnd: MyColours
.color_ffffff,
textColor: MyColours
.color_000000,
fontSize: 24,
borderColor: MyColours
.color_999999,
radius: r(15),
onPressed: () {
Navigator.push(
context,
PopRoute(child:
InputButtomWidget(
onEditingCompleteText:
(text) {
print(
'点击发送 ---$text');
_setComment(
sunModel
.id,
sunModel
.rid,
text,
);
},
)));
},
),
),
),
VEmptyView(26),
]))),
],
VEmptyView(26),
]))),
],
),
),
);
]);
}))
],
));
... ...
import 'package:flutter/material.dart';
import '../../../res/colors.dart';
import '../../../utils/screen_util.dart';
import '../../../widgets/h_empty_view.dart';
import '../../../widgets/round_button.dart';
class InputButtomWidget extends StatefulWidget {
final ValueChanged onEditingCompleteText;
InputButtomWidget({Key key, this.onEditingCompleteText}) : super(key: key);
@override
_InputButtomWidgetState createState() => _InputButtomWidgetState();
}
class _InputButtomWidgetState extends State<InputButtomWidget> {
final TextEditingController controller = TextEditingController();
@override
Widget build(BuildContext context) {
return new Scaffold(
backgroundColor: Colors.transparent,
body: new Column(
children: <Widget>[
Expanded(
child: new GestureDetector(
child: new Container(
color: Colors.transparent,
),
onTap: () {
Navigator.pop(context);
},
)),
new Container(
color: Color(0xFFF4F4F4),
padding: EdgeInsets.only(left: 16, top: 8, bottom: 8, right: 16),
child: Row(children: [
// Container(
// decoration: BoxDecoration(color: Colors.white),
// child: TextField(
// controller: controller,
// autofocus: true,
// style: TextStyle(fontSize: 16),
// //设置键盘按钮为发送
// textInputAction: TextInputAction.send,
// keyboardType: TextInputType.multiline,
// onEditingComplete: () {
// //点击发送调用
// print('onEditingComplete');
// onEditingCompleteText(controller.text);
// Navigator.pop(context);
// },
// decoration: InputDecoration(
// hintText: '评论',
// isDense: true,
// contentPadding: EdgeInsets.only(
// left: 10, top: 5, bottom: 5, right: 10),
// border: const OutlineInputBorder(
// gapPadding: 0,
// borderSide: BorderSide(
// width: 0,
// style: BorderStyle.none,
// ),
// ),
// ),
// minLines: 1,
// maxLines: 5,
// ),
// ),
Expanded(
child: Container(
decoration: BoxDecoration(
color: MyColours.color_ffffff,
borderRadius: BorderRadius.circular(r(8))),
padding:
EdgeInsets.symmetric(horizontal: w(4), vertical: 0),
child: TextField(
controller: controller,
minLines: 1,
maxLines: 5,
autofocus: true,
// //光标颜色
// cursorColor:
// widget.isSelect ? Colors.white : MyColours.color_199095,
//输入文本的样式
// inputFormatters: lenghtLimit
// ? [
// LengthLimitingTextInputFormatter(10),
// ]
// : [],
// textAlignVertical: TextAlignVertical.center,
textAlign: TextAlign.left,
style: TextStyle(
fontSize: font(14),
),
decoration: InputDecoration(
contentPadding: EdgeInsets.zero,
border:
OutlineInputBorder(borderSide: BorderSide.none),
hintText: '评论',
hintStyle: TextStyle(
color: MyColours.color_999999,
fontSize: font(14),
),
enabledBorder: new UnderlineInputBorder(
borderSide: BorderSide.none,
),
focusedBorder: new UnderlineInputBorder(
borderSide: BorderSide.none,
),
),
onChanged: (value) {
// name = value;
setState(() {});
},
//设置键盘按钮为发送
// textInputAction: TextInputAction.send,
keyboardType: TextInputType.multiline,
onEditingComplete: () {
//点击发送调用
// print('onEditingComplete');
// onEditingCompleteText(controller.text);
// Navigator.pop(context);
},
))),
HEmptyView(20),
RoundButton(
text: '发送',
width: w(54),
height: w(28),
gradientStart: controller.text.trim().length > 0
? MyColours.color_438E93
: MyColours.color_ffffff,
gradientEnd: controller.text.trim().length > 0
? MyColours.color_438E93
: MyColours.color_ffffff,
textColor: controller.text.trim().length > 0
? MyColours.color_F8F9FD
: MyColours.color_999999,
fontSize: 24,
borderColor: controller.text.trim().length > 0
? MyColours.color_438E93
: MyColours.color_999999,
radius: r(15),
onPressed: () {
if (controller.text.trim().length == 0) {
return;
}
print('onEditingComplete');
widget.onEditingCompleteText(controller.text);
Navigator.pop(context);
},
),
]))
],
),
);
}
}
... ...
//过度路由
import 'package:flutter/material.dart';
class PopRoute extends PopupRoute{
final Duration _duration = Duration(milliseconds: 300);
Widget child;
PopRoute({@required this.child});
@override
Color get barrierColor => null;
@override
bool get barrierDismissible => true;
@override
String get barrierLabel => null;
@override
Widget buildPage(BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation) {
return child;
}
@override
Duration get transitionDuration => _duration;
}
... ...
... ... @@ -1304,32 +1304,32 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver {
isRowLow: outDay == '0' ||
!Utils.getAuthority(
context, '营销中心'))),
// InkWell(
// onTap: () {
// if (outDay == '0') {
// return;
// }
// if (Utils.getAuthority(
// context, '评价管理')) {
// NavigatorUtil
// .goCommentManageHomePage(
// context);
// }
// },
// child: _item(
// outDay == '0' ||
// !Utils.getAuthority(
// context, '评价管理')
// ? Utils.getImgPath(
// 'my_comment_un')
// : Utils.getImgPath(
// 'my_comment'),
// '评价管理',
// isRowLow: outDay == '0' ||
// !Utils.getAuthority(
// context, '评价管理'))),
InkWell(
onTap: () {}, child: _item('', '空空空空')),
onTap: () {
if (outDay == '0') {
return;
}
if (Utils.getAuthority(
context, '评价管理')) {
NavigatorUtil
.goCommentManageHomePage(
context);
}
},
child: _item(
outDay == '0' ||
!Utils.getAuthority(
context, '评价管理')
? Utils.getImgPath(
'my_comment_un')
: Utils.getImgPath(
'my_comment'),
'评价管理',
isRowLow: outDay == '0' ||
!Utils.getAuthority(
context, '评价管理'))),
// InkWell(
// onTap: () {}, child: _item('', '空空空空')),
InkWell(
onTap: () {}, child: _item('', '空空空空')),
],
... ...
... ... @@ -55,87 +55,108 @@ typedef ClickCallback = void Function(String value);
// };
class DialogUtil {
//回复评论弹框
static openCommentsModalBottomSheet(context,
static openCommentsModalBottomSheet(context, TextEditingController controller,
{VoidCallback lCallback, VoidCallback rCallback}) async {
final option = await showModalBottomSheet(
context: context,
backgroundColor: Colors.transparent,
isDismissible: false,
isDismissible: true,
builder: (BuildContext context) {
return Container(
// height: ScreenUtil().setWidth(180 * 2),
decoration: BoxDecoration(
color: MyColours.color_DBDBDB,
return Scaffold(
resizeToAvoidBottomInset: false,
body: Column(mainAxisSize: MainAxisSize.min, children: [
Container(
// height: ScreenUtil().setWidth(180 * 2),
// constraints: BoxConstraints(minHeight: w(40), maxHeight: w(500)),
decoration: BoxDecoration(
color: MyColours.color_F7F7F7,
// borderRadius: BorderRadius.only(
// topLeft: Radius.circular(ScreenUtil().setWidth(24)),
// topRight: Radius.circular(ScreenUtil().setWidth(24)))
),
child: Row(
children: <Widget>[
InkWell(
onTap: lCallback,
child: Container(
width: double.infinity,
height: ScreenUtil().setWidth(58 * 2),
child: Center(
child: Text(
'拍摄',
style: TextStyle(
fontSize: ScreenUtil().setSp(32),
color: MyColours.color_353535,
fontWeight: FontWeight.bold),
),
)),
),
MyDivider(
double.infinity,
ScreenUtil().setWidth(2),
color: MyColours.color_EEEEEE,
),
InkWell(
onTap: rCallback,
child: Container(
width: double.infinity,
height: ScreenUtil().setWidth(58 * 2),
child: Center(
child: Text(
'从相册选择',
style: TextStyle(
fontSize: ScreenUtil().setSp(32),
color: MyColours.color_353535,
fontWeight: FontWeight.bold),
),
)),
),
MyDivider(
double.infinity,
ScreenUtil().setWidth(10),
color: MyColours.color_EEEEEE,
),
InkWell(
onTap: () {
Navigator.pop(context, '取消');
},
child: Container(
width: double.infinity,
height: ScreenUtil().setWidth(58 * 2),
child: Center(
child: Text(
'取消',
style: TextStyle(
fontSize: ScreenUtil().setSp(32),
color: MyColours.color_353535,
fontWeight: FontWeight.bold),
),
)))
],
),
);
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
Expanded(
child: Container(
margin: EdgeInsets.symmetric(
horizontal: w(15), vertical: w(8)),
decoration: BoxDecoration(
color: MyColours.color_ffffff,
borderRadius: BorderRadius.circular(r(8))),
padding: EdgeInsets.symmetric(horizontal: w(4)),
child: TextField(
controller: controller,
maxLines: null,
autofocus: true,
// //光标颜色
// cursorColor:
// widget.isSelect ? Colors.white : MyColours.color_199095,
//输入文本的样式
// inputFormatters: lenghtLimit
// ? [
// LengthLimitingTextInputFormatter(10),
// ]
// : [],
textAlignVertical: TextAlignVertical.bottom,
textAlign: TextAlign.left,
style: TextStyle(
fontSize: ScreenUtil().setSp(28),
),
decoration: InputDecoration(
border: OutlineInputBorder(
borderSide: BorderSide.none),
hintText: '评论',
hintStyle: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(28),
),
enabledBorder: new UnderlineInputBorder(
borderSide: BorderSide.none,
),
focusedBorder: new UnderlineInputBorder(
borderSide: BorderSide.none,
),
),
onChanged: (value) {
// name = value;
},
onEditingComplete: () {
FocusScope.of(context)
.requestFocus(FocusNode()); //点击空白处隐藏键盘
},
keyboardType: TextInputType.text))),
HEmptyView(20),
RoundButton(
text: '发送',
width: w(54),
height: w(24),
gradientStart: controller.text.trim().length > 0
? MyColours.color_438E93
: MyColours.color_ffffff,
gradientEnd: controller.text.trim().length > 0
? MyColours.color_438E93
: MyColours.color_ffffff,
textColor: controller.text.trim().length > 0
? MyColours.color_F8F9FD
: MyColours.color_000000,
fontSize: 24,
borderColor: controller.text.trim().length > 0
? MyColours.color_438E93
: MyColours.color_999999,
radius: r(15),
onPressed: () {},
),
HEmptyView(20),
],
),
)
]));
});
}
static List<Widget> menuSelectBtn(MenuSunModel menuSunModel, state) {
List<Widget> temp = [];
for (int i = 0; i < menuSunModel.practice.length; i++) {
... ...