Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
smart_hotel_app
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张宏
smart_hotel_app
Commits
d5a8a7d0
Commit
d5a8a7d0
authored
Jun 29, 2026
by
胡曲
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bugs
parent
e0fb3687
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
62 additions
and
76 deletions
+62
-76
auth_bloc.dart
lib/blocs/auth/auth_bloc.dart
+6
-4
index_view.dart
lib/views/home/index/index_view.dart
+1
-1
voltage_operate_block.dart
lib/views/home/index/widget/voltage_operate_block.dart
+1
-1
login_cubit.dart
lib/views/login/cubit/login_cubit.dart
+2
-6
login_view.dart
lib/views/login/login_view.dart
+41
-54
btn_login.dart
lib/views/login/widget/btn_login.dart
+2
-2
password_field.dart
lib/views/login/widget/password_field.dart
+4
-4
remember_password_row.dart
lib/views/login/widget/remember_password_row.dart
+1
-0
username_field.dart
lib/views/login/widget/username_field.dart
+4
-4
No files found.
lib/blocs/auth/auth_bloc.dart
View file @
d5a8a7d0
...
...
@@ -14,10 +14,10 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
})
:
_authService
=
authService
,
_storageService
=
storageService
,
super
(
AuthInitial
())
{
on
<
AuthLoginRequested
>(
_onLoginRequested
);
on
<
AuthTokenExpiredEvent
>(
_onTokenExpired
);
on
<
AuthLogoutRequestedEvent
>(
_onLogoutRequested
);
on
<
AuthFetchUserInfo
>(
_onFetchUserInfo
);
on
<
AuthLoginRequested
>(
_onLoginRequested
);
/// 登录
on
<
AuthTokenExpiredEvent
>(
_onTokenExpired
);
/// token过期
on
<
AuthLogoutRequestedEvent
>(
_onLogoutRequested
);
/// 退出登录
on
<
AuthFetchUserInfo
>(
_onFetchUserInfo
);
/// 获取用户信息
}
Future
<
void
>
_onLoginRequested
(
...
...
@@ -80,4 +80,5 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
}
}
}
}
\ No newline at end of file
lib/views/home/index/index_view.dart
View file @
d5a8a7d0
...
...
@@ -157,7 +157,7 @@ class _HomeViewState extends State<HomeView> with AutoRouteAwareStateMixin<HomeV
voltageAlarmLocation:
location
,
voltageValue:
DealUtils
.
formatVoltage
(
alert
.
voltage
),
alertContent:
alert
.
alertContent
.
isNotEmpty
?
'
(
${alert.alertContent}
)
'
:
''
,
'
${alert.alertContent}
·
'
:
''
,
voltageWaitTime:
alert
.
waitingDurationDesc
,
voltageAlarmLevel:
alert
.
alertLevelText
,
alertCategory:
alert
.
alertCategory
,
...
...
lib/views/home/index/widget/voltage_operate_block.dart
View file @
d5a8a7d0
...
...
@@ -100,7 +100,7 @@ class VoltageOperateBlock extends StatelessWidget {
width:
double
.
infinity
,
margin:
EdgeInsets
.
only
(
left:
80
.
w
,
bottom:
20
.
h
),
child:
Text
(
'
电压
$voltageValue
$alertContent
·
$voltageWaitTime
'
,
'
$alertContent
$voltageWaitTime
'
,
style:
TextStyle
(
fontSize:
24
.
sp
,
color:
const
Color
.
fromRGBO
(
100
,
116
,
139
,
1.0
),
...
...
lib/views/login/cubit/login_cubit.dart
View file @
d5a8a7d0
...
...
@@ -49,11 +49,7 @@ class LoginCubit extends Cubit<LoginState> {
emit
(
state
.
copyWith
(
rememberPassword:
value
));
}
void
login
({
required
String
username
,
required
String
password
,
bool
rememberPassword
=
false
,
})
{
void
login
(
String
username
,
String
password
,
bool
rememberPassword
)
{
if
(
rememberPassword
)
{
storageService
.
saveRememberCredentials
(
username:
username
,
...
...
@@ -83,7 +79,7 @@ class LoginCubit extends Cubit<LoginState> {
}
void
forgotPwd
()
{
// TODO: 跳转到忘记密码页面
}
@override
...
...
lib/views/login/login_view.dart
View file @
d5a8a7d0
...
...
@@ -73,53 +73,46 @@ class LoginView extends StatelessWidget {
return
Column
(
children:
[
SizedBox
(
height:
150
.
h
),
SizedBox
(
height:
208
.
h
),
Container
(
margin:
EdgeInsets
.
only
(
bottom:
80
.
h
),
child:
Column
(
children:
[
Container
(
width:
160
.
w
,
height:
160
.
w
,
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
40
.
w
),
gradient:
const
LinearGradient
(
begin:
Alignment
.
topCenter
,
end:
Alignment
.
bottomCenter
,
colors:
[
Color
(
0xFF00C6FF
),
Color
(
0xFF0072FF
),
],
),
),
child:
ClipRRect
(
borderRadius:
BorderRadius
.
circular
(
40
.
w
),
child:
Image
.
asset
(
'lib/assets/login/logo@2x.png'
,
fit:
BoxFit
.
cover
,
),
),
),
SizedBox
(
height:
40
.
h
),
const
Text
(
'智能酒店管理系统'
,
style:
TextStyle
(
color:
Color
(
0xFF333333
),
fontSize:
24
,
fontWeight:
FontWeight
.
bold
,
),
),
SizedBox
(
height:
10
.
h
),
const
Text
(
'Intelligent Hotel Management System'
,
style:
TextStyle
(
color:
Color
(
0xFF999999
),
fontSize:
14
,
),
),
],
width:
160
.
w
,
height:
160
.
w
,
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
32
.
r
),
gradient:
const
LinearGradient
(
begin:
Alignment
.
topCenter
,
end:
Alignment
.
bottomCenter
,
colors:
[
Color
(
0xFF00C6FF
),
Color
(
0xFF0072FF
),
],
),
),
child:
ClipRRect
(
borderRadius:
BorderRadius
.
circular
(
32
.
r
),
child:
Image
.
asset
(
'lib/assets/login/logo@2x.png'
,
fit:
BoxFit
.
cover
,
),
),
),
SizedBox
(
height:
30
.
h
),
const
Text
(
'智能酒店管理系统'
,
style:
TextStyle
(
color:
Color
(
0xFF333333
),
fontSize:
24
,
fontWeight:
FontWeight
.
bold
,
),
),
const
Text
(
'Intelligent Hotel Management System'
,
style:
TextStyle
(
color:
Color
(
0xFF999999
),
fontSize:
14
,
),
),
SizedBox
(
height:
60
.
h
),
Form
(
key:
_frmGlobalKey
,
child:
Column
(
...
...
@@ -128,7 +121,6 @@ class LoginView extends StatelessWidget {
UsernameField
(
controller:
_txtUserNameController
,
),
SizedBox
(
height:
20
.
h
),
PasswordField
(
controller:
_txtPwdController
,
),
...
...
@@ -159,16 +151,11 @@ class LoginView extends StatelessWidget {
return
BtnLogin
(
isLoading:
authState
is
AuthLoading
,
onPressed:
()
{
if
(
_frmGlobalKey
.
currentState
!
.
validate
())
{
if
(
_frmGlobalKey
.
currentState
!.
validate
())
{
cubit
.
login
(
username:
_txtUserNameController
.
text
.
trim
(),
password:
_txtPwdController
.
text
.
trim
(),
rememberPassword:
state
.
rememberPassword
,
_txtUserNameController
.
text
.
trim
(),
_txtPwdController
.
text
.
trim
(),
state
.
rememberPassword
,
);
}
},
...
...
lib/views/login/widget/btn_login.dart
View file @
d5a8a7d0
...
...
@@ -15,10 +15,10 @@ class BtnLogin extends StatelessWidget {
Widget
build
(
BuildContext
context
)
{
return
Container
(
width:
double
.
infinity
,
height:
104
.
h
,
height:
83
.
h
,
decoration:
BoxDecoration
(
color:
const
Color
.
fromRGBO
(
73
,
149
,
234
,
1
),
borderRadius:
BorderRadius
.
circular
(
40
.
w
),
borderRadius:
BorderRadius
.
circular
(
50
.
r
),
),
child:
ElevatedButton
(
onPressed:
isLoading
?
null
:
onPressed
,
...
...
lib/views/login/widget/password_field.dart
View file @
d5a8a7d0
...
...
@@ -28,7 +28,7 @@ class _PasswordFieldState extends State<PasswordField> {
return
TextFormField
(
controller:
widget
.
controller
,
obscureText:
_obscureText
,
style:
TextStyle
(
color:
const
Color
(
0xFF333333
),
fontSize:
28
.
sp
),
style:
TextStyle
(
color:
const
Color
(
0xFF333333
),
fontSize:
32
.
sp
),
validator:
(
val
)
{
if
(
val
==
null
||
val
.
isEmpty
)
{
return
"密码不能为空"
;
...
...
@@ -38,7 +38,7 @@ class _PasswordFieldState extends State<PasswordField> {
decoration:
InputDecoration
(
filled:
true
,
hintText:
"password"
,
hintStyle:
TextStyle
(
color:
const
Color
(
0xFF999999
),
fontSize:
28
.
sp
),
hintStyle:
TextStyle
(
color:
const
Color
(
0xFF999999
),
fontSize:
32
.
sp
),
prefixIcon:
Icon
(
Icons
.
lock
,
color:
const
Color
(
0xFF999999
),
size:
40
.
w
),
prefixIconConstraints:
BoxConstraints
(
minWidth:
80
.
w
,
minHeight:
80
.
w
),
suffixIcon:
IconButton
(
...
...
@@ -52,8 +52,8 @@ class _PasswordFieldState extends State<PasswordField> {
suffixIconConstraints:
BoxConstraints
(
minWidth:
80
.
w
,
minHeight:
80
.
w
),
contentPadding:
EdgeInsets
.
symmetric
(
vertical:
20
.
h
,
horizontal:
24
.
w
),
helperText:
" "
,
helperStyle:
TextStyle
(
height:
1
,
fontSize:
2
4
.
sp
),
errorStyle:
TextStyle
(
color:
Colors
.
red
,
fontSize:
2
4
.
sp
,
height:
1
),
helperStyle:
TextStyle
(
height:
1
,
fontSize:
2
8
.
sp
),
errorStyle:
TextStyle
(
color:
Colors
.
red
,
fontSize:
2
8
.
sp
,
height:
1
),
errorMaxLines:
1
,
fillColor:
Colors
.
white
,
border:
OutlineInputBorder
(
...
...
lib/views/login/widget/remember_password_row.dart
View file @
d5a8a7d0
...
...
@@ -47,6 +47,7 @@ class RememberPasswordRow extends StatelessWidget {
style:
TextStyle
(
color:
const
Color
(
0xFF0A0D14
),
fontSize:
24
.
sp
,
fontWeight:
FontWeight
.
w600
,
),
),
],
...
...
lib/views/login/widget/username_field.dart
View file @
d5a8a7d0
...
...
@@ -13,7 +13,7 @@ class UsernameField extends StatelessWidget {
Widget
build
(
BuildContext
context
)
{
return
TextFormField
(
controller:
controller
,
style:
TextStyle
(
color:
const
Color
(
0xFF333333
),
fontSize:
28
.
sp
),
style:
TextStyle
(
color:
const
Color
(
0xFF333333
),
fontSize:
32
.
sp
),
validator:
(
val
)
{
if
(
val
==
null
||
val
.
isEmpty
)
{
return
"用户名不能为空哦"
;
...
...
@@ -23,13 +23,13 @@ class UsernameField extends StatelessWidget {
decoration:
InputDecoration
(
filled:
true
,
hintText:
"admin"
,
hintStyle:
TextStyle
(
color:
const
Color
(
0xFF999999
),
fontSize:
28
.
sp
),
hintStyle:
TextStyle
(
color:
const
Color
(
0xFF999999
),
fontSize:
32
.
sp
),
prefixIcon:
Icon
(
Icons
.
person
,
color:
const
Color
(
0xFF999999
),
size:
40
.
w
),
prefixIconConstraints:
BoxConstraints
(
minWidth:
80
.
w
,
minHeight:
80
.
w
),
contentPadding:
EdgeInsets
.
symmetric
(
vertical:
20
.
h
,
horizontal:
24
.
w
),
helperText:
" "
,
helperStyle:
TextStyle
(
height:
1
,
fontSize:
2
4
.
sp
),
errorStyle:
TextStyle
(
color:
Colors
.
red
,
fontSize:
2
4
.
sp
,
height:
1
),
helperStyle:
TextStyle
(
height:
1
,
fontSize:
2
8
.
sp
),
errorStyle:
TextStyle
(
color:
Colors
.
red
,
fontSize:
2
8
.
sp
,
height:
1
),
errorMaxLines:
1
,
fillColor:
Colors
.
white
,
border:
OutlineInputBorder
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment