|
@@ -101,16 +101,12 @@ export class TextbookComponent implements OnInit {
|
|
|
});
|
|
|
query = Parse.Query.or(query1, query2);
|
|
|
}
|
|
|
- if (this.tbookSer.profile.user.department?.objectId) {
|
|
|
- query.equalTo(
|
|
|
- 'department',
|
|
|
- this.tbookSer.profile.user.department?.objectId
|
|
|
- );
|
|
|
- }
|
|
|
+ this.tbookSer.profile.user?.objectId && query.equalTo('user',this.tbookSer.profile.user?.objectId);
|
|
|
this.depart && query.equalTo('department', this.depart);
|
|
|
this.recommend && query.equalTo('recommend', true);
|
|
|
this.filterObj?.noStared && query.notEqualTo('recommend', true);
|
|
|
this.uid && query.equalTo('user', this.uid);
|
|
|
+ query.descending('createdAt')
|
|
|
query.notEqualTo('isDeleted', true);
|
|
|
if (!this.uid) {
|
|
|
query.equalTo('render', true);
|
|
@@ -133,6 +129,7 @@ export class TextbookComponent implements OnInit {
|
|
|
this.count = await query.count();
|
|
|
query.limit(this.limit);
|
|
|
query.skip(this.limit * (this.pageSize - 1));
|
|
|
+ // query.include('user')
|
|
|
this.textbookList = await query.find();
|
|
|
console.log(this.textbookList);
|
|
|
this.loading = false;
|
|
@@ -272,8 +269,9 @@ export class TextbookComponent implements OnInit {
|
|
|
});
|
|
|
}
|
|
|
//提交教材
|
|
|
- submit(data?: Parse.Object) {
|
|
|
- console.log(data);
|
|
|
+ async submit(data?: Parse.Object) {
|
|
|
+ let parentMap = await this.tbookSer.formatNode(this.tbookSer?.profile?.user?.department?.objectId);
|
|
|
+ console.log(parentMap);
|
|
|
this.modal.confirm({
|
|
|
nzTitle: '提交教材',
|
|
|
nzContent: `提交后在已提交评审教材中查看`,
|
|
@@ -301,6 +299,13 @@ export class TextbookComponent implements OnInit {
|
|
|
item.set('render', true);
|
|
|
item.set('status', '200');
|
|
|
item.set('code', t);
|
|
|
+ if(parentMap[1]?.key){
|
|
|
+ item?.set('department', {
|
|
|
+ __type: 'Pointer',
|
|
|
+ className: 'Department',
|
|
|
+ objectId:parentMap[1]?.key
|
|
|
+ });
|
|
|
+ }
|
|
|
item.save().then(() => resolve(true));
|
|
|
});
|
|
|
});
|