-
用户信息采集平台
+
数据采集管理平台
From 383d65337b5eddfdd90c361c9ac737c396adb2be Mon Sep 17 00:00:00 2001
From: cpf <1105965053@qq.com>
Date: Sun, 8 Mar 2020 15:53:16 +0800
Subject: [PATCH 2/2] =?UTF-8?q?[=E5=AE=8C=E5=96=84]=E9=87=87=E9=9B=86?=
=?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=B9=B3=E5=8F=B0=E7=99=BB=E5=BD=95,?=
=?UTF-8?q?=E7=99=BB=E5=87=BA,=E6=B3=A8=E5=86=8C,=E4=BF=AE=E6=94=B9?=
=?UTF-8?q?=E5=AF=86=E7=A0=81,=E8=8E=B7=E5=8F=96=E4=BF=AE=E6=94=B9?=
=?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=BF=A1=E6=81=AF,=E5=88=B7=E6=96=B0token?=
=?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=AE=8C=E5=96=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/app/app.component.ts | 37 +----
src/app/http-interceptors/base-interceptor.ts | 12 +-
.../http-interceptors/cache-token.service.ts | 8 +-
src/app/pages/login/login.component.html | 67 ++++----
src/app/pages/login/login.component.scss | 146 +++++++-----------
src/app/pages/login/login.component.ts | 52 +++----
.../pages/register/register.component.html | 129 ++++++++--------
.../pages/register/register.component.scss | 128 +++++++--------
src/app/pages/register/register.component.ts | 39 ++++-
src/app/tabbar/tabbar.component.html | 4 +-
src/app/tabbar/tabbar.component.ts | 23 ++-
.../changepassword.component.ts | 2 +-
src/app/ui/ui-routing.module.ts | 1 +
.../ui/userdata/edituserdata.component.html | 51 ++++--
src/app/ui/userdata/userdata.component.html | 34 ++--
src/app/ui/userdata/userdata.component.scss | 32 ++--
src/app/ui/userdata/userdata.component.ts | 116 +++++++-------
src/index.html | 2 +-
18 files changed, 440 insertions(+), 443 deletions(-)
diff --git a/src/app/app.component.ts b/src/app/app.component.ts
index d12bf0c..801fb2e 100644
--- a/src/app/app.component.ts
+++ b/src/app/app.component.ts
@@ -3,44 +3,25 @@ import { HttpClient } from '@angular/common/http'
import { Data } from './interface'
import { Router,ActivatedRoute } from '@angular/router'
import {CacheTokenService} from './http-interceptors/cache-token.service'//引入服务
+
+
+
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent {
- title = '数字化预案编制管理平台';
+ title = '数据采集管理平台';
constructor(private http:HttpClient,private router:Router,public token:CacheTokenService) { }
- ngOnInit(): void {
- var isnologin = localStorage.getItem("isnologin")
- //七天免登录
- if(isnologin){
- var token = localStorage.getItem("token");
- var refreshToken = localStorage.getItem("refreshToken");
- this.http.post(
- '/api/Account/RefreshToken',
- {
- token: token,
- refreshToken: refreshToken
- }
- ).subscribe(
- (data: Data) => {
- sessionStorage.setItem("token",data.token);
- sessionStorage.setItem("refreshToken",data.refreshToken);
- this.token.getmenus()
- this.token.startUp()
- this.router.navigate(['/ui/person'])
- console.log('已自动登录')
- }
- )
- }else{
+ ngOnInit(): void {
var token = sessionStorage.getItem("token");
var refreshToken = sessionStorage.getItem("refreshToken");
if(token && refreshToken) {
this.http.post(
- '/api/Account/RefreshToken',
+ '/api/CompanyAccount/RefreshToken',
{
token: token,
refreshToken: refreshToken
@@ -49,15 +30,13 @@ export class AppComponent {
(data: Data) => {
sessionStorage.setItem("token",data.token);
sessionStorage.setItem("refreshToken",data.refreshToken);
- this.token.getmenus()
this.token.startUp()
console.log('已重启定时器')
}
- )
- }
+ )
}
-
}
+
}
diff --git a/src/app/http-interceptors/base-interceptor.ts b/src/app/http-interceptors/base-interceptor.ts
index 9515a59..91bb81f 100644
--- a/src/app/http-interceptors/base-interceptor.ts
+++ b/src/app/http-interceptors/base-interceptor.ts
@@ -8,6 +8,7 @@ import { catchError, retry } from 'rxjs/operators';
import { Router,ActivatedRoute } from '@angular/router'
import {CacheTokenService} from './cache-token.service'
+import { MatSnackBar } from '@angular/material/snack-bar';
//baseurl
// const baseurl = 'http://39.106.78.171:8008';
@@ -15,7 +16,8 @@ import {CacheTokenService} from './cache-token.service'
@Injectable()
export class BaseInterceptor implements HttpInterceptor {
- constructor(private http:HttpClient,private router:Router,private route:ActivatedRoute,public token:CacheTokenService) {}
+ constructor(private http:HttpClient,private router:Router,private route:ActivatedRoute,public token:CacheTokenService,
+ public snackBar: MatSnackBar) {}
intercept(req, next: HttpHandler) {
@@ -47,11 +49,15 @@ export class BaseInterceptor implements HttpInterceptor {
this.token.delete()
sessionStorage.clear()
window.localStorage.clear()
- alert('用户认证信息过期,请重新登录')
+ this.snackBar.open('用户认证信息过期,请重新登录', '确定', {
+ duration: 3000
+ });
this.router.navigate(['/login'])
}
if (error.status === 403) {
- alert('对不起,您无此权限')
+ this.snackBar.open('对不起,您无此权限!', '确定', {
+ duration: 3000
+ });
}
if (error.error instanceof ErrorEvent) {
diff --git a/src/app/http-interceptors/cache-token.service.ts b/src/app/http-interceptors/cache-token.service.ts
index 938dee8..cf2b151 100644
--- a/src/app/http-interceptors/cache-token.service.ts
+++ b/src/app/http-interceptors/cache-token.service.ts
@@ -15,13 +15,12 @@ export class CacheTokenService {
startUp = ():void=>{
// this.getmenus();
this.timer = window.setInterval(
-
()=>{
window.clearInterval(this.settime)
var token = sessionStorage.getItem("token");
var refreshToken = sessionStorage.getItem("refreshToken");
this.http.post(
- '/api/Account/RefreshToken',
+ '/api/CompanyAccount/RefreshToken',
{
token: token,
refreshToken: refreshToken
@@ -36,6 +35,7 @@ export class CacheTokenService {
}
,18*60*1000)
}
+
organization = false;//组织机构管理
un = false;//单位类型管理
unit = false;//单位类型
@@ -94,14 +94,12 @@ export class CacheTokenService {
this.matlibrary = true
}
});
- // console.log(777,this.user,this.organization,this.power)
})
}
-
-
+
//删除定时器
delete = ():void=> {
diff --git a/src/app/pages/login/login.component.html b/src/app/pages/login/login.component.html
index bd480ac..bd3de21 100644
--- a/src/app/pages/login/login.component.html
+++ b/src/app/pages/login/login.component.html
@@ -1,51 +1,42 @@
-
+
-
-
-
-
-
-
-
-
-
-
+
diff --git a/src/app/pages/login/login.component.scss b/src/app/pages/login/login.component.scss
index 6fbf2af..f04ec7d 100644
--- a/src/app/pages/login/login.component.scss
+++ b/src/app/pages/login/login.component.scss
@@ -1,115 +1,73 @@
-
.login {
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;
- }
-
- .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;
- }
- }
-
- .card{
- width: 460px;
- height: 100%;
- background-color: #fff;
- position: absolute;
- right: 0;
- }
-
}
-
-.example-container {
- display: flex;
- flex-direction: column;
+.loginBox {
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;
-}
-
-.applyfor {
- font-size: 16px;
- a {
- color: #039be5;
- }
+ height: 100%;
+ background-color: #000;
+ background: rgba(0,0,0,0.5);/*盒子背景透明*/
+ display: flex;
+ /*!*flex-direction: column;*!可写可不写*/
+ justify-content: center;
+ align-items: center;
}
-.website {
- font-size: 14px;
+.card {
+ width: 500px;
+ height: 355px;
+ border-radius: 10px;
+ padding-top: 25px;
+ background-color: hsla(0,0%,100%,.8);
text-align: center;
- margin-top: 60px;
-
-}
-.alert-danger {
- font-size: 14px;
- color: red;
+ box-shadow:0px 0px 10px 5px #333;
}
.cardheader{
+ margin-bottom: 10px;
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;
}
-.mat-input-element {
+
+.input {
+ margin: 15px auto;
position: relative;
}
-.mat-card .example-container .icon {
- width: 24px;
- color: #666;
- font-size: 24px;
- position: absolute;
- top:36px;
- left: 15px;
+.mat-form-field {
+ width: 300px;
}
-.mat-card .example-container .icon2 {
- width: 24px;
- color: #666;
- font-size: 24px;
+.position {
+ margin-top: 5px;
position: absolute;
- top:100px;
- left: 15px;
+ top: 15px;
+ left: 75px;
}
-a {
+
+.alert-danger {
+ text-align-last: left;
+ margin-left: 100px;
font-size: 14px;
- color: #0066FF;
- margin-left: 250px;
+ color: red;
+}
+.register {
+ text-align: left;
+ a {
+ font-size: 14px;
+ color: #0066FF;
+ }
+ :first-child {
+ margin-left: 100px;
+ }
+ :last-child {
+ margin-left: 180px;
+ }
+}
+.loginbtn {
+ margin-top: 25px;
+ height: 30px;
+ line-height: 30px;
+ width: 280px;
+ background-color:#039be5;
+ border-radius: 15px;
+ color: #fff;
}
\ 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 a924ae3..0b5c6fe 100644
--- a/src/app/pages/login/login.component.ts
+++ b/src/app/pages/login/login.component.ts
@@ -2,9 +2,11 @@ import { Component, OnInit } from '@angular/core';
import { HttpClient } from '@angular/common/http'
import { Data } from '../../interface'
import { Router,ActivatedRoute } from '@angular/router'
-
import {CacheTokenService} from '../../http-interceptors/cache-token.service'//引入服务
import { MatSnackBar } from '@angular/material/snack-bar';
+
+
+
@Component({
selector: 'app-login',
templateUrl: './login.component.html',
@@ -13,54 +15,44 @@ 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) { }
- ngOnInit() {
+ ngOnInit() {}
- }
- errmsg :string = ''
+ errmsg :string = ''; //错误信息
+
+ //提交登录表单
onSubmit(e){
- this.http.post(
- '/api/Account/SignIn',
- {
+ this.http.post('/api/CompanyAccount/SignIn',{
name: e.name,
- password: e.password
- }
- ).subscribe(
-
+ password: e.password}).subscribe(
(data: Data) =>
- {
+ {
sessionStorage.setItem("token",data.token);
sessionStorage.setItem("refreshToken",data.refreshToken);
- this.router.navigate(['/datacollection/userdata'])
-
-
- if(e.notlogin){
- console.log("true")
- localStorage.setItem("isnologin","true")
- localStorage.setItem("token",data.token)
- localStorage.setItem("refreshToken",data.refreshToken)
- }else{
- console.log("false")
- }
+ this.router.navigate(['/datacollection/basicinfo'])
//调用服务中的function刷新token
this.token.startUp()
- //调用服务中的function获取菜单
- this.token.getmenus()
},
(err) =>
{this.errmsg = err}
)
}
- //打开弹窗
+ //跳转注册页面
+ toRegister () {
+ this.router.navigate(['/register'])
+ }
+
+ //打开忘记密码弹窗
open () {
- this.snackBar.open('请联系管理员', '确定', {
+ this.snackBar.open('请联系管理员: 1391111111', '确定', {
duration: 3000
});
}
-
-
+
+
}
diff --git a/src/app/pages/register/register.component.html b/src/app/pages/register/register.component.html
index 4439983..cb2d4b1 100644
--- a/src/app/pages/register/register.component.html
+++ b/src/app/pages/register/register.component.html
@@ -1,80 +1,87 @@
-
+
-
-
北京安信科创有限公司
-
北京安信科创软件有限公司作为中国应急服务领跑者,于2006年进入消防救援领域,是一家专注于应急领域仿真培训演练与应急数据预判领域的软件服务供应商。安信主要利用大数据与虚拟现实技术实现对消防、公安、机场相关安防人员与企业安全监管人员的仿真培训与考核,致力于为我国应急产业的发展构建更美好的未来。目前,安信的业务遍布全国20多个省份和地区,服务全国将近四分之一以上的人口
-
-
-
-
-
请同意不扩散核武器条约条约
+
+ {{errmsg}}
+
+
-
+
-
-
-
-
WEBSITE BY AnXin
-
© 2020. All RIGHT RESERVED.
-
-
-
+
diff --git a/src/app/pages/register/register.component.scss b/src/app/pages/register/register.component.scss
index 5212d70..a37144b 100644
--- a/src/app/pages/register/register.component.scss
+++ b/src/app/pages/register/register.component.scss
@@ -2,87 +2,71 @@
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);/*盒子背景透明*/
- // opacity: 0.5;
- position: relative;
- }
-
- .intro {
- width: 650px;
- // height: 350px;
- position: fixed;
- top:35%;
- left: 15%;
- p {
- font-size: 36px;
- color:white;
- margin-bottom: 35px;
- }
- span {
- font-size: 16px;
- color:white;
- opacity: 0.5;
- }
- }
-
- .card{
- width: 460px;
- height: 100%;
- padding-left: 20px;
- background-color: #fff;
- position: absolute;
- right: 0;
- p {
- width: 100%;
- margin: 18px 0;
- }
- .cardheader{
- font-size: 26px;
- font-weight: 500;
- }
-
- }
-
}
-
-.example-container {
+.loginBox {
+ width: 100%;
+ height: 100%;
+ background-color: #000;
+ background: rgba(0,0,0,0.5);/*盒子背景透明*/
display: flex;
- flex-direction: column;
+ /*!*flex-direction: column;*!可写可不写*/
+ justify-content: center;
+ align-items: center;
}
-.example-container > * {
- width: 100%;
-}
-.loginbtn {
- margin-top: 18px;
- height: 35px;
- background-color:#039be5;
- border-radius: 15px;
- color: #fff;;
+.card {
+ width: 500px;
+ border-radius: 10px;
+ padding-top: 25px;
+ background-color: hsla(0,0%,100%,.8);
+ text-align: center;
+ box-shadow:0px 0px 10px 5px #333;
}
-.mat-card {
- box-shadow: 0 0 0;
- margin-top: 70px;
+.cardheader{
+ margin-bottom: 10px;
+ font-size: 26px;
+ font-weight: 500;
}
-.applyfor {
- font-size: 16px;
- a {
- color: #039be5;
- }
+.input {
+ margin: 0 auto;
+ position: relative;
}
-
-.website {
- font-size: 14px;
- text-align: center;
- margin-top: 50px;
+.mat-form-field {
+ width: 300px;
}
+.position {
+ margin-top: 5px;
+ position: absolute;
+ top: 15px;
+ left: 75px;
+}
+
.alert-danger {
- font-size: 14px;
+ margin-bottom: 5px;
+ text-align: left;
+ padding-left: 100px;
+ font-size: 12px;
color: red;
+}
+.register {
+ padding-left: 100px;
+ text-align: left;
+ a {
+ font-size: 14px;
+ color: #0066FF;
+ }
+ :last-child {
+ margin-left: 135px;
+ }
+}
+.loginbtn {
+ margin-top: 25px;
+ margin-bottom: 25px;
+ height: 30px;
+ line-height: 30px;
+ width: 280px;
+ background-color:#039be5;
+ border-radius: 15px;
+ color: #fff;
}
\ No newline at end of file
diff --git a/src/app/pages/register/register.component.ts b/src/app/pages/register/register.component.ts
index 55013f6..d77625a 100644
--- a/src/app/pages/register/register.component.ts
+++ b/src/app/pages/register/register.component.ts
@@ -1,4 +1,7 @@
import { Component, OnInit } from '@angular/core';
+import { HttpClient } from '@angular/common/http';
+import { Router, ActivatedRoute } from '@angular/router';
+import { MatSnackBar } from '@angular/material/snack-bar';
@Component({
selector: 'app-register',
@@ -7,13 +10,41 @@ import { Component, OnInit } from '@angular/core';
})
export class RegisterComponent implements OnInit {
- constructor() { }
+ constructor(private http:HttpClient,private router:Router,private route:ActivatedRoute,public snackBar: MatSnackBar) { }
- ngOnInit() {
+ ngOnInit() {}
+ errmsg:any; //错误信息
+
+ //提交注册表单
+ onSubmit(e){
+ this.http.post('/api/CompanyAccount/SignUp',{
+ companyName: e.companyName,
+ name:e.name,
+ password:e.password,
+ phone:e.phone,
+ usci:e.usci
+ }).subscribe(data=>{
+ this.snackBar.open('注册成功,请登录!', '确定', {
+ duration: 3000
+ });
+ this.router.navigate(['/login'])
+ },(err)=>{
+ this.errmsg = err
+ })
}
- onSubmit(e){
- console.log(e)
+ //跳转登陆页面
+ toLogin () {
+ this.router.navigate(['/login'])
+ }
+
+ //打开注册失败弹窗
+ open () {
+ this.snackBar.open('若信息输入正确无法注册,请联系管理员: 13911111111', '确定', {
+ duration: 3000
+ });
}
+
+
}
diff --git a/src/app/tabbar/tabbar.component.html b/src/app/tabbar/tabbar.component.html
index c444963..f83003f 100644
--- a/src/app/tabbar/tabbar.component.html
+++ b/src/app/tabbar/tabbar.component.html
@@ -1,6 +1,6 @@
- 用户信息采集平台
+ {{companyName}}
-