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 bb902091
authored
2026-06-03 12:00:40 +0800
by
tanghuan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
学习机登录界面调整
1 parent
34e1546b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
166 additions
and
13 deletions
lib/bloc/login_qr_cubit.dart
lib/config/routes.dart
lib/ui/pages/login_qr_page.dart
lib/ui/pages/login_v3/login_phone_page_v3.dart
lib/ui/pages/login_v3/login_qr_page_v3.dart
lib/bloc/login_qr_cubit.dart
View file @
bb90209
...
@@ -120,11 +120,18 @@ class LoginQrCubit extends Cubit<LoginQrState> {
...
@@ -120,11 +120,18 @@ class LoginQrCubit extends Cubit<LoginQrState> {
int
?
errCode
=
response
.
errCode
;
int
?
errCode
=
response
.
errCode
;
if
(
errCode
!=
null
&&
errCode
==
0
)
{
if
(
errCode
!=
null
&&
errCode
==
0
)
{
_doLogin
(
response
.
authCode
!);
_doLogin
(
response
.
authCode
!);
}
else
{
}
else
if
(
errCode
==
-
2
)
{
// 用户主动取消
emit
(
state
.
copyWith
(
emit
(
state
.
copyWith
(
status:
3
,
status:
3
,
tip:
'你已取消此次登录'
,
tip:
'你已取消此次登录'
,
));
));
}
else
{
// 其它非 0 错误码(含二维码过期/超时/网络异常等),引导用户刷新
emit
(
state
.
copyWith
(
status:
4
,
tip:
'请刷新二维码,再次登录'
,
));
}
}
}
}
}
}
...
@@ -247,6 +254,22 @@ class LoginQrCubit extends Cubit<LoginQrState> {
...
@@ -247,6 +254,22 @@ class LoginQrCubit extends Cubit<LoginQrState> {
router
.
go
(
'/loginMain'
);
router
.
go
(
'/loginMain'
);
}
}
void
goLoginPhone
()
{
router
.
go
(
'/loginPhone'
);
}
/// 刷新二维码:停止当前授权流程并重新走 init() 生成新的二维码
Future
<
void
>
refresh
()
async
{
// 重置为加载中状态(tip 与初次进入区分,避免 Equatable 短路掉相同 state 的 emit)
emit
(
const
LoginQrState
(
status:
0
,
tip:
'正在重新生成二维码...'
));
try
{
_fluwx
.
stopAuthByQRCode
();
}
catch
(
e
)
{
debugPrint
(
'stopAuthByQRCode error:
$e
'
);
}
await
init
();
}
@override
@override
Future
<
void
>
close
()
{
Future
<
void
>
close
()
{
_fluwxCancelable
.
cancel
();
_fluwxCancelable
.
cancel
();
...
...
lib/config/routes.dart
View file @
bb90209
...
@@ -21,7 +21,7 @@ import 'package:flutter/material.dart';
...
@@ -21,7 +21,7 @@ import 'package:flutter/material.dart';
import
'package:go_router/go_router.dart'
;
import
'package:go_router/go_router.dart'
;
final
GoRouter
router
=
GoRouter
(
final
GoRouter
router
=
GoRouter
(
initialLocation:
'/
web
'
,
initialLocation:
'/
loginQr
'
,
observers:
Platform
.
isIOS
?
[
LinkPageObserver
(),
IosGestureObserver
()]
:
[
LinkPageObserver
()],
observers:
Platform
.
isIOS
?
[
LinkPageObserver
(),
IosGestureObserver
()]
:
[
LinkPageObserver
()],
routes:
<
RouteBase
>[
routes:
<
RouteBase
>[
GoRoute
(
GoRoute
(
...
...
lib/ui/pages/login_qr_page.dart
View file @
bb90209
...
@@ -239,6 +239,50 @@ class LoginQrPage extends StatelessWidget {
...
@@ -239,6 +239,50 @@ class LoginQrPage extends StatelessWidget {
),
),
],
],
);
);
}
else
if
(
state
.
status
==
4
)
{
// 二维码过期,提示点击刷新
return
Column
(
children:
[
SizedBox
(
height:
15.5
),
Image
.
asset
(
"assets/images/login_v2/refused.png"
,
width:
217
,
height:
190
,
),
SizedBox
(
height:
15.5
),
Text
(
"二维码已过期"
,
style:
TextStyle
(
fontSize:
16
,
fontWeight:
FontWeight
.
bold
,
fontFamily:
'黑体'
,
color:
Color
(
0xFF333333
),
),
strutStyle:
StrutStyle
(
height:
21
/
16
),
),
SizedBox
(
height:
8
),
InkWell
(
onTap:
()
{
loginQrCubit
.
refresh
();
},
borderRadius:
BorderRadius
.
circular
(
4
),
child:
Padding
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
12
,
vertical:
6
),
child:
Text
(
'点击刷新'
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
fontSize:
14
,
color:
Color
(
0xFF7691FA
),
decoration:
TextDecoration
.
underline
,
decorationColor:
Color
(
0xFF7691FA
),
),
strutStyle:
StrutStyle
(
height:
16
/
14
),
),
),
),
],
);
}
}
return
null
;
return
null
;
}
}
...
...
lib/ui/pages/login_v3/login_phone_page_v3.dart
View file @
bb90209
...
@@ -87,15 +87,6 @@ class LoginPhonePageV3 extends StatelessWidget {
...
@@ -87,15 +87,6 @@ class LoginPhonePageV3 extends StatelessWidget {
children:
[
children:
[
InkWell
(
InkWell
(
onTap:
()
{
onTap:
()
{
context
.
read
<
LoginPhoneCubit
>().
goLoginMain
();
},
child:
Image
.
asset
(
'assets/images/login_v3/wechat.png'
,
),
),
SizedBox
(
width:
25
),
InkWell
(
onTap:
()
{
context
.
read
<
LoginPhoneCubit
>().
goLoginQr
();
context
.
read
<
LoginPhoneCubit
>().
goLoginQr
();
},
},
child:
Image
.
asset
(
child:
Image
.
asset
(
...
...
lib/ui/pages/login_v3/login_qr_page_v3.dart
View file @
bb90209
...
@@ -73,10 +73,10 @@ class LoginQrPageV3 extends StatelessWidget {
...
@@ -73,10 +73,10 @@ class LoginQrPageV3 extends StatelessWidget {
children:
[
children:
[
InkWell
(
InkWell
(
onTap:
()
{
onTap:
()
{
context
.
read
<
LoginQrCubit
>().
goLogin
Main
();
context
.
read
<
LoginQrCubit
>().
goLogin
Phone
();
},
},
child:
Image
.
asset
(
child:
Image
.
asset
(
'assets/images/login_v3/
wechat
.png'
,
'assets/images/login_v3/
phone
.png'
,
),
),
),
),
],
],
...
@@ -237,6 +237,101 @@ class LoginQrPageV3 extends StatelessWidget {
...
@@ -237,6 +237,101 @@ class LoginQrPageV3 extends StatelessWidget {
),
),
],
],
);
);
}
else
if
(
state
.
status
==
4
)
{
// 二维码过期,提示点击刷新
return
Column
(
children:
[
Container
(
width:
230
,
height:
230
,
padding:
EdgeInsets
.
all
(
20
),
decoration:
BoxDecoration
(
border:
Border
.
all
(
color:
Color
(
0x29265ECF
),
width:
0.5
,
),
borderRadius:
BorderRadius
.
circular
(
20
),
),
child:
Stack
(
alignment:
Alignment
.
center
,
children:
[
Image
.
memory
(
state
.
image
!,
width:
190
,
height:
190
,
),
Container
(
width:
190
,
height:
190
,
color:
Color
(
0xFF000000
).
withOpacity
(
0.5
),
alignment:
Alignment
.
center
,
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
children:
[
Text
(
'二维码已过期'
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
fontSize:
20
,
height:
1.0
,
fontWeight:
FontWeight
.
bold
,
fontFamily:
'黑体'
,
color:
Color
(
0xFFFFFFFF
),
),
),
SizedBox
(
height:
12
),
InkWell
(
onTap:
()
{
loginQrCubit
.
refresh
();
},
borderRadius:
BorderRadius
.
circular
(
22
),
child:
Container
(
height:
44
,
width:
129
,
padding:
EdgeInsets
.
symmetric
(
horizontal:
16
),
alignment:
Alignment
.
center
,
decoration:
BoxDecoration
(
color:
Color
(
0xFF7691FA
),
borderRadius:
BorderRadius
.
circular
(
22
),
),
child:
Row
(
mainAxisSize:
MainAxisSize
.
min
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
Image
.
asset
(
'assets/images/login_v3/refresh_icon.png'
,
),
SizedBox
(
width:
4
),
Text
(
'点击刷新'
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
fontSize:
16
,
height:
1.0
,
color:
Colors
.
white
,
),
),
],
),
),
),
],
),
),
],
),
),
SizedBox
(
height:
15
),
Text
(
state
.
tip
,
style:
TextStyle
(
fontSize:
14
,
height:
1.0
,
color:
Color
(
0xFF333333
),
),
),
],
);
}
}
return
null
;
return
null
;
}
}
...
...
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