Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
张善主
2024-05-23 15:46:54 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
6f24115784d79d04824b657a3e78a9d06ba59f03
6f241157
1 parent
d0a79a00
fix(17804):现在可以上次好几张问题
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
12 deletions
sight_harmony/features/wdComponent/src/main/ets/components/FeedBackActivity.ets
sight_harmony/features/wdComponent/src/main/ets/components/FeedBackActivity.ets
View file @
6f24115
...
...
@@ -33,8 +33,6 @@ export struct FeedBackActivity {
//添加图片
addPic: PhotoListBean = {itemType:1} as PhotoListBean
@State pics: PhotoListBean[] = [this.addPic] as PhotoListBean[]
// 选择媒体文件的最大数目
selectNum = 3;
async aboutToAppear() {
await this.getContentDetailData()
...
...
@@ -140,7 +138,6 @@ export struct FeedBackActivity {
if(await FastClickUtil.isMinDelayTime()){
return
}
let temp: PhotoListBean[] = [] as PhotoListBean[]
temp.length = this.pics.length - 1;
let tempIndex = 0;
...
...
@@ -267,7 +264,8 @@ export struct FeedBackActivity {
// 设置photoPicker的参数
let PhotoSelectOptions = new picker.PhotoSelectOptions();
PhotoSelectOptions.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE; // 过滤选择媒体文件类型
PhotoSelectOptions.maxSelectNumber = this.selectNum; // 选择媒体文件的最大数目
let max = 3-this.pics.length+1
PhotoSelectOptions.maxSelectNumber = max; // 选择媒体文件的最大数目
let mediaFlag = false;
let photoPicker = new picker.PhotoViewPicker(); // 使用图库选择器对象前,需要先创建PhotoViewPicker实例
photoPicker.select(PhotoSelectOptions).then((PhotoSelectResult) => {
...
...
@@ -278,26 +276,35 @@ export struct FeedBackActivity {
// 其中包含Array<string>类型的photoUris,为返回图库选择后的媒体文件的uri数组;还包含boolean类型的isOriginalPhoto,指示返回图库选择后的媒体文件是否为原图。
// 声明变量array,其取值为PhotoSelectResult中的数组。
array = PhotoSelectResult['photoUris'];
let beforeLen = this.pics.length;
let startIndex = this.pics.length-1;
let beforeLen = this.pics.length + array.length;
let totalLen = this.pics.length+array.length;
if(totalLen > 3){
totalLen = 3
}
this.pics.length = totalLen;
// this.pics.length = totalLen;
let tempPics = [] as PhotoListBean[]
tempPics.length = totalLen;
let startIndex = 0;
this.pics.forEach((value) => {
if(value.itemType == 2){
value.id = startIndex
tempPics[startIndex] = value;
startIndex = startIndex+1;
mediaFlag = true;
}
})
array.forEach((value) => {
let pic: PhotoListBean = {itemType:2,picPath:value} as PhotoListBean
pic.id = startIndex
t
his.pics[startIndex] = pic
t
empPics[startIndex] = pic;
startIndex = startIndex+1;
mediaFlag = true;
Logger.info(TAG, `select image/video uri: ${value}`);
})
if(
this.pics.length<=3 && beforeLen != 3 && array.length !=
3){
if(
startIndex<
3){
this.addPic.id = startIndex
t
his.pics[this.pics.length-1
]=this.addPic;
t
empPics[startIndex
]=this.addPic;
}
this.pics = tempPics;
}
if (mediaFlag) {
this.getFilenameByUriForMedia(array);
...
...
Please
register
or
login
to post a comment