王士厅
Showing 38 changed files with 425 additions and 131 deletions
... ... @@ -29,6 +29,14 @@
"value": "14fp"
},
{
"name": "font_size_14_5",
"value": "14.5fp"
},
{
"name": "font_size_15",
"value": "15fp"
},
{
"name": "font_size_16",
"value": "16fp"
},
... ...
... ... @@ -681,6 +681,15 @@ export class HttpUrlUtils {
return url
}
static getLiveSendBarrageUrl() {
let url = HttpUrlUtils.getHost() + "/api/live-center-message/zh/c/live/message/chat/send"
return url
}
static getLiveTouristSendBarrageUrl() {
let url = HttpUrlUtils.getHost() + "/api/live-center-message/zh/a/live/message/chat/tourist/send"
return url
}
static getAppointmentStatusUrl() {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_APPOINTMENT_BATCH_PATH
return url
... ...
... ... @@ -59,6 +59,7 @@ export class ContentDTO implements BaseDTO {
source: string = '';
objectId: string = '';
objectType: string = '';
objectLevel: string = '';
channelId: string = '';
relId: string = '';
relType: string = '';
... ... @@ -102,6 +103,7 @@ export class ContentDTO implements BaseDTO {
liveRoomDataBean : LiveRoomDataBean = {} as LiveRoomDataBean// 批查获取到的直播观看人数
//本地字段:时间轴专题页节点组件时间;【如果开启模糊则显示时间->左右;0:否,1:是】
timeBlurred:number = 0
top:number = 0
static clone(old: ContentDTO): ContentDTO {
let content = new ContentDTO();
... ...
... ... @@ -32,6 +32,10 @@ export struct CardParser {
pageShowTime:number = 0;
pageHideTime:number = 0;
aboutToAppear(): void {
console.log('CardParser-', JSON.stringify(this.contentDTO))
}
onPageShow() {
this.pageShowTime = DateTimeUtils.getTimeStamp()
}
... ...
... ... @@ -49,10 +49,15 @@ export struct FeedBackActivity {
Column() {
Text($r('app.string.feedback_opinion_type'))
.fontColor($r('app.color.color_222222'))
.fontSize($r('app.float.font_size_16'))
.fontWeight(FontWeight.Bold)
.fontSize($r('app.float.font_size_14_5'))
.fontWeight(600)
.width('100%')
.margin({ left: 24, top: $r('app.float.vp_14') })
Blank()
.height(0.5)
.width('94%')
.margin({ top: $r('app.float.vp_12') })
.backgroundColor($r('app.color.color_EDEDED'))
GridRow({
columns:3,
}) {
... ... @@ -82,15 +87,15 @@ export struct FeedBackActivity {
}
})
}
.width('94%')
.width('90%')
.margin({top:$r('app.float.vp_16')})
Blank()
.height($r('app.float.margin_5'))
.backgroundColor($r('app.color.color_F5F5F5'))
Text($r('app.string.feedback_opinion_tv'))
.fontColor($r('app.color.color_222222'))
.fontSize($r('app.float.font_size_16'))
.fontWeight(FontWeight.Bold)
.fontSize($r('app.float.font_size_14_5'))
.fontWeight(600)
.width(CommonConstants.FULL_WIDTH)
.margin({ left: 24, top: $r('app.float.vp_12') })
Stack({ alignContent: Alignment.BottomEnd }) {
... ... @@ -191,26 +196,46 @@ export struct FeedBackActivity {
.fontSize($r('app.float.font_size_13_2'))
.width('94%')
.margin({ top: $r('app.float.margin_24') })
Row() {
Blank().width('3%')
Text($r('app.string.feedback_mail'))
.height(CommonConstants.FULL_HEIGHT)
.fontColor($r('app.color.color_222222'))
.fontSize($r('app.float.font_size_14'))
.fontWeight(FontWeight.Bold)
.fontSize($r('app.float.font_size_13_2'))
.fontWeight(600)
.padding({left: $r('app.float.margin_12') })
.backgroundColor($r('app.color.color_F5F5F5'))
.borderRadius({
topLeft: 4,
topRight: 0,
bottomLeft: 4,
bottomRight: 0,
})
TextInput({ placeholder: $r('app.string.feedback_hideemail') })
.width(CommonConstants.FULL_WIDTH)
.width(0)
.layoutWeight(1)
.height(CommonConstants.FULL_HEIGHT)
// .margin({left:15})
.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')})
.backgroundColor($r('app.color.color_F5F5F5'))
.borderRadius({
topLeft: 0,
topRight: 4,
bottomLeft: 0,
bottomRight: 4,
})
.onChange((value) => {
// Logger.debug(TAG, "onChange" + value + "/" + this.passwordContent)
this.email = value
})
Blank().width('3%')
}
.height(44)
.width('94%')
.backgroundColor($r('app.color.color_F5F5F5'))
.margin({top: $r('app.float.margin_16') })
.borderRadius(4)
.height(42)
.width(CommonConstants.FULL_WIDTH)
.margin({top: $r('app.float.margin_16')})
Blank().layoutWeight(1)
}
}
... ... @@ -222,8 +247,8 @@ export struct FeedBackActivity {
Column(){
Text($r('app.string.submit'))
.textAlign(TextAlign.Center)
.height(44)
.width('90%')
.height(42)
.width('94%')
.fontColor(this.canSubmit ? $r('app.color.color_fff') : $r('app.color.color_FFFFFF_40'))
.fontSize($r('app.float.font_size_18'))
.backgroundColor(this.canSubmit ? $r('app.color.color_ED2800') : $r('app.color.color_ED2800_99'))
... ...
... ... @@ -169,8 +169,8 @@ export struct SingleColumn999Component {
*/
@Builder
buildPaperItem(item: ContentDTO, index: number) {
///屏蔽早晚报 音频
if (item.objectType != '13'){
///屏蔽早晚报 音频 和 音频专题
if (item.objectType != '13'&&!(item.objectType == '5' && item.objectLevel === '22')){
PaperSingleColumn999CardView({
item: item,
index: index,
... ...
... ... @@ -39,13 +39,16 @@ export struct Card11Component {
Column() {
Stack() {
if(this.contentDTO.objectType == '5'){
Notes({ objectType: this.contentDTO.objectType }).height(20).align(Alignment.Center)
Notes({ objectType: this.contentDTO.objectType }).height(28).align(Alignment.Center)
} else {
if (this.contentDTO.seoTags) {
Notes({ newTags: this.contentDTO.seoTags }).height(20).align(Alignment.Center)
Notes({ newTags: this.contentDTO.seoTags }).height(28).align(Alignment.Center)
}
if (this.contentDTO.newTags) {
Notes({ newTags: this.contentDTO.newTags }).height(20).align(Alignment.Center)
Notes({ newTags: this.contentDTO.newTags }).height(28).align(Alignment.Center)
}
if (this.contentDTO.top === 1) {
Notes({ newTags: '置顶' }).height(28).align(Alignment.Center)
}
}
Text() {
... ... @@ -70,7 +73,7 @@ export struct Card11Component {
.width(CommonConstants.FULL_WIDTH)
.textIndent((this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) > 2 &&
(this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) < 5 ? 58 :
((this.contentDTO.newTags?.length > 0 || this.contentDTO.seoTags?.length > 0) || this.contentDTO.objectType == '5') ? 35 :
((this.contentDTO.newTags?.length > 0 || this.contentDTO.seoTags?.length > 0) || this.contentDTO.objectType == '5' || this.contentDTO.top === 1) ? 35 :
0 )
}.alignContent(Alignment.TopStart)
... ...
... ... @@ -69,6 +69,9 @@ export struct Card2Component {
if (this.contentDTO.newTags) {
Notes({ newTags: this.contentDTO.newTags }).height(29).align(Alignment.Center)
}
if (this.contentDTO.top === 1) {
Notes({ newTags: '置顶' }).height(29).align(Alignment.Center)
}
}
//新闻标题
// if (this.contentDTO.newTags) {
... ... @@ -101,7 +104,7 @@ export struct Card2Component {
.align(Alignment.Start)
.textIndent((this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) > 2 &&
(this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) < 5 ? 58 :
((this.contentDTO.newTags?.length > 0 || this.contentDTO.seoTags?.length > 0) || this.contentDTO.objectType == '5') ? 35 :
((this.contentDTO.newTags?.length > 0 || this.contentDTO.seoTags?.length > 0) || this.contentDTO.objectType == '5' || this.contentDTO.top === 1) ? 35 :
0 )
}.alignContent(Alignment.TopStart)
... ...
... ... @@ -50,6 +50,9 @@ export struct Card3Component {
if (this.contentDTO.newTags) {
Notes({ newTags: this.contentDTO.newTags }).height(29).align(Alignment.Center)
}
if (this.contentDTO.top === 1) {
Notes({ newTags: '置顶' }).height(29).align(Alignment.Center)
}
}
Text() {
if (this.titleMarked) {
... ... @@ -71,7 +74,7 @@ export struct Card3Component {
.width(CommonConstants.FULL_WIDTH)
.textIndent((this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) > 2 &&
(this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) < 5 ? 58 :
((this.contentDTO.newTags?.length > 0 || this.contentDTO.seoTags?.length > 0) || this.contentDTO.objectType == '5') ? 35 :
((this.contentDTO.newTags?.length > 0 || this.contentDTO.seoTags?.length > 0) || this.contentDTO.objectType == '5' || this.contentDTO.top === 1) ? 35 :
0 )
}.alignContent(Alignment.TopStart)
... ...
... ... @@ -55,6 +55,9 @@ export struct Card4Component {
if (this.contentDTO.newTags) {
Notes({ newTags: this.contentDTO.newTags }).height(19).align(Alignment.Center)
}
if (this.contentDTO.top === 1) {
Notes({ newTags: '置顶' }).height(20).align(Alignment.Center)
}
}
Text() {
if (this.titleMarked) {
... ... @@ -76,7 +79,7 @@ export struct Card4Component {
.textOverflow({ overflow: TextOverflow.Ellipsis })
.textIndent((this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) > 2 &&
(this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) < 5 ? 58 :
((this.contentDTO.newTags?.length > 0 || this.contentDTO.seoTags?.length > 0) || this.contentDTO.objectType == '5') ? 35 :
((this.contentDTO.newTags?.length > 0 || this.contentDTO.seoTags?.length > 0) || this.contentDTO.objectType == '5' || this.contentDTO.top === 1) ? 35 :
0 )
}.alignContent(Alignment.TopStart)
//新闻标题
... ...
... ... @@ -82,6 +82,9 @@ export struct Card5Component {
if (this.contentDTO.newTags) {
Notes({ newTags: this.contentDTO.newTags }).height(20).align(Alignment.Center)
}
if (this.contentDTO.top === 1) {
Notes({ newTags: '置顶' }).height(20).align(Alignment.Center)
}
}
Text() {
... ... @@ -106,7 +109,7 @@ export struct Card5Component {
.textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
.textIndent((this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) > 2 &&
(this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) < 5 ? 58 :
((this.contentDTO.newTags?.length > 0 || this.contentDTO.seoTags?.length > 0) || this.contentDTO.objectType == '5') ? 35 :
((this.contentDTO.newTags?.length > 0 || this.contentDTO.seoTags?.length > 0) || this.contentDTO.objectType == '5' || this.contentDTO.top === 1) ? 35 :
0 )
}.alignContent(Alignment.TopStart)
}
... ...
... ... @@ -61,6 +61,9 @@ export struct Card6Component {
if (this.contentDTO.newTags) {
Notes({ newTags: this.contentDTO.newTags }).height(28).align(Alignment.Center)
}
if (this.contentDTO.top === 1) {
Notes({ newTags: '置顶' }).height(28).align(Alignment.Center)
}
}
Text() {
... ... @@ -86,7 +89,7 @@ export struct Card6Component {
.textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
.textIndent((this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) > 2 &&
(this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) < 5 ? 58 :
((this.contentDTO.newTags?.length > 0 || this.contentDTO.seoTags?.length > 0) || this.contentDTO.objectType == '5') ? 35 :
((this.contentDTO.newTags?.length > 0 || this.contentDTO.seoTags?.length > 0) || this.contentDTO.objectType == '5' || this.contentDTO.top === 1) ? 35 :
0 )
}.alignContent(Alignment.TopStart)
// .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 60: 156)
... ...
... ... @@ -98,6 +98,9 @@ export struct Card9Component {
if (this.contentDTO.newTags) {
Notes({ newTags: this.contentDTO.newTags }).height(20).align(Alignment.Center)
}
if (this.contentDTO.top === 1) {
Notes({ newTags: '置顶' }).height(20).align(Alignment.Center)
}
}
}.alignContent(Alignment.BottomStart)
... ...
... ... @@ -438,7 +438,8 @@ export struct PaperSingleColumn999CardView {
Stack({ alignContent: Alignment.BottomEnd }) {
Image(this.item?.coverUrl)
.borderRadius(5)
.aspectRatio(319 / 179) ///图片设计比例
.objectFit(ImageFit.Fill)
.aspectRatio(16 / 10) ///图片设计比例
.padding({ top: 10 })
//视频
if (this.item?.videoInfo) {
... ... @@ -629,7 +630,11 @@ export struct PaperSingleColumn999CardView {
}else if(this.item.liveInfo.liveState === 'running'){
contentString = '直播中'
}else if(this.item.liveInfo.liveState === 'end'){
if (this.item.liveInfo.replayUri.length > 0) {
contentString = '回看'
}else {
contentString = '已结束'
}
}
return contentString;
}
... ... @@ -643,7 +648,10 @@ export struct PaperSingleColumn999CardView {
}else if(this.item.liveInfo.liveState === 'running'){
imageString = $r('app.media.card_live')
}else if(this.item.liveInfo.liveState === 'end'){
if (this.item.liveInfo.replayUri.length > 0) {
imageString = $r('app.media.card_play')
}else {
}
}
return imageString;
}
... ...
... ... @@ -23,7 +23,7 @@ struct ChannelSubscriptionLayout {
@Link myChannelList: TopNavDTO []
@Link moreChannelList: TopNavDTO []
@Link localChannelList: TopNavDTO []
@Link channelIds: number []
@State channelIds: number [] = []
@State isShow: boolean = false
@State dragItem: number = -1
private dragRefOffsetX: number = 0
... ... @@ -40,6 +40,9 @@ struct ChannelSubscriptionLayout {
aboutToAppear() {
this.currentTopNavSelectedItem = this.myChannelList[this.currentTopNavSelectedIndex]
this.myChannelList.forEach(item=>{
this.channelIds.push(item.channelId)
})
}
//交换我的频道数组中的位置
... ... @@ -54,7 +57,7 @@ struct ChannelSubscriptionLayout {
delChannelItem(index: number){
let item = this.myChannelList.splice(index, 1)[0]
this.channelIds.splice(index, 1)
AppStorage.setOrCreate('channelIds', this.channelIds.join(','))
AppStorage.setOrCreate('channelIds', JSON.stringify(this.channelIds))
if (item.moreChannel === '1') {
this.moreChannelList.unshift(item)
}
... ...
... ... @@ -28,7 +28,7 @@ struct PeopleShipHomePage {
// 总滑动空间
scroller: Scroller = new Scroller()
// 顶部透明度
@State topOpacity: number = 0
@Watch('topOpacityChange') @State topOpacity: number = 0
//发布数量
@State publishCount: number = 0
// 是否关注
... ... @@ -42,6 +42,22 @@ struct PeopleShipHomePage {
@State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
@State isConnectNetwork : boolean = NetworkUtil.isNetConnected()
onPageShow(): void {
WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff'})
}
onPageHide(): void {
WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', })
}
topOpacityChange(){
if(this.topOpacity > 0.8){
WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', })
}else{
WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff'})
}
}
build() {
if(this.isConnectNetwork){
Stack({ alignContent: Alignment.TopStart }) {
... ... @@ -50,7 +66,8 @@ struct PeopleShipHomePage {
Image($r('app.media.home_page_bg'))
.width('100%')
.height('120vp')
.objectFit(ImageFit.Fill)
.objectFit(ImageFit.Auto)
.objectRepeat(ImageRepeat.NoRepeat)
.backgroundColor(Color.White)
.visibility(this.isLoading ? Visibility.None : Visibility.Visible)
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP])
... ...
... ... @@ -46,8 +46,6 @@ export struct TopNavigationComponentNew {
// 顶导数据
@State @Watch('onTopNavigationDataUpdated') topNavList: TopNavDTO[] = []
@State indexSettingChannelId: number = AppStorage.get<number>('indexSettingChannelId') || 2002
//我的频道id列表
@State channelIds: number[] = []
//本地缓存频道id列表
@State storageChannelIds: string = AppStorage.get<string>('channelIds') || ''
@State homeChannelList: TopNavDTO[] = []
... ... @@ -192,7 +190,6 @@ export struct TopNavigationComponentNew {
myChannelList: $myChannelList,
moreChannelList: $moreChannelList,
localChannelList: $localChannelList,
channelIds: $channelIds,
changeTab: (index) => {
this.changePage(index)
}
... ... @@ -260,7 +257,7 @@ export struct TopNavigationComponentNew {
.edgeEffect(EdgeEffect.None)
.height($r('app.float.top_tab_bar_height_common'))
.backgroundColor(this.barBackgroundColor)
.margin({top:10})
.margin({ top: 10 })
.onAreaChange((oldValue: Area, newValue: Area) => {
let width = Number.parseFloat(newValue.width.toString())
this.tabsWidth = Number.isNaN(width) ? 0 : width
... ... @@ -342,8 +339,6 @@ export struct TopNavigationComponentNew {
//处理新闻tab顶导频道数据
topNavListHandle() {
let cityName = SPHelper.default.getSync(SpConstants.LOCATION_CITY_NAME, '') as string
let _channelIds: number [] = []
let _myChannelList: TopNavDTO [] = []
let _storageChannelIds: string [] = [] //list1
let defaultMyChannelList: TopNavDTO[] = []
... ... @@ -379,11 +374,7 @@ export struct TopNavigationComponentNew {
}
})
defaultList.unshift(...defaultMyChannelList)
defaultList.forEach((item, index) => {
if (this.storageChannelIds && _storageChannelIds.includes(String(item.channelId))) {
item.myChannel = '1'
}
if (item.channelType === 2) {
if (cityName.includes(item.name)) {
item.myChannel = '1'
... ... @@ -399,32 +390,34 @@ export struct TopNavigationComponentNew {
item.moreChannel = '1'
}
}
if (this.storageChannelIds && _storageChannelIds.includes(String(item.channelId))) {
item.myChannel = '1'
}
//频道分类
if (item.name !== '播报') { //暂时隐藏播报
if (item.myChannel === '1' && !this.storageChannelIds) {
if (item.myChannel === '1') {
_myChannelList.push(item)
_channelIds.push(item.channelId)
}
if (item.moreChannel === '1') {
if (item.moreChannel === '1' && item.myChannel !== '1') {
this.moreChannelList.push(item)
}
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 (this.storageChannelIds) {
let sortedyChannelList = _myChannelList.sort((item1, item2) => {
let index1 = this.storageChannelIds.indexOf(String(item1.channelId));
let index2 = this.storageChannelIds.indexOf(String(item2.channelId));
return index1 - index2;
});
_myChannelList = sortedyChannelList
}
if (cityName) {
let index = _myChannelList.findIndex(ele => cityName.includes(ele.name))
const localChannelitem = _myChannelList.splice(index, 1)[0];
... ... @@ -432,7 +425,6 @@ export struct TopNavigationComponentNew {
_myChannelList.splice(3, 0, localChannelitem);
}
this.channelIds = _channelIds
this.myChannelList = _myChannelList
//缓存首页频道
... ... @@ -620,22 +612,22 @@ export struct TopNavigationComponentNew {
})
}
clickMorningEveningPaper(){
clickMorningEveningPaper() {
if (NetworkUtil.isNetConnected()) {
DailyPaperTopicModel.getDailyPaperTopic().then(dailyPaperTopicBean =>{
DailyPaperTopicModel.getDailyPaperTopic().then(dailyPaperTopicBean => {
if (dailyPaperTopicBean && dailyPaperTopicBean.id > 0) {
SPHelper.default.saveSync('dailyPaperTopicPageId', dailyPaperTopicBean.id);
ProcessUtils.gotoMorningEveningPaper()
TrackingButton.click('morning_evening_news_click',TrackConstants.SummaryType.MorningAndEveningNews,TrackConstants.SummaryType.MorningAndEveningNews)
}else {
TrackingButton.click('morning_evening_news_click', TrackConstants.SummaryType.MorningAndEveningNews,
TrackConstants.SummaryType.MorningAndEveningNews)
} else {
ToastUtils.showToast('暂无早晚报信息', 1000)
}
}).catch((err:string) =>{
}).catch((err: string) => {
ToastUtils.showToast('暂无早晚报信息', 1000)
})
} else {
ToastUtils.showToast('网络出小差了,请检查网络后重试', 1000)
}
}
}
\ No newline at end of file
... ...
... ... @@ -276,6 +276,7 @@ export struct PeopleShipHomeArticleListComponent {
let extModel = element.contentExt[0];
contentDTO.openLikes = extModel.openLikes;
contentDTO.openComment = extModel.openComment;
contentDTO.top = extModel.top //是否置顶
}
// 页面
if (contentDTO.appStyle == '2' || contentDTO.appStyle == '13' || contentDTO.appStyle == '20') {
... ...
... ... @@ -40,7 +40,9 @@ export struct PeopleShipHomePageTopComponent {
Image($r('app.media.home_page_bg'))
.width('100%')
.height('48vp')
.objectFit(ImageFit.Fill)
.objectFit(ImageFit.Auto)
.objectRepeat(ImageRepeat.NoRepeat)
.objectFit(ImageFit.Auto)
.backgroundColor(Color.White)
// 头像和名称
Row() {
... ...
... ... @@ -28,10 +28,10 @@ export struct CustomTitleUI {
Text(this.titleName)
.maxLines(1)
.id("title")
.fontSize('35lpx')
.fontSize('30lpx')
.fontWeight(400)
.fontColor($r('app.color.color_222222'))
.lineHeight('42lpx')
.lineHeight('43lpx')
.alignRules({
center: {anchor: "__container__", align: VerticalAlign.Center},
middle: {anchor: "__container__", align: HorizontalAlign.Center}
... ...
... ... @@ -372,6 +372,7 @@ export struct LiveOperRowListView {
this.publishCommentModel.rootCommentId = '-1';
this.publishCommentModel.parentId = '-1';
this.publishCommentModel.placeHolderText = "说两句..."
this.publishCommentModel.commentContent = ""
this.commentInputDialogController?.open();
}
... ... @@ -466,14 +467,20 @@ export struct LiveOperRowListView {
this.showCommentInput = canComment
let mLiveId: string = this.contentDetailData.liveInfo.mlive.mliveId as string
if (!HttpUtils.isLogin() || mLiveId == undefined) {
if (!mLiveId) {
return
}
if (!HttpUtils.isLogin()) {
this.banComment = false
return
}
// 查询是否被禁言
PageRepository.fetchLiveBarrageBan(mLiveId).then(res => {
if (res.code == 0) {
this.banComment = res.data as boolean
this.showCommentInput = !this.banComment && canComment
}
})
}
}
\ No newline at end of file
... ...
... ... @@ -27,32 +27,60 @@ export class SearchShowRed {
res.push(content);
}
SearchShowRed.formatTitle(html, res, 0, textArr);
console.log('SearchShowRed-res', JSON.stringify(res))
SearchShowRed.formatTitle(
html.replaceAll('<em>', '').replaceAll('</em>', ''),
res,
0,
textArr
);
}
const titleInitRes: titleInitRes = {
titleMarked,
textArr
}
console.log('SearchShowRed-titleInitRes', JSON.stringify(titleInitRes))
return titleInitRes
}
private static formatTitle(textStr: string, matchArr: string[], index: number, textArr: textItem[]) {
const item: string = matchArr[index];
const arr = textStr.split(item);
arr.forEach((str: string, ind: number) => {
if (!item) {
textArr.push({
content: textStr,
isRed: false
})
return;
}
const ind = textStr.indexOf(item);
const len = item.length;
if (ind === 0) {
textArr.push({
content: str.replaceAll('<em>', '').replaceAll('</em>', ''),
content: item,
isRed: true
})
SearchShowRed.formatTitle(textStr.slice(len), matchArr, index + 1, textArr);
} else if (ind + len === textStr.length) {
textArr.push({
content: textStr.slice(0, ind),
isRed: false
} as textItem)
})
textArr.push({
content: item,
isRed: true
})
} else if (ind === 1) {
SearchShowRed.formatTitle(str, matchArr, index + 1, textArr)
}
} else {
textArr.push({
content: textStr.slice(0, ind),
isRed: false
})
textArr.push({
content: item,
isRed: true
})
SearchShowRed.formatTitle(textStr.slice(ind + len), matchArr, index + 1, textArr);
}
}
}
\ No newline at end of file
... ...
... ... @@ -29,6 +29,14 @@
"value": "14fp"
},
{
"name": "font_size_14_5",
"value": "14.5fp"
},
{
"name": "font_size_15",
"value": "15fp"
},
{
"name": "font_size_16",
"value": "16fp"
},
... ...
... ... @@ -68,19 +68,35 @@ export struct DetailPlayLiveCommon {
*/
getContentDetail() {
this.liveViewModel.getContentDetail(this.contentId, this.relId, this.relType)
.then((data: Array<ContentDetailDTO>) => {
.then(async (data: Array<ContentDetailDTO>) => {
console.log(TAG, '查询视频详情用于评论展示 getContentDetail:', JSON.stringify(data))
if (data) {
let detailData = data[0]
//人民号类型单独获取直播地址
if (detailData.rmhPlatform === 1) {
let vliveId = detailData.liveInfo.vlive[0].vliveId as string
console.error(TAG, 'vliveId==' + vliveId)
let pullStreamAddressData = await this.liveViewModel.getLiveRoomPullAddress(vliveId) as GetPullAddressBean
if (pullStreamAddressData) {
console.log(TAG, ' GetPullAddressBean:', JSON.stringify(pullStreamAddressData))
let m3u8uUrl = pullStreamAddressData.transCode[0].m3u8Url
detailData.liveInfo.vlive[0].liveUrl = m3u8uUrl
this.playUrl = m3u8uUrl
console.log(TAG, ' GetPullAddressBean:', m3u8uUrl)
}
}
this.liveLandscape =
detailData?.liveInfo?.liveLandScape //String(this.contentDetailData?.liveInfo?.liveLandScape || '')
detailData?.liveInfo?.liveLandScape
this.liveState = detailData.liveInfo?.liveState
this.contentDetailData = data[0]
console.log(TAG, '查询视频详情用于评论展示 openComment:', detailData.openComment)
this.publishCommentModel.targetId = String(detailData?.newsId || '')
this.publishCommentModel.targetRelId = String(detailData?.reLInfo?.relId || '')
this.publishCommentModel.targetTitle = detailData?.newsTitle
... ... @@ -100,18 +116,6 @@ export struct DetailPlayLiveCommon {
this.playUrl = detailData.liveInfo.vlive[0].replayUri
}
//人民号类型单独获取直播地址
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))
})
}
}
})
... ...
import { ContentDetailDTO, LiveRoomDataBean } from 'wdBean/Index';
import { ContentDetailDTO, LiveRoomDataBean, LiveRoomItemBean } from 'wdBean/Index';
import { LiveViewModel } from '../viewModel/LiveViewModel';
import { TabComponent } from '../widgets/details/TabComponent';
import { TopPlayComponent } from '../widgets/details/video/TopPlayComponet';
... ... @@ -35,6 +35,10 @@ export struct DetailPlayLivePage {
@Consume contentDetailData: ContentDetailDTO
@Consume publishCommentModel: publishCommentModel
// 尽量不要动属性。用来作为输入了评论之后,值传递
@State lastInputedLiveComment: LiveRoomItemBean = {} as LiveRoomItemBean // 上次输入的直播间消息
@State lastInputedChatComment: LiveRoomItemBean = {} as LiveRoomItemBean // 上次输入的大家聊消息
aboutToAppear(): void {
Logger.info(TAG, `wyj-aboutToAppear`)
... ... @@ -65,7 +69,10 @@ export struct DetailPlayLivePage {
TopPlayComponent({ playerController: this.playerController })
.height(this.displayDirection == DisplayDirection.VERTICAL ? 211 : '100%')
TabComponent({ tabs: this.tabs, changeToTab: this.changeToTab })
TabComponent({ tabs: this.tabs,
changeToTab: this.changeToTab,
lastInputedLiveComment: this.lastInputedLiveComment,
lastInputedChatComment: this.lastInputedChatComment})
.layoutWeight(1)
.visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None)
... ... @@ -79,7 +86,16 @@ export struct DetailPlayLivePage {
},
onCommentInputed: (content) => {
if (content.comment) {
this.liveViewModel.sendComment(content.comment)
this.liveViewModel.sendComment(content.comment, this.contentDetailData).then(result => {
if (!result) {
return
}
if (result.isWall == 1) {
this.lastInputedLiveComment = result
} else {
this.lastInputedChatComment = result
}
})
}
}
}).visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None)
... ...
import { HttpUrlUtils, ResponseDTO } from 'wdNetwork';
import { HttpUrlUtils, HttpUtils, 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, ValueType } from 'wdBean/Index';
import { Logger, ToastUtils, EmitterEventId, EmitterUtils, SPHelper } from 'wdKit';
import { ContentDetailDTO, LiveDetailsBean, LiveRoomBean, LiveRoomDataBean,
LiveRoomItemBean,
ReserveItemBean, ValueType } from 'wdBean/Index';
import { ContentDetailRequest } from 'wdDetailPlayApi/Index';
import { SpConstants } from 'wdConstant/Index';
const TAG = 'LiveModel'
... ... @@ -266,5 +269,61 @@ export class LiveModel {
})
})
}
liveSendComment(comment: string, content: ContentDetailDTO) {
let tourist: boolean = !HttpUtils.isLogin()
let roomId: string = content.liveInfo.mlive.roomId as string
let liveId: string = content.newsId + ''
let mLiveId: string = content.liveInfo.mlive.mliveId as string
let commentItem: LiveRoomItemBean = {} as LiveRoomItemBean
commentItem.text = comment
commentItem.isWall = 0
commentItem.dataType = "ZH_TEXT_MSG"
let params: Record<string, string | number> = {};
params["liveId"] = liveId
params["mliveId"] = mLiveId
params["roomId"] = roomId
params["title"] = content.newsTitle
params["text"] = comment
if (tourist) {
params["deviceId"] = HttpUtils.getDeviceId()
params["senderUserName"] = SPHelper.default.getSync(SpConstants.TOURIST_NICK_NAME, "") as string
} else {
params["senderUserId"] = SPHelper.default.getSync(SpConstants.USER_ID, "") as string
params["senderAvatarUrl"] = SPHelper.default.getSync(SpConstants.USER_HEAD_PHOTO_URL, "") as string
params["senderUserName"] = SPHelper.default.getSync(SpConstants.USER_NAME, "") as string
commentItem.senderUserAvatarUrl = params["senderAvatarUrl"]
}
commentItem.senderUserName = params["senderUserName"]
params["customizeExpression"] = 0
params["role"] = tourist ? "tourist" : "audience"
commentItem.role = tourist ? "tourist" : "audience"
let url = tourist ? HttpUrlUtils.getLiveTouristSendBarrageUrl() : HttpUrlUtils.getLiveSendBarrageUrl()
return new Promise<SendLiveCommentRes>((success, fail) => {
HttpRequest.post<ResponseDTO<SendLiveCommentInterfaceRes>>(url, params).then((data) => {
let res:SendLiveCommentRes = {
preDisplay: data.data?.preDisplay || false,
tipMessage: data.message,
commentItem: commentItem
}
success(res)
}, (error: Error) => {
fail(error.message)
Logger.debug(TAG + ":error ", error.toString())
})
})
}
}
interface SendLiveCommentInterfaceRes {
preDisplay: boolean
}
export interface SendLiveCommentRes {
preDisplay: boolean
tipMessage: string
commentItem: LiveRoomItemBean
}
\ No newline at end of file
... ...
import { ContentDetailDTO,
GetPullAddressBean,
LiveDetailsBean, LiveRoomBean, LiveRoomDataBean, ValueType } from 'wdBean/Index'
LiveDetailsBean, LiveRoomBean, LiveRoomDataBean,
LiveRoomItemBean,
ValueType } from 'wdBean/Index'
import { ContentDetailRequest } from 'wdDetailPlayApi/Index'
import { Logger } from 'wdKit/Index'
import { ToastUtils } from 'wdKit/src/main/ets/utils/ToastUtils'
import { ResponseDTO } from 'wdNetwork/Index'
import { LiveModel } from './LiveModel'
... ... @@ -27,14 +30,7 @@ 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)
// })
// })
async getLiveRoomPullAddress(vliveId:string) : Promise<GetPullAddressBean>{
return new Promise<GetPullAddressBean>((success, fail) => {
ContentDetailRequest.getLiveRoomPullStream(vliveId).then(async (resDTO: ResponseDTO<GetPullAddressBean>) => {
... ... @@ -136,7 +132,40 @@ export class LiveViewModel {
})
}
sendComment(comment: string) {
// 发送评论
sendComment(comment: string, content: ContentDetailDTO) {
return new Promise<LiveRoomItemBean | undefined>((success, fail) => {
this.liveModel.liveSendComment(comment, content).then((data) => {
Logger.debug(TAG, "发送评论结果: " + JSON.stringify(data))
if (data.preDisplay) {
success(data.commentItem)
} else {
success(undefined)
}
ToastUtils.showToast(data.tipMessage, 3000)
}).catch((message: string) => {
fail(message)
})
})
}
deepCopyLiveRoomItem(item: LiveRoomItemBean) {
return item
let retItem: LiveRoomItemBean = {} as LiveRoomItemBean
retItem.text = item.text
retItem.senderUserAvatarUrl = item.senderUserAvatarUrl
retItem.senderUserName = item.senderUserName
retItem.pictureUrls = item.pictureUrls
retItem.time = item.time
retItem.isWall = item.isWall
retItem.isTop = item.isTop
retItem.dataType = item.dataType
retItem.transcodeImageUrl = item.transcodeImageUrl
retItem.videoUrl = item.videoUrl
retItem.pictureResolutions = item.pictureResolutions
retItem.duration = item.duration
retItem.audioUrl = item.audioUrl
retItem.fullColumnImgUrlDto = item.fullColumnImgUrlDto
return retItem
}
}
... ...
... ... @@ -23,6 +23,7 @@ export struct TabChatComponent {
@State liveChatList: Array<LiveRoomItemBean> = []
@Consume contentDetailData: ContentDetailDTO
@Consume publishCommentModel: publishCommentModel
@Prop @Watch("lastInputedCommentChanged") lastInputedComment: LiveRoomItemBean
aboutToAppear(): void {
this.getLiveChatList()
... ... @@ -46,6 +47,12 @@ export struct TabChatComponent {
})
}
lastInputedCommentChanged(info: string) {
Logger.debug(TAG, "2显示评论》》》: " + JSON.stringify(this.lastInputedComment))
this.liveChatList.push(this.liveViewModel.deepCopyLiveRoomItem(this.lastInputedComment))
this.pageModel.viewType = ViewType.LOADED;
}
build() {
Stack() {
if (this.pageModel.viewType == ViewType.LOADING) {
... ...
import { LiveRoomItemBean, Action, PhotoListBean, Params } from 'wdBean/Index'
import { StringUtils } from 'wdKit/Index'
import { Logger, StringUtils } from 'wdKit/Index'
// import { Action, LiveRoomItemBean, Params, PhotoListBean } from 'wdBean/Index'
import { WDRouterRule } from 'wdRouter'
import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'
const TAG = "TabChatItemComponent"
@Component
export struct TabChatItemComponent {
item: LiveRoomItemBean = {} as LiveRoomItemBean
aboutToAppear(): void {
Logger.debug(TAG, "评论内容: " + this.item.text + " 评论sender: " + this.item.senderUserName)
}
build() {
... ...
import { LiveRoomItemBean } from 'wdBean/Index'
import { TabChatComponent } from './TabChatComponent'
import { TabInfoComponent } from './TabInfoComponent'
import { TabLiveComponent } from './TabLiveComponent'
... ... @@ -13,6 +14,9 @@ export struct TabComponent {
@State currentIndex: number = 0
private controller: TabsController = new TabsController()
@Prop tabs: string[] = []
@Prop lastInputedLiveComment: LiveRoomItemBean // 上次输入的直播间消息
@Prop lastInputedChatComment: LiveRoomItemBean // 上次输入的大家聊消息
aboutToAppear(): void {
}
... ... @@ -34,9 +38,9 @@ export struct TabComponent {
if ('简介' === item) {
TabInfoComponent()
} else if ('直播间' === item) {
TabLiveComponent()
TabLiveComponent({lastInputedComment: this.lastInputedLiveComment})
} else if ('大家聊' === item) {
TabChatComponent()
TabChatComponent({lastInputedComment: this.lastInputedChatComment})
}
}
.backgroundColor('#F5F5F5')
... ...
... ... @@ -23,11 +23,18 @@ export struct TabLiveComponent {
@Consume @Watch('updateData') contentDetailData: ContentDetailDTO
@State private pageModel: PageModel = new PageModel()
private scroller: Scroller = new Scroller()
@Prop @Watch("lastInputedCommentChanged") lastInputedComment: LiveRoomItemBean
aboutToAppear(): void {
this.getLiveList()
}
lastInputedCommentChanged(info: string) {
Logger.debug(TAG, "1显示评论》》》: " + JSON.stringify(this.lastInputedComment))
this.liveList.push(this.liveViewModel.deepCopyLiveRoomItem(this.lastInputedComment))
this.pageModel.viewType = ViewType.LOADED;
}
build() {
Stack() {
if (this.pageModel.viewType == ViewType.LOADING) {
... ...
... ... @@ -15,6 +15,7 @@ export struct TopPlayComponent {
playerController?: WDAliPlayerController
// 预告片图片/视频url
@State previewUrl: string = ''
// 预告资源是否是视频资源
@State isVideoSource: boolean = false
//未开始
@State isWait: boolean = false
... ... @@ -61,6 +62,9 @@ export struct TopPlayComponent {
this.updateData()
}
/**
* 更新直播播放数据
*/
updateData() {
// 检测等待中的直播预告是否视频资源
if (this.contentDetailData.liveInfo && this.contentDetailData.liveInfo.previewType === 1
... ... @@ -91,8 +95,11 @@ export struct TopPlayComponent {
}
}
this.isEnd = this.contentDetailData?.liveInfo?.liveState === 'end' &&
StringUtils.isEmpty(this.contentDetailData?.liveInfo?.vlive[0]?.replayUri)
Logger.debug(TAG, `---0------>` + this.isWait + ' ->' + this.isLoading + ' ->' + this.isEnd)
if (!this.isWait && this.contentDetailData.liveInfo && this.contentDetailData.liveInfo.vlive.length > 0) {
let playUrl = ''
if (this.contentDetailData.liveInfo.liveState == 'running') {
... ... @@ -105,17 +112,29 @@ export struct TopPlayComponent {
this.playUrl = this.previewUrl
this.tryToPlay()
} else {
Logger.debug(TAG, `---0------>${playUrl}`)
if (StringUtils.isNotEmpty(playUrl)) {
Logger.debug(TAG, `${playUrl}`)
this.playUrl = playUrl
this.tryToPlay()
}
}
}
// 文字直播 running 状态
if (this.contentDetailData?.liveInfo?.liveWay === 1 && this.contentDetailData?.liveInfo?.liveState === 'running') {
this.isWait = true
this.isLoading = true
if (this.contentDetailData.fullColumnImgUrls && this.contentDetailData.fullColumnImgUrls.length > 0) {
this.previewUrl = this.contentDetailData.fullColumnImgUrls[0].url
} else {
this.previewUrl = ''
}
}
}
tryToPlay() {
Logger.debug(TAG, `---1------>`)
if (!this.xComponentIsLoaded) {
Logger.debug(TAG, "需要xComponent加载完成")
return
... ... @@ -136,6 +155,7 @@ export struct TopPlayComponent {
this.isLoading = false
this.isError = false
this.xComponentIsLoaded = true
Logger.debug(TAG, `---onLoad------>`)
this.tryToPlay()
}
})
... ... @@ -149,6 +169,7 @@ export struct TopPlayComponent {
// 直播房间图
Image(this.previewUrl)
.objectFit(ImageFit.Cover)
.alt($r('app.media.live_room_image_fail'))
.visibility(this.isWait || this.isEnd ? Visibility.Visible : Visibility.None)
.contrast(this.isEnd ? 0.2 : 1)
.width('100%')
... ...
... ... @@ -10,7 +10,7 @@ import { LiveViewModel } from '../../viewModel/LiveViewModel'
import { ChartItemCompereComponent } from './ChartItemCompereComponent'
import { ChatItemComponent } from './ChartItemComponent'
import { router } from '@kit.ArkUI'
import { EmitterEventId, EmitterUtils, SPHelper, WindowModel } from 'wdKit/Index'
import { EmitterEventId, EmitterUtils, Logger, SPHelper, WindowModel } from 'wdKit/Index'
const TAG = "PlayerCommentComponent"
... ... @@ -28,22 +28,6 @@ export struct PlayerCommentComponent {
async aboutToAppear(): Promise<void> {
this.getLiveChatList()
//注册通知
EmitterUtils.receiveEvent(EmitterEventId.COMMENT_PUBLISH, async (targetId?: string) => {
if (targetId) {
if (targetId == this.publishCommentModel.targetId) {
const info = {
senderUserName: this.publishCommentModel.lastCommentModel.fromUserName,
text: this.publishCommentModel.lastCommentModel.commentContent,
} as LiveRoomItemBean
this.liveChatList.push(info)
this.scroller.scrollEdge(Edge.Bottom)
console.log(TAG, '发布评论:', JSON.stringify(this.publishCommentModel.lastCommentModel))
}
}
})
}
generateRandomString() {
... ... @@ -122,7 +106,14 @@ export struct PlayerCommentComponent {
},
onCommentInputed: (content) => {
if (content.comment) {
this.liveViewModel.sendComment(content.comment)
this.liveViewModel.sendComment(content.comment, this.contentDetailData).then(result => {
if (!result) {
return
}
Logger.debug(TAG, "3显示评论》》》: " + JSON.stringify(result))
this.liveChatList.push(result)
this.scroller.scrollEdge(Edge.Bottom)
})
}
},
onBack: () => {
... ...
... ... @@ -16,6 +16,7 @@ export struct PlayerComponent {
@State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
@State imgUrl: string = ''
@State isWait: boolean = false
// 0-横屏流画面,1-竖屏幕流画面
@State liveStreamType: number | null = -1
@State playUrl: string = ''
@State isCanplay: boolean = false
... ...
... ... @@ -267,6 +267,7 @@ export class WDAliPlayerController {
async firstPlay(url: string) {
if (StringUtils.isEmpty(url)) {
Logger.error(TAG, "播放链接为空")
return
}
... ... @@ -292,7 +293,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)
... ...
... ... @@ -95,6 +95,22 @@ struct LaunchAdvertisingPage {
.width('100%')
.height('100%')
if (this.defaultModel.isAd === '1'){
Stack({alignContent:Alignment.TopStart}){
Text('广告')
.fontColor(Color.White)
.textAlign(TextAlign.Center)
.fontSize('24lpx')
.width('72lpx')
.height('36lpx')
.borderRadius(5)
.margin({top:'10lpx',left:'19lpx'})
.backgroundColor('#80000000')
}
.width('100%')
.height('100%')
}
if(this.defaultModel.screenType != '2'){
//底部logo样式 按钮加载在背景展示图上
Button(){
... ...