yuzhilin

H5稿件详情 图片加载

1 import { Action } from './Action'; 1 import { Action } from './Action';
2 interface dataObject { 2 interface dataObject {
  3 + operateType?: string
3 webViewHeight?: string 4 webViewHeight?: string
4 dataJson?: string 5 dataJson?: string
5 } 6 }
@@ -41,6 +41,7 @@ export function performJSCallNative(data: Message, call: Callback) { @@ -41,6 +41,7 @@ export function performJSCallNative(data: Message, call: Callback) {
41 class AppInfo { 41 class AppInfo {
42 plat: string = '' 42 plat: string = ''
43 system: string = '' 43 system: string = ''
  44 + networkStatus: number = 1
44 // TODO 完善 45 // TODO 完善
45 } 46 }
46 47
@@ -52,6 +53,7 @@ function getAppPublicInfo(): string { @@ -52,6 +53,7 @@ function getAppPublicInfo(): string {
52 info.plat = 'Phone' 53 info.plat = 'Phone'
53 // 直接用Android,后续适配再新增鸿蒙 54 // 直接用Android,后续适配再新增鸿蒙
54 info.system = 'Android' 55 info.system = 'Android'
  56 + info.networkStatus = 1
55 let result = JSON.stringify(info) 57 let result = JSON.stringify(info)
56 return result; 58 return result;
57 } 59 }
@@ -83,7 +83,7 @@ export struct WdWebLocalComponent { @@ -83,7 +83,7 @@ export struct WdWebLocalComponent {
83 //webview 高度设置 83 //webview 高度设置
84 private setCurrentPageOperate: (data: Message) => void = (data) => { 84 private setCurrentPageOperate: (data: Message) => void = (data) => {
85 console.log("setCurrentPageOperate", JSON.stringify(data)) 85 console.log("setCurrentPageOperate", JSON.stringify(data))
86 - if (data.handlerName === H5CallNativeType.jsCall_currentPageOperate) { 86 + if (data.handlerName === H5CallNativeType.jsCall_currentPageOperate && data?.data?.operateType === '8') {
87 if (typeof this.webHeight === 'number') { 87 if (typeof this.webHeight === 'number') {
88 if (Number(data?.data?.webViewHeight) > this.webHeight) { 88 if (Number(data?.data?.webViewHeight) > this.webHeight) {
89 this.webHeight = Number(data?.data?.webViewHeight) 89 this.webHeight = Number(data?.data?.webViewHeight)
1 export interface H5ReceiveDataExtraBean { 1 export interface H5ReceiveDataExtraBean {
2 creatorId: string; 2 creatorId: string;
3 isLogin: string; 3 isLogin: string;
  4 + networkStatus: number;
  5 + loadImageOnlyWifiSwitch: string
4 } 6 }
@@ -55,7 +55,13 @@ export struct ImageAndTextWebComponent { @@ -55,7 +55,13 @@ export struct ImageAndTextWebComponent {
55 } 55 }
56 56
57 // TODO 对接user信息、登录情况 57 // TODO 对接user信息、登录情况
58 - let h5ReceiveDataExtraBean: H5ReceiveDataExtraBean = { creatorId: '', isLogin: '0' } as H5ReceiveDataExtraBean 58 + let h5ReceiveDataExtraBean: H5ReceiveDataExtraBean = {
  59 + creatorId: '',
  60 + isLogin: '0',
  61 + networkStatus: 1,
  62 + loadImageOnlyWifiSwitch: '2',
  63 +
  64 + } as H5ReceiveDataExtraBean
59 let h5ReceiveDataJsonBean: H5ReceiveDataJsonBean = { 65 let h5ReceiveDataJsonBean: H5ReceiveDataJsonBean = {
60 contentId: contentId, 66 contentId: contentId,
61 contentType: contentType 67 contentType: contentType
@@ -86,7 +92,7 @@ export struct ImageAndTextWebComponent { @@ -86,7 +92,7 @@ export struct ImageAndTextWebComponent {
86 webResource: $rawfile('apph5/index.html'), 92 webResource: $rawfile('apph5/index.html'),
87 backVisibility: false, 93 backVisibility: false,
88 onWebPrepared: this.onWebPrepared.bind(this), 94 onWebPrepared: this.onWebPrepared.bind(this),
89 - isPageEnd:$isPageEnd 95 + isPageEnd: $isPageEnd
90 96
91 }) 97 })
92 } 98 }
@@ -33,7 +33,7 @@ struct DefaultWebPage { @@ -33,7 +33,7 @@ struct DefaultWebPage {
33 webUrl: this.url, 33 webUrl: this.url,
34 backVisibility: false, 34 backVisibility: false,
35 reload: this.reload, 35 reload: this.reload,
36 - isPageEnd:this.isPageEnd 36 + isPageEnd:$isPageEnd
37 }) 37 })
38 } 38 }
39 } 39 }