chengen02

Merge remote-tracking branch 'origin/main'

... ... @@ -114,7 +114,7 @@ export { ShareInfo } from './src/main/ets/bean/morningevening/ShareInfo';
export { slideShows } from './src/main/ets/bean/morningevening/slideShows';
export { LiveDetailsBean } from './src/main/ets/bean/live/LiveDetailsBean';
export { LiveDetailsBean, joinPeopleNum } from './src/main/ets/bean/live/LiveDetailsBean';
export { ArticleListDTO } from './src/main/ets/bean/component/ArticleListDTO';
... ...
... ... @@ -208,3 +208,11 @@ export interface Vlive {
export interface ReLInfo {
relId: string
}
export interface joinPeopleNum {
barrageNum: number,
likeNum: number,
liveId: number,
pv: number,
subscribeNum: number
}
\ No newline at end of file
... ...
import { ContentDTO } from 'wdBean/Index'
import { ContentDTO, joinPeopleNum } from 'wdBean/Index'
import { DateTimeUtils } from 'wdKit/Index'
import { LottieView } from '../../components/lottie/LottieView';
import { LiveModel } from '../../viewmodel/LiveModel'
import font from '@ohos.font';
/**
* 这里是样式卡中,右下角显示的音视频信息
... ... @@ -11,10 +13,55 @@ import { LottieView } from '../../components/lottie/LottieView';
@Component
export struct CardMediaInfo {
@State contentDTO: ContentDTO = new ContentDTO() // 如果有duraion,代表点播,显示时长;如果不传或者传0,显示直播中
@State joinPeopleNum: number = 0;
// objectType 0:不跳转 1:点播,2:直播,3:活动,4:广告,5:专题,6:链接,7:榜单,8:图文,9:组图,10:H5新闻,11:频道,12:组件,13:音频,
// 14动态图文,15动态视频16问政;100人民号,101标签
aboutToAppear(): void {
this.getJoinPeopleNum();
font.registerFont({
familyName: 'BebasNeue',
familySrc: $rawfile('font/BebasNeue.ttf')
})
}
/**
* 全域数字显示规则
* 1、当数量为千位以內时,显示数字,不保留小数点,比如 4585
* 2、当数量为万位~1亿时,显示xx 万,保留小数点后一位,比如1517.9w、2.9w
* 3、当数量为1亿~千亿时,显示XX 亿,保留小数点后一位,比如1517.9亿、2.9亿
* 4、不进行四舍五入
* 5、0 和空 不显示
*/
handlerNum(number: string) {
const num = number??'0';
if (Number.parseInt(num) <= 9999) {
return Number.parseInt(num).toString()
} else if (Number.parseInt(num) > 9999 && Number.parseInt(num) <= 99999999) {
const num1: string = num.slice(0, -4); // 万
const num2: string = num.slice(-4, -3); // 千
return num2 === '0' ? num1 +'万' : num1 + '.' + num2 + '万'
} else if (Number.parseInt(num) > 99999999) {
const num1: string = num.slice(0, -8); // 亿
const num2: string = num.slice(-8, -7);
return num2 === '0' ? num1 +'亿' : num1 + '.' + num2 + '亿'
}
return num
}
//
/**
* 获取直播节目参与人数
*/
async getJoinPeopleNum() {
if (this.contentDTO.objectType !== '2') return;
console.log('getJoinPeopleNum-ContentDTO', JSON.stringify(this.contentDTO.objectId))
let liveIdList: string = this.contentDTO.objectId
let data: joinPeopleNum[] = await LiveModel.getJoinPeopleNum(liveIdList)
this.joinPeopleNum = data[0].pv;
}
build() {
Row() {
if (this.contentDTO?.objectType === '1' || this.contentDTO?.objectType === '15') {
... ... @@ -25,6 +72,7 @@ export struct CardMediaInfo {
if (this.contentDTO.videoInfo != null) {
Text(DateTimeUtils.getFormattedDuration(this.contentDTO.videoInfo.videoDuration * 1000))
.mediaText()
.fontFamily('BebasNeue')
}
}
} else if (this.contentDTO.objectType === '2') {
... ... @@ -62,6 +110,12 @@ export struct CardMediaInfo {
Text('已结束')
.mediaText()
}
if (!!this.joinPeopleNum) {
Text(' | ')
.mediaText()
Text(`${this.handlerNum(this.joinPeopleNum.toString())}人参加`)
.mediaText()
}
// } else if (this.contentDTO?.liveInfo?.liveState === 'end' && this.contentDTO?.liveInfo
// ?.replayUri) {
// // Image($r('app.media.card_live'))
... ... @@ -85,6 +139,7 @@ export struct CardMediaInfo {
.mediaLogo()
Text(DateTimeUtils.getFormattedDuration(this.contentDTO.voiceInfo.voiceDuration * 1000))
.mediaText()
.fontFamily('BebasNeue')
}
} else if (this.contentDTO.objectType === '4') {//广告标签
Text($r('app.string.comp_advertisement'))
... ...
... ... @@ -155,7 +155,7 @@ export struct RmhTitle {
Text(Number(this.followStatus) === 0 ? '关注' : '已关注')
.fontSize($r('app.float.font_size_13'))
.fontColor($r('app.color.color_ED2800'))
.fontColor(Number(this.followStatus) === 0 ? $r('app.color.color_ED2800') : 0xc6c6c6)
}
.flexShrink(0)
.alignSelf(ItemAlign.Center)
... ...
... ... @@ -67,6 +67,7 @@ export struct Card2Component {
.fontSize($r('app.float.font_size_18'))
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.maxLines(2)
.lineHeight(27)
.textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
.align(Alignment.Start)
.textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 :
... ...
import MinePageDatasModel from '../../../model/MinePageDatasModel'
import { onlyWifiLoadImg } from '../../../utils/lazyloadImg'
import { AppointmentOperationRequestItem } from '../../../viewmodel/AppointmentOperationRequestItem'
import { MineAppointmentItem } from '../../../viewmodel/MineAppointmentItem'
import { MyCustomDialog } from '../../reusable/MyCustomDialog'
@Component
export struct AppointmentListChildComponent{
export struct AppointmentListChildComponent {
@ObjectLink item: MineAppointmentItem
@State loadImg: boolean = false;
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
}
dialogController: CustomDialogController = new CustomDialogController({
builder: MyCustomDialog({
cancel: this.onCancel,
... ... @@ -20,18 +27,20 @@ export struct AppointmentListChildComponent{
customStyle: true
})
build() {
Column(){
Stack(){
Image(this.item?.imageUrl[0])
Column() {
Stack() {
Image(this.loadImg ? this.item?.imageUrl[0] : '')
.backgroundColor(this.loadImg ? $r('app.color.color_B0B0B0') : 0xf5f5f5)
.width('100%')
.aspectRatio(16 / 9)
.objectFit(ImageFit.Auto)
.interpolation(ImageInterpolation.High)
if(this.item.relType === 1){
Row(){
Row(){
if (this.item.relType === 1) {
Row() {
Row() {
Image($r('app.media.reserve_icon'))
.width('42lpx')
.height('35lpx')
... ... @@ -47,7 +56,7 @@ export struct AppointmentListChildComponent{
.layoutWeight(1)
.textAlign(TextAlign.Center)
}.width('94lpx')
.margin({bottom:'15lpx',right:'15lpx'})
.margin({ bottom: '15lpx', right: '15lpx' })
}.width('100%')
.height('100%')
.alignItems(VerticalAlign.Bottom)
... ... @@ -56,7 +65,7 @@ export struct AppointmentListChildComponent{
}.width('100%')
.height('376lpx')
Column(){
Column() {
Text(this.item.title)
.fontWeight('400lpx')
.fontSize('33lpx')
... ... @@ -64,28 +73,28 @@ export struct AppointmentListChildComponent{
.lineHeight('48lpx')
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.margin({bottom:'23lpx'})
.margin({ bottom: '23lpx' })
.textAlign(TextAlign.Start)
.width('100%')
Row(){
Row(){
if(this.item.relType === 2){
Row() {
Row() {
if (this.item.relType === 2) {
Image($r('app.media.play_status_history_icon'))
.objectFit(ImageFit.Auto)
.interpolation(ImageInterpolation.High)
.width('38lpx')
.height('38lpx')
.margin({right:'12lpx'})
.margin({ right: '12lpx' })
Text('已结束').fontColor($r('app.color.color_999999'))
.fontWeight('500lpx')
.fontSize('23lpx')
}else {
} else {
Image($r('app.media.play_status_icon'))
.objectFit(ImageFit.Auto)
.interpolation(ImageInterpolation.High)
.width('38lpx')
.height('38lpx')
.margin({right:'12lpx'})
.margin({ right: '12lpx' })
Text(this.item.timePre).fontColor($r('app.color.color_ED2800'))
.fontWeight('500lpx')
.fontSize('23lpx')
... ... @@ -94,35 +103,37 @@ export struct AppointmentListChildComponent{
.interpolation(ImageInterpolation.High)
.width('12lpx')
.height('31lpx')
.margin({right:'4lpx'})
.margin({ right: '4lpx' })
Text(`${this.item.timeBack}开始`).fontColor($r('app.color.color_ED2800'))
.fontWeight('500lpx')
.fontSize('23lpx')
.lineHeight('31lpx')
}
}.padding({left:'19lpx',right:'19lpx'})
}
.padding({ left: '19lpx', right: '19lpx' })
.height('46lpx')
.alignItems(VerticalAlign.Center)
.backgroundColor($r('app.color.color_F5F5F5'))
.borderRadius('4lpx')
Blank()
.layoutWeight(1)
if(this.item.relType === 1){
Text(this.item.isAppointment?"已预约":"预约")
.fontWeight(400)
.fontSize('23lpx')
.backgroundColor(this.item.isAppointment?$r('app.color.color_F5F5F5'):$r('app.color.color_ED2800'))
.fontColor(this.item.isAppointment?$r('app.color.color_CCCCCC'):$r('app.color.white'))
.lineHeight('31lpx')
.textAlign(TextAlign.Center)
.width('100lpx')
.height('46lpx')
.borderRadius('6lpx')
.onClick(()=>{
this.dialogController.open()
})
}else {
Text(this.item.relType === 2?"去观看":"看回放")
.layoutWeight(1)
if (this.item.relType === 1) {
Text(this.item.isAppointment ? "已预约" : "预约")
.fontWeight(400)
.fontSize('23lpx')
.backgroundColor(this.item.isAppointment ? $r('app.color.color_F5F5F5') : $r('app.color.color_ED2800'))
.fontColor(this.item.isAppointment ? $r('app.color.color_CCCCCC') : $r('app.color.white'))
.lineHeight('31lpx')
.textAlign(TextAlign.Center)
.width('100lpx')
.height('46lpx')
.borderRadius('6lpx')
.onClick(() => {
this.dialogController.open()
})
} else {
Text(this.item.relType === 2 ? "去观看" : "看回放")
.fontWeight(400)
.fontSize('23lpx')
.backgroundColor($r('app.color.color_ED2800'))
... ... @@ -135,7 +146,12 @@ export struct AppointmentListChildComponent{
}
}
}
.padding({left:'23lpx',right:'23lpx',top:'15lpx',bottom:'23lpx'})
.padding({
left: '23lpx',
right: '23lpx',
top: '15lpx',
bottom: '23lpx'
})
}.margin({ left: 10, right: 10 })
.backgroundColor($r('app.color.white'))
.borderRadius('8lpx')
... ... @@ -145,20 +161,19 @@ export struct AppointmentListChildComponent{
console.info('Callback when the first button is clicked')
}
onAccept(){
onAccept() {
console.info('Callback when the second button is clicked')
this.appointmentOperation()
}
appointmentOperation(){
let item = new AppointmentOperationRequestItem(this.item.relId,this.item.liveId+"",!this.item.isAppointment)
MinePageDatasModel.getAppointmentOperation(item,getContext(this)).then((value)=>{
if(value!=null){
appointmentOperation() {
let item = new AppointmentOperationRequestItem(this.item.relId, this.item.liveId + "", !this.item.isAppointment)
MinePageDatasModel.getAppointmentOperation(item, getContext(this)).then((value) => {
if (value != null) {
if (value.code === 0 || value.code.toString() === "0") {
this.item.isAppointment = !this.item.isAppointment
}
}
})
}
}
\ No newline at end of file
... ...
... ... @@ -12,6 +12,7 @@ import LoadMoreLayout from '../page/LoadMoreLayout';
import { LottieView } from '../../components/lottie/LottieView';
import dataPreferences from '@ohos.data.preferences';
import { BusinessError } from '@ohos.base';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
const TAG: string = 'LiveMorePage';
... ... @@ -45,8 +46,12 @@ struct LiveMorePage {
// 点击过的数据
@State clickDatas: Array<string> = []
async aboutToAppear() {
@State loadImg: boolean = false;
async aboutToAppear() : Promise<void>{
await this.getPreferencesFromStorage()
this.loadImg = await onlyWifiLoadImg();
this.getLivMoreClickPreference()
Logger.debug(TAG, '数据:' + JSON.stringify(this.clickDatas))
this.currentPage = 1
... ... @@ -155,9 +160,10 @@ struct LiveMorePage {
.fontColor(this.isClicked(item.objectId) ? $r('app.color.color_848484') : $r('app.color.color_222222'))
Stack() {
if (item.fullColumnImgUrls && item.fullColumnImgUrls.length > 0) {
Image(item.fullColumnImgUrls[0].url)
Image(this.loadImg?item.fullColumnImgUrls[0].url:'')
.backgroundColor(this.loadImg ? $r('app.color.color_B0B0B0') : 0xf5f5f5)
.width('100%')
.height(196)
.aspectRatio(16 / 9)
.borderRadius(4)
}
this.LiveImage(item)
... ...
import { ContentDTO, ReserveBean, ReserveItemBean } from 'wdBean/Index';
import { ProcessUtils } from 'wdRouter/Index';
import PageViewModel from '../../viewmodel/PageViewModel';
import { Logger, EmitterEventId, EmitterUtils, ToastUtils } from 'wdKit/Index';
import { Logger, EmitterEventId, EmitterUtils, ToastUtils } from 'wdKit/Index';
import { router } from '@kit.ArkUI';
import { LiveModel } from '../../viewmodel/LiveModel';
import { ViewType } from 'wdConstant/src/main/ets/enum/ViewType';
... ... @@ -9,10 +9,11 @@ import { EmptyComponent } from '../view/EmptyComponent';
import { ErrorComponent } from '../view/ErrorComponent';
import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh';
import { PeopleShipNoMoreData } from '../reusable/PeopleShipNoMoreData';
import { HttpUtils } from 'wdNetwork/Index';
import { HttpUtils } from 'wdNetwork/Index';
import { WDRouterPage, WDRouterRule } from 'wdRouter'
import { LazyDataSource } from 'wdKit/Index';
import { LazyDataSource } from 'wdKit/Index';
import LoadMoreLayout from '../page/LoadMoreLayout'
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
const TAG: string = 'ReserveMorePage';
... ... @@ -43,11 +44,12 @@ struct ReserveMorePage {
private scroller: Scroller = new Scroller()
@State reservedIds: string[] = []
@State isShow: boolean = false
@State private liveId: string = ''
@State private liveId: string = ''
@State isLoadingAttention: boolean = false
@State loadImg: boolean = false;
build() {
Column(){
Column() {
this.TabbarNormal()
if (this.viewType == ViewType.LOADING) {
this.LoadingLayout()
... ... @@ -85,7 +87,7 @@ struct ReserveMorePage {
@Builder
ListLayout() {
List({scroller: this.scroller}) {
List({ scroller: this.scroller }) {
// 下拉刷新
LazyForEach(this.data, (contentDTO: ContentDTO, index: number) => {
ListItem() {
... ... @@ -110,7 +112,7 @@ struct ReserveMorePage {
.height('calc(100% - 44vp)')
.onReachEnd(() => {
Logger.debug(TAG, "触底了");
if(!this.isLoading && this.hasMore){
if (!this.isLoading && this.hasMore) {
//加载分页数据
this.currentPage++;
this.getData()
... ... @@ -127,9 +129,13 @@ struct ReserveMorePage {
buildItem(item: ContentDTO, index: number) {
Column() {
Stack() {
Image(item.fullColumnImgUrls[0]?.url)
Image(this.loadImg ? item.fullColumnImgUrls[0]?.url : '')
.width('100%')
.aspectRatio(16 / 9)
.backgroundColor(this.loadImg ? $r('app.color.color_B0B0B0') : $r('app.color.color_33A3A3A3'))
.objectFit(ImageFit.Contain)
.borderWidth(0.5)
.borderColor($r('app.color.color_0D000000'))
.borderRadius({
topLeft: '4vp',
topRight: '4vp'
... ... @@ -152,7 +158,12 @@ struct ReserveMorePage {
Image($r('app.media.reserve_play_icon'))
.width(20)
.height(20)
.margin({ left: 10, top: 2, bottom: 2, right: 6 })
.margin({
left: 10,
top: 2,
bottom: 2,
right: 6
})
Text(this.getReserveDate(item.liveInfo.liveStartTime, 1))
.fontSize(12)
... ... @@ -190,7 +201,8 @@ struct ReserveMorePage {
.width(20)
.height(20)
.color(!this.isReserved(item) ? $r('app.color.color_fff') : $r('app.color.color_CCCCCC'))
.visibility((this.isLoadingAttention && this.liveId == item.objectId) ? Visibility.Visible : Visibility.None)
.visibility((this.isLoadingAttention && this.liveId == item.objectId) ? Visibility.Visible :
Visibility.None)
Text(!this.isReserved(item) ? '预约' : '已预约')
.fontSize($r('app.float.vp_12'))
... ... @@ -199,14 +211,21 @@ struct ReserveMorePage {
.width('100%')
.height('100%')
.textAlign(TextAlign.Center)
.visibility((this.isLoadingAttention && this.liveId == item.objectId) ? Visibility.None : Visibility.Visible)
.visibility((this.isLoadingAttention && this.liveId == item.objectId) ? Visibility.None :
Visibility.Visible)
.margin({
right: '10vp'
})
.textShadow({
radius: 2,
color: 'rgba(0,0,0,0.3)',
offsetY: 2
})
.backgroundColor(!this.isReserved(item) ? $r('app.color.color_ED2800') : $r('app.color.color_F5F5F5'))
.borderRadius(3)
}.onClick(() => {
}
.onClick(() => {
this.bookAndCancel(item)
})
.justifyContent(FlexAlign.Center)
... ... @@ -214,7 +233,7 @@ struct ReserveMorePage {
.borderRadius(3)
.width('52vp')
.height('24vp')
.margin({right: 12})
.margin({ right: 12 })
}
.width('100%')
... ... @@ -285,12 +304,18 @@ struct ReserveMorePage {
.fontSize('12vp')
.fontWeight(400)
.fontColor(Color.White)
.textShadow({
radius: 2,
color: 'rgba(0,0,0,0.3)',
offsetY: 2
})
}
.backgroundColor(Color.Transparent)
.margin({ right: 8, bottom: 8 })
}
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
// PageViewModel.get
this.currentPage = 1
this.getData()
... ... @@ -301,24 +326,24 @@ struct ReserveMorePage {
})
// 获取预约
EmitterUtils.receiveEvent(EmitterEventId.LIVE_ROOM_SUBSCRIBE, (str?: string) => {
EmitterUtils.receiveEvent(EmitterEventId.LIVE_ROOM_SUBSCRIBE, (str?: string) => {
Logger.debug(TAG, 'receiveEvent LIVE_ROOM_SUBSCRIBE: ' + str)
if (str) {
// 跳转指定频道场景,传参底导id、频道id
const model: ReserveItemBean = JSON.parse(str)
Logger.debug(TAG,'是否关注元数据0:' +` ${model.liveId}`)
if (model && model.liveId && this.reserveList) {
Logger.debug(TAG, '是否关注元数据0:' + ` ${model.liveId}`)
if (model && model.liveId && this.reserveList) {
// 修改源数据
this.reserveList.forEach((element) => {
if (element.liveId == model.liveId) {
if (element && element.subscribe != model.subscribe) {
Logger.debug(TAG,'是否关注元数据2:' +` ${JSON.stringify(element.subscribe)}`)
Logger.debug(TAG, '是否关注元数据2:' + ` ${JSON.stringify(element.subscribe)}`)
element.subscribe = !element.subscribe
Logger.debug(TAG,'是否关注元数据3:' +` ${JSON.stringify(element.subscribe)}`)
Logger.debug(TAG, '是否关注元数据3:' + ` ${JSON.stringify(element.subscribe)}`)
this.isShow = true
if (element.subscribe) {
this.reservedIds.push(element.liveId.toString())
}else {
} else {
const num = this.reservedIds.indexOf(element.liveId.toString())
if (num >= 0 && num < this.reservedIds.length) {
this.reservedIds.splice(num, 1)
... ... @@ -364,14 +389,14 @@ struct ReserveMorePage {
this.data.push(...liveReviewDTO.list)
//批量查询关注状态
this.getAppointmentInfo(liveReviewDTO.list)
} else {
} else {
this.hasMore = false;
}
this.resolveEnd(true, resolve)
if (liveReviewDTO.list.length == 0 && this.currentPage == 1) {
this.viewType = ViewType.EMPTY
}
}catch (exception) {
} catch (exception) {
this.resolveEnd(false, resolve)
}
// PageViewModel.getLiveMoreUrl(this.type, this.currentPage, this.pageSize).then(async (liveReviewDTO) => {
... ... @@ -387,7 +412,7 @@ struct ReserveMorePage {
if (resolve) {
if (this.currentPage == 1 && isTop) {
resolve('已更新至最新')
}else {
} else {
resolve('')
}
}
... ... @@ -402,9 +427,9 @@ struct ReserveMorePage {
async getAppointmentInfo(list: ContentDTO[]) {
if (HttpUtils.getUserId()) {
const reserveBean = this.transformToLiveDetailsBeans(list)
Logger.debug(TAG,'是否预约数据:' +` ${JSON.stringify(reserveBean)}`)
Logger.debug(TAG, '是否预约数据:' + ` ${JSON.stringify(reserveBean)}`)
LiveModel.getAppointmentStatus(reserveBean).then((result) => {
Logger.debug(TAG,'是否预约数据:' +` ${JSON.stringify(result)}`)
Logger.debug(TAG, '是否预约数据:' + ` ${JSON.stringify(result)}`)
if (result && result.length > 0) {
this.reserveList.push(...result)
// this.reserveStatus = res;
... ... @@ -414,10 +439,10 @@ struct ReserveMorePage {
}
})
}
}).catch(() =>{
}).catch(() => {
// this.data.push(...list)
})
}else {
} else {
// this.data.push(...list)
}
... ... @@ -463,18 +488,19 @@ struct ReserveMorePage {
this.isLoadingAttention = true
this.liveId = reserveItem.liveId.toString()
try {
const res = await LiveModel.liveAppointment(reserveItem.relationId, reserveItem.liveId.toString(), !reserveItem.subscribe);
const res = await LiveModel.liveAppointment(reserveItem.relationId, reserveItem.liveId.toString(),
!reserveItem.subscribe);
if (res.code == 0) {
ToastUtils.shortToast(!reserveItem.subscribe ? '预约成功' : '取消预约成功')
// 修改源数据
this.reserveList.forEach((element) => {
if (element.liveId.toString() == item.objectId) {
Logger.debug(TAG,'是否关注元数据:' +` ${JSON.stringify(element.subscribe)}`)
Logger.debug(TAG, '是否关注元数据:' + ` ${JSON.stringify(element.subscribe)}`)
element.subscribe = !element.subscribe
Logger.debug(TAG,'是否关注元数据1:' +` ${JSON.stringify(element.subscribe)}`)
Logger.debug(TAG, '是否关注元数据1:' + ` ${JSON.stringify(element.subscribe)}`)
if (element.subscribe) {
this.reservedIds.push(element.liveId.toString())
}else {
} else {
const num = this.reservedIds.indexOf(element.liveId.toString())
if (num >= 0 && num < this.reservedIds.length) {
this.reservedIds.splice(num, 1)
... ... @@ -490,13 +516,12 @@ struct ReserveMorePage {
this.liveId = ''
this.isLoadingAttention = false
}
}else {
} else {
this.liveId = ''
this.isLoadingAttention = false
}
}
}
getReserveDate(eventDateTimeString: string, type: number): string {
// 解析事件的日期和时间
const eventDateTime = new Date(eventDateTimeString);
... ... @@ -509,17 +534,47 @@ struct ReserveMorePage {
if (type === 1) {
// 如果是今天
if (eventDateTime.setHours(0,0,0,0) === currentDateTime.setHours(0,0,0,0)) {
return `今天`;
if (eventDateTime.setHours(0, 0, 0, 0) === currentDateTime.setHours(0, 0, 0, 0)) {
const eventDate = eventDateTime.setHours(0, 0, 0, 0);
const currentDate = currentDateTime.setHours(0, 0, 0, 0);
if (eventDate === currentDate) {
return `今天`;
} else {
// 如果事件不在今天
// 将来的日期
const month = eventDateTime.getMonth() + 1;
const date = eventDateTime.getDate();
return `${month}月${date}日`;
}
} else {
// 如果事件不在今天
const month = eventDateTime.getMonth() + 1; // 月份从0开始
const date = eventDateTime.getDate();
return `${month}月${date}日`;
return `${eventTimeStr}`;
}
} else {
return `${eventTimeStr}`;
}
// getReserveDate(eventDateTimeString: string, type: number): string {
// // 解析事件的日期和时间
// const eventDateTime = new Date(eventDateTimeString);
// const currentDateTime = new Date();
//
// // 截取事件时间的小时和分钟(假设事件时间是按照24小时制)
// const eventHour = eventDateTime.getHours();
// const eventMinutes = eventDateTime.getMinutes();
// const eventTimeStr = `${eventHour}:${eventMinutes.toString().padStart(2, '0')}开始`; // 格式化时间,确保分钟是两位数
//
// if (type === 1) {
// // 如果是今天
// if (eventDateTime.setHours(0,0,0,0) === currentDateTime.setHours(0,0,0,0)) {
// return `今天`;
// } else {
// // 如果事件不在今天
// const month = eventDateTime.getMonth() + 1; // 月份从0开始
// const date = eventDateTime.getDate();
// return `${month}月${date}日`;
// }
// } else {
// return `${eventTimeStr}`;
// }
// }
}
... ...
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 } from 'wdBean/Index';
import { LiveDetailsBean, ReserveBean, ReserveItemBean, joinPeopleNum } from 'wdBean/Index';
const TAG = 'LiveModel'
... ... @@ -105,5 +105,34 @@ export class LiveModel {
})
})
}
/**
* 查询直播参与人数
*/
static getJoinPeopleNum(liveIdList: string) {
return new Promise<Array<joinPeopleNum>>((success, fail) => {
HttpRequest.get<ResponseDTO<Array<joinPeopleNum>>>(
HttpUrlUtils.getJoinPeopleNum() + `?liveIdList=${liveIdList}`,
).then((data: ResponseDTO<Array<joinPeopleNum>>) => {
Logger.debug(TAG, 'getJoinPeopleNum:' + `${JSON.stringify(data)}`)
Logger.debug(TAG, 'liveIdList:' + liveIdList)
if (!data || !data.data) {
fail("数据为空")
return
}
if (data.code != 0) {
fail(data.message)
ToastUtils.shortToast(data.message)
return
}
success(data.data)
Logger.info('getJoinPeopleNum', JSON.stringify(data.data))
}, (error: Error) => {
fail(error.message)
Logger.debug(TAG + ":error ", JSON.stringify(error))
})
})
}
}
... ...
... ... @@ -409,6 +409,8 @@ export class PageHelper {
// 批查直播观看人数
this.getLiveRoomDataInfo(compList)
//
// 测试数据
// setTimeout(() => {
... ...
... ... @@ -177,6 +177,7 @@
{
"name": "color_848484",
"value": "#848484"
}
},
{"name": "color_33A3A3A3","value": "#33A3A3A3"}
]
}
\ No newline at end of file
... ...