fa problem

Signed-off-by: z00513345 <zhuchengfeng1@huawei.com>
This commit is contained in:
z00513345 2022-08-24 14:51:08 +08:00
parent 0e78bc21e6
commit 1ac57d4635
4 changed files with 25 additions and 64 deletions

View File

@ -42,27 +42,15 @@ export class FormController {
bindFormData(formId: string): any {
this.logger.info(`bindFormData start formId: ${formId}`)
let fd = this.mediaDataManager.getCurrentFd();
let image: string = "image" + this.mediaDataManager.getMediaData().arkUri;
let dataObj1: any;
if (image == "image0") {
dataObj1 = {
"fd": fd == -1 ? false : true,
"image1": "memory://image" + this.mediaDataManager.getMediaData().arkUri,
"albumName": this.mediaDataManager.getCurrentAlbumName(),
"currentIndex": this.mediaDataManager.getCurrentIndex(),
"isShow": this.mediaDataManager.getIsShowAlbumName(),
"formImages": { "image0": fd }
};
} else {
dataObj1 = {
"fd": fd == -1 ? false : true,
"image1": "memory://image" + this.mediaDataManager.getMediaData().arkUri,
"albumName": this.mediaDataManager.getCurrentAlbumName(),
"currentIndex": this.mediaDataManager.getCurrentIndex(),
"isShow": this.mediaDataManager.getIsShowAlbumName(),
"formImages": { "image1": fd }
};
}
let image: string = "image_" + fd + "_formId_" + this.mediaDataManager.getMediaData().formId;
let dataObj1: any = {
"fd": fd == -1 ? false : true,
"image1": "memory://" + image,
"albumName": this.mediaDataManager.getCurrentAlbumName(),
"currentIndex": this.mediaDataManager.getCurrentIndex(),
"isShow": this.mediaDataManager.getIsShowAlbumName(),
"formImages": JSON.parse(`{ "${image}": ${fd} }`)
};
this.logger.debug(`bindFormData, createFormBindingData dataObj2.data: ${JSON.stringify(dataObj1)}`);
let obj = formBindingData.createFormBindingData(JSON.stringify(dataObj1));
this.logger.debug(`bindFormData, createFormBindingData obj2.data: ${JSON.stringify(obj.data)}`);
@ -101,7 +89,6 @@ export class FormController {
onDestroy() {
this.logger.info('onDestroy start!');
this.mediaDataManager.closeFd();
DataStoreUtil.getInstance(this.context).removeCache();
MediaLibraryAccess.getInstance().onDestroy();
this.callback = null;
this.logger.info('onDestroy done end!');

View File

@ -259,24 +259,6 @@ export class MediaDataManager {
this.logger.debug('storageDelete end!');
}
setMediaData(displayName: string, albumName: string, currentUri: string, intervalTime: number) {
this.logger.debug('setAlbumNameAndUri start!');
if (this.mediaData != null) {
this.mediaData.currentUri = currentUri;
if (this.mediaData.currentUri == '') {
this.mediaData.currentIndex = 0;
}
this.mediaData.intervalTime = intervalTime;
if (this.mediaData.albumName != albumName) {
this.mediaData.albumName = albumName;
this.loadData();
} else {
this.saveData();
}
}
this.logger.debug('setAlbumNameAndUri end!');
}
filterOutVideoMediaData() {
this.logger.debug('filterOutVideoMediaData start!');
if (this.items.length == 0) {
@ -378,7 +360,8 @@ export class MediaDataManager {
setNextIndex() {
this.logger.debug(`setNextIndex start old index ${this.mediaData.currentIndex} flag ${this.isNextFag}`);
if (this.isNextFag) {
// this.mediaData.isShowAlbumName == false means select a photo instead of a album
if (this.isNextFag && this.mediaData.isShowAlbumName) {
let index = this.mediaData.currentIndex;
if ((this.items.length != 0) && (index < this.items.length - 1)) {
index = index + 1;

View File

@ -72,6 +72,7 @@ export class DataStoreUtil {
this.logger.debug('putData start!');
if (this.preferences == undefined) {
this.logger.error('putData preferences is undefined');
return
}
await this.preferences.put(key, value).then(() => {

View File

@ -197,29 +197,19 @@ struct FormEditorPage {
bindFormData(): any {
this.logger.debug(`bindFormData start formId: ${this.formId}`)
let image = "image" + this.arkUri;
let dataObj1: any;
if (image == "image0") {
dataObj1 = {
"fd": this.fd == -1 ? false : true,
"image1": "memory://image" + this.arkUri,
"albumName": this.displayName,
"currentIndex": this.currentIndex,
"isShow": this.isShow,
"formImages": { "image0": this.fd }
};
} else {
dataObj1 = {
"fd": this.fd == -1 ? false : true,
"image1": "memory://image" + this.arkUri,
"albumName": this.displayName,
"currentIndex": this.currentIndex,
"isShow": this.isShow,
"formImages": { "image1": this.fd }
};
}
this.logger.debug(`bindFormData, createFormBindingData dataObj2.data: ${JSON.stringify(dataObj1)}`);
let obj = formBindingData.createFormBindingData(JSON.stringify(dataObj1));
let image = "image_" + this.fd + "_formId_" + this.formId;
this.logger.debug(`bindFormData start image: ${image}`)
let dataObj1: any = {
"fd": this.fd == -1 ? false : true,
"image1": "memory://" + image,
"albumName": this.displayName,
"currentIndex": this.currentIndex,
"isShow": this.isShow,
"formImages": JSON.parse(`{ "${image}": ${this.fd} }`)
};
let dataObj = JSON.stringify(dataObj1)
this.logger.info(`bindFormData, createFormBindingData dataObj2.data: ${dataObj}`);
let obj = formBindingData.createFormBindingData(dataObj);
this.logger.debug(`bindFormData, createFormBindingData obj2.data: ${JSON.stringify(obj.data)}`);
return obj;
}