pull/1/head
章文轩 3 years ago
commit 9af01afc50

@ -47,6 +47,15 @@ class _City {
} }
class _User { class _User {
///app()
String get sendTelCodeUpdateTel => '/app/user/sendTelCodeUpdateTel';
///
String get updateTel => '/app/user/updateTel';
///
String get updateSex => '/app/user/updateSex';
/// ///
String get userProfile => '/app/user/findDetail'; String get userProfile => '/app/user/findDetail';

@ -1,13 +1,11 @@
import 'package:aku_new_community/provider/user_provider.dart';
import 'package:aku_new_community/widget/bee_scaffold.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
import 'package:aku_new_community/provider/user_provider.dart';
import 'package:aku_new_community/widget/bee_scaffold.dart';
class ChangeNickName extends StatefulWidget { class ChangeNickName extends StatefulWidget {
ChangeNickName({Key? key}) : super(key: key); ChangeNickName({Key? key}) : super(key: key);

@ -173,7 +173,9 @@ class _SelectCommunityState extends State<SelectCommunity> {
borderRadius: BorderRadius.circular(4.w), borderRadius: BorderRadius.circular(4.w),
), ),
color: kPrimaryColor, color: kPrimaryColor,
onPressed: (){Navigator.pop(context);}, onPressed: () {
Navigator.pop(context);
},
child: '提交'.text.size(34.sp).make(), child: '提交'.text.size(34.sp).make(),
).centered(), ).centered(),
), ),
@ -192,22 +194,32 @@ class _SelectCommunityState extends State<SelectCommunity> {
} }
Widget _historyTile(HistoryLoginModel model) { Widget _historyTile(HistoryLoginModel model) {
return Container( return GestureDetector(
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w), onTap: () {
child: Row( UserTool.appProvider.setPickedCity(
children: [ city: model.cityModel, community: model.communityModel);
Icon( setState(() {});
CupertinoIcons.search, },
size: 30.w, child: Material(
color: Colors.black.withOpacity(0.2), color: Colors.transparent,
child: Container(
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w),
child: Row(
children: [
Icon(
CupertinoIcons.search,
size: 30.w,
color: Colors.black.withOpacity(0.2),
),
24.w.widthBox,
'${model.communityModel!.name}(${model.cityModel.province.name}·${model.cityModel.city.name}·${model.cityModel.district.name})'
.text
.size(28.sp)
.color(Colors.black.withOpacity(0.2))
.make(),
],
), ),
24.w.widthBox, ),
'${model.communityModel!.name}(${model.cityModel.province.name}·${model.cityModel.city.name}·${model.cityModel.district.name})'
.text
.size(28.sp)
.color(Colors.black.withOpacity(0.2))
.make(),
],
), ),
); );
} }

@ -40,7 +40,7 @@ class SignFunc {
static Future sendNewMessageCode(String newTel) async { static Future sendNewMessageCode(String newTel) async {
BaseModel baseModel = await NetUtil().post( BaseModel baseModel = await NetUtil().post(
API.login.sendNewMSCode, SAASAPI.user.sendTelCodeUpdateTel,
params: {'newTel': newTel}, params: {'newTel': newTel},
showMessage: true, showMessage: true,
); );

@ -43,10 +43,13 @@ class DataProvider extends ChangeNotifier {
List<HistoryLoginModel> get loginHistories => _loginHistories; List<HistoryLoginModel> get loginHistories => _loginHistories;
Future addHistories() async { Future addHistories() async {
_loginHistories.insert(0, UserTool.appProvider.pickedCityAndCommunity!); if (!_loginHistories
if (_loginHistories.length > 4) { .contains(UserTool.appProvider.pickedCityAndCommunity!)) {
_loginHistories.removeAt(_loginHistories.length - 1); _loginHistories.insert(0, UserTool.appProvider.pickedCityAndCommunity!);
if (_loginHistories.length > 4) {
_loginHistories.removeAt(_loginHistories.length - 1);
}
HiveStore.dataBox!.put('historyLogin', _loginHistories);
} }
HiveStore.dataBox!.put('historyLogin', _loginHistories);
} }
} }

@ -111,8 +111,8 @@ class UserProvider extends ChangeNotifier {
/// ///
Future setSex(int sex) async { Future setSex(int sex) async {
BaseModel baseModel = await NetUtil().post( BaseModel baseModel = await NetUtil().get(
API.user.setSex, SAASAPI.user.updateSex,
params: {'sex': sex}, params: {'sex': sex},
showMessage: true, showMessage: true,
); );
@ -139,12 +139,8 @@ class UserProvider extends ChangeNotifier {
// //
Future setName(String name) async { Future setName(String name) async {
BaseModel baseModel = await NetUtil().post( var re = await SignFunc.setNickName(name);
API.user.updateNickName, if (re) {
params: {'nickName': name},
showMessage: true,
);
if (baseModel.success) {
await updateUserInfo(); await updateUserInfo();
notifyListeners(); notifyListeners();
} }
@ -153,8 +149,8 @@ class UserProvider extends ChangeNotifier {
// //
Future updateTel(String oldTel, String newTel, String code) async { Future updateTel(String oldTel, String newTel, String code) async {
BaseModel baseModel = await NetUtil().post( BaseModel baseModel = await NetUtil().post(
API.user.updateTel, SAASAPI.user.updateTel,
params: {'oldTel': oldTel, 'newTel': newTel, 'code': code}, params: {'tel': oldTel, 'newTel': newTel, 'telCode': code},
showMessage: true, showMessage: true,
); );
if (baseModel.success) { if (baseModel.success) {

@ -1,3 +1,4 @@
import 'package:equatable/equatable.dart';
import 'package:hive_flutter/adapters.dart'; import 'package:hive_flutter/adapters.dart';
import 'package:json_annotation/json_annotation.dart'; import 'package:json_annotation/json_annotation.dart';
@ -5,7 +6,7 @@ part 'community_model.g.dart';
@JsonSerializable() @JsonSerializable()
@HiveType(typeId: 7) @HiveType(typeId: 7)
class CommunityModel { class CommunityModel extends Equatable {
@HiveField(0) @HiveField(0)
final int id; final int id;
@HiveField(1) @HiveField(1)
@ -14,6 +15,7 @@ class CommunityModel {
final String address; final String address;
@HiveField(3) @HiveField(3)
final String addressDetails; final String addressDetails;
factory CommunityModel.fromJson(Map<String, dynamic> json) => factory CommunityModel.fromJson(Map<String, dynamic> json) =>
_$CommunityModelFromJson(json); _$CommunityModelFromJson(json);
@ -23,4 +25,7 @@ class CommunityModel {
required this.address, required this.address,
required this.addressDetails, required this.addressDetails,
}); });
@override
List<Object?> get props => [id, name, address, addressDetails];
} }

@ -13,11 +13,45 @@ class HistoryLoginModel {
PickedCityModel cityModel; PickedCityModel cityModel;
@HiveField(1) @HiveField(1)
CommunityModel? communityModel; CommunityModel? communityModel;
factory HistoryLoginModel.fromJson(Map<String, dynamic> json) => factory HistoryLoginModel.fromJson(Map<String, dynamic> json) =>
_$HistoryLoginModelFromJson(json); _$HistoryLoginModelFromJson(json);
//<editor-fold desc="Data Methods">
HistoryLoginModel({ HistoryLoginModel({
required this.cityModel, required this.cityModel,
this.communityModel, this.communityModel,
}); });
@override
bool operator ==(Object other) =>
identical(this, other) ||
(other is HistoryLoginModel &&
runtimeType == other.runtimeType &&
cityModel == other.cityModel &&
communityModel == other.communityModel);
@override
int get hashCode => cityModel.hashCode ^ communityModel.hashCode;
@override
String toString() {
return 'HistoryLoginModel{' +
' cityModel: $cityModel,' +
' communityModel: $communityModel,' +
'}';
}
HistoryLoginModel copyWith({
PickedCityModel? cityModel,
CommunityModel? communityModel,
}) {
return HistoryLoginModel(
cityModel: cityModel ?? this.cityModel,
communityModel: communityModel ?? this.communityModel,
);
}
//</editor-fold>
} }

@ -1,4 +1,5 @@
import 'package:aku_new_community/utils/hive_store.dart'; import 'package:aku_new_community/utils/hive_store.dart';
import 'package:equatable/equatable.dart';
import 'package:hive/hive.dart'; import 'package:hive/hive.dart';
import 'package:json_annotation/json_annotation.dart'; import 'package:json_annotation/json_annotation.dart';
@ -8,13 +9,14 @@ part 'picked_city_model.g.dart';
@JsonSerializable() @JsonSerializable()
@HiveType(typeId: 6) @HiveType(typeId: 6)
class PickedCityModel { class PickedCityModel extends Equatable {
@HiveField(0) @HiveField(0)
final ChinaRegionModel province; final ChinaRegionModel province;
@HiveField(1) @HiveField(1)
final ChinaRegionModel city; final ChinaRegionModel city;
@HiveField(2) @HiveField(2)
final ChinaRegionModel district; final ChinaRegionModel district;
factory PickedCityModel.fromJson(Map<String, dynamic> json) => factory PickedCityModel.fromJson(Map<String, dynamic> json) =>
_$PickedCityModelFromJson(json); _$PickedCityModelFromJson(json);
@ -23,6 +25,7 @@ class PickedCityModel {
required this.city, required this.city,
required this.district, required this.district,
}); });
factory PickedCityModel.fromId( factory PickedCityModel.fromId(
{required int provinceId, required int cityId, required int distrctId}) { {required int provinceId, required int cityId, required int distrctId}) {
var provinces = var provinces =
@ -44,4 +47,7 @@ class PickedCityModel {
String get address => province.name + city.name + district.name; String get address => province.name + city.name + district.name;
int get id => district.id; int get id => district.id;
@override
List<Object?> get props => [province, city, district];
} }

@ -30,9 +30,9 @@ class _TaskCancelDialogState extends State<TaskCancelDialog> {
children: [ children: [
Assets.icons.cancelTask.image( Assets.icons.cancelTask.image(
width: double.infinity, width: double.infinity,
height: 420.w, height: 390.w,
), ),
64.hb, 24.hb,
'确定要取消任务吗?'.text.size(36.sp).black.bold.make(), '确定要取消任务吗?'.text.size(36.sp).black.bold.make(),
24.hb, 24.hb,
'不再等等吗?马上就会有人来接单了!' '不再等等吗?马上就会有人来接单了!'
@ -40,7 +40,7 @@ class _TaskCancelDialogState extends State<TaskCancelDialog> {
.size(28.sp) .size(28.sp)
.color(Colors.black.withOpacity(0.45)) .color(Colors.black.withOpacity(0.45))
.make(), .make(),
80.hb, 24.hb,
Row( Row(
children: [ children: [
MaterialButton( MaterialButton(

@ -10,6 +10,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:power_logger/power_logger.dart';
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
class WorkOrderPage extends StatefulWidget { class WorkOrderPage extends StatefulWidget {
@ -47,8 +48,9 @@ class _WorkOrderPageState extends State<WorkOrderPage>
title: '报事报修', title: '报事报修',
actions: [ actions: [
IconButton( IconButton(
onPressed: () { onPressed: () async {
Get.to(() => PublishWorkOrderPage()); await Get.to(() => PublishWorkOrderPage());
_refreshController.callRefresh();
}, },
icon: Icon( icon: Icon(
CupertinoIcons.plus_circle, CupertinoIcons.plus_circle,
@ -69,16 +71,23 @@ class _WorkOrderPageState extends State<WorkOrderPage>
Widget _getOrderView(int index) { Widget _getOrderView(int index) {
return EasyRefresh( return EasyRefresh(
firstRefresh: true, firstRefresh: true,
controller: _refreshController,
header: MaterialHeader(), header: MaterialHeader(),
footer: MaterialFooter(),
onRefresh: () async { onRefresh: () async {
_page = 1; _page = 1;
var base = await NetUtil().getList(SAASAPI.workOrder.list, params: { _models.clear();
'pageNum': _page, try {
'size': _size, var base = await NetUtil().getList(SAASAPI.workOrder.list, params: {
'status': index == 0 ? null : index, 'pageNum': _page,
}); 'size': _size,
_models = 'status': index == 0 ? null : index,
base.rows.map((e) => WorkOrderListModel.fromJson(e)).toList(); });
_models =
base.rows.map((e) => WorkOrderListModel.fromJson(e)).toList();
} catch (e) {
LoggerData.addData(e.toString());
}
setState(() {}); setState(() {});
}, },
onLoad: () async { onLoad: () async {
@ -93,7 +102,7 @@ class _WorkOrderPageState extends State<WorkOrderPage>
base.rows.map((e) => WorkOrderListModel.fromJson(e)).toList()); base.rows.map((e) => WorkOrderListModel.fromJson(e)).toList());
setState(() {}); setState(() {});
} else { } else {
_refreshController.finishLoad(); _refreshController.finishLoad(noMore: true);
} }
}, },
child: ListView.separated( child: ListView.separated(

@ -88,7 +88,7 @@ class _BeeCityPickerState extends State<BeeCityPicker> {
children: [ children: [
Expanded( Expanded(
child: CupertinoPicker( child: CupertinoPicker(
itemExtent: 60.w, itemExtent: 80.w,
magnification: 1.0, magnification: 1.0,
// offAxisFraction: -0.6, // offAxisFraction: -0.6,
looping: true, looping: true,
@ -110,7 +110,7 @@ class _BeeCityPickerState extends State<BeeCityPicker> {
), ),
Expanded( Expanded(
child: CupertinoPicker( child: CupertinoPicker(
itemExtent: 60.w, itemExtent: 80.w,
magnification: 1.0, magnification: 1.0,
looping: true, looping: true,
scrollController: _cityController, scrollController: _cityController,
@ -131,7 +131,7 @@ class _BeeCityPickerState extends State<BeeCityPicker> {
), ),
Expanded( Expanded(
child: CupertinoPicker( child: CupertinoPicker(
itemExtent: 60.w, itemExtent: 80.w,
magnification: 1.0, magnification: 1.0,
// offAxisFraction: 0.6, // offAxisFraction: 0.6,
looping: true, looping: true,
@ -145,7 +145,11 @@ class _BeeCityPickerState extends State<BeeCityPicker> {
: districts : districts
.map((e) => Center( .map((e) => Center(
child: Padding( child: Padding(
padding: EdgeInsets.only(left: 20.w, right: 20.w), padding: EdgeInsets.only(
left: 20.w,
right: 20.w,
top: 10.w,
bottom: 10.w),
child: Text(e.name, textAlign: TextAlign.center), child: Text(e.name, textAlign: TextAlign.center),
), ),
)) ))

Loading…
Cancel
Save