Browse Source

[完善]修改注册时密码正则并去掉电话正则;保存单位时去掉电话正则

master
邵佳豪 4 years ago
parent
commit
4295a866b7
  1. 50
      src/app/pages/register/register.component.html
  2. 28
      src/app/pages/register/register.component.ts
  3. 6
      src/app/ui/basicinfo/basicinfo.component.html
  4. 2193
      src/app/ui/basicinfo/basicinfo.component.ts
  5. 2
      src/styles.scss

50
src/app/pages/register/register.component.html

@ -8,19 +8,21 @@
<form (ngSubmit)="onSubmit(form.value)" #form="ngForm" class="example-container">
<div class="input">
<label class="position"><mat-icon>group</mat-icon></label>
<label class="position">
<mat-icon>group</mat-icon>
</label>
<mat-form-field>
<input matInput id="companyName" name="companyName"
required ngModel placeholder="请输入单位名称">
<input matInput id="companyName" name="companyName" required ngModel placeholder="请输入单位名称">
</mat-form-field>
</div>
<div class="input">
<label class="position"><mat-icon>dns</mat-icon></label>
<label class="position">
<mat-icon>dns</mat-icon>
</label>
<mat-form-field>
<input matInput id="usci" name="usci" #usci="ngModel"
pattern="^[0-9A-HJ-NP-RTUW-Y]{2}\d{6}[0-9A-HJ-NP-RTUW-Y]{10}$"
ngModel placeholder="请输入统一社会信用代码">
pattern="^[0-9A-HJ-NP-RTUW-Y]{2}\d{6}[0-9A-HJ-NP-RTUW-Y]{10}$" ngModel placeholder="请输入统一社会信用代码">
</mat-form-field>
</div>
<div *ngIf="usci.invalid && (usci.dirty || usci.touched)" class="alert-danger">
@ -30,24 +32,27 @@
</div>
<div class="input">
<label class="position"><mat-icon>phone</mat-icon></label>
<label class="position">
<mat-icon>phone</mat-icon>
</label>
<mat-form-field>
<input matInput id="phone" name="phone" #tel="ngModel"
required pattern="^^(?:\+?86)?1(?:3\d{3}|5[^4\D]\d{2}|8\d{3}|7(?:[35-8]\d{2}|4(?:0\d|1[0-2]|9\d))|9[0135-9]\d{2}|66\d{2})\d{6}$"
ngModel placeholder="请输入联系电话">
<input matInput type="number" id="phone" name="phone" #tel="ngModel" required ngModel
placeholder="请输入联系电话">
</mat-form-field>
</div>
<div *ngIf="tel.invalid && (tel.dirty || tel.touched)" class="alert-danger">
<!-- <div *ngIf="tel.invalid && (tel.dirty || tel.touched)" class="alert-danger">
<div *ngIf="tel.errors.pattern">
电话号码格式为11位数字
</div>
</div>
</div> -->
<div class="input">
<label class="position"><mat-icon>account_box</mat-icon></label>
<label class="position">
<mat-icon>account_box</mat-icon>
</label>
<mat-form-field>
<input matInput id="name" name="name" #name="ngModel" pattern="^[a-zA-Z][a-zA-Z0-9_]{4,19}$"
required ngModel placeholder="请输入账号">
<input matInput id="name" name="name" #name="ngModel" pattern="^[a-zA-Z][a-zA-Z0-9_]{4,19}$" required
ngModel placeholder="请输入账号">
</mat-form-field>
</div>
<div *ngIf="name.invalid && (name.dirty || name.touched)" class="alert-danger">
@ -57,11 +62,13 @@
</div>
<div class="input">
<label class="position"><mat-icon>lock</mat-icon></label>
<label class="position">
<mat-icon>lock</mat-icon>
</label>
<mat-form-field>
<input matInput id="password" name="password" type='password' #password="ngModel"
required pattern="^(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.+[\!\@\#\$\%\^\&\*\(\)\-\=\\\`\_\+\|\~\[\]\{\}\;\'\:\,\.\/\<\>\?])[A-Za-z0-9\!\@\#\$\%\^\&\*\(\)\-\=\\\`\_\+\|\~\[\]\{\}\;\'\:\,\.\/\<\>\?]{8,32}$"
ngModel placeholder="请输入密码">
<input matInput id="password" name="password" type='password' #password="ngModel" required
pattern="^(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.+[\!\@\#\$\%\^\&\*\(\)\-\=\\\`\_\+\|\~\[\]\{\}\;\'\:\,\.\/\<\>\?])[A-Za-z0-9\!\@\#\$\%\^\&\*\(\)\-\=\\\`\_\+\|\~\[\]\{\}\;\'\:\,\.\/\<\>\?]{8,32}$"
ngModel placeholder="请输入密码">
</mat-form-field>
</div>
<div *ngIf="password.invalid && (password.dirty || password.touched)" class="alert-danger">
@ -78,7 +85,8 @@
<a href="javascript:void(0);" style="margin-left: 135px;" class="forget">
注册失败?
<div class="contactUs">
<label style="font-size: 14px; text-align: center; width: 100%; display: block; color: #fff;">安信科创QQ号</label>
<label
style="font-size: 14px; text-align: center; width: 100%; display: block; color: #fff;">安信科创QQ号</label>
<img src="../../../assets/images/AnXinQQ.jpg">
</div>
</a>
@ -89,6 +97,6 @@
</div>
</div>
</div>
</div>

