delete some code

pull/1/head
张萌 3 years ago
parent ad6cd6fc8b
commit 01fcb33944

@ -37,6 +37,12 @@ class _User {
///app() ///app()
String get sendForgotTelCode => '/app/user/sendTelCodeForgetPwd'; String get sendForgotTelCode => '/app/user/sendTelCodeForgetPwd';
///
String get checkNickRepeat => '/app/user/checkNickNameRepeat';
///
String get setNickName => '/app/user/settingNickName';
} }
class _Login { class _Login {

@ -0,0 +1,141 @@
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/tab_navigator.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:velocity_x/velocity_x.dart';
class SetNickNamePage extends StatefulWidget {
const SetNickNamePage({Key? key}) : super(key: key);
@override
_SetNickNamePageState createState() => _SetNickNamePageState();
}
class _SetNickNamePageState extends State<SetNickNamePage> {
TextEditingController _nickController = TextEditingController();
bool _nickIsRepeat = false;
@override
void dispose() {
_nickController.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,
'昵称不可设置侮辱性词汇、特殊符号、敏感字符'
.text
.size(28.sp)
.color(Colors.black.withOpacity(0.45))
.make(),
Spacer(),
],
),
95.w.heightBox,
Container(
width: 686.w,
height: 94.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(60.w),
color: Colors.black.withOpacity(0.06),
),
child: TextField(
onChanged: (text) async {
_nickIsRepeat = !(await SignFunc.checkNickRepeat(text));
setState(() {});
},
maxLength: 20,
controller: _nickController,
decoration: InputDecoration(
isDense: false,
contentPadding:
EdgeInsets.symmetric(horizontal: 24.w, vertical: 24.w),
border: InputBorder.none,
counterText: '',
hintText: '请输入您的昵称不超过20个字符',
hintStyle: TextStyle(
color: Colors.black.withOpacity(0.25), fontSize: 28.sp)),
),
),
_nickIsRepeat ? _nickRepeat() : 100.w.heightBox,
LoginButtonWidget(
onTap: () async {
var result = await SignFunc.setNickName(_nickController.text);
if (result) {
Get.offAll(TabNavigator());
}
},
text: '确定'),
],
),
);
}
Widget _nickRepeat() {
return Padding(
padding: EdgeInsets.symmetric(horizontal: 48.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
24.w.heightBox,
'该昵称已有人注册,请重新输入'.text.size(28.sp).color(Colors.red).make(),
50.w.heightBox,
'试试以下昵称'
.text
.size(28.sp)
.color(Colors.black.withOpacity(0.65))
.make(),
24.w.heightBox,
otherNick('123'),
24.w.heightBox,
otherNick('321'),
24.w.heightBox,
otherNick('231'),
100.w.heightBox,
],
),
);
}
Container otherNick(String extra) {
return Container(
height: 70.w,
padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 16.w),
alignment: Alignment.centerLeft,
decoration: BoxDecoration(
color: Colors.black.withOpacity(0.03),
borderRadius: BorderRadius.circular(42.sp)),
child: '${_nickController.text}$extra'
.text
.size(28.sp)
.color(Color(0xFF5096F1))
.make(),
);
}
}

@ -3,8 +3,8 @@ 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/pick_building_model.dart';
import 'package:aku_new_community/models/user/my_house_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/models/user/user_info_model.dart';
import 'package:aku_new_community/pages/sign/login/set_nick_name_page.dart';
import 'package:aku_new_community/pages/sign/login/set_psd_page.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/sign_up_provider.dart';
import 'package:aku_new_community/provider/user_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/base_model.dart';
@ -158,7 +158,7 @@ class SignFunc {
BaseModel baseModel = await NetUtil().get( BaseModel baseModel = await NetUtil().get(
SARSAPI.profile.house.userHouse, SARSAPI.profile.house.userHouse,
); );
if (baseModel.data == null) return null; if ((baseModel.data as List).isEmpty) return null;
return MyHouseModel.fromJson(baseModel.data); return MyHouseModel.fromJson(baseModel.data);
} }
@ -166,9 +166,31 @@ class SignFunc {
if (!UserTool.userProvider.userInfoModel!.isExistPassword) { if (!UserTool.userProvider.userInfoModel!.isExistPassword) {
await Get.to(() => SetPsdPage()); await Get.to(() => SetPsdPage());
} else if (UserTool.userProvider.userInfoModel!.nickName == null) { } else if (UserTool.userProvider.userInfoModel!.nickName == null) {
await Get.to(() => SignUpSetNicknamePage()); print('111');
await Get.to(() => SetNickNamePage());
} else { } else {
print('222');
Get.offAll(() => TabNavigator()); Get.offAll(() => TabNavigator());
} }
} }
///
static Future<bool> checkNickRepeat(String nick) async {
BaseModel baseModel = await NetUtil().get(SARSAPI.user.checkNickRepeat,
params: {
'nickName': nick,
},
showMessage: true);
return baseModel.success;
}
///
static Future<bool> setNickName(String nick) async {
BaseModel baseModel = await NetUtil().get(SARSAPI.user.setNickName,
params: {
'nickName': nick,
},
showMessage: true);
return baseModel.success;
}
} }

