对接接口:app问卷调查提交

hmxc
张萌 4 years ago
parent 14a5fda462
commit acfb84c2c4

@ -160,6 +160,9 @@ class _Manager {
///id
String get questionnairefindById => '/user/questionnaire/findById';
///app
String get questionnaireSubmit => '/user/questionnaire/submit';
}
class _Community {

@ -1,30 +1,30 @@
// class QuestionnaireSubmitModel {
// int id;
// List<AppQuestionnaireAnswerSubmits> appQuestionnaireAnswerSubmits;
class QuestionnaireSubmitModel {
int id;
List<AppQuestionnaireAnswerSubmits> appQuestionnaireAnswerSubmits;
// QuestionnaireSubmitModel({this.id, this.appQuestionnaireAnswerSubmits});
QuestionnaireSubmitModel({this.id, this.appQuestionnaireAnswerSubmits});
// QuestionnaireSubmitModel.fromJson(Map<String, dynamic> json) {
// id = json['id'];
// if (json['appQuestionnaireAnswerSubmits'] != null) {
// appQuestionnaireAnswerSubmits = new List<AppQuestionnaireAnswerSubmits>();
// json['appQuestionnaireAnswerSubmits'].forEach((v) {
// appQuestionnaireAnswerSubmits
// .add(new AppQuestionnaireAnswerSubmits.fromJson(v));
// });
// }
// }
QuestionnaireSubmitModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
if (json['appQuestionnaireAnswerSubmits'] != null) {
appQuestionnaireAnswerSubmits = new List<AppQuestionnaireAnswerSubmits>();
json['appQuestionnaireAnswerSubmits'].forEach((v) {
appQuestionnaireAnswerSubmits
.add(new AppQuestionnaireAnswerSubmits.fromJson(v));
});
}
}
// Map<String, dynamic> toJson() {
// final Map<String, dynamic> data = new Map<String, dynamic>();
// data['id'] = this.id;
// if (this.appQuestionnaireAnswerSubmits != null) {
// data['appQuestionnaireAnswerSubmits'] =
// this.appQuestionnaireAnswerSubmits.map((v) => v.toJson()).toList();
// }
// return data;
// }
// }
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
if (this.appQuestionnaireAnswerSubmits != null) {
data['appQuestionnaireAnswerSubmits'] =
this.appQuestionnaireAnswerSubmits.map((v) => v.toJson()).toList();
}
return data;
}
}
class AppQuestionnaireAnswerSubmits {
int topicId;

@ -1,7 +1,10 @@
// Package imports:
import 'dart:convert';
import 'package:akuCommunity/model/manager/article_QR_code_model.dart';
import 'package:akuCommunity/model/manager/moving_company_model.dart';
import 'package:akuCommunity/model/manager/questionnaire_detail_model.dart';
import 'package:akuCommunity/model/manager/quetionnaire_submit_model.dart';
import 'package:akuCommunity/model/manager/voting_detail_model.dart';
import 'package:dio/dio.dart';
import 'package:flustars/flustars.dart';
@ -194,4 +197,17 @@ class ManagerFunc {
);
return QuestionnaireDetialModel.fromJson(baseModel.data);
}
static Future<BaseModel> questionnaireSubmit(
int id, List<AppQuestionnaireAnswerSubmits> model) async {
BaseModel baseModel = await NetUtil().post(
API.manager.questionnaireSubmit,
params: {
'id': id,
'appQuestionnaireAnswerSubmits': jsonEncode(model),
},
showMessage: true,
);
return baseModel;
}
}

@ -151,6 +151,7 @@ class _QuestionnaireDetailPageState extends State<QuestionnaireDetailPage> {
answers: questionModel.questionnaireChoiceVoList);
case 2:
submitModels[index].choiceAnswer.remove(-1);
return QuestionnaireRadioCheck(
title: questionModel.topic,
selected: submitModels[index].choiceAnswer,
@ -246,7 +247,9 @@ class _QuestionnaireDetailPageState extends State<QuestionnaireDetailPage> {
),
bottomNavi: BottomButton(
child: '确认提交'.text.black.size(32.sp).bold.make(),
onPressed: () {},
onPressed: () async {
await ManagerFunc.questionnaireSubmit(widget.id, _submitModels);
},
),
);
}

Loading…
Cancel
Save