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-13 09:31:04 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
ee9a96fd5bd3b9a7cb56db90c51b87e275ed8fe9
ee9a96fd
2 parents
05c312e0
87a2432f
Merge remote-tracking branch 'origin/main'
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
137 additions
and
52 deletions
sight_harmony/build-profile.json5
sight_harmony/commons/wdKit/build-profile.json5
sight_harmony/commons/wdKit/hvigorfile.ts
sight_harmony/commons/wdKit/src/main/ets/utils/AppUtils.ets
sight_harmony/commons/wdNetwork/src/main/ets/http/AxiosRequest.ets
sight_harmony/commons/wdNetwork/src/main/ets/http/HttpCommonParams.ets
sight_harmony/features/wdComponent/src/main/ets/components/ENewspaperItemComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/peopleShip/PeopleShipMainComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/search/SearchHistoryComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/setting/AboutPageUI.ets
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/pages/DetailPlayShortVideoPage.ets
sight_harmony/features/wdPlayer/src/main/ets/pages/WDPlayerRenderView.ets
sight_harmony/build-profile.json5
View file @
ee9a96f
...
...
@@ -50,6 +50,13 @@
"compileSdkVersion"
:
"5.0.0(12)"
,
"compatibleSdkVersion"
:
"5.0.0(12)"
,
"runtimeOS"
:
"HarmonyOS"
,
"buildOption"
:
{
"arkOptions"
:
{
"buildProfileFields"
:
{
"BUILD_VERSION"
:
""
}
}
},
}
,
{
"name"
:
"productRELEASE"
,
...
...
@@ -57,6 +64,13 @@
"compileSdkVersion"
:
"5.0.0(12)"
,
"compatibleSdkVersion"
:
"5.0.0(12)"
,
"runtimeOS"
:
"HarmonyOS"
,
"buildOption"
:
{
"arkOptions"
:
{
"buildProfileFields"
:
{
"BUILD_VERSION"
:
""
}
}
}
}
],
"buildModeSet"
:
[
...
...
sight_harmony/commons/wdKit/build-profile.json5
View file @
ee9a96f
...
...
@@ -2,7 +2,9 @@
"apiType"
:
"stageMode"
,
"buildOption"
:
{
"arkOptions"
:
{
//
"apPath"
:
"./modules.ap"
/*
Profile
used
for
profile-guided
optimization
(PGO)
,
a
compiler
optimization
technique
to
improve
app
runtime
performance.
*/
"buildProfileFields"
:
{
"BUILD_TIME"
:
""
}
}
},
"buildOptionSet"
:
[
...
...
@@ -16,6 +18,9 @@
"./obfuscation-rules.txt"
]
}
},
"buildProfileFields"
:
{
"BUILD_TIME"
:
""
}
}
},
...
...
sight_harmony/commons/wdKit/hvigorfile.ts
View file @
ee9a96f
import
{
hspTasks
}
from
'@ohos/hvigor-ohos-plugin'
;
import
{
appTasks
,
OhosAppContext
,
OhosPluginId
}
from
'@ohos/hvigor-ohos-plugin'
;
import
{
hvigor
,
getNode
}
from
'@ohos/hvigor'
// 获取根节点
const
rootNode
=
getNode
(
__filename
);
// 为根节点添加一个afterNodeEvaluate hook 在hook中修改根目录下的build-profile.json5的内容并使能
rootNode
.
afterNodeEvaluate
(
node
=>
{
// 获取app插件的上下文对象
const
appContext
=
node
.
getContext
(
OhosPluginId
.
OHOS_HSP_PLUGIN
)
as
OhosHspContext
;
// 通过上下文对象获取从根目录build-profile.json5文件中读出来的obj对象
const
buildProfileOpt
=
appContext
.
getBuildProfileOpt
();
buildProfileOpt
[
'buildOption'
][
'arkOptions'
][
'buildProfileFields'
]
=
{
"BUILD_VERSION"
:
getBuildVersion
(),
};
// 将obj对象设置回上下文对象以使能到构建的过程与结果中
appContext
.
setBuildProfileOpt
(
buildProfileOpt
);
})
export
default
{
system
:
hspTasks
,
/* Built-in plugin of Hvigor. It cannot be modified. */
plugins
:[]
/* Custom plugin to extend the functionality of Hvigor. */
plugins
:
[]
/* Custom plugin to extend the functionality of Hvigor. */
}
function
getBuildVersion
()
{
// build时间作为版本
let
now
=
new
Date
()
let
year
=
now
.
getFullYear
()
let
month
=
(
'0'
+
(
now
.
getMonth
()
+
1
)).
slice
(
-
2
)
let
day
=
(
'0'
+
(
now
.
getDate
())).
slice
(
-
2
)
let
hours
=
(
'0'
+
(
now
.
getHours
())).
slice
(
-
2
)
let
minutes
=
(
'0'
+
(
now
.
getMinutes
())).
slice
(
-
2
)
let
str
=
year
+
month
+
day
+
hours
+
minutes
return
str
;
}
\ No newline at end of file
...
...
sight_harmony/commons/wdKit/src/main/ets/utils/AppUtils.ets
View file @
ee9a96f
import bundleManager from '@ohos.bundle.bundleManager';
import common from '@ohos.app.ability.common';
import { Logger } from './Logger';
import BuildProfile from 'BuildProfile';
const TAG: string = 'AppUtils';
...
...
@@ -8,9 +9,14 @@ const TAG: string = 'AppUtils';
* 与应用相关属性或操作
*/
export class AppUtils {
private static buildVersion: string = ''
static {
AppUtils.buildVersion = BuildProfile.BUILD_VERSION;
}
/**
* 获取应用名称
* 即:
咪咕视频
* 即:
人民日报
*/
static getAppName(context: common.Context): string {
// todo:获取到的是 $string:app_name
...
...
@@ -20,7 +26,6 @@ export class AppUtils {
/**
* 获取应用的包名
* 即:com.cmcc.myapplication
*/
static getPackageName(context: common.Context): string {
return context.applicationInfo?.name;
...
...
@@ -60,7 +65,6 @@ export class AppUtils {
}
static getOSName() {
// TODO: 待确认,暂时写死Android
return "Harmony"
}
...
...
@@ -74,5 +78,12 @@ export class AppUtils {
}
return '';
}
/**
* 应用build版本,时间,如:'202405291450'
*/
static getBuildVersion(): string {
return AppUtils.buildVersion;
}
}
...
...
sight_harmony/commons/wdNetwork/src/main/ets/http/AxiosRequest.ets
View file @
ee9a96f
...
...
@@ -40,9 +40,6 @@ instance.interceptors.request.use(
// 公共请求参数
// config.params.key = key
Logger.debug('HttpRequest', 'request: ' + config.url)
// TODO 临时打印token,测试token失效。待删除
Logger.debug('HttpRequest', 'request token: ' + config?.headers?.get('RMRB-X-TOKEN'))
Logger.debug('HttpRequest', 'request cookie: ' + config?.headers?.get('cookie'))
return config;
},
(error: AxiosError) => {
...
...
sight_harmony/commons/wdNetwork/src/main/ets/http/HttpCommonParams.ets
View file @
ee9a96f
...
...
@@ -16,7 +16,7 @@ export class HttpParams {
headers['plat'] = DeviceUtil.getPlat()
headers['Content-Type'] = 'application/json; charset=utf-8'
headers['device_id'] = DeviceUtil.clientId()
headers['build_version'] =
HttpParams.get
Version()
headers['build_version'] =
AppUtils.getBuild
Version()
headers['adcode'] = HttpUtils.getProvinceCode()
headers['os_version'] = DeviceUtil.getOsVersion()
headers['system'] = AppUtils.getOSName()
...
...
@@ -80,9 +80,4 @@ export class HttpParams {
headers['city_dode'] = encodeURI(cityCode)
}
}
private static getVersion() {
// TODO build时间,待对接build生成属性
return '202401242103';
}
}
\ No newline at end of file
...
...
sight_harmony/features/wdComponent/src/main/ets/components/ENewspaperItemComponent.ets
View file @
ee9a96f
import { ContentDTO, NewspaperListItemBean, NewspaperPositionItemBean, Params } from 'wdBean';
import { StringUtils } from 'wdKit';
import { ProcessUtils } from 'wdRouter';
import { TrackingContent,TrackConstants } from 'wdTracking/Index';
import { TrackingContent,
TrackConstants } from 'wdTracking/Index';
import { newsSkeleton } from './skeleton/newsSkeleton';
@Component
...
...
@@ -21,21 +21,22 @@ export struct ENewspaperItemComponent {
aboutToAppear(): void {
for (let index = 0; index < this.newspaperListItemBean.items.length; index++) {
const element = this.newspaperListItemBean.items[index];
TrackingContent.common(TrackConstants.EventType.Show,TrackConstants.PageName.NewsPaperPage,TrackConstants.PageName.NewsPaperPage
,{
'contentName':element.title,
'contentType':element.newsType,
'contentId':element.newsId,
'panelNumber':this.newspaperListItemBean.pageNum,
'panelName':this.newspaperListItemBean.pageName,
'readMode':'1',
TrackingContent.common(TrackConstants.EventType.Show, TrackConstants.PageName.NewsPaperPage,
TrackConstants.PageName.NewsPaperPage
, {
'contentName': element.title,
'contentType': element.newsType,
'contentId': element.newsId,
'panelNumber': this.newspaperListItemBean.pageNum,
'panelName': this.newspaperListItemBean.pageName,
'readMode': '1',
})
}
}
build() {
Stack() {
newsSkeleton()
.visibility(this.isShowSkeleton ? Visibility.Visible : Visibility.None)
Image(this.newspaperListItemBean.pagePic)
.width(px2vp(this.itemPicWidth))
.height(px2vp(this.itemPicHeight))
...
...
@@ -48,6 +49,8 @@ export struct ENewspaperItemComponent {
})
.objectFit(ImageFit.Fill)
.visibility(this.isShowSkeleton ? Visibility.None : Visibility.Visible)
newsSkeleton()
.visibility(this.isShowSkeleton ? Visibility.Visible : Visibility.None)
if (this.contentWidth !== 0) {
Canvas(this.context)
.width(px2vp(this.contentWidth))
...
...
@@ -58,7 +61,12 @@ export struct ENewspaperItemComponent {
})
}
}
.padding({ top:14, right: 10, bottom: 14, left: 10 })
.padding({
top: 14,
right: 10,
bottom: 14,
left: 10
})
.backgroundColor(Color.White)
.width('100%')
.onTouch((event: TouchEvent) => {
...
...
@@ -88,21 +96,22 @@ export struct ENewspaperItemComponent {
if (this.itemBeanClicked != null && this.itemBeanClicked.newsId != 0) {
//公共跳转
let content: ContentDTO = {
objectId:this.itemBeanClicked.newsId+'',
objectType:this.itemBeanClicked.newsType+'',
relId:this.itemBeanClicked.relId+'',
relType:this.itemBeanClicked.relType ?? '0'
objectId: this.itemBeanClicked.newsId + '',
objectType: this.itemBeanClicked.newsType + '',
relId: this.itemBeanClicked.relId + '',
relType: this.itemBeanClicked.relType ?? '0'
} as ContentDTO
ProcessUtils.processPage(content)
//内容点击
TrackingContent.clickWithEvent('current_Number_Panel_content_click',TrackConstants.PageName.NewsPaperPage,TrackConstants.PageName.NewsPaperPage
,{
'contentName':this.itemBeanClicked.title,
'contentType':this.itemBeanClicked.newsType,
'contentId':this.itemBeanClicked.newsId,
'panelNumber':this.newspaperListItemBean.pageNum,
'panelName':this.newspaperListItemBean.pageName,
'readMode':'1',
TrackingContent.clickWithEvent('current_Number_Panel_content_click', TrackConstants.PageName.NewsPaperPage,
TrackConstants.PageName.NewsPaperPage
, {
'contentName': this.itemBeanClicked.title,
'contentType': this.itemBeanClicked.newsType,
'contentId': this.itemBeanClicked.newsId,
'panelNumber': this.newspaperListItemBean.pageNum,
'panelName': this.newspaperListItemBean.pageName,
'readMode': '1',
})
this.itemBeanClicked = {} as NewspaperPositionItemBean
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/peopleShip/PeopleShipMainComponent.ets
View file @
ee9a96f
...
...
@@ -25,6 +25,7 @@ import { PeopleShipAttentionContentListTopComponent } from './PeopleShipAttentio
import { CardParser } from '../CardParser'
import { PeopleShipNoMoreData } from '../reusable/PeopleShipNoMoreData';
import PageFollowHelper from '../../viewmodel/PageFollowHelper';
import { MineFollowListItem } from '../../viewmodel/MineFollowListItem';
const TAG = 'PeopleShipMainComponent';
...
...
@@ -228,12 +229,10 @@ export struct PeopleShipMainComponent {
this.followList = []
this.getRmhRecommendInfo(resolve)
} else {
this.followList = []
this.followList.push(...followInfo.list)
this.attentionList = []
this.currentPage = 1
this.loadTime = DateTimeUtils.getCurDate(DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)
this.getAttentionContentListData(resolve)
this.getAttentionContentListData(resolve
,followInfo
)
}
} else {
this.followList = []
...
...
@@ -273,7 +272,7 @@ export struct PeopleShipMainComponent {
}
// 获取关注
private async getAttentionContentListData(resolve?: (value: string | PromiseLike<string>) => void) {
private async getAttentionContentListData(resolve?: (value: string | PromiseLike<string>) => void
,myFollowInfor?:MineFollowListItem
) {
if (this.isLoading && this.currentPage != 1) {
if (resolve) {
resolve('')
...
...
@@ -291,11 +290,9 @@ export struct PeopleShipMainComponent {
} else {
this.hasMore = false;
}
if (this.currentPage == 1) {
this.attentionList = []
}
//批量查询各类型内容动态数据接口
this.checkContentInteractData(listData.list, resolve)
this.checkContentInteractData(listData.list, resolve
,myFollowInfor
)
} else {
this.hasMore = false;
this.resolveEnd(true, resolve)
...
...
@@ -307,7 +304,7 @@ export struct PeopleShipMainComponent {
}
// 批量查询各类型内容动态数据接口
private async checkContentInteractData(list: ContentDTO[], resolve?: (value: string | PromiseLike<string>) => void) {
private async checkContentInteractData(list: ContentDTO[], resolve?: (value: string | PromiseLike<string>) => void
,myFollowInfor?:MineFollowListItem
) {
// 批量查询内容当前用户点赞、收藏状态
try {
// 获取列表数据
...
...
@@ -324,6 +321,15 @@ export struct PeopleShipMainComponent {
let listData = await PeopleShipMainViewModel.getContentInteractInfo(params)
Logger.debug('PeopleShipMainComponent', '获取页面信息' + `${JSON.stringify(listData)}`)
this.resolveEnd(true, resolve)
if (this.currentPage == 1) {
this.attentionList = []
this.followList = []
}
if(myFollowInfor){
this.followList.push(...myFollowInfor.list)
}
list.forEach((element: ContentDTO) => {
// 获取 interactData 数据
if (listData && listData.length > 0) {
...
...
sight_harmony/features/wdComponent/src/main/ets/components/search/SearchHistoryComponent.ets
View file @
ee9a96f
...
...
@@ -21,7 +21,7 @@ export struct SearchHistoryComponent{
},
title: "确认清空历史记录?",
tipShow:false,
leftTextColor:$r('app.color.color_
648DF2
')
leftTextColor:$r('app.color.color_
333333
')
}),
autoCancel: true,
alignment: DialogAlignment.Center,
...
...
sight_harmony/features/wdComponent/src/main/ets/components/setting/AboutPageUI.ets
View file @
ee9a96f
...
...
@@ -47,7 +47,7 @@ export struct AboutPageUI {
context.getApplicationContext();
let appVerion = AppUtils.getAppVersionName()
if (StringUtils.isNotEmpty(appVerion)) {
this.version = "版本号:" + appVerion
this.version = "版本号:" + appVerion
+ '.' + AppUtils.getBuildVersion()
}
}
...
...
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/pages/DetailPlayShortVideoPage.ets
View file @
ee9a96f
...
...
@@ -403,7 +403,8 @@ export struct DetailPlayShortVideoPage {
this.playerController.firstPlay(this.contentDetailData.videoInfo[0].videoUrl, this.PageName, this.PageName,
this.pageParam);
}
}
},
liftVideo: $showCommentList,
})
.width(this.playerWidth)
.height(this.playerHeight)
...
...
sight_harmony/features/wdPlayer/src/main/ets/pages/WDPlayerRenderView.ets
View file @
ee9a96f
...
...
@@ -49,6 +49,9 @@ export struct WDPlayerRenderView {
@State videoHeight: number = 9
@State videoRatio: number = 16 / 9
@State selfSize: Size = new Size('100%', '100%');
// 是否上推视频中
@Link liftVideo: boolean
private enableAliPlayer = false
aboutToAppear() {
...
...
@@ -61,7 +64,7 @@ export struct WDPlayerRenderView {
this.playerController.onVideoSizeChange = (width: number, height: number) => {
// console.log(`WDPlayerRenderView onVideoSizeChange width:${width} videoTop:${height}`)
Logger.info(TAG, ` onVideoSizeChange width:${width}
videoTop
:${height}`)
Logger.info(TAG, ` onVideoSizeChange width:${width}
height
:${height}`)
this.videoWidth = width;
this.videoHeight = height;
this.videoRatio = width / height
...
...
@@ -127,6 +130,21 @@ export struct WDPlayerRenderView {
if (info.size.width > 0 && info.size.height > 0) {
if (!this.liftVideo) {
if (this.videoHeight > 0 && this.videoWidth > 0) {
this.xComponentController.setXComponentSurfaceRect({
surfaceWidth: info.size.width,
surfaceHeight: info.size.width / this.videoRatio,
});
return
}
this.xComponentController.setXComponentSurfaceRect({
surfaceWidth: info.size.width,
surfaceHeight: info.size.height,
});
return
}
// 竖屏
if (this.videoHeight > 0 && this.videoWidth > 0 && this.videoWidth < this.videoHeight) {
let ratio = this.videoWidth / this.videoHeight
...
...
Please
register
or
login
to post a comment