update fixed submit module

hmxc
张萌 4 years ago
parent ded21ef0b5
commit 4617d6241c

@ -92,4 +92,7 @@ class _Upload {
/// ///
String get uploadAvatar => '/user/upload/appHeadSculpture'; String get uploadAvatar => '/user/upload/appHeadSculpture';
///
String get uploadRepair => '/user/upload/uploadRepair';
} }

@ -1,3 +1,5 @@
import 'dart:io';
import 'package:akuCommunity/constants/api.dart'; import 'package:akuCommunity/constants/api.dart';
import 'package:akuCommunity/utils/network/base_model.dart'; import 'package:akuCommunity/utils/network/base_model.dart';
import 'package:akuCommunity/utils/network/net_util.dart'; import 'package:akuCommunity/utils/network/net_util.dart';

@ -78,7 +78,7 @@ class _FixedSubmitPageState extends State<FixedSubmitPage> {
Widget _buildCard(FixedSubmitModel model) { Widget _buildCard(FixedSubmitModel model) {
return AnimatedPositioned( return AnimatedPositioned(
top: 0, top: 0,
left: (_canSkew(4) && _isEdit) ? 55.w : 0, left: (_canSkew(model.status) && _isEdit) ? 55.w : 0,
bottom: 0, bottom: 0,
duration: Duration(milliseconds: 300), duration: Duration(milliseconds: 300),
curve: Curves.easeInOutCubic, curve: Curves.easeInOutCubic,
@ -86,11 +86,12 @@ class _FixedSubmitPageState extends State<FixedSubmitPage> {
width: 686.w, width: 686.w,
decoration: BoxDecoration( decoration: BoxDecoration(
color: kForeGroundColor, borderRadius: BorderRadius.circular(8.w)), color: kForeGroundColor, borderRadius: BorderRadius.circular(8.w)),
padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 24.w),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Row( Padding(
padding: EdgeInsets.fromLTRB(24.w, 24.w, 24.w, 0),
child: Row(
children: [ children: [
BeeMap() BeeMap()
.fixTag[model.type] .fixTag[model.type]
@ -108,22 +109,36 @@ class _FixedSubmitPageState extends State<FixedSubmitPage> {
.make(), .make(),
], ],
), ),
),
24.hb, 24.hb,
Divider( Padding(
padding: EdgeInsets.symmetric(
horizontal: 24.w,
),
child: Divider(
thickness: 1.w, thickness: 1.w,
height: 0, height: 0,
), ),
),
24.hb, 24.hb,
model.reportDetail.text Padding(
padding: EdgeInsets.symmetric(
horizontal: 24.w,
),
child: model.reportDetail.text
.color(ktextSubColor) .color(ktextSubColor)
.size(28.sp) .size(28.sp)
.ellipsis .ellipsis
.make(), .make(),
16.hb, ),
model.imgUrls.length != 0 // 16.hb,
? HorizontalImageView(List.generate( Padding(
model.imgUrls.length, (index) => model.imgUrls[index].url)) padding: EdgeInsets.only(left: 8.w),
child: model.imgUrls.length != 0
? HorizontalImageView(List.generate(model.imgUrls.length,
(index) => model.imgUrls[index].url))
: SizedBox(), : SizedBox(),
),
], ],
), ),
), ),
@ -157,10 +172,17 @@ class _FixedSubmitPageState extends State<FixedSubmitPage> {
}, },
), ),
CupertinoDialogAction( CupertinoDialogAction(
child: '删除订单'.text.color(Color(0xFFFF8200)).size(34.sp).bold.isIntrinsic.make(), child: '删除订单'
.text
.color(Color(0xFFFF8200))
.size(34.sp)
.bold
.isIntrinsic
.make(),
onPressed: () { onPressed: () {
ManagerFunc.reportRepairDelete(_selected); ManagerFunc.reportRepairDelete(_selected);
Get.back(); Get.back();
_selected.clear();
_easyRefreshController.callRefresh(); _easyRefreshController.callRefresh();
}, },
) )

