咨询建议上传图片修复

hmxc
小赖 4 years ago
parent e0b38ddf1d
commit c869bfce69

@ -235,7 +235,7 @@ class _Community {
class _Upload { class _Upload {
/// ///
String get uploadArticle => '/user/upload/uploadArticle'; String get uploadAdvice => '/user/upload/uploadAdvice';
/// ///
String get uploadAvatar => '/user/upload/appHeadSculpture'; String get uploadAvatar => '/user/upload/appHeadSculpture';

@ -132,10 +132,10 @@ class _SettingsPageState extends State<SettingsPage> {
)), )),
26.hb, 26.hb,
...[ ...[
_buildTile( // _buildTile(
title: '清除缓存', // title: '清除缓存',
onTap: () {}, // onTap: () {},
), // ),
_buildTile( _buildTile(
title: '意见反馈', title: '意见反馈',
onTap: () => Get.to(() => FeedBackPage()), onTap: () => Get.to(() => FeedBackPage()),
@ -156,7 +156,6 @@ class _SettingsPageState extends State<SettingsPage> {
separate: Divider( separate: Divider(
indent: 32.w, indent: 32.w,
endIndent: 32.w, endIndent: 32.w,
color: Color(0xFFD8D8D8),
thickness: 1.w, thickness: 1.w,
height: 1.w, height: 1.w,
)), )),

@ -1,6 +1,7 @@
import 'package:akuCommunity/constants/app_values.dart'; import 'package:akuCommunity/constants/app_values.dart';
import 'package:akuCommunity/provider/app_provider.dart'; import 'package:akuCommunity/provider/app_provider.dart';
import 'package:akuCommunity/ui/profile/house/pick_my_house_page.dart'; import 'package:akuCommunity/ui/profile/house/pick_my_house_page.dart';
import 'package:flustars/flustars.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -34,6 +35,7 @@ class _VisitorAccessPageState extends State<VisitorAccessPage> {
TextEditingController _userCarNum = new TextEditingController(); TextEditingController _userCarNum = new TextEditingController();
DateTime dateTime; DateTime dateTime;
int _selectSex = 1; int _selectSex = 1;
GlobalKey<FormState> formKey = GlobalKey<FormState>();
Widget _buildHouseCard( Widget _buildHouseCard(
String title, String title,
@ -82,7 +84,8 @@ class _VisitorAccessPageState extends State<VisitorAccessPage> {
); );
} }
Widget _input(String title, hintText, TextEditingController controller) { Widget _input(String title, hintText, TextEditingController controller,
FormFieldValidator validator) {
return Container( return Container(
padding: EdgeInsets.only( padding: EdgeInsets.only(
left: 36.w, left: 36.w,
@ -103,7 +106,11 @@ class _VisitorAccessPageState extends State<VisitorAccessPage> {
style: TextStyle(fontSize: 28.sp, color: Color(0xff333333)), style: TextStyle(fontSize: 28.sp, color: Color(0xff333333)),
), ),
SizedBox(height: 25.w), SizedBox(height: 25.w),
CommonInput(inputController: controller, hintText: hintText) CommonInput(
inputController: controller,
hintText: hintText,
validator: validator,
),
], ],
), ),
); );
@ -243,11 +250,17 @@ class _VisitorAccessPageState extends State<VisitorAccessPage> {
) { ) {
return MaterialButton( return MaterialButton(
onPressed: () async { onPressed: () async {
if (formKey.currentState.validate()) {
if (dateTime == null) {
BotToast.showText(text: '请选择到访时间');
return;
}
VoidCallback cancel = BotToast.showLoading(); VoidCallback cancel = BotToast.showLoading();
await ManagerFunc.insertVisitorInfo(id, type, _userName.text, await ManagerFunc.insertVisitorInfo(id, type, _userName.text,
_selectSex, tel, _userCarNum.text, dateTime); _selectSex, tel, _userCarNum.text, dateTime);
cancel(); cancel();
Get.off(VisitorRecordPage()); Get.off(VisitorRecordPage());
}
}, },
minWidth: double.infinity, minWidth: double.infinity,
height: 96.w, height: 96.w,
@ -293,8 +306,8 @@ class _VisitorAccessPageState extends State<VisitorAccessPage> {
child: '访客记录'.text.black.size(28.sp).make(), child: '访客记录'.text.black.size(28.sp).make(),
) )
], ],
body: Container( body: Form(
color: Colors.white, key: formKey,
child: ListView( child: ListView(
children: [ children: [
SingleChildScrollView( SingleChildScrollView(
@ -309,9 +322,23 @@ class _VisitorAccessPageState extends State<VisitorAccessPage> {
S.of(context).tempPlotName, S.of(context).tempPlotName,
appProvider.selectedHouse.roomName, appProvider.selectedHouse.roomName,
), ),
_input('访客姓名', '请输入访客姓名', _userName), _input(
'访客姓名',
'请输入访客姓名',
_userName,
(text) {
if (TextUtil.isEmpty(text)) return '姓名不能为空';
if (!RegexUtil.isZh(text)) return '姓名包含特殊文字';
return null;
},
),
_sexSelect(), _sexSelect(),
_input('是否驾车', '请输入,例如浙A88888(没有驾车可不填)', _userCarNum), _input(
'是否驾车',
'请输入,例如浙A88888(没有驾车可不填)',
_userCarNum,
(text) => null,
),
_selectTime(), _selectTime(),
SizedBox(height: 64.w), SizedBox(height: 64.w),
_create( _create(
@ -325,7 +352,7 @@ class _VisitorAccessPageState extends State<VisitorAccessPage> {
), ),
), ),
], ],
), ).material(color: Colors.white),
), ),
); );
} }

