咨询建议上传图片修复

hmxc
小赖 4 years ago
parent e0b38ddf1d
commit c869bfce69

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

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

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

@ -100,7 +100,7 @@ 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);
await NetUtil().uploadFiles(files, API.upload.uploadAdvice);
BaseModel baseModel = await NetUtil().post(
API.manager.addAdvice,
params: {
@ -210,7 +210,7 @@ class _NewAdvicePageState extends State<NewAdvicePage> {
type = _type == 0 ? 2 : 1;
break;
case AdviceType.COMPLAIN:
type = _type == 0 ? 4 : 3;
type = _type == 0 ? 3 : 4;
break;
}
addAdvice(type, _files, _editingController.text);

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

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

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

@ -55,7 +55,7 @@ dependencies:
ref: null-safety
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
jpush_flutter: ^2.0.1
open_file: ^3.1.0

Loading…
Cancel
Save