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-17 15:02:20 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
0a5bee454e45c87b9fd7bd6ebf20579757de949f
0a5bee45
2 parents
0e7fe404
74d9ef7a
Merge remote-tracking branch 'origin/main'
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
139 additions
and
88 deletions
sight_harmony/commons/wdWebComponent/src/main/ets/pages/WdWebLocalComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/compview/ZhCarouselLayout01.ets
sight_harmony/features/wdComponent/src/main/ets/components/compview/ZhGridLayout02NewsContent.ets
sight_harmony/features/wdComponent/src/main/ets/components/compview/ZhSingleRow02.ets
sight_harmony/features/wdComponent/src/main/ets/components/compview/ZhSingleRow03.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/peopleShipHomePage/PeopleShipHomeNavComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/view/HorizontalStrokeCardThreeTwoRadioForMoreComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/view/LiveHorizontalCardComponent.ets
sight_harmony/features/wdLogin/src/main/ets/pages/login/LoginProtocolWebview.ets
sight_harmony/features/wdTracking/src/main/ets/common/PublicParams.ets
sight_harmony/features/wdTracking/src/main/ets/tracking/Tracking.ets
sight_harmony/commons/wdWebComponent/src/main/ets/pages/WdWebLocalComponent.ets
View file @
0a5bee4
...
...
@@ -60,12 +60,14 @@ export struct WdWebLocalComponent {
.imageAccess(true)
.mixedMode(MixedMode.All)
.onlineImageAccess(true)
.enableNativeEmbedMode(true)
.layoutMode(WebLayoutMode.FIT_CONTENT)
// .enableNativeEmbedMode(true)
// .layoutMode(WebLayoutMode.FIT_CONTENT)
.nestedScroll({
scrollForward: NestedScrollMode.SELF_FIRST,
scrollBackward: NestedScrollMode.PARENT_FIRST
})// .height(this.webHeight)
})
.width('100%')
.height(this.webHeight)
.onPageBegin((event) => {
this.onPageBegin(event?.url);
})
...
...
sight_harmony/features/wdComponent/src/main/ets/components/compview/ZhCarouselLayout01.ets
View file @
0a5bee4
...
...
@@ -8,6 +8,7 @@ import { CardMediaInfo } from '../cardCommon/CardMediaInfo';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { Notes } from '../cardview/notes';
import { InfomationCardClick } from '../../utils/infomationCardClick'
import font from '@ohos.font';
const TAG = 'Zh_Carousel_Layout-01';
...
...
@@ -67,6 +68,11 @@ export struct ZhCarouselLayout01 {
list.push(i);
}
this.data = new MyDataSource(list)
font.registerFont({
familyName: 'BebasNeue',
familySrc: $rawfile('font/BebasNeue.ttf')
})
}
isAutoPlay() {
...
...
sight_harmony/features/wdComponent/src/main/ets/components/compview/ZhGridLayout02NewsContent.ets
View file @
0a5bee4
...
...
@@ -45,7 +45,7 @@ export struct ZhGridLayout02NewsContent {
buildItemCard(item: ContentDTO, index: number) {
Column() {
Stack({ alignContent: Alignment.BottomEnd }) {
Image(this.loadImg ? item == undefined ? '' : item.fullColumnImgUrls
[0]
.url : '')
Image(this.loadImg ? item == undefined ? '' : item.fullColumnImgUrls
?.[0]?
.url : '')
.backgroundColor(0xf5f5f5)
.width('100%')
// .height(95)
...
...
sight_harmony/features/wdComponent/src/main/ets/components/compview/ZhSingleRow02.ets
View file @
0a5bee4
...
...
@@ -19,8 +19,8 @@ export struct ZhSingleRow02 {
@State pageId: string = '';
@State pageName: string = '';
@State compDTO: CompDTO = {} as CompDTO
@State initMoreWidth: number = 16;
@State moreWidth:number = 16
@State initMoreWidth: number = 22;
@State moreWidth:number = 22
@State moreTips: string = ''
scroller: Scroller = new Scroller()
...
...
@@ -53,7 +53,7 @@ export struct ZhSingleRow02 {
resetEdgeAnimation() {
if (this.moreWidth > this.initMoreWidth) {
this.moreWidth =
16
this.moreWidth =
22
}
this.resetMoreTips()
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/compview/ZhSingleRow03.ets
View file @
0a5bee4
...
...
@@ -43,8 +43,8 @@ export struct ZhSingleRow03 {
// @State reserveStatus: reserveItem[] = []
@State reservedIds: string[] = [];
@State loadImg: boolean = false;
@State initMoreWidth: number = 16;
@State moreWidth:number = 16
@State initMoreWidth: number = 22;
@State moreWidth:number = 22
@State moreTips: string = ''
scroller: Scroller = new Scroller()
...
...
@@ -78,7 +78,7 @@ export struct ZhSingleRow03 {
resetEdgeAnimation() {
if (this.moreWidth > this.initMoreWidth) {
this.moreWidth =
16
this.moreWidth =
22
}
this.resetMoreTips()
}
...
...
@@ -260,7 +260,7 @@ export struct ZhSingleRow03 {
.fontSize(12)
.textAlign(TextAlign.Start)
.fontFamily('PingFang SC-Semibold')
.fontWeight(
6
00)
.fontWeight(
5
00)
Image($r('app.media.timeline_rect'))
.width(4)
.height(3)
...
...
@@ -270,7 +270,7 @@ export struct ZhSingleRow03 {
.fontColor(0x000000)
.fontSize(12)
.fontFamily('PingFang SC-Semibold')
.fontWeight(
6
00)
.fontWeight(
5
00)
Text('开始直播')
.fontColor(0xC8C8C8)
.fontSize(12)
...
...
sight_harmony/features/wdComponent/src/main/ets/components/page/ChannelSubscriptionLayout.ets
View file @
0a5bee4
...
...
@@ -19,10 +19,15 @@ struct ChannelSubscriptionLayout {
//当前选中的频道
@Link currentTopNavSelectedIndex: number;
@Prop homeChannelList: TopNavDTO []
// 我的频道栏目的频道信息数组
@Link myChannelList: TopNavDTO []
// 更多频道栏目频道信息数组
@Link moreChannelList: TopNavDTO []
// 地方频道栏目频道信息数组
@Link localChannelList: TopNavDTO []
// 收集到的我的频道栏目中的频道id
@State channelIds: number [] = []
@State isShow: boolean = false
@State dragItem: number = -1
private dragRefOffsetX: number = 0
...
...
@@ -33,12 +38,12 @@ struct ChannelSubscriptionLayout {
private FIX_VP_Y: number = 48
@State indexSettingChannelId: number = AppStorage.get<number>('indexSettingChannelId') || 2002
@State isEditIng: boolean = false
@State currentTopNavSelectedItem: TopNavDTO = {} as TopNavDTO
//
@State currentTopNavSelectedItem: TopNavDTO = {} as TopNavDTO
changeTab: (index: number) => void = () => {
}
aboutToAppear() {
this.currentTopNavSelectedItem = this.myChannelList[this.currentTopNavSelectedIndex]
//
this.currentTopNavSelectedItem = this.myChannelList[this.currentTopNavSelectedIndex]
this.myChannelList.forEach(item => {
if(item != undefined && item.channelId != undefined){
this.channelIds.push(item.channelId)
...
...
@@ -57,15 +62,66 @@ struct ChannelSubscriptionLayout {
//删除频道
delChannelItem(index: number) {
let item = this.myChannelList.splice(index, 1)[0]
this.channelIds.splice(index, 1)
AppStorage.setOrCreate('channelIds', JSON.stringify(this.channelIds))
/*
删除的频道信息回到原栏目中去
*/
if (item.moreChannel === '1') {
this.moreChannelList.unshift(item)
}
if (item.localChannel === '1') {
this.localChannelList.unshift(item)
}
// 删除频道的索引值大于 我的栏目中频道最大索引值
if(this.currentTopNavSelectedIndex > this.channelIds.length-1){
//使用默认频道
//缓存首页频道
let index = this.myChannelList.findIndex(_item => _item?.channelId === this.indexSettingChannelId)
console.debug('TopNavigationComponent','index='+index)
if (index > -1) {
this.currentTopNavSelectedIndex = index
}
}else {
//检测删除频道后的当前频道是否是特殊频道
let item = this.myChannelList[this.currentTopNavSelectedIndex]
if(this.isBroadcast(item) || this.isLayout(item)){
this.changeTab(this.currentTopNavSelectedIndex)
this.isShow = false
let index = this.myChannelList.findIndex(_item => _item?.channelId === this.indexSettingChannelId)
console.debug('TopNavigationComponent','index='+index)
if (index > -1) {
this.currentTopNavSelectedIndex = index
this.changeTab(this.currentTopNavSelectedIndex)
}
}
}
}
/**
* 频道是播报
* @param item
* @returns
*/
private isBroadcast(item?: TopNavDTO): boolean {
return item?.channelId === 2066
}
/**
* 频道是电子报
* @param item
* @returns
*/
private isLayout(item?: TopNavDTO): boolean {
return item?.channelId === 2006
}
// 添加频道
...
...
sight_harmony/features/wdComponent/src/main/ets/components/page/TopNavigationComponentNew.ets
View file @
0a5bee4
...
...
@@ -12,8 +12,6 @@ import { ParamType, TrackConstants, Tracking, TrackingButton } from 'wdTracking/
import DailyPaperTopicModel from '../../model/DailyPaperTopicModel';
import { CompUtils } from '../../utils/CompUtils';
import ChannelViewModel from '../../viewmodel/ChannelViewModel';
import { JSON } from '@kit.ArkTS';
import text from '@ohos.graphics.text';
const TAG = 'TopNavigationComponent';
...
...
@@ -95,7 +93,6 @@ export struct TopNavigationComponentNew {
})
} else {
channelSkeleton()
//Text('特殊频道').fontColor(Color.Red).fontSize(20).width('100%').height('100%')
}
}
})
...
...
@@ -117,17 +114,8 @@ export struct TopNavigationComponentNew {
return
}
if (this.isBroadcastByIndex(index)) {
// 跳转到播报页面
ProcessUtils.gotoBroadcastPage(this.myChannelList[index].pageId)
this.channelJumpToPage(index)
} else if (this.isLayoutByIndex(index)) {
// 跳转到电子报页面
ProcessUtils.gotoENewsPaper()
} else {
this.changePage(index)
}
})
.onAnimationEnd((index: number) => {
Logger.info(TAG, `onAnimationEnd ${index}`);
...
...
@@ -153,6 +141,7 @@ export struct TopNavigationComponentNew {
// 极左极右有特殊频道,用旧值
this.changePage(this.currentTopNavSelectedIndex)
}
} else {
}
})
...
...
@@ -227,7 +216,7 @@ export struct TopNavigationComponentNew {
moreChannelList: $moreChannelList,
localChannelList: $localChannelList,
changeTab: (index) => {
this.chan
ge
Page(index)
this.chan
nelJumpTo
Page(index)
}
})
.id('channelManageBtn')
...
...
@@ -352,16 +341,27 @@ export struct TopNavigationComponentNew {
// 当前tab,单击事件
this.doAutoRefresh()
} else {
this.channelJumpToPage(index)
}
})
}
/**
* 频道信息跳转页面方法
* @param index
*/
private channelJumpToPage(index :number){
if (this.isBroadcastByIndex(index)) {
// 跳转到播报页面
ProcessUtils.gotoBroadcastPage(this.myChannelList[index].pageId)
} else if (this.isLayoutByIndex(index)) {
// 跳转到电子报页面
ProcessUtils.gotoENewsPaper()
} else {
this.changePage(index)
}
}
})
}
/**
...
...
@@ -369,6 +369,7 @@ export struct TopNavigationComponentNew {
* @param index 频道所在的序列号
*/
private changePage(index: number) {
Logger.info(TAG, `修改页面 changePage index : ${index}`);
this.currentTopNavSelectedIndex = index
this.swiperController.changeIndex(index)
this.listScroller.scrollToIndex(index, true, ScrollAlign.CENTER)
...
...
@@ -521,7 +522,6 @@ export struct TopNavigationComponentNew {
this.topNavListHandle()
this.changePage(this.currentTopNavSelectedIndex)
console.log('XY', '----TopNavigation-------aboutToAppear' + this.navItem.name)
this.getTopNavList(this.navItem.id)
}
...
...
@@ -534,11 +534,9 @@ export struct TopNavigationComponentNew {
*
*/
updateCurrentTopNavSelectedIndex() {
console.debug(TAG, 'updateCurrentTopNavSelectedIndex=>' + this.currentTopNavSelectedIndex)
if (CompUtils.isNews(this.navItem)) {
const tab = this.myChannelList[this.currentTopNavSelectedIndex]
//Logger.info(TAG, `新闻tab埋点: ${JSON.stringify(tab)}`);
// 埋点
const params: ParamType = {
"pageName": tab.name,
...
...
@@ -548,8 +546,6 @@ export struct TopNavigationComponentNew {
Tracking.event("home_page_tab_click", params)
} else if (CompUtils.isRMH(this.navItem)) {
const tab = this.topNavList[this.currentTopNavSelectedIndex]
Logger.info(TAG, `人民号tab埋点: ${JSON.stringify(tab)}`);
// 埋点
const params: ParamType = {
"pageName": tab.name,
...
...
@@ -663,21 +659,6 @@ export struct TopNavigationComponentNew {
return null
}
//
// private startAnimateTo(duration: number, leftMargin: number, width: number) {
// animateTo({
// duration: duration, // 动画时长
// curve: Curve.Linear, // 动画曲线
// iterations: 1, // 播放次数
// playMode: PlayMode.Normal, // 动画模式
// onFinish: () => {
// console.info('play end')
// }
// }, () => {
// this.indicatorLeftMargin = leftMargin
// this.indicatorWidth = width
// })
// }
/**
* 进入早晚报专题
...
...
@@ -701,15 +682,23 @@ export struct TopNavigationComponentNew {
} else {
ToastUtils.showToast('暂无早晚报信息', 1000)
}
let timer = setInterval(() => {
this.isClickMorningEveningPaper = false
clearInterval(timer);
}, 1000);
}).catch((err: string) => {
ToastUtils.showToast('暂无早晚报信息', 1000)
let timer = setInterval(() => {
this.isClickMorningEveningPaper = false
clearInterval(timer);
}, 1000);
})
} else {
ToastUtils.showToast('网络出小差了,请检查网络后重试', 1000)
let timer = setInterval(() => {
this.isClickMorningEveningPaper = false
clearInterval(timer);
}, 1000);
}
}
...
...
@@ -717,9 +706,9 @@ export struct TopNavigationComponentNew {
async getTopNavList(id: number) {
let bottomNavDetail = await ChannelViewModel.getBottomNavDetailData(id)
let topNavList = bottomNavDetail?.topNavChannelList || []
for (let topNav of topNavList) {
console.debug(TAG, 'getTopNavList=>' + JSON.stringify(topNav))
}
// for (let topNav of topNavList) {
// console.debug(TAG, 'getTopNavList=>' + JSON.stringify(topNav))
//
// }
}
}
\ No newline at end of file
...
...
sight_harmony/features/wdComponent/src/main/ets/components/peopleShipHomePage/PeopleShipHomeNavComponent.ets
View file @
0a5bee4
...
...
@@ -120,15 +120,15 @@ export struct PeopleShipHomePageNavComponent {
}
.height('100%')
Blank()
// 分享
Image((this.topOpacity > 0.5 ? $r('app.media.icon_forward') : $r('app.media.icon_share')))
.width('24vp')
.height('24vp')
.objectFit(ImageFit.Auto)
.margin({ right: '10vp' })
.onClick(() => {
ToastUtils.showToast('分享为公共方法,待开发', 1000);
})
// 分享 分享暂不展示
// Image((this.topOpacity > 0.5 ? $r('app.media.icon_forward') : $r('app.media.icon_share')))
// .width('24vp')
// .height('24vp')
// .objectFit(ImageFit.Auto)
// .margin({ right: '10vp' })
// .onClick(() => {
// ToastUtils.showToast('分享为公共方法,待开发', 1000);
// })
}
.width('100%')
.height('100%')
...
...
sight_harmony/features/wdComponent/src/main/ets/components/view/HorizontalStrokeCardThreeTwoRadioForMoreComponent.ets
View file @
0a5bee4
...
...
@@ -9,8 +9,8 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent {
@State compDTO: CompDTO = {} as CompDTO
@State pageId: string = '';
@State pageName: string = '';
@State initMoreWidth: number = 16;
@State moreWidth:number = 16
@State initMoreWidth: number = 22;
@State moreWidth:number = 22
@State moreTips: string = ''
scroller: Scroller = new Scroller()
...
...
@@ -44,7 +44,7 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent {
resetEdgeAnimation() {
if (this.moreWidth > this.initMoreWidth) {
this.moreWidth =
16
this.moreWidth =
22
}
this.resetMoreTips()
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/view/LiveHorizontalCardComponent.ets
View file @
0a5bee4
...
...
@@ -18,8 +18,8 @@ export struct LiveHorizontalCardComponent {
@State pageName: string = '';
@State compDTO: CompDTO = {} as CompDTO
@State loadImg: boolean = false;
@State initMoreWidth: number = 16;
@State moreWidth:number = 16
@State initMoreWidth: number = 22;
@State moreWidth:number = 22
@State moreTips: string = ''
scroller: Scroller = new Scroller()
...
...
@@ -53,7 +53,7 @@ export struct LiveHorizontalCardComponent {
resetEdgeAnimation() {
if (this.moreWidth > this.initMoreWidth) {
this.moreWidth =
16
this.moreWidth =
22
}
this.resetMoreTips()
}
...
...
sight_harmony/features/wdLogin/src/main/ets/pages/login/LoginProtocolWebview.ets
View file @
0a5bee4
...
...
@@ -33,13 +33,11 @@ struct LoginProtocolWebview {
this.contentID = params.contentID
}
if (params.contentID == "1") { //"人民日报客户端网络服务使用协议"
this.webUrl = this.userProtocol
this.webUrl = await SPHelper.default.get(SpConstants.NET_SERVICE_PROTOCOL, this.userProtocol) as string
this.webUrl = SPHelper.default.getSync(SpConstants.NET_SERVICE_PROTOCOL, this.userProtocol) as string
} else if(params.contentID == "2"){ //"人民日报客户端用户隐私协议"
this.webUrl = this.privateProtocol
this.webUrl = await SPHelper.default.get(SpConstants.PRIVATE_PROTOCOL, this.privateProtocol) as string
this.webUrl = SPHelper.default.getSync(SpConstants.PRIVATE_PROTOCOL, this.privateProtocol) as string
}else if(params.contentID == "3"){ //注销协议
this.webUrl =
await SPHelper.default.get
(SpConstants.LOGOUT_PROTOCOL, this.logoutProtocol) as string
this.webUrl =
SPHelper.default.getSync
(SpConstants.LOGOUT_PROTOCOL, this.logoutProtocol) as string
} else if(params.contentID == "4"){ //华为用户认证协议
this.webUrl = this.huaweiAuthProtocol
} else if(params.contentID == "5"){ //收集个人信息明示清单
...
...
sight_harmony/features/wdTracking/src/main/ets/common/PublicParams.ets
View file @
0a5bee4
...
...
@@ -21,7 +21,7 @@ export class PublicParams {
"isSign": AccountManagerUtils.isLoginSync() ? "1" : "0",
"environment": PublicParams.getEnv(),
"os": AppUtils.getOSName(),
"actionTime":
new Date().getTime() * 0.001
,
"actionTime":
Math.log(new Date().getTime() / 1000)
,
"channel": AppUtils.getAppChannel(),
"version": AppUtils.getAppVersionName(),
"deviceId": DeviceUtil.clientId(),
...
...
sight_harmony/features/wdTracking/src/main/ets/tracking/Tracking.ets
View file @
0a5bee4
...
...
@@ -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)
// })
}
}
...
...
Please
register
or
login
to post a comment