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
yuzhilin
2024-04-26 16:44:52 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
07ffc7dc9e94ada4df2eca10e84f91e97425c11a
07ffc7dc
1 parent
7dfcc57e
H5详情页关注功能
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
181 additions
and
137 deletions
sight_harmony/commons/wdRouter/src/main/ets/utils/ProcessUtils.ets
sight_harmony/commons/wdWebComponent/src/main/ets/pages/JsBridgeBiz.ets
sight_harmony/commons/wdWebComponent/src/main/ets/pages/JsCallAppService.ets
sight_harmony/features/wdBean/src/main/ets/bean/h5/H5ReceiveDataExtraBean.ets
sight_harmony/features/wdBean/src/main/ets/bean/h5/H5ReceiveDataJsonBean.ets
sight_harmony/features/wdBean/src/main/ets/bean/h5/ResponseBean.ets
sight_harmony/features/wdComponent/src/main/ets/components/ImageAndTextPageComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/ImageAndTextWebComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/SpacialTopicPageComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/page/ChannelSubscriptionLayout.ets
sight_harmony/products/phone/src/main/ets/pages/SpacialTopicPage.ets
sight_harmony/commons/wdRouter/src/main/ets/utils/ProcessUtils.ets
View file @
07ffc7d
...
...
@@ -157,7 +157,7 @@ export class ProcessUtils {
* 图集详情页
* @param content
* */
public static gotoMultiPictureListPage(photoList: PhotoListBean[], swiperIndex?:number) {
public static gotoMultiPictureListPage(photoList: PhotoListBean[], swiperIndex?:
number) {
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
...
...
@@ -187,8 +187,14 @@ export class ProcessUtils {
let taskAction: Action = {
type: 'JUMP_INNER_NEW_PAGE',
params: {
contentID: content?.objectId,
url: content.linkUrl,
pageID: 'SPACIAL_TOPIC_PAGE',
extra: {
relType: content?.relType,
relId: content?.relId,
channelId: content?.channelId,
} as ExtraDTO
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
...
...
@@ -423,11 +429,10 @@ export class ProcessUtils {
/**
* 跳转人民号主页
*@params creatorId 创作者id
*
@params creatorId 创作者id
*/
public static gotoPeopleShipHomePage(creatorId: string) {
let params = {
'creatorId': creatorId
} as Record<string, string>;
let params = {
'creatorId': creatorId
} as Record<string, string>;
WDRouterRule.jumpWithPage(WDRouterPage.peopleShipHomePage, params)
}
}
...
...
sight_harmony/commons/wdWebComponent/src/main/ets/pages/JsBridgeBiz.ets
View file @
07ffc7d
import HashMap from '@ohos.util.HashMap';
import { Callback } from 'wdJsBridge';
import { Message, IImgListData } from 'wdJsBridge/src/main/ets/bean/Message';
import { Logger } from 'wdKit';
import { Logger
, SPHelper
} from 'wdKit';
import { H5CallNativeType } from './H5CallNativeType';
import { H5OperateType } from './H5OperateType';
import { ContentConstants } from 'wdConstant';
import { ContentConstants
, SpConstants
} from 'wdConstant';
import { ProcessUtils } from 'wdRouter';
import router from '@ohos.router';
import Url from '@ohos.url'
import { ContentDTO, PhotoListBean } from 'wdBean';
import {
ResponseDTO, WDHttp, HttpUrlUtils } from 'wdNetwork';
import {
handleJsCallAppService } from './JsCallAppService'
const TAG = 'JsBridgeBiz'
...
...
@@ -20,6 +19,19 @@ class AppInfo {
// TODO 完善
}
class AppLoginAuthInfo {
"X-Ca-Stage": string = ''
userType: number = SPHelper.default.getSync(SpConstants.USER_Type, '') as number
userName: string = SPHelper.default.getSync(SpConstants.USER_NAME, '') as string
userID: string = SPHelper.default.getSync(SpConstants.USER_ID, '') as string
"RMRB-X-TOKEN": string = SPHelper.default.getSync(SpConstants.USER_TEMP_TOKEN, '') as string
phoneNumber: string = SPHelper.default.getSync(SpConstants.USER_PHONE, '') as string
nickName: string = ''
isLogined: string = SPHelper.default.getSync(SpConstants.USER_STATUS, '') as string
creatorID: string = SPHelper.default.getSync(SpConstants.USER_CREATOR_ID, '') as string
Authorization: string = ''
}
/**
* h5调用native代码
* @param data
...
...
@@ -39,7 +51,7 @@ export function performJSCallNative(data: Message, call: Callback) {
case H5CallNativeType.jsCall_getArticleDetailBussinessData:
break;
case H5CallNativeType.jsCall_callAppService:
handleJsCall
Call
AppService(data, (res: string) => {
handleJsCallAppService(data, (res: string) => {
call(res)
})
break;
...
...
@@ -49,6 +61,9 @@ export function performJSCallNative(data: Message, call: Callback) {
case H5CallNativeType.jsCall_appInnerLinkMethod:
handleJsCallAppInnerLinkMethod(data)
break;
case H5CallNativeType.jsCall_getAppLoginAuthInfo:
call(handleJsCallGetAppLoginAuthInfo())
break;
default:
break;
}
...
...
@@ -64,21 +79,6 @@ function handleJsCallCurrentPageOperate(data: Message) {
}
}
function handleJsCallCallAppService(data: Message, callback: (res: string) => void) {
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
let url: string = HttpUrlUtils.getHost() + data?.data?.url
if (data?.data?.method === 'get') {
WDHttp.get<ResponseDTO<string>>(url, headers).then((res: ResponseDTO<string>) => {
callback(JSON.stringify(res))
})
}
if (data?.data?.method === 'post') {
WDHttp.post<ResponseDTO<string>>(url, data?.data?.parameters, headers).then(res => {
callback(JSON.stringify(res))
})
}
}
/**
* 获取App公共信息
*/
...
...
@@ -90,12 +90,11 @@ function getAppPublicInfo(): string {
info.networkStatus = 1
let result = JSON.stringify(info)
Logger.debug(TAG, 'getAppPublicInfo: ' + JSON.stringify(info))
return result;
}
function handleJsCallReceiveH5Data(data: Message) {
switch (
data?.data?.dataSource
) {
switch (
String(data?.data?.dataSource)
) {
case '3':
let imgListData: IImgListData = JSON.parse(data?.data?.imgListData || "{}")
let imgArr = imgListData?.imgArr || []
...
...
@@ -110,7 +109,7 @@ function handleJsCallReceiveH5Data(data: Message) {
}
return photo
})
ProcessUtils.gotoMultiPictureListPage(photoList,swiperIndex)
ProcessUtils.gotoMultiPictureListPage(photoList,
swiperIndex)
}
break;
case '5':
...
...
@@ -183,3 +182,9 @@ function handleJsCallAppInnerLinkMethod(data: Message) {
}
}
}
function handleJsCallGetAppLoginAuthInfo() {
let appLoginAuthInfo = new AppLoginAuthInfo()
let result = JSON.stringify(appLoginAuthInfo)
return result;
}
\ No newline at end of file
...
...
sight_harmony/commons/wdWebComponent/src/main/ets/pages/JsCallAppService.ets
0 → 100644
View file @
07ffc7d
import HashMap from '@ohos.util.HashMap';
import { Message } from 'wdJsBridge/src/main/ets/bean/Message';
import { H5ReceiveDataJsonBean, postBatchAttentionStatusResult } from 'wdBean';
import { ResponseDTO, WDHttp, HttpUrlUtils } from 'wdNetwork';
const TAG = 'JsCallAppService'
export function handleJsCallAppService(data: Message, callback: (res: string) => void) {
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
let url: string = HttpUrlUtils.getHost() + data?.data?.url
let responseMap: ResponseDTO<postBatchAttentionStatusResult> = {} as ResponseDTO<postBatchAttentionStatusResult>
let h5ReceiveDataJson: H5ReceiveDataJsonBean<ResponseDTO<postBatchAttentionStatusResult>> = {
netError: '0',
responseMap
} as H5ReceiveDataJsonBean<ResponseDTO<postBatchAttentionStatusResult>>
// if (data?.data?.method === 'get') {
// WDHttp.get<ResponseDTO<postBatchAttentionStatusResult>>(url, headers).then((res: ResponseDTO<postBatchAttentionStatusResult>) => {
// callback(JSON.stringify(res))
// })
// }
if (data?.data?.method === 'post' && data?.data?.url === '/api/rmrb-interact/interact/zh/c/batchAttention/status') {
WDHttp.post<ResponseDTO<postBatchAttentionStatusResult>>(url, data?.data?.parameters, headers).then((res: ResponseDTO<postBatchAttentionStatusResult>) => {
h5ReceiveDataJson.responseMap = res
callback(JSON.stringify(h5ReceiveDataJson))
})
}
}
...
...
sight_harmony/features/wdBean/src/main/ets/bean/h5/H5ReceiveDataExtraBean.ets
View file @
07ffc7d
export interface H5ReceiveDataExtraBean {
creatorId: string;
cnsTraceId: string;
isLogin: string;
loadImageOnlyWifiSwitch: string;
networkStatus: number;
loadImageOnlyWifiSwitch: string
darkMode: string;
fontSizes: string;
}
\ No newline at end of file
...
...
sight_harmony/features/wdBean/src/main/ets/bean/h5/H5ReceiveDataJsonBean.ets
View file @
07ffc7d
import { ResponseBean } from './ResponseBean';
export interface H5ReceiveDataJsonBean {
contentId: string;
contentType: string;
topicId: string;
channelId: string;
compId: string;
sourcePage: string;
export interface H5ReceiveDataJsonBean<T = ResponseBean> {
contentId?: string;
contentType?: string;
topicId?: string;
channelId?: string;
compId?: string;
sourcePage?: string;
netError: string;
responseMap:
ResponseBean
;
responseMap:
T
;
}
\ No newline at end of file
...
...
sight_harmony/features/wdBean/src/main/ets/bean/h5/ResponseBean.ets
View file @
07ffc7d
import { ContentDetailDTO } from '../detail/ContentDetailDTO';
export interface ResponseBean{
success:boolean;
export interface ResponseBean<T = ContentDetailDTO[]> {
success: boolean;
// 服务请求响应值/微服务响应状态码”
code: number;
...
...
@@ -10,8 +10,7 @@ export interface ResponseBean{
message: string;
// 响应结果
data:ContentDetailDTO[];
data: T
// 请求响应时间戳(unix格式)
timestamp?: number;
}
\ No newline at end of file
...
...
sight_harmony/features/wdComponent/src/main/ets/components/ImageAndTextPageComponent.ets
View file @
07ffc7d
...
...
@@ -13,7 +13,6 @@ import {
import DetailViewModel from '../viewmodel/DetailViewModel';
import { ImageAndTextWebComponent } from './ImageAndTextWebComponent';
import { OperRowListView } from './view/OperRowListView';
import router from '@ohos.router';
import { RecommendList } from '../components/view/RecommendList'
import { CommonConstants } from 'wdConstant';
import { HttpUrlUtils } from 'wdNetwork/Index';
...
...
@@ -21,10 +20,11 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
import { PageRepository } from '../repository/PageRepository';
import { detailedSkeleton } from './skeleton/detailSkeleton';
import { CommentComponent } from '../components/comment/view/CommentComponent'
const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm';
const TAG = 'ImageAndTextPageComponent'
const TAG
: string
= 'ImageAndTextPageComponent'
@Component
export struct ImageAndTextPageComponent {
...
...
@@ -75,9 +75,55 @@ export struct ImageAndTextPageComponent {
isPageEnd: $isPageEnd
})
Column() {
// 点赞
if (this.contentDetailData[0]?.openLikes) {
Row() {
Row() {
if (this.newsStatusOfUser?.likeStatus === '1') {
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')))
.width(24)
.height(24)
.margin({ right: 5 })
} else {
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')))
.width(24)
.height(24)
.margin({ right: 5 })
}
if(this.interactData?.likeNum !== '0'){
Text(`${this.interactData?.likeNum}`)
.fontSize(16)
.fontColor(this.newsStatusOfUser?.likeStatus === '1' ? '#ED2800' : '#999999')
.fontWeight(500)
}
}
.width(140)
.height(36)
.justifyContent(FlexAlign.Center)
.alignItems(VerticalAlign.Center)
.borderRadius(20)
.border({
width: 1,
color: '#EDEDED',
})
.onClick(() => {
this.toggleLikeStatus()
})
}.width(CommonConstants.FULL_WIDTH).height(80)
.justifyContent(FlexAlign.Center)
Divider().strokeWidth(6).color('#f5f5f5')
}
if (this.recommendList.length > 0) {
RecommendList({ recommendList: this.recommendList })
}
// 评论
if(this.contentDetailData[0]?.openComment){
// CommentComponent({
//
// })
}
}
}
...
...
@@ -95,42 +141,6 @@ export struct ImageAndTextPageComponent {
if (this.contentDetailData?.length) {
OperRowListView({contentDetailData: this.contentDetailData[0]})
}
/* Row() {
Image($r('app.media.icon_arrow_left'))
.width(24)
.height(24)
.onClick((event: ClickEvent) => {
router.back()
})
Row() {
Image($r('app.media.icon_comment'))
.width(24)
.height(24)
.margin({ right: 24 })
.id('comment')
Image($r('app.media.icon_star'))
.width(24)
.height(24)
.margin({ right: 24 })
Image($r('app.media.icon_listen'))
.width(24)
.height(24)
.margin({ right: 24 })
Image($r('app.media.icon_forward'))
.width(24)
.height(24)
}
}
.width(CommonConstants.FULL_WIDTH)
.height(56)
.padding({ left: 15, right: 15, bottom: 50, top: 20 })
.justifyContent(FlexAlign.SpaceBetween)
.backgroundColor(Color.White)*/
}
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/ImageAndTextWebComponent.ets
View file @
07ffc7d
...
...
@@ -12,6 +12,7 @@ import { WdWebLocalComponent } from 'wdWebComponent';
import { NativeCallH5Type } from 'wdWebComponent/src/main/ets/pages/NativeCallH5Type';
import { BridgeWebViewControl } from 'wdJsBridge/Index';
const TAG: string = 'ImageAndTextWebComponent'
@Component
export struct ImageAndTextWebComponent {
action: Action = {} as Action
...
...
@@ -60,9 +61,12 @@ export struct ImageAndTextWebComponent {
// TODO 对接user信息、登录情况
let h5ReceiveDataExtraBean: H5ReceiveDataExtraBean = {
creatorId: creatorId,
cnsTraceId: '',
isLogin: isLogin,
networkStatus: Number(NetworkUtil.isNetConnected()),
loadImageOnlyWifiSwitch: '2',
networkStatus: Number(NetworkUtil.isNetConnected()),
darkMode: 'light',
fontSizes: 'normalsize'
} as H5ReceiveDataExtraBean
let h5ReceiveDataJsonBean: H5ReceiveDataJsonBean = {
...
...
@@ -83,7 +87,6 @@ export struct ImageAndTextWebComponent {
this.h5ReceiveAppData.dataExt = h5ReceiveDataExtraBean
this.dataPrepared = true
this.trySendData2H5()
}
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/SpacialTopicPageComponent.ets
View file @
07ffc7d
import { Action, H5ReceiveDetailBean } from 'wdBean';
import { Action, H5ReceiveDetailBean
, ContentDetailDTO
} from 'wdBean';
import { WdWebComponent } from 'wdWebComponent';
import router from '@ohos.router';
import { CommonConstants } from 'wdConstant'
import { BridgeWebViewControl } from 'wdJsBridge/Index';
import { detailedSkeleton } from './skeleton/detailSkeleton'
import { NativeCallH5Type } from 'wdWebComponent/src/main/ets/pages/NativeCallH5Type';
const TAG = 'SpacialTopicPageComponent'
import { OperRowListView } from './view/OperRowListView';
import DetailViewModel from '../viewmodel/DetailViewModel';
const TAG: string = 'SpacialTopicPageComponent'
@Component
export struct SpacialTopicPageComponent {
...
...
@@ -14,6 +17,7 @@ export struct SpacialTopicPageComponent {
action: Action = {} as Action
@State webUrl: string = '';
@State isPageEnd: boolean = false
@State contentDetailData: ContentDetailDTO [] = [] as ContentDetailDTO []
private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean
private webPrepared = false;
private dataPrepared = false;
...
...
@@ -37,11 +41,33 @@ export struct SpacialTopicPageComponent {
})
}
private async getDetail() {
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 detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType)
if (detailBeans && detailBeans.length > 0) {
this.contentDetailData = detailBeans;
this.trySendData2H5()
}
}
}
build() {
Column() {
if (!this.isPageEnd) {
detailedSkeleton()
}
Stack({ alignContent: Alignment.Bottom }) {
Column() {
WdWebComponent({
...
...
@@ -52,62 +78,23 @@ export struct SpacialTopicPageComponent {
isPageEnd: $isPageEnd
})
}
.padding({ bottom: 56 })
.width(CommonConstants.FULL_WIDTH)
.height(CommonConstants.FULL_HEIGHT)
.padding({ bottom: 126 })
//底部交互区
Row() {
Image($r('app.media.icon_arrow_left'))
.width(24)
.height(24)
.onClick((event: ClickEvent) => {
router.back()
})
Row() {
Image($r('app.media.icon_comment'))
.width(24)
.height(24)
.margin({ right: 24 })
.id('comment')
Image($r('app.media.icon_star'))
.width(24)
.height(24)
.margin({ right: 24 })
Image($r('app.media.icon_listen'))
.width(24)
.height(24)
.margin({ right: 24 })
Image($r('app.media.icon_forward'))
.width(24)
.height(24)
}
if (!this.isPageEnd) {
detailedSkeleton()
}
.width(CommonConstants.FULL_WIDTH)
.height(56)
.padding({ left: 15, right: 15, bottom: 20, top: 20 })
.justifyContent(FlexAlign.SpaceBetween)
.backgroundColor(Color.White)
//底部交互区
OperRowListView({ contentDetailData: this.contentDetailData[0] })
}
}.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT)
.backgroundColor(Color.White)
}
aboutToAppear() {
let action: Action = router.getParams() as Action
if (action) {
this.webUrl = action.params?.url || ''
if (this.action) {
this.webUrl = this.action.params?.url || ''
}
this.trySendData2H5()
}
aboutToDisappear() {
this.getDetail()
}
}
\ No newline at end of file
...
...
sight_harmony/features/wdComponent/src/main/ets/components/page/ChannelSubscriptionLayout.ets
View file @
07ffc7d
...
...
@@ -11,6 +11,7 @@ const MY_CHANNEL_TIP2: string = '拖动调整频道顺序'
const MORE_CHANNEL: string = '更多频道'
const LOCAL_CHANNEL: string = '地方频道'
const TAG: string = 'ChannelSubscriptionLayout'
@CustomDialog
struct ChannelDialog {
...
...
sight_harmony/products/phone/src/main/ets/pages/SpacialTopicPage.ets
View file @
07ffc7d
import { Action } from 'wdBean';
import { SpacialTopicPageComponent } from 'wdComponent'
import { CommonConstants } from 'wdConstant'
import { Logger } from 'wdKit'
import router from '@ohos.router';
const TAG = 'SpacialPage';
const TAG = 'Spacial
Topic
Page';
@Entry
@Component
...
...
@@ -12,11 +13,11 @@ struct SpacialTopicPage {
build() {
Column() {
SpacialTopicPageComponent()
}
SpacialTopicPageComponent({ action: this.action })
}.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT)
}
pageTransition(){
pageTransition()
{
// 定义页面进入时的效果,从右边侧滑入
PageTransitionEnter({ type: RouteType.None, duration: 300 })
.slide(SlideEffect.Right)
...
...
@@ -25,7 +26,6 @@ struct SpacialTopicPage {
.slide(SlideEffect.Right)
}
aboutToAppear() {
Logger.info(TAG, 'aboutToAppear');
let action: Action = router.getParams() as Action
...
...
Please
register
or
login
to post a comment