Merge branch 'master' of 192.168.2.201:laiiihz/akuCommunity

* 'master' of 192.168.2.201:laiiihz/akuCommunity:
  update fixed submit module
hmxc
小赖 4 years ago
commit bd869e6d3c

@ -95,4 +95,7 @@ class _Upload {
///
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/utils/network/base_model.dart';
import 'package:akuCommunity/utils/network/net_util.dart';

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

@ -1,9 +1,16 @@
import 'dart:io';
import 'package:akuCommunity/base/base_style.dart';
import 'package:akuCommunity/constants/api.dart';
import 'package:akuCommunity/pages/manager_func.dart';
import 'package:akuCommunity/pages/things_page/widget/finish_fixed_submit_page.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_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/material.dart';
import 'package:provider/provider.dart';
@ -25,6 +32,7 @@ class _AddFixedSubmitPageState extends State<AddFixedSubmitPage> {
String reportText;
List<String> _buttons = ['公区保修', '家庭维修'];
int _selectType;
List<File> _files;
@override
void initState() {
super.initState();
@ -170,26 +178,9 @@ class _AddFixedSubmitPageState extends State<AddFixedSubmitPage> {
children: [
'添加图片信息(${0}/9)'.text.black.size(28.sp).make(),
24.w.heightBox,
Row(
children: [
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) ,
)),
),
],
),
GridImagePicker(onChange: (files) {
_files = files;
})
],
),
);
@ -217,10 +208,15 @@ class _AddFixedSubmitPageState extends State<AddFixedSubmitPage> {
MaterialButton(
minWidth: double.infinity,
height: 98.w,
onPressed: () {
ManagerFunc.reportRepairInsert(
_selectType + 1, _textEditingController.text, []);
onPressed: () async {
List<String> urls =
await NetUtil().uploadFiles(_files, API.upload.uploadRepair);
BaseModel baseModel = await ManagerFunc.reportRepairInsert(
_selectType + 1, _textEditingController.text, urls);
if (baseModel.status) {
FinishFixedSubmitPage().to();
} else
BotToast.showText(text: baseModel.message);
},
child: '确认提交'.text.black.bold.size(32.sp).make(),
color: kPrimaryColor,

@ -142,6 +142,19 @@ class NetUtil {
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) {
_logger.v({
'type': err.type.toString(),

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

@ -113,7 +113,12 @@ class _GridImagePickerState extends State<GridImagePicker> {
mainAxisSpacing: 16.w,
),
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]);
},
itemCount: displayLength,

Loading…
Cancel
Save