Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
ethan
/
appframe
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit 8081bf8e
authored
2026-01-07 09:29:05 +0800
by
tanghuan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
增加注销用户操作
1 parent
ca90354c
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
85 additions
and
1 deletions
lib/bloc/setting/account_cubit.dart
lib/data/repositories/phone_auth_repository.dart
lib/ui/pages/setting/account_page.dart
lib/bloc/setting/account_cubit.dart
View file @
8081bf8
...
@@ -90,4 +90,16 @@ class AccountCubit extends Cubit<AccountState> {
...
@@ -90,4 +90,16 @@ class AccountCubit extends Cubit<AccountState> {
emit
(
state
.
copyWith
(
phone:
result
));
emit
(
state
.
copyWith
(
phone:
result
));
}
}
}
}
Future
<
void
>
unbind
()
async
{
var
sharedPreferences
=
getIt
.
get
<
SharedPreferences
>();
var
userCode
=
sharedPreferences
.
getString
(
'auth_userCode'
)
??
''
;
_phoneAuthRepository
.
unbind
(
userCode
);
// 当前只会成功,不会失败
// 解绑成功,跳转登录界面
router
.
go
(
'/loginMain'
);
}
}
}
lib/data/repositories/phone_auth_repository.dart
View file @
8081bf8
...
@@ -86,4 +86,20 @@ class PhoneAuthRepository {
...
@@ -86,4 +86,20 @@ class PhoneAuthRepository {
);
);
return
resp
.
statusCode
==
200
?
resp
.
data
:
null
;
return
resp
.
statusCode
==
200
?
resp
.
data
:
null
;
}
}
///
/// {
/// "code": 0,
/// "error": "操作成功"
/// }
///
Future
<
dynamic
>
unbind
(
String
userid
)
async
{
Response
resp
=
await
_appService
.
post
(
'/api/v1/comm/phone/unbind'
,
{
"userid"
:
userid
,
},
);
return
resp
.
data
;
}
}
}
lib/ui/pages/setting/account_page.dart
View file @
8081bf8
...
@@ -77,7 +77,63 @@ class AccountPage extends StatelessWidget {
...
@@ -77,7 +77,63 @@ class AccountPage extends StatelessWidget {
},
},
),
),
),
),
// Divider(),
SizedBox
(
height:
16
),
Padding
(
padding:
EdgeInsets
.
all
(
80
),
child:
SizedBox
(
width:
double
.
infinity
,
height:
47
,
child:
ElevatedButton
(
onPressed:
()
async
{
final
accountCubit
=
context
.
read
<
AccountCubit
>();
bool
?
confirm
=
await
showDialog
<
bool
>(
context:
context
,
builder:
(
BuildContext
ctx
)
{
return
AlertDialog
(
title:
Text
(
'确认注销'
),
content:
Text
(
'您确定要注销当前用户吗?'
),
actions:
[
TextButton
(
onPressed:
()
{
Navigator
.
of
(
ctx
).
pop
(
false
);
},
child:
Text
(
'取消'
),
),
TextButton
(
onPressed:
()
{
Navigator
.
of
(
ctx
).
pop
(
true
);
},
child:
Text
(
'确认'
),
),
],
);
},
);
if
(
confirm
==
true
)
{
accountCubit
.
unbind
();
}
},
style:
ElevatedButton
.
styleFrom
(
backgroundColor:
Color
(
0xFF7691FA
),
foregroundColor:
Colors
.
white
,
textStyle:
TextStyle
(
fontSize:
19
),
shape:
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
circular
(
23.5
),
),
),
child:
Text
(
'注销用户'
,
style:
TextStyle
(
fontSize:
19
,
fontWeight:
FontWeight
.
w400
,
color:
Color
(
0xFFFFFFFF
),
),
strutStyle:
StrutStyle
(
height:
22
/
19
),
),
),
),
),
],
],
),
),
),
),
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment