wangliang_wd

Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool into main

* 'main' of http://192.168.1.42/developOne/harmonyPool: (28 commits)
  版本号与Android对齐,用7.3.7.0
  feat:  1)处理直播结束view;2)添加获取拉流地址
  刷新token修改。
  desc:获取消息需要登录
  fix(17802): UI还原问题-【uat】意见反馈-描述您的问题-输入框提示文案颜色未置灰,字体大小偏大,看图
  fix(17808): UI还原问题-【uat】意见反馈-描述您的问题-输入框字数没置灰显示,看图
  fix:bug[18314] 【华为验收】【ux-直板机】【底部导航条适配】点击 我的-预约,进入该页面,该页面底部导航条未沉浸
  feat:  进入横屏多路直播-置空-评论预显示禁止直播间,大家聊不支持下拉刷新
  fix(17809): UI还原问题-【uat】意见反馈-描述您的问题-“期待您留下联系方式,我们将提供更好的服务” 文案字体和大小与android不一致,看图
  feat: 17449 UI还原问题--地方频道下的人民号动态长图无法显示长图信息
  修复视频全屏变形
  ref |> 直播模块增加评论输入框逻辑
  修复视频频道点击接口重复调用
  直播详情页互动组件点赞组件点赞数据++
  直播详情页互动组件点赞组件完善
  漏提
  fix:somebug
  集成图片框架ImageKnife,底导用图片框架加载icon
  一级视频详情页-埋点
  仅wifi下加载图片开关逻辑修改
  ...
