|
@@ -48,12 +48,15 @@ export class PageUserComponent implements OnInit {
|
|
companyType: {
|
|
companyType: {
|
|
listOfFilter: [
|
|
listOfFilter: [
|
|
{ value: '教育部直属高校', text: '教育部直属高校' },
|
|
{ value: '教育部直属高校', text: '教育部直属高校' },
|
|
- { value: '中央有关部门(单位)教育司(局)', text: '中央有关部门(单位)教育司(局)' },
|
|
|
|
|
|
+ {
|
|
|
|
+ value: '中央有关部门(单位)教育司(局)',
|
|
|
|
+ text: '中央有关部门(单位)教育司(局)',
|
|
|
|
+ },
|
|
{ value: '省级教育行政部门', text: '省级教育行政部门' },
|
|
{ value: '省级教育行政部门', text: '省级教育行政部门' },
|
|
{ value: '出版单位', text: '出版单位' },
|
|
{ value: '出版单位', text: '出版单位' },
|
|
],
|
|
],
|
|
},
|
|
},
|
|
- }
|
|
|
|
|
|
+ };
|
|
// _User = _User;
|
|
// _User = _User;
|
|
// ProfileList = Profile;
|
|
// ProfileList = Profile;
|
|
// className: string | undefined;
|
|
// className: string | undefined;
|
|
@@ -107,9 +110,9 @@ export class PageUserComponent implements OnInit {
|
|
|
|
|
|
ngOnInit(): void {
|
|
ngOnInit(): void {
|
|
this.activeRoute.queryParamMap.subscribe(async (queryParams) => {
|
|
this.activeRoute.queryParamMap.subscribe(async (queryParams) => {
|
|
- console.log(queryParams)
|
|
|
|
- let page = queryParams.get("page");
|
|
|
|
- if(page){
|
|
|
|
|
|
+ console.log(queryParams);
|
|
|
|
+ let page = queryParams.get('page');
|
|
|
|
+ if (page) {
|
|
this.pageIndex = Number(page);
|
|
this.pageIndex = Number(page);
|
|
this.updateUrlPageIndex(Number(page));
|
|
this.updateUrlPageIndex(Number(page));
|
|
}
|
|
}
|
|
@@ -150,7 +153,9 @@ export class PageUserComponent implements OnInit {
|
|
},
|
|
},
|
|
};
|
|
};
|
|
if (this.tbookSer.profile.identity != '国家级管理员') {
|
|
if (this.tbookSer.profile.identity != '国家级管理员') {
|
|
- let childrens = await this.tbookSer.getChild(this.tbookSer.profile.user.department?.objectId)
|
|
|
|
|
|
+ let childrens = await this.tbookSer.getChild(
|
|
|
|
+ this.tbookSer.profile.user.department?.objectId
|
|
|
|
+ );
|
|
this.tbookSer.profile.user.department;
|
|
this.tbookSer.profile.user.department;
|
|
queryParams['where']['$or'][0]['user']['$inQuery']['where'][
|
|
queryParams['where']['$or'][0]['user']['$inQuery']['where'][
|
|
'department'
|
|
'department'
|
|
@@ -188,28 +193,31 @@ export class PageUserComponent implements OnInit {
|
|
this.getProfile();
|
|
this.getProfile();
|
|
}
|
|
}
|
|
/** 更新页码queryParams */
|
|
/** 更新页码queryParams */
|
|
- updateUrlPageIndex(page:number){
|
|
|
|
|
|
+ updateUrlPageIndex(page: number) {
|
|
let search = window.location.search;
|
|
let search = window.location.search;
|
|
- if(!search){
|
|
|
|
- search = `?page=${page}`
|
|
|
|
- }else{
|
|
|
|
- let pagestr = window.location.search?.replaceAll("?","").split("&").find(item=>item.indexOf("page=")>-1);
|
|
|
|
- if(pagestr){
|
|
|
|
- search = search.replaceAll(pagestr,`page=${page}`)
|
|
|
|
- }else{
|
|
|
|
- search = search + `?page=${page}`
|
|
|
|
|
|
+ if (!search) {
|
|
|
|
+ search = `?page=${page}`;
|
|
|
|
+ } else {
|
|
|
|
+ let pagestr = window.location.search
|
|
|
|
+ ?.replaceAll('?', '')
|
|
|
|
+ .split('&')
|
|
|
|
+ .find((item) => item.indexOf('page=') > -1);
|
|
|
|
+ if (pagestr) {
|
|
|
|
+ search = search.replaceAll(pagestr, `page=${page}`);
|
|
|
|
+ } else {
|
|
|
|
+ search = search + `?page=${page}`;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
let newHref = window.location.origin + window.location.pathname + search;
|
|
let newHref = window.location.origin + window.location.pathname + search;
|
|
- window.history.replaceState(null, "", newHref);
|
|
|
|
|
|
+ window.history.replaceState(null, '', newHref);
|
|
}
|
|
}
|
|
//筛选条件
|
|
//筛选条件
|
|
- onChangeFilter(data: any, type:string){
|
|
|
|
|
|
+ onChangeFilter(data: any, type: string) {
|
|
console.log(data);
|
|
console.log(data);
|
|
- this.filters[type].value = data
|
|
|
|
- this.profiles = []
|
|
|
|
- this.pageIndex = 1
|
|
|
|
- this.getProfile()
|
|
|
|
|
|
+ this.filters[type].value = data;
|
|
|
|
+ this.profiles = [];
|
|
|
|
+ this.pageIndex = 1;
|
|
|
|
+ this.getProfile();
|
|
}
|
|
}
|
|
createUser() {
|
|
createUser() {
|
|
this.route.navigate(['/nav-admin/manage/user/create']);
|
|
this.route.navigate(['/nav-admin/manage/user/create']);
|
|
@@ -261,18 +269,26 @@ export class PageUserComponent implements OnInit {
|
|
if (r?.id) {
|
|
if (r?.id) {
|
|
switch (type) {
|
|
switch (type) {
|
|
case '通过认证':
|
|
case '通过认证':
|
|
- if(!r?.get('department')?.id){
|
|
|
|
- this.message.warning('该用户暂未绑定所属单位')
|
|
|
|
- return
|
|
|
|
|
|
+ if (!r?.get('department')?.id) {
|
|
|
|
+ this.message.warning('该用户暂未绑定所属单位');
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
- if(data?.get('identity') == '工作联系人'){
|
|
|
|
- let auth = await this.tbookSer.updateProfileSubmitted(data?.id,'save',r?.get('department')?.id,this.message)
|
|
|
|
- if(!auth) return
|
|
|
|
|
|
+ if (data?.get('identity') == '工作联系人') {
|
|
|
|
+ let auth = await this.tbookSer.updateProfileSubmitted(
|
|
|
|
+ data?.id,
|
|
|
|
+ 'save',
|
|
|
|
+ r?.get('department')?.id,
|
|
|
|
+ this.message
|
|
|
|
+ );
|
|
|
|
+ if (!auth) return;
|
|
}
|
|
}
|
|
r?.set('accountState', '已认证');
|
|
r?.set('accountState', '已认证');
|
|
- Parse.Cloud.run('aliSmsSend',{
|
|
|
|
- "mobileList": [data?.get('user')?.get('phone')],"templateCode":"SMS_468870790","params":{},"signName":"普通高等教育教材网"
|
|
|
|
- })
|
|
|
|
|
|
+ Parse.Cloud.run('aliSmsSend', {
|
|
|
|
+ mobileList: [data?.get('user')?.get('phone')],
|
|
|
|
+ templateCode: 'SMS_468870790',
|
|
|
|
+ params: {},
|
|
|
|
+ signName: '普通高等教育教材网',
|
|
|
|
+ });
|
|
await r?.save();
|
|
await r?.save();
|
|
break;
|
|
break;
|
|
case '禁用':
|
|
case '禁用':
|
|
@@ -307,15 +323,15 @@ export class PageUserComponent implements OnInit {
|
|
);
|
|
);
|
|
let deletePromiseList = selectedList.map((item: any) => {
|
|
let deletePromiseList = selectedList.map((item: any) => {
|
|
return new Promise(async (resolve) => {
|
|
return new Promise(async (resolve) => {
|
|
- await item.get('user')?.destroy()
|
|
|
|
- await item.destroy()
|
|
|
|
- resolve(true)
|
|
|
|
|
|
+ await item.get('user')?.destroy();
|
|
|
|
+ await item.destroy();
|
|
|
|
+ resolve(true);
|
|
});
|
|
});
|
|
});
|
|
});
|
|
try {
|
|
try {
|
|
await Promise.all(deletePromiseList);
|
|
await Promise.all(deletePromiseList);
|
|
this.setOfCheckedId = new Set<string>();
|
|
this.setOfCheckedId = new Set<string>();
|
|
- this.checkedAll = false
|
|
|
|
|
|
+ this.checkedAll = false;
|
|
this.getProfile();
|
|
this.getProfile();
|
|
} catch (err) {}
|
|
} catch (err) {}
|
|
},
|
|
},
|
|
@@ -324,7 +340,21 @@ export class PageUserComponent implements OnInit {
|
|
});
|
|
});
|
|
}
|
|
}
|
|
goDateil(id: string) {
|
|
goDateil(id: string) {
|
|
- this.route.navigate(['/nav-admin/manage/user/edit', { id: id }],{queryParams:{page:this.pageIndex}});
|
|
|
|
|
|
+ let url = '';
|
|
|
|
+ switch (this.tbookSer.profile.identity) {
|
|
|
|
+ case '国家级管理员':
|
|
|
|
+ url = '/nav-admin/manage/user/edit';
|
|
|
|
+ break;
|
|
|
|
+ case '工作联系人':
|
|
|
|
+ url = '/nav-province-contact/manage/user/edit';
|
|
|
|
+ break;
|
|
|
|
+ case '高校联系人':
|
|
|
|
+ url = '/nav-province-school-contact/manage/user/edit';
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ this.route.navigate([url, { id: id }], {
|
|
|
|
+ queryParams: { page: this.pageIndex },
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
|
|
/* 添加用户 */
|
|
/* 添加用户 */
|
|
@@ -356,8 +386,12 @@ export class PageUserComponent implements OnInit {
|
|
// type: res.get('type'),
|
|
// type: res.get('type'),
|
|
// },
|
|
// },
|
|
// ];
|
|
// ];
|
|
- this.parentList = await this.getDepart(this.tbookSer.profile.user.department?.objectId);
|
|
|
|
- this.parentMap = await this.formatNode(this.tbookSer.profile.user.department?.objectId);
|
|
|
|
|
|
+ this.parentList = await this.getDepart(
|
|
|
|
+ this.tbookSer.profile.user.department?.objectId
|
|
|
|
+ );
|
|
|
|
+ this.parentMap = await this.formatNode(
|
|
|
|
+ this.tbookSer.profile.user.department?.objectId
|
|
|
|
+ );
|
|
} else {
|
|
} else {
|
|
this.parentList = await this.getDepart();
|
|
this.parentList = await this.getDepart();
|
|
}
|
|
}
|
|
@@ -406,10 +440,11 @@ export class PageUserComponent implements OnInit {
|
|
this.parentMap = [];
|
|
this.parentMap = [];
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- if (index == this.parentMap.length - 1){
|
|
|
|
- if(this.parentList.length == 0 ) this.parentList = await this.getDepart(data?.key);
|
|
|
|
|
|
+ if (index == this.parentMap.length - 1) {
|
|
|
|
+ if (this.parentList.length == 0)
|
|
|
|
+ this.parentList = await this.getDepart(data?.key);
|
|
return;
|
|
return;
|
|
- }
|
|
|
|
|
|
+ }
|
|
this.parentMap.splice((index || 0) + 1);
|
|
this.parentMap.splice((index || 0) + 1);
|
|
this.parentList = await this.getDepart(data?.key);
|
|
this.parentList = await this.getDepart(data?.key);
|
|
}
|
|
}
|
|
@@ -434,7 +469,9 @@ export class PageUserComponent implements OnInit {
|
|
this.account.department = { title: e.title, id: e.key };
|
|
this.account.department = { title: e.title, id: e.key };
|
|
this.account.companyType = e.branch || e.title;
|
|
this.account.companyType = e.branch || e.title;
|
|
this.userType = this.parents.some((item) => e.parent == item.key)
|
|
this.userType = this.parents.some((item) => e.parent == item.key)
|
|
- ? !e.type ? ['工作联系人'] : ['评审专家', '工作联系人', '教师']
|
|
|
|
|
|
+ ? !e.type
|
|
|
|
+ ? ['工作联系人']
|
|
|
|
+ : ['评审专家', '工作联系人', '教师']
|
|
: e.type == '单位'
|
|
: e.type == '单位'
|
|
? ['评审专家', '高校联系人', '教师']
|
|
? ['评审专家', '高校联系人', '教师']
|
|
: ['评审专家', '教师'];
|
|
: ['评审专家', '教师'];
|
|
@@ -471,18 +508,18 @@ export class PageUserComponent implements OnInit {
|
|
console.log(this.account.password);
|
|
console.log(this.account.password);
|
|
}
|
|
}
|
|
/* 添加账号 */
|
|
/* 添加账号 */
|
|
- isLoadingOne:boolean = false
|
|
|
|
|
|
+ isLoadingOne: boolean = false;
|
|
async accountComplete() {
|
|
async accountComplete() {
|
|
- if(this.isLoadingOne) return
|
|
|
|
- this.isLoadingOne = true
|
|
|
|
|
|
+ if (this.isLoadingOne) return;
|
|
|
|
+ this.isLoadingOne = true;
|
|
this.account.username = this.account?.username.trim();
|
|
this.account.username = this.account?.username.trim();
|
|
this.account.email = this.account?.email.trim();
|
|
this.account.email = this.account?.email.trim();
|
|
this.account.phone = this.account?.phone.trim();
|
|
this.account.phone = this.account?.phone.trim();
|
|
this.account.name = this.account?.name.trim();
|
|
this.account.name = this.account?.name.trim();
|
|
this.account.password = this.account?.password.trim();
|
|
this.account.password = this.account?.password.trim();
|
|
- if(!await this.authVrifly()){
|
|
|
|
- this.isLoadingOne = false
|
|
|
|
- return
|
|
|
|
|
|
+ if (!(await this.authVrifly())) {
|
|
|
|
+ this.isLoadingOne = false;
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
try {
|
|
try {
|
|
let obj = Parse.Object.extend('_User');
|
|
let obj = Parse.Object.extend('_User');
|
|
@@ -509,12 +546,15 @@ export class PageUserComponent implements OnInit {
|
|
profile?.set('email', this.account.email);
|
|
profile?.set('email', this.account.email);
|
|
profile?.set('identity', this.account.identity);
|
|
profile?.set('identity', this.account.identity);
|
|
let res = await profile?.save();
|
|
let res = await profile?.save();
|
|
- this.isLoadingOne = false
|
|
|
|
|
|
+ this.isLoadingOne = false;
|
|
this.accountIsVisible = false;
|
|
this.accountIsVisible = false;
|
|
this.account = null;
|
|
this.account = null;
|
|
- Parse.Cloud.run('aliSmsSend',{
|
|
|
|
- "mobileList": [this.account?.phone],"templateCode":"SMS_469060724","params":{},"signName":"普通高等教育教材网"
|
|
|
|
- })
|
|
|
|
|
|
+ Parse.Cloud.run('aliSmsSend', {
|
|
|
|
+ mobileList: [this.account?.phone],
|
|
|
|
+ templateCode: 'SMS_469060724',
|
|
|
|
+ params: {},
|
|
|
|
+ signName: '普通高等教育教材网',
|
|
|
|
+ });
|
|
this.modal.success({
|
|
this.modal.success({
|
|
nzTitle: '添加成功',
|
|
nzTitle: '添加成功',
|
|
nzContent: '',
|
|
nzContent: '',
|
|
@@ -525,14 +565,14 @@ export class PageUserComponent implements OnInit {
|
|
});
|
|
});
|
|
} catch (err: any) {
|
|
} catch (err: any) {
|
|
console.warn('添加用户错误', err);
|
|
console.warn('添加用户错误', err);
|
|
- this.isLoadingOne = false
|
|
|
|
|
|
+ this.isLoadingOne = false;
|
|
this.message.error(
|
|
this.message.error(
|
|
err?.Error || '错误:请检查用户或邮箱及手机号是否已存在'
|
|
err?.Error || '错误:请检查用户或邮箱及手机号是否已存在'
|
|
);
|
|
);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- async authVrifly():Promise< boolean | undefined>{
|
|
|
|
|
|
+ async authVrifly(): Promise<boolean | undefined> {
|
|
this.account.password = this.account?.password.trim();
|
|
this.account.password = this.account?.password.trim();
|
|
this.account.email = this.account?.email.trim();
|
|
this.account.email = this.account?.email.trim();
|
|
this.account.phone = this.account?.phone.trim();
|
|
this.account.phone = this.account?.phone.trim();
|
|
@@ -540,8 +580,9 @@ export class PageUserComponent implements OnInit {
|
|
if (
|
|
if (
|
|
!this.account?.name ||
|
|
!this.account?.name ||
|
|
!this.account.department?.id ||
|
|
!this.account.department?.id ||
|
|
- !this.account.password||
|
|
|
|
- !this.account.phone || !this.account?.email
|
|
|
|
|
|
+ !this.account.password ||
|
|
|
|
+ !this.account.phone ||
|
|
|
|
+ !this.account?.email
|
|
) {
|
|
) {
|
|
this.message.warning('请填写必填项');
|
|
this.message.warning('请填写必填项');
|
|
return;
|
|
return;
|
|
@@ -555,23 +596,28 @@ export class PageUserComponent implements OnInit {
|
|
this.message.error('请填写正确手机号');
|
|
this.message.error('请填写正确手机号');
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- let m = /^(([^<>()[\]\\.,;:\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.account.email).match(m)){
|
|
|
|
- this.message.error("邮箱格式有误");
|
|
|
|
|
|
+ let m =
|
|
|
|
+ /^(([^<>()[\]\\.,;:\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.account.email).match(m)) {
|
|
|
|
+ this.message.error('邮箱格式有误');
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
// if (!this.account?.email&& !this.account?.phone) {
|
|
// if (!this.account?.email&& !this.account?.phone) {
|
|
// this.message.error('邮箱或手机号必须填写一项');
|
|
// this.message.error('邮箱或手机号必须填写一项');
|
|
// return;
|
|
// return;
|
|
// }
|
|
// }
|
|
- if(!(this.account.password.length >= 6 && this.account.password.length <= 18)){
|
|
|
|
- this.message.error('密码格式错误,请填写6-18位非空字符串(数字、大小写字母或英文符号)');
|
|
|
|
|
|
+ if (
|
|
|
|
+ !(this.account.password.length >= 6 && this.account.password.length <= 18)
|
|
|
|
+ ) {
|
|
|
|
+ this.message.error(
|
|
|
|
+ '密码格式错误,请填写6-18位非空字符串(数字、大小写字母或英文符号)'
|
|
|
|
+ );
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- if(!await this.tbookSer.userFind(this.account.phone)){
|
|
|
|
|
|
+ if (!(await this.tbookSer.userFind(this.account.phone))) {
|
|
this.message.error('手机号已存在');
|
|
this.message.error('手机号已存在');
|
|
- return
|
|
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
- return true
|
|
|
|
|
|
+ return true;
|
|
}
|
|
}
|
|
}
|
|
}
|