|
|
@ -1,13 +1,19 @@
|
|
|
|
import 'dart:io';
|
|
|
|
import 'dart:io';
|
|
|
|
|
|
|
|
|
|
|
|
import 'package:akuCommunity/const/resource.dart';
|
|
|
|
import 'package:akuCommunity/const/resource.dart';
|
|
|
|
|
|
|
|
import 'package:akuCommunity/constants/api.dart';
|
|
|
|
import 'package:akuCommunity/ui/manager/advice/advice_page.dart';
|
|
|
|
import 'package:akuCommunity/ui/manager/advice/advice_page.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/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/buttons/bottom_button.dart';
|
|
|
|
import 'package:akuCommunity/widget/picker/grid_image_picker.dart';
|
|
|
|
import 'package:akuCommunity/widget/picker/grid_image_picker.dart';
|
|
|
|
|
|
|
|
import 'package:bot_toast/bot_toast.dart';
|
|
|
|
|
|
|
|
import 'package:common_utils/common_utils.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
|
|
|
|
import 'package:get/get.dart';
|
|
|
|
import 'package:velocity_x/velocity_x.dart';
|
|
|
|
import 'package:velocity_x/velocity_x.dart';
|
|
|
|
|
|
|
|
|
|
|
|
class NewAdvicePage extends StatefulWidget {
|
|
|
|
class NewAdvicePage extends StatefulWidget {
|
|
|
@ -21,6 +27,8 @@ class NewAdvicePage extends StatefulWidget {
|
|
|
|
class _NewAdvicePageState extends State<NewAdvicePage> {
|
|
|
|
class _NewAdvicePageState extends State<NewAdvicePage> {
|
|
|
|
int _type = 0;
|
|
|
|
int _type = 0;
|
|
|
|
List<File> _files = [];
|
|
|
|
List<File> _files = [];
|
|
|
|
|
|
|
|
TextEditingController _editingController = TextEditingController();
|
|
|
|
|
|
|
|
GlobalKey<FormState> _formKey = GlobalKey<FormState>();
|
|
|
|
String get title {
|
|
|
|
String get title {
|
|
|
|
switch (widget.type) {
|
|
|
|
switch (widget.type) {
|
|
|
|
case AdviceType.SUGGESTION:
|
|
|
|
case AdviceType.SUGGESTION:
|
|
|
@ -80,6 +88,32 @@ class _NewAdvicePageState extends State<NewAdvicePage> {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///添加建议咨询/投诉表扬 信息
|
|
|
|
|
|
|
|
Future addAdvice(int type, List<File> files, String content) async {
|
|
|
|
|
|
|
|
VoidCallback cancel = BotToast.showLoading();
|
|
|
|
|
|
|
|
List<String> urls =
|
|
|
|
|
|
|
|
await NetUtil().uploadFiles(files, API.upload.uploadArticle);
|
|
|
|
|
|
|
|
BaseModel baseModel = await NetUtil().post(
|
|
|
|
|
|
|
|
API.manager.addAdvice,
|
|
|
|
|
|
|
|
params: {
|
|
|
|
|
|
|
|
'type': type,
|
|
|
|
|
|
|
|
'content': content,
|
|
|
|
|
|
|
|
'fileUrls': urls,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
showMessage: true,
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
cancel();
|
|
|
|
|
|
|
|
if (baseModel.status) {
|
|
|
|
|
|
|
|
Get.back();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
|
|
|
void dispose() {
|
|
|
|
|
|
|
|
_editingController.dispose();
|
|
|
|
|
|
|
|
super.dispose();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return BeeScaffold.white(
|
|
|
|
return BeeScaffold.white(
|
|
|
@ -102,17 +136,25 @@ class _NewAdvicePageState extends State<NewAdvicePage> {
|
|
|
|
'您要选择的类型是?'.text.size(28.sp).make(),
|
|
|
|
'您要选择的类型是?'.text.size(28.sp).make(),
|
|
|
|
32.hb,
|
|
|
|
32.hb,
|
|
|
|
<Widget>[
|
|
|
|
<Widget>[
|
|
|
|
_buildType(0, R.ASSETS_ICONS_PROPOSAL_PNG, '建议'),
|
|
|
|
_buildType(0, R.ASSETS_ICONS_PROPOSAL_PNG,
|
|
|
|
|
|
|
|
widget.type == AdviceType.SUGGESTION ? '建议' : '投诉'),
|
|
|
|
80.wb,
|
|
|
|
80.wb,
|
|
|
|
_buildType(1, R.ASSETS_ICONS_CONSULT_PNG, '咨询'),
|
|
|
|
_buildType(1, R.ASSETS_ICONS_CONSULT_PNG,
|
|
|
|
|
|
|
|
widget.type == AdviceType.SUGGESTION ? '咨询' : '表扬'),
|
|
|
|
].row(),
|
|
|
|
].row(),
|
|
|
|
44.hb,
|
|
|
|
44.hb,
|
|
|
|
'请输入内容'.text.size(28.sp).make(),
|
|
|
|
'请输入内容'.text.size(28.sp).make(),
|
|
|
|
24.hb,
|
|
|
|
24.hb,
|
|
|
|
TextField(
|
|
|
|
Form(
|
|
|
|
// controller: ,
|
|
|
|
key: _formKey,
|
|
|
|
|
|
|
|
child: TextFormField(
|
|
|
|
|
|
|
|
controller: _editingController,
|
|
|
|
minLines: 6,
|
|
|
|
minLines: 6,
|
|
|
|
maxLines: 99,
|
|
|
|
maxLines: 99,
|
|
|
|
|
|
|
|
validator: (text) {
|
|
|
|
|
|
|
|
if (TextUtil.isEmpty(text)) return '内容不能为空';
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
},
|
|
|
|
decoration: InputDecoration(
|
|
|
|
decoration: InputDecoration(
|
|
|
|
border: OutlineInputBorder(),
|
|
|
|
border: OutlineInputBorder(),
|
|
|
|
isDense: true,
|
|
|
|
isDense: true,
|
|
|
@ -127,6 +169,7 @@ class _NewAdvicePageState extends State<NewAdvicePage> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
32.hb,
|
|
|
|
32.hb,
|
|
|
|
'添加图片信息(${_files.length}/9)'.text.size(28.sp).make(),
|
|
|
|
'添加图片信息(${_files.length}/9)'.text.size(28.sp).make(),
|
|
|
|
24.hb,
|
|
|
|
24.hb,
|
|
|
@ -138,7 +181,20 @@ class _NewAdvicePageState extends State<NewAdvicePage> {
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
bottomNavi: BottomButton(
|
|
|
|
bottomNavi: BottomButton(
|
|
|
|
onPressed: () {},
|
|
|
|
onPressed: () {
|
|
|
|
|
|
|
|
if (_formKey.currentState.validate()) {
|
|
|
|
|
|
|
|
int type = 1;
|
|
|
|
|
|
|
|
switch (widget.type) {
|
|
|
|
|
|
|
|
case AdviceType.SUGGESTION:
|
|
|
|
|
|
|
|
type = _type == 0 ? 2 : 1;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AdviceType.COMPLAIN:
|
|
|
|
|
|
|
|
type = _type == 0 ? 4 : 3;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
addAdvice(type, _files, _editingController.text);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
child: '确认提交'.text.make(),
|
|
|
|
child: '确认提交'.text.make(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
|