wangliang_wd

Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool into main

* 'main' of http://192.168.1.42/developOne/harmonyPool:
  fix |> 查看大图轮播组件返回按钮间距调整
  fix |> 修复bindSheet半模态退出时出现重影的问题
  fix |> 隐藏文章稿件分享入口
  fix |> 修复稿件详情查看大图缺少图片缓存的问题
... ... @@ -7,8 +7,10 @@ import { WindowSizeManager } from '../utils/Managers';
import { runWithAnimation } from '../utils/FuncUtils';
import { PhotoListBean } from 'wdBean/Index';
import { router } from '@kit.ArkUI';
import { taskpool } from '@kit.ArkTS';
import { buffer, taskpool,util } from '@kit.ArkTS';
import { httpRequest } from '../utils/httpRequest';
import { ImageKnifeComponent } from '@ohos/imageknife';
import { Logger,SPHelper } from 'wdKit';
const TAG = 'MultiPictureDetailItemComponent';
... ... @@ -50,18 +52,54 @@ export struct MultiPictureDetailItemComponent {
@State currentOffset: number = 0
@Consume duration: number
windowSizeManager: WindowSizeManager = new WindowSizeManager();
private picPathKey:string = ''
async aboutToAppear() {
aboutToAppear() {
this.imageUri = this.MultiPictureDetailItem.picPath
// 通过任务池(taskpool)从网络下载图片资源
taskpool.execute(getPicture, this.imageUri).then((res) => {
const imgBuffer = res as ArrayBuffer
this.imageBuffer = imgBuffer;
this.transcodePixelMap(imgBuffer);
})
let lastIndexOfSlash = this.imageUri.lastIndexOf('/')
let lastIndexOfDot = this.imageUri.lastIndexOf('.')
let resultString = ''
if (lastIndexOfSlash != -1 && lastIndexOfDot != -1 && lastIndexOfDot >lastIndexOfSlash ) {
resultString = this.imageUri.substring(lastIndexOfSlash+1,lastIndexOfDot)
}
this.picPathKey = resultString;
let base64Str = SPHelper.default.getSync(this.picPathKey, '') as string
let base64StartIndex = base64Str.indexOf("base64,") + "base64,".length;
base64Str = base64Str.substring(base64StartIndex);
if (base64Str.length > 0) {
let helper = new util.Base64Helper();
let buffer: ArrayBuffer = helper.decodeSync(base64Str, util.Type.MIME).buffer as ArrayBuffer;
let imageSource = image.createImageSource(buffer);
let opts: image.DecodingOptions = { editable: true };
this.imagePixelMap = await imageSource.createPixelMap(opts);
} else {
// 通过任务池(taskpool)从网络下载图片资源
taskpool.execute(getPicture, this.imageUri).then((res) => {
const imgBuffer = res as ArrayBuffer
this.imageBuffer = imgBuffer;
this.transcodePixelMap(imgBuffer);
})
}
}
async saveImage(data: image.PixelMap){
if (this.picPathKey.length > 0) {
// 转换成base64
const imagePackerApi: image.ImagePacker = image.createImagePacker();
let packOpts: image.PackingOption = { format: 'image/jpeg', quality: 100 };
imagePackerApi.packing(data, packOpts).then((data: ArrayBuffer) => {
let buf: buffer.Buffer = buffer.from(data);
let base64 = 'data:image/jpeg;base64,' + buf.toString('base64', 0, buf.length);
SPHelper.default.saveSync(this.picPathKey,base64)
})
}
}
/**
* 使用createPixelMap将ArrayBuffer类型的图片装换为PixelMap类型
... ... @@ -97,6 +135,7 @@ export struct MultiPictureDetailItemComponent {
});
imageSource.createPixelMap().then((data: image.PixelMap) => {
this.imagePixelMap = data;
this.saveImage(data);
}).catch((err: BusinessError) => {
console.error(`[error][createPixelMap]${err.message}`);
});
... ...
... ... @@ -44,14 +44,18 @@ export struct CommentListDialogView {
showClose: false,
maskColor: "#50000000",
dragBar: false,
onDisappear:()=>{
this.showCommentList = false
if (this.onClose) { this.onClose() }
},
onWillDisappear: () => {
this.showCommentList = false
if (this.onClose) { this.onClose() }
},
shouldDismiss:((sheetDismiss: SheetDismiss)=> {
console.log("bind sheet shouldDismiss")
sheetDismiss.dismiss()
}),
// shouldDismiss:((sheetDismiss: SheetDismiss)=> {
// console.log("bind sheet shouldDismiss")
// sheetDismiss.dismiss()
// }),
onHeightDidChange: (number: number) => {
Logger.debug(TAG, "onHeightDidChange : " + number)
let height = number
... ...
... ... @@ -74,6 +74,7 @@ export struct MultiPictureListPage {
.height(24)
.aspectRatio(1)
.interpolation(ImageInterpolation.High)
.margin({left:15})
}
.zIndex(10)
.margin({ top: `${this.topSafeHeight}px` })
... ...
... ... @@ -553,7 +553,7 @@ const app = Vue.createApp({
? data.newLinkObject.headLinkdata
: ''
shareOpen.value = state.details.shareInfo ? state.details.shareInfo.shareOpen == 1 : false
// shareOpen.value = state.details.shareInfo ? state.details.shareInfo.shareOpen == 1 : false
hasInit.value = true
if (pageError) {
... ...