!96 部分问题修复

Merge pull request !96 from 朱铖丰/master
This commit is contained in:
openharmony_ci 2022-09-21 06:25:27 +00:00 committed by Gitee
commit e639931846
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 45 additions and 19 deletions

View File

@ -103,12 +103,11 @@ export struct ImageGridItemComponent {
private selectStateChange() {
logInfo(TAG, `change selected ${this.isSelectedMode}`);
if (this.isSelectedMode) {
this.onSelected()
} else {
if (!this.isSelectedMode) {
this.isSelectedMode = true
this.pressAnimScale = 1;
}
this.onSelected()
}
build() {

View File

@ -24,11 +24,20 @@ export class FavorMediaDataItem extends MediaDataItem {
}
async loadFileAsset(): Promise<MediaLib.FileAsset> {
let fetchOption: MediaLib.MediaFetchOptions = {
selections: this.selections,
selectionArgs: this.selectionArgs,
order: `date_added DESC LIMIT ${this.index},1`
};
let fetchOption: MediaLib.MediaFetchOptions
if (this.status == MediaConstants.UNDEFINED) {
fetchOption = {
selections: this.selections,
selectionArgs: this.selectionArgs,
order: `date_added DESC LIMIT ${this.index},1`
};
} else {
fetchOption = {
selections: `${MediaLib.FileKey.ID} = ?`,
selectionArgs: [this.id.toString()],
order: `date_added DESC`
}
}
return (await mediaModel.getAllFavorMediaItem(fetchOption, false)).fileAsset
}

View File

@ -68,11 +68,20 @@ export class MediaDataItem {
}
async loadFileAsset(): Promise<MediaLib.FileAsset> {
let fetchOption: MediaLib.MediaFetchOptions = {
selections: this.selections,
selectionArgs: this.selectionArgs,
order: `date_added DESC LIMIT ${this.index},1`
};
let fetchOption: MediaLib.MediaFetchOptions
if (this.status == MediaConstants.UNDEFINED) {
fetchOption = {
selections: this.selections,
selectionArgs: this.selectionArgs,
order: `date_added DESC LIMIT ${this.index},1`
};
} else {
fetchOption = {
selections: `${MediaLib.FileKey.ID} = ?`,
selectionArgs: [this.id.toString()],
order: `date_added DESC`
}
}
if (this.deviceId.length > 0) {
fetchOption['networkId'] = this.deviceId
}
@ -156,7 +165,7 @@ export class MediaDataItem {
this.status = MediaConstants.TRASHED
return true
} catch (err) {
logError(TAG, `onDelete error: ${JSON.stringify(err)}`)
logError(TAG, `onDelete ${this.index} error: ${JSON.stringify(err)}`)
return false
}
}

View File

@ -29,11 +29,20 @@ export class TrashMediaDataItem extends MediaDataItem {
}
async loadFileAsset(): Promise<MediaLib.FileAsset> {
let fetchOption: MediaLib.MediaFetchOptions = {
selections: this.selections,
selectionArgs: this.selectionArgs,
order: `date_added DESC LIMIT ${this.index},1`
};
let fetchOption: MediaLib.MediaFetchOptions
if (this.status == MediaConstants.UNDEFINED) {
fetchOption = {
selections: this.selections,
selectionArgs: this.selectionArgs,
order: `date_added DESC LIMIT ${this.index},1`
}
} else {
fetchOption = {
selections: `${MediaLib.FileKey.ID} = ?`,
selectionArgs: [this.id.toString()],
order: `date_added DESC`
}
}
return (await mediaModel.getAllTrashMediaItem(fetchOption, false)).fileAsset
}