Showing 54 changed files with 1510 additions and 213 deletions
... ... @@ -2,8 +2,8 @@
"app": {
"bundleName": "com.peopledailychina.hosactivity",
"vendor": "$string:app_vendor",
"versionCode": 10000,
"versionName": "1.0.0",
"versionCode": 7370,
"versionName": "7.3.7.0",
"icon": "$media:app_icon",
"label": "$string:app_name"
}
... ...
... ... @@ -17,6 +17,14 @@
"value": "13fp"
},
{
"name": "font_size_13_5",
"value": "13.5fp"
},
{
"name": "font_size_13_2",
"value": "13.2fp"
},
{
"name": "font_size_14",
"value": "14fp"
},
... ...
... ... @@ -40,6 +40,9 @@ 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) => {
... ...
... ... @@ -29,10 +29,11 @@ export class HttpBizUtil {
// 403:临时token;406:强制下线、封禁、清空登录信息还要跳转登录页面
if (res.code == 403 || res.code == 406) {
HttpBizUtil.refreshToken().then((token: string) => {
if (headers) {
headers.replace('RMRB-X-TOKEN', token)
headers.replace('cookie', 'RMRB-X-TOKEN=' + token)
if (!headers) {
headers = new HashMap()
}
headers?.replace('RMRB-X-TOKEN', token)
headers?.replace('cookie', 'RMRB-X-TOKEN=' + token)
Logger.debug(TAG, 'get again send: ' + token)
// refreshToken为空场景不处理,直接请求接口。
WDHttp.get<T>(url, headers).then((againResDTO: T) => {
... ... @@ -67,10 +68,11 @@ export class HttpBizUtil {
Logger.debug(TAG, 'post catch error: ' + JSON.stringify(res))
if (res.code == 403 || res.code == 406) {
HttpBizUtil.refreshToken().then((token: string) => {
if (headers) {
headers.replace('RMRB-X-TOKEN', token)
headers.replace('cookie', 'RMRB-X-TOKEN=' + token)
if (!headers) {
headers = new HashMap()
}
headers?.replace('RMRB-X-TOKEN', token)
headers?.replace('cookie', 'RMRB-X-TOKEN=' + token)
Logger.debug(TAG, 'post again send: ' + token)
// refreshToken为空场景不处理,直接请求接口。
WDHttp.post<T>(url, data, headers).then((againResDTO: T) => {
... ...
... ... @@ -32,6 +32,11 @@ export class HttpUrlUtils {
* 详情页面详情接口
*/
static readonly DETAIL_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/content/detail";
/**
* 获取视频直播间拉流地址
*/
static readonly PULL_STREAM_PATH: string = "/api/live-center-video/zh/c/vlive/pull-stream/";
/**
* 批查接口,查询互动相关数据,如收藏数、评论数等
*/
... ... @@ -207,6 +212,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 +231,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 +655,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
... ...
... ... @@ -70,6 +70,8 @@ export { NewspaperTimeItemBean } from './src/main/ets/bean/newspaper/NewspaperTi
export { ContentDetailDTO } from './src/main/ets/bean/detail/ContentDetailDTO';
export { GetPullAddressBean } from './src/main/ets/bean/live/GetPullAddressBean';
export { RmhInfoDTO } from './src/main/ets/bean/detail/RmhInfoDTO';
export { UserInfoDTO } from './src/main/ets/bean/detail/UserInfoDTO';
... ... @@ -122,7 +124,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';
... ...
... ... @@ -19,4 +19,9 @@ export interface RmhInfoDTO {
userId: string;
userType: string;
honoraryIcon:string;
/**
* 发布标识,0-cms;1-表示号主发布
*/
rmhPlatform:number
}
... ...
/**
* 获取拉流地址解析类
*/
export class GetPullAddressBean {
origin: OriginBean = new OriginBean();
transCode: Array<TransCodeBean> = new Array;
}
class OriginBean {
expireTime: number = -1;
definition: string = '';
flvUrl: string = '';
m3u8Url: string = '';
rtmpUrl: string = '';
rtsUrl: string = '';
}
export class TransCodeBean {
expireTime: number = -1;
definition: string = '';
flvUrl: string = '';
m3u8Url: string = '';
rtmpUrl: string = '';
rtsUrl: string = '';
}
\ No newline at end of file
... ...
... ... @@ -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
... ...
... ... @@ -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';
... ...
... ... @@ -97,6 +97,10 @@ export struct FeedBackActivity {
TextArea({ placeholder: $r('app.string.feedback_comments') })
.width(CommonConstants.FULL_WIDTH)
.height(CommonConstants.FULL_HEIGHT)
.fontColor($r('app.color.color_222222'))
.fontSize($r('app.float.font_size_13_2'))
.placeholderColor($r('app.color.color_CCCCCC'))
.placeholderFont({size:$r('app.float.font_size_13_2')})
.padding({bottom:96})
.backgroundColor($r('app.color.color_F5F5F5'))
.align(Alignment.TopStart)
... ... @@ -170,6 +174,8 @@ export struct FeedBackActivity {
.margin({bottom: $r('app.float.vp_12'), right: $r('app.float.vp_12'),left: $r('app.float.vp_12')})
Text(this.textNumLabel)
.margin({bottom: $r('app.float.vp_12'), right: $r('app.float.vp_11')})
.fontColor($r('app.color.color_999999'))
.fontSize($r('app.float.font_size_13_5'))
}
.height(200)
.width('94%')
... ... @@ -182,7 +188,7 @@ export struct FeedBackActivity {
Text($r('app.string.feedback_email'))
.fontColor($r('app.color.color_222222'))
.fontSize($r('app.float.font_size_14'))
.fontSize($r('app.float.font_size_13_2'))
.width('94%')
.margin({ top: $r('app.float.margin_24') })
Row() {
... ... @@ -232,6 +238,7 @@ export struct FeedBackActivity {
}
}.margin({bottom:20})
}
.backgroundColor($r('app.color.color_fff'))
}
/**
... ...
... ... @@ -103,11 +103,14 @@ interface radiusType {
bottomRight: number | Resource;
}
interface picProps {
width: number,
height: number
}
@Component
struct createImg {
@Prop fullColumnImgUrls: FullColumnImgUrlDTO[]
@State picWidth: number = 0;
@State picHeight: number = 0;
@State loadImg: boolean = false;
async aboutToAppear(): Promise<void> {
... ... @@ -143,11 +146,11 @@ struct createImg {
return radius
}
getPicType(){
if (this.picWidth && this.picHeight) {
if (this.picWidth / this.picHeight > 2/1) {
getPicType(picWidth: number, picHeight: number) {
if (picWidth && picHeight) {
if (picWidth / picHeight > 2/1) {
return 1; //横长图
} else if ( this.picWidth/this.picHeight < 1/2) {
} else if (picWidth/picHeight < 1/2) {
return 2; //竖长图
} else {
return 3
... ... @@ -163,21 +166,21 @@ struct createImg {
}) {
ForEach(this.fullColumnImgUrls, (item: FullColumnImgUrlDTO, index: number) => {
if (this.fullColumnImgUrls.length === 1) {
if (this.getPicType() !== 3) {
if (this.getPicType(item.weight, item.height) !== 3) {
GridCol({
span: this.getPicType() === 1 ? 12 : 8
span: this.getPicType(item.weight, item.height) === 1 ? 12 : 8
}){
Stack({
alignContent: Alignment.BottomEnd
}) {
if (this.getPicType() === 1) {
if (this.getPicType(item.weight, item.height) === 1) {
Image(this.loadImg ? item.fullUrl || item.url : '')
.backgroundColor(0xf5f5f5)
.width('100%')
.height(172)
.autoResize(true)
.borderRadius(this.caclImageRadius(index))
} else if (this.getPicType() === 2) {
} else if (this.getPicType(item.weight, item.height) === 2) {
Image(this.loadImg ? item.fullUrl || item.url : '')
.width('100%')
.height(305)
... ... @@ -200,6 +203,10 @@ struct createImg {
})
.fontColor(0xffffff)
.fontFamily('PingFang SC')
.visibility(
item.weight / item.height > 2 / 1 || item.weight / item.height < 1 / 2
? Visibility.Visible : Visibility.None
)
}
.width(48)
.padding({bottom: 9})
... ... @@ -215,11 +222,7 @@ struct createImg {
.width('100%')
.autoResize(true)
.borderRadius(this.caclImageRadius(index))
.opacity(!this.picWidth && !this.picHeight ? 0 : 1)
.onComplete(callback => {
this.picWidth = callback?.width || 0;
this.picHeight = callback?.height || 0;
})
.opacity(!item.weight && !item.height ? 0 : 1)
}
}
} else if (this.fullColumnImgUrls.length === 4) {
... ... @@ -231,11 +234,7 @@ struct createImg {
.backgroundColor(0xf5f5f5)
.aspectRatio(1)
.borderRadius(this.caclImageRadius(index))
.onComplete(callback => {
this.picWidth = callback?.width || 0;
this.picHeight = callback?.height || 0;
})
if(this.getPicType() !== 3){
if(this.getPicType(item.weight, item.height) !== 3){
Flex({ direction: FlexDirection.Row }) {
Image($r('app.media.icon_long_pic'))
.width(12)
... ... @@ -252,6 +251,10 @@ struct createImg {
})
.fontColor(0xffffff)
.fontFamily('PingFang SC')
.visibility(
item.weight / item.height > 2 / 1 || item.weight / item.height < 1 / 2
? Visibility.Visible : Visibility.None
)
}
.width(48)
.align(Alignment.BottomEnd)
... ... @@ -268,11 +271,7 @@ struct createImg {
.backgroundColor(0xf5f5f5)
.aspectRatio(1)
.borderRadius(this.caclImageRadius(index))
.onComplete(callback => {
this.picWidth = callback?.width || 0;
this.picHeight = callback?.height || 0;
})
if (this.getPicType() !== 3) {
if (this.getPicType(item.weight, item.height) !== 3) {
Flex({ direction: FlexDirection.Row }) {
Image($r('app.media.icon_long_pic'))
.width(12)
... ... @@ -289,6 +288,10 @@ struct createImg {
})
.fontColor(0xffffff)
.fontFamily('PingFang SC')
.visibility(
item.weight / item.height > 2 / 1 || item.weight / item.height < 1 / 2
? Visibility.Visible : Visibility.None
)
}
.width(48)
.align(Alignment.BottomEnd)
... ...
... ... @@ -61,13 +61,13 @@ export struct Card2Component {
// }
// }
if(this.contentDTO.objectType == '5'){
Notes({ objectType: this.contentDTO.objectType }).height(20).align(Alignment.Center)
Notes({ objectType: this.contentDTO.objectType }).height(29).align(Alignment.Center)
} else {
if (this.contentDTO.seoTags) {
Notes({ newTags: this.contentDTO.seoTags }).height(20).align(Alignment.Center)
Notes({ newTags: this.contentDTO.seoTags }).height(29).align(Alignment.Center)
}
if (this.contentDTO.newTags) {
Notes({ newTags: this.contentDTO.newTags }).height(20).align(Alignment.Center)
Notes({ newTags: this.contentDTO.newTags }).height(29).align(Alignment.Center)
}
}
//新闻标题
... ...
... ... @@ -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(20).align(Alignment.Center)
Notes({ objectType: this.contentDTO.objectType }).height(29).align(Alignment.Center)
} else {
if (this.contentDTO.seoTags) {
Notes({ newTags: this.contentDTO.seoTags }).height(20).align(Alignment.Center)
Notes({ newTags: this.contentDTO.seoTags }).height(29).align(Alignment.Center)
}
if (this.contentDTO.newTags) {
Notes({ newTags: this.contentDTO.newTags }).height(20).align(Alignment.Center)
Notes({ newTags: this.contentDTO.newTags }).height(29).align(Alignment.Center)
}
}
Text() {
... ...
... ... @@ -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)
... ...
... ... @@ -38,8 +38,12 @@ export struct CommentListDialogView {
}
closeAction() {
if (this.onClose) {
this.onClose()
} else {
this.showCommentList = false
}
}
build() {
}
... ...
... ... @@ -58,6 +58,12 @@ export struct AppointmentListUI {
}
}
} else {
Stack(){
Row()
.width("100%")
.height("100%")
.backgroundColor($r('app.color.color_F9F9F9'))
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
CustomPullToRefresh({
alldata:this.data,
scroller:this.scroller,
... ... @@ -84,7 +90,8 @@ export struct AppointmentListUI {
})
}
}
.backgroundColor($r('app.color.color_F9F9F9'))
}
.backgroundColor($r('app.color.color_transparent'))
.height('100%')
.width('100%')
}
... ...
... ... @@ -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 indexSettingTabIndex: number = 0
@State indexSettingChannelId: 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)
})
})
... ...
... ... @@ -61,13 +61,17 @@ export struct MinePageComponent {
@Prop isMinePage:boolean = false;
//第一次还没创建时候 pageShow 接收不到监听
pageShowForUpdateData(): void {
async pageShowForUpdateData() {
if(this.isMinePage){
let userid = await SPHelper.default.get(SpConstants.USER_ID,"")
if(StringUtils.isNotEmpty(userid)){
this.getMessageData()
}
this.pageShowTime = DateTimeUtils.getTimeStamp()
}
}
pageHideForUpdateData(): void {
pageHideForUpdateData(){
if(this.isMinePage){
this.pageHideTime = DateTimeUtils.getTimeStamp()
let duration = 0
... ... @@ -83,10 +87,9 @@ export struct MinePageComponent {
aboutToAppear(){
this.pageFirstCreateTime = DateTimeUtils.getTimeStamp()
this.getUserLogin()
this.getFunctionData()
this.getUserLogin()
this.addLoginStatusObserver()
this.getMessageData()
}
getMessageData(){
... ... @@ -177,6 +180,7 @@ export struct MinePageComponent {
let userid = await SPHelper.default.get(SpConstants.USER_ID,"")
if(StringUtils.isNotEmpty(userid)){
this.isLogin = true
this.getMessageData()
}else{
this.isLogin = false
}
... ...
... ... @@ -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[] = []
@StorageProp('indexSettingChannelId') indexSettingChannelId: number = 2002
@State indexSettingChannelId: number = AppStorage.get<number>('indexSettingChannelId') || 2002
//我的频道id列表
@State channelIds: number[] = []
//本地缓存频道id列表
@StorageProp('channelIds') storageChannelIds: string = ''
@State 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}`);
... ...
... ... @@ -466,7 +466,8 @@ export struct SearchResultContentComponent {
rmhDesc: obj.introduction,
userId: obj.userId,
userType: obj.userType,
honoraryIcon:''
honoraryIcon:'',
rmhPlatform:0
}
if(rem.length>0){
rem.forEach(item=>{
... ... @@ -491,7 +492,8 @@ export struct SearchResultContentComponent {
rmhDesc: item.introduction,
userId: item.userId,
userType: item.userType,
honoraryIcon:''
honoraryIcon:'',
rmhPlatform:0
}
}
})
... ...
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
... ...
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
... ...
... ... @@ -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_14'))
.fontSize($r('app.float.font_size_13'))
.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_14'))
.fontSize($r('app.float.font_size_13'))
.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_17'))
.fontSize($r('app.float.font_size_16'))
.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_14'))
.fontSize($r('app.float.font_size_13'))
.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_14'))
.fontSize($r('app.float.font_size_13'))
.fontColor($r('app.color.color_999999'))
.lineHeight(25)
.margin({
... ...
... ... @@ -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
}
... ... @@ -883,7 +883,8 @@ class MinePageDatasModel{
rmhDesc: obj.introduction,
userId: obj.userId,
userType: obj.userType,
honoraryIcon:''
honoraryIcon:'',
rmhPlatform:0
}
if(rem.length>0){
rem.forEach(item=>{
... ... @@ -908,7 +909,8 @@ class MinePageDatasModel{
rmhDesc: item.introduction,
userId: item.userId,
userType: item.userType,
honoraryIcon:''
honoraryIcon:'',
rmhPlatform:0
}
}
})
... ...
... ... @@ -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)
}
}
... ...
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
... ...
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"}]
... ...
... ... @@ -17,6 +17,14 @@
"value": "13fp"
},
{
"name": "font_size_13_2",
"value": "13.2fp"
},
{
"name": "font_size_13_5",
"value": "13.5fp"
},
{
"name": "font_size_14",
"value": "14fp"
},
... ...
import { Logger, ResourcesUtils, EmitterUtils, EmitterEventId } from 'wdKit';
import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork';
import { ContentDetailDTO, InteractDataDTO } from 'wdBean';
import { ContentDetailDTO, GetPullAddressBean, InteractDataDTO } from 'wdBean';
import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest';
const TAG = 'ContentDetailRequest';
... ... @@ -208,6 +208,19 @@ export class ContentDetailRequest {
return url;
}
static getLiveRoomPullStreamUrl(vliveId:string){
let url = HttpUrlUtils.getHost() + HttpUrlUtils.PULL_STREAM_PATH
url = url + vliveId
return url;
}
static getLiveRoomPullStream(vliveId: string): Promise<ResponseDTO<GetPullAddressBean>> {
let url = ContentDetailRequest.getLiveRoomPullStreamUrl(vliveId)
return WDHttp.get<ResponseDTO<GetPullAddressBean>>(url)
}
static getContentDetail(params: ContentDetailRequestParams): Promise<ResponseDTO<ContentDetailDTO[]>> {
if (mock_switch) {
return ContentDetailRequest.getContentDetailDataMock(getContext());
... ... @@ -216,6 +229,8 @@ export class ContentDetailRequest {
return WDHttp.get<ResponseDTO<ContentDetailDTO[]>>(url)
}
/**
* 查询沉浸式视频频道推荐楼层数据
* @returns
... ...
import { Action, ContentDetailDTO } from 'wdBean/Index';
import { Action, ContentDetailDTO, GetPullAddressBean } from 'wdBean/Index';
import { LiveViewModel } from '../viewModel/LiveViewModel';
import router from '@ohos.router';
... ... @@ -71,7 +71,6 @@ export struct DetailPlayLiveCommon {
.then((data: Array<ContentDetailDTO>) => {
console.log(TAG, '查询视频详情用于评论展示 getContentDetail:', JSON.stringify(data))
if (data) {
let detailData = data[0]
this.liveLandscape =
detailData?.liveInfo?.liveLandScape //String(this.contentDetailData?.liveInfo?.liveLandScape || '')
... ... @@ -79,14 +78,7 @@ export struct DetailPlayLiveCommon {
this.liveState = detailData.liveInfo?.liveState
if (this.liveState === 'wait' || this.liveLandscape === 'news') {
this.contentDetailData = data[0]
} else if (this.liveLandscape === 'general') {
//todo 不加setTimeOut ,接口返回的数据 就没法让PlayerComponent #@Consume @Watch('updateData') liveDetailsBean 的updateData方法运行
setTimeout(() => {
this.contentDetailData = data[0]
}, 10)
}
console.log(TAG, '查询视频详情用于评论展示 openComment:', detailData.openComment)
this.publishCommentModel.targetId = String(detailData?.newsId || '')
... ... @@ -107,7 +99,20 @@ export struct DetailPlayLiveCommon {
if (detailData.liveInfo.liveState == 'end') {
this.playUrl = detailData.liveInfo.vlive[0].replayUri
}
//console.error('XXXXZZZZ', "liveLandscape =" + this.liveLandscape + ' this.liveState =' + this.liveState)
//人民号类型单独获取直播地址
if (detailData.rmhPlatform === 1) {
let vliveId = detailData.liveInfo.vlive[0].vliveId as string
console.error(TAG, 'vliveId==' + vliveId)
this.liveViewModel.getLiveRoomPullAddress(vliveId)
.then((data: GetPullAddressBean) => {
console.log(TAG, ' GetPullAddressBean:', JSON.stringify(data))
})
}
}
})
}
... ...
... ... @@ -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,19 +69,22 @@ 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)
// LiveCommentComponent({ heartNum: this.liveRoomDataBean.likeNum })
// .visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None)
}
... ...
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
... ...
import { ContentDetailDTO, LiveDetailsBean, LiveRoomBean, LiveRoomDataBean } from 'wdBean/Index'
import { ContentDetailDTO,
GetPullAddressBean,
LiveDetailsBean, LiveRoomBean, LiveRoomDataBean, ValueType } from 'wdBean/Index'
import { ContentDetailRequest } from 'wdDetailPlayApi/Index'
import { ResponseDTO } from 'wdNetwork/Index'
import { LiveModel } from './LiveModel'
... ... @@ -24,6 +27,28 @@ export class LiveViewModel {
}
getLiveRoomPullAddress(vliveId:string){
// return new Promise<GetPullAddressBean>((success, fail) => {
// this.liveModel.getContentDetail(contentId, relId, relType).then((data) => {
// success(data)
// }).catch((message: string) => {
// fail(message)
// })
// })
return new Promise<GetPullAddressBean>((success, fail) => {
ContentDetailRequest.getLiveRoomPullStream(vliveId).then(async (resDTO: ResponseDTO<GetPullAddressBean>) => {
console.log(TAG, 'getContentDetail:', JSON.stringify(resDTO.data))
if (resDTO.data) {
success(resDTO.data)
}
}).catch(() => {
fail("数据为空")
})
})
}
//直播详情
getLiveDetails(contentId: string, relId: string, relType: string) {
... ... @@ -68,6 +93,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 +135,8 @@ export class LiveViewModel {
})
})
}
sendComment(comment: string) {
}
}
\ No newline at end of file
... ...
... ... @@ -12,6 +12,10 @@ import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment
const TAG: string = 'TabChatComponent';
/**
*
* 非沉浸式---大家聊
*/
@Component
export struct TabChatComponent {
@State private pageModel: PageModel = new PageModel()
... ...
... ... @@ -13,11 +13,9 @@ export struct TabComponent {
@State currentIndex: number = 0
private controller: TabsController = new TabsController()
@Prop tabs: string[] = []
aboutToAppear(): void {
}
/**
* 评论切换到大家聊
*/
... ...
import { ContentDetailDTO, LiveDetailsBean } from 'wdBean/Index'
import { LiveCountdownComponent } from './LiveCountdownComponent'
/**
* 非沉浸式---简介
*/
@Component
export struct TabInfoComponent {
@Consume contentDetailData: ContentDetailDTO
... ...
import { ContentDetailDTO, LiveDetailsBean, LiveRoomItemBean } from 'wdBean/Index'
import { EmptyComponent, ErrorComponent, ListHasNoMoreDataUI, WDViewDefaultType } from 'wdComponent/Index'
import { ContentDetailDTO, LiveRoomItemBean } from 'wdBean/Index'
import { CustomPullToRefresh, EmptyComponent, ErrorComponent, WDViewDefaultType } from 'wdComponent/Index'
import { TabLiveItemComponent } from './TabLiveItemComponent'
import CustomRefreshLoadLayout from 'wdComponent/src/main/ets/components/page/CustomRefreshLoadLayout'
import { RefreshLayoutBean } from 'wdComponent/src/main/ets/components/page/RefreshLayoutBean'
import PageModel from 'wdComponent/src/main/ets/viewmodel/PageModel'
import { ViewType } from 'wdConstant/Index'
import RefreshLayout from 'wdComponent/src/main/ets/components/page/RefreshLayout'
import { StringUtils } from 'wdKit/Index'
import { LazyDataSource, StringUtils } from 'wdKit/Index'
import { LiveViewModel } from '../../viewModel/LiveViewModel'
import { Logger } from 'wdKit'
import LoadMoreLayout from 'wdComponent/src/main/ets/components/page/LoadMoreLayout'
import { PeopleShipNoMoreData } from 'wdComponent/src/main/ets/components/reusable/PeopleShipNoMoreData'
const TAG: string = 'TabLiveComponent';
... ... @@ -18,9 +19,10 @@ const TAG: string = 'TabLiveComponent';
@Component
export struct TabLiveComponent {
liveViewModel: LiveViewModel = new LiveViewModel()
@State liveList: Array<LiveRoomItemBean> = []
@State liveList: LazyDataSource<LiveRoomItemBean> = new LazyDataSource();
@Consume @Watch('updateData') contentDetailData: ContentDetailDTO
@State private pageModel: PageModel = new PageModel()
private scroller: Scroller = new Scroller()
aboutToAppear(): void {
this.getLiveList()
... ... @@ -35,7 +37,19 @@ export struct TabLiveComponent {
} else if (this.pageModel.viewType == ViewType.EMPTY) {
EmptyComponent({ emptyType: WDViewDefaultType.WDViewDefaultType_NoContent1 })
} else {
CustomPullToRefresh({
alldata: this.liveList,
scroller: this.scroller,
hasMore: false,
customList: () => {
this.ListLayout()
},
onRefresh: (resolve) => {
this.pageModel.currentPage = 1
this.getLiveList(resolve)
},
})
}
}
.alignContent(Alignment.Top)
... ... @@ -46,32 +60,35 @@ export struct TabLiveComponent {
@Builder
ListLayout() {
List() {
ListItem() {
// 下拉刷新 TODO 待对接新的下拉刷新组件
// RefreshLayout({
// refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullDown, this.pageModel.pullDownRefreshImage,
// this.pageModel.pullDownRefreshText, this.pageModel.pullDownRefreshHeight)
// })
}
ForEach(this.liveList, (item: LiveRoomItemBean) => {
List({ scroller: this.scroller }) {
// 下拉刷新
LazyForEach(this.liveList, (item: LiveRoomItemBean, index: number) => {
ListItem() {
TabLiveItemComponent({ item: item })
}
})
},
(item: LiveRoomItemBean, contentIndex: number) => JSON.stringify(item)
)
// 加载更多
ListItem() {
if (this.pageModel.hasMore) {
// LoadMoreLayout({
// refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullUpLoad, this.pageModel.pullUpLoadImage,
// this.pageModel.pullUpLoadText, this.pageModel.pullUpLoadHeight)
// })
} else {
ListHasNoMoreDataUI()
if (this.pageModel.hasMore && this.liveList && this.liveList.totalCount() > 0) {
LoadMoreLayout({ isVisible: this.pageModel.hasMore })
} else if (!this.pageModel.hasMore && !this.pageModel.isLoading) {
PeopleShipNoMoreData()
}
}
}
.edgeEffect(EdgeEffect.None)
.scrollBar(BarState.Off)
.onReachEnd(() => {
Logger.debug(TAG, "触底了");
if (!this.pageModel.isLoading && this.pageModel.hasMore) {
//加载分页数据
//this.currentPage++;
this.getLiveList()
}
})
}
@Builder
... ... @@ -82,19 +99,35 @@ export struct TabLiveComponent {
})
}
getLiveList() {
async getLiveList(resolve?: (value: string | PromiseLike<string>) => void) {
if (!this.contentDetailData || !this.contentDetailData.newsId) {
// 参数不够,直接拦截接口
return
}
if (this.pageModel.isLoading) {
if (resolve) {
resolve('已更新至最新')
}
return
}
this.pageModel.isLoading = true
this.pageModel.currentPage = 1
this.liveViewModel.getLiveList(
this.pageModel.currentPage,
this.contentDetailData?.liveInfo?.mlive?.mliveId,
this.contentDetailData?.newsId+'',
this.contentDetailData?.newsId + '',
20)
.then(
(data) => {
this.pageModel.isLoading = false
if (resolve) {
if (this.pageModel.currentPage == 1) {
resolve('已更新至最新')
} else {
resolve('')
}
}
Logger.debug(TAG, '直播间数据:' + `${JSON.stringify(data)}`)
if (data.barrageResponses && data.barrageResponses.length > 0) {
/**
... ... @@ -106,6 +139,10 @@ export struct TabLiveComponent {
3.内容:详情接口的简介,newIntroduction
*/
this.pageModel.viewType = ViewType.LOADED;
if(this.pageModel.currentPage ===1){
this.liveList.clear()
}
this.liveList.push(...data.barrageResponses)
if (data.barrageResponses.length === this.pageModel.pageSize) {
this.pageModel.currentPage++;
... ... @@ -124,9 +161,11 @@ export struct TabLiveComponent {
&& this.contentDetailData.liveInfo.liveState != 'wait') {
this.pageModel.viewType = ViewType.LOADED;
this.updateLiveListData()
this.pageModel.hasMore = false;
} else {
this.pageModel.viewType = ViewType.EMPTY;
}
}
},
() => {
... ... @@ -155,7 +194,7 @@ export struct TabLiveComponent {
}
updateData() {
if (this.liveList.length > 0) {
if (this.liveList.totalCount() > 0) {
// TODO 拦截刷新?根据业务斟酌下
return
}
... ...
... ... @@ -52,7 +52,6 @@ export struct TopPlayComponent {
} else if (status === PlayerConstants.STATUS_COMPLETION) {
// 播放完成
} else {
this.isError = false
}
... ... @@ -63,7 +62,6 @@ export struct TopPlayComponent {
}
updateData() {
// 检测等待中的直播预告是否视频资源
if (this.contentDetailData.liveInfo && this.contentDetailData.liveInfo.previewType === 1
&& this.contentDetailData.liveInfo.previewUrl &&
... ...
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({
LiveOperRowListView({
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', })
... ...
... ... @@ -28,7 +28,10 @@ export struct PlayerComponent {
this.playerController?.pause()
}
aboutToAppear(): void {
async aboutToAppear(): Promise<void> {
setTimeout(() => {
this.updateData()
}, 10)
}
async aboutToDisappear(): Promise<void> {
... ... @@ -36,6 +39,7 @@ export struct PlayerComponent {
await this.playerController?.pause()
await this.playerController?.stop()
await this.playerController?.release()
}
updateData() {
... ... @@ -58,6 +62,7 @@ export struct PlayerComponent {
this.liveStreamType = liveStreamType
this.playUrl = playUrl
}
console.error("XXXXZZZZ", 'updateData ----liveState==>' + this.playUrl)
}
build() {
... ... @@ -69,6 +74,7 @@ export struct PlayerComponent {
playerController: this.playerController,
onLoad: () => {
this.isCanplay = true
console.error("XXXXZZZZ", '------2------------')
this.playerController?.firstPlay(this.playUrl);
}
})
... ... @@ -77,7 +83,7 @@ export struct PlayerComponent {
playerController: this.playerController,
onLoad: () => {
this.isCanplay = true
console.error('WDAliPlayerController', '------1------------')
console.error('XXXXZZZZ', '------1------------')
this.playerController?.firstPlay(this.playUrl);
}
}).margin({ top: 195 }).height(211)
... ...
... ... @@ -4,6 +4,7 @@ import { SpConstants } from 'wdConstant/Index'
import { ContentDetailRequest, postInteractAccentionOperateParams } from 'wdDetailPlayApi/Index'
import { NumberFormatterUtils, DateTimeUtils, SPHelper } from 'wdKit/Index'
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'
import { router } from '@kit.ArkUI'
const TAG = 'PlayerEndView'
... ... @@ -15,9 +16,12 @@ export struct PlayerEndView {
@Consume liveRoomDataBean: LiveRoomDataBean
@State duration: string = ''
@State followStatus: String = '0';
private onBack: () => void = () => {
}
aboutToAppear(): void {
const sn = DateTimeUtils.parseDate(this.contentDetailData.liveInfo.startTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)
const sn =
DateTimeUtils.parseDate(this.contentDetailData.liveInfo.startTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)
const en = DateTimeUtils.parseDate(this.contentDetailData.liveInfo.endTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)
const sd = DateTimeUtils.getDuration(sn, en)
this.duration = DateTimeUtils.secondToTime(sd / 1000)
... ... @@ -113,7 +117,12 @@ export struct PlayerEndView {
.fontWeight(400)
.fontSize(16)
.fontColor(Color.White)
.padding({ top: 8, bottom: 8, left: 122, right: 122 })
.padding({
top: 8,
bottom: 8,
left: 122,
right: 122
})
.backgroundColor(this.followStatus == '0' ? '#FFED2800' : Color.Grey)
.borderRadius(4)
.onClick(() => {
... ... @@ -140,8 +149,30 @@ export struct PlayerEndView {
}
.width(307)
.padding({ top: 40 })
Blank()
// 返回按钮
Row() {
Image($r('app.media.icon_arrow_left_white'))
.width(24)
.height(24)
.aspectRatio(1)
.interpolation(ImageInterpolation.High)
.hoverEffect(HoverEffect.Scale)
.margin({ bottom: 30 ,left:14})
.onClick(() => {
if (this.onBack) {
this.onBack()
}
router.back();
})
}.width('100%')
}
.height('100%')
.width('100%')
}
}
\ No newline at end of file
... ...
... ... @@ -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: 500, curve: Curve.EaseInOut
duration: 350, 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()
... ...
... ... @@ -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) {
... ...
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)
}
}
})
}
... ...
... ... @@ -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)
... ...
... ... @@ -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"
}
}
... ...
... ... @@ -7,12 +7,13 @@ import {
paused,
stopped,
completion,
error} from 'premierlibrary/src/main/ets/com/aliyun/player/IPlayer';
error
} from 'premierlibrary/src/main/ets/com/aliyun/player/IPlayer';
import { initGlobalPlayerSettings, setupPlayerConfig } from '../utils/GlobalSetting';
import prompt from '@ohos.promptAction';
import { PlayerConstants, AVPlayerStatus, Events } from '../constants/PlayerConstants';
import { Logger } from 'wdKit/Index';
import { Logger, StringUtils } from 'wdKit/Index';
const TAG = "WDAliPlayerController"
... ... @@ -26,7 +27,6 @@ const TAG = "WDAliPlayerController"
export class WDAliPlayerController {
private initPromise: Promise<void>;
private avPlayer?: AliPlayer;
// 内部播放器状态
private avPlayerStatus: number = idle
private duration: number = 0;
... ... @@ -38,18 +38,14 @@ export class WDAliPlayerController {
private seekTime: number = 0;
private positionY: number = 0;
private startTime: number = 0
public errorCode?: number
public errorMesage?: string
public onVideoSizeChange?: (width: number, height: number) => void;
public onBufferUpdate?: (buffered: number, duration: number) => void;
public onTimeUpdate?: (position: number, duration: number) => void;
public onVolumeUpdate?: (volume: number) => void;
// 播放完成,决定是否继续播放回调
public continue?: () => void;
// 准备完成,决定是否播放回调。如果不实现,则自动播放
public onCanplay?: () => void;
public onStatusChange?: (status: number) => void;
... ... @@ -117,12 +113,12 @@ export class WDAliPlayerController {
onInfo: (bean: InfoBean) => {
if (bean.getCode() === InfoCode.CurrentPosition) {
let position : number = bean.getExtraValue()
let position: number = bean.getExtraValue()
Logger.debug(TAG, `播放进度条:${position}/ ${this.duration}`)
this.initProgress(position);
} else if (bean.getCode() === InfoCode.BufferedPosition) {
let buffer : number = bean.getExtraValue()
let buffer: number = bean.getExtraValue()
if (this.onBufferUpdate) {
this.onBufferUpdate(buffer, this.duration)
}
... ... @@ -140,7 +136,8 @@ export class WDAliPlayerController {
switch (status) {
case initalized: {
//this.avPlayer?.prepare();
} break
}
break
case prepared: {
if (this.startTime) {
this.setSeekTime(this.startTime, SliderChangeMode.Begin);
... ... @@ -154,20 +151,24 @@ export class WDAliPlayerController {
} else {
this.play()
}
} break
}
break
case started: {
this.setBright();
this.status = PlayerConstants.STATUS_START;
this.watchStatus();
} break
}
break
case paused: {
this.status = PlayerConstants.STATUS_PAUSE;
this.watchStatus();
} break
}
break
case stopped: {
this.status = PlayerConstants.STATUS_STOP;
this.watchStatus();
} break
}
break
case completion: {
this.status = PlayerConstants.STATUS_COMPLETION;
this.watchStatus();
... ... @@ -179,7 +180,8 @@ export class WDAliPlayerController {
//this.url = this.avPlayer.url || '';
//this.avPlayer.reset();
}
} break
}
break
case error: {
// 这里拿不到错误信息
// this.status = PlayerConstants.STATUS_ERROR;
... ... @@ -189,7 +191,7 @@ export class WDAliPlayerController {
}
});
this.avPlayer?.setOnErrorListener({
onError:(errorInfo) => {
onError: (errorInfo) => {
Logger.error(TAG, "播放错误", JSON.stringify(errorInfo))
this.errorCode = errorInfo.getCode()
this.errorMesage = errorInfo.getMsg()
... ... @@ -220,21 +222,29 @@ export class WDAliPlayerController {
}
private setAliPlayerURL(url: string) {
let urlSource : UrlSource = new UrlSource()
let urlSource: UrlSource = new UrlSource()
urlSource.setUri(url)
this.avPlayer?.setUrlDataSource(urlSource)
}
private getStatusStringWith(status: number) : string {
private getStatusStringWith(status: number): string {
switch (status) {
case idle: return 'idle'
case initalized: return 'initalized'
case prepared: return 'prepared'
case started: return 'started'
case paused: return 'paused'
case stopped: return 'stopped'
case completion: return 'completion'
case error: return 'error'
case idle:
return 'idle'
case initalized:
return 'initalized'
case prepared:
return 'prepared'
case started:
return 'started'
case paused:
return 'paused'
case stopped:
return 'stopped'
case completion:
return 'completion'
case error:
return 'error'
}
return 'unknow'
}
... ... @@ -256,6 +266,10 @@ export class WDAliPlayerController {
}
async firstPlay(url: string) {
if (StringUtils.isEmpty(url)) {
return
}
this.url = url;
if (this.avPlayer == null) {
Logger.info(TAG, "等待播放器初始化")
... ... @@ -278,7 +292,7 @@ export class WDAliPlayerController {
this.avPlayer?.setAutoPlay(false)
Logger.debug(TAG, "开始播放", this.url)
Logger.debug(TAG, "开始播放:"+ this.url)
this.setAliPlayerURL(this.url);
Logger.info(TAG, "设置SurfaceId: " + this.surfaceId)
... ...
... ... @@ -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,10 +162,20 @@ 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("等待")
console.log("等待")
await this.initPromise;
} else {
if (this.avPlayer.state != AVPlayerStatus.IDLE) {
... ... @@ -164,8 +188,13 @@ export class WDPlayerController {
if (this.avPlayer == null) {
return
}
Logger.error("开始播放", this.url)
console.log("开始播放", 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)
}
... ...
... ... @@ -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) {
... ...
... ... @@ -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
... ...
... ... @@ -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
}
... ...
... ... @@ -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
})
}
... ...
... ... @@ -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()
... ...