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'; @@ -7,8 +7,10 @@ import { WindowSizeManager } from '../utils/Managers';
7 import { runWithAnimation } from '../utils/FuncUtils'; 7 import { runWithAnimation } from '../utils/FuncUtils';
8 import { PhotoListBean } from 'wdBean/Index'; 8 import { PhotoListBean } from 'wdBean/Index';
9 import { router } from '@kit.ArkUI'; 9 import { router } from '@kit.ArkUI';
10 -import { taskpool } from '@kit.ArkTS'; 10 +import { buffer, taskpool,util } from '@kit.ArkTS';
11 import { httpRequest } from '../utils/httpRequest'; 11 import { httpRequest } from '../utils/httpRequest';
  12 +import { ImageKnifeComponent } from '@ohos/imageknife';
  13 +import { Logger,SPHelper } from 'wdKit';
12 14
13 const TAG = 'MultiPictureDetailItemComponent'; 15 const TAG = 'MultiPictureDetailItemComponent';
14 16
@@ -50,18 +52,54 @@ export struct MultiPictureDetailItemComponent { @@ -50,18 +52,54 @@ export struct MultiPictureDetailItemComponent {
50 @State currentOffset: number = 0 52 @State currentOffset: number = 0
51 @Consume duration: number 53 @Consume duration: number
52 windowSizeManager: WindowSizeManager = new WindowSizeManager(); 54 windowSizeManager: WindowSizeManager = new WindowSizeManager();
  55 + private picPathKey:string = ''
53 56
  57 + async aboutToAppear() {
54 58
55 - aboutToAppear() {  
56 this.imageUri = this.MultiPictureDetailItem.picPath 59 this.imageUri = this.MultiPictureDetailItem.picPath
57 - // 通过任务池(taskpool)从网络下载图片资源  
58 - taskpool.execute(getPicture, this.imageUri).then((res) => {  
59 - const imgBuffer = res as ArrayBuffer  
60 - this.imageBuffer = imgBuffer;  
61 - this.transcodePixelMap(imgBuffer);  
62 - }) 60 +
  61 + let lastIndexOfSlash = this.imageUri.lastIndexOf('/')
  62 + let lastIndexOfDot = this.imageUri.lastIndexOf('.')
  63 + let resultString = ''
  64 + if (lastIndexOfSlash != -1 && lastIndexOfDot != -1 && lastIndexOfDot >lastIndexOfSlash ) {
  65 + resultString = this.imageUri.substring(lastIndexOfSlash+1,lastIndexOfDot)
  66 + }
  67 + this.picPathKey = resultString;
  68 +
  69 + let base64Str = SPHelper.default.getSync(this.picPathKey, '') as string
  70 + let base64StartIndex = base64Str.indexOf("base64,") + "base64,".length;
  71 + base64Str = base64Str.substring(base64StartIndex);
  72 +
  73 + if (base64Str.length > 0) {
  74 + let helper = new util.Base64Helper();
  75 + let buffer: ArrayBuffer = helper.decodeSync(base64Str, util.Type.MIME).buffer as ArrayBuffer;
  76 + let imageSource = image.createImageSource(buffer);
  77 + let opts: image.DecodingOptions = { editable: true };
  78 + this.imagePixelMap = await imageSource.createPixelMap(opts);
  79 +
  80 + } else {
  81 + // 通过任务池(taskpool)从网络下载图片资源
  82 + taskpool.execute(getPicture, this.imageUri).then((res) => {
  83 + const imgBuffer = res as ArrayBuffer
  84 + this.imageBuffer = imgBuffer;
  85 + this.transcodePixelMap(imgBuffer);
  86 + })
  87 + }
63 } 88 }
64 89
  90 + async saveImage(data: image.PixelMap){
  91 +
  92 + if (this.picPathKey.length > 0) {
  93 + // 转换成base64
  94 + const imagePackerApi: image.ImagePacker = image.createImagePacker();
  95 + let packOpts: image.PackingOption = { format: 'image/jpeg', quality: 100 };
  96 + imagePackerApi.packing(data, packOpts).then((data: ArrayBuffer) => {
  97 + let buf: buffer.Buffer = buffer.from(data);
  98 + let base64 = 'data:image/jpeg;base64,' + buf.toString('base64', 0, buf.length);
  99 + SPHelper.default.saveSync(this.picPathKey,base64)
  100 + })
  101 + }
  102 + }
65 103
66 /** 104 /**
67 * 使用createPixelMap将ArrayBuffer类型的图片装换为PixelMap类型 105 * 使用createPixelMap将ArrayBuffer类型的图片装换为PixelMap类型
@@ -97,6 +135,7 @@ export struct MultiPictureDetailItemComponent { @@ -97,6 +135,7 @@ export struct MultiPictureDetailItemComponent {
97 }); 135 });
98 imageSource.createPixelMap().then((data: image.PixelMap) => { 136 imageSource.createPixelMap().then((data: image.PixelMap) => {
99 this.imagePixelMap = data; 137 this.imagePixelMap = data;
  138 + this.saveImage(data);
100 }).catch((err: BusinessError) => { 139 }).catch((err: BusinessError) => {
101 console.error(`[error][createPixelMap]${err.message}`); 140 console.error(`[error][createPixelMap]${err.message}`);
102 }); 141 });
@@ -44,14 +44,18 @@ export struct CommentListDialogView { @@ -44,14 +44,18 @@ export struct CommentListDialogView {
44 showClose: false, 44 showClose: false,
45 maskColor: "#50000000", 45 maskColor: "#50000000",
46 dragBar: false, 46 dragBar: false,
  47 + onDisappear:()=>{
  48 + this.showCommentList = false
  49 + if (this.onClose) { this.onClose() }
  50 + },
47 onWillDisappear: () => { 51 onWillDisappear: () => {
48 this.showCommentList = false 52 this.showCommentList = false
49 if (this.onClose) { this.onClose() } 53 if (this.onClose) { this.onClose() }
50 }, 54 },
51 - shouldDismiss:((sheetDismiss: SheetDismiss)=> {  
52 - console.log("bind sheet shouldDismiss")  
53 - sheetDismiss.dismiss()  
54 - }), 55 + // shouldDismiss:((sheetDismiss: SheetDismiss)=> {
  56 + // console.log("bind sheet shouldDismiss")
  57 + // sheetDismiss.dismiss()
  58 + // }),
55 onHeightDidChange: (number: number) => { 59 onHeightDidChange: (number: number) => {
56 Logger.debug(TAG, "onHeightDidChange : " + number) 60 Logger.debug(TAG, "onHeightDidChange : " + number)
57 let height = number 61 let height = number
@@ -74,6 +74,7 @@ export struct MultiPictureListPage { @@ -74,6 +74,7 @@ export struct MultiPictureListPage {
74 .height(24) 74 .height(24)
75 .aspectRatio(1) 75 .aspectRatio(1)
76 .interpolation(ImageInterpolation.High) 76 .interpolation(ImageInterpolation.High)
  77 + .margin({left:15})
77 } 78 }
78 .zIndex(10) 79 .zIndex(10)
79 .margin({ top: `${this.topSafeHeight}px` }) 80 .margin({ top: `${this.topSafeHeight}px` })
@@ -553,7 +553,7 @@ const app = Vue.createApp({ @@ -553,7 +553,7 @@ const app = Vue.createApp({
553 ? data.newLinkObject.headLinkdata 553 ? data.newLinkObject.headLinkdata
554 : '' 554 : ''
555 555
556 - shareOpen.value = state.details.shareInfo ? state.details.shareInfo.shareOpen == 1 : false 556 + // shareOpen.value = state.details.shareInfo ? state.details.shareInfo.shareOpen == 1 : false
557 557
558 hasInit.value = true 558 hasInit.value = true
559 if (pageError) { 559 if (pageError) {