Browse Source

优化完善功能

ios
王子贤 2 months ago
parent
commit
80be6fa732
12 changed files with 375 additions and 206 deletions
  1. 60
      lib/controller/home/event_info_controller.dart
  2. 4
      lib/controller/mine/mine_controller.dart
  3. 1
      lib/controller/setting/setting_controller.dart
  4. 6
      lib/network/api_urls.dart
  5. 10
      lib/network/home_api.dart
  6. 68
      lib/network/home_api.g.dart
  7. 123
      lib/pages/home/event_info.dart
  8. 282
      lib/pages/home/recommend_tab.dart
  9. 1
      lib/pages/home/timeline_item.dart
  10. 13
      lib/pages/home/user_information_page.dart
  11. 1
      lib/pages/mine/edit_info_page.dart
  12. 12
      lib/pages/setting/setting_page.dart

60
lib/controller/home/event_info_controller.dart

@ -2,6 +2,9 @@ import 'package:dating_touchme_app/model/home/event_data.dart';
import 'package:dating_touchme_app/network/home_api.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
import 'package:intl/intl.dart';
import '../global.dart';
class EventInfoController extends GetxController {
final String id;
@ -10,6 +13,8 @@ class EventInfoController extends GetxController {
final item = EventData().obs;
late final HomeApi _homeApi;
final isOpen = true.obs;
@override
void onInit() {
super.onInit();
@ -22,8 +27,14 @@ class EventInfoController extends GetxController {
final response = await _homeApi.userGetSiteActivityDetails(id: id);
if (response.data.isSuccess && response.data.data != null) {
item.value = response.data.data ?? EventData();
final formatter = DateFormat('yyyy-MM-dd HH:mm:ss');
final dateTime = formatter.parse(item.value.applyEndTime ?? "1970-01-01 08:00:00");
final now = DateTime.now();
if (dateTime.isBefore(now)) {
isOpen.value = false;
} else {
isOpen.value = true;
}
} else {
//
@ -36,4 +47,49 @@ class EventInfoController extends GetxController {
}
}
submit() async {
try {
final response = await _homeApi.userParticipateInSiteActivity({
"id": item.value.id ?? "",
"miId": GlobalData().userData?.id ?? "",
});
if (response.data.isSuccess) {
SmartDialog.showToast('报名成功');
Get.back();
} else {
//
throw Exception(response.data.message ?? '获取数据失败');
}
} catch(e){
print('帖子发布失败: $e');
SmartDialog.showToast('报名失败');
rethrow;
}
}
quit() async {
try {
final response = await _homeApi.userQuitSiteActivity({
"id": item.value.id ?? "",
});
if (response.data.isSuccess) {
SmartDialog.showToast('退出活动已提交审核');
Get.back();
} else {
//
throw Exception(response.data.message ?? '获取数据失败');
}
} catch(e){
print('帖子发布失败: $e');
SmartDialog.showToast('退出活动失败');
rethrow;
}
}
}

4
lib/controller/mine/mine_controller.dart

@ -22,8 +22,8 @@ class MineController extends GetxController {
final settingList = <Map>[
{"icon": Assets.imagesSetting, "title": "设置", "path": () => SettingPage()},
{"icon": Assets.imagesCustomer, "title": "联系客服", "path": () => null},
{"icon": Assets.imagesMail, "title": "意见反馈", "path": () => UserHelpCenterPage()},
// {"icon": Assets.imagesCustomer, "title": "联系客服", "path": () => null},
// {"icon": Assets.imagesMail, "title": "意见反馈", "path": () => UserHelpCenterPage()},
].obs;
final userData = GlobalData().userData.obs;

1
lib/controller/setting/setting_controller.dart

@ -18,6 +18,7 @@ class SettingController extends GetxController {
final packageName = ''.obs;
final version = ''.obs;
final buildNumber = ''.obs;
final x = ''.obs;
@override
Future<void> onInit() async {

6
lib/network/api_urls.dart

@ -140,6 +140,12 @@ class ApiUrls {
static const String userPageOwnPostDynamic =
'dating-agency-service/user/page/own-post-dynamic';
static const String userParticipateInSiteActivity =
'dating-agency-service/user/participate/in/site/activity';
static const String userQuitSiteActivity =
'dating-agency-service/user/quit/site/activity';
// API端点
static const String listMatchmakerProduct =
'dating-agency-mall/user/page/product/by/matchmaker';

10
lib/network/home_api.dart

@ -81,4 +81,14 @@ abstract class HomeApi {
@Query('pageNum') required int pageNum,
@Query('pageSize') required int pageSize,
});
@POST(ApiUrls.userParticipateInSiteActivity)
Future<HttpResponse<BaseResponse<dynamic>>> userParticipateInSiteActivity(
@Body() Map<String, dynamic> data,
);
@POST(ApiUrls.userQuitSiteActivity)
Future<HttpResponse<BaseResponse<dynamic>>> userQuitSiteActivity(
@Body() Map<String, dynamic> data,
);
}

68
lib/network/home_api.g.dart

@ -422,6 +422,74 @@ class _HomeApi implements HomeApi {
return httpResponse;
}
@override
Future<HttpResponse<BaseResponse<dynamic>>> userParticipateInSiteActivity(
Map<String, dynamic> data,
) async {
final _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _headers = <String, dynamic>{};
final _data = <String, dynamic>{};
_data.addAll(data);
final _options = _setStreamType<HttpResponse<BaseResponse<dynamic>>>(
Options(method: 'POST', headers: _headers, extra: _extra)
.compose(
_dio.options,
'dating-agency-service/user/participate/in/site/activity',
queryParameters: queryParameters,
data: _data,
)
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
);
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
late BaseResponse<dynamic> _value;
try {
_value = BaseResponse<dynamic>.fromJson(
_result.data!,
(json) => json as dynamic,
);
} on Object catch (e, s) {
errorLogger?.logError(e, s, _options);
rethrow;
}
final httpResponse = HttpResponse(_value, _result);
return httpResponse;
}
@override
Future<HttpResponse<BaseResponse<dynamic>>> userQuitSiteActivity(
Map<String, dynamic> data,
) async {
final _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _headers = <String, dynamic>{};
final _data = <String, dynamic>{};
_data.addAll(data);
final _options = _setStreamType<HttpResponse<BaseResponse<dynamic>>>(
Options(method: 'POST', headers: _headers, extra: _extra)
.compose(
_dio.options,
'dating-agency-service/user/quit/site/activity',
queryParameters: queryParameters,
data: _data,
)
.copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)),
);
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
late BaseResponse<dynamic> _value;
try {
_value = BaseResponse<dynamic>.fromJson(
_result.data!,
(json) => json as dynamic,
);
} on Object catch (e, s) {
errorLogger?.logError(e, s, _options);
rethrow;
}
final httpResponse = HttpResponse(_value, _result);
return httpResponse;
}
RequestOptions _setStreamType<T>(RequestOptions requestOptions) {
if (T != dynamic &&
!(requestOptions.responseType == ResponseType.bytes ||

123
lib/pages/home/event_info.dart

@ -1,6 +1,7 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:dating_touchme_app/components/page_appbar.dart';
import 'package:dating_touchme_app/controller/home/event_info_controller.dart';
import 'package:dating_touchme_app/extension/ex_widget.dart';
import 'package:dating_touchme_app/generated/assets.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -48,14 +49,17 @@ class EventInfo extends StatelessWidget {
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
controller.item.value.name ?? "",
style: TextStyle(
fontSize: 18.w,
color: const Color.fromRGBO(255, 66, 236, 1),
fontWeight: FontWeight.w500
Expanded(
child: Text(
controller.item.value.name ?? "",
style: TextStyle(
fontSize: 18.w,
color: const Color.fromRGBO(255, 66, 236, 1),
fontWeight: FontWeight.w500
),
),
),
SizedBox(width: 10.w,),
Row(
children: [
Icon(
@ -147,53 +151,7 @@ class EventInfo extends StatelessWidget {
)
],
),
SizedBox(height: 5.w,),
Row(
children: [
Icon(
Icons.currency_yen,
color: const Color.fromRGBO(255, 66, 236, 1),
size: 12.w,
),
Text(
"费用:",
style: TextStyle(
fontSize: 12.w,
color: const Color.fromRGBO(144, 144, 144, 1)
),
),
Text(
"男:${controller.item.value.participationAllocationList![0].originalPrice}元/人",
style: TextStyle(
fontSize: 12.w,
color: const Color.fromRGBO(144, 144, 144, 1)
),
)
],
),
Row(
children: [
Icon(
Icons.currency_yen,
color: const Color.fromRGBO(255, 66, 236, 0),
size: 12.w,
),
Text(
"费用:",
style: TextStyle(
fontSize: 12.w,
color: const Color.fromRGBO(144, 144, 144, 0)
),
),
Text(
"女:${controller.item.value.participationAllocationList![1].originalPrice}元/人",
style: TextStyle(
fontSize: 12.w,
color: const Color.fromRGBO(144, 144, 144, 1)
),
)
],
),
SizedBox(height: 15.w,),
Stack(
children: [
@ -281,7 +239,64 @@ class EventInfo extends StatelessWidget {
),
),
),
bottomNavigationBar: Container(
bottomNavigationBar: (controller.item.value.participantStatus == 0 || controller.item.value.participantStatus == -1) ? Container(
height: 60.w,
color: Colors.white,
child: Center(
child: Container(
width: 350.w,
height: 45.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(45.w)),
color: Colors.grey,
),
child: Center(
child: Text(
"已报名",
style: TextStyle(
fontSize: 18.w,
color: Colors.white,
fontWeight: FontWeight.w500
),
),
),
),
),
) : controller.isOpen.value ? Container(
height: 60.w,
color: Colors.white,
child: Center(
child: Container(
width: 350.w,
height: 45.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(45.w)),
gradient: LinearGradient(
begin: Alignment.centerLeft, // 90deg:
end: Alignment.centerRight,
colors: [
Color.fromRGBO(131, 89, 255, 1), //
Color.fromRGBO(77, 127, 231, 1), //
Color.fromRGBO(61, 138, 224, 1), //
],
stops: [0.0, 0.7753, 1.0], // 0%77.53%100%
),
),
child: Center(
child: Text(
"立即报名",
style: TextStyle(
fontSize: 18.w,
color: Colors.white,
fontWeight: FontWeight.w500
),
),
),
),
),
).onTap((){
controller.submit();
}) : Container(
height: 60.w,
color: Colors.white,
child: Center(

282
lib/pages/home/recommend_tab.dart

@ -111,158 +111,160 @@ class _RecommendTabState extends State<RecommendTab>
_refreshController.finishLoad(IndicatorResult.fail);
}
},
child: Column(
children: [
Container(
padding: EdgeInsets.symmetric(horizontal: 12),
margin: EdgeInsets.only(bottom: 10.w),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
width: 174.w,
height: 126.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(8.w)),
color: Colors.white
),
child: Column(
children: [
Stack(
children: [
ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(8.w)),
child: CachedNetworkImage(
imageUrl: "https://dating-agency-test.oss-accelerate.aliyuncs.com/1.png",
width: 174.w,
height: 84.w,
fit: BoxFit.cover,
child: SingleChildScrollView(
child: Column(
children: [
Container(
padding: EdgeInsets.symmetric(horizontal: 12),
margin: EdgeInsets.only(bottom: 10.w),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
width: 174.w,
height: 126.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(8.w)),
color: Colors.white
),
child: Column(
children: [
Stack(
children: [
ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(8.w)),
child: CachedNetworkImage(
imageUrl: "https://dating-agency-test.oss-accelerate.aliyuncs.com/1.png",
width: 174.w,
height: 84.w,
fit: BoxFit.cover,
),
),
),
Positioned(
child: Container(
width: 47.w,
height: 17.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(8.w),
bottomRight: Radius.circular(8.w),
Positioned(
child: Container(
width: 47.w,
height: 17.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(8.w),
bottomRight: Radius.circular(8.w),
),
color: const Color.fromRGBO(234, 57, 49, 1)
),
child: Center(
child: Text(
"热门活动",
style: TextStyle(
fontSize: 9.w,
color: Colors.white,
fontWeight: FontWeight.w500
),
),
),
color: const Color.fromRGBO(234, 57, 49, 1)
),
child: Center(
child: Text(
"热门活动",
style: TextStyle(
fontSize: 9.w,
color: Colors.white,
)
],
),
Container(
padding: EdgeInsets.all(5.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"星河 DEEP--轻奢浪漫之旅",
style: TextStyle(
fontSize: 13.w,
fontWeight: FontWeight.w500
),
),
),
),
)
],
),
Container(
padding: EdgeInsets.all(5.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"0人已报名",
style: TextStyle(
fontSize: 9.w,
color: const Color.fromRGBO(144, 144, 144, 1),
fontWeight: FontWeight.w500
),
),
Text(
"查看详情",
style: TextStyle(
fontSize: 9.w,
color: const Color.fromRGBO(144, 144, 144, 1),
fontWeight: FontWeight.w500
),
),
],
)
],
),
)
],
),
).onTap((){
Get.to(() => EventList());
}),
Container(
width: 167.w,
height: 126.w,
padding: EdgeInsets.all(7.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(8.w)),
color: Colors.white
),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"星河 DEEP--轻奢浪漫之旅",
"金牌红娘",
style: TextStyle(
fontSize: 13.w,
fontWeight: FontWeight.w500
fontSize: 13.w,
fontWeight: FontWeight.w700
),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"0人已报名",
style: TextStyle(
fontSize: 9.w,
color: const Color.fromRGBO(144, 144, 144, 1),
fontWeight: FontWeight.w500
),
),
Text(
"查看详情",
style: TextStyle(
fontSize: 9.w,
color: const Color.fromRGBO(144, 144, 144, 1),
fontWeight: FontWeight.w500
),
),
],
)
Text(
"查看更多",
style: TextStyle(
fontSize: 9.w,
color: const Color.fromRGBO(144, 144, 144, 1),
fontWeight: FontWeight.w500
),
).onTap((){
Get.to(() => MatchmakerPage());
})
],
),
)
],
),
).onTap((){
Get.to(() => EventList());
}),
Container(
width: 167.w,
height: 126.w,
padding: EdgeInsets.all(7.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(8.w)),
color: Colors.white
),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"金牌红娘",
style: TextStyle(
fontSize: 13.w,
fontWeight: FontWeight.w700
),
),
Text(
"查看更多",
style: TextStyle(
fontSize: 9.w,
color: const Color.fromRGBO(144, 144, 144, 1),
fontWeight: FontWeight.w500
),
).onTap((){
Get.to(() => MatchmakerPage());
})
],
),
Wrap(
spacing: 14.w,
runSpacing: 8.w,
children: [
...controller.nearbyFeed.take(6).toList().map((e){
return MatchmakerItem(item: e);
})
],
)
],
Wrap(
spacing: 14.w,
runSpacing: 8.w,
children: [
...controller.nearbyFeed.take(6).toList().map((e){
return MatchmakerItem(item: e);
})
],
)
],
),
),
),
],
),
),
Container(
padding: EdgeInsets.symmetric(horizontal: 12),
child: Image.asset(
Assets.imagesBanner,
width: 375.w - 24,
],
),
),
).onTap((){
Get.to(() => OpenWebView(url: "https://www.quzhaoqin.com/"));
}),
Expanded(
child: ListView.separated(
Container(
padding: EdgeInsets.symmetric(horizontal: 12),
child: Image.asset(
Assets.imagesBanner,
width: 375.w - 24,
),
).onTap((){
Get.to(() => OpenWebView(url: "https://www.quzhaoqin.com/"));
}),
ListView.separated(
shrinkWrap: true, // 1
physics: const NeverScrollableScrollPhysics(), // 2
// 使
// padding AppBar
padding: EdgeInsets.only(left: 12, right: 12),
@ -305,9 +307,9 @@ class _RecommendTabState extends State<RecommendTab>
},
// item
itemCount: controller.recommendFeed.isEmpty ? 1 : controller.recommendFeed.length,
),
)
],
)
],
),
)
);
});

