|
@@ -42,38 +42,33 @@ export class AccountInfoComponent implements OnInit {
|
|
|
email: FormControl<string>; //电子邮箱
|
|
|
telephone: FormControl<string>; //办公电话
|
|
|
province: FormControl<string>; //省份
|
|
|
+ identity:FormControl<string>; //人员类型
|
|
|
companyType: FormControl<string>; //单位类型
|
|
|
- companyName: FormControl<string>; //单位名称
|
|
|
// idcard: FormControl<string>; //身份证号
|
|
|
departmentName: FormControl<string>; //所在部门
|
|
|
postName: FormControl<string>; //职务
|
|
|
- identityFile: FormControl<string>; //单位联系人认证文件
|
|
|
}> = this.fb.group({
|
|
|
name: ['', [Validators.required]],
|
|
|
phone: [''],
|
|
|
email: ['', [Validators.required]],
|
|
|
telephone: [''],
|
|
|
province: [''],
|
|
|
+ identity: ['', [Validators.required]],
|
|
|
companyType: ['', [Validators.required]],
|
|
|
- companyName: ['', [Validators.required]],
|
|
|
// idcard: ['', [Validators.required]],
|
|
|
departmentName: [''],
|
|
|
postName: [''],
|
|
|
- identityFile: [''],
|
|
|
});
|
|
|
- nonRequired: any = {
|
|
|
- job: '',
|
|
|
- };
|
|
|
+ identityFile: string = '' //单位联系人认证文件
|
|
|
+ companyName: string = '' //单位名称
|
|
|
|
|
|
- //省份
|
|
|
- provinces: Array<string> = provinces.options;
|
|
|
- unitTypes: Array<string> = [
|
|
|
- '全国出版单位',
|
|
|
- '教育部直属高校',
|
|
|
- '中央有关部门教育司',
|
|
|
- '省级教育行政部门',
|
|
|
- ];
|
|
|
+ provinces: Array<string> = provinces.options; //省份
|
|
|
+ unitTypes: Array<string> = [];
|
|
|
companys: Array<string> = [];
|
|
|
+ userType: Array<string> = [
|
|
|
+ '报送联系人','评审专家','高校联系人','个人'
|
|
|
+ ];
|
|
|
+
|
|
|
constructor(
|
|
|
public tbookSer: textbookServer,
|
|
|
private fb: NonNullableFormBuilder,
|
|
@@ -88,6 +83,7 @@ export class AccountInfoComponent implements OnInit {
|
|
|
let user = Parse.User.current();
|
|
|
if(!user?.id) history.back()
|
|
|
this.user = user;
|
|
|
+ await this.getUnitTypes()
|
|
|
if (user?.get('accountState') == '已认证') {
|
|
|
this.message.success('账号已认证,无需重复认证');
|
|
|
this.authServr.profileVerify(this.modal);
|
|
@@ -106,17 +102,32 @@ export class AccountInfoComponent implements OnInit {
|
|
|
email: [user?.get('email') || '', [Validators.required]],
|
|
|
telephone: [profile?.get('telephone') || ''],
|
|
|
province: [user?.get('province') || ''],
|
|
|
+ identity: [profile?.get('identity') || '', [Validators.required]],
|
|
|
companyType: [profile?.get('companyType') || '', [Validators.required]],
|
|
|
- companyName: [user?.get('companyName') || '', [Validators.required]],
|
|
|
departmentName: [user?.get('departmentName') || ''],
|
|
|
postName: [profile?.get('postName') || ''],
|
|
|
- identityFile: [profile?.get('identityFile') || ''],
|
|
|
});
|
|
|
+ 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(){
|
|
|
+ let query = new Parse.Query('Department');
|
|
|
+ query.equalTo('branch', undefined);
|
|
|
+ query.equalTo('parent', undefined);
|
|
|
+ query.notEqualTo('isDeleted',true);
|
|
|
+ query.select('name');
|
|
|
+ let r = await query.find()
|
|
|
+ r.forEach(item=>{
|
|
|
+ this.unitTypes.push(item.get('name'))
|
|
|
+ })
|
|
|
}
|
|
|
//根据所选单位类型获取对应单位
|
|
|
- async provinceChange(val?: string) {
|
|
|
- console.log(this.validateForm.value.companyType);
|
|
|
+ async provinceChange(val?: string, isChange?:boolean) {
|
|
|
console.log(val);
|
|
|
+ if(isChange) this.companyName = ''
|
|
|
this.companys = [];
|
|
|
let query = new Parse.Query('Department');
|
|
|
query.equalTo('branch', this.validateForm.value.companyType);
|
|
@@ -131,6 +142,10 @@ export class AccountInfoComponent implements OnInit {
|
|
|
submitForm(): void {
|
|
|
console.log(this.validateForm.value);
|
|
|
if (this.validateForm.valid) {
|
|
|
+ if(!this.companyName){
|
|
|
+ this.message.error('单位名称未选择或与单位类型不匹配,请重新选择');
|
|
|
+ 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,}))$/;
|
|
|
if (!String(this.validateForm.value.email).match(a)) {
|
|
@@ -155,12 +170,11 @@ export class AccountInfoComponent implements OnInit {
|
|
|
this.user?.set('email', params.email);
|
|
|
this.user?.set('phone', params.phone);
|
|
|
this.user?.set('province', params.province);
|
|
|
- this.user?.set('companyName', params.companyName);
|
|
|
+ this.user?.set('companyName', this.companyName);
|
|
|
!this.user?.get('accountState') && this.user?.set('accountState', '待认证');
|
|
|
this.user?.set('departmentName', params.departmentName);
|
|
|
await this.user?.save();
|
|
|
|
|
|
- console.log(params);
|
|
|
let query = new Parse.Query('Profile');
|
|
|
query.equalTo('user', Parse.User.current()?.id);
|
|
|
query.notEqualTo('isDeleted', true);
|
|
@@ -179,8 +193,8 @@ export class AccountInfoComponent implements OnInit {
|
|
|
profile?.set('companyType', params.companyType);
|
|
|
profile?.set('email', params.email);
|
|
|
// profile?.set('idcard', params.idcard);
|
|
|
- profile?.set('identity', '报送联系人');
|
|
|
- profile?.set('identityFile', params.identityFile);
|
|
|
+ profile?.set('identity', params.identity);
|
|
|
+ profile?.set('identityFile', this.identityFile);
|
|
|
profile?.set('postName', params.postName);
|
|
|
let res = await profile?.save();
|
|
|
this.modal.success({
|
|
@@ -193,7 +207,7 @@ export class AccountInfoComponent implements OnInit {
|
|
|
upload(e:any){
|
|
|
console.log(e);
|
|
|
let file = e[0]
|
|
|
- this.validateForm.value.identityFile = file
|
|
|
+ this.identityFile = file
|
|
|
}
|
|
|
//验证手机号或邮箱是否注册
|
|
|
async authUser(): Promise<boolean> {
|