提交 9dc5cafd authored 作者: yueweilu's avatar yueweilu

关于界面获取版本

上级 fc80bfa6
...@@ -227,7 +227,7 @@ abstract class MineAPI { ...@@ -227,7 +227,7 @@ abstract class MineAPI {
}); });
} }
/// 12、笔记详情列表 /// 13、笔记详情列表
/// ///
static Future <List<DiscussModel>> discussList({ static Future <List<DiscussModel>> discussList({
int page = 1, int page = 1,
...@@ -250,8 +250,43 @@ abstract class MineAPI { ...@@ -250,8 +250,43 @@ abstract class MineAPI {
}); });
} }
/// 14、修改密码
///
static Future <bool> changePwd({
required String password,
required String rePassword
}) async {
final result = await HttpService.to.post(
'/v1/members/Information/changePasswd',
params: {
'password':password,
'repassword':rePassword
},
);
if (result.data is Map && result.data['is_success'] == 1){
return true;
}
return false;
}
/// 15、修改手机号
static Future <bool> changePhone({
required String phone,
required String code
}) async {
final result = await HttpService.to.post(
'/v1/members/Information/editPhone',
params: {
'phone':phone,
'code':code
},
);
if (result.data is Map && result.data['is_success'] == 1){
return true;
}
return false;
}
} }
\ No newline at end of file
...@@ -58,10 +58,10 @@ class ChangePhoneController extends GetxController { ...@@ -58,10 +58,10 @@ class ChangePhoneController extends GetxController {
// 定时器回调 // 定时器回调
}); });
/// 测试账号 /// 测试账号
if (kDebugMode) { // if (kDebugMode) {
phoneInput.text = '13521054068'; // phoneInput.text = '13521054068';
codeInput.text = '123456'; // codeInput.text = '123456';
} // }
super.onInit(); super.onInit();
} }
...@@ -84,6 +84,12 @@ class ChangePhoneController extends GetxController { ...@@ -84,6 +84,12 @@ class ChangePhoneController extends GetxController {
else{ else{
Toast.show('发送失败'); Toast.show('发送失败');
} }
}
Future <bool> changePhone() async {
final result = await MineAPI.changePhone(phone:phoneInput.text, code: codeInput.text,);
return result;
} }
} }
\ No newline at end of file
...@@ -116,10 +116,16 @@ class _ChangePhonePageState extends State<ChangePhonePage> { ...@@ -116,10 +116,16 @@ class _ChangePhonePageState extends State<ChangePhonePage> {
), ),
Gaps.vGaps40, Gaps.vGaps40,
CustomGradientButton( CustomGradientButton(
text: '下一步', text: '确认修改',
isEnabled: controller.enable, isEnabled: controller.enable,
onPressed: () { onPressed: () async {
context.pushNamed(Routes.resetPwd,queryParameters: {'phone': controller.phoneInput.text,'code': controller.codeInput.text}); Tools.unfocus();
final result = await controller.changePhone();
if (result){
Toast.show('修改成功');
context.pop();
}
}, },
) )
], ],
......
...@@ -39,6 +39,11 @@ class ChangePwdController extends GetxController { ...@@ -39,6 +39,11 @@ class ChangePwdController extends GetxController {
super.onClose(); super.onClose();
} }
Future <bool> changePwd() async {
final result = await MineAPI.changePwd(password: EncryptUtil.encodeMd5(EncryptUtil.encodeMd5(pwdInput.text)), rePassword: EncryptUtil.encodeMd5(EncryptUtil.encodeMd5(pwd2Input.text)));
return result;
}
// void resetPassword(BuildContext context) async { // void resetPassword(BuildContext context) async {
// final result = await AccountAPI.resetPassword( // final result = await AccountAPI.resetPassword(
// phone: phone, // phone: phone,
......
...@@ -15,6 +15,7 @@ class ChangePwdPage extends StatefulWidget { ...@@ -15,6 +15,7 @@ class ChangePwdPage extends StatefulWidget {
class _ChangePwdPageState extends State<ChangePwdPage> { class _ChangePwdPageState extends State<ChangePwdPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final currentContext = context;
return GetBuilder<ChangePwdController>( return GetBuilder<ChangePwdController>(
init: ChangePwdController(), init: ChangePwdController(),
builder: (controller) =>Scaffold( builder: (controller) =>Scaffold(
...@@ -118,7 +119,13 @@ class _ChangePwdPageState extends State<ChangePwdPage> { ...@@ -118,7 +119,13 @@ class _ChangePwdPageState extends State<ChangePwdPage> {
CustomGradientButton( CustomGradientButton(
text: widget.type == '1'?'确认':'确认修改', text: widget.type == '1'?'确认':'确认修改',
isEnabled: controller.enable, isEnabled: controller.enable,
onPressed: () { onPressed: () async {
Tools.unfocus();
final result = await controller.changePwd();
if (result){
Toast.show('修改成功');
context.pop();
}
// context.goNamed(Routes.login); // context.goNamed(Routes.login);
}, },
) )
......
...@@ -4,6 +4,7 @@ import 'package:flutter/material.dart'; ...@@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_book/utils/index.dart'; import 'package:flutter_book/utils/index.dart';
import 'package:flutter_book/widgets/index.dart'; import 'package:flutter_book/widgets/index.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:package_info_plus/package_info_plus.dart';
import '../../routes/index.dart'; import '../../routes/index.dart';
......
part of about; part of about;
class AboutPage extends StatelessWidget { class AboutPage extends StatefulWidget {
const AboutPage({Key? key}) : super(key: key); const AboutPage({Key? key}) : super(key: key);
@override
State<AboutPage> createState() => _AboutPageState();
}
class _AboutPageState extends State<AboutPage> {
PackageInfo packageInfo = PackageInfo(
appName: 'Unknown',
packageName: 'Unknown',
version: 'Unknown',
buildNumber: 'Unknown',
buildSignature: 'Unknown',
installerStore: 'Unknown',
);
@override
void initState() {
_getVersion();
super.initState();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
...@@ -23,9 +43,10 @@ class AboutPage extends StatelessWidget { ...@@ -23,9 +43,10 @@ class AboutPage extends StatelessWidget {
color: Colors.cyan, color: Colors.cyan,
child: const CustomImage.asset(url: 'assets/images/banner.png'), child: const CustomImage.asset(url: 'assets/images/banner.png'),
), ),
Gaps.hGaps15, Gaps.vGaps15,
const Text('紫荆数智学堂',style: TextStyle(fontSize: 17,fontWeight: Fonts.medium,color: Colours.c3),), const Text('紫荆数智学堂',style: TextStyle(fontSize: 17,fontWeight: Fonts.medium,color: Colours.c3),),
const Text('V1.0.0',style: TextStyle(fontSize: 13,color: Colours.c9)), Gaps.vGaps5,
Text('V${packageInfo.version??''}',style: const TextStyle(fontSize: 13,color: Colours.c9)),
], ],
), ),
SafeArea( SafeArea(
...@@ -52,8 +73,8 @@ class AboutPage extends StatelessWidget { ...@@ -52,8 +73,8 @@ class AboutPage extends StatelessWidget {
], ],
), ),
Gaps.hGaps10, Gaps.hGaps10,
const Text('Copyright © 2017 Zijing Education. All rights reserved.\n清控紫荆(北京)教育科技股份有限公司京\nICP证150431号',style: TextStyle(color: Colours.c9,fontSize:9),textAlign: TextAlign.center,) const Text('Copyright © 2024 Zijing Education. All rights reserved.\n清控紫荆(北京)教育科技股份有限公司京\nICP证150431号',style: TextStyle(color: Colours.c9,fontSize:9),textAlign: TextAlign.center,),
Gaps.vGaps25,
], ],
), ),
) )
...@@ -62,4 +83,11 @@ class AboutPage extends StatelessWidget { ...@@ -62,4 +83,11 @@ class AboutPage extends StatelessWidget {
), ),
); );
} }
void _getVersion() async {
final info = await PackageInfo.fromPlatform();
setState(() {
packageInfo = info;
});
}
} }
差异被折叠。
...@@ -93,6 +93,8 @@ dependencies: ...@@ -93,6 +93,8 @@ dependencies:
fluwx: ^4.4.9 fluwx: ^4.4.9
# #
image_picker: 0.8.7+5 image_picker: 0.8.7+5
#
package_info_plus: ^4.2.0
dev_dependencies: dev_dependencies:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论