@ -1,17 +0,0 @@
import 'package:aku_new_community/base/base_style.dart';
import 'package:aku_new_community/utils/headers.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:velocity_x/velocity_x.dart';
signUpTitle(String subTitle) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
'欢迎登录小蜜蜂'.text.bold.size(38.sp).color(ktextPrimary).make(),
8.hb,
subTitle.text.size(28.sp).color(ktextSubColor).make(),
],
);
}

@ -1,102 +0,0 @@
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_common_widget.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/utils/headers.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flustars/flustars.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';
import 'package:random_character/chinese_character/random_chinese_charater.dart';
import 'package:velocity_x/velocity_x.dart';
class SignUpSetNicknamePage extends StatefulWidget {
SignUpSetNicknamePage({Key? key}) : super(key: key);
@override
_SignUpSetNicknamePageState createState() => _SignUpSetNicknamePageState();
}
class _SignUpSetNicknamePageState extends State<SignUpSetNicknamePage> {
GlobalKey<FormState> _globalKey = GlobalKey<FormState>();
TextEditingController _textEditingController = TextEditingController();
@override
void dispose() {
_textEditingController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: ListView(
padding: EdgeInsets.symmetric(horizontal: 32.w),
children: [
148.hb,
signUpTitle('设置昵称'),
190.hb,
'请输入您的昵称'.text.size(32.sp).color(ktextPrimary).make(),
Form(
key: _globalKey,
child: TextFormField(
controller: _textEditingController,
validator: (value) {
if (TextUtil.isEmpty(value))
return '昵称不能为空';
else
return null;
},
decoration: InputDecoration(
border: UnderlineInputBorder(
borderSide: BorderSide(color: Color(0xFFD8D8D8)),
),
hintText: '为保护个人隐私,在与邻居交流时将显示昵称',
),
),
),
],
),
bottomNavigationBar: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
MaterialButton(
color: kPrimaryColor,
elevation: 0,
height: 89.w,
child: '保存'.text.make(),
shape: StadiumBorder(),
onPressed: () async {
final cancel = BotToast.showLoading();
if (_globalKey.currentState!.validate()) {
final signUpProvider =
Provider.of<SignUpProvider>(context, listen: false);
signUpProvider.setNickName(_textEditingController.text);
cancel();
bool result = await SignFunc.signUp();
if (result) Get.offAll(() => TabNavigator());
}
},
),
MaterialButton(
elevation: 0,
height: 89.w,
child: [
Icon(Icons.cached_rounded),
12.wb,
'换一换'.text.make(),
].row(),
shape: StadiumBorder(),
onPressed: () {
_textEditingController.text =
RandomCharacter.getChinese(length: 3);
},
),
],
).pLTRB(82.w, 0, 82.w, 60.w),
);
}
}

