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-06-20 09:55:29 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
fcf8fc735fdd97c3230fa412b1344e585e3c8795
fcf8fc73
2 parents
f9f1a21d
4ec0e01f
Merge remote-tracking branch 'origin/main'
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
242 additions
and
130 deletions
sight_harmony/features/wdComponent/src/main/ets/components/ENewspaperItemComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/ENewspaperPageComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/MorningEveningPaper/MorningEveningPaperComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/MorningEveningPaper/PaperTitleComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/MorningEveningPaper/topicInfoView.ets
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/CommentText.ets
sight_harmony/features/wdComponent/src/main/ets/components/page/ChannelSubscriptionLayout.ets
sight_harmony/features/wdComponent/src/main/ets/components/page/TopNavigationComponentNew.ets
sight_harmony/features/wdComponent/src/main/ets/components/setting/AboutPageUI.ets
sight_harmony/features/wdComponent/src/main/ets/components/skeleton/newsSkeleton.ets
sight_harmony/features/wdComponent/src/main/ets/repository/PageRepository.ets
sight_harmony/features/wdComponent/src/main/ets/viewmodel/ChannelViewModel.ets
sight_harmony/features/wdComponent/src/main/ets/viewmodel/PageHelper.ets
sight_harmony/features/wdLogin/src/main/ets/pages/login/LoginProtocolWebview.ets
sight_harmony/features/wdTracking/src/main/ets/tracking/Tracking.ets
sight_harmony/products/phone/src/main/ets/pages/ENewspaper.ets
sight_harmony/products/phone/src/main/resources/base/profile/insight_intent.json
sight_harmony/features/wdComponent/src/main/ets/components/ENewspaperItemComponent.ets
View file @
fcf8fc7
...
...
@@ -40,7 +40,6 @@ export struct ENewspaperItemComponent {
Image(this.newspaperListItemBean.pagePic)
.width(px2vp(this.itemPicWidth))
.height(px2vp(this.itemPicHeight))
.alt($r('app.media.paper_placeholder'))
.onComplete((event) => {
if (event?.loadingStatus == 1) {
this.contentWidth = event?.contentWidth
...
...
@@ -50,9 +49,10 @@ export struct ENewspaperItemComponent {
})
.objectFit(ImageFit.Fill)
.zIndex(10)
// newsSkeleton()
// .height('100%')
// .zIndex(1)
newsSkeleton()
.visibility(this.isShowSkeleton ? Visibility.Visible : Visibility.None)
.width('100%')
.zIndex(1)
if (this.contentWidth !== 0) {
Canvas(this.context)
.width(px2vp(this.contentWidth))
...
...
sight_harmony/features/wdComponent/src/main/ets/components/ENewspaperPageComponent.ets
View file @
fcf8fc7
...
...
@@ -145,7 +145,6 @@ export struct ENewspaperPageComponent {
let ratio = this.ratio == '100%' ? 1 : 0.5
this.picWidth = this.picWidth * ratio
this.picHeight = this.picHeight
// 默认日期
const date = new Date()
const month = date.getMonth() + 1
...
...
@@ -174,14 +173,17 @@ export struct ENewspaperPageComponent {
resizeWindow() {
this.windowClass?.on('windowSizeChange', () => {
this.screenWidth = this.windowClass?.getWindowProperties()?.windowRect.width || this.displayTool.width
// 2000折叠屏 TODO DeviceUtil 方法完善了换判断条件
this.ratio = this.screenWidth > 2000 ? '50%' : '100%'
let ratio = this.ratio == '100%' ? 1 : 0.5
this.picWidth = this.screenWidth - vp2px(20)
this.picWidth = this.picWidth * ratio
this.resize()
});
}
resize() {
this.screenWidth = this.windowClass?.getWindowProperties()?.windowRect.width || this.displayTool.width
// 2000折叠屏 TODO DeviceUtil 方法完善了换判断条件
this.ratio = this.screenWidth > 2000 ? '50%' : '100%'
let ratio = this.ratio == '100%' ? 1 : 0.5
this.picWidth = this.screenWidth - vp2px(20)
this.picWidth = this.picWidth * ratio
}
build() {
Stack() {
...
...
@@ -257,9 +259,10 @@ export struct ENewspaperPageComponent {
middle: { anchor: "__container__", align: HorizontalAlign.Center }
})
.id('news_skeleton_id')
.width('100%')
.height(px2vp(this.picHeight) + 32)
.width(px2vp(this.picWidth))
.height(px2vp(this.picHeight))
.margin({ top: 59, left: 10, right: 10 })
// .padding({ right: 10, left: 10 })
}
if (this.newspaperListBean && this.newspaperListBean.list && this.newspaperListBean.list.length > 0) {
...
...
@@ -447,8 +450,7 @@ export struct ENewspaperPageComponent {
private async getNewspaperList() {
// ENewspaperItemComponent .padding({ top:14, right: 10, bottom: 14, left: 10 })
// 计算图片的内容宽高
let ratio = this.ratio == '100%' ? 1 : 0.6
this.itemPicWidth = this.picWidth * ratio - vp2px(20)
this.itemPicWidth = this.picWidth - vp2px(20)
this.itemPicHeight = this.picHeight - vp2px(28)
try {
if (NetworkUtil.isNetConnected()) {
...
...
sight_harmony/features/wdComponent/src/main/ets/components/MorningEveningPaper/MorningEveningPaperComponent.ets
View file @
fcf8fc7
...
...
@@ -237,14 +237,13 @@ export struct MorningEveningPaperComponent {
if (imageSource) {
const pixelMap: image.PixelMap = await imageNet2PixelMap(imageSource);
effectKit.createColorPicker(pixelMap, (err, colorPicker) => {
let color = colorPicker.get
LargestProportionColor
();
let color = colorPicker.get
MainColorSync
();
console.log(TAG, "compInfoBean compStyle = " + color)
// color = ColorUtils.getMorningEveningPaperRgb({red:color.red,green:color.green,blue:color.blue,alpha:color.alpha})
// 将取色器选取的color示例转换为十六进制颜色代码
this.mixedBgColor = "#" + color.alpha.toString(16) + color.red.toString(16) + color.green.toString(16) + color.blue.toString(16);
console.log(TAG, "compInfoBean compStyle = " + this.mixedBgColor)
});
}
}
...
...
@@ -275,7 +274,7 @@ export struct MorningEveningPaperComponent {
this.AudioBarView()
}
.margin({
top: this.isHasTopView ? 10 : 44
+
this.topSafeHeight
top: this.isHasTopView ? 10 : 44
+
this.topSafeHeight
})
}
...
...
@@ -328,8 +327,8 @@ export struct MorningEveningPaperComponent {
Stack({ alignContent: Alignment.Start }) {
Image($r('app.media.listen_left_bg'))
.width('100%')
.height('100%')
.objectFit(ImageFit.Contain)
// .height('100%')
.objectFit(ImageFit.Fill)
Image($r('app.media.icon_listen'))
.width(20)
.height(20)
...
...
sight_harmony/features/wdComponent/src/main/ets/components/MorningEveningPaper/PaperTitleComponent.ets
View file @
fcf8fc7
...
...
@@ -98,18 +98,18 @@ export struct PaperTitleComponent {
})
.margin({ right: 16 })
Image($r('app.media.icon_share'))
.height($r('app.float.top_arrow_size'))
.width($r('app.float.top_arrow_size'))
.alignRules({
right: { anchor: "img_close", align: HorizontalAlign.Start },
center: { anchor: "__container__", align: VerticalAlign.Center }
})
.id('img_share')
.margin({ right: 16 })
.onClick(() => {
this.share()
})
// Image($r('app.media.icon_share'))
// .height($r('app.float.top_arrow_size'))
// .width($r('app.float.top_arrow_size'))
// .alignRules({
// right: { anchor: "img_close", align: HorizontalAlign.Start },
// center: { anchor: "__container__", align: VerticalAlign.Center }
// })
// .id('img_share')
// .margin({ right: 16 })
// .onClick(() => {
// this.share()
// })
}
// .margin({ left: 14, right: 14 })
.height($r('app.float.top_bar_height'))
...
...
sight_harmony/features/wdComponent/src/main/ets/components/MorningEveningPaper/topicInfoView.ets
View file @
fcf8fc7
import { ContentDTO, FrontLinkObject } from 'wdBean';
import { Logger } from 'wdKit/Index';
import { ProcessUtils } from 'wdRouter/Index';
import { CommentText } from '../comment/view/CommentText';
/**
* 早晚报,topic
...
...
@@ -69,17 +71,25 @@ export struct topicInfoView {
Row(){
Text(this.frontLinkObject?.summary ?? "")
.fontSize(14)
.fontColor('#CCFFFFFF')
.maxLines(this.isExpansion?999:3)
.textOverflow({ overflow: TextOverflow.Ellipsis })
Text(this.isExpansion?'收起':'展开').onClick(()=>{
this.isExpansion = !this.isExpansion
})
.fontSize(14)
.fontColor($r('app.color.white'))
CommentText({longMessage:this.frontLinkObject?.summary ?? "",fontSize:14,fontColor:'#CCFFFFFF',isMorningEveningPaper:true})
// Text(this.frontLinkObject?.summary ?? "")
// .fontSize(14)
// .fontColor('#CCFFFFFF')
// .maxLines(this.isExpansion?999:3)
// .textOverflow({ overflow: TextOverflow.Ellipsis })
// .onVisibleAreaChange([0.0, 1.0], (isVisible: boolean, currentRatio: number) => {
// Logger.debug('TAG', `当前屏幕可见区域大小: currentRatio:' +${currentRatio}`)
// if (!isVisible && currentRatio <= 0.0) {
//
// }
// })
//
// Text(this.isExpansion?'收起':'展开').onClick(()=>{
// this.isExpansion = !this.isExpansion
// })
// .fontSize(14)
// .fontColor($r('app.color.white'))
}.alignItems(VerticalAlign.Bottom)
.alignRules({
left: { anchor: "__container__", align: HorizontalAlign.Start },
...
...
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/CommentText.ets
View file @
fcf8fc7
...
...
@@ -32,6 +32,7 @@ export struct CommentText {
fontColor: ResourceColor = $r('app.color.color_222222')
// 测量文本宽度(单位px)
@State textWidth: number = 0;
isMorningEveningPaper:boolean = false
// constructor(longMessage?:string,) {
// super();
// this.longMessage = longMessage;
...
...
@@ -108,6 +109,11 @@ export struct CommentText {
// if (this.maxLineMesssage.endsWith('\n')) {
// this.maxLineMesssage = this.maxLineMesssage.slice(0, this.maxLineMesssage.length - 1)
// }
///早晚报三行显示 展开功能显示末尾
if (this.isMorningEveningPaper) {
this.maxLineMesssage = this.maxLineMesssage.substring(0,this.maxLineMesssage.length - 7)
}
break
}
this.maxLineMesssage = element;
...
...
sight_harmony/features/wdComponent/src/main/ets/components/page/ChannelSubscriptionLayout.ets
View file @
fcf8fc7
import { TopNavDTO } from 'wdBean';
import curves from '@ohos.curves';
import { Logger } from 'wdKit/Index';
import { Logger, SPHelper } from 'wdKit/Index';
import { SpConstants } from 'wdConstant/Index';
const INDEX_SETTING_TITLE: string = '首页设置'
const INDEX_SETTING_SUBTITLE: string = '将指定频道设置为首页'
...
...
@@ -43,7 +44,6 @@ struct ChannelSubscriptionLayout {
@State isEditIng: boolean = false
// 顶部导航栏是否有临时跳转频道数据不
@Prop haveTempTabData: boolean
changeTab: (index: number) => void = () => {
}
...
...
@@ -67,9 +67,14 @@ struct ChannelSubscriptionLayout {
delChannelItem(index: number) {
let item = this.myChannelList.splice(index, 1)[0]
this.channelIds.splice(index, 1)
//
this.channelIds.splice(index, 1)
AppStorage.setOrCreate('channelIds', this.channelIds.join(','))
// 本地频道特殊处理
let provinceName = SPHelper.default.getSync(SpConstants.LOCATION_PROVINCE_NAME, '') as string
if (provinceName && provinceName.includes(item.name) && item.localChannel == '0') {
item.localChannel = '1'
}
/*
删除的频道信息回到原栏目中去
*/
...
...
@@ -130,8 +135,8 @@ struct ChannelSubscriptionLayout {
this.myChannelList.push(item)
AppStorage.setOrCreate('channelIds', this.channelIds.join(','))
let storageChannelIds: string = AppStorage.get<string>('channelIds') || ''
console.debug('TopNavigationComponent', 'addChannelItem==>' + storageChannelIds)
// let storageChannelIds: string = AppStorage.get<string>('channelIds') || ''
// console.debug('TopNavigationComponent', 'addChannelItem==>' + storageChannelIds)
}
itemMove(index: number, newIndex: number): void {
...
...
@@ -570,7 +575,7 @@ struct ChannelSubscriptionLayout {
.backgroundColor(Color.White)
.onClick(() => {
this.isShow = true
if
(this.haveTempTabData)
{
if
(this.haveTempTabData)
{
// 存储数据
AppStorage.setOrCreate('channelIds', this.channelIds.join(','))
this.haveTempTabData = false
...
...
@@ -578,18 +583,23 @@ struct ChannelSubscriptionLayout {
})
.bindContentCover(this.isShow, this.sheetBuilder(), {
modalTransition: ModalTransition.DEFAULT,
onWillAppear: () => {console.log("BindContentCover onWillAppear.")},
onAppear: () => {console.log("BindContentCover onAppear.")},
onWillDisappear: () => {console.log("BindContentCover onWillDisappear.")
onWillAppear: () => {
console.log("BindContentCover onWillAppear.")
},
onAppear: () => {
console.log("BindContentCover onAppear.")
},
onWillDisappear: () => {
console.log("BindContentCover onWillDisappear.")
this.isShow = false
this.isEditIng = false},
onDisappear: () => {console.log("BindContentCover onDisappear.")
this.isEditIng = false
},
onDisappear: () => {
console.log("BindContentCover onDisappear.")
}
})
}
/**
* 改变我的频道栏目中频道id数据
*/
...
...
sight_harmony/features/wdComponent/src/main/ets/components/page/TopNavigationComponentNew.ets
View file @
fcf8fc7
import { BottomNavDTO, TopNavDTO } from 'wdBean';
import { SpConstants } from 'wdConstant';
import { BottomNavDTO, NavigationDetailDTO, TopNavDTO } from 'wdBean';
import { Logger, NetworkUtil, SPHelper, ToastUtils } from 'wdKit';
import { ProcessUtils, WDRouterPage, WDRouterRule } from 'wdRouter';
import { PageComponent } from './PageComponent';
...
...
@@ -422,7 +421,6 @@ export struct TopNavigationComponentNew {
async aboutToAppear() {
if (CompUtils.isNews(this.navItem)) {
// 请求顶导网络数据
...
...
@@ -619,20 +617,51 @@ export struct TopNavigationComponentNew {
//请求顶导数据
async getTopNavList(id: number) {
Logger.debug(TAG, 'getTopNavList=存储=>' + this.storageChannelIds)
// 1 、使用存储数据
let bottomDetailCache = await ChannelViewModel.getBottomNavDetailCacheData(id)
if (bottomDetailCache != null && bottomDetailCache.topNavChannelList.length > 0) {
Logger.debug(TAG, '使用缓存数据')
this.processTopNewsTapData(bottomDetailCache, false)
}
// 2、请求网络数据
let bottomNavDetail = await ChannelViewModel.getBottomNavDetailData(id, this.storageChannelIds)
if (bottomNavDetail != null) {
// 3、 接口数据md5和存储数据md5对比,一致不更新
if (bottomNavDetail.md5 == bottomDetailCache?.md5) {
Logger.debug(TAG, '不使用接口数据')
} else {
Logger.debug(TAG, '使用接口数据')
this.processTopNewsTapData(bottomNavDetail, true)
//存储
ChannelViewModel.saveBottomDetailData(bottomNavDetail)
}
}
}
/**
* 加工新闻tab 顶导数据
* @param bottomNavDetail
*/
private processTopNewsTapData(bottomNavDetail: NavigationDetailDTO, isNetData: boolean) {
let topNavList = bottomNavDetail?.topNavChannelList || []
//let provinceName = SPHelper.default.getSync(SpConstants.LOCATION_PROVINCE_NAME, '') as string
let _myChannelList: TopNavDTO [] = []
this.homeChannelList = []
this.moreChannelList = []
this.localChannelList = []
topNavList.forEach(item => {
if (item.defaultPermitted === 1) {
console.debug('TopNavigationComponent', '--homeChannelList--->' + item.name)
this.homeChannelList.push(item)
}
//TODO 暂时隐藏播报
if (item.name !== '播报') {
if (item.myChannel === '1') {
...
...
@@ -645,6 +674,33 @@ export struct TopNavigationComponentNew {
}
})
//根据缓存数组排序
if (this.storageChannelIds && !isNetData) {
Logger.debug(TAG, '根据存储内容')
let sortedyChannelList: TopNavDTO [] = []
let _storageChannelIds = this.storageChannelIds.split(',')
_storageChannelIds.forEach((channelId) => {
for (let a of _myChannelList) {
if (channelId == String(a.channelId)) {
let startIndex = _myChannelList.findIndex(b => b.channelId == a.channelId)
_myChannelList.splice(startIndex, 1)
sortedyChannelList.push(a)
break;
}
}
})
// 依据存储的我的频道中频道id集合,过滤出符合条件频道,剩余的频道,针对本地频道处理,每次删除,再次进入存储的频道详情信息里面我的频道栏目的信息集合都有本地频道
if (_myChannelList.length > 0) {
_myChannelList.forEach((localChannelBean) => {
localChannelBean.localChannel = '1'
})
this.localChannelList.unshift(..._myChannelList)
}
_myChannelList = sortedyChannelList
}
this.myChannelList = _myChannelList
//缓存首页频道
...
...
@@ -653,13 +709,17 @@ export struct TopNavigationComponentNew {
this.currentTopNavSelectedIndex = index
}
// 存储我的频道栏目中的频道id信息
let channelIds: number [] = []
this.myChannelList.forEach(item => {
if (item != undefined && item.channelId != undefined) {
channelIds.push(item.channelId)
}
})
AppStorage.setOrCreate('channelIds', channelIds.join(','))
if (isNetData) {
// 存储我的频道栏目中的频道id信息
Logger.debug(TAG, '存储我的频道栏目数据')
let channelIds: number [] = []
this.myChannelList.forEach(item => {
if (item != undefined && item.channelId != undefined) {
channelIds.push(item.channelId)
}
})
AppStorage.setOrCreate('channelIds', channelIds.join(','))
}
}
}
\ No newline at end of file
...
...
sight_harmony/features/wdComponent/src/main/ets/components/setting/AboutPageUI.ets
View file @
fcf8fc7
...
...
@@ -9,7 +9,7 @@ const TAG = 'AboutPageUI';
@Component
export struct AboutPageUI {
@State listData: Array<string | Array<string>> = ['隐私授权协议', '软件许可及用户协议','
收集个人信息明示
清单','第三方信息共享清单'];
@State listData: Array<string | Array<string>> = ['隐私授权协议', '软件许可及用户协议','
APP个人信息收集
清单','第三方信息共享清单'];
@State message: string = '京ICP备16066560号-6A Copyright © 人民日报客户端\nall rights reserved.'
@State version: string = '版本号:v'
dialogController: CustomDialogController = new CustomDialogController({
...
...
sight_harmony/features/wdComponent/src/main/ets/components/skeleton/newsSkeleton.ets
View file @
fcf8fc7
...
...
@@ -14,32 +14,40 @@ export struct newsSkeleton {
Column() {
Row() {
Column() {
Image($r('app.media.peopleSeleton')).width('100%').height(47)// 后缀名不能省略
Image($r('app.media.peopleSeleton'))
.width('100%')
.height(47)// 后缀名不能省略
.interpolation(ImageInterpolation.High)
.margin({
bottom: 6
})
textArea('100%', 8)
}
.width(124)
.margin({
right: '2%'
})
.width(`76%`)
.alignItems(HorizontalAlign.Start)
.margin({ right: 5 })
Column() {
Row()
.width(
27
)
.width(
`100%`
)
.height(25)
.backgroundColor('#FFF5F5F5')
Row()
.width(
27
)
.width(
`100%`
)
.height(4)
.backgroundColor('#FFF5F5F5')
.margin({ top: 3, bottom: 3 })
Row()
.width(
27
)
.width(
`100%`
)
.height(20)
.backgroundColor('#FFF5F5F5')
// textArea(27, 25)
// textArea(27, 4)
// textArea(27, 20)
}
.width(`22%`)
.border({ width: 1 })
.borderColor('#FFF5F5F5')
.padding({
...
...
@@ -113,9 +121,9 @@ export struct newsSkeleton {
Column().backgroundColor('#909090').height(5).width(326)
}
.width('100%')
.padding({ right: 10, left: 10 })
}
.height('100%')
.width('100%')
}
}
...
...
sight_harmony/features/wdComponent/src/main/ets/repository/PageRepository.ets
View file @
fcf8fc7
...
...
@@ -192,11 +192,11 @@ export class PageRepository {
/**
* 早晚报pageInfo请求
* */
static getMorningEveningPageInfoUrl(pageId: string,
topicId:
string) {
static getMorningEveningPageInfoUrl(pageId: string,
topicId:
string) {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.PAGE_INFO_PATH;
url = url + "?pageId=" + pageId;
if(!StringUtils.isEmpty(topicId)){
url = url+ "&topicId=" + topicId;
if (!StringUtils.isEmpty(topicId)) {
url = url + "&topicId=" + topicId;
}
Logger.info(TAG, "getMorningEveningPageInfoUrl url = " + url)
return url;
...
...
@@ -237,10 +237,11 @@ export class PageRepository {
static fetchNavigationDetailDataApi(id: number = 210, myChannelIds?: string) {
let url = PageRepository.getBottomNavGroupDetailUrl() + `?id=${id}`;
// 310000 310100 310115120
let provinceCode = HttpUtils.getProvinceCode()
if (provinceCode) {
url = url + "&districtCode=" + HttpUtils.getDistrictCode()
+ "&provinceCode=" +
HttpUtils.getProvinceCode()
+ "&provinceCode=" +
provinceCode
+ "&cityCode=" + HttpUtils.getCityCode()
}
if (myChannelIds) {
...
...
@@ -395,8 +396,8 @@ export class PageRepository {
/**
* 获取早晚报pageInfo
* */
static fetchMorningEveningPageInfo(pageId: string,topicId:string) {
let url = PageRepository.getMorningEveningPageInfoUrl(pageId,topicId)
static fetchMorningEveningPageInfo(pageId: string, topicId: string) {
let url = PageRepository.getMorningEveningPageInfoUrl(pageId, topicId)
return WDHttp.get<ResponseDTO<PageInfoBean>>(url)
};
...
...
@@ -421,7 +422,7 @@ export class PageRepository {
* 获取播报pageInfo
* */
static fetchBroadcastPageInfo(pageId: string) {
let url = PageRepository.getMorningEveningPageInfoUrl(pageId,'')
let url = PageRepository.getMorningEveningPageInfoUrl(pageId,
'')
return WDHttp.get<ResponseDTO<PageInfoBean>>(url)
};
...
...
sight_harmony/features/wdComponent/src/main/ets/viewmodel/ChannelViewModel.ets
View file @
fcf8fc7
...
...
@@ -58,7 +58,7 @@ export class ChannelViewModel {
}
/**
* 保存
底
导详情数据到缓存
* 保存
顶部
导详情数据到缓存
*/
saveBottomDetailData(data: NavigationDetailDTO) {
CacheData.saveCacheData(CacheData.channelCacheDataKey + data?.id, data, data.md5)
...
...
@@ -75,7 +75,7 @@ export class ChannelViewModel {
/**
* 获取底导详情(顶导)接口数据
*/
async getBottomNavDetailData(id: number, myChannelIds?: string): Promise<NavigationDetailDTO> {
async getBottomNavDetailData(id: number, myChannelIds?: string): Promise<NavigationDetailDTO
|null
> {
Logger.info(TAG, `getBottomNavDetailData start`);
return this.getNavDetailData(id,myChannelIds);
}
...
...
@@ -111,18 +111,18 @@ export class ChannelViewModel {
* @param myChannelIds
* @returns
*/
private getNavDetailData(id: number, myChannelIds?: string): Promise<NavigationDetailDTO> {
return new Promise<NavigationDetailDTO>((success, error) => {
private getNavDetailData(id: number, myChannelIds?: string): Promise<NavigationDetailDTO|null> {
return new Promise<NavigationDetailDTO|null>((success, error) => {
Logger.info(TAG, `getNavData start`);
PageRepository.fetchNavigationDetailDataApi(id,myChannelIds).then((navResDTO: ResponseDTO<NavigationDetailDTO>) => {
if (!navResDTO || !navResDTO.data) {
Logger.error(TAG, 'getNavData then navResDTO is empty');
error('navResDTO is empty'
);
success(null
);
return
}
if (navResDTO.code != 0) {
Logger.error(TAG, `getNavData then code:${navResDTO.code}, message:${navResDTO.message}`);
error('navResDTO Response Code is failure'
);
success(null
);
return
}
// let navResStr = JSON.stringify(navResDTO);
...
...
@@ -131,7 +131,7 @@ export class ChannelViewModel {
success(navResDTO.data);
}).catch((err: Error) => {
Logger.error(TAG, `fetchNavigationDataApi catch, error.name : ${err.name}, error.message:${err.message}`);
error(err
);
success(null
);
})
})
}
...
...
sight_harmony/features/wdComponent/src/main/ets/viewmodel/PageHelper.ets
View file @
fcf8fc7
...
...
@@ -77,9 +77,9 @@ export class PageHelper {
* 进页面请求数据
*/
async getInitCacheData(pageModel: PageModel, pageAdvModel: PageAdModel) {
Logger.debug(TAG, 'getInitCacheData')
//
Logger.debug(TAG, 'getInitCacheData')
PageViewModel.getPageInfoCache(pageModel.pageId).then(pageInfo => {
Logger.debug(TAG, 'getInitCacheData back: ' + pageInfo)
//
Logger.debug(TAG, 'getInitCacheData back: ' + pageInfo)
if (pageInfo == null) {
return;
}
...
...
@@ -125,9 +125,9 @@ export class PageHelper {
this.refreshUIEnd(pageModel, false)
})
} else {
Logger.debug(TAG, 'getPageInfo')
//
Logger.debug(TAG, 'getPageInfo')
PageViewModel.getPageInfo(pageModel.pageId).then(pageInfo => {
Logger.debug(TAG, 'getPageInfo back: ' + JSON.stringify(pageInfo))
//
Logger.debug(TAG, 'getPageInfo back: ' + JSON.stringify(pageInfo))
if (pageInfo == null) {
pageModel.viewType = ViewType.EMPTY;
pageModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoContent1;
...
...
@@ -137,9 +137,9 @@ export class PageHelper {
pageModel.pageInfo = pageInfo;
if (pageInfo.md5 == pageModel.displayPageInfoMd5) {
// 缓存一致,不解析
Logger.debug(TAG, 'getPageInfo 与缓存一致,不解析广告。。。')
//
Logger.debug(TAG, 'getPageInfo 与缓存一致,不解析广告。。。')
} else {
Logger.debug(TAG, 'getPageInfo 要解析广告')
//
Logger.debug(TAG, 'getPageInfo 要解析广告')
if (pageModel.currentPage == 1) {
// 保存缓存
CacheData.saveCacheData(CacheData.comPageInfoCacheKey + pageModel.pageId, pageInfo, pageInfo.md5)
...
...
@@ -148,7 +148,7 @@ export class PageHelper {
//解析页面挂角广告资源
pageAdvModel.analysisAdvSource(pageInfo);
}
Logger.debug(TAG, 'getPageInfo go on')
//
Logger.debug(TAG, 'getPageInfo go on')
this.parseGroup(pageModel, false)
}).catch(() => {
this.refreshUIEnd(pageModel, false)
...
...
@@ -190,14 +190,14 @@ export class PageHelper {
//Logger.error("ZZZXXXXX", '楼层id-start--》' + pageModel.groupId);
let pageDto: PageDTO
Logger.debug(TAG, 'parseGroup isCache: ' + isCache)
//
Logger.debug(TAG, 'parseGroup isCache: ' + isCache)
if (isCache) {
pageDto = await PageViewModel.getPageGroupCacheData(pageModel.bizCopy()) as PageDTO
pageModel.displayGroupInfoMd5 = pageDto.md5
} else {
pageDto = await PageViewModel.getPageGroupCompData(pageModel.bizCopy()) as PageDTO
if (pageDto.md5 == pageModel.displayGroupInfoMd5) {
Logger.debug(TAG, 'parseGroup cache load, return: ' + pageDto.md5)
//
Logger.debug(TAG, 'parseGroup cache load, return: ' + pageDto.md5)
// 下拉刷新场景,数据没变,拦截刷新UI,重置相关参数
if (pageModel.loadStrategy === 2) {
// 缓存数据一致,不再刷新
...
...
@@ -211,17 +211,17 @@ export class PageHelper {
return
}
pageModel.displayGroupInfoMd5 = pageDto.md5
Logger.debug(TAG, 'parseGroup cache load, save: ' + pageDto.md5)
//
Logger.debug(TAG, 'parseGroup cache load, save: ' + pageDto.md5)
// 保存缓存
CacheData.saveCacheData(CacheData.compGroupInfoDataCacheKey + pageModel.pageId + pageModel.groupId, pageDto,
pageDto.md5)
}
Logger.debug(TAG, 'parseGroup go on')
//
Logger.debug(TAG, 'parseGroup go on')
// await,确保groups接口顺序执行
// let pageDto = page
let index = pageInfo.groups.indexOf(group)
Logger.debug(TAG, 'yyyy parseGroup print')
//
Logger.debug(TAG, 'yyyy parseGroup print')
this.printComp(pageDto)
// 解析楼层组件
this.analysisPageGroupCompData(pageDto, pageInfo)
...
...
@@ -268,7 +268,7 @@ export class PageHelper {
if (pageModel.compList.isEmpty()) {
// 没数据,展示空页面
Logger.debug(TAG, 'aboutToAppear, data response page ' + pageModel.pageId + ', comp list is empty.');
//
Logger.debug(TAG, 'aboutToAppear, data response page ' + pageModel.pageId + ', comp list is empty.');
pageModel.viewType = ViewType.EMPTY;
pageModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoContent1;
...
...
@@ -296,7 +296,7 @@ export class PageHelper {
pageInfo.pageAdList.push(...pageDto.compAdList)
}
// TODO 待删除
Logger.debug(TAG, 'yyyy analysisPageGroupCompData size, '+pageInfo?.oneRequestPageGroupCompList?.length)
//
Logger.debug(TAG, 'yyyy analysisPageGroupCompData size, '+pageInfo?.oneRequestPageGroupCompList?.length)
}
}
...
...
@@ -343,7 +343,7 @@ export class PageHelper {
pageModel.currentPage++;
pageModel.hasMore = true;
Logger.debug(TAG, 'yyyy compLoadMore print')
//
Logger.debug(TAG, 'yyyy compLoadMore print')
this.printComp(data)
//移除音频 和 活动
this.loadMorePageComp(pageModel, data)
...
...
@@ -372,7 +372,7 @@ export class PageHelper {
pageModel.pageInfo.oneRequestPageGroupCompList.add(comp)
})
// TODO 待删除
Logger.debug(TAG, 'yyyy loadMorePageComp size, ' + pageModel.pageInfo.oneRequestPageGroupCompList?.length)
//
Logger.debug(TAG, 'yyyy loadMorePageComp size, ' + pageModel.pageInfo.oneRequestPageGroupCompList?.length)
// 记录
pageModel.pageTotalCompSize = pageCompList.length + pageModel.pageTotalCompSize
...
...
@@ -398,7 +398,7 @@ export class PageHelper {
let contentInfo: ContentDTO = CollectionUtils.getElement(element.operDataList, 0);
//移除音频 和 活动
if (contentInfo && (contentInfo.objectType === '13' || contentInfo.objectType === '3')) {
Logger.debug(TAG, 'getGroupData 移除音频 和 活动');
//
Logger.debug(TAG, 'getGroupData 移除音频 和 活动');
} else {
// 暂时屏蔽活动和音频详情入口
if (element.operDataList[0]?.objectType === '3' || element.operDataList[0]?.objectType === '13') {
...
...
@@ -843,7 +843,7 @@ export class PageHelper {
* 删除分页数据,保留第一页的数据。(下拉刷新场景用到)
*/
deleteMorePage(pageModel: PageModel) {
Logger.debug(TAG, 'deleteMorePage endindex: ' + pageModel.firstPageEndIndex)
//
Logger.debug(TAG, 'deleteMorePage endindex: ' + pageModel.firstPageEndIndex)
if (pageModel.firstPageEndIndex < 0) {
return
}
...
...
@@ -855,7 +855,7 @@ export class PageHelper {
* 临时打印comp相关信息,用于问题定位。TODO 待删除
*/
private printComp(pageDto: PageDTO) {
Logger.debug(TAG, 'yyyy printComp pageDto.compList.size: ' + pageDto?.compList?.length)
//
Logger.debug(TAG, 'yyyy printComp pageDto.compList.size: ' + pageDto?.compList?.length)
new Promise<void>(() => {
let tmpCompList: CompDTO[] = Array.from(pageDto.compList)
tmpCompList.forEach((v, k) => {
...
...
@@ -863,10 +863,10 @@ export class PageHelper {
Logger.warn(TAG, 'yyyy printComp comp forEach, ' + v.compStyle)
v.operDataList.forEach((cv, ci) => {
if (cv) {
Logger.debug(TAG, 'yyyy printComp ContentDTO print, ' + v.compStyle)
Logger.debug(TAG, 'yyyy printComp ContentDTO xxxx newsTitle, ' + cv.newsTitle)
// Logger.debug(TAG, 'yyyy printComp ContentDTO print, ' + v.compStyle)
// Logger.debug(TAG, 'yyyy printComp ContentDTO xxxx newsTitle, ' + cv.newsTitle)
} else {
Logger.warn(TAG, 'yyyy printComp ContentDTO is null, ' + v.compStyle)
//
Logger.warn(TAG, 'yyyy printComp ContentDTO is null, ' + v.compStyle)
}
})
} else {
...
...
sight_harmony/features/wdLogin/src/main/ets/pages/login/LoginProtocolWebview.ets
View file @
fcf8fc7
...
...
@@ -95,6 +95,7 @@ struct LoginProtocolWebview {
}
}.width("100%")
.height("100%")
.backgroundColor(Color.White)
.padding({top:px2vp(this.topSafeHeight),bottom:px2vp(this.bottomSafeHeight)})
}
...
...
sight_harmony/features/wdTracking/src/main/ets/tracking/Tracking.ets
View file @
fcf8fc7
...
...
@@ -24,17 +24,17 @@ export class Tracking {
// Logger.error('yyyy','event track failed')
// })
let publicParams = new PublicParams()
publicParams.getPublicParams().then((pubParams) => {
if (params) {
for (const obj of Object.entries(params)) {
// Logger.info(TAG, ` ${obj[0]} => ` + `${obj[1]}`);
pubParams[obj[0]] = obj[1]
}
}
sensors.track(eventId, pubParams)
})
// let publicParams = new PublicParams()
// publicParams.getPublicParams().then((pubParams) => {
//
// if (params) {
// for (const obj of Object.entries(params)) {
// // Logger.info(TAG, ` ${obj[0]} => ` + `${obj[1]}`);
// pubParams[obj[0]] = obj[1]
// }
// }
// sensors.track(eventId, pubParams)
// })
}
}
...
...
sight_harmony/products/phone/src/main/ets/pages/ENewspaper.ets
View file @
fcf8fc7
...
...
@@ -2,14 +2,15 @@ import { ENewspaperPageComponent } from 'wdComponent';
import { DateTimeUtils, Logger } from 'wdKit';
import common from '@ohos.app.ability.common';
import window from '@ohos.window';
import { TrackingPageBrowse
,TrackConstants
} from 'wdTracking/Index';
import { TrackingPageBrowse
, TrackConstants
} from 'wdTracking/Index';
const TAG = 'ENewspaper';
//电子报主页面
@Entry
@Component
struct ENewspaper {
pageShowTime:number = 0;
pageShowTime:
number = 0;
// 获取UIAbility上下文
context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext
...
...
@@ -49,15 +50,16 @@ struct ENewspaper {
onPageShow() {
this.pageShowTime = DateTimeUtils.getTimeStamp()
this.setSystemBar('#
80000000','#8
0000000', '#FFFFFFFF')
this.setSystemBar('#
00000000', '#0
0000000', '#FFFFFFFF')
Logger.info(TAG, 'onPageShow');
}
onPageHide() {
this.setSystemBar('#FFFFFFFF','#00000000', '#000000')
this.setSystemBar('#FFFFFFFF',
'#00000000', '#000000')
Logger.info(TAG, 'onPageHide');
//页面浏览
TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.NewsPaperPage,TrackConstants.PageName.NewsPaperPage,Math.floor((DateTimeUtils.getTimeStamp() - this.pageShowTime)/1000))
TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.NewsPaperPage,
TrackConstants.PageName.NewsPaperPage, Math.floor((DateTimeUtils.getTimeStamp() - this.pageShowTime) / 1000))
}
onBackPress() {
...
...
sight_harmony/products/phone/src/main/resources/base/profile/insight_intent.json
View file @
fcf8fc7
...
...
@@ -14,6 +14,19 @@
}
},
{
"intentName"
:
"ViewColumn"
,
"domain"
:
""
,
"intentVersion"
:
"1.0.1"
,
"srcEntry"
:
"./ets/utils/InsightIntentExecutorImpl.ets"
,
"uiAbility"
:
{
"ability"
:
"EntryAbility"
,
"executeMode"
:
[
"background"
,
"foreground"
]
}
},
{
"intentName"
:
"ViewColumnUpdate"
,
"domain"
:
""
,
"intentVersion"
:
"1.0.1"
,
...
...
Please
register
or
login
to post a comment