@ -68,7 +68,7 @@ class _AdvicePageState extends State<AdvicePage> with TickerProviderStateMixin {
return index == 0 ? 2 : 1; return index == 0 ? 2 : 1;
break; break;
case AdviceType.COMPLAIN: case AdviceType.COMPLAIN:
return index == 0 ? 4 : 3; return index == 0 ? 3 : 4;
break; break;
} }
return 0; return 0;

@ -100,7 +100,7 @@ class _NewAdvicePageState extends State<NewAdvicePage> {
Future addAdvice(int type, List<File> files, String content) async { Future addAdvice(int type, List<File> files, String content) async {
VoidCallback cancel = BotToast.showLoading(); VoidCallback cancel = BotToast.showLoading();
List<String> urls = List<String> urls =
await NetUtil().uploadFiles(files, API.upload.uploadArticle); await NetUtil().uploadFiles(files, API.upload.uploadAdvice);
BaseModel baseModel = await NetUtil().post( BaseModel baseModel = await NetUtil().post(
API.manager.addAdvice, API.manager.addAdvice,
params: { params: {
@ -210,7 +210,7 @@ class _NewAdvicePageState extends State<NewAdvicePage> {
type = _type == 0 ? 2 : 1; type = _type == 0 ? 2 : 1;
break; break;
case AdviceType.COMPLAIN: case AdviceType.COMPLAIN:
type = _type == 0 ? 4 : 3; type = _type == 0 ? 3 : 4;
break; break;
} }
addAdvice(type, _files, _editingController.text); addAdvice(type, _files, _editingController.text);

@ -7,7 +7,9 @@ import 'package:akuCommunity/utils/headers.dart';
class CommonInput extends StatefulWidget { class CommonInput extends StatefulWidget {
final TextEditingController inputController; final TextEditingController inputController;
final String hintText; final String hintText;
CommonInput({Key key, this.inputController, this.hintText}) : super(key: key); final FormFieldValidator validator;
CommonInput({Key key, this.inputController, this.hintText, this.validator})
: super(key: key);
@override @override
_CommonInputState createState() => _CommonInputState(); _CommonInputState createState() => _CommonInputState();
@ -18,6 +20,7 @@ class _CommonInputState extends State<CommonInput> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
child: TextFormField( child: TextFormField(
validator: widget.validator,
cursorColor: Color(0xffffc40c), cursorColor: Color(0xffffc40c),
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,

@ -28,10 +28,7 @@ class HorizontalImageView extends StatelessWidget {
itemBuilder: (context, index) { itemBuilder: (context, index) {
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
Get.to( BeeImagePreview.toPath(path: urls[index], tag: urls[index]);
BeeImagePreview.path(path: urls[index]),
opaque: false,
);
}, },
child: Hero( child: Hero(
tag: urls[index], tag: urls[index],

@ -582,7 +582,7 @@ packages:
name: power_logger name: power_logger
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.0-nullsafety.0" version: "1.0.1-nullsafety.1"
process: process:
dependency: transitive dependency: transitive
description: description:

@ -55,7 +55,7 @@ dependencies:
ref: null-safety ref: null-safety
image_picker: ^0.7.3 image_picker: ^0.7.3
power_logger: ^1.0.0-nullsafety.0 power_logger: ^1.0.0-nullsafety.1
flutter_rating_bar: ^4.0.0 flutter_rating_bar: ^4.0.0
jpush_flutter: ^2.0.1 jpush_flutter: ^2.0.1
open_file: ^3.1.0 open_file: ^3.1.0

Loading…
Cancel
Save