提交 03879430 authored 作者: maodou's avatar maodou

1:意见反馈接口调用-提交反馈

上级 5415f496
......@@ -293,4 +293,20 @@ abstract class MineAPI {
if (result.data is! Map) return HelpCenterContentModel();
return HelpCenterContentModel.fromJson(result.data);
}
/// 18、意见反馈
///
static Future<bool> feedback(String? proposal) async {
Map<String, dynamic> params = {};
if (proposal != null) {
params['proposal'] = proposal;
}
final result = await HttpService.to
.post('/v1/members/Information/proposal', params: params);
if (result.data is Map && result.data['is_success'] == 1) {
return true;
}
return false;
}
}
part of user_feedback;
/// 提交意见反馈
class UserFeedbackController extends GetxController {
late TextEditingController searchController = TextEditingController();
/// 提交意见反馈
void upFeedback() async {
final result = await MineAPI.feedback(searchController.text);
if (result) {
Toast.show('提交成功');
update();
}
}
}
......@@ -3,7 +3,11 @@ library user_feedback;
import 'package:flutter/material.dart';
import 'package:flutter_book/utils/index.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get_state_manager/src/simple/get_controllers.dart';
import 'package:get/get_state_manager/src/simple/get_state.dart';
import '../../apis/index.dart';
import '../../widgets/index.dart';
part 'view.dart';
\ No newline at end of file
part 'view.dart';
part 'controller.dart';
\ No newline at end of file
......@@ -10,66 +10,65 @@ class UserFeedbackPage extends StatefulWidget {
class _UserFeedbackPageState extends State<UserFeedbackPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('意见反馈'),
centerTitle: true,
),
body: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.w),
color: Colors.transparent,
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Container(
alignment: Alignment.centerLeft,
padding: EdgeInsets.only(left: 10.w, top: 16.5.w),
child: Text.rich(TextSpan(children: [
TextSpan(
text: "*",
style: TextStyle(fontSize: 14, color: Colours.cAB1941)),
TextSpan(
text: "问题描述或建议",
style: TextStyle(
fontSize: 14.w,
color: Colours.c3,
fontWeight: FontWeight.bold)),
])),
return GetBuilder<UserFeedbackController>(
init: UserFeedbackController(),
builder: (controller) => Scaffold(
appBar: AppBar(
title: const Text('意见反馈'),
centerTitle: true,
),
body: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.w),
color: Colors.transparent,
),
Container(
padding: EdgeInsets.only(
left: 10.w, right: 10.w, top: 6.5.w, bottom: 10.w),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Container(
alignment: Alignment.centerLeft,
padding: EdgeInsets.only(left: 10.w, top: 16.5.w),
child: Text.rich(TextSpan(children: [
const TextSpan(
text: "*",
style:
TextStyle(fontSize: 14, color: Colours.cAB1941)),
TextSpan(
text: "问题描述或建议",
style: TextStyle(
fontSize: 14.w,
color: Colours.c3,
fontWeight: FontWeight.bold)),
])),
),
Container(
padding: EdgeInsets.only(
left: 10.w, right: 10.w, top: 6.5.w, bottom: 10.w),
child: CustomInput(
controller: controller.searchController,
maxLines: 5,
hintText: '请描述你的问题,我们会尽快处理并回复',
),
),
child: const CustomInput(
maxLines: 5,
hintText: '请描述你的问题,我们会尽快处理并回复',
),
// _buildTextField(context),
Container(
padding: EdgeInsets.only(
left: 10.w, right: 10.w, top: 35.w, bottom: 20.w),
width: double.infinity,
child: CustomGradientButton(
text: '提交反馈',
isEnabled: true,
onPressed: () {
controller.upFeedback();
FocusNode blankNode = FocusNode();
FocusScope.of(context).requestFocus(blankNode);
print('提交反馈');
// controller.onLogin(context);
},
)),
],
),
// _buildTextField(context),
Container(
padding: EdgeInsets.only(
left: 10.w, right: 10.w, top: 35.w, bottom: 20.w),
width: double.infinity,
child:
CustomGradientButton(
text: '提交反馈',
isEnabled: true,
onPressed: () {
print('提交反馈');
// controller.onLogin(context);
},
)
),
],
),
)
);
)));
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论