ImageAndTextWebComponent.ets
3.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import {
Action,
ContentDetailDTO,
H5ReceiveDataExtraBean,
H5ReceiveDataJsonBean,
H5ReceiveDetailBean,
ResponseBean
} from 'wdBean';
import { Logger } from 'wdKit';
import { WdWebComponent, WdWebLocalComponent } from 'wdWebComponent';
import { BridgeWebViewControl } from '../../../../../../commons/wdWebComponent/oh_modules/wdJsBridge/Index';
@Component
export struct ImageAndTextWebComponent {
webviewControl: BridgeWebViewControl = new BridgeWebViewControl()
action: Action = {} as Action
@State reload: number = 0;
@Prop @Watch('onDetailDataUpdated') detailData: ContentDetailDTO = {} as ContentDetailDTO
onDetailDataUpdated() {
// if (this.action) {
// let contentId: string = ''
// let contentType: string = ''
// let topicId: string = ''
// let channelId: string = ''
// let compId: string = ''
// let sourcePage: string = '5'
// if (this.action.params) {
// if (this.action.params.contentID) {
// contentId = this.action.params?.contentID
// }
// if (this.action.params.extra) {
// if (this.action.params.extra.contentType) {
// contentType = this.action.params.extra.contentType
// }
// if (this.action.params.extra.topicId) {
// topicId = this.action.params.extra.topicId
// }
// if (this.action.params.extra.channelId) {
// channelId = this.action.params.extra.channelId
// }
// if (this.action.params.extra.compId) {
// compId = this.action.params.extra.compId
// }
// if (this.action.params.extra.sourcePage) {
// sourcePage = this.action.params.extra.sourcePage
// }
// }
//
// }
//
// let h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean
// let h5ReceiveDataExtraBean: H5ReceiveDataExtraBean = { creatorId: '', isLogin: '0' } as H5ReceiveDataExtraBean
// let h5ReceiveDataJsonBean: H5ReceiveDataJsonBean = {
// contentId: contentId,
// contentType: contentType
// } as H5ReceiveDataJsonBean
// h5ReceiveDataJsonBean.topicId = topicId
// h5ReceiveDataJsonBean.channelId = channelId
// h5ReceiveDataJsonBean.compId = compId
// h5ReceiveDataJsonBean.sourcePage = sourcePage
// h5ReceiveDataJsonBean.netError = '0'
// let response: ResponseBean = {} as ResponseBean
// response.data = this.detailData
// response.code = 0
// response.success = true
// h5ReceiveDataJsonBean.responseMap = response
// h5ReceiveAppData.dataJson = h5ReceiveDataJsonBean
// h5ReceiveAppData.dataExt = h5ReceiveDataExtraBean
// this.webviewControl.callHandle("jsCall_receiveAppData", JSON.stringify(h5ReceiveAppData), (data: string) => {
// Logger.info("from js data = " + data);
// })
// }
}
build() {
Column() {
if (this.detailData && this.detailData.shareInfo && this.detailData.shareInfo.shareUrl){
WdWebComponent({
webviewControl: this.webviewControl,
webUrl: this.detailData?.shareInfo?.shareUrl,
backVisibility: false,
})
}
}
}
}