王士厅
... ... @@ -12,6 +12,7 @@ export class H5CallNativeType {
static jsCall_receiveH5Data = 'jsCall_receiveH5Data'
static jsCall_getAppLoginAuthInfo = 'jsCall_getAppLoginAuthInfo'
static jsCall_appNotifyEvent = 'jsCall_appNotifyEvent'
static jsCall_receiveSubjectData = 'jsCall_receiveSubjectData'
// TODO 业务自行新增类型、自行在JsBridgeBiz#performJSCallNative里添加接收分支处理。
... ... @@ -24,6 +25,7 @@ export class H5CallNativeType {
H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_receiveH5Data)
H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_getAppLoginAuthInfo)
H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_appNotifyEvent)
H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_receiveSubjectData)
}
}
... ...
... ... @@ -17,6 +17,7 @@ export struct WdWebComponent {
@Prop webUrl: string = ''
@Prop @Watch('onReloadStateChanged') reload: number = 0
@Link isPageEnd: boolean
@State subjectData : string = ''
build() {
Column() {
... ... @@ -48,6 +49,10 @@ export struct WdWebComponent {
this.webviewControl.flushMessageQueue()
return true
}
if (url.includes('__bridge_loaded__')) {
BridgeUtil.webViewLoadLocalJs(getContext(this), this.webviewControl)
return true
}
return this.onLoadIntercept(event.data.getRequestUrl().toString());
})
}
... ... @@ -60,6 +65,7 @@ export struct WdWebComponent {
let handle = (data: Message, f: Callback) => {
Logger.debug('registerHandlers handlerName: ' + JSON.stringify(data))
this.defaultPerformJSCallNative(data, f)
this.defaultGetReceiveSubjectData(data, f)
};
this.webviewControl.registerHandler(handleName, { handle: handle });
}
... ... @@ -71,13 +77,21 @@ export struct WdWebComponent {
private defaultPerformJSCallNative: (data: Message, f: Callback) => void = (data: Message, f: Callback) => {
performJSCallNative(data, f)
}
/**
*/
private defaultGetReceiveSubjectData: (data: Message, f: Callback) => void = (data: Message, f: Callback) => {
if(data.handlerName === H5CallNativeType.jsCall_receiveSubjectData){
f('')
}
}
onPageBegin: (url?: string) => void = () => {
Logger.debug(TAG, 'onPageBegin');
this.registerHandlers();
//有时序问题 必须延时执行
setTimeout(() => {
BridgeUtil.webViewLoadLocalJs(getContext(this), this.webviewControl)
}, 200)
// setTimeout(() => {
// BridgeUtil.webViewLoadLocalJs(getContext(this), this.webviewControl)
// }, 200)
}
onPageEnd: (url?: string) => void = () => {
Logger.debug(TAG, 'onPageEnd');
... ...
... ... @@ -9,7 +9,7 @@ import font from '@ohos.font';
import { ENewspaperPageDialog } from '../dialog/ENewspaperPageDialog';
import { RMCalendarBean } from './calendar/RMCalendarBean';
import { newsSkeleton } from './skeleton/newsSkeleton';
import { Logger, ToastUtils, NetworkUtil } from 'wdKit/Index';
import { Logger, ToastUtils, NetworkUtil, CustomToast } from 'wdKit/Index';
import { TrackingContent,TrackConstants, TrackingButton } from 'wdTracking/Index';
import { WDShare } from 'wdShare/Index';
import { window } from '@kit.ArkUI';
... ... @@ -36,6 +36,25 @@ export struct ENewspaperPageComponent {
@State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
@State ratio: string = '100%'
@State toastText:ResourceStr = ""
dialogToast: CustomDialogController = new CustomDialogController({
builder: CustomToast({
bgColor:$r("app.color.color_B3000000"),
opacityValue:1,
fontSizeValue:"25lpx",
lineHeightValue:"36lpx",
msg: this.toastText,
}),
autoCancel: false,
alignment: DialogAlignment.Center,
customStyle: true,
maskColor:"#00000000"
})
showToastTip(msg:ResourceStr){
this.toastText = msg
this.dialogToast.open()
}
//watch监听报纸页码回调
onCurrentPageNumUpdated(): void {
console.log("ENewspaperPageComponent-onCurrentPageNumUpdated", "currentPageNum:", this.currentPageNum)
... ... @@ -323,7 +342,7 @@ export struct ENewspaperPageComponent {
.id('e_newspaper_page_num')
.onClick((event: ClickEvent) => {
if(!NetworkUtil.isNetConnected()){
ToastUtils.showToast('网络出小差了,请检查网络后重试', 1000)
this.showToastTip('网络出小差了,请检查网络后重试')
return
}
if (this.newspaperListBean.list && this.newspaperListBean.list.length > 0) {
... ... @@ -334,7 +353,7 @@ export struct ENewspaperPageComponent {
this.pageDialogController.close()
}
}else {
ToastUtils.showToast('暂无数据', 1000)
this.showToastTip('暂无数据')
}
})
... ... @@ -362,7 +381,7 @@ export struct ENewspaperPageComponent {
.id('e_newspaper_read')
.onClick((event: ClickEvent) => {
if(!NetworkUtil.isNetConnected()){
ToastUtils.showToast('网络出小差了,请检查网络后重试', 1000)
this.showToastTip('网络出小差了,请检查网络后重试')
return
}
if (this.newspaperListBean.list && this.newspaperListBean.list.length > 0) {
... ... @@ -376,7 +395,7 @@ export struct ENewspaperPageComponent {
'currentNumber':this.swiperIndex,
})
}else {
ToastUtils.showToast('暂无数据', 1000)
this.showToastTip('暂无数据')
}
})
}
... ... @@ -414,7 +433,7 @@ export struct ENewspaperPageComponent {
let listBean = await NewspaperViewModel.getNewspaperList(this.calendarDate, this.picWidth + 'x' + this.picHeight)
this.newspaperListBean = listBean;
} else {
ToastUtils.showToast('网络出小差了,请检查网络后重试', 1000)
this.showToastTip('网络出小差了,请检查网络后重试')
}
} catch (exception) {
... ...
... ... @@ -22,6 +22,7 @@ export struct SpacialTopicPageComponent {
scroller: Scroller = new Scroller();
action: Action = {} as Action
@State webUrl: string = '';
@State subjectData: string = '';
@State isPageEnd: boolean = false
@Prop reload: number = 0;
@Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
... ... @@ -57,6 +58,36 @@ export struct SpacialTopicPageComponent {
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
}
}
}
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,
// },
// }
}
}
private async getDetail() {
this.isNetConnected = NetworkUtil.isNetConnected()
... ... @@ -93,12 +124,17 @@ export struct SpacialTopicPageComponent {
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType || '')
this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment || '')
// }
this.trySendData2H5()
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',this.contentDetailData)
}
}
}
... ... @@ -115,15 +151,17 @@ export struct SpacialTopicPageComponent {
.textAlign(TextAlign.Center)
.fontWeight(500)
.visibility(this.action?.params?.backVisibility && this.isPageEnd ? Visibility.Visible : Visibility.None)
if(this.subjectData.length > 0){
WdWebComponent({
webviewControl: this.webviewControl,
webUrl: this.webUrl,
reload: this.reload,
onWebPrepared: this.onWebPrepared.bind(this),
isPageEnd: $isPageEnd,
subjectData: this.subjectData
})
}
}
.width(CommonConstants.FULL_WIDTH)
.height(CommonConstants.FULL_HEIGHT)
.padding({ bottom: this.action?.params?.backVisibility ? 115 : 75 })
... ...
... ... @@ -219,7 +219,8 @@ struct createImg {
}) {
Image(this.loadImg ? item.fullUrl : '')
.backgroundColor(0xf5f5f5)
.width('100%')
.width(113)
.height(113)
.autoResize(true)
.borderRadius(this.caclImageRadius(index))
.opacity(!item.weight && !item.height ? 0 : 1)
... ... @@ -233,6 +234,8 @@ struct createImg {
Image(this.loadImg ? item.fullUrl : '')
.backgroundColor(0xf5f5f5)
.aspectRatio(1)
.width(113)
.height(113)
.borderRadius(this.caclImageRadius(index))
if(this.getPicType(item.weight, item.height) !== 3){
Flex({ direction: FlexDirection.Row }) {
... ...
... ... @@ -88,7 +88,7 @@ export struct Card6Component {
.fontSize(18)
.lineHeight(27)
.fontWeight(FontWeight.Normal)
.maxLines(2)
.maxLines(this.contentDTO.appStyle === '6' ? 5 : 2)
.alignSelf(ItemAlign.Start)
.textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
.textIndent((this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) > 2 &&
... ...
... ... @@ -54,8 +54,7 @@ export struct ZhSingleRow02 {
resetEdgeAnimation() {
if (this.moreWidth > this.initMoreWidth) {
this.moreWidth = this.moreWidth - 1
this.resetEdgeAnimation();
this.moreWidth = 16
}
this.resetMoreTips()
}
... ... @@ -91,7 +90,14 @@ export struct ZhSingleRow02 {
.margin({ right: 8 })
})
}
if (this.compDTO.operDataList.length >= 2) {
if (this.compDTO.operDataList.length >= 2 && (this.compDTO?.objectType === '0' || this.compDTO?.objectType === '')) {
Row() {
Ellipse()
.width(2* (this.moreWidth - this.initMoreWidth - 1))
.height('100%')
.fill(0xe9e9e9)
.position({ left: -(this.moreWidth - this.initMoreWidth - 3) * 0.8 , top: 0 })
Column() {
if (this.moreWidth > this.initMoreWidth + 2) {
Text(this.moreTips)
... ... @@ -103,10 +109,12 @@ export struct ZhSingleRow02 {
.justifyContent(FlexAlign.Center)
.align(Alignment.Center)
.height('100%')
.width(this.moreWidth)
.width(this.initMoreWidth)
.backgroundColor(0xe9e9e9)
.borderRadius({ topLeft: 5, bottomLeft: 5 })
}
.margin({left: 1.5 * (this.moreWidth - this.initMoreWidth)})
}
}
}
.width(CommonConstants.FULL_WIDTH)
... ...
... ... @@ -78,8 +78,7 @@ export struct ZhSingleRow03 {
resetEdgeAnimation() {
if (this.moreWidth > this.initMoreWidth) {
this.moreWidth = this.moreWidth - 1
this.resetEdgeAnimation();
this.moreWidth = 16
}
this.resetMoreTips()
}
... ... @@ -166,7 +165,14 @@ export struct ZhSingleRow03 {
this.ItemCard(item)
})
}
if (this.compDTO.operDataList.length >= 2) {
if (this.compDTO.operDataList.length >= 2 && (this.compDTO?.objectType === '0' || this.compDTO?.objectType === '')) {
Row() {
Ellipse()
.width(2* (this.moreWidth - this.initMoreWidth - 1))
.height(116)
.fill(0xf9f9f9)
.position({ left: -(this.moreWidth - this.initMoreWidth - 3) * 0.8 , top: 0 })
Column() {
if (this.moreWidth > this.initMoreWidth + 2) {
Text(this.moreTips)
... ... @@ -177,10 +183,12 @@ export struct ZhSingleRow03 {
}
.justifyContent(FlexAlign.Center)
.align(Alignment.Center)
.width(this.moreWidth)
.height(116)
.width(this.initMoreWidth)
.backgroundColor(0xf9f9f9)
.borderRadius({ topLeft: 5, bottomLeft: 5 })
.height(116)
}
.margin({left: 1.5 * (this.moreWidth - this.initMoreWidth)})
}
}
}
... ... @@ -393,6 +401,7 @@ export struct ZhSingleRow03 {
.fontWeight(600)
}
if (this.compDTO?.objectType === '0' || this.compDTO?.objectType === '') {
Row() {
Text("更多")
.fontSize($r("app.float.font_size_14"))
... ... @@ -406,6 +415,7 @@ export struct ZhSingleRow03 {
this.jumpToMore();
})
}
}
.justifyContent(FlexAlign.SpaceBetween)
.margin({ top: 8, bottom: 8 })
.width('100%')
... ...
... ... @@ -14,6 +14,7 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter'
import { LazyDataSource } from 'wdKit/Index';
import LoadMoreLayout from '../page/LoadMoreLayout'
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { TrackConstants, Tracking, TrackingContent, TrackingPageBrowse, TrackParamConvert } from 'wdTracking/Index';
const TAG: string = 'ReserveMorePage';
... ... @@ -47,6 +48,9 @@ struct ReserveMorePage {
@State private liveId: string = ''
@State isLoadingAttention: boolean = false
@State loadImg: boolean = false;
private pageId: string = TrackConstants.PageName.Live_Appointment_List
private pageName: string = TrackConstants.PageName.Live_Appointment_List
private pageShowStartTime: number = 0
build() {
Column() {
... ... @@ -249,8 +253,24 @@ struct ReserveMorePage {
top: index == 0 ? '12vp' : '8vp'
})
.onClick(() => {
// 内容点击埋点
TrackingContent.common(TrackConstants.EventType.Click,
item.pageId,
item.pageId,
TrackParamConvert.program(item))
ProcessUtils.processPage(item)
})
.onVisibleAreaChange([0, 1], (isVisiable: boolean, ratio: number) => {
if (isVisiable) {
// 内容曝光埋点
TrackingContent.common(TrackConstants.EventType.Show,
item.pageId,
item.pageId,
TrackParamConvert.program(item))
}
})
}
/*导航栏*/
... ... @@ -358,12 +378,18 @@ struct ReserveMorePage {
}
onPageShow(): void {
this.pageShowStartTime = Date.now()
if (this.isShow) {
this.data.reloadData()
this.isShow = false
}
}
onPageHide(): void {
const duration = Date.now() - this.pageShowStartTime
TrackingPageBrowse.trackCommonPageExposureEnd(this.pageId, this.pageName, duration)
}
private async getData(resolve?: (value: string | PromiseLike<string>) => void) {
if (this.isLoading) {
if (resolve) {
... ... @@ -386,6 +412,8 @@ struct ReserveMorePage {
this.reserveList = []
this.reservedIds = []
}
liveReviewDTO.list.forEach((content) => { content.pageId = this.pageId })
this.data.push(...liveReviewDTO.list)
//批量查询关注状态
this.getAppointmentInfo(liveReviewDTO.list)
... ... @@ -488,6 +516,11 @@ struct ReserveMorePage {
this.isLoadingAttention = true
this.liveId = reserveItem.liveId.toString()
try {
// 埋点
Tracking.event(!reserveItem.subscribe ? "live_subscribe_click":"cancel_live_subscribe_click",
TrackParamConvert.program(item))
const res = await LiveModel.liveAppointment(reserveItem.relationId, reserveItem.liveId.toString(),
!reserveItem.subscribe);
if (res.code == 0) {
... ...
... ... @@ -43,8 +43,7 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent {
resetEdgeAnimation() {
if (this.moreWidth > this.initMoreWidth) {
this.moreWidth = this.moreWidth - 1
this.resetEdgeAnimation();
this.moreWidth = 16
}
this.resetMoreTips()
}
... ... @@ -141,7 +140,15 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent {
})
})
}
if (this.compDTO.operDataList.length > 2) {
if (this.compDTO.operDataList.length >= 2 && (this.compDTO?.objectType === '0' || this.compDTO?.objectType === '')) {
Row() {
Ellipse()
.width(2* (this.moreWidth - this.initMoreWidth - 1))
.height(this.compDTO.operDataList.length == 2 ? 180 : 146)
.fill(0xf1f3f4)
.position({ left: -(this.moreWidth - this.initMoreWidth - 3) * 0.8 })
Column() {
if (this.moreWidth > this.initMoreWidth + 2) {
Text(this.moreTips)
... ... @@ -152,10 +159,12 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent {
}
.justifyContent(FlexAlign.Center)
.align(Alignment.Center)
.width(this.moreWidth)
.height(this.compDTO.operDataList.length == 2 ? 180 : 146)
.width(this.initMoreWidth)
.backgroundColor(0xf1f3f4)
.borderRadius({ topLeft: 5, bottomLeft: 5 })
.height(this.compDTO.operDataList.length == 2 ? 180 : 146)
}
.margin({left: 1.5 * (this.moreWidth - this.initMoreWidth)})
}
}
}
... ...
... ... @@ -135,6 +135,9 @@ export namespace TrackConstants {
/// 我的预约
My_Saved_Live = "mySavedLivePage",
/// 直播预约更多列表
Live_Appointment_List = "liveSubscribeListPage",
/// 兴趣选择
Preference_Selection = "preferenceSelectionPage",
/// 升级页面
... ...
import { CompInfoBean, ContentDetailDTO, ContentDTO, PageInfoBean, PageInfoDTO } from 'wdBean/Index';
import { StringUtils } from 'wdKit/Index';
import { ParamType } from './PublicParams';
import { TrackConstants } from './TrackConstants';
import { TrackingUtils } from './TrackingUtils';
... ... @@ -22,17 +23,40 @@ export class TrackParamConvert {
static pageCompProgram(pageInfo?: PageInfoDTO, comp?: CompInfoBean, program?: ContentDTO) : ParamType {
let params = TrackingUtils.generateParams()
//TODO: 转换参数
if (pageInfo) {
params["pageName"] = pageInfo.name
params["pageId"] = pageInfo.id + ''
TrackParamConvert.appendRecommendPageInfo(pageInfo, params)
}
if (program) {
params["contentType"] = program.objectType
params["contentId"] = program.objectId
params["contentName"] = program.newsTitle
params["channelSourceId"] = program.channelId
params["rmhPlatform"] = program.rmhPlatform
TrackParamConvert.appendRecommend(program, params)
if (program.liveInfo) {
params["liveType"] = program.liveInfo.liveState
params["liveStreamType"] = ((program.liveInfo.vrType + '') == "1") ? "2" : "1"
params["vliveId"] = program.objectId
params["vliveName"] = program.newsTitle
}
//TODO: 转换参数
if (!StringUtils.isEmpty(program.linkUrl)) {
params["linkUrl"] = program.linkUrl
}
if (program.rmhInfo && program.rmhInfo.rmhId) {
params["saAuthorId"] = program.rmhInfo.rmhId || ""
params["saAuthorName"] = program.rmhInfo.rmhName || ""
}
TrackParamConvert.appendRecommendProgram(program, params)
}
return params
}
... ... @@ -79,10 +103,68 @@ export class TrackParamConvert {
return param
}
private static appendRecommend(detail: object, to: ParamType) {
private static appendRecommend(detail: ContentDetailDTO, to: ParamType) {
//TODO: ContentDetailDTO 增加推荐字段
to["sceneId"] = !StringUtils.isEmpty(detail.sceneId) ? detail.sceneId : "9999"
to["subSceneId"] = !StringUtils.isEmpty(detail.subSceneId) ? detail.subSceneId : ""
//to["cnsTraceId"] = !StringUtils.isEmpty(detail.cnsTraceId) ? detail.cnsTraceId : "selfHold"
to["cnsTraceId"] = "selfHold"
to["itemId"] = !StringUtils.isEmpty(detail.itemId) ? detail.itemId : ""
// to["expIds"] = !StringUtils.isEmpty(detail.expIds) ? detail.expIds : ""
to["expIds"] = ""
/// 这里填写默认值,后续在分享处 再重写
to["shareChannel"] = ""
/// 这里填写默认值,后续在action=browse时,再重写
to["duration"] = 0
}
private static appendRecommendProgram(program: ContentDTO, to: ParamType) {
to["sceneId"] = !StringUtils.isEmpty(program.itemId) ? program.itemId : "9999"
to["subSceneId"] = !StringUtils.isEmpty(program.itemId) ? program.itemId : ""
to["cnsTraceId"] = !StringUtils.isEmpty(program.itemId) ? program.itemId : "selfHold"
to["itemId"] = !StringUtils.isEmpty(program.itemId) ? program.itemId : ""
to["expIds"] = !StringUtils.isEmpty(program.itemId) ? program.itemId : ""
/// 这里填写默认值,后续在分享处 再重写
to["shareChannel"] = ""
/// 这里填写默认值,后续在action=browse时,再重写
to["duration"] = 0
}
private static appendRecommendCompInfo(program: CompInfoBean, to: ParamType) {
// TODO:
// to["sceneId"] = !StringUtils.isEmpty(program.itemId) ? program.itemId : "9999"
// to["subSceneId"] = !StringUtils.isEmpty(program.itemId) ? program.itemId : ""
// to["cnsTraceId"] = !StringUtils.isEmpty(program.itemId) ? program.itemId : "selfHold"
// to["itemId"] = !StringUtils.isEmpty(program.itemId) ? program.itemId : ""
// to["expIds"] = !StringUtils.isEmpty(program.itemId) ? program.itemId : ""
/// 这里填写默认值,后续在分享处 再重写
to["shareChannel"] = ""
/// 这里填写默认值,后续在action=browse时,再重写
to["duration"] = 0
}
private static appendRecommendPageInfo(program: PageInfoDTO, to: ParamType) {
// TODO:
// to["sceneId"] = !StringUtils.isEmpty(program.itemId) ? program.itemId : "9999"
// to["subSceneId"] = !StringUtils.isEmpty(program.itemId) ? program.itemId : ""
// to["cnsTraceId"] = !StringUtils.isEmpty(program.itemId) ? program.itemId : "selfHold"
// to["itemId"] = !StringUtils.isEmpty(program.itemId) ? program.itemId : ""
// to["expIds"] = !StringUtils.isEmpty(program.itemId) ? program.itemId : ""
/// 这里填写默认值,后续在分享处 再重写
to["shareChannel"] = ""
/// 这里填写默认值,后续在action=browse时,再重写
to["duration"] = 0
}
private static appendRecommendPageInfoBean(program: PageInfoBean, to: ParamType) {
to["sceneId"] = "9999"
to["subSceneId"] = ""
to["cnsTraceId"] = "selfHold"
... ... @@ -95,6 +177,13 @@ export class TrackParamConvert {
to["duration"] = 0
}
// 'sceneId': contentDTO.sceneId,
// 'subSceneId': contentDTO.subSceneId,
// 'cnsTraceId': contentDTO.cnsTraceId,
// 'cardItemId': compDTO.cardItemId,
// 'itemId': compDTO.itemId || contentDTO.itemId,
// 'expIds': compDTO.expIds || contentDTO.expIds
///早晚报 专题
static pageInfoBean_ParamType(pageInfo: PageInfoBean) : ParamType {
... ... @@ -128,7 +217,8 @@ export class TrackParamConvert {
"channelSourceId": pageInfo.name,
"pageId": 'summaryDetailPage',
}
TrackParamConvert.appendRecommend(pageInfo, param)
TrackParamConvert.appendRecommendPageInfoBean(pageInfo, param)
return param
}
... ...
import { Action } from 'wdBean';
import { SpacialTopicPageComponent } from 'wdComponent'
import { CommonConstants } from 'wdConstant'
import { Logger } from 'wdKit'
import { CommonConstants, SpConstants } from 'wdConstant'
import { Logger, SPHelper, StringUtils } from 'wdKit'
import router from '@ohos.router';
import dataPreferences from '@ohos.data.preferences';
import { TrackConstants } from 'wdTracking/Index';
const TAG = 'SpacialTopicPage';
... ... @@ -13,6 +14,18 @@ struct SpacialTopicPage {
@State action: Action = {} as Action
@State reload: number = 0
@State count: number = 0
preferences: dataPreferences.Preferences | null = null;
observer = (key: string) => {
if(key == SpConstants.USER_ID){
if(StringUtils.isEmpty(SPHelper.default.getSync(SpConstants.USER_ID,""))){
// 未登录
}else {
// 登录
this.reload = this.reload + 1
}
}
}
@Provide pageName: string = TrackConstants.PageName.Summary_Detail
@Provide pageId: string = TrackConstants.PageName.Summary_Detail
... ... @@ -39,9 +52,16 @@ struct SpacialTopicPage {
Logger.info(TAG, `aboutToAppearcount:${this.reload}`);
let action: Action = router.getParams() as Action
this.action = action
this.addLoginStatusObserver()
}
async addLoginStatusObserver(){
this.preferences = await SPHelper.default.getPreferences();
this.preferences.on('change', this.observer);
}
onPageShow() {
this.reload = this.reload + 1
// this.reload = this.reload + 1
Logger.info(TAG, `onPageShowcount:${this.reload}`);
}
}
\ No newline at end of file
... ...