You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.0 KiB
40 lines
1.0 KiB
import { Component, OnInit } from '@angular/core'; |
|
import { HttpClient } from '@angular/common/http'; |
|
import { Router } from '@angular/router'; |
|
import { NzMessageService } from 'ng-zorro-antd/message'; |
|
@Component({ |
|
selector: 'app-register', |
|
templateUrl: './register.component.html', |
|
styleUrls: ['./register.component.scss'] |
|
}) |
|
export class RegisterComponent implements OnInit { |
|
|
|
constructor(private http: HttpClient, private router: Router, private message: NzMessageService) { } |
|
|
|
ngOnInit() { } |
|
errmsg: any; //错误信息 |
|
|
|
//提交注册表单 |
|
onSubmit(e) { |
|
this.http.post('/api/CompanyAccount/SignUp', { |
|
companyName: e.companyName, |
|
name: e.name, |
|
password: e.password, |
|
phone: String(e.phone), |
|
usci: e.usci |
|
}).subscribe(data => { |
|
this.message.create('success', `注册成功,请登录!`); |
|
this.router.navigate(['/login']) |
|
}, (err) => { |
|
this.errmsg = err |
|
}) |
|
} |
|
|
|
//跳转登陆页面 |
|
toLogin() { |
|
this.router.navigate(['/login']) |
|
} |
|
|
|
|
|
|
|
}
|
|
|