@ -1,9 +1,16 @@
import 'dart:io';
import 'package:akuCommunity/base/base_style.dart'; import 'package:akuCommunity/base/base_style.dart';
import 'package:akuCommunity/constants/api.dart';
import 'package:akuCommunity/pages/manager_func.dart'; import 'package:akuCommunity/pages/manager_func.dart';
import 'package:akuCommunity/pages/things_page/widget/finish_fixed_submit_page.dart'; import 'package:akuCommunity/pages/things_page/widget/finish_fixed_submit_page.dart';
import 'package:akuCommunity/provider/user_provider.dart'; import 'package:akuCommunity/provider/user_provider.dart';
import 'package:akuCommunity/utils/network/base_model.dart';
import 'package:akuCommunity/utils/network/net_util.dart';
import 'package:akuCommunity/widget/bee_divider.dart'; import 'package:akuCommunity/widget/bee_divider.dart';
import 'package:akuCommunity/widget/bee_scaffold.dart'; import 'package:akuCommunity/widget/bee_scaffold.dart';
import 'package:akuCommunity/widget/picker/grid_image_picker.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -25,6 +32,7 @@ class _AddFixedSubmitPageState extends State<AddFixedSubmitPage> {
String reportText; String reportText;
List<String> _buttons = ['公区保修', '家庭维修']; List<String> _buttons = ['公区保修', '家庭维修'];
int _selectType; int _selectType;
List<File> _files;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
@ -170,26 +178,9 @@ class _AddFixedSubmitPageState extends State<AddFixedSubmitPage> {
children: [ children: [
'添加图片信息(${0}/9)'.text.black.size(28.sp).make(), '添加图片信息(${0}/9)'.text.black.size(28.sp).make(),
24.w.heightBox, 24.w.heightBox,
Row( GridImagePicker(onChange: (files) {
children: [ _files = files;
InkWell( })
onTap: () {},
child: Container(
alignment: Alignment.center,
width: 218.w,
height: 218.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.w),
border: Border.all(color: Color(0xFF979797), width: 1.w),
),
child: Icon(
CupertinoIcons.plus,
size: 80.w,
color:Color(0xFFD8D8D8) ,
)),
),
],
),
], ],
), ),
); );
@ -217,10 +208,15 @@ class _AddFixedSubmitPageState extends State<AddFixedSubmitPage> {
MaterialButton( MaterialButton(
minWidth: double.infinity, minWidth: double.infinity,
height: 98.w, height: 98.w,
onPressed: () { onPressed: () async {
ManagerFunc.reportRepairInsert( List<String> urls =
_selectType + 1, _textEditingController.text, []); await NetUtil().uploadFiles(_files, API.upload.uploadRepair);
BaseModel baseModel = await ManagerFunc.reportRepairInsert(
_selectType + 1, _textEditingController.text, urls);
if (baseModel.status) {
FinishFixedSubmitPage().to(); FinishFixedSubmitPage().to();
} else
BotToast.showText(text: baseModel.message);
}, },
child: '确认提交'.text.black.bold.size(32.sp).make(), child: '确认提交'.text.black.bold.size(32.sp).make(),
color: kPrimaryColor, color: kPrimaryColor,

@ -142,6 +142,19 @@ class NetUtil {
return BaseFileModel.err(); return BaseFileModel.err();
} }
Future<List<String>> uploadFiles(List<File> files, String api) async {
List<String> urls = [];
if (urls.isEmpty) {
for (var item in files) {
BaseFileModel model = await NetUtil().upload(api, item);
urls.add(model.url);
}
} else
return [];
return urls;
}
_parseErr(DioError err) { _parseErr(DioError err) {
_logger.v({ _logger.v({
'type': err.type.toString(), 'type': err.type.toString(),

@ -25,15 +25,16 @@ class _HorizontalImageViewState extends State<HorizontalImageView> {
itemBuilder: (context, index) { itemBuilder: (context, index) {
return Padding( return Padding(
padding: EdgeInsets.all(16.w), padding: EdgeInsets.all(16.w),
// child: ClipRRect( child: ClipRRect(
// borderRadius: BorderRadius.circular(8.w), borderRadius: BorderRadius.circular(8.w),
// child: FadeInImage.assetNetwork( child: FadeInImage.assetNetwork(
// placeholder: R.ASSETS_IMAGES_DRAWINGS_PNG, placeholder: R.ASSETS_ICONS_PROPOSAL_PNG,
// image: API.resource + widget.urls[index], image: API.image(widget.urls[index]),
// ), ),
// ), ),
); );
}, },
itemCount: widget.urls.length,
), ),
); );
} }

@ -106,7 +106,12 @@ class _GridImagePickerState extends State<GridImagePicker> {
mainAxisSpacing: 16.w, mainAxisSpacing: 16.w,
), ),
itemBuilder: (context, index) { itemBuilder: (context, index) {
if (index == 0) return _buildSelect(); if (index == 0) {
if (_files.length >= 9) {
return _buildItem(_files[8]);
} else
return _buildSelect();
}
return _buildItem(_files[index - 1]); return _buildItem(_files[index - 1]);
}, },
itemCount: displayLength, itemCount: displayLength,

Loading…
Cancel
Save