Showing
11 changed files
with
181 additions
and
137 deletions
| @@ -157,7 +157,7 @@ export class ProcessUtils { | @@ -157,7 +157,7 @@ export class ProcessUtils { | ||
| 157 | * 图集详情页 | 157 | * 图集详情页 |
| 158 | * @param content | 158 | * @param content |
| 159 | * */ | 159 | * */ |
| 160 | - public static gotoMultiPictureListPage(photoList: PhotoListBean[], swiperIndex?:number) { | 160 | + public static gotoMultiPictureListPage(photoList: PhotoListBean[], swiperIndex?: number) { |
| 161 | let taskAction: Action = { | 161 | let taskAction: Action = { |
| 162 | type: 'JUMP_DETAIL_PAGE', | 162 | type: 'JUMP_DETAIL_PAGE', |
| 163 | params: { | 163 | params: { |
| @@ -187,8 +187,14 @@ export class ProcessUtils { | @@ -187,8 +187,14 @@ export class ProcessUtils { | ||
| 187 | let taskAction: Action = { | 187 | let taskAction: Action = { |
| 188 | type: 'JUMP_INNER_NEW_PAGE', | 188 | type: 'JUMP_INNER_NEW_PAGE', |
| 189 | params: { | 189 | params: { |
| 190 | + contentID: content?.objectId, | ||
| 190 | url: content.linkUrl, | 191 | url: content.linkUrl, |
| 191 | pageID: 'SPACIAL_TOPIC_PAGE', | 192 | pageID: 'SPACIAL_TOPIC_PAGE', |
| 193 | + extra: { | ||
| 194 | + relType: content?.relType, | ||
| 195 | + relId: content?.relId, | ||
| 196 | + channelId: content?.channelId, | ||
| 197 | + } as ExtraDTO | ||
| 192 | } as Params, | 198 | } as Params, |
| 193 | }; | 199 | }; |
| 194 | WDRouterRule.jumpWithAction(taskAction) | 200 | WDRouterRule.jumpWithAction(taskAction) |
| @@ -423,11 +429,10 @@ export class ProcessUtils { | @@ -423,11 +429,10 @@ export class ProcessUtils { | ||
| 423 | 429 | ||
| 424 | /** | 430 | /** |
| 425 | * 跳转人民号主页 | 431 | * 跳转人民号主页 |
| 426 | - *@params creatorId 创作者id | 432 | + * @params creatorId 创作者id |
| 427 | */ | 433 | */ |
| 428 | public static gotoPeopleShipHomePage(creatorId: string) { | 434 | public static gotoPeopleShipHomePage(creatorId: string) { |
| 429 | - let params = {'creatorId': creatorId} as Record<string, string>; | 435 | + let params = { 'creatorId': creatorId } as Record<string, string>; |
| 430 | WDRouterRule.jumpWithPage(WDRouterPage.peopleShipHomePage, params) | 436 | WDRouterRule.jumpWithPage(WDRouterPage.peopleShipHomePage, params) |
| 431 | } | 437 | } |
| 432 | - | ||
| 433 | } | 438 | } |
| 1 | -import HashMap from '@ohos.util.HashMap'; | ||
| 2 | import { Callback } from 'wdJsBridge'; | 1 | import { Callback } from 'wdJsBridge'; |
| 3 | import { Message, IImgListData } from 'wdJsBridge/src/main/ets/bean/Message'; | 2 | import { Message, IImgListData } from 'wdJsBridge/src/main/ets/bean/Message'; |
| 4 | -import { Logger } from 'wdKit'; | 3 | +import { Logger, SPHelper } from 'wdKit'; |
| 5 | import { H5CallNativeType } from './H5CallNativeType'; | 4 | import { H5CallNativeType } from './H5CallNativeType'; |
| 6 | import { H5OperateType } from './H5OperateType'; | 5 | import { H5OperateType } from './H5OperateType'; |
| 7 | -import { ContentConstants } from 'wdConstant'; | 6 | +import { ContentConstants, SpConstants } from 'wdConstant'; |
| 8 | import { ProcessUtils } from 'wdRouter'; | 7 | import { ProcessUtils } from 'wdRouter'; |
| 9 | import router from '@ohos.router'; | 8 | import router from '@ohos.router'; |
| 10 | import Url from '@ohos.url' | 9 | import Url from '@ohos.url' |
| 11 | import { ContentDTO, PhotoListBean } from 'wdBean'; | 10 | import { ContentDTO, PhotoListBean } from 'wdBean'; |
| 12 | -import { ResponseDTO, WDHttp, HttpUrlUtils } from 'wdNetwork'; | 11 | +import { handleJsCallAppService } from './JsCallAppService' |
| 13 | 12 | ||
| 14 | const TAG = 'JsBridgeBiz' | 13 | const TAG = 'JsBridgeBiz' |
| 15 | 14 | ||
| @@ -20,6 +19,19 @@ class AppInfo { | @@ -20,6 +19,19 @@ class AppInfo { | ||
| 20 | // TODO 完善 | 19 | // TODO 完善 |
| 21 | } | 20 | } |
| 22 | 21 | ||
| 22 | +class AppLoginAuthInfo { | ||
| 23 | + "X-Ca-Stage": string = '' | ||
| 24 | + userType: number = SPHelper.default.getSync(SpConstants.USER_Type, '') as number | ||
| 25 | + userName: string = SPHelper.default.getSync(SpConstants.USER_NAME, '') as string | ||
| 26 | + userID: string = SPHelper.default.getSync(SpConstants.USER_ID, '') as string | ||
| 27 | + "RMRB-X-TOKEN": string = SPHelper.default.getSync(SpConstants.USER_TEMP_TOKEN, '') as string | ||
| 28 | + phoneNumber: string = SPHelper.default.getSync(SpConstants.USER_PHONE, '') as string | ||
| 29 | + nickName: string = '' | ||
| 30 | + isLogined: string = SPHelper.default.getSync(SpConstants.USER_STATUS, '') as string | ||
| 31 | + creatorID: string = SPHelper.default.getSync(SpConstants.USER_CREATOR_ID, '') as string | ||
| 32 | + Authorization: string = '' | ||
| 33 | +} | ||
| 34 | + | ||
| 23 | /** | 35 | /** |
| 24 | * h5调用native代码 | 36 | * h5调用native代码 |
| 25 | * @param data | 37 | * @param data |
| @@ -39,7 +51,7 @@ export function performJSCallNative(data: Message, call: Callback) { | @@ -39,7 +51,7 @@ export function performJSCallNative(data: Message, call: Callback) { | ||
| 39 | case H5CallNativeType.jsCall_getArticleDetailBussinessData: | 51 | case H5CallNativeType.jsCall_getArticleDetailBussinessData: |
| 40 | break; | 52 | break; |
| 41 | case H5CallNativeType.jsCall_callAppService: | 53 | case H5CallNativeType.jsCall_callAppService: |
| 42 | - handleJsCallCallAppService(data, (res: string) => { | 54 | + handleJsCallAppService(data, (res: string) => { |
| 43 | call(res) | 55 | call(res) |
| 44 | }) | 56 | }) |
| 45 | break; | 57 | break; |
| @@ -49,6 +61,9 @@ export function performJSCallNative(data: Message, call: Callback) { | @@ -49,6 +61,9 @@ export function performJSCallNative(data: Message, call: Callback) { | ||
| 49 | case H5CallNativeType.jsCall_appInnerLinkMethod: | 61 | case H5CallNativeType.jsCall_appInnerLinkMethod: |
| 50 | handleJsCallAppInnerLinkMethod(data) | 62 | handleJsCallAppInnerLinkMethod(data) |
| 51 | break; | 63 | break; |
| 64 | + case H5CallNativeType.jsCall_getAppLoginAuthInfo: | ||
| 65 | + call(handleJsCallGetAppLoginAuthInfo()) | ||
| 66 | + break; | ||
| 52 | default: | 67 | default: |
| 53 | break; | 68 | break; |
| 54 | } | 69 | } |
| @@ -64,21 +79,6 @@ function handleJsCallCurrentPageOperate(data: Message) { | @@ -64,21 +79,6 @@ function handleJsCallCurrentPageOperate(data: Message) { | ||
| 64 | } | 79 | } |
| 65 | } | 80 | } |
| 66 | 81 | ||
| 67 | -function handleJsCallCallAppService(data: Message, callback: (res: string) => void) { | ||
| 68 | - let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | ||
| 69 | - let url: string = HttpUrlUtils.getHost() + data?.data?.url | ||
| 70 | - if (data?.data?.method === 'get') { | ||
| 71 | - WDHttp.get<ResponseDTO<string>>(url, headers).then((res: ResponseDTO<string>) => { | ||
| 72 | - callback(JSON.stringify(res)) | ||
| 73 | - }) | ||
| 74 | - } | ||
| 75 | - if (data?.data?.method === 'post') { | ||
| 76 | - WDHttp.post<ResponseDTO<string>>(url, data?.data?.parameters, headers).then(res => { | ||
| 77 | - callback(JSON.stringify(res)) | ||
| 78 | - }) | ||
| 79 | - } | ||
| 80 | -} | ||
| 81 | - | ||
| 82 | /** | 82 | /** |
| 83 | * 获取App公共信息 | 83 | * 获取App公共信息 |
| 84 | */ | 84 | */ |
| @@ -90,12 +90,11 @@ function getAppPublicInfo(): string { | @@ -90,12 +90,11 @@ function getAppPublicInfo(): string { | ||
| 90 | info.networkStatus = 1 | 90 | info.networkStatus = 1 |
| 91 | let result = JSON.stringify(info) | 91 | let result = JSON.stringify(info) |
| 92 | Logger.debug(TAG, 'getAppPublicInfo: ' + JSON.stringify(info)) | 92 | Logger.debug(TAG, 'getAppPublicInfo: ' + JSON.stringify(info)) |
| 93 | - | ||
| 94 | return result; | 93 | return result; |
| 95 | } | 94 | } |
| 96 | 95 | ||
| 97 | function handleJsCallReceiveH5Data(data: Message) { | 96 | function handleJsCallReceiveH5Data(data: Message) { |
| 98 | - switch (data?.data?.dataSource) { | 97 | + switch (String(data?.data?.dataSource)) { |
| 99 | case '3': | 98 | case '3': |
| 100 | let imgListData: IImgListData = JSON.parse(data?.data?.imgListData || "{}") | 99 | let imgListData: IImgListData = JSON.parse(data?.data?.imgListData || "{}") |
| 101 | let imgArr = imgListData?.imgArr || [] | 100 | let imgArr = imgListData?.imgArr || [] |
| @@ -110,7 +109,7 @@ function handleJsCallReceiveH5Data(data: Message) { | @@ -110,7 +109,7 @@ function handleJsCallReceiveH5Data(data: Message) { | ||
| 110 | } | 109 | } |
| 111 | return photo | 110 | return photo |
| 112 | }) | 111 | }) |
| 113 | - ProcessUtils.gotoMultiPictureListPage(photoList,swiperIndex) | 112 | + ProcessUtils.gotoMultiPictureListPage(photoList, swiperIndex) |
| 114 | } | 113 | } |
| 115 | break; | 114 | break; |
| 116 | case '5': | 115 | case '5': |
| @@ -183,3 +182,9 @@ function handleJsCallAppInnerLinkMethod(data: Message) { | @@ -183,3 +182,9 @@ function handleJsCallAppInnerLinkMethod(data: Message) { | ||
| 183 | } | 182 | } |
| 184 | } | 183 | } |
| 185 | } | 184 | } |
| 185 | + | ||
| 186 | +function handleJsCallGetAppLoginAuthInfo() { | ||
| 187 | + let appLoginAuthInfo = new AppLoginAuthInfo() | ||
| 188 | + let result = JSON.stringify(appLoginAuthInfo) | ||
| 189 | + return result; | ||
| 190 | +} |
| 1 | +import HashMap from '@ohos.util.HashMap'; | ||
| 2 | +import { Message } from 'wdJsBridge/src/main/ets/bean/Message'; | ||
| 3 | +import { H5ReceiveDataJsonBean, postBatchAttentionStatusResult } from 'wdBean'; | ||
| 4 | +import { ResponseDTO, WDHttp, HttpUrlUtils } from 'wdNetwork'; | ||
| 5 | + | ||
| 6 | +const TAG = 'JsCallAppService' | ||
| 7 | + | ||
| 8 | + | ||
| 9 | +export function handleJsCallAppService(data: Message, callback: (res: string) => void) { | ||
| 10 | + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | ||
| 11 | + let url: string = HttpUrlUtils.getHost() + data?.data?.url | ||
| 12 | + | ||
| 13 | + let responseMap: ResponseDTO<postBatchAttentionStatusResult> = {} as ResponseDTO<postBatchAttentionStatusResult> | ||
| 14 | + | ||
| 15 | + let h5ReceiveDataJson: H5ReceiveDataJsonBean<ResponseDTO<postBatchAttentionStatusResult>> = { | ||
| 16 | + netError: '0', | ||
| 17 | + responseMap | ||
| 18 | + } as H5ReceiveDataJsonBean<ResponseDTO<postBatchAttentionStatusResult>> | ||
| 19 | + | ||
| 20 | + // if (data?.data?.method === 'get') { | ||
| 21 | + // WDHttp.get<ResponseDTO<postBatchAttentionStatusResult>>(url, headers).then((res: ResponseDTO<postBatchAttentionStatusResult>) => { | ||
| 22 | + // callback(JSON.stringify(res)) | ||
| 23 | + // }) | ||
| 24 | + // } | ||
| 25 | + if (data?.data?.method === 'post' && data?.data?.url === '/api/rmrb-interact/interact/zh/c/batchAttention/status') { | ||
| 26 | + WDHttp.post<ResponseDTO<postBatchAttentionStatusResult>>(url, data?.data?.parameters, headers).then((res: ResponseDTO<postBatchAttentionStatusResult>) => { | ||
| 27 | + h5ReceiveDataJson.responseMap = res | ||
| 28 | + callback(JSON.stringify(h5ReceiveDataJson)) | ||
| 29 | + }) | ||
| 30 | + } | ||
| 31 | +} |
| 1 | export interface H5ReceiveDataExtraBean { | 1 | export interface H5ReceiveDataExtraBean { |
| 2 | creatorId: string; | 2 | creatorId: string; |
| 3 | + cnsTraceId: string; | ||
| 3 | isLogin: string; | 4 | isLogin: string; |
| 5 | + loadImageOnlyWifiSwitch: string; | ||
| 4 | networkStatus: number; | 6 | networkStatus: number; |
| 5 | - loadImageOnlyWifiSwitch: string | 7 | + darkMode: string; |
| 8 | + fontSizes: string; | ||
| 6 | } | 9 | } |
| 1 | import { ResponseBean } from './ResponseBean'; | 1 | import { ResponseBean } from './ResponseBean'; |
| 2 | 2 | ||
| 3 | -export interface H5ReceiveDataJsonBean { | ||
| 4 | - contentId: string; | ||
| 5 | - contentType: string; | ||
| 6 | - topicId: string; | ||
| 7 | - channelId: string; | ||
| 8 | - compId: string; | ||
| 9 | - sourcePage: string; | 3 | +export interface H5ReceiveDataJsonBean<T = ResponseBean> { |
| 4 | + contentId?: string; | ||
| 5 | + contentType?: string; | ||
| 6 | + topicId?: string; | ||
| 7 | + channelId?: string; | ||
| 8 | + compId?: string; | ||
| 9 | + sourcePage?: string; | ||
| 10 | netError: string; | 10 | netError: string; |
| 11 | - responseMap: ResponseBean; | 11 | + responseMap: T; |
| 12 | 12 | ||
| 13 | } | 13 | } |
| 1 | import { ContentDetailDTO } from '../detail/ContentDetailDTO'; | 1 | import { ContentDetailDTO } from '../detail/ContentDetailDTO'; |
| 2 | 2 | ||
| 3 | -export interface ResponseBean{ | ||
| 4 | - success:boolean; | 3 | +export interface ResponseBean<T = ContentDetailDTO[]> { |
| 4 | + success: boolean; | ||
| 5 | 5 | ||
| 6 | // 服务请求响应值/微服务响应状态码” | 6 | // 服务请求响应值/微服务响应状态码” |
| 7 | code: number; | 7 | code: number; |
| @@ -10,8 +10,7 @@ export interface ResponseBean{ | @@ -10,8 +10,7 @@ export interface ResponseBean{ | ||
| 10 | message: string; | 10 | message: string; |
| 11 | 11 | ||
| 12 | // 响应结果 | 12 | // 响应结果 |
| 13 | - data:ContentDetailDTO[]; | ||
| 14 | - | 13 | + data: T |
| 15 | // 请求响应时间戳(unix格式) | 14 | // 请求响应时间戳(unix格式) |
| 16 | timestamp?: number; | 15 | timestamp?: number; |
| 17 | } | 16 | } |
| @@ -13,7 +13,6 @@ import { | @@ -13,7 +13,6 @@ import { | ||
| 13 | import DetailViewModel from '../viewmodel/DetailViewModel'; | 13 | import DetailViewModel from '../viewmodel/DetailViewModel'; |
| 14 | import { ImageAndTextWebComponent } from './ImageAndTextWebComponent'; | 14 | import { ImageAndTextWebComponent } from './ImageAndTextWebComponent'; |
| 15 | import { OperRowListView } from './view/OperRowListView'; | 15 | import { OperRowListView } from './view/OperRowListView'; |
| 16 | -import router from '@ohos.router'; | ||
| 17 | import { RecommendList } from '../components/view/RecommendList' | 16 | import { RecommendList } from '../components/view/RecommendList' |
| 18 | import { CommonConstants } from 'wdConstant'; | 17 | import { CommonConstants } from 'wdConstant'; |
| 19 | import { HttpUrlUtils } from 'wdNetwork/Index'; | 18 | import { HttpUrlUtils } from 'wdNetwork/Index'; |
| @@ -21,10 +20,11 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | @@ -21,10 +20,11 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | ||
| 21 | import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; | 20 | import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; |
| 22 | import { PageRepository } from '../repository/PageRepository'; | 21 | import { PageRepository } from '../repository/PageRepository'; |
| 23 | import { detailedSkeleton } from './skeleton/detailSkeleton'; | 22 | import { detailedSkeleton } from './skeleton/detailSkeleton'; |
| 23 | +import { CommentComponent } from '../components/comment/view/CommentComponent' | ||
| 24 | 24 | ||
| 25 | const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm'; | 25 | const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm'; |
| 26 | 26 | ||
| 27 | -const TAG = 'ImageAndTextPageComponent' | 27 | +const TAG: string = 'ImageAndTextPageComponent' |
| 28 | 28 | ||
| 29 | @Component | 29 | @Component |
| 30 | export struct ImageAndTextPageComponent { | 30 | export struct ImageAndTextPageComponent { |
| @@ -75,9 +75,55 @@ export struct ImageAndTextPageComponent { | @@ -75,9 +75,55 @@ export struct ImageAndTextPageComponent { | ||
| 75 | isPageEnd: $isPageEnd | 75 | isPageEnd: $isPageEnd |
| 76 | }) | 76 | }) |
| 77 | Column() { | 77 | Column() { |
| 78 | + // 点赞 | ||
| 79 | + if (this.contentDetailData[0]?.openLikes) { | ||
| 80 | + Row() { | ||
| 81 | + Row() { | ||
| 82 | + if (this.newsStatusOfUser?.likeStatus === '1') { | ||
| 83 | + Image(this.contentDetailData[0]?.likesStyle === 1 ? $r('app.media.ic_like_check') : (this.contentDetailData[0]?.likesStyle === 2 ? $r('app.media.icon_prayer_active') : $r('app.media.icon_candle_active'))) | ||
| 84 | + .width(24) | ||
| 85 | + .height(24) | ||
| 86 | + .margin({ right: 5 }) | ||
| 87 | + } else { | ||
| 88 | + Image(this.contentDetailData[0]?.likesStyle === 1 ? $r('app.media.icon_like') : (this.contentDetailData[0]?.likesStyle === 2 ? $r('app.media.icon_prayer') : $r('app.media.icon_candle'))) | ||
| 89 | + .width(24) | ||
| 90 | + .height(24) | ||
| 91 | + .margin({ right: 5 }) | ||
| 92 | + } | ||
| 93 | + if(this.interactData?.likeNum !== '0'){ | ||
| 94 | + Text(`${this.interactData?.likeNum}`) | ||
| 95 | + .fontSize(16) | ||
| 96 | + .fontColor(this.newsStatusOfUser?.likeStatus === '1' ? '#ED2800' : '#999999') | ||
| 97 | + .fontWeight(500) | ||
| 98 | + } | ||
| 99 | + } | ||
| 100 | + .width(140) | ||
| 101 | + .height(36) | ||
| 102 | + .justifyContent(FlexAlign.Center) | ||
| 103 | + .alignItems(VerticalAlign.Center) | ||
| 104 | + .borderRadius(20) | ||
| 105 | + .border({ | ||
| 106 | + width: 1, | ||
| 107 | + color: '#EDEDED', | ||
| 108 | + }) | ||
| 109 | + .onClick(() => { | ||
| 110 | + this.toggleLikeStatus() | ||
| 111 | + }) | ||
| 112 | + | ||
| 113 | + }.width(CommonConstants.FULL_WIDTH).height(80) | ||
| 114 | + .justifyContent(FlexAlign.Center) | ||
| 115 | + | ||
| 116 | + Divider().strokeWidth(6).color('#f5f5f5') | ||
| 117 | + } | ||
| 78 | if (this.recommendList.length > 0) { | 118 | if (this.recommendList.length > 0) { |
| 79 | RecommendList({ recommendList: this.recommendList }) | 119 | RecommendList({ recommendList: this.recommendList }) |
| 80 | } | 120 | } |
| 121 | + // 评论 | ||
| 122 | + if(this.contentDetailData[0]?.openComment){ | ||
| 123 | + // CommentComponent({ | ||
| 124 | + // | ||
| 125 | + // }) | ||
| 126 | + } | ||
| 81 | } | 127 | } |
| 82 | } | 128 | } |
| 83 | 129 | ||
| @@ -95,42 +141,6 @@ export struct ImageAndTextPageComponent { | @@ -95,42 +141,6 @@ export struct ImageAndTextPageComponent { | ||
| 95 | if (this.contentDetailData?.length) { | 141 | if (this.contentDetailData?.length) { |
| 96 | OperRowListView({contentDetailData: this.contentDetailData[0]}) | 142 | OperRowListView({contentDetailData: this.contentDetailData[0]}) |
| 97 | } | 143 | } |
| 98 | - /* Row() { | ||
| 99 | - Image($r('app.media.icon_arrow_left')) | ||
| 100 | - .width(24) | ||
| 101 | - .height(24) | ||
| 102 | - .onClick((event: ClickEvent) => { | ||
| 103 | - router.back() | ||
| 104 | - }) | ||
| 105 | - | ||
| 106 | - Row() { | ||
| 107 | - Image($r('app.media.icon_comment')) | ||
| 108 | - .width(24) | ||
| 109 | - .height(24) | ||
| 110 | - .margin({ right: 24 }) | ||
| 111 | - .id('comment') | ||
| 112 | - | ||
| 113 | - Image($r('app.media.icon_star')) | ||
| 114 | - .width(24) | ||
| 115 | - .height(24) | ||
| 116 | - .margin({ right: 24 }) | ||
| 117 | - | ||
| 118 | - Image($r('app.media.icon_listen')) | ||
| 119 | - .width(24) | ||
| 120 | - .height(24) | ||
| 121 | - .margin({ right: 24 }) | ||
| 122 | - | ||
| 123 | - Image($r('app.media.icon_forward')) | ||
| 124 | - .width(24) | ||
| 125 | - .height(24) | ||
| 126 | - | ||
| 127 | - } | ||
| 128 | - } | ||
| 129 | - .width(CommonConstants.FULL_WIDTH) | ||
| 130 | - .height(56) | ||
| 131 | - .padding({ left: 15, right: 15, bottom: 50, top: 20 }) | ||
| 132 | - .justifyContent(FlexAlign.SpaceBetween) | ||
| 133 | - .backgroundColor(Color.White)*/ | ||
| 134 | } | 144 | } |
| 135 | 145 | ||
| 136 | } | 146 | } |
| @@ -12,6 +12,7 @@ import { WdWebLocalComponent } from 'wdWebComponent'; | @@ -12,6 +12,7 @@ import { WdWebLocalComponent } from 'wdWebComponent'; | ||
| 12 | import { NativeCallH5Type } from 'wdWebComponent/src/main/ets/pages/NativeCallH5Type'; | 12 | import { NativeCallH5Type } from 'wdWebComponent/src/main/ets/pages/NativeCallH5Type'; |
| 13 | import { BridgeWebViewControl } from 'wdJsBridge/Index'; | 13 | import { BridgeWebViewControl } from 'wdJsBridge/Index'; |
| 14 | 14 | ||
| 15 | +const TAG: string = 'ImageAndTextWebComponent' | ||
| 15 | @Component | 16 | @Component |
| 16 | export struct ImageAndTextWebComponent { | 17 | export struct ImageAndTextWebComponent { |
| 17 | action: Action = {} as Action | 18 | action: Action = {} as Action |
| @@ -60,9 +61,12 @@ export struct ImageAndTextWebComponent { | @@ -60,9 +61,12 @@ export struct ImageAndTextWebComponent { | ||
| 60 | // TODO 对接user信息、登录情况 | 61 | // TODO 对接user信息、登录情况 |
| 61 | let h5ReceiveDataExtraBean: H5ReceiveDataExtraBean = { | 62 | let h5ReceiveDataExtraBean: H5ReceiveDataExtraBean = { |
| 62 | creatorId: creatorId, | 63 | creatorId: creatorId, |
| 64 | + cnsTraceId: '', | ||
| 63 | isLogin: isLogin, | 65 | isLogin: isLogin, |
| 64 | - networkStatus: Number(NetworkUtil.isNetConnected()), | ||
| 65 | loadImageOnlyWifiSwitch: '2', | 66 | loadImageOnlyWifiSwitch: '2', |
| 67 | + networkStatus: Number(NetworkUtil.isNetConnected()), | ||
| 68 | + darkMode: 'light', | ||
| 69 | + fontSizes: 'normalsize' | ||
| 66 | 70 | ||
| 67 | } as H5ReceiveDataExtraBean | 71 | } as H5ReceiveDataExtraBean |
| 68 | let h5ReceiveDataJsonBean: H5ReceiveDataJsonBean = { | 72 | let h5ReceiveDataJsonBean: H5ReceiveDataJsonBean = { |
| @@ -83,7 +87,6 @@ export struct ImageAndTextWebComponent { | @@ -83,7 +87,6 @@ export struct ImageAndTextWebComponent { | ||
| 83 | this.h5ReceiveAppData.dataExt = h5ReceiveDataExtraBean | 87 | this.h5ReceiveAppData.dataExt = h5ReceiveDataExtraBean |
| 84 | this.dataPrepared = true | 88 | this.dataPrepared = true |
| 85 | this.trySendData2H5() | 89 | this.trySendData2H5() |
| 86 | - | ||
| 87 | } | 90 | } |
| 88 | 91 | ||
| 89 | } | 92 | } |
| 1 | -import { Action, H5ReceiveDetailBean } from 'wdBean'; | 1 | +import { Action, H5ReceiveDetailBean, ContentDetailDTO } from 'wdBean'; |
| 2 | import { WdWebComponent } from 'wdWebComponent'; | 2 | import { WdWebComponent } from 'wdWebComponent'; |
| 3 | import router from '@ohos.router'; | 3 | import router from '@ohos.router'; |
| 4 | import { CommonConstants } from 'wdConstant' | 4 | import { CommonConstants } from 'wdConstant' |
| 5 | import { BridgeWebViewControl } from 'wdJsBridge/Index'; | 5 | import { BridgeWebViewControl } from 'wdJsBridge/Index'; |
| 6 | import { detailedSkeleton } from './skeleton/detailSkeleton' | 6 | import { detailedSkeleton } from './skeleton/detailSkeleton' |
| 7 | import { NativeCallH5Type } from 'wdWebComponent/src/main/ets/pages/NativeCallH5Type'; | 7 | import { NativeCallH5Type } from 'wdWebComponent/src/main/ets/pages/NativeCallH5Type'; |
| 8 | -const TAG = 'SpacialTopicPageComponent' | 8 | +import { OperRowListView } from './view/OperRowListView'; |
| 9 | +import DetailViewModel from '../viewmodel/DetailViewModel'; | ||
| 10 | + | ||
| 11 | +const TAG: string = 'SpacialTopicPageComponent' | ||
| 9 | 12 | ||
| 10 | @Component | 13 | @Component |
| 11 | export struct SpacialTopicPageComponent { | 14 | export struct SpacialTopicPageComponent { |
| @@ -14,6 +17,7 @@ export struct SpacialTopicPageComponent { | @@ -14,6 +17,7 @@ export struct SpacialTopicPageComponent { | ||
| 14 | action: Action = {} as Action | 17 | action: Action = {} as Action |
| 15 | @State webUrl: string = ''; | 18 | @State webUrl: string = ''; |
| 16 | @State isPageEnd: boolean = false | 19 | @State isPageEnd: boolean = false |
| 20 | + @State contentDetailData: ContentDetailDTO [] = [] as ContentDetailDTO [] | ||
| 17 | private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean | 21 | private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean |
| 18 | private webPrepared = false; | 22 | private webPrepared = false; |
| 19 | private dataPrepared = false; | 23 | private dataPrepared = false; |
| @@ -37,11 +41,33 @@ export struct SpacialTopicPageComponent { | @@ -37,11 +41,33 @@ export struct SpacialTopicPageComponent { | ||
| 37 | }) | 41 | }) |
| 38 | } | 42 | } |
| 39 | 43 | ||
| 44 | + private async getDetail() { | ||
| 45 | + let contentId: string = '' | ||
| 46 | + let relId: string = '' | ||
| 47 | + let relType: string = '' | ||
| 48 | + if (this.action && this.action.params) { | ||
| 49 | + if (this.action.params.contentID) { | ||
| 50 | + contentId = this.action.params.contentID; | ||
| 51 | + } | ||
| 52 | + if (this.action && this.action.params && this.action.params.extra) { | ||
| 53 | + if (this.action.params.extra.relId) { | ||
| 54 | + relId = this.action.params.extra.relId; | ||
| 55 | + } | ||
| 56 | + if (this.action.params.extra.relType) { | ||
| 57 | + relType = this.action.params.extra.relType | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + } | ||
| 61 | + let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType) | ||
| 62 | + if (detailBeans && detailBeans.length > 0) { | ||
| 63 | + this.contentDetailData = detailBeans; | ||
| 64 | + this.trySendData2H5() | ||
| 65 | + } | ||
| 66 | + } | ||
| 67 | + } | ||
| 68 | + | ||
| 40 | build() { | 69 | build() { |
| 41 | Column() { | 70 | Column() { |
| 42 | - if (!this.isPageEnd) { | ||
| 43 | - detailedSkeleton() | ||
| 44 | - } | ||
| 45 | Stack({ alignContent: Alignment.Bottom }) { | 71 | Stack({ alignContent: Alignment.Bottom }) { |
| 46 | Column() { | 72 | Column() { |
| 47 | WdWebComponent({ | 73 | WdWebComponent({ |
| @@ -52,62 +78,23 @@ export struct SpacialTopicPageComponent { | @@ -52,62 +78,23 @@ export struct SpacialTopicPageComponent { | ||
| 52 | isPageEnd: $isPageEnd | 78 | isPageEnd: $isPageEnd |
| 53 | }) | 79 | }) |
| 54 | } | 80 | } |
| 55 | - .padding({ bottom: 56 }) | ||
| 56 | .width(CommonConstants.FULL_WIDTH) | 81 | .width(CommonConstants.FULL_WIDTH) |
| 57 | .height(CommonConstants.FULL_HEIGHT) | 82 | .height(CommonConstants.FULL_HEIGHT) |
| 83 | + .padding({ bottom: 126 }) | ||
| 58 | 84 | ||
| 59 | - //底部交互区 | ||
| 60 | - Row() { | ||
| 61 | - Image($r('app.media.icon_arrow_left')) | ||
| 62 | - .width(24) | ||
| 63 | - .height(24) | ||
| 64 | - .onClick((event: ClickEvent) => { | ||
| 65 | - router.back() | ||
| 66 | - }) | ||
| 67 | - | ||
| 68 | - Row() { | ||
| 69 | - Image($r('app.media.icon_comment')) | ||
| 70 | - .width(24) | ||
| 71 | - .height(24) | ||
| 72 | - .margin({ right: 24 }) | ||
| 73 | - .id('comment') | ||
| 74 | - | ||
| 75 | - Image($r('app.media.icon_star')) | ||
| 76 | - .width(24) | ||
| 77 | - .height(24) | ||
| 78 | - .margin({ right: 24 }) | ||
| 79 | - | ||
| 80 | - Image($r('app.media.icon_listen')) | ||
| 81 | - .width(24) | ||
| 82 | - .height(24) | ||
| 83 | - .margin({ right: 24 }) | ||
| 84 | - | ||
| 85 | - Image($r('app.media.icon_forward')) | ||
| 86 | - .width(24) | ||
| 87 | - .height(24) | ||
| 88 | - | ||
| 89 | - } | 85 | + if (!this.isPageEnd) { |
| 86 | + detailedSkeleton() | ||
| 90 | } | 87 | } |
| 91 | - .width(CommonConstants.FULL_WIDTH) | ||
| 92 | - .height(56) | ||
| 93 | - .padding({ left: 15, right: 15, bottom: 20, top: 20 }) | ||
| 94 | - .justifyContent(FlexAlign.SpaceBetween) | ||
| 95 | - .backgroundColor(Color.White) | ||
| 96 | - | 88 | + //底部交互区 |
| 89 | + OperRowListView({ contentDetailData: this.contentDetailData[0] }) | ||
| 97 | } | 90 | } |
| 98 | }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT) | 91 | }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT) |
| 99 | - .backgroundColor(Color.White) | ||
| 100 | } | 92 | } |
| 101 | 93 | ||
| 102 | aboutToAppear() { | 94 | aboutToAppear() { |
| 103 | - let action: Action = router.getParams() as Action | ||
| 104 | - if (action) { | ||
| 105 | - this.webUrl = action.params?.url || '' | 95 | + if (this.action) { |
| 96 | + this.webUrl = this.action.params?.url || '' | ||
| 106 | } | 97 | } |
| 107 | - this.trySendData2H5() | ||
| 108 | - } | ||
| 109 | - | ||
| 110 | - aboutToDisappear() { | ||
| 111 | - | 98 | + this.getDetail() |
| 112 | } | 99 | } |
| 113 | } | 100 | } |
| @@ -11,6 +11,7 @@ const MY_CHANNEL_TIP2: string = '拖动调整频道顺序' | @@ -11,6 +11,7 @@ const MY_CHANNEL_TIP2: string = '拖动调整频道顺序' | ||
| 11 | const MORE_CHANNEL: string = '更多频道' | 11 | const MORE_CHANNEL: string = '更多频道' |
| 12 | const LOCAL_CHANNEL: string = '地方频道' | 12 | const LOCAL_CHANNEL: string = '地方频道' |
| 13 | 13 | ||
| 14 | +const TAG: string = 'ChannelSubscriptionLayout' | ||
| 14 | 15 | ||
| 15 | @CustomDialog | 16 | @CustomDialog |
| 16 | struct ChannelDialog { | 17 | struct ChannelDialog { |
| 1 | import { Action } from 'wdBean'; | 1 | import { Action } from 'wdBean'; |
| 2 | import { SpacialTopicPageComponent } from 'wdComponent' | 2 | import { SpacialTopicPageComponent } from 'wdComponent' |
| 3 | +import { CommonConstants } from 'wdConstant' | ||
| 3 | import { Logger } from 'wdKit' | 4 | import { Logger } from 'wdKit' |
| 4 | import router from '@ohos.router'; | 5 | import router from '@ohos.router'; |
| 5 | 6 | ||
| 6 | -const TAG = 'SpacialPage'; | 7 | +const TAG = 'SpacialTopicPage'; |
| 7 | 8 | ||
| 8 | @Entry | 9 | @Entry |
| 9 | @Component | 10 | @Component |
| @@ -12,11 +13,11 @@ struct SpacialTopicPage { | @@ -12,11 +13,11 @@ struct SpacialTopicPage { | ||
| 12 | 13 | ||
| 13 | build() { | 14 | build() { |
| 14 | Column() { | 15 | Column() { |
| 15 | - SpacialTopicPageComponent() | ||
| 16 | - } | 16 | + SpacialTopicPageComponent({ action: this.action }) |
| 17 | + }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT) | ||
| 17 | } | 18 | } |
| 18 | 19 | ||
| 19 | - pageTransition(){ | 20 | + pageTransition() { |
| 20 | // 定义页面进入时的效果,从右边侧滑入 | 21 | // 定义页面进入时的效果,从右边侧滑入 |
| 21 | PageTransitionEnter({ type: RouteType.None, duration: 300 }) | 22 | PageTransitionEnter({ type: RouteType.None, duration: 300 }) |
| 22 | .slide(SlideEffect.Right) | 23 | .slide(SlideEffect.Right) |
| @@ -25,7 +26,6 @@ struct SpacialTopicPage { | @@ -25,7 +26,6 @@ struct SpacialTopicPage { | ||
| 25 | .slide(SlideEffect.Right) | 26 | .slide(SlideEffect.Right) |
| 26 | } | 27 | } |
| 27 | 28 | ||
| 28 | - | ||
| 29 | aboutToAppear() { | 29 | aboutToAppear() { |
| 30 | Logger.info(TAG, 'aboutToAppear'); | 30 | Logger.info(TAG, 'aboutToAppear'); |
| 31 | let action: Action = router.getParams() as Action | 31 | let action: Action = router.getParams() as Action |
-
Please register or login to post a comment