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-07-17 18:03:35 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
b54a6dd824fa9fc51be14523d49a5f2d16c6a741
b54a6dd8
2 parents
656b3dcc
df584660
Merge branch 'main' of
http://192.168.1.42/developOne/harmonyPool
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
142 additions
and
102 deletions
sight_harmony/commons/wdJsBridge/src/main/ets/bean/Message.ets
sight_harmony/commons/wdWebComponent/src/main/ets/pages/WdWebComponent.ets
sight_harmony/features/wdBean/Index.ets
sight_harmony/features/wdBean/src/main/ets/bean/content/TopicDetailData.ets
sight_harmony/features/wdComponent/src/main/ets/components/SpacialTopicPageComponent.ets
sight_harmony/features/wdComponent/src/main/ets/repository/PageRepository.ets
sight_harmony/commons/wdJsBridge/src/main/ets/bean/Message.ets
View file @
b54a6dd
...
...
@@ -24,7 +24,7 @@ interface dataObject {
// 9、活动投稿 视频跳转
// 10、活动投稿 动态跳转
// 11、活动投稿 图集跳转
dataSource:
string
dataSource:
WDH5WebDataSource
operateType?: string
webViewHeight?: string
dataJson?: string
...
...
@@ -69,3 +69,20 @@ export class Message {
return JSON.parse(jsonStr)
}
}
export enum WDH5WebDataSource {
WDH5WebDataSourceUnknown = 0,
WDH5WebDataSourceImageTextDetail = 1,
WDH5WebDataSourceContentInfo = 2,
WDH5WebDataSourcePictures = 3,
WDH5WebDataSourceTopicPageInfo = 4,
WDH5WebDataSourceCompPositionData = 5,
WDH5WebDataSourceArticleRefDataJump = 6,
WDH5WebDataSourceSharePosterListDatas = 7,
WDH5WebDataSourcePartinActivityPublishArticle = 8,
WDH5WebDataSourcePartinActivityPublishVideo = 9,
WDH5WebDataSourcePartinActivityPublishDynamic = 10,
WDH5WebDataSourcePartinActivityPublishPicture = 11,
}
\ No newline at end of file
...
...
sight_harmony/commons/wdWebComponent/src/main/ets/pages/WdWebComponent.ets
View file @
b54a6dd
...
...
@@ -5,7 +5,8 @@ import { setDefaultNativeWebSettings } from './WebComponentUtil';
import { Action } from 'wdBean';
import { performJSCallNative } from './JsBridgeBiz';
import { H5CallNativeType } from './H5CallNativeType';
import { Message } from 'wdJsBridge/src/main/ets/bean/Message';
import { Message,WDH5WebDataSource } from 'wdJsBridge/src/main/ets/bean/Message';
import { JSON } from '@kit.ArkTS';
const TAG = 'WdWebComponent';
...
...
@@ -14,6 +15,9 @@ export struct WdWebComponent {
webviewControl: BridgeWebViewControl = new BridgeWebViewControl()
onWebPrepared: () => void = () => {
}
receiveH5SendToNativeData: (dataString:string | undefined) => void = () =>{
}
@Prop webUrl: string = ''
@Prop @Watch('onReloadStateChanged') reload: number = 0
@Link isPageEnd: boolean
...
...
@@ -61,16 +65,26 @@ export struct WdWebComponent {
* 默认【CallNative】逻辑处理
*/
private defaultPerformJSCallNative: (data: Message, f: Callback) => void = (data: Message, f: Callback) => {
// H5内部跳转逻辑(前端调用原生的js方法处理)
performJSCallNative(data, f)
}
/**
* 获取前端返回的数据
*/
private defaultGetReceiveSubjectData: (data: Message, f: Callback) => void = (data: Message, f: Callback) => {
if(data.handlerName === H5CallNativeType.jsCall_receiveSubjectData) {
f('')
return
}
if (data.handlerName === H5CallNativeType.jsCall_receiveH5Data) {
if (data.data?.dataSource === WDH5WebDataSource.WDH5WebDataSourceTopicPageInfo) {
this.receiveH5SendToNativeData(data.data?.dataJson)
return
}
}
}
onPageBegin: (url?: string) => void = () => {
Logger.debug(TAG, 'onPageBegin');
this.registerHandlers();
...
...
sight_harmony/features/wdBean/Index.ets
View file @
b54a6dd
...
...
@@ -175,6 +175,7 @@ export { MasterDetailRes } from './src/main/ets/bean/user/MasterDetailRes';
export { ReserveItemBean } from './src/main/ets/bean/live/ReserveItemBean';
export { PageTrackBean } from './src/main/ets/bean/component/PageTrackBean';
export { TopicDetailData,GroupItem } from './src/main/ets/bean/content/TopicDetailData'
export { FeedbackTypeBean } from './src/main/ets/bean/detail/FeedbackTypeBean';
...
...
sight_harmony/features/wdBean/src/main/ets/bean/content/TopicDetailData.ets
0 → 100644
View file @
b54a6dd
import { TopicInfo } from '../morningevening/TopicInfo';
import { ArrayList } from '@kit.ArkTS';
export interface GroupItem {
id: number;
blockDesc: string;
groupStrategy: number;
itemNum: number;
showType: number;
sortValue: number;
}
export interface TopicDetailData {
backIconUrl: string;
shareSummary: string;
id: number;
baselineCopywriting: string;
cornersAdv: string;
backgroundImgUrl: string;
description: string;
imgSize: string;
pageTopType: number;
pushupLogoImgUrl: string;
backgroundColor: string;
shareCoverUrl: string;
shareName: string;
mainLogoImgUrl: string;
titleColor: string;
baselineShow: number;
pageType: number;
shareIconUrl: string;
shareUrl: string;
name: string;
hasAdInfo: number;
hasPopUp: number;
statusBarColor: string;
templateType: number;
topicInfo: TopicInfo;
baselineColor: string;
groups: ArrayList<GroupItem>;
}
\ No newline at end of file
...
...
sight_harmony/features/wdComponent/src/main/ets/components/SpacialTopicPageComponent.ets
View file @
b54a6dd
import { Action, H5ReceiveDetailBean, ContentDetailDTO, InteractDataDTO, TopicInfo } from 'wdBean';
import { Action, H5ReceiveDetailBean, ContentDetailDTO, InteractDataDTO, TopicInfo
,TopicDetailData,ShareInfoDTO
} from 'wdBean';
import { WdWebComponent } from 'wdWebComponent';
import { CommonConstants } from 'wdConstant'
import { BridgeWebViewControl } from 'wdJsBridge/Index';
...
...
@@ -7,7 +7,7 @@ import { OperRowListView } from './view/OperRowListView';
import DetailViewModel from '../viewmodel/DetailViewModel';
import { publishCommentModel } from '../components/comment/model/PublishCommentModel';
import { EmptyComponent } from '../components/view/EmptyComponent';
import { NetworkUtil, WindowModel } from 'wdKit';
import { NetworkUtil, WindowModel
,Logger
} from 'wdKit';
import { viewBlogItemInsightIntentShare } from '../utils/InsightIntentShare'
import { common } from '@kit.AbilityKit';
import { PageRepository } from '../repository/PageRepository';
...
...
@@ -34,7 +34,7 @@ export struct SpacialTopicPageComponent {
@Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean
private webPrepared = false;
private dataPrepared = false;
//
private dataPrepared = false;
@State publishCommentModel: publishCommentModel = new publishCommentModel()
@State operationButtonList: string[] = ['comment', 'collect', 'share']
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
...
...
@@ -42,9 +42,12 @@ export struct SpacialTopicPageComponent {
@Provide topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
@State showComment: boolean = false
@State topicInfo: TopicInfo = {} as TopicInfo
@State topicDetail: TopicDetailData = {} as TopicDetailData
@State shareInfo: ShareInfoDTO = {} as ShareInfoDTO
@State showBottomView: boolean = false;
private trySendData2H5() {
if (!this.webPrepared
|| !this.dataPrepared
) {
if (!this.webPrepared) {
return
}
// 数据、web组件,都准备好了,开始塞详情数据
...
...
@@ -57,73 +60,52 @@ export struct SpacialTopicPageComponent {
}
private sendContentData2H5(h5ReceiveAppData: H5ReceiveDetailBean) {
Logger.debug('SpacialTopicPageComponent', 'jsCall_receiveAppData',JSON.stringify(h5ReceiveAppData));
this.webviewControl.callHandle(NativeCallH5Type.jsCall_receiveAppData,
JSON.stringify(h5ReceiveAppData), (data: string) => {
Logger.debug('SpacialTopicPageComponent', "from js data = " + data);
})
}
//意图上报
private viewBlogInsightIntentShare(){
let context = getContext(this) as common.UIAbilityContext;
viewBlogItemInsightIntentShare(context,this.contentDetailData)
}
async getWebviewPageData (){
let pageId = this.action.params?.extra?.pageId
let relId: string = ''
let relType: string = ''
let contentId: string = ''
if (this.action && this.action.params) {
if (this.action.params.contentID) {
contentId = this.action.params.contentID;
}
if (this.action && this.action.params && this.action.params.extra) {
if (this.action.params.extra.relId) {
relId = this.action.params.extra.relId;
}
if (this.action.params.extra.relType) {
relType = this.action.params.extra.relType
}
}
private receiveH5SendToNativeData(dataString:string | undefined) {
// this.topicDetail = JSON.parse(dataString);
if (dataString == undefined) {
return
}
if(pageId){
// let pageInfoMsg = await PageRepository.fetchMorningEveningPageInfo(pageId)
// let pageCompInfoMsg = await PageRepository.fetchMorningEveningCompInfo(Number(pageId), groupId, refreshTime, topicId, 1, 20)
// let res = {
// dataJson: {
// pageInfoResponseMap: pageInfoMsg,
// compInfoResponseMap: pageCompInfoMsg,
// },
// }
Logger.debug('SpacialTopicPageComponent111',dataString);
this.topicDetail = JSON.parse(dataString);
this.topicInfo = this.topicDetail.topicInfo;
if(this.topicInfo){
// 转换详情数据
this.contentDetailData.openComment = Number(this.topicInfo.commentFlag)
this.contentDetailData.commentDisplay = Number(this.topicInfo.commentShowFlag)
this.contentDetailData.newsId = Number(this.topicInfo.topicId)
this.contentDetailData.newsType = this.topicInfo.topicType
this.contentDetailData.newsTitle = this.topicInfo.title;
this.contentDetailData.newsType = this.topicInfo.topicType;
this.contentDetailData.visitorComment = this.topicInfo.visitorComment;
//转换分享数据
this.shareInfo.shareCoverUrl = this.topicInfo.shareCoverUrl
this.shareInfo.shareOpen = this.topicInfo.shareOpen
this.shareInfo.sharePosterCoverUrl = this.topicInfo.sharePosterCoverUrl
this.shareInfo.shareSummary = this.topicInfo.shareSummary
this.shareInfo.shareTitle = this.topicInfo.shareTitle
this.shareInfo.shareUrl = this.topicInfo.shareUrl
this.contentDetailData.shareInfo = this.shareInfo
console.log('contentDetailData111', JSON.stringify(this.contentDetailData))
if(this.topicInfo.shareOpen === 1){
if (!this.operationButtonList.includes('share')) {
this.operationButtonList.push('share');
}
} else {
this.operationButtonList = this.operationButtonList.filter(e =>e !== 'share')
}
private async getDetail() {
this.isNetConnected = NetworkUtil.isNetConnected()
let contentId: string = ''
let relId: string = ''
let relType: string = ''
if (this.action && this.action.params) {
if (this.action.params.contentID) {
contentId = this.action.params.contentID;
}
if (this.action && this.action.params && this.action.params.extra) {
if (this.action.params.extra.relId) {
relId = this.action.params.extra.relId;
}
if (this.action.params.extra.relType) {
relType = this.action.params.extra.relType
}
}
let pageId = this.action.params.extra?.pageId
console.log('pageIdpageId',pageId)
if(pageId){
let pageInfoMsg = await PageRepository.fetchMorningEveningPageInfo(pageId,contentId)
let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType)
if (detailBeans?.length > 0) {
this.contentDetailData = JSON.parse(JSON.stringify(detailBeans[0]));
this.viewBlogInsightIntentShare()
// if (this.contentDetailData[0]?.openComment) {
// 转换评论数据
this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')
this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId || '')
this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle
...
...
@@ -132,59 +114,40 @@ export struct SpacialTopicPageComponent {
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle || '')
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType || '')
this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment || '')
this.showBottomView = true
// }
this.subjectData = 'dasdasdadas'
//TODO
// this.trySendData2H5()
}
if(pageInfoMsg && pageInfoMsg.data){
this.contentDetailData.openComment = Number(pageInfoMsg.data.topicInfo?.commentFlag)
this.contentDetailData.commentDisplay = Number(pageInfoMsg.data.topicInfo?.commentShowFlag)
console.log('contentDetailData pageInfoMsg.data', JSON.stringify(pageInfoMsg.data))
this.topicInfo = pageInfoMsg.data.topicInfo
this.contentDetailData.newsId = Number(this.topicInfo.topicId)
this.contentDetailData.newsType = this.topicInfo.topicType
if(this.topicInfo?.shareOpen === 1){
this.contentDetailData.shareInfo.shareOpen = this.topicInfo?.shareOpen
console.log('contentDetailData this.topicInfo', JSON.stringify(this.topicInfo))
if (!this.operationButtonList.includes('share')) {
this.operationButtonList.push('share');
}
} else {
this.operationButtonList = this.operationButtonList.filter(e =>e !== 'share')
}
// this.viewBlogInsightIntentShare();
}
console.log('contentDetailData', JSON.stringify(this.contentDetailData))
}
}
//意图上报
private viewBlogInsightIntentShare(){
let context = getContext(this) as common.UIAbilityContext;
viewBlogItemInsightIntentShare(context,this.contentDetailData)
}
build() {
Column() {
Stack({ alignContent: Alignment.Bottom }) {
Column() {
Text(this.contentDetailData?.newsTitle)
.backgroundColor(Color.White)
.width('100%')
.height(40)
.fontSize(18)
.textAlign(TextAlign.Center)
.fontWeight(500)
.visibility(this.action?.params?.backVisibility && this.isPageEnd ? Visibility.Visible : Visibility.None)
if(this.subjectData.length > 0){
// Text(this.contentDetailData?.newsTitle)
// .backgroundColor(Color.White)
// .width('100%')
// .height(40)
// .fontSize(18)
// .textAlign(TextAlign.Center)
// .fontWeight(500)
// .visibility(this.action?.params?.backVisibility && this.isPageEnd ? Visibility.Visible : Visibility.None)
WdWebComponent({
webviewControl: this.webviewControl,
webUrl: this.webUrl,
reload: this.reload,
onWebPrepared: this.onWebPrepared.bind(this),
isPageEnd: $isPageEnd,
subjectData: this.subjectData
receiveH5SendToNativeData: this.receiveH5SendToNativeData.bind(this)
})
}
}
.width(CommonConstants.FULL_WIDTH)
.height(CommonConstants.FULL_HEIGHT)
.padding({ bottom: this.action?.params?.backVisibility ? 115 : 75 })
...
...
@@ -194,7 +157,8 @@ export struct SpacialTopicPageComponent {
emptyType: 1,
emptyButton: true,
retry: () => {
this.getDetail()
// this.getDetail()
this.reload ++
}
}).padding({ bottom: 200 })
} else {
...
...
@@ -203,6 +167,7 @@ export struct SpacialTopicPageComponent {
}
}
//底部交互区
if (this.showBottomView){
OperRowListView({
contentDetailData: this.contentDetailData,
publishCommentModel: this.publishCommentModel,
...
...
@@ -222,6 +187,7 @@ export struct SpacialTopicPageComponent {
interactData: $interactData,
}).visibility(this.showComment?Visibility.Visible:Visibility.Hidden)
}
}
}.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT)
}
...
...
@@ -230,7 +196,8 @@ export struct SpacialTopicPageComponent {
// WindowModel.shared.setWindowLayoutFullScreen(true)
}
this.webUrl = this.action?.params?.url || ''
this.getDetail()
this.isNetConnected = NetworkUtil.isNetConnected()
// this.getDetail()
}
aboutToDisappear() {
...
...
sight_harmony/features/wdComponent/src/main/ets/repository/PageRepository.ets
View file @
b54a6dd
...
...
@@ -312,7 +312,7 @@ export class PageRepository {
// 批量查询内容当前用户点赞、收藏状态
static fetchInteractDataStatus(param: object) {
let url = PageRepository.getInteractDataStatusUrl()
return
WDHttp
.post<ResponseDTO<batchLikeAndCollectResult[]>>(url, param)
return
HttpBizUtil
.post<ResponseDTO<batchLikeAndCollectResult[]>>(url, param)
};
/**
...
...
Please
register
or
login
to post a comment