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-11 09:27:32 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
7ed2d23246bb155087bfa017d89ed0a2c412e4e7
7ed2d232
2 parents
1d9bff33
9c4acedc
Merge remote-tracking branch 'origin/main'
Hide whitespace changes
Inline
Side-by-side
Showing
48 changed files
with
1006 additions
and
499 deletions
sight_harmony/commons/wdKit/Index.ets
sight_harmony/commons/wdKit/src/main/ets/utils/CrptoUtils.ets
sight_harmony/commons/wdKit/src/main/ets/utils/FileUtils.ets
sight_harmony/commons/wdRouter/src/main/ets/router/Action2Page.ets
sight_harmony/commons/wdRouter/src/main/ets/utils/AppInnerLink.ets
sight_harmony/commons/wdRouter/src/main/ets/utils/ProcessUtils.ets
sight_harmony/features/wdBean/src/main/ets/bean/content/Params.ts
sight_harmony/features/wdComponent/src/main/ets/components/CardParser.ets
sight_harmony/features/wdComponent/src/main/ets/components/CompParser.ets
sight_harmony/features/wdComponent/src/main/ets/components/DynamicDetailComponent.ets
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/ImageAndTextPageComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/SpacialTopicPageComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card17Component.ets
sight_harmony/features/wdComponent/src/main/ets/components/mine/home/HomePageBottomCommentComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/mine/home/OtherHomePageBottomCommentComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/page/LiveMorePage.ets
sight_harmony/features/wdComponent/src/main/ets/components/page/TopNavigationComponentNew.ets
sight_harmony/features/wdComponent/src/main/ets/components/peopleShip/PeopleShipMainComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/peopleShip/PeopleShipRecommendComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/search/SearchResultContentComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/skeleton/DefaultPage.ets
sight_harmony/features/wdComponent/src/main/ets/components/view/EmptyComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/view/PermissionDesComponent.ets
sight_harmony/features/wdComponent/src/main/ets/pages/MultiPictureListPage.ets
sight_harmony/features/wdComponent/src/main/ets/pages/OtherNormalUserHomePage.ets
sight_harmony/features/wdComponent/src/main/ets/utils/CompUtils.ets
sight_harmony/features/wdComponent/src/main/ets/viewmodel/PageFollowHelper.ets
sight_harmony/features/wdDetailPlayApi/src/main/ets/request/ContentDetailRequest.ets
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/pages/DetailPlayShortVideoPage.ets
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/pages/VideoChannelDetail.ets
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/view/PlayerRightView.ets
sight_harmony/features/wdLogin/src/main/ets/pages/login/LoginPage.ets
sight_harmony/features/wdLogin/src/main/ets/pages/login/OneKeyLoginPage.ets
sight_harmony/features/wdLogin/src/main/ets/utils/HuaweiAuth.ets
sight_harmony/features/wdShare/src/main/ets/utils/DeepLinkUtil.ets
sight_harmony/features/wdTracking/src/main/ets/tracking/Tracking.ets
sight_harmony/products/phone/src/main/ets/dailynewspaperformability/DailyNewspaperFormAbility.ets
sight_harmony/products/phone/src/main/ets/dailynewspaperformability/NewspaperDataFetcher.ets
sight_harmony/products/phone/src/main/ets/dailynewspaperwidget/common/NewspaperWidgetData.ets
sight_harmony/products/phone/src/main/ets/dailynewspaperwidget/pages/DailyNewspaperWidgetCard.ets
sight_harmony/products/phone/src/main/ets/pages/launchPage/LaunchInterestsHobbiesPage.ets
sight_harmony/products/phone/src/main/ets/pages/view/BottomNavigationComponent.ets
sight_harmony/products/phone/src/main/ets/pages/view/CustomDialogComponent.ets
sight_harmony/products/phone/src/main/ets/pages/view/VideoChannelPage.ets
sight_harmony/products/phone/src/main/ets/startupmanager/StartupManager.ets
sight_harmony/products/phone/src/main/resources/base/profile/form_config.json
sight_harmony/commons/wdKit/Index.ets
View file @
7ed2d23
...
...
@@ -67,4 +67,8 @@ export { TingyunAPM } from './src/main/ets/tingyunAPM/TingyunAPM'
export { FastClickUtil } from './src/main/ets/utils/FastClickUtil';
// export { PublicPopupDialogView } from "./src/main/ets/pubComps/dialog/PublicPopupDialogView"
export { PublicDialogManager, CloseAction } from "./src/main/ets/pubComps/dialog/PublicDialogManager"
\ No newline at end of file
export { PublicDialogManager, CloseAction } from "./src/main/ets/pubComps/dialog/PublicDialogManager"
export { CrptoUtils } from "./src/main/ets/utils/CrptoUtils"
export { FileUtils } from "./src/main/ets/utils/FileUtils"
\ No newline at end of file
...
...
sight_harmony/commons/wdKit/src/main/ets/utils/CrptoUtils.ets
0 → 100644
View file @
7ed2d23
import cryptoFramework from '@ohos.security.cryptoFramework';
import buffer from '@ohos.buffer';
export class CrptoUtils {
static md5(message: string) : Promise<string> {
return CrptoUtils.mdFunc(message, 'MD5')
}
static mdFunc(message: string, algoName: string = 'MD5'): Promise<string> {
return new Promise<string>(async (reslove, fail) => {
try {
let md = cryptoFramework.createMd(algoName);
// 数据量较少时,可以只做一次update,将数据全部传入,接口未对入参长度做限制
await md.update({ data: new Uint8Array(buffer.from(message, 'utf-8').buffer) });
let mdResult = await md.digest();
// console.info('Md result:' + mdResult.data);
// const string = mdResult.data.map((charCode, index, array) => {
// return String.fromCharCode(charCode)
// }).join("")
let string = "";
for (let i = 0; i < mdResult.data.length; i++) {
string += mdResult.data[i].toString(16).padStart(2, "0")
}
// const string = mdResult.data.join('')
reslove(string)
} catch (e) {
fail(e)
}
})
}
}
...
...
sight_harmony/commons/wdKit/src/main/ets/utils/FileUtils.ets
0 → 100644
View file @
7ed2d23
import fs from '@ohos.file.fs';
import { BusinessError } from '@kit.BasicServicesKit';
export class FileUtils {
// 文件是否存在,忽略错误
static fileExsit(path: string) : Promise<boolean> {
return new Promise((reslove, fail) => {
fs.stat(path).then(() => {
reslove(true)
}).catch((error: BusinessError) => {
if (error.code = 13900002) {
reslove(false)
} else {
reslove(true)
}
})
});
}
static makeDirIfNotExsit(path: string) : Promise<void> {
return new Promise((reslove, fail) => {
fs.stat(path).then(() => {
reslove()
}).catch((error: BusinessError) => {
if (error.code = 13900002) {
fs.mkdirSync(path)
}
reslove()
})
})
}
}
\ No newline at end of file
...
...
sight_harmony/commons/wdRouter/src/main/ets/router/Action2Page.ets
View file @
7ed2d23
...
...
@@ -49,9 +49,9 @@ export function registerRouter() {
// })
Action2Page.register("JUMP_DETAIL_PAGE", (action: Action) => {
if (action.params?.detailPageType == 2
|| action.params?.detailPageType == 6
) {
if (action.params?.detailPageType == 2) {
return WDRouterPage.detailPlayLiveCommon
} else if (action.params?.detailPageType ==
7 || action.params?.detailPageType == 8
) {
} else if (action.params?.detailPageType ==
1
) {
return WDRouterPage.detailVideoListPage
} else if (action.params?.detailPageType == 9) {
//图集详情页
...
...
@@ -59,16 +59,19 @@ export function registerRouter() {
} else if (action.params?.detailPageType == 14 || action.params?.detailPageType == 15) {
//动态详情页
return WDRouterPage.dynamicDetailPage
} else if (action.params?.detailPageType == 17) {
return WDRouterPage.multiPictureDetailPage
} else if (action.params?.detailPageType == 13) {
return WDRouterPage.audioDetail
} else if (action.params?.detailPageType == 18) {
} else if (action.params?.detailPageType == 30) {
return WDRouterPage.themeListPage
} else if (action.params?.detailPageType == 8) {
return WDRouterPage.imageTextDetailPage
}
//TODO: 以下两个最好改为pageID方式,以上都是有具体内容类型 对应详情页面
else if (action.params?.detailPageType == 18) {
return WDRouterPage.multiPictureListPage
} else if (action.params?.detailPageType == 19) {
return WDRouterPage.videoPlayPage
}else if (action.params?.detailPageType == 30) {
return WDRouterPage.themeListPage
}
return WDRouterPage.detailPlayVodPage
})
...
...
sight_harmony/commons/wdRouter/src/main/ets/utils/AppInnerLink.ets
View file @
7ed2d23
...
...
@@ -3,6 +3,7 @@ import App from '@system.app'
import { Action, Params } from 'wdBean/Index'
import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'
import { Logger } from 'wdKit/Index'
import { ContentType } from '../common/ContentType'
import { WDRouterRule } from '../router/WDRouterRule'
import { ProcessUtils } from './ProcessUtils'
...
...
@@ -111,13 +112,13 @@ export class AppInnerLink {
}
private static contentTypeWithType(type?: string) : number | undefined {
switch (type) {
case "video": return 1
case "dynamic": return 14
case "live": return 2
case "audio": return 13
case "picture": return 9
case "article": return 8
case "ask": return 16
case "video": return ContentType.Video
case "dynamic": return ContentType.DynamicImageText
case "live": return ContentType.Live
case "audio": return ContentType.Audio
case "picture": return ContentType.Pictures
case "article": return ContentType.ImageText
case "ask": return ContentType.Ask
}
return
}
...
...
sight_harmony/commons/wdRouter/src/main/ets/utils/ProcessUtils.ets
View file @
7ed2d23
import { Action, ContentDTO, Params, PhotoListBean, commentInfo } from 'wdBean';
import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO';
import { Logger,
SPHelper
} from 'wdKit';
import { Logger,
NetworkUtil, SPHelper, ToastUtils
} from 'wdKit';
import { StringUtils } from 'wdKit/src/main/ets/utils/StringUtils';
import { WDRouterRule, WDRouterPage } from '../../../../Index';
import { ContentConstants, SpConstants } from 'wdConstant';
...
...
@@ -84,6 +84,13 @@ export class ProcessUtils {
Logger.error(TAG, "processPage, objectType is empty");
return;
}
// 网络出小差了,请检查网络后重试
let netStatus = NetworkUtil.isNetConnected()
if(!netStatus){
ToastUtils.shortToast('网络出小差了,请检查网络后重试')
return
}
let type = content.objectType;
if (typeof type == "number") {
type = `${type}`
...
...
@@ -304,7 +311,7 @@ export class ProcessUtils {
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
detailPageType:
7
,
detailPageType:
1
,
contentID: content?.objectId,
extra: {
relType: content?.relType,
...
...
@@ -382,7 +389,7 @@ export class ProcessUtils {
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
detailPageType:
17
,
detailPageType:
9
,
contentID: content?.objectId,
extra: {
relType: content?.relType,
...
...
sight_harmony/features/wdBean/src/main/ets/bean/content/Params.ts
View file @
7ed2d23
...
...
@@ -10,16 +10,13 @@ export interface Params {
// 详情页类型
// 1.点播详情页
// 2.直播详情页
// 3.图文详情页
// 4.全民播详情页
// 5.欢喜详情页
// 6.挂件详情页
// 7.沉浸式竖屏详情页
// 8.专辑竖屏详情页
// 13.音频详情页
// 17.多图(图集)详情页
// 18.大图列表页
// 19.单个视频播放页
// 8.图文详情页
// 9.多图(图集)详情页
// 14和15 动态详情页
// 13 音频详情页
// 30 金刚位
// 18.大图列表页 - 图片预览 ------ 需要变更待定
// 19.单个视频播放页 - 视频播放 ----- 需要变更待定
detailPageType
?:
number
;
// 详情页类型
liveStyle
?:
number
;
// 直播类型:0横屏,1竖屏
creatorId
?:
string
;
//号主id
...
...
sight_harmony/features/wdComponent/src/main/ets/components/CardParser.ets
View file @
7ed2d23
...
...
@@ -25,6 +25,7 @@ import { TrackConstants, TrackingPageBrowse } from 'wdTracking/Index';
*/
@Component
export struct CardParser {
@State pageId: string = '';
@State pageName: string = '';
@State contentDTO: ContentDTO = new ContentDTO();
...
...
sight_harmony/features/wdComponent/src/main/ets/components/CompParser.ets
View file @
7ed2d23
...
...
@@ -45,8 +45,6 @@ export struct CompParser {
aboutToAppear(): void {
console.log('CompParser', JSON.stringify(this.compDTO))
this.pageName = this.pageModel.pageInfo.name
// 轮播图屏蔽音频类型稿件
...
...
sight_harmony/features/wdComponent/src/main/ets/components/DynamicDetailComponent.ets
View file @
7ed2d23
...
...
@@ -648,7 +648,7 @@ export struct DynamicDetailComponent {
{
contentId: this.contentDetailData?.newsId + '',
contentType: this.contentDetailData?.newsType + '',
contentRelId: this.contentDetailData?.reLInfo?.relId + '',
contentRelId: this.contentDetailData?.reLInfo?.relId
|| ''
+ '',
}
]
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/ENewspaperItemComponent.ets
View file @
7ed2d23
...
...
@@ -13,6 +13,10 @@ export struct ENewspaperItemComponent {
private startY: number = 0
private itemBeanClicked: NewspaperPositionItemBean = {} as NewspaperPositionItemBean
@State isShowSkeleton: boolean = true
@State contentWidth: number = 0
@State contentHeight: number = 0
@Consume itemPicWidth: number
@Consume itemPicHeight: number
aboutToAppear(): void {
for (let index = 0; index < this.newspaperListItemBean.items.length; index++) {
...
...
@@ -33,23 +37,28 @@ export struct ENewspaperItemComponent {
newsSkeleton()
.visibility(this.isShowSkeleton ? Visibility.Visible : Visibility.None)
Image(this.newspaperListItemBean.pagePic)
.width('100%')
.onComplete(() => {
.width(px2vp(this.itemPicWidth))
.height(px2vp(this.itemPicHeight))
.onComplete((event) => {
if (event?.loadingStatus == 1) {
this.contentWidth = event?.contentWidth
this.contentHeight = event?.contentHeight
}
this.isShowSkeleton = false
})
.objectFit(ImageFit.
Contain
)
.objectFit(ImageFit.
Fill
)
.visibility(this.isShowSkeleton ? Visibility.None : Visibility.Visible)
if (this.contentWidth !== 0) {
Canvas(this.context)
.width(px2vp(this.contentWidth))
.height(px2vp(this.contentHeight))
.backgroundColor(Color.Transparent)
.onReady(() => {
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor(Color.Transparent)
.onReady(() => {
})
})
}
}
.padding({ top:14, right: 10, bottom: 14, left: 10 })
.margin({ left: 10, right: 10 })
.backgroundColor(Color.White)
.width('100%')
.onTouch((event: TouchEvent) => {
...
...
@@ -59,6 +68,7 @@ export struct ENewspaperItemComponent {
this.startX = x;
this.startY = y;
let points: number[][] = this.getArea(x, y, this.newspaperListItemBean.items);
console.log("event.points", JSON.stringify(points))
if (points && points.length > 2) {
let path = new Path2D();
path.moveTo(px2vp(points[0][0]), px2vp(points[0][1]));
...
...
sight_harmony/features/wdComponent/src/main/ets/components/ENewspaperPageComponent.ets
View file @
7ed2d23
...
...
@@ -21,8 +21,10 @@ export struct ENewspaperPageComponent {
private windowClass?: window.Window;
private displayTool = display.getDefaultDisplaySync()
private screenWidth: number = 0
priv
ate picWidth: number = 0
@St
ate picWidth: number = 0
@State picHeight: number = 0
@Provide itemPicWidth: number = 0
@Provide itemPicHeight: number = 0
@State newspaperListBean: NewspaperListBean = {} as NewspaperListBean
@Provide @Watch('onCurrentPageNumUpdated') currentPageNum: string = '01'
@State pageDialogShow: boolean = false
...
...
@@ -131,13 +133,19 @@ export struct ENewspaperPageComponent {
this.screenWidth = this.windowClass?.getWindowProperties()?.windowRect.width
console.log('ENewspaperPageComponent this.screenWidth', this.screenWidth)
// 2000折叠屏 TODO DeviceUtil 方法完善了换判断条件
this.ratio = this.screenWidth > 2000 ? '
6
0%' : '100%'
this.ratio = this.screenWidth > 2000 ? '
5
0%' : '100%'
//获取宽高尺寸
this.picWidth = this.screenWidth - vp2px(52)
// Swiper .margin({ left: 10, right: 10 })
this.picWidth = this.screenWidth - vp2px(20)
let screenHeight = this.displayTool.height;
// bottomSafeHeight 底导高度 topSafeHeight 顶导高度 44 顶部高度 60 底部高度
let height = screenHeight - this.bottomSafeHeight - this.topSafeHeight - vp2px(44) - vp2px(60)
// newspaper_shadow 49 高度 e_newspaper_content 59 margin top
let height = screenHeight - this.bottomSafeHeight - this.topSafeHeight - vp2px(44) - vp2px(60) - vp2px(49) -vp2px(59)
this.picHeight = height
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
...
...
@@ -168,7 +176,10 @@ export struct ENewspaperPageComponent {
this.windowClass?.on('windowSizeChange', () => {
this.screenWidth = this.windowClass?.getWindowProperties()?.windowRect.width || this.displayTool.width
// 2000折叠屏 TODO DeviceUtil 方法完善了换判断条件
this.ratio = this.screenWidth > 2000 ? '60%' : '100%'
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
});
}
...
...
@@ -248,7 +259,7 @@ export struct ENewspaperPageComponent {
.id('news_skeleton_id')
.width('100%')
.height(px2vp(this.picHeight) + 32)
.margin({ top:
35
, left: 10, right: 10 })
.margin({ top:
59
, left: 10, right: 10 })
}
if (this.newspaperListBean && this.newspaperListBean.list && this.newspaperListBean.list.length > 0) {
...
...
@@ -259,16 +270,15 @@ export struct ENewspaperPageComponent {
}
.itemSpace(10)
.index(this.swiperIndex)
.width(this.ratio)
// newspaper_shadow 44 高度 e_newspaper_content 35 margin top
.height(px2vp(this.picHeight) - 44 - 35)
.width(px2vp(this.picWidth))
.height(px2vp(this.picHeight))
.vertical(true)
.autoPlay(false)
.cachedCount(1)
.indicator(false)
.loop(false)
.displayCount(1)
.margin({ top:
35
, left: 10, right: 10 })
.margin({ top:
59
, left: 10, right: 10 })
.id('e_newspaper_content')
.alignRules({
top: { anchor: "e_newspaper_top", align: VerticalAlign.Bottom },
...
...
@@ -298,6 +308,7 @@ export struct ENewspaperPageComponent {
'滑动查看下一版')
.fontColor(Color.White)
.fontSize($r('app.float.font_size_14'))
.lineHeight(20)
Image($r('app.media.icon_next_page'))
.width($r('app.float.vp_16'))
.height($r('app.float.vp_16'))
...
...
@@ -305,7 +316,7 @@ export struct ENewspaperPageComponent {
Visibility.Visible)
}
.justifyContent(FlexAlign.Center)
.margin({ top:
$r('app.float.margin_16')
})
.margin({ top:
17
})
.alignRules({
top: { anchor: "e_newspaper_shadow", align: VerticalAlign.Bottom },
middle: { anchor: "__container__", align: HorizontalAlign.Center }
...
...
@@ -434,10 +445,15 @@ 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.itemPicHeight = this.picHeight - vp2px(28)
try {
if (NetworkUtil.isNetConnected()) {
let listBean =
await NewspaperViewModel.getNewspaperList(this.calendarDate, this.
picWidth + 'x' + this.p
icHeight)
await NewspaperViewModel.getNewspaperList(this.calendarDate, this.
itemPicWidth + 'x' + this.itemP
icHeight)
this.newspaperListBean = listBean;
} else {
this.showToastTip('网络出小差了,请检查网络后重试')
...
...
sight_harmony/features/wdComponent/src/main/ets/components/ImageAndTextPageComponent.ets
View file @
7ed2d23
...
...
@@ -95,7 +95,7 @@ export struct ImageAndTextPageComponent {
if (this.contentDetailData?.openLikes && this.contentDetailData?.likesStyle !== 4) {
Row() {
Row() {
if (this.newsStatusOfUser?.likeStatus ==
=
'1') {
if (this.newsStatusOfUser?.likeStatus == '1') {
Image(this.contentDetailData?.likesStyle === 1 ? $r('app.media.ic_like_check') :
(this.contentDetailData?.likesStyle === 2 ? $r('app.media.icon_prayer_active') :
$r('app.media.icon_candle_active')))
...
...
@@ -112,7 +112,7 @@ export struct ImageAndTextPageComponent {
if (this.likeNum > 0) {
Text(NumberFormatterUtils.formatNumberWithWan(this.likeNum))
.fontSize(16)
.fontColor(this.newsStatusOfUser?.likeStatus ==
=
'1' ? '#ED2800' : '#999999')
.fontColor(this.newsStatusOfUser?.likeStatus == '1' ? '#ED2800' : '#999999')
.fontWeight(500)
.margin({ left: 5 })
}
...
...
@@ -343,7 +343,7 @@ export struct ImageAndTextPageComponent {
{
contentId: this.contentDetailData?.newsId + '',
contentType: this.contentDetailData?.newsType + '',
contentRelId: this.contentDetailData?.reLInfo?.relId + '',
contentRelId: this.contentDetailData?.reLInfo?.relId
|| ''
+ '',
}
]
}
...
...
@@ -367,7 +367,7 @@ export struct ImageAndTextPageComponent {
return
}
const params: postExecuteLikeParams = {
status: this.newsStatusOfUser?.likeStatus ==
=
'1' ? '0' : '1',
status: this.newsStatusOfUser?.likeStatus == '1' ? '0' : '1',
contentId: this.contentDetailData?.newsId + '',
contentType: this.contentDetailData?.newsType + '',
}
...
...
@@ -375,7 +375,7 @@ export struct ImageAndTextPageComponent {
console.log(TAG, '点赞、取消点赞', 'toggleLikeStatus==',)
if (this.newsStatusOfUser) {
//内容点赞、取消点赞Tracking 1点赞 0取消点赞
TrackingContent.like(this.newsStatusOfUser?.likeStatus ==
=
'1', TrackConstants.PageName.My, TrackConstants.PageName.My)
TrackingContent.like(this.newsStatusOfUser?.likeStatus == '1', TrackConstants.PageName.My, TrackConstants.PageName.My)
this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus == '1' ? '0' : '1'
this.queryContentInteractCount()
}
...
...
@@ -395,6 +395,7 @@ export struct ImageAndTextPageComponent {
}]
}
PageRepository.getContentInteract(params).then(res => {
console.error(TAG, 'res', JSON.stringify(res))
if (res.data) {
this.interactData = res.data[0]
this.likeNum = Number(res.data[0]?.likeNum) || 0
...
...
sight_harmony/features/wdComponent/src/main/ets/components/SpacialTopicPageComponent.ets
View file @
7ed2d23
...
...
@@ -17,6 +17,7 @@ import { CommentDialogView } from './CommentDialogView';
const TAG: string = 'SpacialTopicPageComponent'
//专题详情页
@Component
export struct SpacialTopicPageComponent {
webviewControl: BridgeWebViewControl = new BridgeWebViewControl()
...
...
@@ -38,6 +39,7 @@ export struct SpacialTopicPageComponent {
@State operationButtonList: string[] = ['comment', 'collect', 'share']
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
@State isNetConnected: boolean = true
@Provide topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
private trySendData2H5() {
if (!this.webPrepared || !this.dataPrepared) {
...
...
@@ -189,7 +191,7 @@ export struct SpacialTopicPageComponent {
}).padding({ bottom: 200 })
} else {
if (!this.isPageEnd) {
detailedSkeleton().padding({ bottom: this.bottomSafeHeight })
detailedSkeleton().padding({
top:`${this.topSafeHeight}px`,
bottom: this.bottomSafeHeight })
}
}
//底部交互区
...
...
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card17Component.ets
View file @
7ed2d23
...
...
@@ -120,7 +120,7 @@ export struct Card17Component {
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
detailPageType:
17
,
detailPageType:
9
,
contentID: this.contentDTO.objectId,
extra: {
relType: this.contentDTO.relType,
...
...
sight_harmony/features/wdComponent/src/main/ets/components/mine/home/HomePageBottomCommentComponent.ets
View file @
7ed2d23
...
...
@@ -50,6 +50,7 @@ export struct HomePageBottomCommentComponent {
CustomPullToRefresh({
alldata:this.data_comment,
scroller:this.scroller,
hasMore:this.hasMore,
customList:()=>{
this.ListLayout()
},
...
...
@@ -184,7 +185,7 @@ export struct HomePageBottomCommentComponent {
this.count = this.data_comment.totalCount()
this.commentNum = value.totalCount
if (
this.data_comment.totalCount() < value.totalCount
) {
if (
value.pageNum === 1
) {
this.curPageNum++
} else {
this.hasMore = false
...
...
@@ -217,7 +218,7 @@ export struct HomePageBottomCommentComponent {
this.count = this.data_comment.totalCount()
this.commentNum = value.totalCount
if (
this.data_comment.totalCount() < value.totalCount
) {
if (
value.pageNum === 1
) {
this.curPageNum++
} else {
this.hasMore = false
...
...
sight_harmony/features/wdComponent/src/main/ets/components/mine/home/OtherHomePageBottomCommentComponent.ets
View file @
7ed2d23
...
...
@@ -50,6 +50,7 @@ export struct OtherHomePageBottomCommentComponent {
CustomPullToRefresh({
alldata:this.data_comment,
scroller:this.scroller,
hasMore:this.hasMore,
customList:()=>{
this.ListLayout()
},
...
...
@@ -69,6 +70,7 @@ export struct OtherHomePageBottomCommentComponent {
this.isLoading = true
//加载分页数据
this.getNewPageData()
if(resolve) resolve('刷新成功')
}
}
})
...
...
@@ -96,6 +98,7 @@ export struct OtherHomePageBottomCommentComponent {
}).onVisibleAreaChange([0.0, 1.0], (isVisible: boolean, currentRatio: number) => {
if (isVisible) {
let contentDTO = getParams(item)
//埋点crash 后面看看
TrackingContent.common(TrackConstants.EventType.Show, TrackConstants.PageName.Customer_Personal,TrackConstants.PageName.Customer_Personal, TrackParamConvert.program(contentDTO))
}
})
...
...
@@ -126,7 +129,7 @@ export struct OtherHomePageBottomCommentComponent {
.borderRadius(12)
}
getNewPageData() {
getNewPageData() {
this.isLoading = true
if (this.hasMore) {
let time = encodeURI(DateTimeUtils.getCurDate(DateTimeUtils.PATTERN_DATE_TIME_HYPHEN))
...
...
@@ -185,7 +188,7 @@ export struct OtherHomePageBottomCommentComponent {
this.count = this.data_comment.totalCount()
this.commentNum = value.totalCount
if (
this.data_comment.totalCount() < value.totalCount
) {
if (
value.hasNext === 1
) {
this.curPageNum++
} else {
this.hasMore = false
...
...
@@ -214,7 +217,7 @@ export struct OtherHomePageBottomCommentComponent {
this.count = this.data_comment.totalCount()
this.commentNum = value.totalCount
if (
this.data_comment.totalCount() < value.totalCount
) {
if (
value.hasNext === 1
) {
this.curPageNum++
} else {
this.hasMore = false
...
...
sight_harmony/features/wdComponent/src/main/ets/components/page/LiveMorePage.ets
View file @
7ed2d23
import { ContentDTO, LiveRoomDataBean } from 'wdBean';
import { ProcessUtils } from 'wdRouter';
import PageViewModel from '../../viewmodel/PageViewModel';
import { DateTimeUtils, LazyDataSource, Logger } from 'wdKit/Index';
import { DateTimeUtils, LazyDataSource, Logger
, NetworkUtil
} from 'wdKit/Index';
import { router } from '@kit.ArkUI';
import { ViewType } from 'wdConstant/src/main/ets/enum/ViewType';
import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh';
import { PeopleShipNoMoreData } from '../reusable/PeopleShipNoMoreData';
import { EmptyComponent } from '../view/EmptyComponent';
import { EmptyComponent
, WDViewDefaultType
} from '../view/EmptyComponent';
import { ErrorComponent } from '../view/ErrorComponent';
import LoadMoreLayout from '../page/LoadMoreLayout';
import { LottieView } from '../../components/lottie/LottieView';
import dataPreferences from '@ohos.data.preferences';
import { BusinessError } from '@ohos.base';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { channelSkeleton } from '../skeleton/channelSkeleton';
const TAG: string = 'LiveMorePage';
...
...
@@ -41,12 +42,13 @@ struct LiveMorePage {
@State private hasMore: boolean = true
@State private currentPage: number = 1
@State private isLoading: boolean = false
@State viewType: ViewType = ViewType.LOADING
private scroller: Scroller = new Scroller()
@State liveRoomList: LiveRoomDataBean[] = []
// 点击过的数据
@State clickDatas: Array<string> = []
@State loadImg: boolean = false;
@State viewType: ViewType = ViewType.LOADING
emptyType: WDViewDefaultType = WDViewDefaultType.WDViewDefaultType_Default
async aboutToAppear(): Promise<void> {
await this.getPreferencesFromStorage()
...
...
@@ -63,15 +65,14 @@ struct LiveMorePage {
this.TabbarNormal()
if (this.viewType == ViewType.LOADING) {
this.LoadingLayout()
} else if (this.viewType == ViewType.ERROR) {
ErrorComponent()
.onTouch(() => {
if (this.viewType === ViewType.ERROR) {
this.getData()
}
})
} else if (this.viewType == ViewType.EMPTY) {
EmptyComponent()
} else if (this.viewType == ViewType.EMPTY || this.viewType == ViewType.ERROR) {
EmptyComponent({
emptyType: this.emptyType,
emptyButton: true,
retry: () => {
this.getData()
}
})
} else {
CustomPullToRefresh({
alldata: this.data,
...
...
@@ -91,13 +92,15 @@ struct LiveMorePage {
.padding({
left: $r('app.float.card_comp_pagePadding_lf'),
right: $r('app.float.card_comp_pagePadding_lf'),
top:px2vp(this.topSafeHeight),bottom:px2vp(this.bottomSafeHeight)
top: px2vp(this.topSafeHeight),
bottom: px2vp(this.bottomSafeHeight)
})
}
@Builder
LoadingLayout() {
channelSkeleton()
}
@Builder
...
...
@@ -208,6 +211,7 @@ struct LiveMorePage {
/*导航栏*/
@Builder
TabbarNormal() {
RelativeContainer() {
//标题栏目
Image($r('app.media.icon_arrow_left'))
...
...
@@ -223,7 +227,7 @@ struct LiveMorePage {
router.back()
})
Text(this.title)
// .height('42lpx')
Text(this.title)
.maxLines(1)
.id("title")
.fontSize('18vp')
...
...
@@ -298,6 +302,18 @@ struct LiveMorePage {
}
return
}
// 检测网络
let netStatus = NetworkUtil.isNetConnected()
if (!netStatus) {
this.emptyType = WDViewDefaultType.WDViewDefaultType_NoNetwork
this.viewType = ViewType.ERROR
return
}
this.isLoading = true
try {
const liveReviewDTO = await PageViewModel.getLiveMoreUrl(this.type, this.currentPage, this.pageSize)
...
...
@@ -319,17 +335,12 @@ struct LiveMorePage {
this.resolveEnd(true, resolve)
if (liveReviewDTO.list.length == 0 && this.currentPage == 1) {
this.viewType = ViewType.EMPTY
this.emptyType = WDViewDefaultType.WDViewDefaultType_NoListContent
}
} catch (exception) {
this.resolveEnd(false, resolve)
}
// PageViewModel.getLiveMoreUrl(this.type, this.currentPage, this.pageSize).then(async (liveReviewDTO) => {
// // this.operDataList = []
// // this.operDataList.push(...liveReviewDTO.list)
// this.data.push(...liveReviewDTO.list)
//
// // this.getAppointmentInfo()
// })
}
private resolveEnd(isTop: boolean, resolve?: (value: string | PromiseLike<string>) => void) {
...
...
@@ -341,7 +352,9 @@ struct LiveMorePage {
}
}
if (this.currentPage == 1 && !isTop) {
this.viewType = ViewType.ERROR
this.emptyType = WDViewDefaultType.WDViewDefaultType_NoListContent
} else {
this.viewType = ViewType.LOADED
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/page/TopNavigationComponentNew.ets
View file @
7ed2d23
...
...
@@ -11,6 +11,7 @@ import { channelSkeleton } from '../skeleton/channelSkeleton';
import { TrackConstants, TrackingButton } from 'wdTracking/Index';
import DailyPaperTopicModel from '../../model/DailyPaperTopicModel'
import { ParamType, Tracking } from 'wdTracking/Index';
import { CompUtils } from '../../utils/CompUtils';
const TAG = 'TopNavigationComponent';
...
...
@@ -23,27 +24,16 @@ const storage = LocalStorage.getShared();
@Component
export struct TopNavigationComponentNew {
private topRectHeight: string = AppStorage.get<number>('topSafeHeight') + 'px';
/**
* @deprecated
*/
private groupId: number = 0
/**
* @deprecated TODO type判断
*/
private currentBottomNavName: string = ''
private pageName: string = ''
private pageId: number = 0
private swiperController: SwiperController = new SwiperController()
private listScroller: Scroller = new Scroller()
@Consume barBackgroundColor: Color
/**
* @deprecated
*/
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
/**
*
@deprecated
*
首页 底导 某个tab 对象
*/
@State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
navItem: BottomNavDTO = {} as BottomNavDTO
@Consume barBackgroundColor: Color
@Link _currentNavIndex?: number;
// 顶导当前选中/焦点下标
@State @Watch('updateCurrentTopNavSelectedIndex') currentTopNavSelectedIndex: number = 0;
...
...
@@ -70,7 +60,6 @@ export struct TopNavigationComponentNew {
@State animationDuration: number = 0
@State indicatorLeftMargin: number = 0
@State indicatorWidth: number = 0
private tabsWidth: number = 0
build() {
Column() {
...
...
@@ -78,9 +67,10 @@ export struct TopNavigationComponentNew {
RelativeContainer() {
this.tabBar()
Swiper(this.swiperController) {
ForEach(
this.currentBottomNavName === '新闻'
? this.myChannelList : this.topNavList,
ForEach(
CompUtils.isNews(this.navItem)
? this.myChannelList : this.topNavList,
(navItem: TopNavDTO, index: number) => {
if (this.currentBottomNavName === '人民号' && navItem.name === '关注') {
if (CompUtils.isRMH(this.navItem) && navItem.channelType === 3) {
// 人民号 -- 关注tab
PeopleShipMainComponent({
currentTopNavSelectedIndex: $currentTopNavSelectedIndex,
navIndex: index,
...
...
@@ -203,8 +193,7 @@ export struct TopNavigationComponentNew {
@Builder
tabBar() {
// TODO 判断是否新闻tab,修改方法(,_currentNavIndex==0 都不对,需要用type)(用topStyle)
if (this.currentBottomNavName === '新闻') {
if (CompUtils.isNews(this.navItem)) {
// 顶部搜索、日报logo、早晚报
this.topBar()
ChannelSubscriptionLayout({
...
...
@@ -233,13 +222,9 @@ export struct TopNavigationComponentNew {
.listDirection(Axis.Horizontal)
.scrollBar(BarState.Off)
.edgeEffect(EdgeEffect.None)
.padding({ left: 8, top:0, right: 0 })
.padding({ left: 8, top:
0, right: 0 })
.height($r('app.float.top_tab_bar_height'))
.backgroundColor(this.barBackgroundColor)
.onAreaChange((oldValue: Area, newValue: Area) => {
let width = Number.parseFloat(newValue.width.toString())
this.tabsWidth = Number.isNaN(width) ? 0 : width
})
.id('tabList')
.alignRules({
'top': { 'anchor': 'topBar', 'align': VerticalAlign.Bottom },
...
...
@@ -278,10 +263,6 @@ export struct TopNavigationComponentNew {
.listDirection(Axis.Horizontal)
.scrollBar(BarState.Off)
.edgeEffect(EdgeEffect.None)
.onAreaChange((oldValue: Area, newValue: Area) => {
let width = Number.parseFloat(newValue.width.toString())
this.tabsWidth = Number.isNaN(width) ? 0 : width
})
.height($r('app.float.top_tab_bar_height_common'))
.backgroundColor(this.barBackgroundColor)
.id('tabList')
...
...
@@ -347,14 +328,18 @@ export struct TopNavigationComponentNew {
} else if (this.isLayoutByIndex(index)) {
ProcessUtils.gotoENewsPaper()
} else {
this.currentTopNavSelectedIndex = index
this.changePage(index)
}
}
})
}
/**
* 改变频道页
* @param index 频道所在的序列号
*/
private changePage(index: number) {
this.currentTopNavSelectedIndex = index
this.swiperController.changeIndex(index)
this.listScroller.scrollToIndex(index, true, ScrollAlign.CENTER)
}
...
...
@@ -494,10 +479,9 @@ export struct TopNavigationComponentNew {
}
updateCurrentTopNavSelectedIndex() {
Logger.info(TAG, `currentTopNavSelectedIndex : ${this.currentTopNavSelectedIndex}、${this.currentBottomNavName}`);
// 顶部tab埋点
if (
this.currentBottomNavName === '新闻'
) {
if (
CompUtils.isVideo(this.navItem)
) {
const tab = this.myChannelList[this.currentTopNavSelectedIndex]
Logger.info(TAG, `新闻tab埋点: ${JSON.stringify(tab)}`);
...
...
@@ -507,7 +491,7 @@ export struct TopNavigationComponentNew {
"pageId": tab.pageId,
}
Tracking.event("home_page_tab_click ", params)
} else if (
this.currentBottomNavName === '人民号'
) {
} else if (
CompUtils.isRMH(this.navItem)
) {
const tab = this.topNavList[this.currentTopNavSelectedIndex]
Logger.info(TAG, `人民号tab埋点: ${JSON.stringify(tab)}`);
...
...
sight_harmony/features/wdComponent/src/main/ets/components/peopleShip/PeopleShipMainComponent.ets
View file @
7ed2d23
import { PeopleShipRecommendComponent } from './PeopleShipRecommendComponent';
import { PeopleShipMainViewModel } from '../../viewmodel/PeopleShipMainViewModel';
import {
HttpUtils } from 'wdNetwork/Index';
import { HttpUtils } from 'wdNetwork/Index';
import { Logger, DateTimeUtils, EmitterEventId, EmitterUtils } from 'wdKit';
import {
RmhRecommendDTO,
...
...
@@ -21,25 +21,27 @@ import { FollowListDetailItem } from '../../viewmodel/FollowListDetailItem';
import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh';
import PageModel from '../../viewmodel/PageModel';
import PageAdModel from '../../viewmodel/PageAdvModel';
import PageHelper from '../../viewmodel/PageHelper';
import { PeopleShipAttentionContentListTopComponent } from './PeopleShipAttentionContentListTopComponent'
import { CardParser } from '../CardParser'
import { PeopleShipNoMoreData } from '../reusable/PeopleShipNoMoreData';
import PageFollowHelper from '../../viewmodel/PageFollowHelper';
const TAG = 'PeopleShipMainComponent';
@Preview
/**
* 人民号 --- 关注
*/
@Component
export struct PeopleShipMainComponent {
@State private pageModel: PageModel = new PageModel();
@State private pageAdvModel: PageAdModel = new PageAdModel();
// 自动刷新通知
@Prop @Watch('onAutoRefresh') autoRefresh: number = 0
navIndex: number = 0;
pageId: string = "";
channelId: string = "";
@Link @Watch('onChange') currentTopNavSelectedIndex: number
private scroller: Scroller = new Scroller()
//
private scroller: Scroller = new Scroller()
private listScroller: Scroller = new Scroller()
@State rmhList: RmhRecommendDTO[] = []
@Provide rmhSelectedList: string[] = []
@State viewType: ViewType = ViewType.LOADING
...
...
@@ -54,7 +56,6 @@ export struct PeopleShipMainComponent {
@State private currentPage: number = 1
@State private isLoading: boolean = false
@State private loadTime: string = ''
// 页面展示监听
@Consume @Watch('onPageShowChange') pageShow: number
@State private pageAttentionChange: boolean = false
...
...
@@ -84,7 +85,7 @@ export struct PeopleShipMainComponent {
if (this.followList.length == 0) {
CustomPullToRefresh({
alldata: this.rmhList,
scroller: this.
s
croller,
scroller: this.
listS
croller,
hasMore: false,
customList: () => {
this.ListLayout()
...
...
@@ -94,7 +95,7 @@ export struct PeopleShipMainComponent {
this.getData(resolve)
},
})
}else {
}
else {
CustomPullToRefresh({
alldata: this.attentionList,
scroller: this.listScroller,
...
...
@@ -106,19 +107,19 @@ export struct PeopleShipMainComponent {
this.currentPage = 1
this.getData(resolve)
},
onLoadMore:
(resolve)
=> {
onLoadMore:
(resolve)
=> {
if (this.hasMore === false) {
if(resolve) {
if
(resolve) {
resolve('')
}
return
}
if
(!this.isLoading && this.hasMore)
{
if
(!this.isLoading && this.hasMore)
{
//加载分页数据
this.currentPage++;
this.getAttentionContentListData(resolve)
}else {
if(resolve) {
} else {
if (resolve) {
resolve('')
}
}
...
...
@@ -135,13 +136,16 @@ export struct PeopleShipMainComponent {
@Builder
ListLayout() {
Scroll(this.scroller) {
// 推荐人民号
PeopleShipRecommendComponent({
rmhList: this.rmhList,
oneKeyFollow: this.oneKeyFollow,
changeButton: this.changeButton
})
List({ scroller: this.listScroller }) {
// 头部关注列表
ListItem() {
PeopleShipRecommendComponent({
rmhList: this.rmhList,
oneKeyFollow: this.oneKeyFollow,
changeButton: this.changeButton
})
}
}
.edgeEffect(EdgeEffect.None)
.scrollBar(BarState.Off)
...
...
@@ -151,20 +155,25 @@ export struct PeopleShipMainComponent {
@Builder
ListAttentionLayout() {
List({
scroller: this.listScroller})
{
List({
scroller: this.listScroller })
{
// 头部关注列表
ListItem(){
ListItem()
{
PeopleShipAttentionContentListTopComponent({
followList: this.followList
})
}
ForEach(this.attentionList, (item: ContentDTO) => {
ListItem() {
CardParser({compDTO:new CompDTO, contentDTO: item })
Column(){
CardParser({ compDTO: new CompDTO, contentDTO: item })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
}.width('100%')
}.width("100%")
.backgroundColor(Color.Transparent)
}, (item: ContentDTO, index: number) =>
item.objectId + index.toString())
}, (item: ContentDTO, index: number) => item.objectId + index.toString())
// 加载更多
ListItem() {
...
...
@@ -191,7 +200,8 @@ export struct PeopleShipMainComponent {
}
onChange() {
if (this.navIndex === this.currentTopNavSelectedIndex && (this.viewType == ViewType.LOADING || this.pageAttentionChange)) {
if (this.navIndex === this.currentTopNavSelectedIndex &&
(this.viewType == ViewType.LOADING || this.pageAttentionChange)) {
this.getData();
}
}
...
...
@@ -219,7 +229,6 @@ export struct PeopleShipMainComponent {
this.getRmhRecommendInfo(resolve)
} else {
this.followList = []
// this.followList = followInfo.list
this.followList.push(...followInfo.list)
this.attentionList = []
this.currentPage = 1
...
...
@@ -287,7 +296,7 @@ export struct PeopleShipMainComponent {
}
//批量查询各类型内容动态数据接口
this.checkContentInteractData(listData.list, resolve)
} else
{
} else {
this.hasMore = false;
this.resolveEnd(true, resolve)
}
...
...
@@ -317,7 +326,7 @@ export struct PeopleShipMainComponent {
this.resolveEnd(true, resolve)
list.forEach((element: ContentDTO) => {
// 获取 interactData 数据
if (listData &&
listData.length > 0) {
if (listData && listData.length > 0) {
const objc = listData.find((interactModel: InteractDataDTO) => {
return element.objectId == interactModel.contentId
})
...
...
@@ -341,7 +350,7 @@ export struct PeopleShipMainComponent {
if (resolve) {
if (this.currentPage == 1 && isTop) {
resolve('已更新至最新')
}
else
{
}
else
{
resolve('')
}
}
...
...
@@ -355,12 +364,13 @@ export struct PeopleShipMainComponent {
// 说是首页必须要调用
async getInitData() {
Logger.debug('PeopleShipMainComponent', `getData id: ${this.pageId} , ${this.channelId} , navIndex: ${this.currentTopNavSelectedIndex}`);
Logger.debug('PeopleShipMainComponent',
`getData id: ${this.pageId} , ${this.channelId} , navIndex: ${this.currentTopNavSelectedIndex}`);
this.pageModel.pageId = this.pageId;
this.pageModel.groupId = this.pageId;
this.pageModel.channelId = this.channelId;
this.pageModel.currentPage = 1;
Page
Helper.getInitData(this.pageModel, this.pageAdv
Model)
Page
FollowHelper.getInitData(this.page
Model)
}
// 点击一键关注
...
...
@@ -386,7 +396,7 @@ export struct PeopleShipMainComponent {
// 获取列表数据
let objects = new AttentionBatchDTO()
this.rmhList.forEach((element: RmhRecommendDTO) => {
if (
this.rmhSelectedList.indexOf(element.creatorId) != -1) {
if (this.rmhSelectedList.indexOf(element.creatorId) != -1) {
const creator = new CreatorDTO(element.userType, element.userId, element.creatorId)
objects.creators.push(creator)
}
...
...
@@ -411,7 +421,7 @@ export struct PeopleShipMainComponent {
// 页面展示监听
onPageShowChange() {
if (this.navIndex === this.currentTopNavSelectedIndex && this.pageAttentionChange
) {
if (this.navIndex === this.currentTopNavSelectedIndex && this.pageAttentionChange) {
this.getData()
}
}
...
...
@@ -422,6 +432,7 @@ export struct PeopleShipMainComponent {
}
// 当前页面,自动刷新数据
Logger.debug(TAG, 'page onAutoRefresh ' + this.autoRefresh)
this.listScroller.scrollToIndex(0)
this.currentPage = 1
this.getData()
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/peopleShip/PeopleShipRecommendComponent.ets
View file @
7ed2d23
...
...
@@ -56,7 +56,6 @@ export struct PeopleShipRecommendComponent {
.width('100%')
.alignSelf(ItemAlign.Start)
.margin({
top: '-50vp',
bottom: '10vp'
})
...
...
sight_harmony/features/wdComponent/src/main/ets/components/search/SearchResultContentComponent.ets
View file @
7ed2d23
...
...
@@ -294,11 +294,12 @@ export struct SearchResultContentComponent {
CardParser({compDTO:new CompDTO, contentDTO: item })
}
if (index != this.data.totalCount() - 1) {
Divider()
.width('100%')
.height('1lpx')
.color($r('app.color.color_F5F5F5'))
.strokeWidth('1lpx')
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
// Divider()
// .width('100%')
// .height('1lpx')
// .color($r('app.color.color_F5F5F5'))
// .strokeWidth('1lpx')
}
}
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/skeleton/DefaultPage.ets
deleted
100644 → 0
View file @
1d9bff3
import { EmptyComponent } from '../view/EmptyComponent'
@Entry
@Component
export struct DefaultPage {
@State type: number = 15
retry() {
console.log('daj点击了重试')
}
build() {
Row() {
EmptyComponent({
emptyType: this.type,
retry: () => {
this.retry()
}
})
// .height('612lpx')
// .width('100%')
}
}
}
\ No newline at end of file
sight_harmony/features/wdComponent/src/main/ets/components/view/EmptyComponent.ets
View file @
7ed2d23
...
...
@@ -96,17 +96,11 @@ export struct EmptyComponent {
}
}
onPageShow(): void {
this.createTimer()
}
aboutToAppear(): void {
this.createTimer()
}
onPageHide(): void {
this.destroyTimer()
}
aboutToDisappear() {
this.destroyTimer()
...
...
sight_harmony/features/wdComponent/src/main/ets/components/view/PermissionDesComponent.ets
View file @
7ed2d23
@Component
export struct PermissionDesComponent {
@State translateY: number = 0
@State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
aboutToAppear(): void {
this.startDismiss()
...
...
@@ -29,7 +30,7 @@ export struct PermissionDesComponent {
// .height(60)
.backgroundColor('#FFFFFF')
.border({ radius: 5 })
.margin({ top:
12
})
.margin({ top:
px2vp(this.topSafeHeight)
})
.padding(12)
.zIndex(20)
}
...
...
sight_harmony/features/wdComponent/src/main/ets/pages/MultiPictureListPage.ets
View file @
7ed2d23
...
...
@@ -74,9 +74,9 @@ export struct MultiPictureListPage {
center: { anchor: "__container__", align: VerticalAlign.Center },
middle: { anchor: "__container__", align: HorizontalAlign.Center }
})
.onChange((index: number) => {
this.swiperIndex = index
this.currentUrl = this.photoList[index]?.picPath
.onAnimationStart((index: number, targetIndex: number, extraInfo: SwiperAnimationEvent) => {
this.swiperIndex = targetIndex
this.currentUrl = this.photoList[targetIndex]?.picPath
})
Row() {
...
...
sight_harmony/features/wdComponent/src/main/ets/pages/OtherNormalUserHomePage.ets
View file @
7ed2d23
...
...
@@ -63,213 +63,214 @@ struct OtherNormalUserHomePage {
build() {
if(this.isConnectNetwork){
Stack({ alignContent: Alignment.Top }){
Column(){
if(this.isConnectNetwork){
Stack({ alignContent: Alignment.Top }){
Image($r('app.media.title_bg'))
.width('100%')
.height(`calc(${295 + this.topSafeHeight + 'lpx'})`)
.objectFit(ImageFit.Cover)
Row()
.height(px2vp(this.topSafeHeight))
.width("100%")
.backgroundColor($r('app.color.white'))
.visibility(this.tileOpacity > 0 ? 0 : 1)
.opacity(this.tileOpacity )
}
Column(){
Stack({ alignContent: Alignment.Top }){
this.MineHomeTitleTransparent()
this.MineHomeTitleWhite()
}.margin({top:px2vp(this.topSafeHeight)})
Scroll() {
Column() {
//用户信息区域
Row() {
Stack(){
Image(this.headPhotoUrl)
.alt($r('app.media.default_head'))
.width('115lpx')
.height('115lpx')
.objectFit(ImageFit.Cover)
.clip(new Circle({ width: '115lpx', height: '115lpx' }))
Image(this.levelHead)
.width('165lpx')
.height('165lpx')
.objectFit(ImageFit.Cover)
}
Image($r('app.media.title_bg'))
.width('100%')
.height(`calc(${295 + this.topSafeHeight + 'lpx'})`)
.objectFit(ImageFit.Cover)
Row()
.height(px2vp(this.topSafeHeight))
.width("100%")
.backgroundColor($r('app.color.white'))
.visibility(this.tileOpacity > 0 ? 0 : 1)
.opacity(this.tileOpacity )
}
Column() {
Row() {
Text(`${this.userName}`)
.fontColor($r('app.color.white'))
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.fontSize('38lpx')
.lineHeight('50lpx')
.fontWeight('500lpx')
if(this.levelId>0){
Text(`等级${this.levelId}`)
.fontColor($r('app.color.color_ED2800'))
.fontSize('23lpx')
.fontWeight(500)
.margin({ left: '10lpx' })
.backgroundImage($r("app.media.my_grade_bg"))
.backgroundImageSize(ImageSize.Cover)
.padding({left:"17lpx",right:"8lpx"})
.height('35lpx')
}
Blank()
}.width('507lpx')
Column(){
Stack({ alignContent: Alignment.Top }){
this.MineHomeTitleTransparent()
this.MineHomeTitleWhite()
}.margin({top:px2vp(this.topSafeHeight)})
Scroll() {
Column() {
//用户信息区域
Row() {
Stack(){
Image(this.headPhotoUrl)
.alt($r('app.media.default_head'))
.width('115lpx')
.height('115lpx')
.objectFit(ImageFit.Cover)
.clip(new Circle({ width: '115lpx', height: '115lpx' }))
Image(this.levelHead)
.width('165lpx')
.height('165lpx')
.objectFit(ImageFit.Cover)
}
Row() {
Row() {
Text(`${this.browseNum}`)
.textStyle()
Text("阅读")
.textStyle2()
}
.margin({ right: '15lpx' })
Divider()
.height('19lpx')
.width('2lpx')
.color($r('app.color.white'))
.vertical(true)
.opacity(0.4)
Column() {
Row() {
Text(`${this.commentNum}`)
.textStyle()
Text("评论")
.textStyle2()
}.margin({ right: '15lpx', left: '15lpx' })
Divider()
.height('19lpx')
.width('2lpx')
.color($r('app.color.white'))
.vertical(true)
.opacity(0.4)
Text(`${this.userName}`)
.fontColor($r('app.color.white'))
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.fontSize('38lpx')
.lineHeight('50lpx')
.fontWeight('500lpx')
if(this.levelId>0){
Text(`等级${this.levelId}`)
.fontColor($r('app.color.color_ED2800'))
.fontSize('23lpx')
.fontWeight(500)
.margin({ left: '10lpx' })
.backgroundImage($r("app.media.my_grade_bg"))
.backgroundImageSize(ImageSize.Cover)
.padding({left:"17lpx",right:"8lpx"})
.height('35lpx')
}
Blank()
}.width('507lpx')
Row() {
Text(`${this.attentionNum}`)
.textStyle()
Text("关注")
.textStyle2()
}.margin({ left: '15lpx' })
}.margin({ top: '23lpx' })
}.alignItems(HorizontalAlign.Start)
.margin({ left: StringUtils.isEmpty(this.levelHead)?'32lpx':"3lpx" })
}
.onAreaChange((oldValue: Area, newValue: Area) => {
if (this.firstPositionY === 0) {
this.firstPositionY = newValue.globalPosition.y as number
}else{
let persent = (this.firstPositionY - Number(newValue.globalPosition.y)) / (this.firstPositionY * 0.3)
if(persent > 1){
persent = 1
}
this.tileOpacity = persent
Row() {
Text(`${this.browseNum}`)
.textStyle()
Text("阅读")
.textStyle2()
}
.margin({ right: '15lpx' })
Divider()
.height('19lpx')
.width('2lpx')
.color($r('app.color.white'))
.vertical(true)
.opacity(0.4)
Row() {
Text(`${this.commentNum}`)
.textStyle()
Text("评论")
.textStyle2()
}.margin({ right: '15lpx', left: '15lpx' })
Divider()
.height('19lpx')
.width('2lpx')
.color($r('app.color.white'))
.vertical(true)
.opacity(0.4)
Row() {
Text(`${this.attentionNum}`)
.textStyle()
Text("关注")
.textStyle2()
}.margin({ left: '15lpx' })
}.margin({ top: '23lpx' })
}.alignItems(HorizontalAlign.Start)
.margin({ left: StringUtils.isEmpty(this.levelHead)?'32lpx':"3lpx" })
}
})
// .backgroundColor($r('app.color.color_transparent'))
.height('184lpx')
.width('100%')
.padding({ left: '6lpx' })
//用户简介区域
if(StringUtils.isNotEmpty(this.desc)){
Column() {
Row() {
Text('简介:'+this.desc)
.fontSize('27lpx')
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.lineHeight('40lpx')
.fontWeight('400lpx')
.fontColor($r('app.color.color_222222'))
.textAlign(TextAlign.Start)
}
}.padding({ left: '31lpx',right:'31lpx',top:'19lpx',bottom:'31lpx'})
.alignItems(HorizontalAlign.Start)
.justifyContent(FlexAlign.Center)
.width('100%')
.backgroundColor($r('app.color.white'))
}
//间隔符
Divider().width('100%').height('12lpx').color($r('app.color.color_F5F5F5')).strokeWidth('12lpx')
//tab 页面
Stack({ alignContent: Alignment.Top }){
Tabs({controller: this.controller}) {
TabContent() {
OtherHomePageBottomCommentComponent({curUserId:this.curUserId,levelHead:this.levelHead,commentNum:$commentNum})
}
TabContent() {
OtherHomePageBottomFollowComponent({curUserId:this.curUserId})
.onAreaChange((oldValue: Area, newValue: Area) => {
if (this.firstPositionY === 0) {
this.firstPositionY = newValue.globalPosition.y as number
}else{
let persent = (this.firstPositionY - Number(newValue.globalPosition.y)) / (this.firstPositionY * 0.3)
if(persent > 1){
persent = 1
}
this.tileOpacity = persent
}
}
.backgroundColor($r('app.color.white'))
.animationDuration(0)
.onChange((index: number) => {
this.currentIndex = index
trackTabFirstClick(index === 0 ? "评论":"关注")
})
.vertical(false)
.barHeight('77lpx')
// .backgroundColor($r('app.color.color_transparent'))
.height('184lpx')
.width('100%')
.padding({ left: '6lpx' })
Column() {
// 页签
Row({ space: 7 }) {
Scroll() {
Row() {
this.TabBuilder(0,"评论")
this.TabBuilder(1,"关注")
//用户简介区域
if(StringUtils.isNotEmpty(this.desc)){
Column() {
Row() {
Text('简介:'+this.desc)
.fontSize('27lpx')
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.lineHeight('40lpx')
.fontWeight('400lpx')
.fontColor($r('app.color.color_222222'))
.textAlign(TextAlign.Start)
}
}.padding({ left: '31lpx',right:'31lpx',top:'19lpx',bottom:'31lpx'})
.alignItems(HorizontalAlign.Start)
.justifyContent(FlexAlign.Center)
.width('100%')
.backgroundColor($r('app.color.white'))
}
//间隔符
Divider().width('100%').height('12lpx').color($r('app.color.color_F5F5F5')).strokeWidth('12lpx')
//tab 页面
Stack({ alignContent: Alignment.Top }){
Tabs({controller: this.controller}) {
TabContent() {
OtherHomePageBottomCommentComponent({curUserId:this.curUserId,levelHead:this.levelHead,commentNum:$commentNum})
}
TabContent() {
OtherHomePageBottomFollowComponent({curUserId:this.curUserId})
}
}
.backgroundColor($r('app.color.white'))
.animationDuration(0)
.onChange((index: number) => {
this.currentIndex = index
trackTabFirstClick(index === 0 ? "评论":"关注")
})
.vertical(false)
.barHeight('77lpx')
Column() {
// 页签
Row({ space: 7 }) {
Scroll() {
Row() {
this.TabBuilder(0,"评论")
this.TabBuilder(1,"关注")
}
.justifyContent(FlexAlign.Start)
}
.justifyContent(FlexAlign.Start)
.align(Alignment.Start)
.scrollable(ScrollDirection.Horizontal)
.scrollBar(BarState.Off)
.width('90%')
.padding({left:'31lpx'})
}
.align(Alignment.Start)
.scrollable(ScrollDirection.Horizontal)
.scrollBar(BarState.Off)
.width('90%')
.padding({left:'31lpx'})
.alignItems(VerticalAlign.Bottom)
.width('100%')
}
.alignItems(VerticalAlign.Bottom)
.backgroundColor($r('app.color.white'))
.alignItems(HorizontalAlign.Start)
.width('100%')
.height('77lpx')
}
.backgroundColor($r('app.color.white'))
.alignItems(HorizontalAlign.Start)
.width('100%')
.height('77lpx')
}
}.width("100%")
}.width("100%")
}
.edgeEffect(EdgeEffect.None)
.scrollBar(BarState.Off)
.width('100%')
.layoutWeight(1)
}
.edgeEffect(EdgeEffect.None)
.scrollBar(BarState.Off)
.width('100%')
.layoutWeight(1)
}.width('100%')
.layoutWeight(1)
}else{
Column(){
CustomTitleUI({ titleName: "" })
EmptyComponent({ emptyType: 1,emptyHeight:"100%" ,retry: () => {
this.isConnectNetwork = NetworkUtil.isNetConnected()
if(this.isChangeToUserEdit){
this.getUserInfo()
}
},})
.layoutWeight(1)
.width('100%')
}
}.width('100%')
.layoutWeight(1)
}else{
Column(){
CustomTitleUI({ titleName: "" })
EmptyComponent({ emptyType: 1,emptyHeight:"100%" ,retry: () => {
this.isConnectNetwork = NetworkUtil.isNetConnected()
if(this.isChangeToUserEdit){
this.getUserInfo()
}
},})
.layoutWeight(1)
.width('100%')
}
}
}.padding({bottom:px2vp(this.bottomSafeHeight)})
}
@Builder MineHomeTitleTransparent() {
RelativeContainer() {
...
...
sight_harmony/features/wdComponent/src/main/ets/utils/CompUtils.ets
View file @
7ed2d23
...
...
@@ -32,6 +32,45 @@ export class CompUtils {
}
/**
* 是视频tab
* @param navItem
* @returns
*/
static isVideo(navItem: BottomNavDTO) : boolean{
if (navItem == null) {
return false;
}
return navItem.topStyle === '13';
}
/**
* 是新闻tab
* @param navItem
* @returns
*/
static isNews(navItem: BottomNavDTO) : boolean{
if (navItem == null) {
return false;
}
return navItem.topStyle === '11';
}
/**
* 是人民号tab
* @param navItem
* @returns
*/
static isRMH(navItem: BottomNavDTO) : boolean{
if (navItem == null) {
return false;
}
return navItem.topStyle === '12';
}
/**
* 获取Label标题
*
* @param component 组件bean
...
...
sight_harmony/features/wdComponent/src/main/ets/viewmodel/PageFollowHelper.ets
0 → 100644
View file @
7ed2d23
import { CompDTO, ContentDTO, InteractDataDTO, LiveReviewDTO, LiveRoomDataBean, PageDTO, PageInfoDTO } from 'wdBean';
import { CompStyle, ViewType } from 'wdConstant/Index';
import { CollectionUtils, DateTimeUtils, LazyDataSource, Logger, NetworkUtil, StringUtils, ToastUtils } from 'wdKit';
import { closeRefresh } from '../utils/PullDownRefresh';
import PageModel from './PageModel';
import PageViewModel from './PageViewModel';
import { promptAction } from '@kit.ArkUI';
import { CompAdvBean } from 'wdBean/src/main/ets/bean/adv/AdvsRuleBean';
import PageAdModel from './PageAdvModel';
import { ArrayList } from '@kit.ArkTS';
import { WDViewDefaultType } from '../components/view/EmptyComponent';
import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean';
import { BaseDTO } from 'wdBean/src/main/ets/bean/component/BaseDTO';
import { viewBlogInsightIntentShare, ActionMode } from '../utils/InsightIntentShare'
import { common } from '@kit.AbilityKit';
import { CacheData } from 'wdNetwork/Index';
import { closeLoadMore } from '../utils/PullUpLoadMore';
const TAG = 'PageHelper';
/**
* 处理返回后的数据
*/
export class PageFollowHelper {
private refreshUIEnd(pageModel: PageModel, isRefreshSuccess: boolean) {
if (pageModel.loadStrategy != 2) {
return
}
closeRefresh(pageModel, isRefreshSuccess)
}
/**
* 进页面请求数据
*/
async getInitData(pageModel: PageModel) {
pageModel.loadStrategy = 1
let netStatus = NetworkUtil.isNetConnected()
if (netStatus) {
this.getPageInfo(pageModel)
} else if (pageModel.compList.size() > 0) {
// 加载缓存数据了,不用无网络提示
} else {
pageModel.viewType = ViewType.EMPTY;
pageModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoNetwork;
}
}
getPageInfo(pageModel: PageModel) {
pageModel.currentPage = 1;
Logger.debug(TAG, 'getPageInfo')
PageViewModel.getPageInfo(pageModel.pageId).then(pageInfo => {
Logger.debug(TAG, 'getPageInfo back: ' + JSON.stringify(pageInfo))
if (pageInfo == null) {
pageModel.viewType = ViewType.EMPTY;
pageModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoContent1;
return;
}
pageModel.pageInfo = pageInfo;
Logger.debug(TAG, 'getPageInfo go on')
}).catch(() => {
this.refreshUIEnd(pageModel, false)
if (this.isPageLoaded(pageModel)) {
return
}
pageModel.viewType = ViewType.EMPTY;
pageModel.emptyType = WDViewDefaultType.WDViewDefaultType_ContentFailed;
})
}
private isPageLoaded(pageModel: PageModel) {
if (pageModel.compList.size() > 0) {
return true
}
return false
}
}
let pageHelper = new PageFollowHelper();
export default pageHelper as PageFollowHelper;
\ No newline at end of file
...
...
sight_harmony/features/wdDetailPlayApi/src/main/ets/request/ContentDetailRequest.ets
View file @
7ed2d23
...
...
@@ -127,7 +127,7 @@ export interface postExecuteLikeParams {
title?: string;
contentRelId?: string;
userHeaderUrl?: string;
channelId?: string;
channelId?: string
| number
;
}
export interface postExecuteCollectRecordParamsItem {
...
...
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/pages/DetailPlayShortVideoPage.ets
View file @
7ed2d23
...
...
@@ -43,6 +43,7 @@ export struct DetailPlayShortVideoPage {
@Consume @Watch("showCommentListChanged") showCommentList: boolean
@Consume displayDirection: DisplayDirection
@Consume @Watch('videoStatusChange') switchVideoStatus: boolean
@State isPlay: boolean = true // 视频手动播放暂停
@Consume @Watch('pageShowChange') pageShow: number
@Consume windowWidth: number
@Consume windowHeight: number
...
...
@@ -61,7 +62,7 @@ export struct DetailPlayShortVideoPage {
async pageShowChange() {
if (this.currentIndex === this.index) {
this.queryNewsInfoOfUser()
if (this.switchVideoStatus) {
if (this.switchVideoStatus
&& this.isPlay
) {
await this.playerController.play()
this.imageVisible = false
}
...
...
@@ -74,7 +75,7 @@ export struct DetailPlayShortVideoPage {
*/
async videoStatusChange() {
if (this.currentIndex === this.index) {
if (this.switchVideoStatus) {
if (this.switchVideoStatus
&& this.isPlay
) {
await this.playerController.play()
this.imageVisible = false
} else {
...
...
@@ -183,14 +184,6 @@ export struct DetailPlayShortVideoPage {
}
if (this.contentDetailData.newsType == 1) {
this.PageName = TrackConstants.PageName.VideoDetail // 点播
} else if (this.contentDetailData.newsType == 2) {
this.PageName = TrackConstants.PageName.Live_Detail // 直播
} else if (this.contentDetailData.newsType == 5) {
this.PageName = TrackConstants.PageName.Summary_Detail // 专题详情页
} else if (this.contentDetailData.newsType == 8) {
this.PageName = TrackConstants.PageName.Article_Detail // 图文详情页
} else if (this.contentDetailData.newsType == 9) {
this.PageName = TrackConstants.PageName.Atlas_Detail // 图集详情页
} else if (this.contentDetailData.newsType == 14 || this.contentDetailData.newsType == 15) {
this.PageName = TrackConstants.PageName.DynamicDetail // 动态图文/动态视频
}
...
...
@@ -268,6 +261,13 @@ export struct DetailPlayShortVideoPage {
.layoutWeight(1)
.onClick(() => {
this.playerController?.switchPlayOrPause();
this.playerController.onStatusChange = (status: number) => {
if (status === PlayerConstants.STATUS_PAUSE) {
this.isPlay = false
} else if(status === PlayerConstants.STATUS_START) {
this.isPlay = true
}
}
})
// 显示评论且非全屏模式(视频频道无评论showComment=false)
...
...
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/pages/VideoChannelDetail.ets
View file @
7ed2d23
...
...
@@ -140,8 +140,6 @@ export struct VideoChannelDetail {
// navigationBarColor: '#000000',
// navigationBarContentColor: '#ffffff'
})
// WindowModel.shared.setWindowLayoutFullScreen(true)
// WindowModel.shared.setWindowSystemBarEnable([])
}
/**
...
...
@@ -156,8 +154,6 @@ export struct VideoChannelDetail {
// navigationBarContentColor: '#0xE5FFFFFF'
})
// WindowModel.shared.setWindowLayoutFullScreen(false)
// WindowModel.shared.setWindowSystemBarEnable(['status', 'navigation'])
}
onBackPress(): boolean | void {
...
...
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/view/PlayerRightView.ets
View file @
7ed2d23
...
...
@@ -75,13 +75,13 @@ export struct PlayerRightView {
return
}
const params: postExecuteLikeParams = {
status: this.newsStatusOfUser?.likeStatus ==
=
'1' ? 0 : 1,
status: this.newsStatusOfUser?.likeStatus == '1' ? 0 : 1,
contentId: this.contentDetailData?.newsId + '',
contentType: this.contentDetailData?.newsType + '',
userName: this.contentDetailData?.userInfo?.userName || '' + '',
contentRelId: this.contentDetailData?.reLInfo?.relId || '' + '',
title: this.contentDetailData?.newsTitle || '' + '',
channelId: this.contentDetailData?.reLInfo?.channelId + '',
channelId: this.contentDetailData?.reLInfo?.channelId
|| ''
+ '',
relType: this.contentDetailData?.reLInfo?.relType || '' + '',
userHeaderUrl: this.contentDetailData?.userInfo?.headPhotoUrl || '' + '',
}
...
...
sight_harmony/features/wdLogin/src/main/ets/pages/login/LoginPage.ets
View file @
7ed2d23
...
...
@@ -115,7 +115,7 @@ struct LoginPage {
Image($r("app.media.login_logo"))
.width(120)
.height(66)
.margin({ top: 78 })
.margin({ top: 78
+ px2vp(this.topSafeHeight)
})
.align(Alignment.Center)
LoginInputComponent({
...
...
@@ -225,7 +225,7 @@ struct LoginPage {
Image($r('app.media.login_closed'))
.width(24)
.height(24)
.margin({ top:
10
, right: 15 })
.margin({ top:
px2vp(this.topSafeHeight)
, right: 15 })
.alignRules({
top: { anchor: "__container__", align: VerticalAlign.Top },
right: { anchor: "__container__", align: HorizontalAlign.End }
...
...
@@ -249,7 +249,7 @@ struct LoginPage {
.backgroundColor(Color.White)
}.width("100%")
.height("100%")
.padding({top:px2vp(this.topSafeHeight),bottom:px2vp(this.bottomSafeHeight)})
//
.padding({top:px2vp(this.topSafeHeight),bottom:px2vp(this.bottomSafeHeight)})
}
...
...
sight_harmony/features/wdLogin/src/main/ets/pages/login/OneKeyLoginPage.ets
View file @
7ed2d23
...
...
@@ -7,6 +7,8 @@ import { Logger, ToastUtils, CustomToast, EmitterUtils, EmitterEventId } from 'w
import { LoginViewModel } from './LoginViewModel'
import {InterestsHobbiesModel} from '../../../../../../../products/phone/src/main/ets/pages/viewModel/InterestsHobbiesModel'
import { TrackConstants, TrackingButton, TrackingPageBrowse } from 'wdTracking/Index'
import { loginComponentManager, LoginWithHuaweiIDButton } from '@kit.AccountKit'
import { JSON } from '@kit.ArkTS'
const TAG = "OneKeyLoginPage"
...
...
@@ -29,6 +31,30 @@ struct OneKeyLoginPage {
customStyle: true,
maskColor:"#00000000"
})
// 构造LoginWithHuaweiIDButton组件的控制器。
controller: loginComponentManager.LoginWithHuaweiIDButtonController =
new loginComponentManager.LoginWithHuaweiIDButtonController()
/**
* 当应用使用自定义的登录页时,如果用户未同意协议,需要设置协议状态为NOT_ACCEPTED,当用户同意协议后再设置
* 协议状态为ACCEPTED,才可以使用华为帐号一键登录功能。
*/
.setAgreementStatus(loginComponentManager.AgreementStatus.NOT_ACCEPTED)
.onClickLoginWithHuaweiIDButton((error: BusinessError, response: loginComponentManager.HuaweiIDCredential) => {
if (error) {
Logger.debug("HuaweiOneKeyAuth", "onClickLoginWithHuaweiIDButton error: " + JSON.stringify(error))
this.toastText = "请阅读并勾选用户协议、隐私政策和华为账号用户认证协议"
this.dialogToast.open()
return;
}
if (response) {
// 获取到Authorization Code
let authorizationCode = response.authorizationCode;
// hilog.info(0x0000, 'testTag', 'response: %{public}s', JSON.stringify(response));
TrackingButton.click("oneClickLoginPageLoginButton", this.pageName, this.pageName)
this.requestLogin()
return;
}
});
// 埋点计算页面浏览时长
private pageStartDate: number = 0
...
...
@@ -85,30 +111,7 @@ struct OneKeyLoginPage {
this.ProtocolRow()
Row() {
Button() {
Row() {
Image($r("app.media.huawei_one_key_login_icon"))
.width(24).height(24)
Text("华为账号一键登录")
.fontColor(Color.White)
}
}
.type(ButtonType.Normal)
.height(48)
.backgroundColor(!this.agreeProtocol ? "#60ED2800" : "#ED2800")
.width("100%")
.onClick((event) => {
if (!this.agreeProtocol) {
return
}
TrackingButton.click("oneClickLoginPageLoginButton", this.pageName, this.pageName)
this.requestLogin()
})
}
.padding({ left: 25, right: 25 })
.margin({top: 20})
this.loginButton()
Button("账号密码登录")
.type(ButtonType.Normal)
...
...
@@ -125,6 +128,58 @@ struct OneKeyLoginPage {
.padding({top: `${this.topSafeHeight}px`})
}
@Builder loginButton() {
Column() {
LoginWithHuaweiIDButton({
params: {
// LoginWithHuaweiIDButton支持的样式。
style: loginComponentManager.Style.BUTTON_CUSTOM,
// LoginWithHuaweiIDButton的边框圆角半径。
borderRadius: 4,
// LoginWithHuaweiIDButton支持的登录类型。
loginType: loginComponentManager.LoginType.QUICK_LOGIN,
// LoginWithHuaweiIDButton支持按钮的样式跟随系统深浅色模式切换。
supportDarkMode: true,
customButtonParams: {
fontColor: loginComponentManager.FontColor.WHITE,
// backgroundColor:!this.agreeProtocol ? "#60ED2800" : "#ED2800"
backgroundColor:"#ED2800"
}
},
controller: this.controller
})
}
.height(48)
.margin({ top: 20 ,left: 25, right: 25 })
}
// @Builder loginButton() {
// Row() {
// Button() {
// Row() {
// Image($r("app.media.huawei_one_key_login_icon"))
// .width(24).height(24)
// Text("华为账号一键登录")
// .fontColor(Color.White)
// }
// }
// .type(ButtonType.Normal)
// .height(48)
// .backgroundColor(!this.agreeProtocol ? "#60ED2800" : "#ED2800")
// .width("100%")
// .onClick((event) => {
// if (!this.agreeProtocol) {
// return
// }
//
// TrackingButton.click("oneClickLoginPageLoginButton", this.pageName, this.pageName)
// this.requestLogin()
// })
// }
// .padding({ left: 25, right: 25 })
// .margin({top: 20})
// }
@Builder ProtocolRow() {
Row({space: 4}) {
Image(this.agreeProtocol ? $r('app.media.login_checkbox_select') : $r('app.media.login_checkbox_unselected'))
...
...
@@ -133,6 +188,11 @@ struct OneKeyLoginPage {
.margin({top: 3})
.onClick(() => {
this.agreeProtocol = !this.agreeProtocol
if (this.agreeProtocol) {
this.controller.setAgreementStatus(loginComponentManager.AgreementStatus.ACCEPTED)
} else {
this.controller.setAgreementStatus(loginComponentManager.AgreementStatus.NOT_ACCEPTED)
}
})
Text() {
Span("我已阅读并同意").fontColor("#999999").fontSize(12).lineHeight(18)
...
...
@@ -173,7 +233,7 @@ struct OneKeyLoginPage {
async requestLogin() {
try {
let authorizeCode = await HuaweiAuth.sharedInstance().
oneKeyLogin
()
let authorizeCode = await HuaweiAuth.sharedInstance().
requestProfile
()
let data = await this.viewModel.huaweiOneKeyLogin(authorizeCode)
...
...
sight_harmony/features/wdLogin/src/main/ets/utils/HuaweiAuth.ets
View file @
7ed2d23
...
...
@@ -84,7 +84,7 @@ export default class HuaweiAuth {
// 华为账号一键登录授权
// 返回结果为 Authorization Code
oneKeyLogin
() : Promise<string> {
requestProfile
() : Promise<string> {
// let loginRequest = new authentication.HuaweiIDProvider().createLoginWithHuaweiIDRequest();
// // 当用户未登录华为帐号时,是否强制拉起华为帐号登录界面
...
...
@@ -94,7 +94,7 @@ export default class HuaweiAuth {
// 创建授权请求,并设置参数
let loginRequest = new authentication.HuaweiIDProvider().createAuthorizationWithHuaweiIDRequest();
// 获取头像昵称需要传如下scope
loginRequest.scopes = ['profile'
, 'phone'];
loginRequest.scopes = ['profile'
]; //, 'phone'
// 若开发者需要进行服务端开发,则需传如下permission获取authorizationCode
loginRequest.permissions = ['serviceauthcode'];
// 用户是否需要登录授权,该值为true且用户未登录或未授权时,会拉起用户登录或授权页面
...
...
sight_harmony/features/wdShare/src/main/ets/utils/DeepLinkUtil.ets
View file @
7ed2d23
...
...
@@ -4,7 +4,7 @@ import { ContentType } from 'wdRouter/Index';
export class DeepLinkUtil {
private static DEEP_LINK_PREFIX = "rmrbapp:rmrb.app/openwith"
private static DEEP_LINK_PREFIX = "rmrbapp:
//
rmrb.app/openwith"
static generateDeepLinkWithConent(content: ContentDetailDTO): string {
...
...
@@ -23,7 +23,7 @@ export class DeepLinkUtil {
private static generate(contentType: number, contentId?: string, relId?: string, link?: string): string {
let deeplink = DeepLinkUtil.DEEP_LINK_PREFIX
let pubParam = `&contentId=${contentId}
}
&relId=${relId}&skipType=1`
let pubParam = `&contentId=${contentId}&relId=${relId}&skipType=1`
let type: ContentType = Number(contentType)
switch (type) {
...
...
@@ -38,7 +38,7 @@ export class DeepLinkUtil {
deeplink += "?type=article&subType=h5"
deeplink += "&url=" + encodeURIComponent(link)
} else {
deeplink += "type=article&subType=h5_template_article"
deeplink += "
?
type=article&subType=h5_template_article"
}
break
case ContentType.DynamicImageText:
...
...
sight_harmony/features/wdTracking/src/main/ets/tracking/Tracking.ets
View file @
7ed2d23
...
...
@@ -2,7 +2,7 @@ import { Logger } from 'wdKit/Index';
import { TrackingModule } from '../TrackingModule';
import sensors from '@sensorsdata/analytics';
import { ParamType, PublicParams } from '../common/PublicParams';
import {
HashMap
} from '@kit.ArkTS';
import {
taskpool
} from '@kit.ArkTS';
import { TrackConstants } from '../common/TrackConstants';
const TAG = "WDTracking"
...
...
@@ -18,17 +18,37 @@ export class Tracking {
}
//TODO: 添加运行单独线程?
taskpool.execute(doTrack, eventId, params).then(() => {
Logger.error('yyyy','event track success')
}).catch(()=>{
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) => {
@Concurrent
function doTrack(eventId: string, params?: ParamType): void {
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]
}
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)
})
}
}
sensors.track(eventId, pubParams)
})
}
\ No newline at end of file
...
...
sight_harmony/products/phone/src/main/ets/dailynewspaperformability/DailyNewspaperFormAbility.ets
View file @
7ed2d23
import { formBindingData, FormExtensionAbility, formInfo, formProvider } from '@kit.FormKit';
import { Want } from '@kit.AbilityKit';
import { Logger, NetworkManager, SPHelper, StringUtils } from 'wdKit/Index';
import {
FileUtils,
Logger, NetworkManager, SPHelper, StringUtils } from 'wdKit/Index';
import { BusinessError } from '@kit.BasicServicesKit';
import {
FormDataType,
NewspaperDataFetcher } from './NewspaperDataFetcher';
import { NewspaperDataFetcher } from './NewspaperDataFetcher';
import { JSON } from '@kit.ArkTS';
import { FormNewspaperPaperType } from '../dailynewspaperwidget/common/NewspaperWidgetData';
import { FormNewspaper
Data, FormNewspaper
PaperType } from '../dailynewspaperwidget/common/NewspaperWidgetData';
import { HostEnum, HostManager, WDHttp } from 'wdNetwork/Index';
import fs from '@ohos.file.fs';
const TAG = "DailyNewspaperFormAbility"
export default class DailyNewspaperFormAbility extends FormExtensionAbility {
lastDatas: Record<string, FormNewspaperData> = {}
onAddForm(want: Want) {
Logger.debug(TAG, "onAddForm with " + JSON.stringify(want))
this.initApp()
if (want.parameters) {
let formId = want.parameters[formInfo.FormParam.IDENTITY_KEY] as string
let isTempCard = want.parameters[formInfo.FormParam.TEMPORARY_KEY] as boolean
if (isTempCard === false) { // 如果为常态卡片,直接进行信息持久化
Logger.debug(TAG, "开始刷新数据");
NewspaperDataFetcher.refreshDailyPaper().then((data) => {
let formData = formBindingData.createFormBindingData(data);
formProvider.updateForm(formId, formData).catch((err: BusinessError) => {
Logger.debug(TAG, ` xFailed to updateForm. Code: ${err.code}, message: ${err.message}`);
});
})
this.fetchAndRefreshData(formId)
}
}
let obj: Form
DataType = {}
let obj: Form
NewspaperData = {} as FormNewspaperData
obj.paperType = FormNewspaperPaperType.unknown
let formData = formBindingData.createFormBindingData(obj);
return formData;
...
...
@@ -45,13 +41,9 @@ export default class DailyNewspaperFormAbility extends FormExtensionAbility {
onUpdateForm(formId: string) {
// 若卡片支持定时更新/定点更新/卡片使用方主动请求更新功能,则提供方需要重写该方法以支持数据更新
Logger.debug(TAG, 'onUpdateForm ' + formId);
NewspaperDataFetcher.refreshDailyPaper().then((data) => {
let formData = formBindingData.createFormBindingData(data);
formProvider.updateForm(formId, formData).catch((err: BusinessError) => {
Logger.debug(TAG, ` xFailed to updateForm. Code: ${err.code}, message: ${err.message}`);
});
})
this.initApp()
this.fetchAndRefreshData(formId)
}
onFormEvent(formId: string, message: string) {
...
...
@@ -61,7 +53,9 @@ export default class DailyNewspaperFormAbility extends FormExtensionAbility {
onRemoveForm(formId: string) {
// 当对应的卡片删除时触发的回调,入参是被删除的卡片ID
Logger.debug(TAG, 'onRemoveForm');
Logger.debug(TAG, 'onRemoveForm / formId: ' + formId);
let data = this.lastDatas[formId]
NewspaperDataFetcher.closeFilesWith(data)
}
// onConfigurationUpdate(config: Configuration) {
...
...
@@ -75,6 +69,32 @@ export default class DailyNewspaperFormAbility extends FormExtensionAbility {
return formInfo.FormState.READY;
}
fetchAndRefreshData(formId: string) {
Logger.debug(TAG, "开始刷新数据");
NewspaperDataFetcher.refreshDailyPaper().then(async (data) => {
let formData = formBindingData.createFormBindingData(data);
formProvider.updateForm(formId, formData).then(() => {
this.lastDatas[formId] = data
}).catch((err: BusinessError) => {
Logger.debug(TAG, ` xFailed to updateForm. Code: ${err.code}, message: ${err.message}`);
});
let fileDir = this.context.getApplicationContext().filesDir + "/widget-daily-newspaper"
await FileUtils.makeDirIfNotExsit(fileDir)
NewspaperDataFetcher.dealWithPictures(data, formId, fileDir, (data) => {
Logger.debug(TAG, `refresh ui with new pictuers`);
let formData = formBindingData.createFormBindingData(data);
formProvider.updateForm(formId, formData).then(() => {
this.lastDatas[formId] = data
}).catch((err: BusinessError) => {
Logger.error(TAG, ` xFailed to updateForm. Code: ${err.code}, message: ${err.message}`);
});
})
})
}
initApp() {
// KV存储
SPHelper.init(this.context);
...
...
sight_harmony/products/phone/src/main/ets/dailynewspaperformability/NewspaperDataFetcher.ets
View file @
7ed2d23
import { CompInfoBean, ContentDTO, PageInfoBean } from 'wdBean/Index';
import { MorningEveningViewModel } from 'wdComponent/Index';
import { Logger } from 'wdKit/Index';
import {
CrptoUtils, FileUtils,
Logger } from 'wdKit/Index';
import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork/Index';
import { DeepLinkUtil } from 'wdShare/Index'
import { FormNewspaperPaperType, FormNewspaperPaperInfo, FormNewspaperPaperContent } from "../dailynewspaperwidget/common/NewspaperWidgetData"
import { FormNewspaperPaperType, FormNewspaperPaperInfo, FormNewspaperPaperContent,
FormNewspaperData } from "../dailynewspaperwidget/common/NewspaperWidgetData"
import { http } from '@kit.NetworkKit';
import fs from '@ohos.file.fs';
import { BusinessError } from '@kit.BasicServicesKit';
import { JSON } from '@kit.ArkTS';
const TAG = "NewspaperDataFetcher"
export type FormDataType = Record<string, FormNewspaperPaperType | FormNewspaperPaperInfo | FormNewspaperPaperContent[]>
//
export type FormDataType = Record<string, FormNewspaperPaperType | FormNewspaperPaperInfo | FormNewspaperPaperContent[]>
export class NewspaperDataFetcher {
public static async refreshDailyPaper(): Promise<FormDataType> {
return new Promise<FormDataType>(async (reslove, fail) => {
public static async refreshDailyPaper(): Promise<FormNewspaperData> {
return new Promise<FormNewspaperData>(async (reslove, fail) => {
let data: Form
DataType = { 'paperType': FormNewspaperPaperType.unknown }
let data: Form
NewspaperData = new FormNewspaperData()
data.paperInfo = { showLeftImage: false }
try {
let page: PageInfoBean = await MorningEveningViewModel.getDailyPaperTopic()
data.paperType = page.topicInfo?.
frontFlag
|| FormNewspaperPaperType.unknown
data.paperType = page.topicInfo?.
topicPattern
|| FormNewspaperPaperType.unknown
let currentTime = new Date().getTime()
let compInfo = await MorningEveningViewModel.getMorningEveningCompInfo(
...
...
@@ -29,7 +34,7 @@ export class NewspaperDataFetcher {
page.topicInfo?.topicId
)
if (page.topicInfo.frontLinkObject) {
if (page.topicInfo
?.frontFlag && page.topicInfo
.frontLinkObject) {
data.paperInfo.showLeftImage = true
data.paperInfo.leftImageUrl = page.topicInfo.frontLinkObject.coverUrl
data.paperInfo.leftTitle = page.topicInfo.frontLinkObject.title
...
...
@@ -60,7 +65,7 @@ export class NewspaperDataFetcher {
})
}
static fakeData(): Form
DataType
{
static fakeData(): Form
NewspaperData
{
let data : FormNewspaperPaperContent = {
title: "标题标题标题标题标题标题标题标题",
coverUrl: "https://"
...
...
@@ -72,6 +77,137 @@ export class NewspaperDataFetcher {
leftTitle: "leftTitleleftTitleleftTitleleftTitleleftTitleleftTitle"
},
"paperContents": [data, data, data]
} as FormNewspaperData
}
static dealWithPictures(data: FormNewspaperData, formId: string ,tempDir: string, refreshCallback:(data: FormNewspaperData) => void) {
let donwloadCount = data.paperContents.filter((value) => {
return value.coverUrl && value.coverUrl.length > 0
}).length
let fileFDs: Record<string, string | number> = {};
if (data.paperInfo.leftImageUrl) {
donwloadCount += 1
CrptoUtils.md5(data.paperInfo.leftImageUrl).then((md5String) => {
const fileName = formId + "file" + md5String;
const filePath = tempDir + "/" + fileName
NewspaperDataFetcher.downloadUrlToPath(data.paperInfo.leftImageUrl!, filePath).then(() => {
let file = fs.openSync(filePath)
fileFDs[fileName] = file.fd
data.paperInfo.localLeftImageFileName = fileName
data.paperInfo.localLeftImageFilePath = filePath
data.formImages = fileFDs
if (--donwloadCount == 0) { refreshCallback(data) }
}).catch((e : BusinessError) => {
Logger.debug(TAG, "download file failed.");
if (--donwloadCount == 0) { refreshCallback(data) }
})
}).catch((e: BusinessError) => {
if (--donwloadCount == 0) { refreshCallback(data) }
})
}
for (let index = 0; index < data.paperContents.length; index++) {
const content = data.paperContents[index];
if (!content.coverUrl || content.coverUrl.length == 0) {
continue
}
CrptoUtils.md5(content.coverUrl).then((md5String) => {
const fileName = formId + "file" + md5String;
const filePath = tempDir + "/" + fileName
NewspaperDataFetcher.downloadUrlToPath(content.coverUrl!, filePath).then(() => {
Logger.debug(TAG, "open file for display ");
let file = fs.openSync(filePath)
fileFDs[fileName] = file.fd
data.paperContents[index].localCoverFileName = fileName
data.paperContents[index].localCoverFilePath = filePath
data.formImages = fileFDs
if (--donwloadCount == 0) { refreshCallback(data) }
}).catch((e : BusinessError) => {
Logger.debug(TAG, "download file failed." + JSON.stringify(e));
if (--donwloadCount == 0) { refreshCallback(data) }
})
}).catch((e: BusinessError) => {
if (--donwloadCount == 0) { refreshCallback(data) }
})
}
}
static closeFilesWith(data?: FormNewspaperData) {
if (data && data.formImages) {
for (const obj of Object.entries(data.formImages)) {
const fileName = obj[0]
let fd: number = obj[1] as number
fs.close(fd)
}
}
}
static downloadUrlToPath(url: string, toFilePath: string): Promise<void> {
Logger.debug(TAG, "will donwload url:" + url + " ======> " + toFilePath);
return new Promise((reslove, fail) => {
FileUtils.fileExsit(toFilePath).then((exsit: boolean) => {
if (exsit) {
Logger.debug(TAG, "file is exsit. " + toFilePath);
reslove()
return
}
NewspaperDataFetcher.downloadUrlToPathWithout(url, toFilePath).then(() => {
reslove()
}).catch((e: BusinessError) => {
fail(e)
})
}).catch((e: BusinessError) => {
NewspaperDataFetcher.downloadUrlToPathWithout(url, toFilePath).then(() => {
reslove()
}).catch((e: BusinessError) => {
fail(e)
})
})
})
}
static downloadUrlToPathWithout(url: string, toFilePath: string): Promise<void> {
Logger.debug(TAG, "will donwload url:" + url + " ======> " + toFilePath);
return new Promise((reslove, fail) => {
let httpRequest = http.createHttp()
httpRequest.request(url, (err, data) => {
if (!err && data.responseCode == http.ResponseCode.OK) {
let imgFile = fs.openSync(toFilePath, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE);
let wroteLength = 0
fs.write(imgFile.fd, data.result as ArrayBuffer).then((writeLen: number) => {
Logger.debug(TAG, "write data to file succeed and size is:" + writeLen);
wroteLength = writeLen
}).catch((err: BusinessError) => {
Logger.error(TAG, "write data to file failed with error message: " + err.message + ", error code: " + err.code);
}).finally(() => {
fs.closeSync(imgFile);
httpRequest.destroy()
wroteLength > 0 ? reslove() : fail("failed")
});
return
}
httpRequest.destroy()
fail("failed")
});
})
}
}
\ No newline at end of file
...
...
sight_harmony/products/phone/src/main/ets/dailynewspaperwidget/common/NewspaperWidgetData.ets
View file @
7ed2d23
...
...
@@ -11,6 +11,9 @@ export class FormNewspaperPaperInfo {
showLeftImage: boolean = false
leftImageUrl?: string
localLeftImageFileName?: ResourceStr // 传递图片用
localLeftImageFileFD? : number // 传递图片用
localLeftImageFilePath? : string // 传递图片用
leftTitle?: string
leftDeepLink?: string
...
...
@@ -20,5 +23,16 @@ export class FormNewspaperPaperInfo {
export class FormNewspaperPaperContent {
title: string = ""
coverUrl?: string
localCoverFileName?: ResourceStr // 传递图片用
localCoverFileFD? : number // 传递图片用
localCoverFilePath? : string // 传递图片用
deepLink: string = ""
}
export class FormNewspaperData {
paperType: FormNewspaperPaperType = FormNewspaperPaperType.unknown
paperInfo: FormNewspaperPaperInfo = {} as FormNewspaperPaperInfo
paperContents: FormNewspaperPaperContent[] = []
formImages: Record<string, string | number> = {}
}
\ No newline at end of file
...
...
sight_harmony/products/phone/src/main/ets/dailynewspaperwidget/pages/DailyNewspaperWidgetCard.ets
View file @
7ed2d23
...
...
@@ -43,8 +43,8 @@ struct DailyNewspaperWidgetCard {
@Builder leftImageView() {
Stack({ alignContent: Alignment.Bottom }) {
Image(this.paperInfo.leftImageUrl)
// Image($r("app.media.desktop_card_comp_place_holder_16_9"))
Image("memory://" + this.paperInfo.localLeftImageFileName)
// Image(this.paperInfo.leftImageUrl)
.alt($r("app.media.desktop_card_comp_place_holder_16_9"))
.objectFit(ImageFit.Cover)
.aspectRatio(87/116)
...
...
@@ -109,8 +109,9 @@ struct ContentCellView {
bottom: this.hasImage ? 0 : 6})
if (this.hasImage) {
Image(this.content.coverUrl)
// Image($r("app.media.desktop_card_comp_place_holder_3_4"))
// Image(this.content.localCoverFilePath)
Image("memory://" + this.content.localCoverFileName)
// Image(this.content.coverUrl)
.alt($r("app.media.desktop_card_comp_place_holder_3_4"))
.objectFit(ImageFit.Cover)
.height(40)
...
...
@@ -151,14 +152,12 @@ function jumpWithDeepLink(deepLink: string, component: Object) {
if (deepLink.length == 0) {
return
}
const deepLinkKey: string = NewspaperWidgetCommon.JumpParam.DeepLinkKey
const fromDailyNewspaperKey: string = NewspaperWidgetCommon.JumpParam.FromNewspaperWidgetKey
postCardAction(component, {
action: NewspaperWidgetCommon.PosterCardAction.ActionRouter,
abilityName: NewspaperWidgetCommon.PosterCardAction.MainAbilityName,
params: {
deepLinkKey: deepLink,
fromDailyNewspaperKey: true
"newspaper.widget.jump.deeplink": deepLink,
"newspaper.widget.jump.fromNewspaperWidget": 1
}
});
}
\ No newline at end of file
...
...
sight_harmony/products/phone/src/main/ets/pages/launchPage/LaunchInterestsHobbiesPage.ets
View file @
7ed2d23
...
...
@@ -44,7 +44,7 @@ struct LaunchInterestsHobbiesPage {
.fontColor('#333333')
.width('54lpx')
.height('35lpx')
.margin({right:'46lpx'})
.margin({
top:'30lpx',
right:'46lpx'})
.onClick(()=>{
//直接跳过到首页
//跳转首页
...
...
@@ -64,7 +64,7 @@ struct LaunchInterestsHobbiesPage {
.fontColor('#333333')
.width('100%')
.height('61lpx')
.margin({top:'
8
4lpx'})
.margin({top:'
5
4lpx'})
Text('完善信息,将为您推荐个性化的内容')
.fontSize('27lpx')
.textAlign(TextAlign.Center)
...
...
@@ -76,6 +76,7 @@ struct LaunchInterestsHobbiesPage {
if(!this.isConnectNetwork){
EmptyComponent({ emptyType: 1,emptyHeight:"60%" ,retry: () => {
this.isConnectNetwork = NetworkUtil.isNetConnected()
this.requestInterestsData()
}})
.layoutWeight(1)
.width('100%')
...
...
sight_harmony/products/phone/src/main/ets/pages/view/BottomNavigationComponent.ets
View file @
7ed2d23
...
...
@@ -53,7 +53,7 @@ export struct BottomNavigationComponent {
// 自动刷新触发(双击tab自动刷新)
@State autoRefresh: number = 0
// 顶导数据,从接口获取 TODO 顶导业务逻辑没看懂,暂时不替换顶导list。频道管理数据待梳理
@State topNavMap: Record<string, TopNavDTO[]> = {}
//
@State topNavMap: Record<string, TopNavDTO[]> = {}
async aboutToAppear() {
Logger.info(TAG, `aboutToAppear currentNavIndex: ${this.currentNavIndex}`);
...
...
@@ -81,7 +81,7 @@ export struct BottomNavigationComponent {
if (CompUtils.isMine(navItem)) {
// 我的页面组件数据列表
MinePageComponent({ isMinePage: this.currentNavIndex === this.bottomNavList.length - 1 })
} else if (
navItem.name === '视频'
) {
} else if (
CompUtils.isVideo(navItem)
) {
// 视频频道,包含视频和直播
VideoChannelPage({
topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073),
...
...
@@ -89,14 +89,14 @@ export struct BottomNavigationComponent {
autoRefresh: this.autoRefresh
})
} else {
// 其它带顶到的页面,如 新闻、人民号、服务
TopNavigationComponentNew({
groupId: navItem.id,
topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073),
_currentNavIndex: $currentNavIndex,
bottomNavIndex: index,
currentBottomNavName: navItem.name,
assignChannel: this.assignChannel,
autoRefresh: this.autoRefresh
autoRefresh: this.autoRefresh,
navItem: navItem
})
}
}
...
...
@@ -246,7 +246,7 @@ export struct BottomNavigationComponent {
}
onBottomNavigationDataUpdated() {
Logger.error('yyyy',
'onBottomNavigationDataUpdated '+
JSON.stringify(this.bottomNavList))
Logger.error('yyyy',
'onBottomNavigationDataUpdated ' +
JSON.stringify(this.bottomNavList))
// Logger.info(TAG, `onBottomNavigationDataUpdated currentNavIndex: ${this.currentNavIndex},length:${this.bottomNavItemList.length}`);
}
...
...
@@ -353,11 +353,20 @@ export struct BottomNavigationComponent {
list = list.filter(item => item.name !== '服务');
list.forEach(item => {
switch (item.name) {
case '新闻': item.pageName = 'NEWS'; break;
case '人民号': item.pageName = 'PEOPLE'; break;
case '视频': item.pageName = 'VIDEOS'; break;
case '我的': item.pageName = 'MY'; break;
default : item.pageName = 'NEWS'; break;
case '新闻':
item.pageName = 'NEWS';
break;
case '人民号':
item.pageName = 'PEOPLE';
break;
case '视频':
item.pageName = 'VIDEOS';
break;
case '我的':
item.pageName = 'MY';
break;
default:
item.pageName = 'NEWS'; break;
}
})
this.bottomNavList = list
...
...
sight_harmony/products/phone/src/main/ets/pages/view/CustomDialogComponent.ets
View file @
7ed2d23
...
...
@@ -72,7 +72,8 @@ export default struct CustomDialogComponent {
Row() {
Text($r('app.string.dialog_text_privacy_statement'))
.fontColor($r('app.color.dialog_text_color'))
.fontSize(14).margin({top:20})
.fontSize(14).fontFamily('PingFang SC')
.margin({top:20})
}.width('90%')
.justifyContent(FlexAlign.Center)
...
...
sight_harmony/products/phone/src/main/ets/pages/view/VideoChannelPage.ets
View file @
7ed2d23
...
...
@@ -58,7 +58,7 @@ export struct VideoChannelPage {
* TODO:根据顶导配置获取颜色展示效果不对,待确认
*/
getTopNavFontColor(item: TopNavDTO, index: number): Color | string {
if (item.
name === '视频' && this.currentBottomNavInfo.name === '视频'
) {
if (item.
channelStyle === 1
) {
return this.currentTopNavSelectedIndex === index ? Color.White : '#949494'
} else {
return this.currentTopNavSelectedIndex === index ? Color.Black : "#B2B2B2"
...
...
sight_harmony/products/phone/src/main/ets/startupmanager/StartupManager.ets
View file @
7ed2d23
...
...
@@ -12,13 +12,14 @@ import { DeviceUtil,
UmengStats } from 'wdKit/Index'
import { LoginModule } from 'wdLogin/Index'
import { HostEnum, HostManager, WDHttp } from 'wdNetwork/Index'
import { registerRouter } from 'wdRouter/Index'
import {
AppInnerLink,
registerRouter } from 'wdRouter/Index'
import { TrackingModule } from 'wdTracking/Index'
import { JSON } from '@kit.ArkTS'
import app from '@system.app'
import { GetuiPush, HWLocationUtils } from 'wdHwAbility/Index'
import { ImageKnife, ImageKnifeGlobal } from '@ohos/imageknife'
import { webview } from '@kit.ArkWeb'
import { NewspaperWidgetCommon } from '../dailynewspaperwidget/common/NewspaperWidgetCommon'
const TAG = "[StartupManager]"
...
...
@@ -26,6 +27,7 @@ const TAG = "[StartupManager]"
export class StartupManager {
private context?: common.UIAbilityContext
private lastStartupWant?: Want
private constructor() {
}
...
...
@@ -74,10 +76,14 @@ export class StartupManager {
// 通知栏点击后启动
GetuiPush.sharedInstance().onWant(want)
Logger.debug(TAG, "App onCreate: finised")
this.lastStartupWant = want
}
appOnNewWant(want: Want, launchParam: AbilityConstant.LaunchParam) {
GetuiPush.sharedInstance().onNewWant(want)
this.dealWithDeepLink(want)
}
appOnDestory() {
...
...
@@ -124,6 +130,10 @@ export class StartupManager {
//TODO:
// 提前初始化webview
webview.WebviewController.initializeWebEngine()
if (this.lastStartupWant && this.dealWithDeepLink(this.lastStartupWant)) {
this.lastStartupWant = undefined
}
resolve()
})
}
...
...
@@ -195,4 +205,20 @@ export class StartupManager {
private initOthers() {
}
private dealWithDeepLink(want: Want): boolean {
if (!want.parameters) {
return false
}
let deepLink = want.parameters[NewspaperWidgetCommon.JumpParam.DeepLinkKey] as string
if (deepLink && deepLink.length) {
AppInnerLink.jumpWithLink(deepLink)
return true
}
return false
}
}
...
...
sight_harmony/products/phone/src/main/resources/base/profile/form_config.json
View file @
7ed2d23
...
...
@@ -14,8 +14,8 @@
"isDynamic"
:
true
,
"isDefault"
:
true
,
"updateEnabled"
:
true
,
"scheduledUpdateTime"
:
"10:30"
,
"updateDuration"
:
1
,
"scheduledUpdateTime"
:
"18:26"
,
"updateDuration"
:
4
,
"defaultDimension"
:
"2*4"
,
"supportDimensions"
:
[
"2*4"
...
...
Please
register
or
login
to post a comment