|
@@ -42,7 +42,7 @@ export class AccountInfoComponent implements OnInit {
|
|
|
email: FormControl<string>; //电子邮箱
|
|
|
telephone: FormControl<string>; //办公电话
|
|
|
province: FormControl<string>; //省份
|
|
|
- identity:FormControl<string>; //人员类型
|
|
|
+ identity: FormControl<string>; //人员类型
|
|
|
companyType: FormControl<string>; //单位类型
|
|
|
// idcard: FormControl<string>; //身份证号
|
|
|
departmentName: FormControl<string>; //所在部门
|
|
@@ -59,15 +59,13 @@ export class AccountInfoComponent implements OnInit {
|
|
|
departmentName: [''],
|
|
|
postName: [''],
|
|
|
});
|
|
|
- identityFile: string = '' //单位联系人认证文件
|
|
|
- companyName: string = '' //单位名称
|
|
|
+ identityFile: string = ''; //单位联系人认证文件
|
|
|
+ companyName: string = ''; //单位名称
|
|
|
|
|
|
- provinces: Array<string> = provinces.options; //省份
|
|
|
- unitTypes: Array<string> = [];
|
|
|
+ provinces: Array<string> = provinces.options; //省份
|
|
|
+ unitTypes: Array<any> = [];
|
|
|
companys: Array<string> = [];
|
|
|
- userType: Array<string> = [
|
|
|
- '报送联系人','评审专家','高校联系人','个人'
|
|
|
- ];
|
|
|
+ userType: Array<string> = ['报送联系人', '评审专家', '高校联系人', '个人'];
|
|
|
|
|
|
constructor(
|
|
|
public tbookSer: textbookServer,
|
|
@@ -81,9 +79,9 @@ export class AccountInfoComponent implements OnInit {
|
|
|
|
|
|
async ngOnInit() {
|
|
|
let user = Parse.User.current();
|
|
|
- if(!user?.id) history.back()
|
|
|
+ if (!user?.id) history.back();
|
|
|
this.user = user;
|
|
|
- await this.getUnitTypes()
|
|
|
+ await this.getUnitTypes();
|
|
|
if (user?.get('accountState') == '已认证') {
|
|
|
this.message.success('账号已认证,无需重复认证');
|
|
|
this.authServr.profileVerify(this.modal);
|
|
@@ -93,9 +91,9 @@ export class AccountInfoComponent implements OnInit {
|
|
|
this.router.navigate(['/user/register'], { replaceUrl: true });
|
|
|
return;
|
|
|
}
|
|
|
- let queryProfile = new Parse.Query('Profile')
|
|
|
- queryProfile.equalTo('user',user?.id)
|
|
|
- let profile = await queryProfile.first()
|
|
|
+ let queryProfile = new Parse.Query('Profile');
|
|
|
+ queryProfile.equalTo('user', user?.id);
|
|
|
+ let profile = await queryProfile.first();
|
|
|
this.validateForm = this.fb.group({
|
|
|
name: [user?.get('name') || '', [Validators.required]],
|
|
|
phone: [user?.get('phone') || ''],
|
|
@@ -107,32 +105,34 @@ export class AccountInfoComponent implements OnInit {
|
|
|
departmentName: [user?.get('departmentName') || ''],
|
|
|
postName: [profile?.get('postName') || ''],
|
|
|
});
|
|
|
- this.identityFile = profile?.get('identityFile') || ''
|
|
|
- this.companyName = user?.get('companyName') || ''
|
|
|
- this.provinceChange()
|
|
|
- console.log(this.companyName, this.identityFile);
|
|
|
- console.log(this.validateForm.value);
|
|
|
+ // this.identityFile = profile?.get('identityFile') || ''
|
|
|
+ this.companyName = user?.get('companyName') || '';
|
|
|
+ this.provinceChange();
|
|
|
+ // console.log(this.companyName, this.identityFile);
|
|
|
+ // console.log(this.validateForm.value);
|
|
|
}
|
|
|
- async getUnitTypes(){
|
|
|
+ async getUnitTypes() {
|
|
|
let query = new Parse.Query('Department');
|
|
|
query.equalTo('branch', undefined);
|
|
|
query.equalTo('parent', undefined);
|
|
|
- query.notEqualTo('isDeleted',true);
|
|
|
+ query.notEqualTo('isDeleted', true);
|
|
|
query.select('name');
|
|
|
- let r = await query.find()
|
|
|
- r.forEach(item=>{
|
|
|
- this.unitTypes.push(item.get('name'))
|
|
|
- })
|
|
|
+ let r = await query.find();
|
|
|
+ r.forEach((item) => {
|
|
|
+ this.unitTypes.push({ id: item.id, name: item.get('name') });
|
|
|
+ });
|
|
|
}
|
|
|
//根据所选单位类型获取对应单位
|
|
|
- async provinceChange(val?: string, isChange?:boolean) {
|
|
|
- console.log(val);
|
|
|
- if(isChange) this.companyName = ''
|
|
|
+ async provinceChange(val?: string, isChange?: boolean) {
|
|
|
+ // console.log(val);
|
|
|
+ if (isChange) this.companyName = '';
|
|
|
this.companys = [];
|
|
|
+ let parent = this.unitTypes.find(item=>item.name == this.validateForm.value.companyType)
|
|
|
let query = new Parse.Query('Department');
|
|
|
- query.equalTo('branch', this.validateForm.value.companyType);
|
|
|
- query.select('name','branch');
|
|
|
- query.limit(1000);
|
|
|
+ // query.equalTo('branch', this.validateForm.value.companyType);
|
|
|
+ query.equalTo('parent', parent.id);
|
|
|
+ query.select('name', 'branch');
|
|
|
+ query.limit(100);
|
|
|
val && query.contains('name', val);
|
|
|
let r = await query.find();
|
|
|
if (r.length > 0) {
|
|
@@ -141,10 +141,11 @@ export class AccountInfoComponent implements OnInit {
|
|
|
}
|
|
|
submitForm(): void {
|
|
|
console.log(this.validateForm.value);
|
|
|
+ console.log(this.companyName, this.identityFile);
|
|
|
if (this.validateForm.valid) {
|
|
|
- if(!this.companyName){
|
|
|
+ if (!this.companyName) {
|
|
|
this.message.error('单位名称未选择或与单位类型不匹配,请重新选择');
|
|
|
- return
|
|
|
+ return;
|
|
|
}
|
|
|
let a =
|
|
|
/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
|
@@ -152,6 +153,10 @@ export class AccountInfoComponent implements OnInit {
|
|
|
this.message.error('邮箱格式不正确');
|
|
|
return;
|
|
|
}
|
|
|
+ if (!this.identityFile) {
|
|
|
+ this.message.error('请上传单位联系人认证文件');
|
|
|
+ return;
|
|
|
+ }
|
|
|
let params = this.validateForm.value;
|
|
|
this.profileSave(params);
|
|
|
} else {
|
|
@@ -200,14 +205,13 @@ export class AccountInfoComponent implements OnInit {
|
|
|
this.modal.success({
|
|
|
nzTitle: '提交成功',
|
|
|
nzContent: '',
|
|
|
- nzOnOk: () =>
|
|
|
- this.router.navigate(['/user/login'], { replaceUrl: true }),
|
|
|
+ nzOnOk: () => this.router.navigate(['/user/login'], { replaceUrl: true }),
|
|
|
});
|
|
|
}
|
|
|
- upload(e:any){
|
|
|
+ upload(e: any) {
|
|
|
console.log(e);
|
|
|
- let file = e[0]
|
|
|
- this.identityFile = file
|
|
|
+ let file = e[0];
|
|
|
+ this.identityFile = file;
|
|
|
}
|
|
|
//验证手机号或邮箱是否注册
|
|
|
async authUser(): Promise<boolean> {
|