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

hmxc
张萌 4 years ago
parent 14a5fda462
commit acfb84c2c4

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

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

@ -1,7 +1,10 @@
// Package imports: // Package imports:
import 'dart:convert';
import 'package:akuCommunity/model/manager/article_QR_code_model.dart'; import 'package:akuCommunity/model/manager/article_QR_code_model.dart';
import 'package:akuCommunity/model/manager/moving_company_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/questionnaire_detail_model.dart';
import 'package:akuCommunity/model/manager/quetionnaire_submit_model.dart';
import 'package:akuCommunity/model/manager/voting_detail_model.dart'; import 'package:akuCommunity/model/manager/voting_detail_model.dart';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flustars/flustars.dart'; import 'package:flustars/flustars.dart';
@ -194,4 +197,17 @@ class ManagerFunc {
); );
return QuestionnaireDetialModel.fromJson(baseModel.data); 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); answers: questionModel.questionnaireChoiceVoList);
case 2: case 2:
submitModels[index].choiceAnswer.remove(-1);
return QuestionnaireRadioCheck( return QuestionnaireRadioCheck(
title: questionModel.topic, title: questionModel.topic,
selected: submitModels[index].choiceAnswer, selected: submitModels[index].choiceAnswer,
@ -246,7 +247,9 @@ class _QuestionnaireDetailPageState extends State<QuestionnaireDetailPage> {
), ),
bottomNavi: BottomButton( bottomNavi: BottomButton(
child: '确认提交'.text.black.size(32.sp).bold.make(), child: '确认提交'.text.black.size(32.sp).bold.make(),
onPressed: () {}, onPressed: () async {
await ManagerFunc.questionnaireSubmit(widget.id, _submitModels);
},
), ),
); );
} }

Loading…
Cancel
Save