Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
book-app
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
book-app
Commits
db20dff5
提交
db20dff5
authored
1月 22, 2024
作者:
yueweilu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修正回显逻辑
上级
ea5b1d3f
显示空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
32 行增加
和
11 行删除
+32
-11
controller.dart
lib/pages/change_pwd/controller.dart
+10
-2
index.dart
lib/pages/change_pwd/index.dart
+1
-0
view.dart
lib/pages/change_pwd/view.dart
+5
-5
index.dart
lib/pages/user_security/index.dart
+4
-0
view.dart
lib/pages/user_security/view.dart
+11
-3
routes.dart
lib/routes/routes.dart
+1
-1
没有找到文件。
lib/pages/change_pwd/controller.dart
浏览文件 @
db20dff5
part of
change_pwd
;
class
ChangePwdController
extends
GetxController
{
final
UserInfoModel
userInfo
;
ChangePwdController
(
this
.
userInfo
);
// 新密码
final
TextEditingController
pwdInput
=
TextEditingController
();
// 确认密码
...
...
@@ -40,7 +41,14 @@ class ChangePwdController extends GetxController {
}
Future
<
bool
>
changePwd
()
async
{
final
result
=
await
MineAPI
.
changePwd
(
password:
EncryptUtil
.
encodeMd5
(
EncryptUtil
.
encodeMd5
(
pwdInput
.
text
)),
rePassword:
EncryptUtil
.
encodeMd5
(
EncryptUtil
.
encodeMd5
(
pwd2Input
.
text
)));
final
result
=
await
MineAPI
.
changePwd
(
password:
EncryptUtil
.
encodeMd5
(
EncryptUtil
.
encodeMd5
(
pwdInput
.
text
)),
rePassword:
EncryptUtil
.
encodeMd5
(
EncryptUtil
.
encodeMd5
(
pwd2Input
.
text
))
);
if
(
result
){
userInfo
.
password
=
EncryptUtil
.
encodeMd5
(
EncryptUtil
.
encodeMd5
(
pwdInput
.
text
));
update
();
}
return
result
;
}
...
...
lib/pages/change_pwd/index.dart
浏览文件 @
db20dff5
...
...
@@ -8,6 +8,7 @@ import 'package:flutter/material.dart';
import
'package:go_router/go_router.dart'
;
import
'../../apis/index.dart'
;
import
'../../models/index.dart'
;
import
'../../routes/index.dart'
;
import
'../../widgets/index.dart'
;
...
...
lib/pages/change_pwd/view.dart
浏览文件 @
db20dff5
part of
change_pwd
;
class
ChangePwdPage
extends
StatefulWidget
{
final
String
type
;
final
UserInfoModel
userInfo
;
const
ChangePwdPage
({
Key
?
key
,
required
this
.
type
,
required
this
.
userInfo
,
})
:
super
(
key:
key
);
// const ResetPwdPage({Key? key}) : super(key: key);
...
...
@@ -17,11 +17,11 @@ class _ChangePwdPageState extends State<ChangePwdPage> {
Widget
build
(
BuildContext
context
)
{
final
currentContext
=
context
;
return
GetBuilder
<
ChangePwdController
>(
init:
ChangePwdController
(),
init:
ChangePwdController
(
widget
.
userInfo
),
builder:
(
controller
)
=>
Scaffold
(
appBar:
AppBar
(
centerTitle:
true
,
title:
Text
(
widget
.
type
==
'1'
?
'设置密码'
:
'修改密码'
),
title:
Text
(
widget
.
userInfo
.
password
.
toString
().
isEmpty
?
'设置密码'
:
'修改密码'
),
),
body:
Container
(
margin:
EdgeInsets
.
only
(
left:
10
.
w
,
top:
15
.
w
,
right:
10
.
w
),
...
...
@@ -117,7 +117,7 @@ class _ChangePwdPageState extends State<ChangePwdPage> {
),
Gaps
.
vGaps40
,
CustomGradientButton
(
text:
widget
.
type
==
'1'
?
'确认'
:
'确认修改'
,
text:
widget
.
userInfo
.
password
.
toString
().
isEmpty
?
'确认'
:
'确认修改'
,
isEnabled:
controller
.
enable
,
onPressed:
()
async
{
Tools
.
unfocus
();
...
...
lib/pages/user_security/index.dart
浏览文件 @
db20dff5
library
user_security
;
import
'package:flutter/material.dart'
;
import
'package:flutter_book/apis/index.dart'
;
import
'package:flutter_book/models/index.dart'
;
import
'package:flutter_screenutil/flutter_screenutil.dart'
;
import
'package:go_router/go_router.dart'
;
import
'../../routes/index.dart'
;
import
'../../store/index.dart'
;
import
'../../utils/index.dart'
;
import
'../../widgets/index.dart'
;
part
'view.dart'
;
\ No newline at end of file
lib/pages/user_security/view.dart
浏览文件 @
db20dff5
...
...
@@ -51,7 +51,7 @@ class _UserSecurityPageState extends State<UserSecurityPage> {
),
GestureDetector
(
onTap:
(){
context
.
pushNamed
(
Routes
.
changePwd
,
queryParameters:
{
'type'
:
widget
.
model
.
password
.
toString
().
isEmpty
?
'1'
:
'2'
}
);
context
.
pushNamed
(
Routes
.
changePwd
,
extra:
widget
.
model
);
},
child:
_buildItem
(
title:
'修改密码'
,
value:
widget
.
model
.
password
.
toString
().
isEmpty
?
'未设置'
:
''
)
),
...
...
@@ -76,8 +76,16 @@ class _UserSecurityPageState extends State<UserSecurityPage> {
children:
[
GestureDetector
(
child:
_buildItem
(
title:
'账号注销'
,
value:
''
),
onTap:
(){
onTap:
()
async
{
final
result
=
await
AccountAPI
.
delete
();
if
(
result
){
CustomToast
.
loading
();
await
UserStore
.
to
.
logout
();
CustomToast
.
dismiss
();
if
(
context
.
mounted
){
context
.
goNamed
(
Routes
.
splash
);
}
}
},
),
],
...
...
lib/routes/routes.dart
浏览文件 @
db20dff5
...
...
@@ -416,7 +416,7 @@ abstract class Routes {
pageBuilder:
(
context
,
state
)
=>
CupertinoPage
(
name:
state
.
uri
.
toString
(),
key:
state
.
pageKey
,
child:
ChangePwdPage
(
type:
state
.
uri
.
queryParameters
[
'type'
].
toString
()
)
child:
ChangePwdPage
(
userInfo:
state
.
extra
as
UserInfoModel
)
)
),
GoRoute
(
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论