1
lib/pages/home/timeline_item.dart

@ -298,6 +298,7 @@ class _TimelineItemState extends State<TimelineItem> {
),
).onTap((){
Get.to(() => TimelineInfo(id: widget.item.id ?? "",))?.then((e){
print(12121212121212);
widget.item.likeCount = e.likeCount;
widget.item.isLiked = e.isLiked;
widget.item.commentCount = e.commentCount;

13
lib/pages/home/user_information_page.dart

@ -195,6 +195,7 @@ class UserInformationPage extends StatelessWidget {
children: [
Container(
width: 375.w,
height: 812.h,
padding: EdgeInsets.only(
top: 31.w,
left: 15.w,
@ -402,7 +403,7 @@ class UserInformationPage extends StatelessWidget {
color: const Color.fromRGBO(144, 144, 144, 1),
margin: EdgeInsets.symmetric(vertical: 15.w),
),
if(controller.postList.isNotEmpty) Row(
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
@ -416,7 +417,15 @@ class UserInformationPage extends StatelessWidget {
SizedBox(height: 10.w,),
...controller.postList.map((e){
return TimelineItem(item: e);
})
}),
if(controller.postList.isEmpty) Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('暂无数据'),
],
),
)
],
),
),

1
lib/pages/mine/edit_info_page.dart

@ -307,6 +307,7 @@ class _EditInfoPageState extends State<EditInfoPage> {
File(controller.avatarLocalPath.value),
width: 85.w,
height: 85.w,
fit: BoxFit.cover,
) : (controller.userData.value?.profilePhoto?.isNotEmpty ?? false) ? CachedNetworkImage(
imageUrl: "${controller.userData.value?.profilePhoto ?? ""}?x-oss-process=image/format,webp/resize,w_170",
width: 85.w,

12
lib/pages/setting/setting_page.dart

@ -27,13 +27,13 @@ class SettingPage extends StatelessWidget {
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Color(0xffF5F5F5),
appBar: PageAppbar(title: "设置"),
appBar: PageAppbar(title: "设置${controller.x.value}"),
body: SingleChildScrollView(
padding: EdgeInsetsGeometry.symmetric(vertical: 16.w),
child: Obx(() {
return Column(
children: [
TDCellGroup(
if(false) TDCellGroup(
theme: TDCellGroupTheme.cardTheme,
cells: [
TDCell(
@ -61,13 +61,13 @@ class SettingPage extends StatelessWidget {
TDCellGroup(
theme: TDCellGroupTheme.cardTheme,
cells: [
TDCell(arrow: true, title: '黑名单', onClick: (cell) {
if(false) TDCell(arrow: true, title: '黑名单', onClick: (cell) {
Get.to(() => BlacklistPage());
}),
TDCell(arrow: true, title: '隐私设置', onClick: (cell) {
if(false) TDCell(arrow: true, title: '隐私设置', onClick: (cell) {
SmartDialog.showToast('功能暂未开放');
},),
TDCell(arrow: true, title: '青少年模式', onClick: (cell) {
TDCell(arrow: true, title: '青少年模式${controller.x.value}', onClick: (cell) {
Get.to(() => TeenagerModePage());
},),
],
@ -94,7 +94,7 @@ class SettingPage extends StatelessWidget {
Get.to(() => OpenWebView(url: "https://www.quzhaoqin.com/information.html"));
}),
TDCell(arrow: true, title: '检查更新', onClick: (cell) {
if(false) TDCell(arrow: true, title: '检查更新', onClick: (cell) {
// _showUpdateDialog();
// controller.checkVersion();
SmartDialog.showToast('功能暂未开放');

Loading…
Cancel
Save