diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 0c32013..0ae24e9 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -11,13 +11,19 @@ import {AuthGuard} from './auth.guard' const routes: Routes = [ + {path:'',redirectTo:'login',pathMatch:'full'}, { - path:'', + path:'home', component:NavigationComponent, + canActivate: [AuthGuard],//守卫验证 children:[ {path:'',loadChildren:() => import('./ui/ui.module').then(m => m.UiModule)} ] }, + { + path:'login', + component:LoginComponent, + }, ]; diff --git a/src/app/app.component.ts b/src/app/app.component.ts index b829c19..2dfa9fd 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -28,12 +28,10 @@ export class AppComponent { }).subscribe((data:any) => { sessionStorage.setItem("token",data.token); sessionStorage.setItem("refreshToken",data.refreshToken); - this.isLogin.isLogin = true this.token.startUp() }) } else { sessionStorage.clear() - this.isLogin.isLogin = false this.token.delete() } diff --git a/src/app/http-interceptors/base-interceptor.ts b/src/app/http-interceptors/base-interceptor.ts index b1178fb..4f22d6a 100644 --- a/src/app/http-interceptors/base-interceptor.ts +++ b/src/app/http-interceptors/base-interceptor.ts @@ -46,7 +46,7 @@ export class BaseInterceptor implements HttpInterceptor { // 用户认证失败返回登录页 if (error.status === 401||error.status === 614) { sessionStorage.clear() - this.isLogin.isLogin = false + this.router.navigate(['/login']) const config = new MatSnackBarConfig(); config.verticalPosition = 'top'; config.duration = 3000 diff --git a/src/app/is-login.service.ts b/src/app/is-login.service.ts index 2b75113..fdeedf1 100644 --- a/src/app/is-login.service.ts +++ b/src/app/is-login.service.ts @@ -8,7 +8,7 @@ export class IsLoginService { constructor(private http: HttpClient) { } - isLogin:boolean = false; //登录状态 + isDownloading:boolean = false; //下载状态 downloadProgress:number = 0;//下载进度 diff --git a/src/app/navigation/navigation.component.html b/src/app/navigation/navigation.component.html index 9a84b68..b626d0d 100644 --- a/src/app/navigation/navigation.component.html +++ b/src/app/navigation/navigation.component.html @@ -23,7 +23,7 @@ (mouseleave)="liLeave(item)" >{{item.name}}

+ *ngIf="item.name != '法律法规' && item.name != '消防知识' && item.name != '装备车辆' && item.name != '设备设施'"> edit delete

diff --git a/src/app/navigation/navigation.component.scss b/src/app/navigation/navigation.component.scss index 1a550e2..5cb721d 100644 --- a/src/app/navigation/navigation.component.scss +++ b/src/app/navigation/navigation.component.scss @@ -219,4 +219,8 @@ mat-sidenav{ button{ margin: 0 5px; } +} +.example-sidenav-content{ + height: 100%; + overflow: hidden; } \ No newline at end of file diff --git a/src/app/pages/login/login.component.html b/src/app/pages/login/login.component.html index bd480ac..f983bb1 100644 --- a/src/app/pages/login/login.component.html +++ b/src/app/pages/login/login.component.html @@ -1,52 +1,32 @@ -
-
- -
-

数据采集管理平台

- -
- -
-
- - -

登录

-
- - +
+
+

指挥长 (员) 战术战法培训系统

+
- account_box - lock - - - - - - +
+ account_box + +
+ +
+ lock + +
+
+ +
+
{{errmsg}}
- - 忘记密码? - - + +
+
-
-

北京安信科创有限公司提供技术支持和维护

-
- - -
-
+
\ No newline at end of file diff --git a/src/app/pages/login/login.component.scss b/src/app/pages/login/login.component.scss index cf24354..87b642d 100644 --- a/src/app/pages/login/login.component.scss +++ b/src/app/pages/login/login.component.scss @@ -1,115 +1,88 @@ - -.login { +.content { width: 100%; height: 100%; - // background: url('../../../assets/images/bg_login.jpg'); - - .loginbox { - width: 100%; - height: 100%; - background-color: #000; - background: rgba(0,0,0,0.5);/*盒子背景透明*/ - position: relative; - } + max-height: 100%; + background: url('../../../assets//images/loginBackground.jpg'); + background-repeat:no-repeat; + background-size:100% 100%; + -moz-background-size:100% 100%; +} - .intro { - width: 35%; - position: fixed; - top:35%; - left: 15%; - p { - font-size: 36px; - color:white; - margin-bottom: 35px; - } - span { - font-size: 16px; - color:white; - opacity: 0.5; - } +.loginBox { + margin: 0 auto; + width: 40%; + text-align: center; + box-sizing: border-box; + padding: 8% 0; + .header { + font-size: 34px; + font-weight: 650; + font-family: 'NSimSun'; } - - .card{ - width: 460px; - height: 100%; - background-color: #fff; - position: absolute; - right: 0; + .center { + padding: 100px 0; + width: 50%; + box-sizing: border-box; + margin: 0 auto; } - } - -.example-container { - display: flex; - flex-direction: column; +.footer { width: 100%; -} -.loginbtn { - margin-top: 25px; - height: 35px; - background-color:#039be5; - border-radius: 15px; - color: #fff;; -} -.mat-card { - box-shadow: 0 0 0; - margin-top: 140px; + text-align: center; + position: fixed; + bottom: 35px; + color: #858688; + font-size: 14px; } -.applyfor { - font-size: 16px; - a { - color: #039be5; - } -} -.website { - font-size: 14px; - text-align: center; - margin-top: 60px; - + +// 表单内部样式 +.forget{ + margin: 30px auto; + label { + margin-left: 80%; + box-sizing: border-box; + font-size: 14px; + color: #2196f3; + cursor:pointer; + } } .alert-danger { + margin-bottom: 30px; + text-align: left; font-size: 14px; color: red; } -.cardheader{ - font-size: 26px; - font-weight: 500; - margin-top: 20px; -} -.mat-card { - margin-top: 10px; - padding-left: 20px; -} -.mat-form-field { - padding-left: 20px;; -} -.loginImg { - margin-top: 90px; - text-align: center; +.loginBtn { + width: 100%; } -.mat-input-element { +//input 框 + 字体图标 +.input { + width: 100%; + margin: 30px auto; position: relative; + input { + width: 90%; + border-radius: 5px; + border: 1px solid #999; + height: 36px; + padding-left: 30px; + } } -.mat-card .example-container .icon { +.icon { width: 24px; - color: #666; + color: #B5BBBC; font-size: 24px; position: absolute; - top:36px; - left: 15px; + top: 7px; + left: 8px; } -.mat-card .example-container .icon2 { +.icon2 { width: 24px; - color: #666; + color: #B5BBBC; font-size: 24px; position: absolute; - top:100px; - left: 15px; -} -a { - font-size: 14px; - color: #0066FF; - margin-left: 250px; + top: 7px; + left: 8px; } \ No newline at end of file diff --git a/src/app/pages/login/login.component.ts b/src/app/pages/login/login.component.ts index 8305988..169654e 100644 --- a/src/app/pages/login/login.component.ts +++ b/src/app/pages/login/login.component.ts @@ -1,10 +1,12 @@ import { Component, OnInit } from '@angular/core'; import { HttpClient } from '@angular/common/http' -import { Data } from '../../interface' import { Router,ActivatedRoute } from '@angular/router' - +import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; +import { IsLoginService } from '../../is-login.service'//引入服务 import {CacheTokenService} from '../../http-interceptors/cache-token.service'//引入服务 -import { MatSnackBar } from '@angular/material/snack-bar'; + + + @Component({ selector: 'app-login', templateUrl: './login.component.html', @@ -13,53 +15,38 @@ import { MatSnackBar } from '@angular/material/snack-bar'; }) export class LoginComponent implements OnInit { - constructor(private http:HttpClient,private router:Router,private route:ActivatedRoute,public token:CacheTokenService,public snackBar: MatSnackBar) { } + constructor(private http:HttpClient,private router:Router,private route:ActivatedRoute,public token:CacheTokenService,public snackBar: MatSnackBar,private isLogin:IsLoginService) { } ngOnInit() { } - errmsg :string = '' - onSubmit(e){ - this.http.post( - '/api/Account/SignIn', - { - name: e.name, - password: e.password - } - ).subscribe( - (data: Data) => - { - sessionStorage.setItem("token",data.token); - sessionStorage.setItem("refreshToken",data.refreshToken); - this.router.navigate(['/datacollection']) + errmsg :string = ''; //错误信息 - if(e.notlogin){ - console.log("true") - localStorage.setItem("isnologin","true") - localStorage.setItem("token",data.token) - localStorage.setItem("refreshToken",data.refreshToken) - }else{ - console.log("false") - } - //调用服务中的function刷新token - this.token.startUp() - //调用服务中的function获取菜单 - }, - (err) => - {this.errmsg = err} - ) + //登录 + onSubmit(e){ + this.http.post('/api/Account/SignIn',e).subscribe((data:any)=>{ + sessionStorage.setItem("token",data.token); + sessionStorage.setItem("refreshToken",data.refreshToken); + this.token.startUp(); //登陆成功启动定时器刷新token + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.router.navigate(['/home']) //登陆成功跳转页面 + this.snackBar.open('登陆成功','确定',config); + },(err) => {this.errmsg = err}) } - //打开弹窗 - open () { - this.snackBar.open('请联系管理员', '确定', { - duration: 3000 - }); + //忘记密码弹窗 + forget () { + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('如果您忘记了密码,请联系管理员重置密码!','确定',config); } - - + + } diff --git a/src/app/tabbar/tabbar.component.html b/src/app/tabbar/tabbar.component.html index 84d720c..2e288e2 100644 --- a/src/app/tabbar/tabbar.component.html +++ b/src/app/tabbar/tabbar.component.html @@ -4,13 +4,13 @@

指挥长(员)战术战法培训系统

- diff --git a/src/app/tabbar/tabbar.component.ts b/src/app/tabbar/tabbar.component.ts index d2b6dff..ba16b58 100644 --- a/src/app/tabbar/tabbar.component.ts +++ b/src/app/tabbar/tabbar.component.ts @@ -50,8 +50,8 @@ export class TabbarComponent implements OnInit { if(out) { this.http.post('/api/Account/SignOut',{}).subscribe(data=>{ sessionStorage.clear() - this.isLogin.isLogin = false this.token.delete() + this.router.navigate(['/login']) const config = new MatSnackBarConfig(); config.verticalPosition = 'top'; config.duration = 3000 diff --git a/src/app/ui/all-file/all-file.component.scss b/src/app/ui/all-file/all-file.component.scss index 9f5ac2a..3ab947c 100644 --- a/src/app/ui/all-file/all-file.component.scss +++ b/src/app/ui/all-file/all-file.component.scss @@ -174,6 +174,7 @@ } } .mainbox{ + overflow-y: auto; table{ td{ img{ diff --git a/src/app/ui/login/login.component.ts b/src/app/ui/login/login.component.ts index 328b91e..fc2690a 100644 --- a/src/app/ui/login/login.component.ts +++ b/src/app/ui/login/login.component.ts @@ -29,7 +29,6 @@ export class LoginComponent implements OnInit { this.http.post('/api/Account/SignIn',loginMsg).subscribe((data:any)=>{ sessionStorage.setItem("token",data.token); sessionStorage.setItem("refreshToken",data.refreshToken); - this.isLogin.isLogin = true; //登陆成功设置登录状态为true this.token.startUp(); //登陆成功启动定时器刷新token const config = new MatSnackBarConfig(); config.verticalPosition = 'top'; diff --git a/src/assets/images/loginBackground.jpg b/src/assets/images/loginBackground.jpg new file mode 100644 index 0000000..72a0a3c Binary files /dev/null and b/src/assets/images/loginBackground.jpg differ