pull/1/head
张萌 3 years ago
parent c66fbdb811
commit d5f243ee75

@ -47,6 +47,15 @@ class _City {
}
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';

@ -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_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:provider/provider.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 {
ChangeNickName({Key? key}) : super(key: key);

@ -173,7 +173,9 @@ class _SelectCommunityState extends State<SelectCommunity> {
borderRadius: BorderRadius.circular(4.w),
),
color: kPrimaryColor,
onPressed: (){Navigator.pop(context);},
onPressed: () {
Navigator.pop(context);
},
child: '提交'.text.size(34.sp).make(),
).centered(),
),
@ -192,7 +194,15 @@ class _SelectCommunityState extends State<SelectCommunity> {
}
Widget _historyTile(HistoryLoginModel model) {
return Container(
return GestureDetector(
onTap: () {
UserTool.appProvider.setPickedCity(
city: model.cityModel, community: model.communityModel);
setState(() {});
},
child: Material(
color: Colors.transparent,
child: Container(
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w),
child: Row(
children: [
@ -209,6 +219,8 @@ class _SelectCommunityState extends State<SelectCommunity> {
.make(),
],
),
),
),
);
}
}

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

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

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

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

@ -13,11 +13,45 @@ class HistoryLoginModel {
PickedCityModel cityModel;
@HiveField(1)
CommunityModel? communityModel;
factory HistoryLoginModel.fromJson(Map<String, dynamic> json) =>
_$HistoryLoginModelFromJson(json);
//<editor-fold desc="Data Methods">
HistoryLoginModel({
required this.cityModel,
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:equatable/equatable.dart';
import 'package:hive/hive.dart';
import 'package:json_annotation/json_annotation.dart';
@ -8,13 +9,14 @@ part 'picked_city_model.g.dart';
@JsonSerializable()
@HiveType(typeId: 6)
class PickedCityModel {
class PickedCityModel extends Equatable {
@HiveField(0)
final ChinaRegionModel province;
@HiveField(1)
final ChinaRegionModel city;
@HiveField(2)
final ChinaRegionModel district;
factory PickedCityModel.fromJson(Map<String, dynamic> json) =>
_$PickedCityModelFromJson(json);
@ -23,6 +25,7 @@ class PickedCityModel {
required this.city,
required this.district,
});
factory PickedCityModel.fromId(
{required int provinceId, required int cityId, required int distrctId}) {
var provinces =
@ -44,4 +47,7 @@ class PickedCityModel {
String get address => province.name + city.name + district.name;
int get id => district.id;
@override
List<Object?> get props => [province, city, district];
}

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

@ -88,7 +88,7 @@ class _BeeCityPickerState extends State<BeeCityPicker> {
children: [
Expanded(
child: CupertinoPicker(
itemExtent: 60.w,
itemExtent: 80.w,
magnification: 1.0,
// offAxisFraction: -0.6,
looping: true,
@ -110,7 +110,7 @@ class _BeeCityPickerState extends State<BeeCityPicker> {
),
Expanded(
child: CupertinoPicker(
itemExtent: 60.w,
itemExtent: 80.w,
magnification: 1.0,
looping: true,
scrollController: _cityController,
@ -131,7 +131,7 @@ class _BeeCityPickerState extends State<BeeCityPicker> {
),
Expanded(
child: CupertinoPicker(
itemExtent: 60.w,
itemExtent: 80.w,
magnification: 1.0,
// offAxisFraction: 0.6,
looping: true,
@ -145,7 +145,7 @@ class _BeeCityPickerState extends State<BeeCityPicker> {
: districts
.map((e) => Center(
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),
),
))

Loading…
Cancel
Save