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-05-29 09:43:45 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
778f7c85205bf9bc1151a75eae409ce0a307ab49
778f7c85
2 parents
84f10275
7c5f3634
Merge remote-tracking branch 'origin/main'
Show whitespace changes
Inline
Side-by-side
Showing
40 changed files
with
1353 additions
and
178 deletions
sight_harmony/commons/wdNetwork/src/main/ets/http/HttpUrlUtils.ets
sight_harmony/features/wdBean/Index.ets
sight_harmony/features/wdBean/src/main/ets/bean/detail/ContentDetailDTO.ts
sight_harmony/features/wdBean/src/main/ets/bean/live/LiveRoomDataBean.ets
sight_harmony/features/wdComponent/Index.ets
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card2Component.ets
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card3Component.ets
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card6Component.ets
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/CommentListDialog.ets
sight_harmony/features/wdComponent/src/main/ets/components/page/ChannelSubscriptionLayout.ets
sight_harmony/features/wdComponent/src/main/ets/components/page/EditUserInfoPage.ets
sight_harmony/features/wdComponent/src/main/ets/components/page/TopNavigationComponentNew.ets
sight_harmony/features/wdComponent/src/main/ets/components/view/LiveLikeComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/view/LiveOperRowListView.ets
sight_harmony/features/wdComponent/src/main/ets/components/view/areaPickerDialog/DateCustomComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/view/areaPickerDialog/EditUserSexCustomDialog.ets
sight_harmony/features/wdComponent/src/main/ets/dialog/ENewspaperListDialog.ets
sight_harmony/features/wdComponent/src/main/ets/model/MinePageDatasModel.ets
sight_harmony/features/wdComponent/src/main/ets/repository/PageRepository.ets
sight_harmony/features/wdComponent/src/main/ets/utils/lazyloadImg.ets
sight_harmony/features/wdComponent/src/main/ets/viewmodel/LiveModel.ets
sight_harmony/features/wdDetailPlayLive/src/main/ets/pages/DetailPlayLiveCommon.ets
sight_harmony/features/wdDetailPlayLive/src/main/ets/pages/DetailPlayLivePage.ets
sight_harmony/features/wdDetailPlayLive/src/main/ets/viewModel/LiveModel.ets
sight_harmony/features/wdDetailPlayLive/src/main/ets/viewModel/LiveViewModel.ets
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/details/video/PlayUIComponent.ets
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/details/video/TopPlayComponet.ets
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/vertical/PlayerCommentComponent.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/CommentDialogView.ets
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/view/PlayerRightView.ets
sight_harmony/features/wdPlayer/oh-package.json5
sight_harmony/features/wdPlayer/src/main/ets/controller/WDPlayerController.ets
sight_harmony/features/wdPlayer/src/main/ets/pages/WDPlayerRenderLiveView.ets
sight_harmony/features/wdTracking/src/main/ets/tracking/TrackingPlay.ets
sight_harmony/oh-package.json5
sight_harmony/products/phone/src/main/ets/pages/view/BottomNavigationComponent.ets
sight_harmony/products/phone/src/main/ets/pages/view/MultiPictureDetailPageComponent.ets
sight_harmony/products/phone/src/main/ets/startupmanager/StartupManager.ets
sight_harmony/commons/wdNetwork/src/main/ets/http/HttpUrlUtils.ets
View file @
778f7c8
...
...
@@ -207,6 +207,14 @@ export class HttpUrlUtils {
*/
static readonly LIVE_ROOM_DATA_PATH: string = "/api/live-center-message/zh/a/live/room/number/all";
/**
* 直播详情-C端点赞接口
*/
static readonly LIVE_ROOM_NUMBER_LIKE: string = "/api/live-center-message/zh/c/live/room/number/like";
/**
* 直播详情-查询是否点赞接口
*/
static readonly LIVE_LIKE: string = "/api/live-center-message/zh/a/live/like";
/**
* 直播详情-预约直播状态
*/
static readonly LIVE_APPOINTMENT_STATUS_PATH: string = "/api/live-center-message/zh/c/live/subscribe/query";
...
...
@@ -218,6 +226,15 @@ export class HttpUrlUtils {
* 预约状态
*/
static readonly LIVE_APPOINTMENT_BATCH_PATH: string = "/api/live-center-message/zh/c/live/subscribe/user/batch";
/**
* 查询是否被禁言
*/
static getLiveBarrageHasBanUrl() {
let url = HttpUrlUtils.getHost() + "/api/live-center-message/zh/c/mlive/barrage/ban"
return url
}
/**
* 搜索结果 显示tab 数
...
...
@@ -633,11 +650,21 @@ export class HttpUrlUtils {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_CHAT_LIST_PATH
return url
}
// 直播详情-直播数据
static getLiveRoomDataUrl() {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_ROOM_DATA_PATH
return url
}
// 直播详情-C端点赞接口
static getLiveRoomNumberLikeUrl() {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_ROOM_NUMBER_LIKE
return url
}
// 直播详情-查询是否点赞接口
static getLiveLikeUrl() {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_LIKE
return url
}
static getLiveAppointmentStatusUrl() {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_APPOINTMENT_STATUS_PATH
...
...
sight_harmony/features/wdBean/Index.ets
View file @
778f7c8
...
...
@@ -122,7 +122,7 @@ export { appStyleImagesDTO } from './src/main/ets/bean/content/appStyleImagesDTO
export { LiveRoomBean, LiveRoomItemBean } from './src/main/ets/bean/live/LiveRoomBean';
export { LiveRoomDataBean } from './src/main/ets/bean/live/LiveRoomDataBean';
export { LiveRoomDataBean
, ValueType
} from './src/main/ets/bean/live/LiveRoomDataBean';
export { ReserveBean } from './src/main/ets/bean/live/ReserveBean';
...
...
sight_harmony/features/wdBean/src/main/ets/bean/detail/ContentDetailDTO.ts
View file @
778f7c8
...
...
@@ -11,7 +11,7 @@ import { UserInfoDTO } from './UserInfoDTO'
* 接口定义:
* http://192.168.1.3:3300/project/3802/interface/api/200915
*/
export
interface
ContentDetailDTO
{
export
class
ContentDetailDTO
{
newsId
:
number
;
newsTitle
:
string
;
newsShortTitle
:
string
;
...
...
@@ -72,4 +72,8 @@ export interface ContentDetailDTO {
isNewspaper
:
boolean
;
oldNewsId
:
string
;
serials
:
any
;
// 本地字段
showTime
:
boolean
=
false
;
}
\ No newline at end of file
...
...
sight_harmony/features/wdBean/src/main/ets/bean/live/LiveRoomDataBean.ets
View file @
778f7c8
...
...
@@ -5,3 +5,5 @@ export interface LiveRoomDataBean {
pv: number,
subscribeNum: number,
}
export type ValueType = number | string | boolean | Array<number> | Array<string> | Array<boolean> | Uint8Array | object | bigint;
\ No newline at end of file
...
...
sight_harmony/features/wdComponent/Index.ets
View file @
778f7c8
...
...
@@ -90,6 +90,8 @@ export { MultiPictureDetailItemComponent } from './src/main/ets/components/Multi
export { OperRowListView } from './src/main/ets/components/view/OperRowListView';
export { LiveOperRowListView } from './src/main/ets/components/view/LiveOperRowListView';
export { ImageDownloadComponent } from './src/main/ets/components/ImageDownloadComponent';
export { PageRepository } from './src/main/ets/repository/PageRepository';
...
...
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card2Component.ets
View file @
778f7c8
...
...
@@ -61,13 +61,13 @@ export struct Card2Component {
// }
// }
if(this.contentDTO.objectType == '5'){
Notes({ objectType: this.contentDTO.objectType }).height(2
0
).align(Alignment.Center)
Notes({ objectType: this.contentDTO.objectType }).height(2
9
).align(Alignment.Center)
} else {
if (this.contentDTO.seoTags) {
Notes({ newTags: this.contentDTO.seoTags }).height(2
0
).align(Alignment.Center)
Notes({ newTags: this.contentDTO.seoTags }).height(2
9
).align(Alignment.Center)
}
if (this.contentDTO.newTags) {
Notes({ newTags: this.contentDTO.newTags }).height(2
0
).align(Alignment.Center)
Notes({ newTags: this.contentDTO.newTags }).height(2
9
).align(Alignment.Center)
}
}
//新闻标题
...
...
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card3Component.ets
View file @
778f7c8
...
...
@@ -42,13 +42,13 @@ export struct Card3Component {
// Notes({ objectType: this.contentDTO.objectType }).height(27).align(Alignment.Center)
// }
if(this.contentDTO.objectType == '5'){
Notes({ objectType: this.contentDTO.objectType }).height(2
0
).align(Alignment.Center)
Notes({ objectType: this.contentDTO.objectType }).height(2
9
).align(Alignment.Center)
} else {
if (this.contentDTO.seoTags) {
Notes({ newTags: this.contentDTO.seoTags }).height(2
0
).align(Alignment.Center)
Notes({ newTags: this.contentDTO.seoTags }).height(2
9
).align(Alignment.Center)
}
if (this.contentDTO.newTags) {
Notes({ newTags: this.contentDTO.newTags }).height(2
0
).align(Alignment.Center)
Notes({ newTags: this.contentDTO.newTags }).height(2
9
).align(Alignment.Center)
}
}
Text() {
...
...
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card6Component.ets
View file @
778f7c8
...
...
@@ -89,18 +89,19 @@ export struct Card6Component {
((this.contentDTO.newTags?.length > 0 || this.contentDTO.seoTags?.length > 0) || this.contentDTO.objectType == '5') ? 35 :
0 )
}.alignContent(Alignment.TopStart)
// .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 60: 156)
}
.justifyContent(FlexAlign.Start)
Blank()
//bottom 评论等信息
CardSourceInfo({ compDTO: this.compDTO, contentDTO: this.contentDTO })
}
.alignItems(HorizontalAlign.Start)
.justifyContent(FlexAlign.Start)
.width('64%')
.height(this.contentDTO.appStyle === CompStyle.Card_13 ? 78 : 156)
Stack({alignContent: Alignment.BottomEnd}) {
Image(this.loadImg ? this.contentDTO.coverUrl || this.contentDTO.fullColumnImgUrls?.[0]?.url || this.contentDTO.fullColumnImgUrls?.[0]?.fullUrl : '')
...
...
@@ -110,6 +111,7 @@ export struct Card6Component {
.height(this.contentDTO.appStyle === CompStyle.Card_13 ? 78 : 156)
CardMediaInfo({ contentDTO: this.contentDTO })
}
}
.onClick((event: ClickEvent) => {
InfomationCardClick.track(this.compDTO, this.contentDTO, this.pageId, this.pageName)
...
...
@@ -123,6 +125,7 @@ export struct Card6Component {
top: $r('app.float.card_comp_pagePadding_tb'),
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.width(CommonConstants.FULL_WIDTH)
// .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 107 : 217)
.justifyContent(FlexAlign.SpaceBetween)
...
...
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/CommentListDialog.ets
View file @
778f7c8
...
...
@@ -38,8 +38,12 @@ export struct CommentListDialogView {
}
closeAction() {
if (this.onClose) {
this.onClose()
} else {
this.showCommentList = false
}
}
build() {
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/page/ChannelSubscriptionLayout.ets
View file @
778f7c8
...
...
@@ -20,12 +20,10 @@ struct ChannelSubscriptionLayout {
//当前选中的频道
@Link currentTopNavSelectedIndex: number;
@Prop homeChannelList: TopNavDTO []
@Prop indexSettingChannelId: number
@Link myChannelList: TopNavDTO []
@Link moreChannelList: TopNavDTO []
@Link localChannelList: TopNavDTO []
@Link channelIds: number []
@StorageLink('channelIds') storeChannelIds: string = ''
@State isShow: boolean = false
@State dragItem: number = -1
private dragRefOffsetX: number = 0
...
...
@@ -34,7 +32,7 @@ struct ChannelSubscriptionLayout {
@State offsetY: number = 0
private FIX_VP_X: number = 80
private FIX_VP_Y: number = 48
@State indexSetting
TabIndex: number = 0
@State indexSetting
ChannelId: number = AppStorage.get<number>('indexSettingChannelId') || 2002
@State isEditIng: boolean = false
@State currentTopNavSelectedItem: TopNavDTO = {} as TopNavDTO
changeTab: (index: number) => void = () => {
...
...
@@ -50,13 +48,13 @@ struct ChannelSubscriptionLayout {
let channelIdTmp = this.channelIds.splice(index1, 1)
this.myChannelList.splice(index2, 0, tmp[0])
this.channelIds.splice(index2, 0, channelIdTmp[0])
this.storeChannelIds = this.channelIds.join(','
)
AppStorage.setOrCreate('channelIds', this.channelIds.join(',')
)
}
//删除频道
delChannelItem(index: number){
let item = this.myChannelList.splice(index, 1)[0]
this.channelIds.splice(index, 1)
this.storeChannelIds = this.channelIds.join(','
)
AppStorage.setOrCreate('channelIds', this.channelIds.join(',')
)
if (item.moreChannel === '1') {
this.moreChannelList.unshift(item)
}
...
...
@@ -68,7 +66,7 @@ struct ChannelSubscriptionLayout {
addChannelItem(item: TopNavDTO){
this.channelIds.push(item.channelId)
this.myChannelList.push(item)
this.storeChannelIds = this.channelIds.join(','
)
AppStorage.setOrCreate('channelIds', this.channelIds.join(',')
)
}
itemMove(index: number, newIndex: number): void {
...
...
@@ -265,6 +263,7 @@ struct ChannelSubscriptionLayout {
.alignContent(Alignment.Start)
.height(36)
.onClick(() => {
this.indexSettingChannelId = item.channelId
AppStorage.set('indexSettingChannelId', item.channelId)
})
})
...
...
sight_harmony/features/wdComponent/src/main/ets/components/page/EditUserInfoPage.ets
View file @
778f7c8
...
...
@@ -5,6 +5,7 @@ import EditInfoViewModel from '../../viewmodel/EditInfoViewModel';
import { WDRouterPage, WDRouterRule } from 'wdRouter';
import {AreaPickerDialog} from '../view/areaPickerDialog/AreaPickerDialog'
import {EditUserInfoCustomDialog} from '../view/areaPickerDialog/EditUserInfoCustomDialog'
import {EditUserSexCustomDialog} from '../view/areaPickerDialog/EditUserSexCustomDialog'
import { AreaListModel } from '../../model/AreaListModel';
import router from '@ohos.router';
import TrackingPageBrowseUtils from '../../utils/TrackingPageBrowseUtils'
...
...
@@ -58,6 +59,22 @@ struct EditUserInfoPage {
},
})
sexDialogController: CustomDialogController = new CustomDialogController({
builder: EditUserSexCustomDialog({
confirmCallback:(index)=>{
this.currentUserInfo.userExtend.sex = index;
this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_sex
this.updateEditModel()
}
}),
alignment: DialogAlignment.Bottom,
customStyle: true,
offset: {
dx: 0,
dy: -this.bottomSafeHeight
},
})
async aboutToAppear() {
let windowHight: window.Window = await window.getLastWindow(getContext(this));
this.bottomSafeHeight = px2vp(windowHight.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).bottomRect.height)
...
...
@@ -174,32 +191,8 @@ struct EditUserInfoPage {
this.dialogController.open()
} else if (i === 4) {
this.dateDialogController.open()
// DatePickerDialog.show({
// start:new Date('1900-1-1'),
// end:new Date(),
// selected:new Date,
// lunar:false,
// onAccept:(value:DatePickerResult) => {
// let mon = value.month as number + 1
// let monStr = mon < 10? '0'+mon.toString():mon.toString();
// let dayStr = value.day as number < 10? '0'+value.day:value.day;
// this.currentUserInfo.userExtend.birthday = value.year+'-'+monStr+'-'+dayStr;
// this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_birthday
// this.updateEditModel()
// }
// })
}else if(i === 5){
TextPickerDialog.show({
range:['男','女'],
canLoop:false,
selected:this.currentUserInfo.userExtend.sex === 0?1:0,
onAccept:(value:TextPickerResult) => {
this.currentUserInfo.userExtend.sex = value.index == 0?1:0;
this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_sex
this.updateEditModel()
}
})
this.sexDialogController.open()
}
})
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/page/TopNavigationComponentNew.ets
View file @
778f7c8
...
...
@@ -13,9 +13,6 @@ import DailyPaperTopicModel from '../../model/DailyPaperTopicModel'
const TAG = 'TopNavigationComponent';
PersistentStorage.persistProp('channelIds', '');
PersistentStorage.persistProp('indexSettingChannelId', 2002);
const storage = LocalStorage.getShared();
/**
...
...
@@ -48,11 +45,11 @@ export struct TopNavigationComponentNew {
@State currentTopNavSelectedIndex: number = 0;
// 顶导数据
@State @Watch('onTopNavigationDataUpdated') topNavList: TopNavDTO[] = []
@St
orageProp('indexSettingChannelId') indexSettingChannelId: number =
2002
@St
ate indexSettingChannelId: number = AppStorage.get<number>('indexSettingChannelId') ||
2002
//我的频道id列表
@State channelIds: number[] = []
//本地缓存频道id列表
@St
orageProp('channelIds') storageChannelIds: string =
''
@St
ate storageChannelIds: string = AppStorage.get<string>('channelIds') ||
''
@State homeChannelList: TopNavDTO[] = []
// 我的频道列表
@State myChannelList: TopNavDTO[] = []
...
...
@@ -191,7 +188,6 @@ export struct TopNavigationComponentNew {
this.topBar()
ChannelSubscriptionLayout({
currentTopNavSelectedIndex: $currentTopNavSelectedIndex,
indexSettingChannelId: this.indexSettingChannelId,
homeChannelList: this.homeChannelList,
myChannelList: $myChannelList,
moreChannelList: $moreChannelList,
...
...
@@ -406,18 +402,29 @@ export struct TopNavigationComponentNew {
//频道分类
if (item.name !== '播报') { //暂时隐藏播报
if (item.myChannel === '1') {
if (item.myChannel === '1'
&& !this.storageChannelIds
) {
_myChannelList.push(item)
_channelIds.push(item.channelId)
} else if (item.moreChannel === '1') {
}
if (item.moreChannel === '1') {
this.moreChannelList.push(item)
} else if (item.localChannel === '1' && item.myChannel !== '1') {
}
if (item.localChannel === '1' && item.myChannel !== '1') {
this.localChannelList.push(item)
}
}
})
if(this.storageChannelIds){
_storageChannelIds.forEach((_item:string)=>{
let index = defaultList.findIndex(ele => Number(_item) === ele.channelId)
if(index > -1){
_myChannelList.push(defaultList[index])
_channelIds.push(defaultList[index].channelId)
}
})
}
if (cityName) {
let index = _myChannelList.findIndex(ele => cityName.includes(ele.name))
const localChannelitem = _myChannelList.splice(index, 1)[0];
...
...
@@ -466,10 +473,6 @@ export struct TopNavigationComponentNew {
this.changePage(this.currentTopNavSelectedIndex)
}
aboutToDisappear() {
AppStorage.set('channelIds', this.channelIds.join(','))
}
onTopNavigationDataUpdated() {
Logger.info(TAG,
`onTopNavigationDataUpdated currentTopNavIndex: ${this.currentTopNavSelectedIndex},topNavList.length:${this.topNavList.length}`);
...
...
sight_harmony/features/wdComponent/src/main/ets/components/view/LiveLikeComponent.ets
0 → 100644
View file @
778f7c8
import { DisplayUtils, NumberFormatterUtils } from 'wdKit/Index'
import { SPHelper } from 'wdKit';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { SpConstants } from 'wdConstant/Index';
import measure from '@ohos.measure'
import { ParamType, TrackConstants, TrackingContent } from 'wdTracking/Index';
import {
ContentDetailDTO,
} from 'wdBean';
import { LiveModel } from '../../viewmodel/LiveModel';
import { HttpUtils } from 'wdNetwork/Index';
const TAG = 'LiveLikeComponent';
interface ILikeStyleResp {
url: Resource;
name: string;
}
@Component
export struct LiveLikeComponent {
private LiveModel: LiveModel = new LiveModel()
@Prop @Watch('onDetailUpdated') contentDetailData: ContentDetailDTO
@Prop pageComponentType: number
@State likesStyle: string = "love" // 点赞样式 love爱心型 thumb点赞手势 mourning 蜡烛(默哀) pray 祈福
@State likeStatus: boolean = false
@State openLikes: boolean = false // 是否可以点赞 1:可以 0:不可以
styleType: number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏) 3 透明背景
@State likeCount: number = 0 //点赞数
@State likeBean: Record<string, string> = {}
pageParam: ParamType = {}
PageName: string = ''
//上层传值 样例
// this.data['contentId'] = '30035444649' //必须
// this.data['userName'] = '人民日报网友2kD2xW'
// this.data['contentType'] = '8' //必须
// this.data['title'] = '开创两校交流先河!克罗地亚教育代表团访问同济大学'
// this.data['userHeaderUrl'] = ""
// this.data['channelId'] = "2059" //必须
// this.data['status'] = "1"
// 内容用 是否开启点赞 1是 0否;
// this.contentDetailData.openLikes == 1
async aboutToAppear() {
this.onDetailUpdated()
this.contentTrackingDict()
}
async onDetailUpdated() {
// 2:竖屏直播页 4:横屏直播页
// 点赞样式 love爱心型 thumb点赞手势 mourning 蜡烛(默哀) pray 祈福
this.likesStyle = this.contentDetailData?.liveInfo?.likesStyle
this.openLikes = this.contentDetailData?.liveInfo?.likeEnable == 1 ? true : false
console.log(TAG, 'this.contentDetailData', JSON.stringify(this.contentDetailData))
// 点赞需要数据
this.likeBean['contentId'] = this.contentDetailData.newsId + ''
//获取点赞状态
this.getLikeStatus()
//获取点赞数
this.getLikeCount()
}
contentTrackingDict(){
this.pageParam = {
'contentType': `${this.contentDetailData.newsType}`,
'contentId': `${this.contentDetailData.newsId}`,
'contentName': `${this.contentDetailData.newsTitle || ''}`,
}
if(this.contentDetailData.newsType == 2) {
this.PageName = TrackConstants.PageName.Live_Detail // 直播
}
}
build() {
// 直播,点赞按钮底测有灰色圆角背景+右上点赞数量
this.likeCompStyle()
}
/**
* 将点赞样式转换为icon
*/
transLikeStyle(): ILikeStyleResp {
if (this.likesStyle === 'love' || this.likesStyle === 'thumb') {
return {
url: this.likeStatus ? $r(`app.media.ic_like_check`) :
this.styleType == 1 ? $r('app.media.icon_like_default') : $r(`app.media.ic_like_uncheck`),
name: '赞'
}
} else if (this.likesStyle === 'pray') {
return {
url: this.likeStatus ? $r(`app.media.ic_thub_check`) : $r(`app.media.ic_thub_uncheck`),
name: '祈祷'
}
} else if (this.likesStyle === 'mourning') {
return {
url: this.likeStatus ? $r(`app.media.ic_candle_check`) :
$r(`app.media.ic_candle_uncheck`),
name: '默哀'
}
}
return {
url: this.likeStatus ? $r(`app.media.ic_like_check`) :
this.styleType == 1 ? $r('app.media.icon_like_default') : $r(`app.media.ic_like_uncheck`),
name: '点赞'
}
}
@Builder
likeCompStyle() {
Stack({ alignContent: Alignment.Bottom }) {
Column() {
Image(this.transLikeStyle().url)
.width(24)
.height(24)
.onClick(() => {
this.clickButtonEvent()
})
}
.justifyContent(FlexAlign.Center)
.width(36)
.height(36)
.borderRadius(18)
.backgroundColor((this.pageComponentType === 4 || this.pageComponentType === 2) ? '#4D000000' : this.pageComponentType === 8 ? Color.Transparent : '#FFF5F5F5')
Row() {
Text(NumberFormatterUtils.formatNumberWithWan(this.likeCount || ''))
.fontSize(8)
.fontColor(Color.White)
.padding({ left: 8, right: 2 })
}
.height(12)
.alignItems(VerticalAlign.Center)
.position({ x: '100%', y: 10 })
.markAnchor({ x: '100%' })
.backgroundImage($r('app.media.ic_like_back'))
.backgroundImageSize({height: 13})
.width(this.getMeasureText(NumberFormatterUtils.formatNumberWithWan(this.likeCount || '')) +
12)
.visibility(this.likeCount > 0 ? Visibility.Visible : Visibility.Hidden)
}
.width(36)
.height(42)
.visibility(this.likesStyle == 'empty' || !this.openLikes ? Visibility.None : Visibility.Visible)
}
async clickButtonEvent() {
console.log(TAG, 'clickButtonEvent 点赞点击')
// 未登录,跳转登录
const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
if (!user_id) {
console.log(TAG, '点赞点击,未登录')
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
return
}
this.executeLike()
}
async executeLike() {
const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
if (!user_id) {
console.log(TAG, '查询点赞状态,未登录')
return
}
this.LiveModel.getLiveRoomNumberLike(this.likeBean['contentId'], 1, HttpUtils.getDeviceId()).then((data) => {
console.log(TAG, '点赞接口调用成功', JSON.stringify(data))
this.likeCount++
}).catch(() => {
})
}
async getLikeStatus() {
const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
if (!user_id) {
console.log(TAG, '查询点赞状态,未登录')
return
}
this.LiveModel.getLiveLike(this.likeBean['contentId'], user_id, HttpUtils.getDeviceId()).then(data => {
console.log(TAG, '查询点赞、收藏状态==', JSON.stringify(data))
this.likeStatus = data
}).catch(() => {
this.likeStatus = false
})
}
/**
* 获取点赞数
*/
getLikeCount() {
this.LiveModel.getLiveRoomData(this.likeBean['contentId']).then(data => {
console.log(TAG, '查询点赞、收藏数量 res', JSON.stringify(data))
if (data) {
this.likeCount = Number(data.likeNum)
} else {
this.likeCount = 0
}
}).catch(() => {
this.likeCount = 0
})
}
private getMeasureText(text: string) {
let width = measure.measureText({
textContent: text,
fontSize: 8,
lineHeight: 12,
constraintWidth: DisplayUtils.getDeviceWidth(),
})
width = px2vp(width)
return width
}
}
\ No newline at end of file
...
...
sight_harmony/features/wdComponent/src/main/ets/components/view/LiveOperRowListView.ets
0 → 100644
View file @
778f7c8
import { NumberFormatterUtils, SPHelper, ToastUtils } from 'wdKit';
import promptAction from '@ohos.promptAction';
import {
batchLikeAndCollectResult,
batchLikeAndCollectParams,
ContentDetailDTO,
contentListParams,
InteractDataDTO,
postExecuteCollectRecordParams
} from 'wdBean';
import router from '@ohos.router';
import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel';
import { LiveLikeComponent } from './LiveLikeComponent';
import { CommentTabComponent, CommentIconComponent, } from '../comment/view/CommentTabComponent';
import { publishCommentModel } from '../comment/model/PublishCommentModel'
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { PageRepository } from '../../repository/PageRepository';
import { SpConstants } from 'wdConstant/Index';
import { WDShare } from 'wdShare/Index';
import { EmitterEventId, EmitterUtils } from 'wdKit/Index'
import { ParamType, TrackConstants, TrackingContent } from 'wdTracking/Index';
import { CommentCustomDialog, CommentDialogInputContent } from '../comment/view/CommentCustomDialog';
import { HttpUtils } from 'wdNetwork/Index';
const TAG = 'LiveOperRowListView';
/**
* 直播详情页底部通栏组件:包含返回、评论、点赞、收藏、分享
* 上层传值:
* 1、(必传) contentDetailData---直播详情
* 2、(非必传) operationButtonList---组件展示条件,
* ['comment', 'like', 'collect', 'share'],需要展示什么传什么
* comment--评论;like--点赞;collect--收藏;share--分享;
* 注意:外层需注册 @Provide contentDetailData:contentDetailData = {} as contentDetailData
* 传值示例:
LiveOperRowListView({
contentDetailData: this.contentDetailData[0],
operationButtonList: ['comment', 'like', 'collect', 'share']
})
*/
@Preview
@Component
export struct LiveOperRowListView {
private onBack: () => void = () => {
}
private onCommentInputFocus?: () => void
private onCommentInputed?: (comment: CommentDialogInputContent) => void
@Prop @Watch('onDetailUpdated') contentDetailData: ContentDetailDTO // 稿件详情
/**
* 用于区分页面类型,在哪个页面嵌套就传相应的值
* 2:竖屏直播页 4:横屏直播页
* 8: 评论弹框内
*/
@Prop pageComponentType?: number = -1
@Prop showBackIcon?: boolean = true
@Prop operationButtonList?: string[] = ['comment', 'collect', 'share'] // 组件展示条件
@State needLike: boolean = true
@State styleType: number = -1
@State bgColor: ResourceColor = Color.White
@State interactData: InteractDataDTO = {} as InteractDataDTO
@State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
@State dialogController: CustomDialogController | null = null;
pageParam: ParamType = {}
PageName: string = ''
@State likesStyle: number | string = "love" // 点赞样式 love爱心型 thumb点赞手势 mourning 蜡烛(默哀) pray 祈福
@State openLikes: boolean = false // 是否可以点赞 1:可以 0:不可以
/// comment
@State showCommentInput: boolean = false
private banComment: boolean = true // 是否已禁言
private commentInputDialogController?: CustomDialogController
@State publishCommentModel: publishCommentModel = new publishCommentModel()
async aboutToAppear() {
console.info(TAG, 'this.needLike', this.needLike)
this.handleStyle()
this.onDetailUpdated()
this.contentTrackingDict()
this.checkCanInputComment()
}
contentTrackingDict(){
this.pageParam = {
'contentType': `${this.contentDetailData.newsType}`,
'contentId': `${this.contentDetailData.newsId}`,
'contentName': `${this.contentDetailData.newsTitle || ''}`,
}
if(this.contentDetailData.newsType == 2) {
this.PageName = TrackConstants.PageName.Live_Detail // 直播
}
}
async onDetailUpdated() {
console.info(TAG, 'this.styleType', this.styleType)
this.handleStyle()
if (!this.contentDetailData) {
return
}
const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
if (user_id) {
this.getInteractDataStatus()
}
await this.queryContentInteractCount()
console.info(TAG, 'contentDetailData----', JSON.stringify(this.contentDetailData))
console.info(TAG, 'this.operationButtonList', JSON.stringify(this.operationButtonList))
// 评论需要数据
/* this.publishCommentModel.targetId = this.contentDetailData.newsId + ''
this.publishCommentModel.targetRelId = this.contentDetailData.reLInfo?.relId + ''
this.publishCommentModel.targetTitle = this.contentDetailData.newsTitle + ''
this.publishCommentModel.targetRelType = this.contentDetailData.reLInfo?.relType + ''
this.publishCommentModel.targetRelObjectId = this.contentDetailData.reLInfo?.relObjectId + ''
this.publishCommentModel.keyArticle = this.contentDetailData.keyArticle + ''
this.publishCommentModel.targetType = this.contentDetailData.newsType + ''*/
// 2:竖屏直播页 3:图集 4:横屏直播页
// 点赞样式 love爱心型 thumb点赞手势 mourning 蜡烛(默哀) pray 祈福
this.likesStyle = this.contentDetailData?.liveInfo?.likesStyle
this.openLikes = this.contentDetailData?.liveInfo?.likeEnable == 1 ? true : false
}
build() {
// 直播详情页
Column() {
if(this.styleType != 3) {
Divider().strokeWidth(1).color(this.styleType == 1 ? '#F5F5F5' : this.styleType == 2 ? '#262626' : 'rgba(0,0,0,0)')
}
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
Row() {
Column() {
Image(this.styleType == 1 ? $r('app.media.icon_arrow_left') :
$r('app.media.icon_arrow_left_white'))
.width(24)
.height(24)
.aspectRatio(1)
.interpolation(ImageInterpolation.High)
}
.width(48)
.hoverEffect(HoverEffect.Scale)
.visibility(this.showBackIcon ? Visibility.Visible : Visibility.None)
.onClick(() => {
if (this.onBack) {
this.onBack()
}
router.back();
})
if (this.contentDetailData?.newsId) {
ForEach(this.operationButtonList, (item: string, index: number) => {
if (item == 'comment') {
this.builderComment()
} else if (item == 'like' && this.needLike) {
this.builderLike()
} else if (item == 'collect') {
this.builderCollect()
} else if (item == 'share') {
this.builderShare()
} else {
}
})
}
}
.width('100%')
.justifyContent(FlexAlign.Start)
}
.width('100%')
.backgroundColor(this.bgColor)
.padding({
top: 10,
// bottom: 10
bottom: `${this.bottomSafeHeight}px`
// bottom: 50
})
}
}
/**
* 评论组件
*/
@Builder
builderComment() {
Column() {
if (this.showCommentInput) {
Row() {
Stack({ alignContent: Alignment.Start }) {
RelativeContainer() {
Image($r('app.media.comment_img_input_hui'))
.objectFit(ImageFit.Fill)
.resizable({
slice: {
top: 1,
left: 1,
right: 20,
bottom: 1
}
})
.alignRules({
top: { anchor: "__container__", align: VerticalAlign.Top },
left: { anchor: "__container__", align: HorizontalAlign.Start },
right: { anchor: "__container__", align: HorizontalAlign.End },
bottom: { anchor: "__container__", align: VerticalAlign.Bottom },
})
.id("Image")
Text("说两句...")
.fontSize(12)
.fontColor('#999999')
.margin({ left: 10 })
.alignRules({
top: { anchor: "__container__", align: VerticalAlign.Top },
left: { anchor: "__container__", align: HorizontalAlign.Start },
bottom: { anchor: "__container__", align: VerticalAlign.Bottom },
})
.id("Text")
}
}
}
.height(30)
.onClick(() => {
if (this.onCommentInputFocus) {
this.onCommentInputFocus()
}
this.showCommentDialog()
})
} else {
Blank()
}
}
.layoutWeight(1)
.margin({ left: 16 })
}
/**
* 点赞组件
*/
@Builder
builderLike() {
Column() {
LiveLikeComponent({
contentDetailData: this.contentDetailData,
styleType: this.styleType,
pageComponentType: this.pageComponentType
})
}
.width(48)
.visibility(this.likesStyle == 4 || this.likesStyle == 'empty' || !this.openLikes ? Visibility.None : Visibility.Visible)
}
/**
* 收藏组件
*/
@Builder
builderCollect() {
Stack() {
Image(this.newsStatusOfUser?.collectStatus == 1 ? $r('app.media.ic_collect_check1') :
this.styleType == 1 ? $r('app.media.iv_live_comment_collect_un') :
$r('app.media.iv_live_comment_collect_un_white'))
.width(24)
.height(24)
.interpolation(ImageInterpolation.High)
/*Text(`${this.interactData?.collectNum}`)
.fontSize(8)
.fontColor(Color.White)
.height(12)
.margin({ left: 6 })
.backgroundImage($r('app.media.comment_icon_number'))
.offset({
x: 12
})*/
}
.height(36)
.width(48)
.borderRadius(18)
.backgroundColor(this.pageComponentType === 2 ? '#4D000000' : Color.Transparent)
.onClick(() => {
this.toggleCollectStatus()
})
}
/**
* 分享组件
*/
@Builder
builderShare() {
Column() {
Image(this.styleType == 1 ? $r('app.media.iv_live_comment_share') :
$r('app.media.iv_live_comment_share_white'))
.width(24)
.height(24)
.aspectRatio(1)
.interpolation(ImageInterpolation.High)
.onClick((event: ClickEvent) => {
// ToastUtils.showToast('分享为公共方法,待开发', 1000);
this.share()
})
}
.justifyContent(FlexAlign.Center)
.height(36)
.width(48)
.borderRadius(18)
.backgroundColor(this.pageComponentType === 2 ? '#4D000000' : Color.Transparent)
}
handleStyle() {
if (this.styleType == 1) {
this.bgColor = Color.White
} else if (this.styleType == 2) {
this.bgColor = Color.Black
} else if (this.styleType == 3) {
this.bgColor = Color.Transparent
}
}
share() {
WDShare.shareContent(this.contentDetailData)
}
showCommentDialog() {
if (this.contentDetailData.liveInfo.openComment != 1) {
ToastUtils.showToast("暂时无法评论", 3000)
return
}
//未登录,游客评论打开
if (!HttpUtils.isLogin() && this.contentDetailData.visitorComment == 1) {
this.commentDialog()
return
}
if (!HttpUtils.isLogin()) {
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
return
}
if (this.banComment) {
ToastUtils.showToast("暂时无法评论", 3000)
return
}
this.commentDialog()
}
private commentDialog() {
this.commentInputDialogController = new CustomDialogController({
builder: CommentCustomDialog({
onPublishBtnClick: (content: CommentDialogInputContent) => {
if (this.banComment) {
ToastUtils.showToast("暂时无法评论", 3000)
} else if (this.onCommentInputed) {
this.onCommentInputed(content)
}
this.commentInputDialogController?.close()
return true
},
publishCommentModel: this.publishCommentModel
}),
autoCancel: true,
alignment: DialogAlignment.Bottom,
customStyle: true,
offset: {
dx: 0,
dy: -20
},
backgroundColor: "#50000000",
})
this.publishCommentModel.rootCommentId = '-1';
this.publishCommentModel.parentId = '-1';
this.publishCommentModel.placeHolderText = "说两句..."
this.commentInputDialogController?.open();
}
// 已登录->查询用户对作品收藏状态
private async getInteractDataStatus() {
try {
const params: batchLikeAndCollectParams = {
contentList: [
{
contentId: this.contentDetailData?.newsId + '',
contentType: this.contentDetailData?.newsType + '',
contentRelId: this.contentDetailData?.reLInfo?.relId || '' + '',
}
]
}
console.info(TAG, '查询用户对作品收藏1', JSON.stringify(params))
// console.info(TAG, '查询用户对作品收藏11', JSON.stringify(params))
let data = await MultiPictureDetailViewModel.getInteractDataStatus(params)
console.info(TAG, '查询用户对作品收藏22', JSON.stringify(data))
this.newsStatusOfUser = data[0];
} catch (exception) {
// console.error(TAG, JSON.stringify(exception))
}
}
/**
* 收藏、取消收藏
*/
async toggleCollectStatus() {
// 未登录,跳转登录
const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
console.log(TAG, '收藏点击,登录', user_id)
if (!user_id) {
console.log(TAG, '收藏点击,用户未登录')
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
return
}
const params: postExecuteCollectRecordParams = {
status: this.newsStatusOfUser?.collectStatus === 1 ? '0' : '1',
contentList: [{
contentId: this.contentDetailData?.newsId + '',
contentType: this.contentDetailData?.newsType + '',
relType: this.contentDetailData?.reLInfo?.relType || '' + '',
contentRelId: this.contentDetailData?.reLInfo?.relId || '' + '',
}],
}
console.log(TAG, '收藏点击', JSON.stringify(params))
PageRepository.postExecuteCollectRecord(params).then(res => {
if (this.newsStatusOfUser) {
this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1
if (this.newsStatusOfUser.collectStatus === 1) {
promptAction.showToast({ message: '收藏成功' })
TrackingContent.collect(true,this.PageName,this.PageName,this.pageParam)
} else {
TrackingContent.collect(false,this.PageName,this.PageName,this.pageParam)
}
this.queryContentInteractCount()
}
console.log(TAG, '收藏点击 this.newsStatusOfUser', JSON.stringify(this.newsStatusOfUser))
})
}
/**
* 查询点赞、收藏数量
*/
queryContentInteractCount() {
// console.error(TAG, 'contentDetailData2222', JSON.stringify(this.contentDetailData))
const params: contentListParams = {
contentList: [{
contentId: this.contentDetailData?.newsId + '',
contentType: this.contentDetailData?.newsType,
}]
}
console.log(TAG, '查询点赞、收藏数量', JSON.stringify(params))
PageRepository.getContentInteract(params).then(res => {
console.log(TAG, '查询点赞、收藏数量 res', JSON.stringify(res))
if (res.data) {
this.interactData.likeNum = NumberFormatterUtils.formatNumberWithWan(res.data[0]?.likeNum)
this.interactData.collectNum = NumberFormatterUtils.formatNumberWithWan(res.data[0]?.collectNum)
this.interactData.commentNum = NumberFormatterUtils.formatNumberWithWan(res.data[0]?.commentNum)
}
// console.log(TAG, '获取互动点赞等数据===', JSON.stringify(res))
console.log(TAG, 'this.interactData44', JSON.stringify(this.interactData))
})
}
async checkCanInputComment() {
// 允许评论,且大家聊没隐藏
let canComment = (this.contentDetailData.liveInfo.openComment == 1 && this.contentDetailData.liveInfo.liveStyle != 2)
this.showCommentInput = canComment
let mLiveId: string = this.contentDetailData.liveInfo.mlive.mliveId as string
if (!HttpUtils.isLogin() || mLiveId == undefined) {
return
}
// 查询是否被禁言
PageRepository.fetchLiveBarrageBan(mLiveId).then(res => {
this.banComment = res.data as boolean
this.showCommentInput = !this.banComment && canComment
})
}
}
\ No newline at end of file
...
...
sight_harmony/features/wdComponent/src/main/ets/components/view/areaPickerDialog/DateCustomComponent.ets
View file @
778f7c8
...
...
@@ -14,14 +14,6 @@ export struct DateCustomComponent {
.onDateChange((value) => {
this.selectDate = value as Date
})
// .onDateChange:(value:DatePickerResult) => {
// let mon = value.month as number + 1
// let monStr = mon < 10? '0'+mon.toString():mon.toString();
// let dayStr = value.day as number < 10? '0'+value.day:value.day;
// this.currentUserInfo.userExtend.birthday = value.year+'-'+monStr+'-'+dayStr;
// this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_birthday
// this.updateEditModel()
// }
}.justifyContent(FlexAlign.Center)
}.height('100%')
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/view/areaPickerDialog/EditUserSexCustomDialog.ets
0 → 100644
View file @
778f7c8
@CustomDialog
export struct EditUserSexCustomDialog {
controller: CustomDialogController
confirmCallback: (selectIndex:number) => void = () => {
}
build() {
Column(){
Button('男',{type:ButtonType.Normal}).height(45).width('100%').fontSize(14).fontColor('#222222').backgroundColor(0xffffff)
.onClick(()=>{
this.confirmCallback(1)
this.controller.close()
})
Divider()
.color('#f5f5f5')
.width('100%')
.strokeWidth(1)
Button('女',{type:ButtonType.Normal}).height(45).width('100%').fontSize(14).fontColor('#222222').backgroundColor(0xffffff)
.onClick(()=>{
this.confirmCallback(0)
this.controller.close()
})
Divider()
.color('#f5f5f5')
.width('100%')
.strokeWidth(5)
Button('取消',{type:ButtonType.Normal}).height(80).width('100%').fontSize(14).fontColor('#222222').backgroundColor(0xffffff)
.onClick(()=>{
this.controller.close()
})
}.height(176).width('100%').backgroundColor(Color.White)
}
}
\ No newline at end of file
...
...
sight_harmony/features/wdComponent/src/main/ets/dialog/ENewspaperListDialog.ets
View file @
778f7c8
...
...
@@ -3,7 +3,7 @@ import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'
import { WDRouterRule } from 'wdRouter/Index'
import { ENewspaperPageDialog } from '../dialog/ENewspaperPageDialog'
import { Logger } from 'wdKit';
import { window } from '@kit.ArkUI';
import {
font,
window } from '@kit.ArkUI';
/**
* 读报纸半屏弹窗
...
...
@@ -56,6 +56,11 @@ export struct ENewspaperListDialog {
}
async aboutToAppear() {
//注册字体
font.registerFont({
familyName: 'BebasNeueBold',
familySrc: $rawfile('font/BebasNeueBold.otf')
})
// 屏幕高度 - 滑动高度计算
let windowClass: window.Window = await window.getLastWindow(getContext(this));
let changeHeight = 85 + 44 + px2vp(windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).topRect.height)
...
...
@@ -151,7 +156,7 @@ export struct ENewspaperListDialog {
Column() {
if (itemIndex == 0) {
Text(item.pageNum + '版:' + item.pageName)
.fontSize($r('app.float.font_size_1
4
'))
.fontSize($r('app.float.font_size_1
3
'))
.fontColor($r('app.color.color_ED2800'))
.fontWeight(600)
.width('100%')
...
...
@@ -165,7 +170,7 @@ export struct ENewspaperListDialog {
Column() {
if (positionItem.shortTitle) {
Text(positionItem.shortTitle)
.fontSize($r('app.float.font_size_1
4
'))
.fontSize($r('app.float.font_size_1
3
'))
.fontColor($r('app.color.color_222222'))
.fontWeight(600)
// .maxLines(2)
...
...
@@ -176,7 +181,7 @@ export struct ENewspaperListDialog {
if (positionItem.title) {
Text(positionItem.title)
.fontSize($r('app.float.font_size_1
7
'))
.fontSize($r('app.float.font_size_1
6
'))
.fontColor($r('app.color.color_222222'))
.fontWeight(600)
.margin({
...
...
@@ -187,7 +192,7 @@ export struct ENewspaperListDialog {
if (positionItem.downTitle) {
Text(positionItem.downTitle)
.fontSize($r('app.float.font_size_1
4
'))
.fontSize($r('app.float.font_size_1
3
'))
.fontColor($r('app.color.color_222222'))
.fontWeight(600)
.margin({
...
...
@@ -197,7 +202,7 @@ export struct ENewspaperListDialog {
}
if (positionItem.newsTxt) {
Text(positionItem.newsTxt)
.fontSize($r('app.float.font_size_1
4
'))
.fontSize($r('app.float.font_size_1
3
'))
.fontColor($r('app.color.color_999999'))
.lineHeight(25)
.margin({
...
...
sight_harmony/features/wdComponent/src/main/ets/model/MinePageDatasModel.ets
View file @
778f7c8
...
...
@@ -73,9 +73,9 @@ class MinePageDatasModel{
this.personalData.push(new MinePagePersonalFunctionsItem("关注",$r('app.media.mine_follow_icon')))
this.personalData.push(new MinePagePersonalFunctionsItem("收藏",$r('app.media.mine_collect_icon')))
// this.personalData.push(new MinePagePersonalFunctionsItem("历史",$r('app.media.mine_history_icon')))
this.personalData.push(new MinePagePersonalFunctionsItem("消息",$r('app.media.mine_msg_icon')))
// this.personalData.push(new MinePagePersonalFunctionsItem("留言板",$r('app.media.mine_msgboard_icon')))
this.personalData.push(new MinePagePersonalFunctionsItem("预约",$r('app.media.mine_order_icon')))
this.personalData.push(new MinePagePersonalFunctionsItem("消息",$r('app.media.mine_msg_icon')))
return this.personalData
}
...
...
sight_harmony/features/wdComponent/src/main/ets/repository/PageRepository.ets
View file @
778f7c8
...
...
@@ -480,4 +480,11 @@ export class PageRepository {
url = url + "?liveIdList=" + ids;
return WDHttp.get<ResponseDTO<LiveRoomDataBean[]>>(url)
};
static fetchLiveBarrageBan(mLiveId: string) {
let url = HttpUrlUtils.getLiveBarrageHasBanUrl()
url = url + "?mliveId=" + mLiveId
return WDHttp.get<ResponseDTO<boolean>>(url)
}
}
...
...
sight_harmony/features/wdComponent/src/main/ets/utils/lazyloadImg.ets
View file @
778f7c8
import { NetworkUtil, SPHelper } from 'wdKit';
import { SpConstants } from 'wdConstant';
async function onlyWifiLoadImg()
: Promise<boolean> {
async function onlyWifiLoadImg(): Promise<boolean> {
let loadImageOnlyWifiSwitch = await SPHelper.default.get(SpConstants.SETTING_WIFI_IMAGE_SWITCH, '') || false;
let isNetConnected = NetworkUtil.isNetConnected();
if (!loadImageOnlyWifiSwitch) {
// 开关没开,直接让加载图片
return true
}
let netWorkStatus = NetworkUtil.getNetworkType();
if (isNetConnected) {
// 开关打开,wifi下才加载图片
if (netWorkStatus === NetworkUtil.TYPE_WIFI) {
return true;
} else {
if (loadImageOnlyWifiSwitch) {
return false
} else {
return true;
}
}
} else {
return false;
return true
}
return false
}
export { onlyWifiLoadImg }
\ No newline at end of file
...
...
sight_harmony/features/wdComponent/src/main/ets/viewmodel/LiveModel.ets
View file @
778f7c8
import { HttpUrlUtils, ResponseDTO } from 'wdNetwork';
import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest';
import { Logger, ToastUtils, EmitterEventId, EmitterUtils } from 'wdKit';
import { LiveDetailsBean, ReserveBean, ReserveItemBean, joinPeopleNum } from 'wdBean/Index';
import { LiveDetailsBean, ReserveBean, ReserveItemBean, joinPeopleNum
, LiveRoomDataBean, ValueType
} from 'wdBean/Index';
const TAG = 'LiveModel'
...
...
@@ -73,6 +73,89 @@ export class LiveModel {
}
/**
* 获取直播数据
* @param liveId
* @returns
*/
getLiveRoomData(liveId: string) {
return new Promise<LiveRoomDataBean>((success, fail) => {
HttpRequest.get<ResponseDTO<LiveRoomDataBean>>(
HttpUrlUtils.getLiveRoomDataUrl() + `?liveId=${liveId}`,
).then((data: ResponseDTO<LiveRoomDataBean>) => {
if (!data || !data.data) {
fail("数据为空")
return
}
if (data.code != 0) {
fail(data.message)
return
}
success(data.data)
}, (error: Error) => {
fail(error.message)
Logger.debug(TAG + ":error ", error.toString())
})
})
}
/**
* 直播详情-C端点赞接口
* @param liveId
* @param number
* @param deviceId
* @returns
*/
getLiveRoomNumberLike(liveId: string, number: number, deviceId: string | number) {
return new Promise<number>((success, fail) => {
HttpRequest.get<ResponseDTO<number>>(
HttpUrlUtils.getLiveRoomNumberLikeUrl() + `?liveId=${liveId}&number=${number}&deviceId=${deviceId}`,
).then((data: ResponseDTO<number>) => {
if (!data || !data.data) {
fail("数据为空")
return
}
if (data.code != 0) {
fail(data.message)
return
}
console.log('LiveLikeComponent data.data', data.data)
success(data.data)
}, (error: Error) => {
fail(error.message)
Logger.debug(TAG + ":error ", error.toString())
})
})
}
/**
* 直播详情-查询是否点赞接口
* @param liveId
* @param userId
* @param deviceId
* @returns
*/
getLiveLike(liveId: string, userId: ValueType, deviceId: string | number) {
return new Promise<boolean>((success, fail) => {
HttpRequest.get<ResponseDTO<boolean>>(
HttpUrlUtils.getLiveLikeUrl() + `?liveId=${liveId}&userId=${userId}&deviceId=${deviceId}`,
).then((data: ResponseDTO<boolean>) => {
if (!data || !data.data) {
fail("数据为空")
return
}
if (data.code != 0) {
fail(data.message)
return
}
success(data.data)
}, (error: Error) => {
fail(error.message)
Logger.debug(TAG + ":error ", error.toString())
})
})
}
/**
* 查询预约状态
*
[{"relationId":"500002824823","liveId":"20000120522"},{"relationId":"500002845517","liveId":"20000120782"}]
...
...
sight_harmony/features/wdDetailPlayLive/src/main/ets/pages/DetailPlayLiveCommon.ets
View file @
778f7c8
...
...
@@ -112,6 +112,23 @@ export struct DetailPlayLiveCommon {
})
}
// /**
// *
// * @returns true : 沉浸式;false : 非沉浸式
// */
// isImmersionLive(): boolean {
//
// let flag = false
//
// if (this.liveState === 'wait' || this.liveLandscape === 'news') {
// flag = false
// } else if (this.liveLandscape === 'general') {
// flag = true
// }
//
// return flag
// }
onPageShow() {
this.pageShow = Math.random()
Logger.info(TAG, 'onPageShow')
...
...
sight_harmony/features/wdDetailPlayLive/src/main/ets/pages/DetailPlayLivePage.ets
View file @
778f7c8
...
...
@@ -7,7 +7,7 @@ import mediaquery from '@ohos.mediaquery';
import { Logger, WindowModel } from 'wdKit/Index';
import { router, window } from '@kit.ArkUI';
import { WDAliPlayerController } from 'wdPlayer/Index';
import {
OperRowListView } from 'wdComponent/src/main/ets/components/view/OperRowListView
';
import {
LiveOperRowListView } from 'wdComponent
';
import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment/model/PublishCommentModel';
let TAG: string = 'DetailPlayLivePage';
...
...
@@ -69,16 +69,18 @@ export struct DetailPlayLivePage {
.layoutWeight(1)
.visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None)
OperRowListView({
componentType: 4,
LiveOperRowListView({
operationButtonList: ['comment', 'collect', 'share', 'like'],
styleType: 1,
contentDetailData: this.contentDetailData,
publishCommentModel: this.publishCommentModel,
showCommentIcon: false,
onCommentFocus: () => {
onCommentInputFocus: () => {
// 切换到大家聊
this.changeToTab = Math.random()
},
onCommentInputed: (content) => {
if (content.comment) {
this.liveViewModel.sendComment(content.comment)
}
}
}).visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None)
...
...
@@ -119,8 +121,8 @@ export struct DetailPlayLivePage {
getLiveDetails() {
const data = this.contentDetailData
console.error("XXXXZZZZ", 'contentDetailData ----liveState==>' + data.liveInfo?.liveState)
console.error("XXXXZZZZ", 'contentDetailData ----liveStyle==>' + data.liveInfo?.liveStyle)
// console.error("XXXXZZZZ", 'contentDetailData ----liveState==>' + data.liveInfo?.liveState)
// console.error("XXXXZZZZ", 'contentDetailData ----liveStyle==>' + data.liveInfo?.liveStyle)
if (data.liveInfo?.liveState == 'wait') {
//直播样式 0-正常模式 , 1-隐藏直播间,2-隐藏大家聊 【人民号发布是竖屏的,为空】
if (data.liveInfo?.liveStyle == 1) {
...
...
sight_harmony/features/wdDetailPlayLive/src/main/ets/viewModel/LiveModel.ets
View file @
778f7c8
import { HttpUrlUtils, ResponseDTO } from 'wdNetwork';
import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest';
import { Logger, ToastUtils, EmitterEventId, EmitterUtils } from 'wdKit';
import { ContentDetailDTO, LiveDetailsBean, LiveRoomBean, LiveRoomDataBean, ReserveItemBean } from 'wdBean/Index';
import { ContentDetailDTO, LiveDetailsBean, LiveRoomBean, LiveRoomDataBean, ReserveItemBean
, ValueType
} from 'wdBean/Index';
import { ContentDetailRequest } from 'wdDetailPlayApi/Index';
const TAG = 'LiveModel'
...
...
@@ -151,6 +151,62 @@ export class LiveModel {
}
/**
* 直播详情-C端点赞接口
* @param liveId
* @param number
* @param deviceId
* @returns
*/
getLiveRoomNumberLike(liveId: string, number: number, deviceId: string | number) {
return new Promise<number>((success, fail) => {
HttpRequest.get<ResponseDTO<number>>(
HttpUrlUtils.getLiveRoomNumberLikeUrl() + `?liveId=${liveId}&number=${number}&deviceId=${deviceId}`,
).then((data: ResponseDTO<number>) => {
if (!data || !data.data) {
fail("数据为空")
return
}
if (data.code != 0) {
fail(data.message)
return
}
success(data.data)
}, (error: Error) => {
fail(error.message)
Logger.debug(TAG + ":error ", error.toString())
})
})
}
/**
* 直播详情-查询是否点赞接口
* @param liveId
* @param userId
* @param deviceId
* @returns
*/
getLiveLike(liveId: string, userId: ValueType, deviceId: string | number) {
return new Promise<boolean>((success, fail) => {
HttpRequest.get<ResponseDTO<boolean>>(
HttpUrlUtils.getLiveLikeUrl() + `?liveId=${liveId}&userId=${userId}&deviceId=${deviceId}`,
).then((data: ResponseDTO<boolean>) => {
if (!data || !data.data) {
fail("数据为空")
return
}
if (data.code != 0) {
fail(data.message)
return
}
success(data.data)
}, (error: Error) => {
fail(error.message)
Logger.debug(TAG + ":error ", error.toString())
})
})
}
/**
* 获取直播预约状态
* @param relationId
* @param liveId
...
...
sight_harmony/features/wdDetailPlayLive/src/main/ets/viewModel/LiveViewModel.ets
View file @
778f7c8
import { ContentDetailDTO, LiveDetailsBean, LiveRoomBean, LiveRoomDataBean } from 'wdBean/Index'
import { ContentDetailDTO, LiveDetailsBean, LiveRoomBean, LiveRoomDataBean
, ValueType
} from 'wdBean/Index'
import { ResponseDTO } from 'wdNetwork/Index'
import { LiveModel } from './LiveModel'
...
...
@@ -68,6 +68,26 @@ export class LiveViewModel {
})
})
}
// 直播详情-C端点赞接口
getLiveRoomNumberLike(liveId: string, number: number, deviceId: string | number) {
return new Promise<number>((success, fail) => {
this.liveModel.getLiveRoomNumberLike(liveId, number, deviceId).then((data) => {
success(data)
}).catch((message: string) => {
fail(message)
})
})
}
// 直播详情-查询是否点赞接口
getLiveLike(liveId: string, userId: ValueType, deviceId: string | number) {
return new Promise<boolean>((success, fail) => {
this.liveModel.getLiveLike(liveId, userId, deviceId).then((data) => {
success(data)
}).catch((message: string) => {
fail(message)
})
})
}
//直播预约状态查询
getLiveAppointmentStatus(relationId: string, liveId: string) {
...
...
@@ -90,4 +110,8 @@ export class LiveViewModel {
})
})
}
sendComment(comment: string) {
}
}
\ No newline at end of file
...
...
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/details/video/PlayUIComponent.ets
View file @
778f7c8
import { window } from '@kit.ArkUI'
import { window } from '@kit.ArkUI'
;
import lottie from '@ohos/lottie';
import { NumberFormatterUtils, StringUtils, WindowModel } from 'wdKit/Index'
import { DateFormatUtil, WDAliPlayerController, WDPlayerController } from 'wdPlayer/Index'
import { ContentDetailDTO, LiveDetailsBean, LiveRoomDataBean } from 'wdBean/Index'
import { DisplayDirection } from 'wdConstant/Index'
import { LiveFollowComponent, LottieView } from 'wdComponent/Index'
import { NumberFormatterUtils, StringUtils, WindowModel } from 'wdKit/Index';
import { DateFormatUtil, PlayerConstants, WDAliPlayerController } from 'wdPlayer/Index';
import { ContentDetailDTO, LiveRoomDataBean } from 'wdBean/Index';
import { DisplayDirection } from 'wdConstant/Index';
import { LiveFollowComponent, LottieView } from 'wdComponent/Index';
@Component
export struct PlayUIComponent {
playerController?: WDAliPlayerController;
//菜单键是否可见
@State @Watch('onChangeMenuVisible') isMenuVisible: boolean = true
// @Consume liveDetailsBean: LiveDetailsBean
@Consume contentDetailData: ContentDetailDTO
@Consume liveRoomDataBean: LiveRoomDataBean
@State currentTime: string = ''
...
...
@@ -21,8 +20,11 @@ export struct PlayUIComponent {
//是否处于播放状态中
@State isPlayStatus: boolean = true
@Consume displayDirection: DisplayDirection
@Prop isShowBottom: boolean
// 播放地址 (视频或者 直播地址)
@Prop liveUrl: string
// 当前播放资源的状态
@Consume playSourceState: number
onChangeMenuVisible() {
if (!this.contentDetailData || !this.contentDetailData.liveInfo ||
...
...
@@ -41,6 +43,21 @@ export struct PlayUIComponent {
aboutToAppear(): void {
this.onChangeMenuVisible()
this.initPlayerSet()
}
aboutToDisappear(): void {
if (this.contentDetailData.liveInfo?.liveState == 'running') {
lottie.destroy('live_status_wait')
}
}
/*
初始话播放器设置
*/
initPlayerSet(){
//播放进度监听
if (this.playerController) {
this.playerController.onTimeUpdate = (position: number, duration: number) => {
...
...
@@ -49,12 +66,7 @@ export struct PlayUIComponent {
this.progressVal = Math.floor(position * 100 / duration);
}
}
}
aboutToDisappear(): void {
if (this.contentDetailData.liveInfo?.liveState == 'running') {
lottie.destroy('live_status_wait')
}
}
build() {
...
...
@@ -62,7 +74,7 @@ export struct PlayUIComponent {
if (this.contentDetailData && this.contentDetailData.liveInfo) {
this.getTopUIComponent()
this.getMiddleUIComponent()
if
(this.isShowBottom)
{
if
(this.isShowBottom)
{
this.getBottomUIComponent()
}
...
...
@@ -251,16 +263,13 @@ export struct PlayUIComponent {
@Builder
getBottomUIComponent() {
Row() {
if (this.contentDetailData?.liveInfo?.liveState == 'wait') {
Blank()
} else if (this.contentDetailData?.liveInfo?.liveState == 'running') {
this.playOrPauseBtn()
Blank()
} else if (this.contentDetailData?.liveInfo?.liveState == 'end') {
if (StringUtils.isEmpty(this.contentDetailData?.liveInfo?.vlive[0]?.replayUri)) {
Blank()
} else {
// 视频资源
if (!StringUtils.isEmpty(this.liveUrl)) {
// 暂定和播放按钮
this.playOrPauseBtn()
// 开始时间
if (this.contentDetailData?.liveInfo?.liveState != 'running' || this.contentDetailData.showTime) {
Text(this.currentTime)
.fontColor(Color.White)
.fontWeight(600)
...
...
@@ -268,7 +277,12 @@ export struct PlayUIComponent {
.margin({
left: 16
})
}
// 进度条
this.playProgressView()
// 总的播放时间
if (this.contentDetailData?.liveInfo?.liveState != 'running' || this.contentDetailData.showTime) {
Text(this.totalTime)
.fontColor(Color.White)
.fontWeight(600)
...
...
@@ -277,11 +291,13 @@ export struct PlayUIComponent {
right: 16
})
}
} else {
Blank()
}
if (this.contentDetailData?.liveInfo?.liveState == 'running'
|| (this.contentDetailData?.liveInfo?.liveState == 'end' &&
StringUtils.isNotEmpty(this.contentDetailData?.liveInfo?.vlive[0]?.replayUri))
) {
// 全屏按钮
if (!StringUtils.isEmpty(this.liveUrl)) {
Image($r('app.media.icon_live_player_full_screen'))
.width(24)
.height(24)
...
...
@@ -298,6 +314,7 @@ export struct PlayUIComponent {
})
.visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None)
}
}
.alignItems(VerticalAlign.Center)
.linearGradient({ angle: 0, colors: [['#99000000', 0], ['#00000000', 1]] })
...
...
@@ -313,6 +330,19 @@ export struct PlayUIComponent {
@Builder
playOrPauseBtn() {
if (this.playSourceState === PlayerConstants.STATUS_COMPLETION) {
//资源播放完成
Image($r('app.media.player_play_ic'))
.width(24)
.height(24)
.onClick(() => {
this.isPlayStatus = true
this.initPlayerSet()
this.playerController?.firstPlay(this.liveUrl)
this.playerController?.play()
})
} else {
//暂停、播放
Image(this.isPlayStatus ? $r('app.media.icon_live_player_pause') : $r('app.media.player_play_ic'))
.width(24)
...
...
@@ -328,6 +358,8 @@ export struct PlayUIComponent {
})
}
}
@Builder
playProgressView() {
Slider({
...
...
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/details/video/TopPlayComponet.ets
View file @
778f7c8
...
...
@@ -13,7 +13,9 @@ const TAG: string = 'TopPlayComponent'
export struct TopPlayComponent {
@Consume @Watch('updateData') contentDetailData: ContentDetailDTO
playerController?: WDAliPlayerController
@State imgUrl: string = ''
// 预告片图片/视频url
@State previewUrl: string = ''
@State isVideoSource: boolean = false
//未开始
@State isWait: boolean = false
//已结束直播
...
...
@@ -24,14 +26,15 @@ export struct TopPlayComponent {
@State isLoading: boolean = false
// 获取播放资源能播放了
@State isCanPlay: boolean = false
// 当前播放资源的状态
@Provide playSourceState: number = 0
private playUrl: string = ""
private xComponentIsLoaded: boolean = false
aboutToAppear(): void {
if (this.playerController) {
this.playerController.onCanplay = () => {
Logger.debug(TAG, 'onCanplay==>')
this.isCanPlay = true
this.isLoading = true
this.playerController?.play()
...
...
@@ -40,35 +43,56 @@ export struct TopPlayComponent {
this.playerController.onStatusChange = (status: number) => {
this.playSourceState = status
Logger.debug(TAG, 'status==>' + status)
if (status === PlayerConstants.STATUS_ERROR) {
this.isError = true
this.isLoading = true
this.isCanPlay = false
} else if (status === PlayerConstants.STATUS_COMPLETION) {
// 播放完成
} else {
this.isError = false
}
}
}
this.updateData()
}
updateData() {
// 检测等待中的直播预告是否视频资源
if (this.contentDetailData.liveInfo && this.contentDetailData.liveInfo.previewType === 1
&& this.contentDetailData.liveInfo.previewUrl &&
this.contentDetailData.liveInfo.previewUrl.length > 0) {
// 预告资源是视频
this.isVideoSource = true
this.contentDetailData.showTime = true
}
//直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停
if (this.contentDetailData.liveInfo && this.contentDetailData.liveInfo.previewUrl &&
this.contentDetailData.liveInfo.previewUrl.length > 0) {
this.imgUrl = this.contentDetailData.liveInfo.previewUrl
Logger.debug(TAG, 'ok+' + `${this.imgUrl}`)
this.previewUrl = this.contentDetailData.liveInfo.previewUrl
} else if (this.contentDetailData.fullColumnImgUrls && this.contentDetailData.fullColumnImgUrls.length > 0) {
this.imgUrl = this.contentDetailData.fullColumnImgUrls[0].url
Logger.debug(TAG, 'ok-' + `${this.imgUrl}`)
this.previewUrl = this.contentDetailData.fullColumnImgUrls[0].url
}
Logger.debug(TAG, 'ok+' + `${this.previewUrl}`)
if (this.isVideoSource) {
this.isWait = false
this.isLoading = false
} else {
this.isWait = this.contentDetailData?.liveInfo?.liveState == 'wait'
if(this.isWait )
{
if (this.isWait)
{
this.isLoading = true
}
}
this.isEnd = this.contentDetailData?.liveInfo?.liveState === 'end' &&
StringUtils.isEmpty(this.contentDetailData?.liveInfo?.vlive[0]?.replayUri)
if (!this.isWait && this.contentDetailData.liveInfo && this.contentDetailData.liveInfo.vlive.length > 0) {
...
...
@@ -78,13 +102,19 @@ export struct TopPlayComponent {
} else if (this.contentDetailData.liveInfo.liveState == 'end') {
playUrl = this.contentDetailData.liveInfo.vlive[0].replayUri
}
// this.playerController?.firstPlay('https://rmrbcmsonline.peopleapp.com/upload/rmh/video/mp4/202404/1713752415708fb81d0b8f137b.mp4');
if (this.isVideoSource) {
this.playUrl = this.previewUrl
this.tryToPlay()
} else {
if (StringUtils.isNotEmpty(playUrl)) {
Logger.debug(TAG, `${playUrl}`)
this.playUrl = playUrl
this.tryToPlay()
}
}
}
}
tryToPlay() {
...
...
@@ -115,18 +145,22 @@ export struct TopPlayComponent {
.width('100%')
.visibility(this.isWait ? Visibility.None : Visibility.Visible)
if (this.isVideoSource) {
} else {
// 直播房间图
Image(this.img
Url)
Image(this.preview
Url)
.objectFit(ImageFit.Cover)
.visibility(this.isWait || this.isEnd ? Visibility.Visible : Visibility.None)
.contrast(this.isEnd ? 0.2 : 1)
.width('100%')
}
// loading
PictureLoading().visibility(this.isLoading ? Visibility.None : Visibility.Visible)
// 视频播放器上的控制面板和信息
PlayUIComponent({ playerController: this.playerController, isShowBottom: this.isCanPlay })
PlayUIComponent({ playerController: this.playerController, isShowBottom: this.isCanPlay
, liveUrl: this.playUrl
})
// 直播结束
Text('直播已结束')
...
...
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/vertical/PlayerCommentComponent.ets
View file @
778f7c8
import { Action, ContentDetailDTO, LiveDetailsBean, LiveRoomDataBean, LiveRoomItemBean } from 'wdBean/Index'
import { LiveCommentComponent } from 'wdComponent/Index'
import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment/model/PublishCommentModel'
import {
OperRowListView } from 'wdComponent/src/main/ets/components/view/OperRowListView
'
import {
LiveOperRowListView } from 'wdComponent
'
import PageModel from 'wdComponent/src/main/ets/viewmodel/PageModel'
import { DisplayDirection, SpConstants, ViewType } from 'wdConstant/Index'
import { ContentDetailRequest } from 'wdDetailPlayApi/Index'
...
...
@@ -112,14 +112,19 @@ export struct PlayerCommentComponent {
.margin({ bottom: 20 })
// 收藏、分享、点赞是否需要根据字段显隐
OperRowListView({
Live
OperRowListView({
styleType: 3,
componentType: 4,
pageComponentType: 2, // 竖屏直播页
operationButtonList: ['comment', 'collect', 'share', 'like'],
contentDetailData: this.contentDetailData,
publishCommentModel: this.publishCommentModel,
showCommentIcon: false,
onCommentInputFocus: () => {
},
onCommentInputed: (content) => {
if (content.comment) {
this.liveViewModel.sendComment(content.comment)
}
},
onBack: () => {
WindowModel.shared.setWindowLayoutFullScreen(false)
WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', })
...
...
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/pages/DetailPlayShortVideoPage.ets
View file @
778f7c8
...
...
@@ -16,6 +16,7 @@ import { CommentDialogView } from '../view/CommentDialogView';
import { window } from '@kit.ArkUI';
import { PlayerFullScreenView } from '../view/PlayerFullScreenView';
import { OperRowListView, publishCommentModel } from 'wdComponent/Index';
import { ParamType, TrackConstants } from 'wdTracking/Index';
const TAG = 'DetailPlayShortVideoPage';
...
...
@@ -49,6 +50,10 @@ export struct DetailPlayShortVideoPage {
@Consume showComment: boolean // 是否显示底部评论,首页视频频道传false
@State imageVisible: boolean = true
@State ratio: number = 16 / 9
@State playerWidth: number | string = px2vp(this.windowWidth)
@State playerHeight: number | string = px2vp(this.windowHeight)
pageParam: ParamType = {}
PageName: string = ''
/**
* 页面显示重查用户关注、点赞等信息
...
...
@@ -91,7 +96,8 @@ export struct DetailPlayShortVideoPage {
} else {
this.queryNewsInfoOfUser()
if (!this.playerController.getPlayer()) {
this.playerController.firstPlay(this.contentDetailData?.videoInfo[0]?.videoUrl || '');
this.playerController.firstPlay(this.contentDetailData?.videoInfo[0]?.videoUrl || '', this.PageName,
this.PageName, this.pageParam);
} else {
await this.playerController.play()
this.imageVisible = false
...
...
@@ -165,7 +171,30 @@ export struct DetailPlayShortVideoPage {
}
this.queryNewsInfoOfUser()
this.contentTrackingDict()
}
contentTrackingDict() {
this.pageParam = {
'contentType': `${this.contentDetailData.newsType}`,
'contentId': `${this.contentDetailData.newsId}`,
'contentName': `${this.contentDetailData.newsTitle || ''}`,
}
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 // 动态图文/动态视频
}
console.log('视频详情页', JSON.stringify(this.pageParam))
console.log('视频详情页2', JSON.stringify(this.PageName))
}
async aboutToDisappear(): Promise<void> {
...
...
@@ -174,6 +203,32 @@ export struct DetailPlayShortVideoPage {
await this.playerController?.release();
}
/**
* 屏幕变化动态计算播放器宽高
*/
calculatePlayerRect() {
let width = this.windowWidth
let height = this.windowHeight
if (this.displayDirection === DisplayDirection.VERTICAL) {
width = this.windowWidth
height = this.windowHeight
} else {
width = this.windowHeight
height = this.windowWidth
}
// 视频宽高比屏幕大,则宽度撑满
if (this.ratio > width / height) {
this.playerWidth = '100%'
this.playerHeight = px2vp(width / this.ratio)
} else {
// 否则高度撑满
this.playerHeight = '100%'
this.playerWidth = px2vp(height * this.ratio)
}
console.log('calculatePlayerRect=====', this.windowWidth, this.windowHeight)
}
build() {
Stack({ alignContent: Alignment.Top }) {
Column() {
...
...
@@ -182,7 +237,8 @@ export struct DetailPlayShortVideoPage {
index: $index,
currentIndex: $currentIndex,
showCommentList: $showCommentList,
publishCommentModel: $publishCommentModel
publishCommentModel: $publishCommentModel,
interactData: $interactData,
})
this.playerViewBuilder()
...
...
@@ -224,6 +280,7 @@ export struct DetailPlayShortVideoPage {
}
.height('100%')
.width('100%')
.onAreaChange(() => this.calculatePlayerRect())
}
...
...
@@ -237,9 +294,9 @@ export struct DetailPlayShortVideoPage {
Image(this.contentDetailData?.firstFrameImageUri)
.width('100%')
.height(this.windowWidth / this.ratio + 'px')
.opacity(this.imageVisible ?
1
: 0)
.opacity(this.imageVisible ?
0.8
: 0)
.animation({
duration:
50
0, curve: Curve.EaseInOut
duration:
35
0, curve: Curve.EaseInOut
})
}
...
...
@@ -250,12 +307,13 @@ export struct DetailPlayShortVideoPage {
playerController: this.playerController,
onLoad: async () => {
if (this.contentDetailData != null && this.contentDetailData?.videoInfo[0] != null) {
this.playerController.firstPlay(this.contentDetailData.videoInfo[0].videoUrl);
this.playerController.firstPlay(this.contentDetailData.videoInfo[0].videoUrl, this.PageName, this.PageName,
this.pageParam);
}
}
})
.width(this.displayDirection === DisplayDirection.VERTICAL ? '100%' : this.windowWidth * 16 / 9 + 'px')
.height(this.displayDirection === DisplayDirection.VERTICAL ? this.windowWidth / this.ratio + 'px' : '100%')
.width(this.playerWidth)
.height(this.playerHeight)
this.playerCoverBuilder()
...
...
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/pages/VideoChannelDetail.ets
View file @
778f7c8
...
...
@@ -15,7 +15,7 @@ import { DisplayDirection } from 'wdConstant/Index';
import { window } from '@kit.ArkUI';
import { EmptyComponent, WDViewDefaultType } from 'wdComponent/Index';
import { DateTimeUtils } from 'wdKit/Index';
import {
TrackConstants,
TrackingPageBrowse } from 'wdTracking/Index';
import {
TrackConstants,
TrackingPageBrowse } from 'wdTracking/Index';
interface loadMoreData {
pageNum: number;
...
...
@@ -61,17 +61,17 @@ export struct VideoChannelDetail {
@State totalCount: number = 0
@State isMouted: boolean = false
@State isRequestError: boolean = false
pageShowTime:number = 0;
pageHideTime:number = 0;
@State isRequesting: boolean = false
pageShowTime: number = 0;
pageHideTime: number = 0;
autoRefreshChange() {
if (this.topNavIndex === 0) {
if (this.topNavIndex === 0
&& !this.isRequesting
) {
this.data = []
this.interactDataList = []
this.totalCount = 0
this.isMouted = false
this.getRecCompInfo()
this.getRecCompInfo()
}
}
...
...
@@ -95,8 +95,9 @@ export struct VideoChannelDetail {
console.log(TAG, '一级视频隐藏')
this.pageHideTime = DateTimeUtils.getTimeStamp()
let duration = 0
duration = Math.floor((this.pageHideTime - this.pageShowTime)/1000)
TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Customer_Personal,TrackConstants.PageName.Customer_Personal,duration)
duration = Math.floor((this.pageHideTime - this.pageShowTime) / 1000)
TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Customer_Personal,
TrackConstants.PageName.Customer_Personal, duration)
}
/**
...
...
@@ -187,7 +188,7 @@ export struct VideoChannelDetail {
AlertDialog.show({ message: '没有更多视频了~' })
return
}
this.isRequesting = true
const params: getRecCompInfoParams = {
groupId: this.groupId,
pageId: this.pageId,
...
...
@@ -237,6 +238,7 @@ export struct VideoChannelDetail {
}).catch(() => {
// 获取内容失败请重试
this.isRequestError = true
this.isRequesting = false
})
}
...
...
@@ -251,7 +253,14 @@ export struct VideoChannelDetail {
this.data = this.data.concat(res.data)
}
console.log('根据视频楼层信息批量查询视频列表', JSON.stringify(res.data))
}).finally(() => {
setTimeout(() => {
this.isRequesting = false
}, 2000)
})
} else {
this.isRequesting = false
}
}
...
...
@@ -268,6 +277,7 @@ export struct VideoChannelDetail {
})
}
}
build() {
Column() {
if (this.isRequestError) {
...
...
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/view/CommentDialogView.ets
View file @
778f7c8
import { ContentDetailDTO, PageInfoDTO } from 'wdBean/Index'
import { ContentDetailDTO,
InteractDataDTO,
PageInfoDTO } from 'wdBean/Index'
import { CommentListDialogView, publishCommentModel } from 'wdComponent/Index'
...
...
@@ -9,6 +9,7 @@ export struct CommentDialogView {
@Link currentIndex: number
@Link publishCommentModel: publishCommentModel
@Consume contentDetailData: ContentDetailDTO
@Link interactData: InteractDataDTO
@State fakePageInfo: PageInfoDTO = {} as PageInfoDTO
@State dialogOffsetY: number = 0 // (this.windowHeight - this.windowWidth * 9 / 16)
...
...
@@ -34,6 +35,9 @@ export struct CommentDialogView {
pageInfo: this.fakePageInfo,
onClose: () => {
this.showCommentList = false
if (Number.parseInt(this.publishCommentModel.totalCommentNumer) > Number.parseInt(this.interactData.commentNum + "")) {
this.interactData.commentNum = Number.parseInt(this.publishCommentModel.totalCommentNumer)
}
}
})
}
...
...
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/view/PlayerRightView.ets
View file @
778f7c8
...
...
@@ -38,9 +38,8 @@ export struct PlayerRightView {
@Consume showCommentList: boolean
@Consume displayDirection: DisplayDirection
@Consume publishCommentModel: publishCommentModel
//
@State likesStyle: number | string = 1 // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空
@State likesStyle: number | string = 1 // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空
@State openLikes: boolean = false // 是否可以点赞 1:可以 0:不可以
@State likesStyle: number | string = this.contentDetailData.likesStyle // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空
pageParam: ParamType = {}
PageName: string = ''
followUserId: string = ''
...
...
@@ -387,7 +386,7 @@ export struct PlayerRightView {
.width(32)
.aspectRatio(1)
Text(this.
transNum2String('commentNum') ||
'抢首评')
Text(this.
interactData.commentNum > 0 ? this.transNum2String('commentNum') :
'抢首评')
.width('100%')
.fontWeight(500)
.textAlign(TextAlign.Center)
...
...
sight_harmony/features/wdPlayer/oh-package.json5
View file @
778f7c8
...
...
@@ -8,6 +8,8 @@
"version"
:
"1.0.0"
,
"dependencies"
:
{
"wdKit"
:
"file:../../commons/wdKit"
,
"premierlibrary"
:
"file:./libs/premierlibrary.har"
"premierlibrary"
:
"file:./libs/premierlibrary.har"
,
"wdTracking"
:
"file:../wdTracking"
,
"wdBean"
:
"file:../../features/wdBean"
}
}
...
...
sight_harmony/features/wdPlayer/src/main/ets/controller/WDPlayerController.ets
View file @
778f7c8
...
...
@@ -3,6 +3,9 @@ import prompt from '@ohos.promptAction';
import { Logger } from '../utils/Logger';
import { PlayerConstants, AVPlayerStatus, Events } from '../constants/PlayerConstants';
import { BusinessError } from '@ohos.base';
import { TrackingPlay } from 'wdTracking/Index';
import { ParamType } from 'wdTracking/Index';
import { DateTimeUtils } from 'wdKit/Index';
@Observed
export class WDPlayerController {
...
...
@@ -17,6 +20,12 @@ export class WDPlayerController {
private seekTime: number = 0;
private positionY: number = 0;
private startTime: number = 0;
private pageParam: ParamType = {}
private pageName: string = ''
private creatStartTime:number = 0;//开始加载时间
private creatEndTime:number = 0;//加载完成时间
private prepareTime:number = 0; //加载时间
private currentPlayTime:number = 0; //当前播放时间
public onVideoSizeChange?: (width: number, height: number) => void;
public onTimeUpdate?: (position: number, duration: number) => void;
public onVolumeUpdate?: (volume: number) => void;
...
...
@@ -28,6 +37,9 @@ export class WDPlayerController {
public videoWidth: number = 0
public videoHeight: number = 0
constructor() {
Logger.error("初始化")
this.initPromise = this.createAVPlayer();
...
...
@@ -123,6 +135,8 @@ export class WDPlayerController {
});
this.avPlayer?.on(Events.ERROR, (error) => {
this.playError(error.message);
console.log('播放错误',JSON.stringify(error))
TrackingPlay.videoPlayError(error.message, this.pageName, this.pageName, this.pageParam)
})
this.avPlayer?.on('seekDone', (time: number) => {
this.initProgress(time);
...
...
@@ -148,8 +162,18 @@ export class WDPlayerController {
this.surfaceId = surfaceId
}
async firstPlay(url: string) {
async firstPlay(url: string
,pageId?: string, pageName?: string, pageParam?: ParamType
) {
this.url = url;
//加载时长prepareTime
this.creatStartTime = DateTimeUtils.getTimeStamp()
console.log('开始创建',JSON.stringify(this.creatStartTime))
this.prepareTime = 0
if(pageName){
this.pageName = pageName
}
if(pageParam){
this.pageParam = pageParam
}
if (this.avPlayer == null) {
Logger.error("等待")
await this.initPromise;
...
...
@@ -166,6 +190,11 @@ export class WDPlayerController {
}
Logger.error("开始播放", this.url)
this.avPlayer.url = this.url;
//加载时长prepareTime
this.creatEndTime = DateTimeUtils.getTimeStamp()
this.prepareTime = 0
this.prepareTime = Math.floor((this.creatEndTime - this.creatStartTime)/1000)
console.log('开始播放2',JSON.stringify(this.prepareTime))
}
async release() {
...
...
@@ -271,6 +300,7 @@ export class WDPlayerController {
}
if (mode === SliderChangeMode.End) {
this.seekTime = Math.floor(value * this.duration / 100);
this.currentPlayTime = this.seekTime
this.avPlayer?.seek(this.seekTime);
}
}
...
...
@@ -288,6 +318,7 @@ export class WDPlayerController {
}
initProgress(time: number) {
this.currentPlayTime=Math.floor(time / 1000);
let nowSeconds = Math.floor(time / 1000);
let totalSeconds = Math.floor(this.duration / 1000);
if (this.onTimeUpdate) {
...
...
@@ -357,6 +388,24 @@ export class WDPlayerController {
watchStatus() {
console.log('watchStatus', this.status)
if(this.status == 1){
console.log('播放视频')
console.log('播放视频prepareTime',JSON.stringify(this.prepareTime))
console.log('播放视频pageName',JSON.stringify(this.pageName))
console.log('播放视频pageParam',JSON.stringify(this.pageParam))
// 播放埋点
TrackingPlay.videoPositivePlay(Number(this.prepareTime),this.pageName, this.pageName, this.pageParam)
}
if(this.status == 2){
let initDuration = Math.floor(Number(this.duration)/1000)
console.log('播放结束')
console.log('播放结束currentPlayTime',JSON.stringify(this.currentPlayTime))
console.log('播放结束initDuration',JSON.stringify(initDuration))
console.log('播放结束pageName',JSON.stringify(this.pageName))
console.log('播放结束pageParam',JSON.stringify(this.pageParam))
// 播放结束埋点
TrackingPlay.videoPlayEnd(this.currentPlayTime, initDuration, this.currentPlayTime, this.pageName, this.pageName, this.pageParam)
}
if (this.onStatusChange) {
this.onStatusChange(this.status)
}
...
...
sight_harmony/features/wdPlayer/src/main/ets/pages/WDPlayerRenderLiveView.ets
View file @
778f7c8
...
...
@@ -50,8 +50,6 @@ export struct WDPlayerRenderLiveView {
aboutToAppear() {
MGPlayRenderViewIns.add();
console.log('playerController', this.playerController)
insIndex++;
if (!this.playerController) {
return
...
...
@@ -59,7 +57,6 @@ export struct WDPlayerRenderLiveView {
this.playerController.onVideoSizeChange = (width: number, height: number) => {
// console.log(`WDPlayerRenderView onVideoSizeChange width:${width} videoTop:${height}`)
Logger.info(TAG, ` onVideoSizeChange width:${width} videoTop:${height}`)
this.videoWidth = width;
this.videoHeight = height;
this.updateLayout()
...
...
@@ -83,8 +80,6 @@ export struct WDPlayerRenderLiveView {
.onLoad(async (event) => {
Logger.info(TAG, 'onLoad')
let surfaceId = this.xComponentController.getXComponentSurfaceId()
console.log('surfaceId===', surfaceId)
console.log('insId===', this.insId)
this.xComponentController.setXComponentSurfaceSize({
surfaceWidth: 1920,
surfaceHeight: 720
...
...
sight_harmony/features/wdTracking/src/main/ets/tracking/TrackingPlay.ets
View file @
778f7c8
...
...
@@ -25,7 +25,7 @@ export class TrackingPlay {
Tracking.event("video_positive_pybk", params)
}
// 视频 播放结束
// 视频 播放结束
currentPlayTime:当前时长,totalTime:总时长 ,browseTime:浏览时长,
static videoPlayEnd(currentPlayTime: number, totalTime: number, browseTime: number, pageId: string, pageName: string, extParams: ParamType) {
let params = TrackingUtils.generateParams(extParams)
if (pageId.length) {
...
...
sight_harmony/oh-package.json5
View file @
778f7c8
...
...
@@ -13,7 +13,8 @@
"@ohos/pulltorefresh"
:
"^2.0.5"
,
"@mpaas/udid"
:
"0.0.2"
,
"@mpaas/upgrade"
:
"0.0.2"
,
"@mpaas/framework"
:
"0.0.2"
"@mpaas/framework"
:
"0.0.2"
,
"@ohos/imageknife"
:
"^2.1.2"
},
"dynamicDependencies"
:
{}
}
\ No newline at end of file
...
...
sight_harmony/products/phone/src/main/ets/pages/view/BottomNavigationComponent.ets
View file @
778f7c8
...
...
@@ -7,8 +7,12 @@ import { MinePageComponent } from 'wdComponent/src/main/ets/components/page/Mine
import { CompUtils, TopNavigationComponent, TopNavigationComponentNew } from 'wdComponent/Index';
import { VideoChannelPage } from './VideoChannelPage';
import ChannelViewModel from 'wdComponent/src/main/ets/viewmodel/ChannelViewModel';
import { ImageKnifeComponent, ImageKnifeOption, NONE } from '@ohos/imageknife';
const TAG = 'BottomNavigationComponent';
PersistentStorage.persistProp('channelIds', '');
PersistentStorage.persistProp('indexSettingChannelId', 2002);
let storage = LocalStorage.getShared();
/**
...
...
@@ -131,16 +135,26 @@ export struct BottomNavigationComponent {
@Builder
tabBarBuilder(navItem: BottomNavDTO, index: number) {
Stack({ alignContent: Alignment.Bottom }) {
Image(this.getBottomIcon(navItem, this.currentNavIndex === index))
.height(CommonConstants.FULL_PARENT)
// Image(this.getBottomIcon(navItem, this.currentNavIndex === index))
// .height(CommonConstants.FULL_PARENT)
// .padding({
// bottom: 15,
// left: 10,
// right: 10,
// top: 2
// })
// .aspectRatio(this.ASPECT_RATIO_1_1)
// .alt(this.getBottomLocalIcon(navItem, this.currentNavIndex === index))
ImageKnifeComponent({ imageKnifeOption: this.getBottomImageKnifeOption(navItem, this.currentNavIndex === index) })
.padding({
bottom: 15,
left: 10,
right: 10,
top: 2
})
.aspectRatio(this.ASPECT_RATIO_1_1)
.alt(this.getBottomLocalIcon(navItem, this.currentNavIndex === index))
.width('100%')
.height('100%')
.enabled(false)
Text(navItem.name)
.margin({ bottom: $r('app.float.bottom_navigation_margin_bottom') })
...
...
@@ -154,6 +168,7 @@ export struct BottomNavigationComponent {
.height($r('app.float.bottom_navigation_barHeight'))
.hoverEffect(HoverEffect.Highlight)
.visibility(this.displayDirection === DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None)
// .hitTestBehavior(HitTestMode.Block)
.onClick(() => {
Logger.info(TAG, `onChange, index: ${index}`);
this.onBottomNavigationIndexChange(navItem, index)
...
...
@@ -161,6 +176,24 @@ export struct BottomNavigationComponent {
}
getBottomImageKnifeOption(navItem: BottomNavDTO, isSelect: boolean): ImageKnifeOption {
let defaultIcon = this.getBottomLocalIcon(navItem, isSelect)
let url = this.getBottomIcon(navItem, isSelect)
let imageKnifeOption: ImageKnifeOption = {
loadSrc: url,
// 占位图使用本地资源
placeholderSrc: defaultIcon,
// 失败占位图使用本地资源
errorholderSrc: defaultIcon,
// 是否开启一级内存缓存
isCacheable: true,
// 磁盘缓存none
strategy: new NONE()
};
return imageKnifeOption
}
private getBottomIcon(navItem: BottomNavDTO, isSelect: boolean): string | Resource {
if (!navItem) {
return ''
...
...
@@ -173,10 +206,10 @@ export struct BottomNavigationComponent {
// 获取常规icon
icon = isSelect ? navItem.iconC : navItem.icon
}
if (StringUtils.isEmpty(icon) || icon.includes('.pag')) {
// 兜底,获取预置的本地icon
return this.getBottomLocalIcon(navItem, isSelect)
}
// if (StringUtils.isEmpty(icon) || icon.includes('.pag')) {
// // 兜底,获取预置的本地icon
// return this.getBottomLocalIcon(navItem, isSelect)
// }
return icon
}
...
...
sight_harmony/products/phone/src/main/ets/pages/view/MultiPictureDetailPageComponent.ets
View file @
778f7c8
...
...
@@ -6,7 +6,8 @@ import {
postInteractBrowsOperateParams,
postBatchAttentionStatusParams,
postInteractAccentionOperateParams,
Params
Params,
InteractDataDTO
} from 'wdBean';
import display from '@ohos.display';
import { DateTimeUtils } from 'wdKit/Index';
...
...
@@ -59,6 +60,7 @@ export struct MultiPictureDetailPageComponent {
@State operationButtonList: string[] = ['comment', 'like', 'collect', 'share']
@State currentOffset: number = 0
@State duration: number = 0
@Provide interactData: InteractDataDTO = {} as InteractDataDTO
pageParam: ParamType = {}
followUserId: string = ''
followUserName: string = ''
...
...
@@ -116,7 +118,8 @@ export struct MultiPictureDetailPageComponent {
index: $index,
currentIndex: $currentIndex,
showCommentList: $showCommentList,
publishCommentModel: $publishCommentModel
publishCommentModel: $publishCommentModel,
interactData:$interactData
})
}
...
...
sight_harmony/products/phone/src/main/ets/startupmanager/StartupManager.ets
View file @
778f7c8
...
...
@@ -17,6 +17,7 @@ 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'
const TAG = "[StartupManager]"
...
...
@@ -58,6 +59,14 @@ export class StartupManager {
HostManager.changeHost(spHostUrl as HostEnum)
}
// 初始化全局ImageKnife
ImageKnife.with(this.context);
let imageKnife: ImageKnife | undefined = ImageKnifeGlobal.getInstance().getImageKnife()
if (imageKnife != undefined) {
//设置全局内存缓存大小张数
imageKnife.setLruCacheSize(100, 100 * 1204 * 1024)
}
// 友盟预初始化
this.preInitUmentStat()
...
...
Please
register
or
login
to post a comment