@ -1,87 +0,0 @@
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_common_widget.dart';
import 'package:aku_new_community/pages/tab_navigator.dart';
import 'package:aku_new_community/utils/headers.dart';
import 'package:flustars/flustars.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class SignUpVerifyPage extends StatefulWidget {
SignUpVerifyPage({Key? key}) : super(key: key);
@override
_SignUpVerifyPageState createState() => _SignUpVerifyPageState();
}
class _SignUpVerifyPageState extends State<SignUpVerifyPage> {
TextEditingController _nameController = TextEditingController();
TextEditingController _idNumberController = TextEditingController();
GlobalKey<FormState> _formKey = GlobalKey<FormState>();
@override
Widget build(BuildContext context) {
return Scaffold(
body: Form(
key: _formKey,
child: ListView(
padding: EdgeInsets.symmetric(horizontal: 32.w),
children: [
148.hb,
signUpTitle('设置昵称'),
190.hb,
'请输入您的姓名'.text.size(32.sp).color(ktextPrimary).make(),
TextFormField(
controller: _nameController,
validator: (value) {
if (TextUtil.isEmpty(value))
return '姓名不能为空';
else
return null;
},
decoration: InputDecoration(
border: UnderlineInputBorder(
borderSide: BorderSide(color: Color(0xFFD8D8D8)),
),
// hintText: '',
),
),
40.hb,
'请输入您的身份证号'.text.size(32.sp).color(ktextPrimary).make(),
TextFormField(
controller: _idNumberController,
validator: (value) {
if (TextUtil.isEmpty(value)) return '身份证号不能为空';
if (!RegexUtil.isIDCard(value!))
return '身份证格式错误';
else
return null;
},
decoration: InputDecoration(
border: UnderlineInputBorder(
borderSide: BorderSide(color: Color(0xFFD8D8D8)),
),
// hintText: '',
),
),
],
),
),
bottomNavigationBar: MaterialButton(
height: 89.w,
color: kPrimaryColor,
shape: StadiumBorder(),
disabledColor: kPrimaryColor.withOpacity(0.3),
child: '登录'.text.bold.make(),
onPressed: () async {
if (_formKey.currentState!.validate()) {
bool result = await SignFunc.signUp();
if (result) Get.offAll(() => TabNavigator());
}
},
elevation: 0,
).pLTRB(82.w, 0, 82.w, 155.w),
);
}
}

@ -4,7 +4,6 @@ import 'package:aku_new_community/const/resource.dart';
import 'package:aku_new_community/main_initialize.dart'; import 'package:aku_new_community/main_initialize.dart';
import 'package:aku_new_community/pages/setting_page/agreement_page/agreement_page.dart'; import 'package:aku_new_community/pages/setting_page/agreement_page/agreement_page.dart';
import 'package:aku_new_community/pages/setting_page/agreement_page/privacy_page.dart'; import 'package:aku_new_community/pages/setting_page/agreement_page/privacy_page.dart';
import 'package:aku_new_community/pages/tab_navigator.dart';
import 'package:aku_new_community/provider/app_provider.dart'; import 'package:aku_new_community/provider/app_provider.dart';
import 'package:aku_new_community/provider/user_provider.dart'; import 'package:aku_new_community/provider/user_provider.dart';
import 'package:aku_new_community/utils/developer_util.dart'; import 'package:aku_new_community/utils/developer_util.dart';
@ -139,7 +138,6 @@ class _SplashPageState extends State<SplashPage> {
MainInitialize.initTheme(); MainInitialize.initTheme();
MainInitialize.initWechat(); MainInitialize.initWechat();
MainInitialize.initWebSocket(); MainInitialize.initWebSocket();
Get.offAll(() => TabNavigator());
}); });
} }

@ -12,7 +12,10 @@ class DataProvider extends ChangeNotifier {
?.cast<HistoryLoginModel>() ?.cast<HistoryLoginModel>()
.toList() ?? .toList() ??
[]; [];
if (_loginHistories.isEmpty) { _cityModel =
HiveStore.dataBox!.get('cities')?.cast<ChinaRegionModel>().toList() ??
[];
if (_cityModel.isEmpty) {
updateCityList(); updateCityList();
} }
} }

@ -33,7 +33,7 @@ class UserProvider extends ChangeNotifier {
HiveStore.appBox!.put('token', token); HiveStore.appBox!.put('token', token);
HiveStore.appBox!.put('login', true); HiveStore.appBox!.put('login', true);
await updateUserInfo(); await updateUserInfo();
await updateMyHouseInfo(); // await updateMyHouseInfo();
/// ///
_userConfig = await HiveStore.userBox!.get('${_userInfoModel!.id}') ?? _userConfig = await HiveStore.userBox!.get('${_userInfoModel!.id}') ??
@ -71,14 +71,11 @@ class UserProvider extends ChangeNotifier {
Future<bool> updateUserInfo() async { Future<bool> updateUserInfo() async {
_userInfoModel = await SignFunc.getUserInfo(); _userInfoModel = await SignFunc.getUserInfo();
print('222');
if (_userInfoModel == null) { if (_userInfoModel == null) {
BotToast.showText(text: '获取用户信息失败'); BotToast.showText(text: '获取用户信息失败');
return false; return false;
} }
if (_userInfoModel != null && !kIsWeb && !Platform.isMacOS) { if (_userInfoModel != null && !kIsWeb && !Platform.isMacOS) {
print('111');
SignFunc.checkNameAndAccount(); SignFunc.checkNameAndAccount();
} }

Loading…
Cancel
Save