张善主

Merge remote-tracking branch 'origin/main'

Showing 44 changed files with 542 additions and 302 deletions
... ... @@ -511,7 +511,12 @@ export class HttpUrlUtils {
}
static getVerifyCodeByTokenUrl() {
let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/auth/zh/c/sendVerifyCodeByToken";
let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/sendVerifyCodeByToken";
return url;
}
static getCheckVerifyCodeByToken() {
let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/checkVerifyCodeByToken";
return url;
}
... ...
... ... @@ -6,6 +6,8 @@ import { WDRouterRule } from '../router/WDRouterRule';
import { ContentConstants } from 'wdConstant';
import { common, Want } from '@kit.AbilityKit';
import { BusinessError } from '@kit.BasicServicesKit';
import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean';
import { AdvertsBean } from 'wdBean/src/main/ets/bean/adv/AdvertsBean';
// import { LiveModel } from '../viewmodel/LiveModel';
... ... @@ -16,6 +18,65 @@ const TAG = 'ProcessUtils';
*/
export class ProcessUtils {
/**
* 广告中心的业务广告跳转方法( 现用在挂角广告)
* @param advContent
*/
static openAdvDetail(matInfo: CompAdvMatInfoBean) {
if (matInfo == null) {
return;
}
// 优先openType,再取linkType
let type: string;
if (!StringUtils.isEmpty(matInfo.openType)) {
type = matInfo.openType;
} else {
type = matInfo.linkType;
}
if ('0' == type) {
// 0 :无链接
return;
}
let linkUrl: string = matInfo.linkUrl;
if (StringUtils.isEmpty(linkUrl)) {
return;
}
if ('1' == type) {
// 内链
let content: ContentDTO = {} as ContentDTO;
content.linkUrl = linkUrl;
ProcessUtils.gotoWeb(content);
} else if ('2' == type) {
// 外链
ProcessUtils.jumpExternalWebPage(linkUrl);
}
}
/**
* 展现中心的广告跳转 ( 现用在挂角广告)
* @param advert 展现中心的展现广告
*/
static advJumpMainPage(advert: AdvertsBean) {
let content: ContentDTO = {
linkUrl: advert.linkUrl,
pageId: advert.pageId,
objectId: advert.objectId,
objectType: advert.objectType,
relId: advert.relId,
bottomNavId: advert.bottomNavId
} as ContentDTO;
ProcessUtils.processPage(content);
}
/**
* 页面跳转
*/
static processPage(content: ContentDTO) {
... ... @@ -97,7 +158,7 @@ export class ProcessUtils {
* 图集详情页
* @param content
* */
public static gotoMultiPictureListPage(photoList: PhotoListBean[]) {
public static gotoMultiPictureListPage(photoList: PhotoListBean[]) {
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
... ...
... ... @@ -95,4 +95,8 @@ export interface CompAdvBean {
* 下一轮展示继续上面逻辑。
*/
displayRound: number;
}
... ...
... ... @@ -78,4 +78,6 @@ export interface ContentDTO {
titleShow?: number;
isSearch?: boolean; // 是否是搜索的结果,区分搜索和主页的数据
commentInfo?: commentInfo
//底部导航栏 id(用于频道跳转)
bottomNavId:string;
}
\ No newline at end of file
... ...
import {
NetworkUtil,
Logger,
NetworkType,
SPHelper,
} from 'wdKit';
import { NetworkUtil, Logger, NetworkType, SPHelper, } from 'wdKit';
import { ResponseDTO } from 'wdNetwork';
import {
ContentDetailDTO,
... ... @@ -68,7 +63,7 @@ export struct MultiPictureDetailPageComponent {
})
// 注册监听网络连接
let netStatus = NetworkUtil.isNetConnected()
if(netStatus) {
if (netStatus) {
// 有网络
this.getContentDetailData()
} else {
... ... @@ -270,8 +265,12 @@ export struct MultiPictureDetailPageComponent {
.height(px2vp(this.titleHeight) + 64)
}
if(this.netStatus !== undefined) {
EmptyComponent({ emptyType: $netStatus, emptyButton:true, retry: () => {this.getContentDetailData()}})
if (this.netStatus !== undefined) {
EmptyComponent({
emptyType: this.netStatus, emptyButton: true, retry: () => {
this.getContentDetailData()
}
})
.id('e_empty_content')
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
... ... @@ -307,35 +306,37 @@ export struct MultiPictureDetailPageComponent {
getContentDetailData() {
try {
PageRepository.fetchDetailData(this.relId, this.contentId, this.relType).then(async (resDTO: ResponseDTO<ContentDetailDTO[]>) => {
if (!resDTO || !resDTO.data) {
Logger.error(TAG, 'fetchDetailData is empty');
return
}
if (resDTO.code != 0) {
Logger.error(TAG, `fetchDetailData then code:${resDTO.code}, message:${resDTO.message}`);
return
}
this.netStatus = undefined
this.contentDetailData = resDTO.data?.[0];
// this.contentDetailData.photoList = []
if(this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length === 0) {
// 暂无内容
this.netStatus = 0
Logger.info(TAG, `this.netStatus:${JSON.stringify(this.netStatus)}`)
}
Logger.info(TAG, `contentDetailData:${JSON.stringify(this.contentDetailData)}`)
// 未登录,跳转登录
const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
if (user_id) {
this.getInteractBrowsOperate()
this.getBatchAttentionStatus()
}
}).catch((err: Error) => {
Logger.info(TAG, `fetchDetailData then,err: ${JSON.stringify(err)}`);
// 内容获取失败
this.netStatus = 9
})
PageRepository.fetchDetailData(this.relId, this.contentId, this.relType)
.then(async (resDTO: ResponseDTO<ContentDetailDTO[]>) => {
if (!resDTO || !resDTO.data) {
Logger.error(TAG, 'fetchDetailData is empty');
return
}
if (resDTO.code != 0) {
Logger.error(TAG, `fetchDetailData then code:${resDTO.code}, message:${resDTO.message}`);
return
}
this.netStatus = undefined
this.contentDetailData = resDTO.data?.[0];
// this.contentDetailData.photoList = []
if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length === 0) {
// 暂无内容
this.netStatus = 0
Logger.info(TAG, `this.netStatus:${JSON.stringify(this.netStatus)}`)
}
Logger.info(TAG, `contentDetailData:${JSON.stringify(this.contentDetailData)}`)
// 未登录,跳转登录
const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
if (user_id) {
this.getInteractBrowsOperate()
this.getBatchAttentionStatus()
}
})
.catch((err: Error) => {
Logger.info(TAG, `fetchDetailData then,err: ${JSON.stringify(err)}`);
// 内容获取失败
this.netStatus = 9
})
} catch (exception) {
}
... ...
... ... @@ -27,6 +27,7 @@ const TAG = 'Zh_Single_Row-06'
// operDataList: Array<operDataListItem>
// }
@Entry
@Component
export struct ZhSingleRow06 {
@State compDTO: CompDTO = {} as CompDTO
... ... @@ -44,9 +45,12 @@ export struct ZhSingleRow06 {
.textOverflow({overflow: TextOverflow.Ellipsis})
.lineHeight(23)
.fontSize(16)
.margin({bottom: 19})
.margin({bottom: 10})
.padding({bottom: 10})
.textAlign(TextAlign.Start)
.width('100%')
.border({width: {bottom: 1}})
.borderColor(0xf4f4f4)
Row() {
... ... @@ -98,8 +102,6 @@ export struct ZhSingleRow06 {
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.backgroundColor($r('app.color.white'))
.margin({ bottom: 8 })
.height(251)
}
@Builder
... ...
... ... @@ -14,6 +14,7 @@ import { CompParser } from '../CompParser';
import { CompDTO } from 'wdBean';
import PageHelper from '../../viewmodel/PageHelper';
import { channelSkeleton } from '../skeleton/channelSkeleton'
import { ProcessUtils } from 'wdRouter/Index';
const TAG = 'PageComponent';
... ... @@ -119,29 +120,71 @@ export struct PageComponent {
@Builder
pageHornAd() {
if (this.pageModel.isShowAds) {
if (this.pageModel.pageCornerAdv.matInfo != null) {
// 页面右边挂角
this.drawPageCornerAdvView(1, 1 == this.pageModel.isRightAdv)
} else if (this.pageModel.pageCornerContentInfo.advert != null) {
this.drawPageCornerAdvView(2, 1 == this.pageModel.isRightAdv)
}
}
if (this.pageModel.pageLeftCornerAdv.matInfo != null) {
}
// 页面左挂角
Image(this.pageModel.pageLeftCornerAdv.matInfo.matImageUrl[0])
.width($r('app.float.vp_80'))
.height($r('app.float.vp_80'))
.id("left_iv")
.alignRules({
bottom: { anchor: '__container__', align: VerticalAlign.Bottom },
left: { anchor: '__container__', align: HorizontalAlign.Start },
})
.margin({ bottom: "65vp", left: $r('app.float.card_comp_pagePadding_lf') })
/**
* 绘制页面挂角
*
* @param type 1:广告中心的挂角广告;2:展现中心的挂角广告
* @param isRightCorne true:右挂角;false:左挂角
*/
@Builder
drawPageCornerAdvView(type: number, isRightCorne: boolean) {
// 页面左挂角
Image(type === 1 ? this.pageModel.pageCornerAdv.matInfo.matImageUrl[0]
: this.pageModel.pageCornerContentInfo.advert.displayUrl)
.width($r('app.float.vp_80'))
.height($r('app.float.vp_80'))
.id("left_iv")
.alignRules({
bottom: { anchor: '__container__', align: VerticalAlign.Bottom },
left: { anchor: isRightCorne ? "" : '__container__', align: HorizontalAlign.Start },
right: { anchor: isRightCorne ? '__container__' : "", align: HorizontalAlign.End },
})
.margin({
bottom: "65vp",
left: isRightCorne ? 0 : $r('app.float.card_comp_pagePadding_lf'),
right: isRightCorne ? $r('app.float.card_comp_pagePadding_lf') : 0,
Image($r('app.media.icon_adv_horn_close')).id('left_close').width($r('app.float.vp_16')).alignRules({
})
.onClick(() => {
if (type === 1) {
// 广告业务跳转
ProcessUtils.openAdvDetail(this.pageModel.pageCornerAdv.matInfo);
} else {
// 展现中心的业务跳转
ProcessUtils.advJumpMainPage(this.pageModel.pageCornerContentInfo.advert)
}
})
// 关闭按钮
Image($r('app.media.icon_adv_horn_close'))
.id('left_close')
.width($r('app.float.vp_16'))
.alignRules({
top: { anchor: 'left_iv', align: VerticalAlign.Top },
left: { anchor: 'left_iv', align: HorizontalAlign.Start },
}).offset({
x: -10,
y: -10
left: { anchor: isRightCorne ? '' : 'left_iv', align: HorizontalAlign.Start },
right: { anchor: isRightCorne ? 'left_iv' : '', align: HorizontalAlign.End },
})
.offset({
x: isRightCorne ? 10 : -10,
y: isRightCorne ? -10 : -10
})
.onClick(() => {
// 关闭挂角广告
this.pageModel.isShowAds = false;
})
if (type == 1) {
Text($r('app.string.comp_advertisement'))
.width($r('app.float.vp_28'))
.height($r('app.float.vp_16'))
... ... @@ -150,7 +193,8 @@ export struct PageComponent {
.id('left_tag')
.alignRules({
bottom: { anchor: 'left_iv', align: VerticalAlign.Bottom },
left: { anchor: 'left_iv', align: HorizontalAlign.Start },
left: { anchor: isRightCorne ? '' : 'left_iv', align: HorizontalAlign.Start },
right: { anchor: isRightCorne ? 'left_iv' : '', align: HorizontalAlign.End },
})
.textAlign(TextAlign.Center)
.backgroundColor($r('app.color.res_color_general_000000_30'))
... ... @@ -162,60 +206,6 @@ export struct PageComponent {
})
}
if (this.pageModel.pageRightCornerAdv.matInfo != null && this.pageModel.isShowRightAds) {
// 页面右边挂角
Image(this.pageModel.pageRightCornerAdv.matInfo.matImageUrl[0])
.width($r('app.float.vp_80'))
.height($r('app.float.vp_80'))
.id("right_iv")
.alignRules({
bottom: { anchor: '__container__', align: VerticalAlign.Bottom },
right: { anchor: '__container__', align: HorizontalAlign.End },
})
.margin({ bottom: "65vp", right: $r('app.float.card_comp_pagePadding_lf') })
.onClick(()=>{
// 关闭挂角广告
this.pageModel.isShowLeftAds = false;
})
Image($r('app.media.icon_adv_horn_close'))
.id('right_close')
.width($r('app.float.vp_16'))
.alignRules({
top: { anchor: 'right_iv', align: VerticalAlign.Top },
right: { anchor: 'right_iv', align: HorizontalAlign.End },
})
.offset({
x: 10,
y: -10
})
.onClick(() => {
// 关闭挂角广告
this.pageModel.isShowRightAds = false;
})
Text($r('app.string.comp_advertisement'))
.width($r('app.float.vp_28'))
.height($r('app.float.vp_16'))
.fontSize($r('app.float.font_size_10'))
.fontColor(Color.White)
.id('right_tag')
.alignRules({
bottom: { anchor: 'right_iv', align: VerticalAlign.Bottom },
right: { anchor: 'right_iv', align: HorizontalAlign.End },
})
.textAlign(TextAlign.Center)
.backgroundColor($r('app.color.res_color_general_000000_30'))
.borderRadius({
topLeft: $r('app.float.vp_2'),
topRight: $r('app.float.vp_2'),
bottomLeft: $r('app.float.vp_2'),
bottomRight: $r('app.float.vp_2')
})
}
}
async aboutToAppear() {
... ...
... ... @@ -192,7 +192,8 @@ export struct SearchResultContentComponent{
rmhPlatform: 0,
newTags: '',
isSearch: true,
publishTimestamp:""
publishTimestamp:"",
bottomNavId:'',
}
this.data.push(contentDTO)
... ...
... ... @@ -3,6 +3,8 @@ import { EmptyComponent } from '../view/EmptyComponent'
@Entry
@Component
export struct DefaultPage {
@State type: number = 1
retry() {
console.log('daj点击了重试')
}
... ... @@ -10,10 +12,14 @@ export struct DefaultPage {
build() {
Row() {
EmptyComponent({
emptyType: 8, emptyButton: true, retry: () => {
emptyType: this.type,
emptyButton: true,
retry: () => {
this.retry()
}
})
// .height('612lpx')
// .width('100%')
}
}
}
\ No newline at end of file
... ...
... ... @@ -7,39 +7,39 @@ const TAG = 'EmptyComponent';
* WDViewDefaultType 缺省页
*/
export const enum WDViewDefaultType {
/// 1.默认
/// 0.默认
WDViewDefaultType_Default,
/// 2.无网
/// 1.无网
WDViewDefaultType_NoNetwork,
/// 3.暂无内容(列表页)
/// 2.暂无内容(列表页)
WDViewDefaultType_NoListContent,
/// 4.内容找不到了(内容详情页)
/// 3.内容找不到了(内容详情页)
WDViewDefaultType_NoContent,
/// 5.无搜索内容
/// 4.无搜索内容
WDViewDefaultType_NoSearchResult,
/// 6.无消息内容
/// 5.无消息内容
WDViewDefaultType_NoMessage,
/// 7.无收藏内容
/// 6.无收藏内容
WDViewDefaultType_NoCollection,
/// 8.无历史记录
/// 7.无历史记录
WDViewDefaultType_NoHistory,
/// 9.网络失败 请稍后重试-倒计时
/// 8.网络失败 请稍后重试-倒计时
WDViewDefaultType_NetworkFailed,
/// 10.内容获取失败
/// 9.内容获取失败
WDViewDefaultType_ContentFailed,
/// 11.无预约内容
/// 10.无预约内容
WDViewDefaultType_NoBooking,
/// 12.无评论内容
/// 11.无评论内容
WDViewDefaultType_NoComment,
/// 13.暂无作品
/// 12.暂无作品
WDViewDefaultType_NoCreation,
/// 14.该号主无法访问
/// 13.该号主无法访问
WDViewDefaultType_NoVisitAccount,
/// 15.暂无关注
/// 14.暂无关注
WDViewDefaultType_NoFollow,
/// 18.视频加载失败
/// 15.视频图集加载失败
WDViewDefaultType_NoVideo,
/// 19.暂无内容1
/// 16.暂无内容1
WDViewDefaultType_NoContent1,
}
... ... @@ -52,7 +52,7 @@ export struct EmptyComponent {
// private emptySize: SizeOptions = {};
@State emptyWidth: string | number = CommonConstants.FULL_PARENT;
@State emptyHeight: string | number = CommonConstants.FULL_PARENT;
@Link emptyType: number
@State emptyType: number = WDViewDefaultType.WDViewDefaultType_Default; // 缺省图类型,传枚举
@State emptyButton: boolean = false
@State timeNum: number = 10
/**
... ... @@ -127,8 +127,8 @@ export struct EmptyComponent {
// .height(this.EMPTY_IMAGE_HEIGHT)
Text(this.emptyType !== 8 ? this.buildNoDataTip() : `${this.buildNoDataTip()}(${this.timeNum}s)`)
.fontSize($r('app.float.normal_text_size'))
.fontColor('#000000')
.fontSize($r('app.float.font_size_14'))
.fontColor('#FF999999')
.fontWeight(FontWeight.Normal)
.opacity(this.TEXT_OPACITY)
.margin({ top: this.EMPTY_TIP_TEXT_MARGIN_TOP })
... ... @@ -136,26 +136,47 @@ export struct EmptyComponent {
Logger.info(TAG, `noProgrammeData onClick event?.source: ${event.source}`);
})
if (this.emptyButton) {
Button('点击重试')
.type(ButtonType.Normal)
.width(80)
.height(28)
.backgroundColor('#fffffff')
.fontColor('#FF666666')
.border({ width: 1 })
.borderColor('#FFEDEDED')
.fontSize($r('app.float.font_size_12'))
.margin({ top: 16 })
.padding(0)
.onClick(() => {
this.retry()
})
if (this.isShowButton()) {
if (this.emptyType !== 15) {
Button('点击重试')
.type(ButtonType.Normal)
.width(80)
.height(28)
.backgroundColor('#fffffff')
.fontColor('#FF666666')
.border({ width: 1 })
.borderColor('#FFEDEDED')
.borderRadius(4)
.fontSize($r('app.float.font_size_12'))
.margin({ top: 16 })
.padding(0)
.onClick(() => {
this.retry()
})
} else {
Button('点击重试')
.type(ButtonType.Normal)
.width(80)
.height(28)
.backgroundColor(Color.Black)
.fontColor('#FFCCCCCC')
.border({ width: 1 })
.borderColor('#4DFFFFFF')
.borderRadius(4)
.fontSize($r('app.float.font_size_12'))
.margin({ top: 16 })
.padding(0)
.onClick(() => {
this.retry()
})
}
}
}
.justifyContent(FlexAlign.Center)
.width(this.emptyWidth)
.height(this.emptyHeight)
// .backgroundColor(Color.Black)
}
buildNoDataTip(): string {
... ... @@ -224,4 +245,12 @@ export struct EmptyComponent {
}
return imageString
}
}
\ No newline at end of file
isShowButton() {
if (this.emptyType === 1 || this.emptyType === 9 || this.emptyType === 15) {
return true
} else {
return false
}
}
}
... ...
... ... @@ -7,13 +7,12 @@ const TAG = 'LiveEmptyComponent';
* WDViewDefaultType 缺省页
*/
export const enum WDViewDefaultType {
/// 1.默认
/// 1.默认
WDViewDefaultType_Default,
/// 16.直播结束
WDViewDefaultType_NoLiveEnd,
/// 17.直播暂停
WDViewDefaultType_NoLiveSuspend,
}
/**
... ... @@ -21,11 +20,13 @@ export const enum WDViewDefaultType {
*/
@Preview
@Component
export struct LiveEmptyComponent {
export struct EmptyComponent {
// private emptySize: SizeOptions = {};
@State emptyWidth: string | number = CommonConstants.FULL_PARENT;
@State emptyHeight: string | number = CommonConstants.FULL_PARENT;
@State emptyType: number = WDViewDefaultType.WDViewDefaultType_Default
@State emptyType: number = WDViewDefaultType.WDViewDefaultType_Default; // 缺省图类型,传枚举
@State emptyButton: boolean = false
@State timeNum: number = 10
/**
* The empty image width percentage setting.
*/
... ... @@ -42,6 +43,42 @@ export struct LiveEmptyComponent {
* The empty data text opacity.
*/
readonly TEXT_OPACITY: number = 0.4;
private timer: number = -1
retry: () => void = () => {
}
createTimer() {
if (this.emptyType === 8) {
this.timer = setInterval(() => {
this.timeNum--;
if (this.timeNum === 0) {
clearInterval(this.timer);
}
}, 1000);
}
}
destroyTimer() {
if (this.emptyType === 8) {
clearInterval(this.timer);
}
}
onPageShow(): void {
this.createTimer()
}
aboutToAppear(): void {
this.createTimer()
}
onPageHide(): void {
this.destroyTimer()
}
aboutToDisappear() {
this.destroyTimer()
}
build() {
this.noProgrammeData();
... ... @@ -54,24 +91,64 @@ export struct LiveEmptyComponent {
noProgrammeData() {
Column() {
Image(this.buildNoDataTipImage())
.width('this.EMPTY_IMAGE_WIDTH')
.height(this.EMPTY_IMAGE_HEIGHT)
.width(160)
.height(112)
.objectFit(ImageFit.Contain)
// .border({ width: 1, color: Color.Red, radius: 6 })
// .width('this.EMPTY_IMAGE_WIDTH')
// .height(this.EMPTY_IMAGE_HEIGHT)
Text(this.buildNoDataTip())
.fontSize($r('app.float.normal_text_size'))
.fontColor('#000000')
Text(this.emptyType !== 8 ? this.buildNoDataTip() : `${this.buildNoDataTip()}(${this.timeNum}s)`)
.fontSize($r('app.float.font_size_14'))
.fontColor('#FF999999')
.fontWeight(FontWeight.Normal)
.opacity(this.TEXT_OPACITY)
.margin({ top: this.EMPTY_TIP_TEXT_MARGIN_TOP })
.onClick((event: ClickEvent) => {
Logger.info(TAG, `noProgrammeData onClick event?.source: ${event.source}`);
})
if (this.isShowButton()) {
if (this.emptyType !== 15) {
Button('点击重试')
.type(ButtonType.Normal)
.width(80)
.height(28)
.backgroundColor('#fffffff')
.fontColor('#FF666666')
.border({ width: 1 })
.borderColor('#FFEDEDED')
.borderRadius(4)
.fontSize($r('app.float.font_size_12'))
.margin({ top: 16 })
.padding(0)
.onClick(() => {
this.retry()
})
} else {
Button('点击重试')
.type(ButtonType.Normal)
.width(80)
.height(28)
.backgroundColor(Color.Black)
.fontColor('#FFCCCCCC')
.border({ width: 1 })
.borderColor('#4DFFFFFF')
.borderRadius(4)
.fontSize($r('app.float.font_size_12'))
.margin({ top: 16 })
.padding(0)
.onClick(() => {
this.retry()
})
}
}
}
.justifyContent(FlexAlign.Center)
.width(this.emptyWidth)
.height(this.emptyHeight)
// .backgroundColor(Color.Black)
}
buildNoDataTip(): string {
... ... @@ -84,15 +161,22 @@ export struct LiveEmptyComponent {
}
return contentString
}
buildNoDataTipImage(): Resource | string {
Logger.info(TAG, "buildNoDataTip");
let imageString: Resource | string = $r('app.media.icon_no_content')
if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoLiveEnd) {
if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoLiveEnd) {
imageString = $r('app.media.icon_no_end')
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoLiveSuspend) {
imageString = $r('app.media.icon_no_liver')
}
return imageString
}
}
\ No newline at end of file
isShowButton() {
if (this.emptyType === 1 || this.emptyType === 9 || this.emptyType === 15) {
return true
} else {
return false
}
}
}
... ...
... ... @@ -121,35 +121,6 @@ export struct LiveHorizontalCardComponent {
}
async gotoLive(content: ContentDTO) {
const liveDetail = await LiveModel.getLiveDetails(content?.objectId || '', content?.relId || '', content?.relType || '')
if (content && content.objectType) {
if (content.objectType === ContentConstants.TYPE_LIVE) {
if (liveDetail && liveDetail[0] && liveDetail[0].liveInfo) {
const liveStyle = liveDetail[0].liveInfo.liveStyle
const liveState = liveDetail[0].liveInfo.liveState
console.error('liveDetail===', liveDetail)
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
detailPageType: 2,
contentID: content?.objectId,
liveStyle: liveState === 'wait' ? 0 : liveStyle,
extra: {
relType: content?.relType,
relId: content?.relId,
} as ExtraDTO
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
// Logger.debug(TAG, `gotoLive, ${content.objectId}`);
}
} else if (content.objectType === ContentConstants.TYPE_TELETEXT) {
ProcessUtils.processPage(content)
}
}
ProcessUtils.processPage(content)
}
}
\ No newline at end of file
... ...
... ... @@ -64,29 +64,49 @@ export class PageHelper {
// 优先展示展现中心广告
let cornersAdv = pageInfo.cornersAdv
if (cornersAdv == null) {
return
}
if (cornersAdv.advert == null) {
return
}
if ("left_down" == cornersAdv.pos) {
// 左边挂角广告
pageModel.isRightAdv = 2
} else {
// 右边挂角广告
pageModel.isRightAdv = 1
}
pageModel.pageCornerContentInfo = cornersAdv;
pageModel.isShowAds = true
} else if (pageInfo.cornersAdv2 != null && pageInfo.cornersAdv2.length > 0) {
// 广告中心-挂角广告信息
let cornersAdv2 = pageInfo.cornersAdv2
// 获取
let showCompAdvBean = cornersAdv2[0]
if (showCompAdvBean.matInfo == null) {
return
}
//
let slotInfo = showCompAdvBean.slotInfo;
let postion = slotInfo.position
if (postion == 0) {
//左边挂角
pageModel.pageLeftCornerAdv = showCompAdvBean
pageModel.isShowLeftAds = true
pageModel.isRightAdv = 2
} else {
// 右边挂角
pageModel.pageRightCornerAdv = showCompAdvBean
pageModel.isShowRightAds = true
pageModel.isRightAdv = 1
}
Logger.error("XXX", JSON.stringify(pageInfo.cornersAdv2))
pageModel.pageCornerAdv = showCompAdvBean
pageModel.isShowAds = true
}
}
... ...
... ... @@ -4,7 +4,7 @@ import { ViewType } from 'wdConstant/src/main/ets/enum/ViewType';
import { RefreshConstants as Const } from '../utils/RefreshConstants';
import { PageUIReqBean } from '../components/page/bean/PageUIReqBean';
import { GroupInfoDTO, PageInfoDTO } from 'wdBean/src/main/ets/bean/navigation/PageInfoDTO';
import { CompAdvBean } from 'wdBean/src/main/ets/bean/adv/AdvsRuleBean';
import { AdvRuleBean, CompAdvBean } from 'wdBean/src/main/ets/bean/adv/AdvsRuleBean';
/**
* 页面下拉刷新、上拉加载数据bean。
... ... @@ -52,12 +52,10 @@ export default class PageModel {
timestamp: String = '1';
//左右挂角广告对象
pageLeftCornerAdv:CompAdvBean = {} as CompAdvBean
isShowLeftAds : boolean = true;
pageRightCornerAdv:CompAdvBean = {} as CompAdvBean
isShowRightAds : boolean = true;
pageCornerAdv:CompAdvBean = {} as CompAdvBean // 挂角广告
isShowAds : boolean = false;
isRightAdv : number = 1;// 1:右边;2:左边 -> 默认右边
pageCornerContentInfo:AdvRuleBean = {} as AdvRuleBean // 展现中心业务信息
/**
... ...
... ... @@ -5,6 +5,8 @@ import router from '@ohos.router';
import { DetailPlayLivePage } from './DetailPlayLivePage'
import { DetailPlayVLivePage } from './DetailPlayVLivePage'
const TAG = 'DetailPlayLiveCommon'
@Entry()
@Component
export struct DetailPlayLiveCommon {
... ... @@ -47,7 +49,7 @@ export struct DetailPlayLiveCommon {
this.liveDetailsBean = data[0]
this.liveState = this.liveDetailsBean.liveInfo?.liveState
this.liveStyle = this.liveDetailsBean.liveInfo.liveStyle
console.error('liveDetailsBean===', JSON.stringify((this.liveDetailsBean)))
console.log(TAG, 'getLiveDetails:', JSON.stringify((this.liveDetailsBean)))
}
},
() => {
... ...
... ... @@ -8,11 +8,11 @@ import { WDPlayerController } from 'wdPlayer/Index';
import { DisplayDirection } from 'wdConstant/Index';
const storage = LocalStorage.getShared();
const TAG = 'DetailPlayVLivePage'
@Entry(storage)
@Component
export struct DetailPlayVLivePage {
TAG: string = 'DetailPlayVLivePage';
private liveViewModel: LiveViewModel = new LiveViewModel()
private playerController: WDPlayerController = new WDPlayerController();
private swiperController: SwiperController = new SwiperController()
... ... @@ -29,6 +29,7 @@ export struct DetailPlayVLivePage {
@State swiperIndex: number = 1
aboutToAppear(): void {
console.log(TAG, 'aboutToAppear')
WindowModel.shared.setWindowLayoutFullScreen(true)
WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff', })
... ... @@ -86,11 +87,11 @@ export struct DetailPlayVLivePage {
if (data.length > 0) {
this.liveDetailsBean = data[0]
this.liveState = this.liveDetailsBean.liveInfo?.liveState
console.error('liveDetailsBean===', JSON.stringify((this.liveDetailsBean)))
console.log(TAG, 'getLiveDetails', JSON.stringify((this.liveDetailsBean)))
}
},
() => {
(message: string) => {
console.error(TAG, 'getLiveDetails catch', message)
})
}
... ... @@ -99,9 +100,10 @@ export struct DetailPlayVLivePage {
.then(
(data) => {
this.liveRoomDataBean = data
console.log(TAG, 'getLiveRoomData', JSON.stringify((this.liveRoomDataBean)))
},
() => {
(message: string) => {
console.error(TAG, 'getLiveDetails catch', message)
})
}
}
... ...
import { LiveDetailsBean } from 'wdBean/Index';
import { WDPlayerController, WDPlayerRenderVLiveView, WDPlayerRenderView } from 'wdPlayer/Index';
import componentUtils from '@ohos.arkui.componentUtils';
const TAG = 'PlayerComponent'
@Component
export struct PlayerComponent {
private playerController?: WDPlayerController;
// playerController: WDPlayerController = new WDPlayerController();
@Consume @Watch('updateData') liveDetailsBean: LiveDetailsBean
@Consume @Watch('pageShowChange') pageShow: number
@Consume @Watch('pageHideChange') pageHide: number
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
@State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
@State imgUrl: string = ''
... ... @@ -15,7 +16,16 @@ export struct PlayerComponent {
@State liveStreamType: number | null = -1
@State playUrl: string = ''
pageShowChange() {
this.playerController?.play()
}
pageHideChange() {
this.playerController?.pause()
}
aboutToAppear(): void {
console.log(TAG, 'aboutToAppear')
if (this.playerController) {
this.playerController.onCanplay = () => {
console.log('可以播放了')
... ... @@ -33,7 +43,6 @@ export struct PlayerComponent {
}
updateData() {
console.error('updateData=============')
//直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停
if (this.liveDetailsBean.fullColumnImgUrls && this.liveDetailsBean.fullColumnImgUrls.length > 0) {
this.imgUrl = this.liveDetailsBean.fullColumnImgUrls[0].url
... ...
... ... @@ -32,19 +32,32 @@ export struct DetailPlayShortVideoPage {
@Provide followStatus: string = '0' // 关注状态
@Provide isOpenDetail: boolean = false // 查看详情按钮点击
@Provide isDragging: boolean = false // 拖动时间进度条
@Consume @Watch('videoStatusChange') switchVideoStatus: boolean
@Consume @Watch('pageShowChange') pageShow: number
@Consume @Watch('pageHideChange') pageHide: number
/**
* 页面显示重查用户关注、点赞等信息
*/
pageShowChange() {
if (this.currentIndex === this.index && this.playerController.getStatus() === PlayerConstants.STATUS_PAUSE) {
this.playerController.play()
if (this.currentIndex === this.index) {
this.queryNewsInfoOfUser()
if (this.switchVideoStatus) {
this.playerController.play()
}
}
}
pageHideChange() {
if (this.currentIndex === this.index && this.playerController.getStatus() === PlayerConstants.STATUS_START) {
this.playerController.pause()
/**
* 频道切换视频暂停、播放
* 页面显隐视频暂停、播放
*/
videoStatusChange() {
if (this.currentIndex === this.index) {
if (this.switchVideoStatus) {
this.playerController.play()
} else {
this.playerController.pause()
}
}
}
... ...
... ... @@ -22,12 +22,12 @@ export struct DetailVideoListPage {
@Provide showComment: boolean = true
@Provide pageShow: number = -1
@Provide pageHide: number = -1
@Provide switchVideoStatus: boolean = false
@State data: ContentDetailDTO[] = []
@State testData: string[] = ['111', '222', '333']
@State currentIndex: number = 0
@State interactDataList: InteractDataDTO[] = []
@State isFullScreen: boolean = false
@State switchVideoStatus: boolean = false
async aboutToAppear(): Promise<void> {
this.openFullScreen()
... ... @@ -57,13 +57,14 @@ export struct DetailVideoListPage {
onPageShow(): void {
console.log(TAG, 'onPageShow')
this.pageShow = Math.random()
this.switchVideoStatus = true
this.openFullScreen()
}
onPageHide(): void {
console.log(TAG, 'onPageHide')
this.pageHide = Math.random()
this.switchVideoStatus = false
this.closeFullScreen()
}
... ...
import { Action, ContentDetailDTO, InteractDataDTO } from 'wdBean/Index';
import { ContentDetailDTO, InteractDataDTO } from 'wdBean/Index';
import { ContentDetailRequest } from 'wdDetailPlayApi/Index'
import { ResponseDTO } from 'wdNetwork/Index';
import { DetailPlayShortVideoPage } from './DetailPlayShortVideoPage'
// import { Test } from './Test'
import router from '@ohos.router';
import window from '@ohos.window';
import {
WDViewDefaultType,
EmptyComponent
} from '../../../../../wdComponent/src/main/ets/components/view/EmptyComponent'
import {
batchContentDetailParams,
compListItem,
contentListParams,
contentsItem,
getRecCompInfoParams
} from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest';
import { Logger, WindowModel } from 'wdKit/Index';
import { BusinessError } from '@kit.BasicServicesKit';
import { PictureLoading } from './PictureLoading';
interface loadMoreData {
... ... @@ -23,8 +21,6 @@ interface loadMoreData {
}
const TAG = 'VideoChannelDetail'
let timer: number = -1
const storage = LocalStorage.getShared();
@Entry(storage)
... ... @@ -46,36 +42,44 @@ export struct VideoChannelDetail {
private swiperController: SwiperController = new SwiperController()
@Provide showComment: boolean = false
@Provide windowWidth: number = AppStorage.get<number>('windowWidth') || 0
@Consume @Watch('pageShowChange') pageShow: number
@Consume @Watch('pageHideChange') pageHide: number
@Provide switchVideoStatus: boolean = false
@State data: ContentDetailDTO[] = []
@State currentIndex: number = 0
@State interactDataList: InteractDataDTO[] = []
@State totalCount: number = 0
@State switchVideoStatus: boolean = false
@State isMouted: boolean = false
@State isRequestError: boolean = false
pageShowChange() {
if (this.bottomNavIndex === 2 && this.topNavIndex === 0) {
this.barBackgroundColor = Color.Black
this.switchVideoStatus = true
this.openFullScreen()
}
}
pageHideChange() {
this.barBackgroundColor = Color.Transparent
this.switchVideoStatus = false
this.closeFullScreen()
}
/**
* 监听视频频道激活或失活
*/
navIndexChange() {
// if (timer) clearTimeout(timer)
console.log('navIndexChange', this.bottomNavIndex, this.topNavIndex)
// timer = setTimeout(() => {
if (this.bottomNavIndex === 2 && this.topNavIndex === 0) {
// 如果视频在暂停则播放视频
this.switchVideoStatus = true
this.barBackgroundColor = Color.Black
this.switchVideoStatus = true
this.openFullScreen()
} else {
// 如果视频在播放则暂停视频
this.switchVideoStatus = false
this.barBackgroundColor = Color.Transparent
this.switchVideoStatus = false
this.closeFullScreen()
}
// timer = -1
// }, 100)
}
aboutToAppear() {
... ... @@ -90,16 +94,6 @@ export struct VideoChannelDetail {
Logger.info(TAG, 'aboutToDisappear');
}
onPageShow(): void {
this.openFullScreen()
Logger.info(TAG, 'onPageShow');
}
onPageHide(): void {
this.closeFullScreen()
Logger.info(TAG, 'onPageHide');
}
/**
* 开启沉浸式
* TODO:颜色待根据业务接口修改
... ... @@ -152,6 +146,7 @@ export struct VideoChannelDetail {
}
await ContentDetailRequest.getRecCompInfo(params).then(res => {
this.isRequestError = false
console.log('根据视频频道传参查询视频楼层信息totalCount', res.data?.totalCount + '')
this.totalCount = res.data?.totalCount || 0
... ... @@ -185,6 +180,9 @@ export struct VideoChannelDetail {
this.isMouted = true
}, 500)
}).catch(() => {
// 获取内容失败请重试
this.isRequestError = true
})
}
... ... @@ -214,41 +212,51 @@ export struct VideoChannelDetail {
build() {
Column() {
PictureLoading().visibility(this.isMouted ? Visibility.None : Visibility.Visible)
Swiper(this.swiperController) {
ForEach(this.data, (item: ContentDetailDTO, index: number) => {
Column() {
DetailPlayShortVideoPage({
contentDetailData: item,
currentIndex: this.currentIndex,
index: index,
interactData: this.interactDataList[index]
})
}.width('100%')
.height('100%')
}, (item: ContentDetailDTO) => item.newsId + '')
}
.visibility(this.isMouted ? Visibility.Visible : Visibility.None)
.cachedCount(-1)
.indicator(false)
.vertical(true)
.loop(false)
.width('100%')
.height('100%')
// 扩展至所有非安全区域
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
.onChange((index: number) => {
this.currentIndex = index
console.info('onChange==', index.toString())
if (this.isRequestError) {
EmptyComponent({
emptyType: WDViewDefaultType.WDViewDefaultType_NoVideo,
retry: () => {
this.getRecCompInfo()
}
})
} else {
if (this.currentIndex === this.data.length - 1) {
this.pageNum++
this.refreshTime = new Date().getTime()
this.loadStrategy = 'push_up'
this.getRecCompInfo()
PictureLoading().visibility(this.isMouted ? Visibility.None : Visibility.Visible)
Swiper(this.swiperController) {
ForEach(this.data, (item: ContentDetailDTO, index: number) => {
Column() {
DetailPlayShortVideoPage({
contentDetailData: item,
currentIndex: this.currentIndex,
index: index,
interactData: this.interactDataList[index]
})
}.width('100%')
.height('100%')
}, (item: ContentDetailDTO) => item.newsId + '')
}
})
.visibility(this.isMouted ? Visibility.Visible : Visibility.None)
.cachedCount(-1)
.indicator(false)
.vertical(true)
.loop(false)
.width('100%')
.height('100%')
// 扩展至所有非安全区域
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
.onChange((index: number) => {
this.currentIndex = index
console.info('onChange==', index.toString())
if (this.currentIndex === this.data.length - 1) {
this.pageNum++
this.refreshTime = new Date().getTime()
this.loadStrategy = 'push_up'
this.getRecCompInfo()
}
})
}
}
.width('100%')
.height('100%')
... ...
... ... @@ -9,6 +9,14 @@
"value": "14fp"
},
{
"name": "font_size_12",
"value": "12fp"
},
{
"name": "normal_text_size",
"value": "16fp"
},
{
"name": "title_popup_image_size",
"value": "24vp"
},
... ...
... ... @@ -96,6 +96,16 @@ struct ForgetPasswordPage {
if (this.isEmpty(this.phoneContent)) {
return
}
if(this.pageType == 1){
this.loginViewModel.sendVerifyCodeByToken().then(()=>{
promptAction.showToast({ message: "验证码已发送成功" })
}).catch((message: string)=>{
promptAction.showToast({ message: message })
})
return
}
this.loginViewModel.sendVerifyCode(this.phoneContent).then((verifyCode) => {
promptAction.showToast({ message: "验证码已发送成功" })
Logger.debug(TAG, "sendVerifyCode: " + verifyCode)
... ... @@ -115,7 +125,20 @@ struct ForgetPasswordPage {
if (this.isEmpty(this.codeContent)) {
return
}
if(this.pageType == 1){
this.loginViewModel.checkVerifyCodeByToken(this.codeContent).then(()=>{
let params: SettingPasswordParams = {
pageID:'1',
phoneContent:this.phoneContent,
codeContent:this.codeContent,
pageType:this.pageType
}
WDRouterRule.jumpWithPage(WDRouterPage.settingPasswordPage, params)
}).catch((message: string)=>{
promptAction.showToast({ message: message })
})
return
}
this.loginViewModel.checkVerifyCode(this.phoneContent, this.codeContent).then(() => {
let params: SettingPasswordParams = {
pageID:'1',
... ...
... ... @@ -41,9 +41,9 @@ export class LoginModel {
let bean: Record<string, string> = {};
// bean['phoneNum'] = number
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return new Promise<string>((success, fail) => {
HttpRequest.post<ResponseDTO<string>>(HttpUrlUtils.getVerifyCodeByTokenUrl(), bean, headers).then((data: ResponseDTO<string>) => {
if (!data || !data.data) {
return new Promise<object>((success, fail) => {
HttpBizUtil.post<ResponseDTO<object>>(HttpUrlUtils.getVerifyCodeByTokenUrl(),bean, headers).then((data: ResponseDTO<object>) => {
if (!data) {
fail("数据为空")
return
}
... ... @@ -51,7 +51,7 @@ export class LoginModel {
fail(data.message)
return
}
success(data.data)
success(data)
}, (error: Error) => {
fail(error.message)
Logger.debug("LoginViewModel:error ", error.toString())
... ... @@ -148,9 +148,9 @@ export class LoginModel {
// bean['phone'] = phone
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return new Promise<CheckVerifyBean>((success, fail) => {
HttpRequest.post<ResponseDTO<CheckVerifyBean>>(HttpUrlUtils.getCheckVerifyByTokenCodeUrl(), bean, headers).then((data: ResponseDTO<CheckVerifyBean>) => {
HttpRequest.post<ResponseDTO<CheckVerifyBean>>(HttpUrlUtils.getCheckVerifyCodeByToken(), bean, headers).then((data: ResponseDTO<CheckVerifyBean>) => {
Logger.debug("LoginViewModel:success2 ", data.message)
if (!data || !data.data) {
if (!data) {
fail("数据为空")
return
}
... ... @@ -158,7 +158,9 @@ export class LoginModel {
fail(data.message)
return
}
success(data.data)
if(data.data){
success(data.data)
}
}, (error: Error) => {
Logger.debug("LoginViewModel:error2 ", error.toString())
fail(error.message)
... ...
... ... @@ -33,7 +33,7 @@ export class LoginViewModel {
}
sendVerifyCodeByToken() {
return new Promise<string>((success, fail) => {
return new Promise<object>((success, fail) => {
this.loginModel.sendVerifyCodeByToken().then((data) => {
success(data)
}).catch((message: string) => {
... ... @@ -55,7 +55,6 @@ export class LoginViewModel {
SPHelper.default.save(SpConstants.USER_STATUS, data.status)
SPHelper.default.save(SpConstants.USER_Type, data.userType)
SPHelper.default.save(SpConstants.USER_NAME, data.userName)
SPHelper.default.save(SpConstants.USER_PHONE, phone)
HttpUrlUtils.setUserId(data.id+"")
HttpUrlUtils.setUserType(data.userType+"")
HttpUrlUtils.setUserToken(data.jwtToken)
... ... @@ -80,7 +79,6 @@ export class LoginViewModel {
SPHelper.default.save(SpConstants.USER_STATUS, data.status)
SPHelper.default.save(SpConstants.USER_Type, data.userType)
SPHelper.default.save(SpConstants.USER_NAME, data.userName)
SPHelper.default.save(SpConstants.USER_PHONE, phone)
HttpUrlUtils.setUserId(data.id+"")
HttpUrlUtils.setUserType(data.userType+"")
HttpUrlUtils.setUserToken(data.jwtToken)
... ...