登录页 多验证方式登录页 验证码页 首次登陆设置密码页

pull/1/head
张萌 3 years ago
parent baf8af8c43
commit f69decf4ae

@ -1,5 +1,3 @@
part 'sars_api.dart';
class API {
///HOST
static const String host = 'http://121.41.26.225:8006';
@ -26,12 +24,17 @@ class API {
static _Search search = _Search();
static _Pay pay = _Pay();
static _House house = _House();
static _SarsApi sarsApi = _SarsApi();
}
class _Login {
///
String get sendSMSCode => '/login/sendMMSLogin';
//
String get allCommunity => '/app/login/findAllCommunity';
//
String get login => '/app/login/loginTelPwd';
//
String get sendSMSCode => '/app/login/sendTelCode';
///
String get loginBySMS => '/login/loginSMSUser';
@ -54,10 +57,7 @@ class _Login {
class _User {
///
String get userProfile => '/user/personalData/findPersonalData';
///
String get userDetail => '/user/personalData/getUserDetail';
String get userProfile => '/app/user/findDetail';
///
String get setSex => '/user/personalData/updateSex';

@ -30,7 +30,6 @@ import 'package:aku_new_community/ui/manager/questionnaire/questionnaire_page.da
import 'package:aku_new_community/ui/profile/car/car_manage_page.dart';
import 'package:aku_new_community/ui/profile/car_parking/car_parking_page.dart';
import 'package:aku_new_community/ui/profile/house/house_owners_page.dart';
import 'package:aku_new_community/widget/others/user_tool.dart';
import 'package:flutter/material.dart';
///
@ -138,7 +137,7 @@ List<AO> userAppObjects = [
'我的房屋',
R.ASSETS_ICONS_USER_ICON_WDFW_PNG,
() => HouseOwnersPage(
identify: UserTool.userProvider.userDetailModel!.type ?? 4,
identify: 4,
)),
AO('我的车位', R.ASSETS_ICONS_USER_ICON_WDCW_PNG, () => CarParkingPage()),
AO('我的车', R.ASSETS_ICONS_USER_ICON_WDC_PNG, () => CarManagePage()),

@ -0,0 +1,10 @@
part of 'sars_api.dart';
class _ProfileApi {
_MyHouse house = _MyHouse();
}
class _MyHouse {
///
String get userHouse => '/app/user/myEstate/findAllMyEstate';
}

@ -1,8 +1,23 @@
part of 'api.dart';
part 'profile_api.dart';
class _SarsApi {
_City city = _City();
_LoginAndSignup login = _LoginAndSignup();
class SARSAPI {
///HOST
static const String host = 'http://121.41.26.225:8006';
///
static const String baseURL = '$host';
///
static String get resource => '$host/static';
static String image(String? path) => '$resource$path';
static String file(String? path) => '$resource$path';
static const int networkTimeOut = 10000;
static _City city = _City();
static _ProfileApi profile = _ProfileApi();
static _Login login = _Login();
static _User user = _User();
}
class _City {
@ -10,7 +25,21 @@ class _City {
String get allCity => '/app/city/allCity';
}
class _LoginAndSignup {
class _User {
///
String get userProfile => '/app/user/findDetail';
}
class _Login {
///
String get allCommunity => '/app/login/findAllCommunity';
///
String get login => '/app/login/loginTelPwd';
///
String get sendSMSCode => '/app/login/sendTelCode';
///app
String get loginTelCode => '/app/login/loginTelCode';
}

@ -9,14 +9,14 @@ part 'history_login_model.g.dart';
@HiveType(typeId: 4)
class HistoryLoginModel {
@HiveField(0)
final PickedCityModel cityModel;
PickedCityModel cityModel;
@HiveField(1)
final CommunityModel communityModel;
CommunityModel? communityModel;
factory HistoryLoginModel.fromJson(Map<String, dynamic> json) =>
_$HistoryLoginModelFromJson(json);
const HistoryLoginModel({
HistoryLoginModel({
required this.cityModel,
required this.communityModel,
this.communityModel,
});
}

@ -18,7 +18,7 @@ class HistoryLoginModelAdapter extends TypeAdapter<HistoryLoginModel> {
};
return HistoryLoginModel(
cityModel: fields[0] as PickedCityModel,
communityModel: fields[1] as CommunityModel,
communityModel: fields[1] as CommunityModel?,
);
}
@ -51,6 +51,8 @@ HistoryLoginModel _$HistoryLoginModelFromJson(Map<String, dynamic> json) =>
HistoryLoginModel(
cityModel:
PickedCityModel.fromJson(json['cityModel'] as Map<String, dynamic>),
communityModel: CommunityModel.fromJson(
json['communityModel'] as Map<String, dynamic>),
communityModel: json['communityModel'] == null
? null
: CommunityModel.fromJson(
json['communityModel'] as Map<String, dynamic>),
);

@ -0,0 +1,34 @@
import 'package:json_annotation/json_annotation.dart';
part 'my_house_model.g.dart';
@JsonSerializable()
class MyHouseModel {
final int id;
final String addressName;
final String communityName;
final String buildingName;
final String estateName;
final String unitName;
final String manageEstateTypeName;
final int identity;
final String name;
final String tel;
final String isDefault;
factory MyHouseModel.fromJson(Map<String, dynamic> json) =>
_$MyHouseModelFromJson(json);
const MyHouseModel({
required this.id,
required this.addressName,
required this.communityName,
required this.buildingName,
required this.estateName,
required this.unitName,
required this.manageEstateTypeName,
required this.identity,
required this.name,
required this.tel,
required this.isDefault,
});
}

@ -0,0 +1,21 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'my_house_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
MyHouseModel _$MyHouseModelFromJson(Map<String, dynamic> json) => MyHouseModel(
id: json['id'] as int,
addressName: json['addressName'] as String,
communityName: json['communityName'] as String,
buildingName: json['buildingName'] as String,
estateName: json['estateName'] as String,
unitName: json['unitName'] as String,
manageEstateTypeName: json['manageEstateTypeName'] as String,
identity: json['identity'] as int,
name: json['name'] as String,
tel: json['tel'] as String,
isDefault: json['isDefault'] as String,
);

@ -1,47 +1,48 @@
import 'package:aku_new_community/model/common/img_model.dart';
import 'package:flustars/flustars.dart';
import 'package:json_annotation/json_annotation.dart';
part 'user_info_model.g.dart';
@JsonSerializable()
class UserInfoModel {
int id;
List<ImgModel> imgUrls;
String? name;
String nickName;
String tel;
final int id;
final int communityId;
final String? name;
final String tel;
final List<ImgModel> imgUrls;
/// 1. 2.
int? sex;
String? birthday;
/// 1. 2. 3.
final int? sex;
final String? nickName;
final bool isExistPassword;
String get sexValue {
if (sex == null) return '未设置';
if (sex == 1) return '';
if (sex == 2) return '';
if (sex == 3) return '保密';
return '未设置';
}
DateTime? get birthdayDate => DateUtil.getDateTime(birthday ?? '');
// DateTime? get birthdayDate => DateUtil.getDateTime(birthday ?? '');
String get birthdayValue {
if (TextUtil.isEmpty(birthday))
return '未设置';
else
return DateUtil.formatDate(birthdayDate, format: 'yyyy-MM-dd');
}
// String get birthdayValue {
// if (TextUtil.isEmpty(birthday))
// return '未设置';
// else
// return DateUtil.formatDate(birthdayDate, format: 'yyyy-MM-dd');
// }
factory UserInfoModel.fromJson(Map<String, dynamic> json) =>
_$UserInfoModelFromJson(json);
UserInfoModel({
const UserInfoModel({
required this.id,
required this.imgUrls,
required this.communityId,
this.name,
required this.nickName,
required this.tel,
required this.imgUrls,
this.sex,
this.birthday,
this.nickName,
required this.isExistPassword,
});
}

@ -9,12 +9,13 @@ part of 'user_info_model.dart';
UserInfoModel _$UserInfoModelFromJson(Map<String, dynamic> json) =>
UserInfoModel(
id: json['id'] as int,
communityId: json['communityId'] as int,
name: json['name'] as String?,
tel: json['tel'] as String,
imgUrls: (json['imgUrls'] as List<dynamic>)
.map((e) => ImgModel.fromJson(e as Map<String, dynamic>))
.toList(),
name: json['name'] as String?,
nickName: json['nickName'] as String,
tel: json['tel'] as String,
sex: json['sex'] as int?,
birthday: json['birthday'] as String?,
nickName: json['nickName'] as String?,
isExistPassword: json['isExistPassword'] as bool,
);

@ -33,7 +33,7 @@ class _CommunityIntroducePageState extends State<CommunityIntroducePage> {
onRefresh: () async {
BaseModel baseModel =
await NetUtil().get(API.manager.communityIntroduceInfo);
if (baseModel.status! && baseModel.data != null) {
if (baseModel.success && baseModel.data != null) {
_model = CommunityIontroduceModel.fromJson(baseModel.data);
}
_onload = false;

@ -52,7 +52,7 @@ class _ElectronicCommercDetailPageState
await NetUtil().get(API.manager.electronicCommercDetail, params: {
"electronicCommerceId": widget.id,
});
if (baseModel.status! && baseModel.data != null) {
if (baseModel.success && baseModel.data != null) {
_detailModel =
ElectronicCommercDetailModel.fromJson(baseModel.data);
} else {

@ -47,7 +47,7 @@ class _ElectronicCommercPageState extends State<ElectronicCommercPage>
final cancel = BotToast.showLoading();
BaseModel baseModel =
await NetUtil().get(API.manager.electronicCommercCategory);
if (baseModel.status == true && baseModel.data != null) {
if (baseModel.success == true && baseModel.data != null) {
_models = (baseModel.data as List)
.map((e) => ElectronicCommercCategoryModel.fromJson(e))
.toList();

@ -275,7 +275,7 @@ class _VotingDetailPageState extends State<VotingDetailPage> {
} else {
BaseModel baseModel =
await ManagerFunc.vote(widget.id, _selectId);
if (baseModel.status!) {
if (baseModel.success) {
await Get.dialog(_shouwVoteDialog());
_hasVoted = true;
setState(() {});

@ -134,10 +134,10 @@ class _ExpressPackageCardState extends State<ExpressPackageCard> {
"packageCollectionId": id,
},
);
if (baseModel.status ?? false) {
BotToast.showText(text: baseModel.message ?? '未知错误');
if (baseModel.success) {
BotToast.showText(text: baseModel.message);
}
return baseModel.status;
return baseModel.success;
}
Widget _rowTile(String assetPath, String titile, Widget content) {

@ -36,7 +36,7 @@ class _GeographicInformationPageState extends State<GeographicInformationPage> {
onRefresh: () async {
BaseModel baseModel =
await NetUtil().get(API.manager.geographyInformation);
if (baseModel.status! && baseModel.data != null) {
if (baseModel.success && baseModel.data != null) {
_model = GeographicInformationModel.fromJson(baseModel.data);
}
_onload = false;

@ -36,7 +36,7 @@ class _GeographicInformationPageState extends State<GeographicInformationPage> {
onRefresh: () async {
BaseModel baseModel =
await NetUtil().get(API.manager.geographyInformation);
if (baseModel.status! && baseModel.data != null) {
if (baseModel.success && baseModel.data != null) {
_model = GeographicInformationModel.fromJson(baseModel.data);
}
_onload = false;

@ -444,7 +444,7 @@ class _DetoCreatePageState extends State<DetoCreatePage> {
.uploadFiles(_files, API.upload.uploadRepair);
BaseModel baseModel = await ManagerFunc.articleOutSubmit(
id: BeeParse.getEstateNameId(
userProvider.userDetailModel!.estateNames![0]),
userProvider.myHouseInfo!.communityName),
name: _itemName,
weight: _selectWeight! + 1,
approach: _selectApproach + 1,
@ -452,10 +452,10 @@ class _DetoCreatePageState extends State<DetoCreatePage> {
time: datetime,
urls: urls,
);
if (baseModel.status!) {
if (baseModel.success) {
Get.back();
} else
BotToast.showText(text: baseModel.message!);
BotToast.showText(text: baseModel.message);
cancel();
}
: () {

@ -96,7 +96,7 @@ class GoodsInfoCardButton extends StatelessWidget {
case '查看二维码':
ArticleQRModel _model =
await ManagerFunc.getQRcode(id);
if (_model.status!) {
if (_model.status ?? false) {
Get.to(() => DetoCodePage(id: id, model: _model));
} else {
BotToast.showText(text: _model.message!);

@ -165,7 +165,7 @@ class _ReturnGoodsDetailPageState extends State<ReturnGoodsDetailPage> {
Future getModels() async {
BaseModel baseModel = await NetUtil().get(API.manager.articleReturnList);
if (baseModel.status! && baseModel.data != null) {
if (baseModel.success && baseModel.data != null) {
return (baseModel.data as List)
.map((e) => ArticleReturnListModel.fromJson(e))
.toList();

@ -207,9 +207,9 @@ class _LifePayPageState extends State<LifePayPage> {
"payType": 1, //
"payPrice": total.payTotal.toDoubleStringAsFixed()
});
if (baseModel.status ?? false) {
if (baseModel.success) {
bool result = await PayUtil()
.callAliPay(baseModel.message!, API.pay.dailPayMentCheck);
.callAliPay(baseModel.message, API.pay.dailPayMentCheck);
if (result) {
Get.off(() => PayFinishPage());
}
@ -263,7 +263,7 @@ class _LifePayPageState extends State<LifePayPage> {
await NetUtil().get(API.manager.dailyPaymentPrePay, params: {
"estateId": UserTool.appProveider.selectedHouse!.estateId,
});
if (baseModel.status ?? false) {
if (baseModel.success) {
return (baseModel.data as num).toDouble();
} else {
return 0;

@ -161,14 +161,14 @@ class _LifePrePayPageState extends State<LifePrePayPage> {
"payType": 1,
"payPrice": _editingController.text
});
if (baseModel.status ?? false) {
if (baseModel.success) {
bool result = await PayUtil().callAliPay(
baseModel.message!, API.pay.dailPaymentPrePayCheck);
baseModel.message, API.pay.dailPaymentPrePayCheck);
if (result) {
Get.off(() => PayFinishPage());
}
} else {
BotToast.showText(text: baseModel.message ?? "");
BotToast.showText(text: baseModel.message);
}
} catch (e) {
LoggerData.addData(e);

@ -57,8 +57,8 @@ class _SystemMessagePageState extends State<SystemMessagePage> {
children: [
'系统通知'.text.black.bold.size(32.sp).make(),
Spacer(),
BeeMap.messageRead[model.status!]!.text
.color(BeeMap.messageIsRead[model.status!]!
BeeMap.messageRead[model.status]!.text
.color(BeeMap.messageIsRead[model.status]!
? Color(0xFF999999)
: Colors.red)
.size(32.sp)

@ -50,7 +50,7 @@ class _OpeningCodePageState extends State<OpeningCodePage> {
_currentTime.add(Duration(seconds: seconds)),
format: 'yyyy/MM/dd HH:mm:ss'),
});
if ((baseModel.status ?? false) && baseModel.data != null) {
if ((baseModel.success) && baseModel.data != null) {
_qrCode = baseModel.data;
_onload = false;
_overDate = false;

@ -67,11 +67,12 @@ class _ClockInPageState extends State<ClockInPage> {
child: ClipOval(
child: FadeInImage.assetNetwork(
placeholder: Assets.images.placeholder.path,
image: API.image(UserTool
.userProvider.userInfoModel!.imgUrls.isNotEmpty
? UserTool
.userProvider.userInfoModel!.imgUrls.first.url
: ''),
image: API.image(
(UserTool.userProvider.userInfoModel?.imgUrls ?? [])
.isNotEmpty
? UserTool
.userProvider.userInfoModel!.imgUrls.first.url
: ''),
height: 106.w,
width: 106.w,
fit: BoxFit.cover,

@ -220,8 +220,8 @@ class _PersonalIndexState extends State<PersonalIndex>
body: EasyRefresh(
header: MaterialHeader(),
onRefresh: () async {
await userProvider.updateProfile();
await userProvider.updateUserDetail();
await userProvider.updateUserInfo();
await userProvider.updateMyHouseInfo();
},
child: Stack(
children: [
@ -513,19 +513,12 @@ class _PersonalIndexState extends State<PersonalIndex>
mainAxisAlignment: MainAxisAlignment.center,
children: [
_function(
'我的房屋',
R.ASSETS_ICONS_ICON_MY_HOUSE_PNG,
() => HouseOwnersPage(
identify:
UserTool.userProvider.userDetailModel?.type ??
4,
),
userProvider.userDetailModel!.estateNames!.isEmpty
? ''
: userProvider
.userDetailModel!.estateNames?[0] ??
'',
),
'我的房屋',
R.ASSETS_ICONS_ICON_MY_HOUSE_PNG,
() => HouseOwnersPage(
identify: 4,
),
userProvider.myHouseInfo?.communityName ?? ''),
36.hb,
_function('我的车位', R.ASSETS_ICONS_ICON_MY_CARSEAT_PNG,
() => CarParkingPage(), ''),

@ -29,7 +29,7 @@ class Userfunc {
'isDefault': isDefault
},
showMessage: false);
if (model.status ?? false) {
if (model.success) {
BotToast.showText(text: '添加成功');
return true;
} else {
@ -51,7 +51,7 @@ class Userfunc {
'isDefault': isDefault
},
showMessage: false);
if (model.status ?? false) {
if (model.success) {
BotToast.showText(text: '修改成功');
return true;
} else {
@ -64,7 +64,7 @@ class Userfunc {
static Future<bool> deleteAddress(int addressId) async {
BaseModel model = await NetUtil().post(API.user.deleteAddress,
params: {'addressId': addressId}, showMessage: false);
if (model.status ?? false) {
if (model.success) {
BotToast.showText(text: '删除成功');
return true;
} else {
@ -77,7 +77,7 @@ class Userfunc {
static Future<bool> setIsDefaultAddress(int addressId) async {
BaseModel model = await NetUtil().post(API.user.settingDefaultAddress,
params: {'addressId': addressId}, showMessage: false);
if (model.status ?? false) {
if (model.success) {
BotToast.showText(text: '设置成功');
return true;
} else {

@ -72,7 +72,7 @@ class _UserProfilePageState extends State<UserProfilePage> {
Function cancel = BotToast.showLoading();
BaseFileModel model =
await NetUtil().upload(API.upload.uploadAvatar, file);
if (model.status!)
if (model.status ?? false)
userProvider.updateAvatar(model.url);
else
BotToast.showText(text: model.message!);
@ -109,7 +109,7 @@ class _UserProfilePageState extends State<UserProfilePage> {
FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
image: API.image(
userProvider.userInfoModel!.imgUrls.isNotEmpty
(userProvider.userInfoModel?.imgUrls ?? []).isNotEmpty
? userProvider.userInfoModel?.imgUrls.first.url
: ''),
height: 56.w,
@ -166,7 +166,7 @@ class _UserProfilePageState extends State<UserProfilePage> {
),
_buildTile(
'出生日期',
userProvider.userInfoModel!.birthdayValue.text.make(),
'userProvider.userInfoModel!.birthdayValue'.text.make(),
onPressed: () async {
DateTime? date = await BeeDatePicker.pick(DateTime.now());
if (date != null) userProvider.setBirthday(date);

@ -10,7 +10,7 @@ class PropertyFunc {
await NetUtil().get(API.manager.dailyPaymentPrePay, params: {
"estateId": UserTool.appProveider.selectedHouse!.estateId,
});
if (baseModel.status ?? false) {
if (baseModel.success) {
return (baseModel.data as num).toDouble();
} else {
return 0;
@ -23,7 +23,7 @@ class PropertyFunc {
await NetUtil().get(API.manager.findUnpaidAmount, params: {
"estateId": UserTool.appProveider.selectedHouse!.estateId,
});
if (baseModel.status ?? false) {
if (baseModel.success) {
return (baseModel.data as num).toDouble();
} else {
return 0;

@ -8,7 +8,6 @@ import 'package:aku_new_community/provider/user_provider.dart';
import 'package:aku_new_community/ui/profile/house/add_house_page.dart';
import 'package:aku_new_community/ui/profile/house/house_owners_page.dart';
import 'package:aku_new_community/utils/headers.dart';
import 'package:aku_new_community/widget/others/user_tool.dart';
import 'package:aku_new_community/widget/views/application_view.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/cupertino.dart';
@ -169,10 +168,7 @@ class _PropertyPageState extends State<PropertyPage>
),
Spacer(),
Text(
userProvider.userDetailModel!.estateNames!.isEmpty
? '暂未绑定'
: userProvider.userDetailModel!.estateNames?[0] ??
'暂未绑定',
userProvider.myHouseInfo!.communityName,
style: TextStyle(
fontSize: 28.sp,
color: Colors.white.withOpacity(0.85),
@ -183,8 +179,7 @@ class _PropertyPageState extends State<PropertyPage>
GestureDetector(
onTap: () {
Get.to(HouseOwnersPage(
identify:
UserTool.userProvider.userDetailModel!.type ?? 4,
identify: 4,
));
},
child: Container(
@ -419,8 +414,8 @@ class _PropertyPageState extends State<PropertyPage>
body: EasyRefresh(
header: MaterialHeader(),
onRefresh: () async {
await userProvider.updateProfile();
await userProvider.updateUserDetail();
await userProvider.updateUserInfo();
await userProvider.updateMyHouseInfo();
},
child: CustomScrollView(
slivers: <Widget>[

@ -73,7 +73,7 @@ class _NewRenovationAddPageState extends State<NewRenovationAddPage> {
},
showMessage: true);
if (baseModel.status ?? false) {
if (baseModel.success) {
Get.back();
}
} else {

@ -139,7 +139,7 @@ class _NewRenovationCardState extends State<NewRenovationCard> {
"userDecorationNewId": widget.model.id,
},
showMessage: true);
if (baseModel.status ?? false) {
if (baseModel.success) {
widget.callRefresh();
}
})

@ -196,9 +196,9 @@ class _SharePayPageState extends State<SharePayPage> {
"payType": 1, //
"payPrice": total.payTotal.toDoubleStringAsFixed()
});
if (baseModel.status ?? false) {
if (baseModel.success) {
bool result = await PayUtil()
.callAliPay(baseModel.message!, API.pay.sharePayOrderCodeCheck);
.callAliPay(baseModel.message, API.pay.sharePayOrderCodeCheck);
if (result) {
Get.off(() => PayFinishPage());
}
@ -252,7 +252,7 @@ class _SharePayPageState extends State<SharePayPage> {
// await NetUtil().get(API.manager.dailyPaymentPrePay, params: {
// "estateId": UserTool.appProveider.selectedHouse!.estateId,
// });
// if (baseModel.status ?? false) {
// if (baseModel.success) {
// return (baseModel.data as num).toDouble();
// } else {
// return 0;

@ -0,0 +1,137 @@
import 'package:aku_new_community/pages/sign/sign_func.dart';
import 'package:aku_new_community/widget/bee_scaffold.dart';
import 'package:aku_new_community/widget/others/user_tool.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:sms_autofill/sms_autofill.dart';
import 'package:velocity_x/velocity_x.dart';
class CodeMessagePage extends StatefulWidget {
final String tel;
const CodeMessagePage({Key? key, required this.tel}) : super(key: key);
@override
_CodeMessagePageState createState() => _CodeMessagePageState();
}
class _CodeMessagePageState extends State<CodeMessagePage> {
String? _errorMessage;
TextEditingController _controller = TextEditingController();
@override
void initState() {
Future.delayed(Duration(milliseconds: 0), () async {
await SmsAutoFill().listenForCode();
});
super.initState();
}
@override
void dispose() {
_controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return BeeScaffold(
title: '',
body: SafeArea(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 48.w, vertical: 24.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
46.w.heightBox,
'请输入验证码'
.text
.size(36.sp)
.color(Colors.black.withOpacity(0.65))
.bold
.make(),
16.w.heightBox,
_errorMessage == null
? '${_errorMessage}'.text.color(Colors.red).size(28.sp).make()
: '验证码已发送至'
.richText
.withTextSpanChildren([
'${widget.tel}'
.textSpan
.size(28.sp)
.color(Color(0xFFCF1322).withOpacity(0.8))
.make(),
])
.size(28.sp)
.color(Colors.black.withOpacity(0.45))
.make(),
80.w.heightBox,
PinFieldAutoFill(
inputFormatters: [FilteringTextInputFormatter.digitsOnly],
codeLength: 6,
onCodeChanged: (code) async {
if (code!.length >= 6) {
var re = await SignFunc.loginBySms(
widget.tel,
code,
UserTool.appProveider.pickedCityAndCommunity!
.communityModel!.id);
if (re.data['success']) {
UserTool.userProvider.setLogin(re.data['data']);
var success =
await UserTool.userProvider.updateUserInfo();
if (!success) {
return;
}
} else {
_errorMessage = re.data['message'];
BotToast.showText(text: re.data['message']);
_controller.clear();
}
}
},
decoration: UnderlineDecoration(
colorBuilder: FixedColorListBuilder([
Colors.black.withOpacity(0.3),
Colors.black.withOpacity(0.3),
Colors.black.withOpacity(0.3),
Colors.black.withOpacity(0.3),
Colors.black.withOpacity(0.3),
Colors.black.withOpacity(0.3),
])),
),
24.w.heightBox,
Row(
children: [
Spacer(),
TextButton(
onPressed: () async {
var base = await SignFunc.sendMessageCode(
widget.tel,
UserTool.appProveider.pickedCityAndCommunity!
.communityModel!.id);
if (base.success) {
_errorMessage = null;
UserTool.appProveider.startTimer();
} else {
BotToast.showText(text: base.message);
}
},
child: (UserTool.appProveider.second >= 60
? '重新发送验证码'
: '${UserTool.appProveider.second}秒后可重新发送')
.text
.size(28.sp)
.color(Color(0xFF5096F1))
.make()),
],
)
],
),
),
),
);
}
}

@ -1,9 +1,12 @@
import 'package:aku_new_community/base/base_style.dart';
import 'package:aku_new_community/pages/sign/login/other_login_page.dart';
import 'package:aku_new_community/pages/sign/login/select_community.dart';
import 'package:aku_new_community/provider/app_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';
class LoginPage extends StatefulWidget {
@ -30,17 +33,7 @@ class _LoginPageState extends State<LoginPage> {
Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
GestureDetector(
onTap: () {
Get.to(() => SelectCommunity());
},
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
'请先选择小区'.text.size(32.sp).color(Color(0xFF5096F1)).make()
],
),
),
CommunityWidget(),
80.w.heightBox,
'${'1547***93018'}'
.text
@ -61,7 +54,9 @@ class _LoginPageState extends State<LoginPage> {
),
24.w.heightBox,
InkWell(
onTap: () {},
onTap: () {
Get.to(() => OtherLoginPage());
},
child: Text(
'其他登录方式',
style: TextStyle(
@ -73,29 +68,79 @@ class _LoginPageState extends State<LoginPage> {
],
),
Spacer(),
RichText(
text: TextSpan(
style: TextStyle(
fontSize: 24.sp,
color: ktextSubColor,
),
text: '注册/登记即代表同意',
children: [
WidgetSpan(
child: InkWell(
onTap: () {
//TODO:
},
child: '《小蜜蜂隐私政策及用户协议》'
.text
.size(24.sp)
.color(Color(0xFF5096F1))
.make(),
)),
])),
BottomTip(),
],
),
),
);
}
}
class BottomTip extends StatelessWidget {
const BottomTip({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Padding(
padding: EdgeInsets.only(bottom: 100.w),
child: RichText(
text: TextSpan(
style: TextStyle(
fontSize: 24.sp,
color: ktextSubColor,
),
text: '注册/登记即代表同意',
children: [
WidgetSpan(
child: InkWell(
onTap: () {
//TODO:
},
child: '《小蜜蜂隐私政策及用户协议》'
.text
.size(24.sp)
.color(Color(0xFF5096F1))
.make(),
)),
])),
);
}
}
class CommunityWidget extends StatelessWidget {
final MainAxisAlignment? align;
const CommunityWidget({
Key? key,
this.align,
}) : super(key: key);
@override
Widget build(BuildContext context) {
AppProvider appProveider = Provider.of<AppProvider>(context, listen: true);
return GestureDetector(
onTap: () async {
await Get.to(() => SelectCommunity());
// setState();
},
child: Row(
mainAxisAlignment: align ?? MainAxisAlignment.center,
children: [
(appProveider.pickedCityAndCommunity != null
? '${appProveider.pickedCityAndCommunity?.cityModel.district.name ?? ''} ${appProveider.pickedCityAndCommunity!.communityModel!.name}'
: '')
.text
.color(Colors.black)
.make(),
'${appProveider.pickedCityAndCommunity == null ? '请先选择小区' : ' 切换'}'
.text
.size(32.sp)
.color(Color(0xFF5096F1))
.make(),
],
),
);
}
}

@ -0,0 +1,196 @@
import 'package:aku_new_community/pages/sign/login/code_message_page.dart';
import 'package:aku_new_community/pages/sign/login/login_page.dart';
import 'package:aku_new_community/pages/sign/sign_func.dart';
import 'package:aku_new_community/pages/sign/widget/login_button_widget.dart';
import 'package:aku_new_community/pages/sign/widget/psd_text_field.dart';
import 'package:aku_new_community/pages/sign/widget/tel_text_field.dart';
import 'package:aku_new_community/provider/app_provider.dart';
import 'package:aku_new_community/widget/bee_scaffold.dart';
import 'package:aku_new_community/widget/others/user_tool.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flustars/flustars.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';
class OtherLoginPage extends StatefulWidget {
const OtherLoginPage({Key? key}) : super(key: key);
@override
_OtherLoginPageState createState() => _OtherLoginPageState();
}
class _OtherLoginPageState extends State<OtherLoginPage> {
PageController _controller = PageController();
List<String> _tabs = ['账号登录', '验证码登录'];
int _currentIndex = 0;
TextEditingController _tel = TextEditingController();
TextEditingController _psd = TextEditingController();
@override
void initState() {
super.initState();
}
@override
void dispose() {
_controller.dispose();
_tel.dispose();
_psd.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return BeeScaffold(
title: '',
bodyColor: Colors.white,
body: Column(
children: [
Row(
children: [
24.w.widthBox,
..._tabs
.mapIndexed((e, index) => _tab(e, index, onTap: (value) {
_currentIndex = value;
_controller.jumpToPage(_currentIndex);
setState(() {});
}))
.toList(),
],
),
Flexible(
child: PageView(
controller: _controller,
children: [_accountView(), _verificationView()],
),
),
BottomTip(),
],
),
);
}
Widget _accountView() {
return ListView(
padding: EdgeInsets.symmetric(horizontal: 32.w),
children: [
140.w.heightBox,
CommunityWidget(
align: MainAxisAlignment.start,
),
40.w.heightBox,
TelTextField(
controller: _tel,
),
40.w.heightBox,
PsdTextField(
controller: _psd,
),
100.w.heightBox,
LoginButtonWidget(
onTap: () async {
var check = checkInput();
if (!check) {
return;
}
var cancel = BotToast.showLoading();
var response = await SignFunc.login(
_tel.text,
_psd.text,
UserTool
.appProveider.pickedCityAndCommunity!.communityModel!.id);
if (response.data['success']) {
UserTool.userProvider.setLogin(response.data['data']);
var success = await UserTool.userProvider.updateUserInfo();
if (!success) {
return;
}
} else {
BotToast.showText(text: response.data['message']);
}
cancel();
},
text: '登录'),
],
);
}
bool checkInput() {
if (!RegexUtil.isTel(_tel.text)) {
BotToast.showText(text: '请输入正确的手机号!');
return false;
}
if (UserTool.appProveider.pickedCityAndCommunity == null) {
BotToast.showText(text: '请先选择小区!');
return false;
}
return true;
}
Widget _verificationView() {
AppProvider appProvider = Provider.of<AppProvider>(context);
return ListView(
padding: EdgeInsets.symmetric(horizontal: 32.w),
children: [
140.w.heightBox,
CommunityWidget(
align: MainAxisAlignment.start,
),
40.w.heightBox,
TelTextField(controller: _tel),
100.w.heightBox,
LoginButtonWidget(
onTap: () async {
var check = checkInput();
if (!check) {
return;
}
var base = await SignFunc.sendMessageCode(
_tel.text,
UserTool
.appProveider.pickedCityAndCommunity!.communityModel!.id);
if (base.success) {
Get.to(() => CodeMessagePage(tel: _tel.text));
appProvider.startTimer();
} else {
BotToast.showText(text: base.message);
}
},
text: appProvider.timerStart
? '${appProvider.second}秒后重新获取'
: '获取验证码'),
24.w.heightBox,
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
'未注册的手机验证后会自动创建账号'
.text
.size(28.sp)
.color(Colors.black.withOpacity(0.25))
.make(),
],
),
],
);
}
Widget _tab(String text, int index, {required Function(int) onTap}) {
return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () => onTap(index),
child: Container(
padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 24.w),
alignment: Alignment.center,
child: text.text
.size(_currentIndex == index ? 36.sp : 32.sp)
.lineHeight(_currentIndex == index ? 1.2 : 1.2)
.color(
Colors.black.withOpacity(_currentIndex == index ? 0.65 : 0.45))
.make(),
),
);
}
}

@ -0,0 +1,36 @@
import 'package:flustars/flustars.dart';
enum PSDVERIFY { shorLength, Insufficient, different, correct, empty }
class PsdVerify {
//
static String reg = r'^(?![\d]+$)(?![a-zA-Z]+$)(?![^\da-zA-Z]+$).*';
static PSDVERIFY check(String psd, String confirmPsd) {
if (psd.isEmpty || confirmPsd.isEmpty) {
return PSDVERIFY.empty;
} else if (psd != confirmPsd) {
return PSDVERIFY.different;
} else if (psd.length < 6) {
return PSDVERIFY.shorLength;
} else if (!RegexUtil.matches(reg, psd)) {
return PSDVERIFY.Insufficient;
} else {
return PSDVERIFY.correct;
}
}
static String checkString(PSDVERIFY enu) {
switch (enu) {
case PSDVERIFY.shorLength:
return '密码不能小于6位';
case PSDVERIFY.Insufficient:
return '密码至少由两种类型组成';
case PSDVERIFY.different:
return '您输入的确认密码和新密码不一致,请检查后重新输入';
case PSDVERIFY.correct:
return '';
case PSDVERIFY.empty:
return '';
}
}
}

@ -1,8 +1,9 @@
import 'package:aku_new_community/constants/api.dart';
import 'package:aku_new_community/models/login/community_model.dart';
import 'package:aku_new_community/models/login/picked_city_model.dart';
import 'package:aku_new_community/models/login/history_login_model.dart';
import 'package:aku_new_community/utils/network/net_util.dart';
import 'package:aku_new_community/widget/bee_scaffold.dart';
import 'package:aku_new_community/widget/others/user_tool.dart';
import 'package:aku_new_community/widget/picker/bee_city_picker.dart';
import 'package:aku_new_community/widget/picker/bee_community_picker.dart';
import 'package:bot_toast/bot_toast.dart';
@ -21,22 +22,24 @@ class SelectCommunity extends StatefulWidget {
}
class _SelectCommunityState extends State<SelectCommunity> {
PickedCityModel? _model;
CommunityModel? _community;
String get cityName {
var _model = UserTool.appProveider.pickedCityAndCommunity;
if (_model == null) {
return '请选择省、市、县/区';
} else {
return _model!.province.name + _model!.city.name + _model!.district.name;
return _model.cityModel.province.name +
_model.cityModel.city.name +
_model.cityModel.district.name;
}
}
String get communityName {
var _community =
UserTool.appProveider.pickedCityAndCommunity?.communityModel;
if (_community == null) {
return '请选择小区';
} else {
return _community!.name;
return _community.name;
}
}
@ -45,77 +48,143 @@ class _SelectCommunityState extends State<SelectCommunity> {
super.initState();
}
@override
void deactivate() {
Future.delayed(Duration(milliseconds: 0), () async {
if (UserTool.appProveider.pickedCityAndCommunity != null &&
UserTool.appProveider.pickedCityAndCommunity?.communityModel ==
null) {
UserTool.appProveider.resetPickedCity();
}
});
super.deactivate();
}
@override
Widget build(BuildContext context) {
return BeeScaffold(
title: '选择登录小区',
body: ListView(
var selectCity = GestureDetector(
onTap: () async {
var _city = await BeeCityPicker.pick(context);
if (_city != null) {
UserTool.appProveider.setPickedCity(city: _city);
}
setState(() {});
},
child: Container(
color: Colors.white,
width: double.infinity,
height: 88.w,
padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w),
child: Row(
children: [
'选择城市'.text.size(28.sp).black.make(),
Spacer(),
'${cityName}'.text.black.make(),
32.w.widthBox,
Icon(
CupertinoIcons.right_chevron,
size: 20.w,
)
],
),
),
);
var selectCommunity = GestureDetector(
onTap: () async {
var cancel = BotToast.showLoading();
List<CommunityModel> _communities = [];
var base = await NetUtil().get(API.login.allCommunity);
if (base.success) {
_communities = (base.data as List)
.map((e) => CommunityModel.fromJson(e))
.toList();
}
cancel();
var _community = await BeeCommunityPicker.pick(context, _communities);
if (_community != null) {
UserTool.appProveider.setPickedCity(community: _community);
}
setState(() {});
},
child: Container(
color: Colors.white,
width: double.infinity,
height: 88.w,
padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w),
child: Row(
children: [
'选择小区'.text.size(28.sp).black.make(),
Spacer(),
'${communityName}'.text.black.make(),
32.w.widthBox,
Icon(
CupertinoIcons.right_chevron,
size: 20.w,
)
],
),
),
);
var history = Offstage(
offstage: UserTool.dataProvider.loginHistories.length == 0,
child: Container(
width: double.infinity,
color: Colors.white,
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
'历史登录'.text.size(28.sp).color(Colors.black.withOpacity(0.2)).make(),
24.w.widthBox,
...UserTool.dataProvider.loginHistories
.map((e) => _historyTile(e))
.toList(),
],
),
),
);
return WillPopScope(
onWillPop: () async {
var bool = UserTool.appProveider.pickedCityAndCommunity != null &&
UserTool.appProveider.pickedCityAndCommunity?.communityModel ==
null;
if (bool) {
BotToast.showText(text: '请选择小区');
return false;
} else {
return true;
}
},
child: BeeScaffold(
title: '选择登录小区',
body: ListView(
children: [
selectCity,
selectCommunity,
10.w.heightBox,
history,
],
),
),
);
}
Widget _historyTile(HistoryLoginModel model) {
return Container(
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w),
child: Row(
children: [
GestureDetector(
onTap: () async {
_model = await BeeCityPicker.pick(context);
setState(() {});
},
child: Container(
color: Colors.white,
width: double.infinity,
height: 88.w,
padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w),
child: Row(
children: [
'选择城市'.text.size(28.sp).black.make(),
Spacer(),
'${cityName}'.text.black.make(),
32.w.widthBox,
Icon(
CupertinoIcons.right_chevron,
size: 20.w,
)
],
),
),
),
GestureDetector(
onTap: () async {
var cancel = BotToast.showLoading();
List<CommunityModel> _communities = [];
var base = await NetUtil().get(API.sarsApi.login.allCommunity);
if (base.status ?? false) {
_communities = (base.data as List)
.map((e) => CommunityModel.fromJson(e))
.toList();
}
cancel();
_community = await BeeCommunityPicker.pick(context, _communities);
setState(() {});
},
child: Container(
color: Colors.white,
width: double.infinity,
height: 88.w,
padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w),
child: Row(
children: [
'选择小区'.text.size(28.sp).black.make(),
Spacer(),
'${communityName}'.text.black.make(),
32.w.widthBox,
Icon(
CupertinoIcons.right_chevron,
size: 20.w,
)
],
),
),
),
Container(
width: double.infinity,
color: Colors.white,
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w),
child: Column(
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(),
],
),
);

@ -0,0 +1,83 @@
import 'package:aku_new_community/pages/sign/login/psd_verify.dart';
import 'package:aku_new_community/pages/sign/widget/login_button_widget.dart';
import 'package:aku_new_community/pages/sign/widget/psd_text_field.dart';
import 'package:aku_new_community/widget/bee_scaffold.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:velocity_x/velocity_x.dart';
class SetPsdPage extends StatefulWidget {
const SetPsdPage({Key? key}) : super(key: key);
@override
_SetPsdPageState createState() => _SetPsdPageState();
}
class _SetPsdPageState extends State<SetPsdPage> {
TextEditingController _psdController = TextEditingController();
TextEditingController _confirmPsdController = TextEditingController();
PSDVERIFY get psdCheck =>
PsdVerify.check(_psdController.text, _confirmPsdController.text);
bool _psdVisible = false;
bool _confirmVisible = false;
@override
void dispose() {
_psdController.dispose();
_confirmPsdController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return BeeScaffold(
title: '',
bodyColor: Colors.white,
body: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
24.w.heightBox,
Row(
children: [
48.w.widthBox,
'首次登陆,请设置账号密码'
.text
.size(36.sp)
.bold
.color(Colors.black.withOpacity(0.65))
.make(),
Spacer(),
],
),
16.w.heightBox,
Row(
children: [
48.w.widthBox,
'密码需由6-20位数字、字母、或符号组成至少两种'
.text
.size(28.sp)
.color(Colors.black.withOpacity(0.45))
.make(),
Spacer(),
],
),
144.w.heightBox,
PsdTextField(controller: _psdController, hintText: '请输入密码'),
24.w.heightBox,
PsdTextField(controller: _confirmPsdController, hintText: '请再次输入密码'),
16.w.heightBox,
PsdVerify.checkString(psdCheck)
.text
.size(28.sp)
.color(Color(0xFFCF1322).withOpacity(0.8))
.make(),
37.w.heightBox,
LoginButtonWidget(
onTap: psdCheck == PSDVERIFY.correct ? () {} : null, text: '确认'),
],
),
);
}
}

@ -1,21 +1,29 @@
import 'package:aku_new_community/constants/api.dart';
import 'package:aku_new_community/constants/sars_api.dart';
import 'package:aku_new_community/model/user/pick_building_model.dart';
import 'package:aku_new_community/model/user/user_detail_model.dart';
import 'package:aku_new_community/models/user/my_house_model.dart';
import 'package:aku_new_community/models/user/user_info_model.dart';
import 'package:aku_new_community/pages/sign/login/set_psd_page.dart';
import 'package:aku_new_community/pages/sign/sign_up/sign_up_set_nickname_page.dart';
import 'package:aku_new_community/provider/sign_up_provider.dart';
import 'package:aku_new_community/provider/user_provider.dart';
import 'package:aku_new_community/utils/network/base_model.dart';
import 'package:aku_new_community/utils/network/net_util.dart';
import 'package:aku_new_community/widget/others/user_tool.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:dio/dio.dart';
import 'package:get/get.dart' hide Response;
import 'package:provider/provider.dart';
import '../tab_navigator.dart';
class SignFunc {
static Future sendMessageCode(String phone) async {
//
static Future<BaseModel> sendMessageCode(
String phone, int communityId) async {
BaseModel baseModel = await NetUtil().post(
API.login.sendSMSCode,
params: {'tel': phone},
SARSAPI.login.sendSMSCode,
params: {'tel': phone, 'communityId': communityId},
showMessage: true,
);
return baseModel;
@ -30,10 +38,30 @@ class SignFunc {
return baseModel;
}
static Future<Response> login(String phone, String code) async {
//
static Future<Response> login(
String phone, String code, int communityId) async {
Response response = await NetUtil().dio!.post(
API.login.loginBySMS,
data: {'tel': phone, 'code': code},
API.login.login,
data: {
'tel': phone,
'password': code,
'communityId': communityId,
},
);
return response;
}
//
static Future<Response> loginBySms(
String phone, String code, int communityId) async {
Response response = await NetUtil().dio!.post(
API.login.login,
data: {
'tel': phone,
'code': code,
'communityId': communityId,
},
);
return response;
}
@ -87,15 +115,25 @@ class SignFunc {
static Future<UserInfoModel?> getUserInfo() async {
BaseModel baseModel = await NetUtil().get(API.user.userProfile);
if (baseModel.data == null) return null;
if (baseModel.data == null || !baseModel.success) return null;
return UserInfoModel.fromJson(baseModel.data);
}
static Future<UserDetailModel?> getUserDetail() async {
static Future<MyHouseModel?> getMyHouseInfo() async {
BaseModel baseModel = await NetUtil().get(
API.user.userDetail,
SARSAPI.profile.house.userHouse,
);
if (baseModel.data == null) return null;
return UserDetailModel.fromJson(baseModel.data);
return MyHouseModel.fromJson(baseModel.data);
}
static Future checkNameAndAccount() async {
if (!UserTool.userProvider.userInfoModel!.isExistPassword) {
await Get.to(() => SetPsdPage());
} else if (UserTool.userProvider.userInfoModel!.nickName == null) {
await Get.to(() => SignUpSetNicknamePage());
} else {
Get.offAll(() => TabNavigator());
}
}
}

@ -1,21 +1,16 @@
import 'dart:async';
import 'package:aku_new_community/base/base_style.dart';
import 'package:aku_new_community/pages/sign/sign_func.dart';
import 'package:aku_new_community/pages/sign/sign_up/sign_up_set_nickname_page.dart';
import 'package:aku_new_community/pages/tab_navigator.dart';
import 'package:aku_new_community/provider/sign_up_provider.dart';
import 'package:aku_new_community/provider/user_provider.dart';
import 'package:aku_new_community/utils/headers.dart';
import 'package:aku_new_community/widget/bee_back_button.dart';
import 'package:aku_new_community/widget/bee_scaffold.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:dio/dio.dart';
import 'package:flustars/flustars.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart' hide Response;
import 'package:power_logger/power_logger.dart';
import 'package:provider/provider.dart';
class SignInPage extends StatefulWidget {
@ -55,24 +50,24 @@ class _SignInPageState extends State<SignInPage> {
Provider.of<SignUpProvider>(Get.context!, listen: false);
if (!result) return;
CancelFunc cancel = BotToast.showLoading();
Response response = await SignFunc.login(_phone.text, _code.text);
LoggerData.addData(response);
if (response.data['status']) {
if (response.data['choose'] == 1) {
userProvider.setLogin(response.data['token']);
cancel();
Get.offAll(() => TabNavigator());
} else {
cancel();
signUpProvider.setTel(_phone.text);
await Get.to(() => SignUpSetNicknamePage());
signUpProvider.clearAll();
}
} else {
BotToast.showText(text: response.data['message']);
cancel();
}
// Response response = await SignFunc.login(_phone.text, _code.text);
// LoggerData.addData(response);
//
// if (response.data['status']) {
// if (response.data['choose'] == 1) {
// userProvider.setLogin(response.data['token']);
// cancel();
// Get.offAll(() => TabNavigator());
// } else {
// cancel();
// signUpProvider.setTel(_phone.text);
// await Get.to(() => SignUpSetNicknamePage());
// signUpProvider.clearAll();
// }
// } else {
// BotToast.showText(text: response.data['message']);
// cancel();
// }
}
Widget _inkWellLogin() {
@ -235,7 +230,7 @@ class _SignInPageState extends State<SignInPage> {
),
onPressed: _canGetCode
? () {
SignFunc.sendMessageCode(_phone.text);
// SignFunc.sendMessageCode(_phone.text);
startTick();
}
: null,

@ -0,0 +1,30 @@
import 'package:aku_new_community/base/base_style.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class LoginButtonWidget extends StatelessWidget {
final VoidCallback? onTap;
final String text;
const LoginButtonWidget({Key? key, required this.onTap, required this.text})
: super(key: key);
@override
Widget build(BuildContext context) {
return MaterialButton(
minWidth: 686.w,
height: 97.w,
onPressed: onTap,
elevation: 0,
child: Text(
text,
style: TextStyle(
fontSize: 32.sp,
),
),
disabledTextColor: Colors.black.withOpacity(0.45),
disabledColor: Colors.black.withOpacity(0.06),
color: kPrimaryColor,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(60.w)),
);
}
}

@ -0,0 +1,66 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class PsdTextField extends StatefulWidget {
final TextEditingController controller;
final String? hintText;
const PsdTextField({
Key? key,
required this.controller,
this.hintText,
}) : super(key: key);
@override
_PsdTextFieldState createState() => _PsdTextFieldState();
}
class _PsdTextFieldState extends State<PsdTextField> {
bool visible = false;
@override
Widget build(BuildContext context) {
return Container(
width: 686.w,
height: 94.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(60.w),
color: Colors.black.withOpacity(0.06),
),
child: TextField(
maxLength: 20,
onChanged: (text) {
setState(() {});
},
controller: widget.controller,
obscureText: !visible,
obscuringCharacter: '*',
decoration: InputDecoration(
isDense: false,
contentPadding:
EdgeInsets.symmetric(horizontal: 24.w, vertical: 24.w),
border: InputBorder.none,
hintText: widget.hintText ?? '请输入密码',
counterText: '',
suffixIconConstraints:
BoxConstraints(minHeight: 50.w, maxHeight: 50.w),
suffixIcon: GestureDetector(
onTap: () {
visible = !visible;
setState(() {});
},
child: Padding(
padding: EdgeInsets.only(right: 20.w),
child: Icon(
visible ? CupertinoIcons.eye : CupertinoIcons.eye_slash,
color: Colors.black.withOpacity(0.4),
),
),
),
hintStyle: TextStyle(
color: Colors.black.withOpacity(0.25), fontSize: 28.sp)),
),
);
}
}

@ -0,0 +1,41 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:velocity_x/velocity_x.dart';
class TelTextField extends StatefulWidget {
final TextEditingController controller;
const TelTextField({Key? key, required this.controller}) : super(key: key);
@override
_TelTextFieldState createState() => _TelTextFieldState();
}
class _TelTextFieldState extends State<TelTextField> {
@override
Widget build(BuildContext context) {
return Container(
width: 686.w,
height: 94.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(60.w),
color: Colors.black.withOpacity(0.06),
),
child: TextField(
inputFormatters: [FilteringTextInputFormatter.digitsOnly],
keyboardType: TextInputType.number,
controller: widget.controller,
decoration: InputDecoration(
isDense: true,
border: InputBorder.none,
prefixIcon: Center(child: '+86'.text.black.make()),
prefixIconConstraints: BoxConstraints.loose(Size(60, 60)),
contentPadding: EdgeInsets.symmetric(vertical: 30.w),
hintText: '点击输入手机号',
hintStyle:
TextStyle(color: Colors.black.withOpacity(0.25), fontSize: 28.sp),
),
),
);
}
}

@ -104,7 +104,7 @@ class _FixedSubmitPageState extends State<FixedSubmitPage> {
.size(32.sp)
.make(),
Spacer(),
BeeMap.fixState[model.status!]!.text
BeeMap.fixState[model.status]!.text
.color(_getColor(model.status))
.size(24.sp)
.make(),

@ -195,10 +195,10 @@ class _AddFixedSubmitPageState extends State<AddFixedSubmitPage> {
_selectType! + 1,
_textEditingController!.text,
urls);
if (baseModel.status!) {
if (baseModel.success) {
Get.off(() => FinishFixedSubmitPage());
} else
BotToast.showText(text: baseModel.message!);
BotToast.showText(text: baseModel.message);
cancel();
}
: () {

@ -406,9 +406,9 @@ class _FixedDetailPageState extends State<FixedDetailPage> {
BaseModel baseModel = await ManagerFunc.reportRepairAlipay(
_model.appReportRepairVo.id,
(_model.appMaintenanceResultVo!.totalCost ?? 0).toDouble());
if ((baseModel.status ?? false) && !baseModel.message.isEmptyOrNull) {
if ((baseModel.success) && !baseModel.message.isEmptyOrNull) {
bool result = await PayUtil()
.callAliPay(baseModel.message!, API.pay.reportReapirCheck);
.callAliPay(baseModel.message, API.pay.reportReapirCheck);
if (result) {
Get.back();
Get.off(() => PayFinishPage());
@ -424,12 +424,12 @@ class _FixedDetailPageState extends State<FixedDetailPage> {
Function cancel = BotToast.showLoading();
BaseModel baseModel =
await ManagerFunc.reportRepairComplete(_model.appReportRepairVo.id);
if ((baseModel.status ?? false)) {
if ((baseModel.success)) {
Get.back();
Get.back();
} else {
Get.back();
BotToast.showText(text: baseModel.message!);
BotToast.showText(text: baseModel.message);
}
cancel();
}

@ -112,7 +112,7 @@ class _FixedEvaluatePageState extends State<FixedEvaluatePage> {
widget.model.appReportRepairVo.id,
_rating,
_textEditingController!.text);
if (baseModel.status!) {
if (baseModel.success) {
Get.back();
}
}

@ -360,7 +360,7 @@ class _VisitorAccessPageState extends State<VisitorAccessPage> {
SizedBox(height: 64.w),
_create(
appProvider.selectedHouse!.estateId,
userProvider.userDetailModel!.type,
4,
_phoneNum.text,
),
_tips(),

@ -1,3 +1,4 @@
import 'dart:async';
import 'dart:io';
import 'package:aku_new_community/constants/api.dart';
@ -8,6 +9,9 @@ import 'package:aku_new_community/model/community/hot_topic_model.dart';
import 'package:aku_new_community/model/message/message_center_model.dart';
import 'package:aku_new_community/model/user/adress_model.dart';
import 'package:aku_new_community/model/user/car_parking_model.dart';
import 'package:aku_new_community/models/login/community_model.dart';
import 'package:aku_new_community/models/login/history_login_model.dart';
import 'package:aku_new_community/models/login/picked_city_model.dart';
import 'package:aku_new_community/models/user/passed_house_list_model.dart';
import 'package:aku_new_community/utils/hive_store.dart';
import 'package:aku_new_community/utils/network/base_model.dart';
@ -327,4 +331,48 @@ class AppProvider extends ChangeNotifier {
}
notifyListeners();
}
HistoryLoginModel? _pickedCityAndCommunity;
HistoryLoginModel? get pickedCityAndCommunity => _pickedCityAndCommunity;
void setPickedCity({PickedCityModel? city, CommunityModel? community}) {
if (city != null) {
_pickedCityAndCommunity = HistoryLoginModel(cityModel: city);
}
if (community != null) {
_pickedCityAndCommunity!.communityModel = community;
}
}
void resetPickedCity() {
_pickedCityAndCommunity = null;
notifyListeners();
}
int second = 60;
bool timerStart = false;
Timer? timer;
void startTimer() {
timerStart = true;
timer = Timer.periodic(Duration(seconds: 1), (timer) {
if (second > 0) {
second--;
notifyListeners();
} else {
stopTimer();
}
});
}
void stopTimer() {
second = 60;
timerStart = false;
timer?.cancel();
timer = null;
notifyListeners();
}
notifyListeners();
}

@ -1,4 +1,4 @@
import 'package:aku_new_community/constants/api.dart';
import 'package:aku_new_community/constants/sars_api.dart';
import 'package:aku_new_community/models/login/china_region_model.dart';
import 'package:aku_new_community/models/login/history_login_model.dart';
import 'package:aku_new_community/utils/hive_store.dart';
@ -9,9 +9,10 @@ class DataProvider extends ChangeNotifier {
Future init() async {
updateCityList();
_loginHistories = HiveStore.dataBox!
.get('historyLogin')
.cast<HistoryLoginModel>()
.toList();
.get('historyLogin')
?.cast<HistoryLoginModel>()
.toList() ??
[];
}
List<ChinaRegionModel> _cityModel = [];
@ -19,8 +20,8 @@ class DataProvider extends ChangeNotifier {
List<ChinaRegionModel> get cityModel => _cityModel;
Future<bool> updateCityList() async {
var model = await NetUtil().get(API.sarsApi.city.allCity);
if (model.status ?? false) {
var model = await NetUtil().get(SARSAPI.city.allCity);
if (model.success) {
_cityModel = (model.data as List)
.map((e) => ChinaRegionModel.fromJson(e))
.toList();

@ -1,7 +1,7 @@
import 'dart:io';
import 'package:aku_new_community/constants/api.dart';
import 'package:aku_new_community/model/user/user_detail_model.dart';
import 'package:aku_new_community/models/user/my_house_model.dart';
import 'package:aku_new_community/models/user/user_config_model.dart';
import 'package:aku_new_community/models/user/user_info_model.dart';
import 'package:aku_new_community/pages/sign/sign_func.dart';
@ -11,7 +11,7 @@ import 'package:aku_new_community/utils/hive_store.dart';
import 'package:aku_new_community/utils/network/base_model.dart';
import 'package:aku_new_community/utils/network/net_util.dart';
import 'package:aku_new_community/utils/websocket/web_socket_util.dart';
import 'package:aku_new_community/widget/others/user_tool.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flustars/flustars.dart';
import 'package:flutter/foundation.dart';
import 'package:get/get.dart';
@ -37,8 +37,8 @@ class UserProvider extends ChangeNotifier {
.putIfAbsent('App-Admin-Token', () => token);
HiveStore.appBox!.put('token', token);
HiveStore.appBox!.put('login', true);
await updateProfile();
await updateUserDetail();
await updateUserInfo();
await updateMyHouseInfo();
///
_userConfig = await HiveStore.userBox!.get('${_userInfoModel!.id}') ??
@ -64,7 +64,7 @@ class UserProvider extends ChangeNotifier {
_isLogin = false;
_token = null;
_userInfoModel = null;
_userDetailModel = null;
_myHouseInfo = null;
NetUtil().get(API.user.logout, showMessage: true);
NetUtil().dio!.options.headers.remove('App-Admin-Token');
HiveStore.appBox!.delete('token');
@ -74,18 +74,23 @@ class UserProvider extends ChangeNotifier {
notifyListeners();
}
Future updateProfile() async {
Future<bool> updateUserInfo() async {
_userInfoModel = await SignFunc.getUserInfo();
if (_userInfoModel != null && !kIsWeb && !Platform.isMacOS) {}
if (_userInfoModel == null) {
BotToast.showText(text: '获取用户信息失败');
return false;
}
if (_userInfoModel != null && !kIsWeb && !Platform.isMacOS) {
SignFunc.checkNameAndAccount();
}
notifyListeners();
return true;
}
Future updateUserDetail() async {
UserDetailModel? _model = await SignFunc.getUserDetail();
if (_model != null) {
_userDetailModel = _model;
UserTool.appProveider.setCurrentHouseId(_model.nowEstateExamineId);
}
Future updateMyHouseInfo() async {
_myHouseInfo = await SignFunc.getMyHouseInfo();
if (_userInfoModel != null && !kIsWeb && !Platform.isMacOS) {}
notifyListeners();
}
@ -97,9 +102,9 @@ class UserProvider extends ChangeNotifier {
UserInfoModel? get userInfoModel => _userInfoModel;
UserDetailModel? _userDetailModel;
MyHouseModel? _myHouseInfo;
UserDetailModel? get userDetailModel => _userDetailModel;
MyHouseModel? get myHouseInfo => _myHouseInfo;
///
Future setSex(int sex) async {
@ -108,8 +113,8 @@ class UserProvider extends ChangeNotifier {
params: {'sex': sex},
showMessage: true,
);
if (baseModel.status!) {
_userInfoModel!.sex = sex;
if (baseModel.success) {
await updateUserInfo();
notifyListeners();
}
}
@ -123,9 +128,9 @@ class UserProvider extends ChangeNotifier {
},
showMessage: true,
);
if (baseModel.status!) {
_userInfoModel!.birthday =
DateUtil.formatDate(date, format: "yyyy-MM-dd HH:mm:ss");
if (baseModel.success) {
// _userInfoModel!.birthday =
// DateUtil.formatDate(date, format: "yyyy-MM-dd HH:mm:ss");
notifyListeners();
}
}
@ -137,8 +142,8 @@ class UserProvider extends ChangeNotifier {
params: {'nickName': name},
showMessage: true,
);
if (baseModel.status!) {
_userInfoModel!.nickName = name;
if (baseModel.success) {
// _userInfoModel!.nickName = name;
notifyListeners();
}
}
@ -150,8 +155,8 @@ class UserProvider extends ChangeNotifier {
params: {'oldTel': oldTel, 'newTel': newTel, 'code': code},
showMessage: true,
);
if (baseModel.status!) {
_userInfoModel!.tel = newTel;
if (baseModel.success) {
await updateUserInfo();
notifyListeners();
}
}
@ -165,8 +170,8 @@ class UserProvider extends ChangeNotifier {
},
showMessage: true,
);
if (model.status!) {
await updateProfile();
if (model.success) {
await updateUserInfo();
}
}

@ -68,7 +68,7 @@ class _AddNewEventPageState extends State<AddNewEventPage> {
showMessage: true,
);
cancel();
if (baseModel.status!) {
if (baseModel.success) {
Get.back(result: true);
}
}

@ -23,7 +23,6 @@ import 'package:aku_new_community/utils/login_util.dart';
import 'package:aku_new_community/utils/network/base_list_model.dart';
import 'package:aku_new_community/utils/network/base_model.dart';
import 'package:aku_new_community/utils/network/net_util.dart';
import 'package:aku_new_community/widget/tab_bar/bee_tab_bar.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -189,13 +188,11 @@ class _CommunityPageState extends State<CommunityPage>
16.hb,
..._newItems
.map((e) => ChatCard(
model: e,onDelete:(){
_easyRefreshController.callRefresh();
setState(() {
});
}
))
model: e,
onDelete: () {
_easyRefreshController.callRefresh();
setState(() {});
}))
.toList()
],
),
@ -226,13 +223,11 @@ class _CommunityPageState extends State<CommunityPage>
16.hb,
..._newItems
.map((e) => ChatCard(
model: e,onDelete:() {
_easyRefreshController.callRefresh();
setState(() {
});
}
))
model: e,
onDelete: () {
_easyRefreshController.callRefresh();
setState(() {});
}))
.toList()
],
),
@ -303,7 +298,7 @@ class _CommunityPageState extends State<CommunityPage>
final cancel = BotToast.showLoading();
BaseModel model = await NetUtil().get(API.news.category);
List<NewsCategoryModel>? category;
if (model.status == true && model.data != null) {
if (model.success == true && model.data != null) {
category = (model.data as List)
.map((e) => NewsCategoryModel.fromJson(e))
.toList();
@ -495,7 +490,7 @@ class _CommunityPageState extends State<CommunityPage>
_geSearch() {
return Container(
padding: EdgeInsets.only(bottom: 20.w,left: 32.w,right: 32.w),
padding: EdgeInsets.only(bottom: 20.w, left: 32.w, right: 32.w),
color: Colors.white,
child: MaterialButton(
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,

@ -175,7 +175,7 @@ class _FacilityPreorderPageState extends State<FacilityPreorderPage> {
},
);
cancel();
if (model.status == true) {
if (model.success == true) {
BotToast.showText(text: '预约成功');
Get.back(result: true);
} else if (model.message == '该时段已被预约') {

@ -69,7 +69,7 @@ class _PublicInformationDetailPageState
.get(API.manager.getPublicInformationDetail, params: {
"newsId": widget.id,
});
if (baseModel.status! && baseModel.data != null) {
if (baseModel.success && baseModel.data != null) {
_detailModel = NewsDetailModel.fromJson(baseModel.data);
_parasedText = LinkTextParase.stringParase(_detailModel.content);
} else {

@ -75,7 +75,7 @@ class _AdviceAddCommentPageState extends State<AdviceAddCommentPage> {
},
showMessage: true,
);
if (baseModel.status!) {
if (baseModel.success) {
Get.back(result: true);
}
}

@ -219,10 +219,10 @@ class _AdviceDetailPageState extends State<AdviceDetailPage> {
await NetUtil().get(API.manager.completeFeedBack, params: {
"adviceId": widget.model!.id,
});
if (baseModel.status ?? false) {
if (baseModel.success) {
Get.to(() => AdviceEvaluatePage(id: widget.model!.id));
}
BotToast.showText(text: baseModel.message ?? '未知错误');
BotToast.showText(text: baseModel.message);
},
child: '完成沟通'.text.bold.make(),
),

@ -72,7 +72,7 @@ class _AdviceEvaluatePageState extends State<AdviceEvaluatePage> {
params: {'id': widget.id, 'score': _rating},
showMessage: true,
);
if (baseModel.status!) {
if (baseModel.success) {
Get.back();
Get.back();
}

@ -105,7 +105,7 @@ class _NewAdvicePageState extends State<NewAdvicePage> {
showMessage: true,
);
cancel();
if (baseModel.status!) {
if (baseModel.success) {
Get.back(result: true);
}
}

@ -17,7 +17,7 @@ class HouseKeepingFunc {
"content": content,
"submitImgUrls": urls
});
if (baseModel.status ?? false) {
if (baseModel.success) {
return true;
} else {
return false;
@ -28,7 +28,7 @@ class HouseKeepingFunc {
static Future getHouseKeepingProcess(int id) async {
BaseModel baseModel = await NetUtil().get(API.manager.houseKeepingProcess,
params: {"housekeepingServiceId": id});
if (baseModel.status ?? false) {
if (baseModel.success) {
return (baseModel.data as List)
.map((e) => HouseKeepingProcessModel.fromJson(e))
.toList();
@ -43,7 +43,7 @@ class HouseKeepingFunc {
await NetUtil().get(API.manager.housekeepingCancel, params: {
"housekeepingServiceId": id,
});
if (baseModel.status ?? false) {
if (baseModel.success) {
BotToast.showText(text: '取消成功');
return true;
} else {
@ -74,7 +74,7 @@ class HouseKeepingFunc {
"evaluationContent": evaluationContent,
"evaluationImgUrls": imgs,
});
return baseModel.status ?? false;
return baseModel.success;
}
///app - ( APP )
@ -88,8 +88,8 @@ class HouseKeepingFunc {
"payType": type,
"payPrice": price
});
if (baseModel.status ?? false) {
return baseModel.message!;
if (baseModel.success) {
return baseModel.message;
} else {
return '';
}

@ -268,7 +268,7 @@ class _QuestionnaireDetailPageState extends State<QuestionnaireDetailPage> {
BaseModel baseModel = await ManagerFunc.questionnaireSubmit(
widget.id, _submitModels);
Get.to(() => SubmitComplishPage(
status: baseModel.status,
status: baseModel.success,
message: baseModel.message,
));
},

@ -13,7 +13,7 @@ class CollectionFunc {
///
static Future<List<CollectionGoodsModel>> getCollectionList() async {
BaseModel baseModel = await NetUtil().get(API.market.collectionList);
if (baseModel.status == true && baseModel.data != null) {
if (baseModel.success == true && baseModel.data != null) {
return (baseModel.data as List)
.map((e) => CollectionGoodsModel.fromJson(e))
.toList();
@ -66,7 +66,7 @@ class CollectionFunc {
// await NetUtil().get(API.market.suppliyerHotTop, params: {
// "supplierId": supplierId,
// });
// if (baseModel.status == true && baseModel.data != null) {
// if (baseModel.success == true && baseModel.data != null) {
// return (baseModel.data as List)
// .map((e) => GoodsItem.fromJson(e))
// .toList();
@ -78,7 +78,7 @@ class CollectionFunc {
// static Future getOrderDetail(int goodsAppointmentId) async {
// BaseModel baseModel = await NetUtil().get(API.market.orderDetail,
// params: {"goodsAppointmentId": goodsAppointmentId});
// if (baseModel.status! && baseModel.data != null) {
// if (baseModel.success && baseModel.data != null) {
// return OrderDetailModel.fromJson(baseModel.data);
// }
// }

@ -87,7 +87,7 @@ class _GoodsDetailPageState extends State<GoodsDetailPage> {
API.market.goodsDetail,
params: {"goodsId": widget.id},
);
if (baseModel.status == true && baseModel.data != null) {
if (baseModel.success == true && baseModel.data != null) {
_goodsModel = GoodsDetailModel.fromJson(baseModel.data);
} else {
_goodsModel = GoodsDetailModel.fail();
@ -96,7 +96,7 @@ class _GoodsDetailPageState extends State<GoodsDetailPage> {
baseModel = await NetUtil().get(API.market.suppliyerHotTop, params: {
"supplierId": _goodsModel.supplierId,
});
if (baseModel.status == true && baseModel.data != null) {
if (baseModel.success == true && baseModel.data != null) {
_topGoods = (baseModel.data as List)
.map((e) => GoodsItem.fromJson(e))
.toList();

@ -13,7 +13,6 @@ import 'package:aku_new_community/widget/bee_divider.dart';
import 'package:aku_new_community/widget/bee_scaffold.dart';
import 'package:aku_new_community/widget/buttons/bee_numberic_button.dart';
import 'package:aku_new_community/widget/buttons/bottom_button.dart';
import 'package:aku_new_community/widget/others/user_tool.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
@ -62,7 +61,7 @@ class _GoodsOrderDetailPageState extends State<GoodsOrderDetailPage> {
TextButton(
onPressed: () {
Get.to(() => HouseOwnersPage(
identify: UserTool.userProvider.userDetailModel!.type ?? 4,
identify: 4,
));
},
child: '切换房屋'.text.size(28.sp).color(ktextPrimary).make())
@ -101,8 +100,7 @@ class _GoodsOrderDetailPageState extends State<GoodsOrderDetailPage> {
},
showMessage: false,
);
if ((baseModel.status ?? false) &&
!baseModel.message.isEmptyOrNull) {
if ((baseModel.success) && !baseModel.message.isEmptyOrNull) {
bool result = await PayUtil()
.callAliPay(baseModel.message!, API.pay.shoppingCheck);
if (result) {

@ -50,7 +50,7 @@ class MyOrderFunc {
await NetUtil().get(API.market.suppliyerHotTop, params: {
"supplierId": supplierId,
});
if (baseModel.status == true && baseModel.data != null) {
if (baseModel.success == true && baseModel.data != null) {
return (baseModel.data as List)
.map((e) => GoodsItem.fromJson(e))
.toList();
@ -62,7 +62,7 @@ class MyOrderFunc {
static Future getOrderDetail(int goodsAppointmentId) async {
BaseModel baseModel = await NetUtil().get(API.market.orderDetail,
params: {"goodsAppointmentId": goodsAppointmentId});
if (baseModel.status! && baseModel.data != null) {
if (baseModel.success && baseModel.data != null) {
return OrderDetailModel.fromJson(baseModel.data);
}
}

@ -56,7 +56,7 @@ class _MyOrderRefundPageState extends State<MyOrderRefundPage> {
onPressed: () async {
BaseModel baseModel = await MyOrderFunc.refundOrder(
widget.model.id, _editingController.text, _type);
if (baseModel.status ?? false) {
if (baseModel.success) {
Get.back();
}
},

@ -74,9 +74,9 @@ class _OrderCardState extends State<OrderCard> {
"payType": 1, //
"payPrice": widget.model.payPrice
});
if (baseModel.status ?? false) {
if (baseModel.success) {
bool result = await PayUtil()
.callAliPay(baseModel.message!, API.pay.sharePayOrderCodeCheck);
.callAliPay(baseModel.message, API.pay.sharePayOrderCodeCheck);
if (result) {
Get.off(() => PayFinishPage());
}
@ -107,7 +107,7 @@ class _OrderCardState extends State<OrderCard> {
await NetUtil().get(API.market.deleteOrder, params: {
"orderId": widget.model.id,
});
if (baseModel.status ?? false) {
if (baseModel.success) {
BotToast.showText(text: '删除成功');
widget.callRefresh();
}
@ -136,7 +136,7 @@ class _OrderCardState extends State<OrderCard> {
Function cancel = BotToast.showLoading();
BaseModel baseModel = await NetUtil().get(API.market.cancelOrder,
params: {"orderId": widget.model.id, 'cancelReasonCode': 4});
if (baseModel.status ?? false) {
if (baseModel.success) {
BotToast.showText(text: '取消成功');
widget.callRefresh();
}
@ -167,7 +167,7 @@ class _OrderCardState extends State<OrderCard> {
await NetUtil().get(API.market.confirmOrder, params: {
"orderId": widget.model.id,
});
if (baseModel.status ?? false) {
if (baseModel.success) {
BotToast.showText(text: '收货成功');
Get.back();
widget.callRefresh();

@ -61,9 +61,9 @@ class _OrderDetailPageState extends State<OrderDetailPage> {
"payType": 1, //
"payPrice": widget.orderModel.payPrice
});
if (baseModel.status ?? false) {
if (baseModel.success) {
bool result = await PayUtil()
.callAliPay(baseModel.message!, API.pay.jcookOrderCheckAlipay);
.callAliPay(baseModel.message, API.pay.jcookOrderCheckAlipay);
if (result) {
Get.off(() => OrderPage(initIndex: 2));
} else {
@ -96,7 +96,7 @@ class _OrderDetailPageState extends State<OrderDetailPage> {
await NetUtil().get(API.market.deleteOrder, params: {
"orderId": widget.orderModel.id,
});
if (baseModel.status ?? false) {
if (baseModel.success) {
BotToast.showText(text: '删除成功');
Get.back();
widget.callRefresh();
@ -126,7 +126,7 @@ class _OrderDetailPageState extends State<OrderDetailPage> {
Function cancel = BotToast.showLoading();
BaseModel baseModel = await NetUtil().get(API.market.cancelOrder,
params: {"orderId": widget.orderModel.id, 'cancelReasonCode': 4});
if (baseModel.status ?? false) {
if (baseModel.success) {
BotToast.showText(text: '取消成功');
Get.back();
widget.callRefresh();
@ -158,7 +158,7 @@ class _OrderDetailPageState extends State<OrderDetailPage> {
await NetUtil().get(API.market.confirmOrder, params: {
"orderId": widget.orderModel.id,
});
if (baseModel.status ?? false) {
if (baseModel.success) {
BotToast.showText(text: '收货成功');
Get.back();
widget.callRefresh();
@ -548,7 +548,7 @@ class _OrderDetailPageState extends State<OrderDetailPage> {
await NetUtil().get(API.market.findLogistics, params: {
"orderId": widget.orderModel.id,
});
if (baseModel.status == true && baseModel.data != null) {
if (baseModel.success == true && baseModel.data != null) {
logisticsModels = (baseModel.data as List)
.map((e) => LogisticsModel.fromJson(e))
.toList();

@ -121,7 +121,7 @@ class SearchFunc {
static Future getOrderDetail(int goodsAppointmentId) async {
BaseModel baseModel = await NetUtil().get(API.market.orderDetail,
params: {"goodsAppointmentId": goodsAppointmentId});
if (baseModel.status! && baseModel.data != null) {
if (baseModel.success && baseModel.data != null) {
return OrderDetailModel.fromJson(baseModel.data);
}
}

@ -134,9 +134,9 @@ class _SubmitOrderPageState extends State<SubmitOrderPage> {
"payType": 1, //
"payPrice": _allPrice
});
if (baseModel.status ?? false) {
if (baseModel.success) {
bool result = await PayUtil().callAliPay(
baseModel.message!, API.pay.jcookOrderCheckAlipay);
baseModel.message, API.pay.jcookOrderCheckAlipay);
if (result) {
Get.off(() => OrderPage(initIndex: 2));
} else {
@ -728,10 +728,10 @@ class _SubmitOrderPageState extends State<SubmitOrderPage> {
var cancel = BotToast.showLoading();
var base = await NetUtil().post(API.market.shopCarChangeNum,
params: {'jcookGoodsId': jcookGoodsId, 'num': num});
if (!(base.status ?? false)) {
BotToast.showText(text: base.message ?? '');
if (!(base.success)) {
BotToast.showText(text: base.message);
}
cancel();
return base.status ?? false;
return base.success;
}
}

@ -122,9 +122,9 @@ class _SubmitOrderNormalPageState extends State<SubmitOrderNormalPage> {
"payType": 1, //
"payPrice": _allPrice
});
if (baseModel.status ?? false) {
if (baseModel.success) {
bool result = await PayUtil().callAliPay(
baseModel.message!, API.pay.jcookOrderCheckAlipay);
baseModel.message, API.pay.jcookOrderCheckAlipay);
if (result) {
Get.off(() => OrderPage(initIndex: 2));
} else {
@ -685,10 +685,10 @@ class _SubmitOrderNormalPageState extends State<SubmitOrderNormalPage> {
var cancel = BotToast.showLoading();
var base = await NetUtil().post(API.market.shopCarChangeNum,
params: {'jcookGoodsId': jcookGoodsId, 'num': num});
if (!(base.status ?? false)) {
BotToast.showText(text: base.message ?? '');
if (!(base.success)) {
BotToast.showText(text: base.message);
}
cancel();
return base.status ?? false;
return base.success;
}
}

@ -93,7 +93,7 @@ class _ShopCarPageState extends State<ShopCarPage> {
header: MaterialHeader(),
onRefresh: () async {
var base = await NetUtil().get(API.market.shopCarList);
if (base.status ?? false) {
if (base.success) {
_models = (base.data as List)
.map((e) => ShopCarListModel.fromJson(e))
.toList();
@ -254,8 +254,8 @@ class _ShopCarPageState extends State<ShopCarPage> {
},
showMessage: true,
);
if (model.status != null) {
if (model.status!) {
if (model.success != null) {
if (model.success) {
_selectIndex.clear();
_refreshController.callRefresh();
}
@ -609,11 +609,11 @@ class _ShopCarPageState extends State<ShopCarPage> {
var cancel = BotToast.showLoading();
var base = await NetUtil().post(API.market.shopCarChangeNum,
params: {'jcookGoodsId': jcookGoodsId, 'num': num});
if (!(base.status ?? false)) {
BotToast.showText(text: base.message ?? '');
if (!(base.success)) {
BotToast.showText(text: base.message);
}
cancel();
return base.status ?? false;
return base.success;
}
Future _changeNum() async {
@ -640,8 +640,8 @@ class _ShopCarPageState extends State<ShopCarPage> {
},
showMessage: true,
);
if (model.status != null) {
if (model.status!) {
if (model.success != null) {
if (model.success) {
_selectIndex.clear();
_refreshController.callRefresh();
}

@ -281,6 +281,6 @@ class _AddHousePageState extends State<AddHousePage> {
showMessage: true,
);
cancel();
if (model.status!) Get.back(result: true);
if (model.success) Get.back(result: true);
}
}

@ -15,7 +15,7 @@ class HouseFunc {
///
static Future<List<PassedHouseListModel>> get examineHouses async {
BaseModel model = await NetUtil().get(API.user.examineHouseList);
if (!model.status!) return [];
if (!model.success) return [];
return (model.data as List)
.map((e) => PassedHouseListModel.fromJson(e))
.toList();
@ -24,7 +24,7 @@ class HouseFunc {
///
static Future<List<PassedHouseListModel>> get passedHouses async {
BaseModel model = await NetUtil().get(API.user.passedHouseList);
if (!model.status!) return [];
if (!model.success) return [];
return (model.data as List)
.map((e) => PassedHouseListModel.fromJson(e))
.toList();
@ -44,7 +44,7 @@ class HouseFunc {
"tel": tel,
"idNumber": idNumber,
});
if (baseModel.status ?? false) {
if (baseModel.success) {
BotToast.showText(text: '提交成功');
return true;
}
@ -54,7 +54,7 @@ class HouseFunc {
///
static Future leaseEcho() async {
BaseModel baseModel = await NetUtil().get(API.house.leaseEcho);
if (baseModel.status ?? false) {
if (baseModel.success) {
return LeaseEchoModel.fromJson(baseModel.data);
} else {
return LeaseEchoModel.fail();
@ -66,7 +66,7 @@ class HouseFunc {
BaseModel baseModel = await NetUtil().get(API.house.leaseFindByld, params: {
"leaseId": leaseId,
});
if (baseModel.status ?? false) {
if (baseModel.success) {
return LeaseDetailModel.fromJson(baseModel.data);
} else {
return null;
@ -110,7 +110,7 @@ class HouseFunc {
"idCardFrontImgUrl": model.idCardFrontImgUrl,
"idCardBackImgUrl": model.idCardBackImgUrl,
});
if (baseModel.status ?? false) {
if (baseModel.success) {
return baseModel.data;
} else {
return '';
@ -141,7 +141,7 @@ class HouseFunc {
"contractSignatureImgUrl": sUrl,
});
if (baseModel.status ?? false) {
if (baseModel.success) {
return baseModel.data;
} else {
return '';
@ -166,7 +166,7 @@ class HouseFunc {
"id": id,
"leaseContractValidPdfUrl": urls,
});
return baseModel.status!;
return baseModel.success;
}
///
@ -178,8 +178,8 @@ class HouseFunc {
"payType": type,
"payPrice": price,
});
if (baseModel.status ?? false) {
return baseModel.message ?? '';
if (baseModel.success) {
return baseModel.message;
} else {
return '';
}
@ -201,7 +201,7 @@ class HouseFunc {
BaseModel baseModel = await NetUtil().post(
API.house.submitTerminateApplication,
params: {"id": id, "takeDate": takeDate, "clearingSingleImgUrl": urls});
if (baseModel.status ?? false) {
if (baseModel.success) {
return true;
} else {
return false;
@ -214,8 +214,8 @@ class HouseFunc {
Future<String> leaseRentOrder(int id, int type, double price) async {
BaseModel baseModel = await NetUtil().post(API.pay.leaseRentOrderAlipay,
params: {"sysLeaseId": id, "payType": type, "payPrice": price});
if (baseModel.status ?? false) {
return baseModel.message!;
if (baseModel.success) {
return baseModel.message;
} else {
return '';
}
@ -228,7 +228,7 @@ class HouseFunc {
"sysLeaseId": id,
"payPrice": price,
});
return baseModel.status ?? false;
return baseModel.success;
}
///-退
@ -237,7 +237,7 @@ class HouseFunc {
await NetUtil().get(API.house.refundApplication, params: {
"sysLeaseId": id,
});
if (baseModel.status ?? false) {
if (baseModel.success) {
return true;
} else {
return false;
@ -250,8 +250,8 @@ class HouseFunc {
Future<String> leaseRentBillOrder(int id, int type, double price) async {
BaseModel baseModel = await NetUtil().post(API.pay.leaseRentBillorder,
params: {"sysLeaseRentId": id, "payType": type, "payPrice": price});
if (baseModel.status ?? false) {
return baseModel.message!;
if (baseModel.success) {
return baseModel.message;
} else {
return '';
}

@ -67,7 +67,7 @@ class _HouseOwnersPageState extends State<HouseOwnersPage> {
}
bool get isOwner {
switch (UserTool.userProvider.userDetailModel!.type) {
switch (4) {
case 1:
return true;
case 3:
@ -79,7 +79,7 @@ class _HouseOwnersPageState extends State<HouseOwnersPage> {
}
bool get isTourist {
switch (UserTool.userProvider.userDetailModel!.type) {
switch (4) {
case 1:
return false;
case 2:
@ -106,7 +106,7 @@ class _HouseOwnersPageState extends State<HouseOwnersPage> {
Future.delayed(Duration(milliseconds: 300), () async {
Function cancel = BotToast.showLoading();
try {
await UserTool.userProvider.updateUserDetail();
await UserTool.userProvider.updateMyHouseInfo();
UserTool.appProveider.updateHouses(await HouseFunc.passedHouses);
} catch (e) {
LoggerData.addData(e);

@ -261,7 +261,7 @@ class _BeeSearchState extends State<BeeSearch> {
onRefresh: () async {
BaseModel baseModel = await NetUtil().get(API.search.homeSearch,
params: {"searchName": _textEditingController.text});
if (baseModel.status! && baseModel.data != null) {
if (baseModel.success && baseModel.data != null) {
_searchModel = SearchModel.fromJson(baseModel.data);
}
setState(() {});

@ -3,7 +3,6 @@ import 'package:aku_new_community/provider/app_provider.dart';
import 'package:aku_new_community/provider/user_provider.dart';
import 'package:aku_new_community/ui/profile/house/add_house_page.dart';
import 'package:aku_new_community/ui/profile/house/house_owners_page.dart';
import 'package:aku_new_community/widget/others/user_tool.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';
@ -43,7 +42,7 @@ class LoginUtil {
if (appProvider.selectedHouse == null) {
BotToast.showText(text: '房屋审核中或审核失败');
Get.to(() => HouseOwnersPage(
identify: UserTool.userProvider.userDetailModel!.type ?? 4,
identify: 4,
));
return false;
}

@ -1,21 +1,25 @@
import 'package:json_annotation/json_annotation.dart';
part 'base_model.g.dart';
@JsonSerializable()
class BaseModel {
int? code;
String? message;
bool? status;
int code;
String message;
bool success;
dynamic data;
factory BaseModel.fromJson(Map<String, dynamic> json) =>
_$BaseModelFromJson(json);
BaseModel.err(
{this.message = '未知错误',
this.success = false,
this.data = null,
this.code = 0});
BaseModel({
this.code,
this.message,
this.data,
this.status,
required this.code,
required this.message,
required this.success,
required this.data,
});
BaseModel.err({this.message = '未知错误', this.status = false});
BaseModel.fromJson(Map<String, dynamic> json) {
message = json['message'] ?? '';
data = json['data'] ?? null;
status = json['status'] ?? false;
}
}

@ -0,0 +1,14 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'base_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
BaseModel _$BaseModelFromJson(Map<String, dynamic> json) => BaseModel(
code: json['code'] as int,
message: json['message'] as String,
success: json['success'] as bool,
data: json['data'],
);

@ -1,7 +1,7 @@
import 'dart:io';
import 'dart:typed_data';
import 'package:aku_new_community/constants/api.dart';
import 'package:aku_new_community/constants/sars_api.dart';
import 'package:aku_new_community/pages/sign/login/login_page.dart';
import 'package:aku_new_community/provider/user_provider.dart';
import 'package:aku_new_community/utils/developer_util.dart';
@ -25,10 +25,10 @@ class NetUtil {
NetUtil._internal() {
BaseOptions options = BaseOptions(
baseUrl: API.baseURL,
connectTimeout: API.networkTimeOut,
receiveTimeout: API.networkTimeOut,
sendTimeout: API.networkTimeOut,
baseUrl: SARSAPI.baseURL,
connectTimeout: SARSAPI.networkTimeOut,
receiveTimeout: SARSAPI.networkTimeOut,
sendTimeout: SARSAPI.networkTimeOut,
headers: {},
);
if (_dio == null) _dio = Dio(options);
@ -182,12 +182,12 @@ class NetUtil {
_parseRequestError(BaseModel model, {bool showMessage = false}) {
final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
if (!model.status! && model.message == '登录失效,请登录' && userProvider.isLogin) {
if (!model.success && model.message == '登录失效,请登录' && userProvider.isLogin) {
userProvider.logout();
Get.offAll(() => LoginPage());
}
if (!model.status! || showMessage) {
BotToast.showText(text: model.message!);
if (!model.success || showMessage) {
BotToast.showText(text: model.message);
}
}
}

@ -1,6 +1,5 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class BeeBackButton extends StatelessWidget {
final Color color;
@ -11,7 +10,7 @@ class BeeBackButton extends StatelessWidget {
Widget build(BuildContext context) {
return Navigator.canPop(context)
? IconButton(
onPressed: () => Get.back(),
onPressed: () => Navigator.pop(context),
icon: Icon(
CupertinoIcons.chevron_back,
color: color,

@ -25,7 +25,7 @@ class BeeCityPicker extends StatefulWidget {
class _BeeCityPickerState extends State<BeeCityPicker> {
List<ChinaRegionModel> get provinces =>
HiveStore.dataBox!.get('cities').cast<ChinaRegionModel>().toList();
HiveStore.dataBox!.get('cities')?.cast<ChinaRegionModel>().toList() ?? [];
late int _pickedProvinceIndex;
late int _pickedCityIndex;

@ -898,6 +898,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "4.1.0"
pin_input_text_field:
dependency: transitive
description:
name: pin_input_text_field
url: "https://pub.flutter-io.cn"
source: hosted
version: "4.1.1"
platform:
dependency: transitive
description:
@ -1087,6 +1094,13 @@ packages:
description: flutter
source: sdk
version: "0.0.99"
sms_autofill:
dependency: "direct main"
description:
name: sms_autofill
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.2.0"
source_gen:
dependency: transitive
description:

@ -109,6 +109,8 @@ dependencies:
carousel_slider: ^4.0.0-nullsafety.0
#跳转索引列表
scroll_to_index: ^2.1.1
#验证码自动填充
sms_autofill: ^2.2.0
dev_dependencies:

Loading…
Cancel
Save