28
src/app/pages/register/register.component.ts

@ -10,33 +10,33 @@ import { MatSnackBar } from '@angular/material/snack-bar';
})
export class RegisterComponent implements OnInit {
constructor(private http:HttpClient,private router:Router,private route:ActivatedRoute,public snackBar: MatSnackBar) { }
constructor(private http: HttpClient, private router: Router, private route: ActivatedRoute, public snackBar: MatSnackBar) { }
ngOnInit() { }
errmsg: any; //错误信息
ngOnInit() {}
errmsg:any; //错误信息
//提交注册表单
onSubmit(e){
this.http.post('/api/CompanyAccount/SignUp',{
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=>{
name: e.name,
password: e.password,
phone: String(e.phone),
usci: e.usci
}).subscribe(data => {
this.snackBar.open('注册成功,请登录!', '确定', {
duration: 3000
});
this.router.navigate(['/login'])
},(err)=>{
}, (err) => {
this.errmsg = err
})
}
//跳转登陆页面
toLogin () {
toLogin() {
this.router.navigate(['/login'])
}
}

6
src/app/ui/basicinfo/basicinfo.component.html

@ -10,7 +10,7 @@
<div class="topbox">
<form (ngSubmit)="onSubmit(form.value,form.invalid,form)" #form="ngForm" class="example-container">
<div class="mainbox" >
<div class="mainleft" style="display: none;">
<div class="mainleft">
<div class="inputbox" >
<span style="color: red;">*</span>
<span>统一社会信用代码:</span>
@ -51,8 +51,8 @@
<span style="color: red;">*</span>
<span>联系电话:</span>
<mat-form-field>
<input matInput id="linkphone" name="linkphone" type='text' #linkphone="ngModel"
required pattern="^(?:\+?86)?1(?:3\d{3}|5[^4\D]\d{2}|8\d{3}|7(?:[35-8]\d{2}|4(?:0\d|1[0-2]|9\d))|9[0135-9]\d{2}|66\d{2})\d{6}$"
<input matInput id="linkphone" name="linkphone" type='number' #linkphone="ngModel"
required
[(ngModel)]="unitinfo.phone"
(focus)="closeorganizationbox()"
>

2193
src/app/ui/basicinfo/basicinfo.component.ts

File diff suppressed because it is too large Load Diff

2
src/styles.scss

@ -124,7 +124,7 @@ table td.mat-footer-cell:last-of-type {
#setPosition {
.custom-content-marker {
position: relative;
border: 1px solid red;
// border: 1px solid red;
width: 68px;
height: 68px;
overflow: hidden;

Loading…
Cancel
Save