陈剑华

Merge remote-tracking branch 'origin/main'

Showing 100 changed files with 1167 additions and 268 deletions

Too many changes to show.

To preserve performance only 100 of 100+ files are displayed.

... ... @@ -47,4 +47,5 @@ export class SpConstants{
//游客状态下首次评论时间
static FIRSTCOMMENTTIME = 'firstCommentTime'
static TOURIST_NICK_NAME = 'touristNickName'
}
\ No newline at end of file
... ...
... ... @@ -135,6 +135,14 @@ export class HttpUrlUtils {
*/
static readonly APPOINTMENT_ExecuteCollcet_PATH: string = "/api/rmrb-interact/interact/zh/c/collect/executeCollcetRecord";
/**
* 个人中心 - 消息
*/
static readonly APPOINTMENT_MessageList_PATH: string = "/api/rmrb-inside-mail/zh/c/inside-mail/private";
/**
* 个人中心 - 消息 点赞数
*/
static readonly APPOINTMENT_getMessageLikeCount_PATH: string = "/api/rmrb-inside-mail/zh/c/inside-mail/private/getLikeCount";
/**
* 个人中心 我的评论列表
*/
static readonly MINE_COMMENT_LIST_DATA_PATH: string = "/api/rmrb-comment/comment/zh/c/myCommentList";
... ... @@ -316,6 +324,10 @@ export class HttpUrlUtils {
*/
static readonly FEEDBACK_TYPE_PATH: string = "/api/rmrb-interact/interact/c/user/optionClassify/list";
/**
* 查询点赞、回复我的、系统消息的未读数量以及回复/评论人
*/
static readonly MESSAGE_UN_READ_DATA_PATH: string = "/api/rmrb-inside-mail/zh/c/inside-mail/private/polymerizationInfo?createTime=";
static getHost(): string {
return HostManager.getHost();
... ... @@ -478,6 +490,16 @@ export class HttpUrlUtils {
return url
}
static getMessageListDataUrl() {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.APPOINTMENT_MessageList_PATH
return url
}
static getMessageLikeCount() {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.APPOINTMENT_getMessageLikeCount_PATH
return url
}
static getExecuteCollcetUrl() {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.APPOINTMENT_ExecuteCollcet_PATH
return url
... ... @@ -714,4 +736,14 @@ export class HttpUrlUtils {
return url;
}
}
\ No newline at end of file
//获取消息未读接口
static getMessageUnReadDataUrl() {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.MESSAGE_UN_READ_DATA_PATH
return url
}
static reportDeviceInfo() {
let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/common/user/c/device/push";
return url;
}
}
... ...
... ... @@ -136,4 +136,9 @@ export class WDRouterPage {
//意见反馈
static feedBackActivity = new WDRouterPage("wdComponent", "ets/components/FeedBackActivity");
// 人民号主页头像显示
static showHomePageHeaderPage = new WDRouterPage("wdComponent", "ets/pages/ShowHomePageHeaderPage");
}
... ...
... ... @@ -55,7 +55,7 @@ export struct WdWebLocalComponent {
.mixedMode(MixedMode.All)
.onlineImageAccess(true)
.enableNativeEmbedMode(true)
.layoutMode(WebLayoutMode.FIT_CONTENT)
// .layoutMode(WebLayoutMode.FIT_CONTENT)
// .nestedScroll({ scrollForward: NestedScrollMode.SELF_FIRST, scrollBackward: NestedScrollMode.PARENT_FIRST })
.height(this.webHeight)
.onPageBegin((event) => {
... ...
... ... @@ -69,6 +69,7 @@ export struct DynamicDetailComponent {
@State isNetConnected: boolean = true
@State isPageEnd: boolean = false
@State publishCommentModel: publishCommentModel = new publishCommentModel()
@State reachEndIncreament: number = 0
async aboutToAppear() {
await this.getContentDetailData()
... ... @@ -709,4 +710,4 @@ interface radiusType {
topRight: number | Resource;
bottomLeft: number | Resource;
bottomRight: number | Resource;
}
\ No newline at end of file
}
... ...
... ... @@ -148,18 +148,19 @@ export struct ENewspaperPageComponent {
this.calendarDialogController.close()
}
})
Image($r('app.media.icon_share'))
.height($r('app.float.top_arrow_size'))
.width($r('app.float.top_arrow_size'))
.alignRules({
right: { anchor: "__container__", align: HorizontalAlign.End },
center: { anchor: "__container__", align: VerticalAlign.Center }
})
.id('e_newspaper_share')
.onClick(() => {
ToastUtils.showToast('分享为公共方法,待开发', 1000);
})
if (this.newspaperListBean && this.newspaperListBean.list && this.newspaperListBean.list.length > 0) {
Image($r('app.media.icon_share'))
.height($r('app.float.top_arrow_size'))
.width($r('app.float.top_arrow_size'))
.alignRules({
right: { anchor: "__container__", align: HorizontalAlign.End },
center: { anchor: "__container__", align: VerticalAlign.Center }
})
.id('e_newspaper_share')
.onClick(() => {
ToastUtils.showToast('分享为公共方法,待开发', 1000);
})
}
}
.margin({ left: $r('app.float.margin_16'), right: $r('app.float.margin_16') })
.height($r('app.float.top_bar_height'))
... ... @@ -311,6 +312,7 @@ export struct ENewspaperPageComponent {
.width('100%')
.height('100%')
.backgroundColor($r('app.color.color_80000000'))
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
.id('e_newspaper_container')
if (this.isOpenListDialog) {
... ...
... ... @@ -52,6 +52,7 @@ export struct ImageAndTextPageComponent {
@State isNetConnected: boolean = true
@State info: Area | null = null
@State likeNum: number = 0
@State reachEndIncreament : number = 0
build() {
Column() {
... ... @@ -141,7 +142,12 @@ export struct ImageAndTextPageComponent {
if (this.contentDetailData?.openComment) {
Divider().strokeWidth(6).color('#f5f5f5')
CommentComponent({
publishCommentModel: this.publishCommentModel
publishCommentModel: this.publishCommentModel,
fixedHeightMode: false,
reachEndIncreament: this.reachEndIncreament,
reachEndLoadMoreFinish: () => {
}
}).onAreaChange((oldValue: Area, newValue: Area) => {
this.info = newValue
})
... ... @@ -157,6 +163,9 @@ export struct ImageAndTextPageComponent {
.padding({ bottom: 76 })
.scrollBar(BarState.Off)
.align(Alignment.Top)
.onReachEnd(() => {
this.reachEndIncreament += 1
})
if (!this.isNetConnected) {
EmptyComponent({
... ... @@ -228,6 +237,7 @@ export struct ImageAndTextPageComponent {
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)
this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment)
}
if (this.contentDetailData?.openAudio && this.contentDetailData?.audioList?.length &&
this.contentDetailData?.audioList[0].audioUrl) {
... ... @@ -340,4 +350,4 @@ export struct ImageAndTextPageComponent {
aboutToDisappear() {
}
}
\ No newline at end of file
}
... ...
import { ContentDTO } from 'wdBean/Index';
import { ProcessUtils } from 'wdRouter/Index';
import { InteractMessageModel } from '../../model/InteractMessageModel'
@Component
export struct InteractMComponent {
messageModel:InteractMessageModel = new InteractMessageModel;
///"remark": "{"beReply":"乐事薯片,大家的最爱!!",
// "headUrl":"https: //uatjdcdnphoto.aikan.pdnews.cn//zhbj/img/user/2023122211/2A59F725E69849A38CEE8823B0D9D141.jpg",
// "contentId":"30035774121","contentRelObjectid":"2012","contentTitle":"乐事推出华夏风光限定罐七款城市地标包装让出游“有滋有味”",
// "commentContent":"大家都爱吃!!","userName":"人民日报网友a8dKCV","userId":"504964178466309","contentRelId":"500002866426",
// "shareUrl":"https: //pd-people-uat.pdnews.cn/column/30035774121-500002866426","userType":"1",
// "contentRelType":"1","visitor":"0","contentType":"8"}",
build() {
Row(){
Image('')
.backgroundColor(Color.Red)
Image(this.messageModel.InteractMsubM.headUrl)
.width(36)
.height(36)
.borderRadius(18)
Column(){
Row(){
Text('用户名')
Text(this.messageModel.InteractMsubM.userName)
.fontSize('14fp').fontColor('#222222')
Text('回复了你的评论')
Text(this.buildContentString())
.fontSize('14fp').fontColor('#999999')
.margin({left:5})
}.width('100%')
Text('两天前')
Text(this.messageModel.time)
.margin({top:2})
.fontSize('12fp').fontColor('#B0B0B0')
Text('评论内容')
.margin({top:8,bottom:10})
.fontSize('16fp').fontColor('#222222')
.width('100%')
.constraintSize({maxHeight:500})
.fontSize('12fp').fontColor('#B0B0B0').margin({top:10,bottom:10})
Column(){
Text('[你的评论]乐事薯片,大家的最爱').fontSize('14fp').fontColor('#666666').constraintSize({maxHeight:500})
.margin({top:5,bottom:5})
if (this.messageModel.contentType === '208' || this.messageModel.contentType === '209'){
Text(this.messageModel.message)
.margin({bottom:10})
.fontSize('16fp').fontColor('#222222')
.width('100%')
.constraintSize({maxHeight:500})
}
Divider()
.color('#f5f5f5')
.backgroundColor('#f5f5f5')
.width('100%')
.height(1)
Column(){
if (this.messageModel.contentType === '207' || this.messageModel.contentType === '209'){
Text('[你的评论]'+this.buildCommentContent()).fontSize('14fp').fontColor('#666666').constraintSize({maxHeight:500})
.margin({top:15,bottom:10})
.width('100%')
Divider()
.color('#EDEDED')
.backgroundColor('#EDEDED')
.width('100%')
.height(1)
}
Row(){
Text('乐事薯片,大家的最爱!!!!').fontSize('12fp').fontColor('#666666').constraintSize({maxHeight:500})
Image($r('app.media.MessageOriginTextIcon'))
.width('12')
.height('12')
Text(this.messageModel.InteractMsubM.contentTitle)
.fontSize('12fp')
.fontColor('#666666')
.maxLines(1)
.width('90%')
.textOverflow({overflow:TextOverflow.Ellipsis})
Blank()
Image($r('app.media.mine_user_edit'))
.width('12')
.height('12')
}.margin({top:5,bottom:5}).width('100%')
}.alignItems(HorizontalAlign.Start).backgroundColor('#f5f5f5').borderRadius(5)
}.padding({left:5}).alignItems(HorizontalAlign.Start)
}.padding({top:5,left:16,right:16}).width('100%').height(160).alignItems(VerticalAlign.Top).backgroundColor(Color.Red)
}.margin({top:10,bottom:15})
}.padding({left:10,right:10}).alignItems(HorizontalAlign.Start).backgroundColor('#f5f5f5').borderRadius(5)
.onClick(()=>{
let contentDTO :ContentDTO = new ContentDTO();
contentDTO.objectType = this.messageModel.InteractMsubM.contentType
contentDTO.objectId = this.messageModel.InteractMsubM.contentId
ProcessUtils.processPage(contentDTO)
})
}.padding({left:5,right:5}).alignItems(HorizontalAlign.Start).width('90%')
}.padding({top:10,left:16,right:16}).width('100%').alignItems(VerticalAlign.Top)
}
buildContentString(): string {
let contentString: string = ''
if (this.messageModel.contentType === '206') {
contentString = '赞了你的作品'
}else if(this.messageModel.contentType === '207'){
contentString = '赞了你的评论'
}else if(this.messageModel.contentType === '208'){
contentString = '评论了你的作品'
}else if(this.messageModel.contentType === '209'){
contentString = '回复了你的评论'
}else if(this.messageModel.contentType === '210'){
contentString = '转发了您的作品'
}else if(this.messageModel.contentType === '211'){
contentString = '关注了你'
}
return contentString;
}
buildCommentContent(): string {
let contentString : string = this.messageModel.contentType === '207'?this.messageModel.message:this.messageModel.InteractMsubM.beReply;
return contentString;
}
}
\ No newline at end of file
... ...
... ... @@ -61,6 +61,8 @@ export struct MorningEveningPaperComponent {
@State mixedBgColor: string = ''
// 顶部安全高度赋值
@State topSafeHeight: number = 0;
@State bottomSafeHeight: number = 0;
private audioDataList: AudioDataList[] = []
private playerController: WDPlayerController = new WDPlayerController();
simpleAudioDialog: CustomDialogController = new CustomDialogController({
... ... @@ -112,6 +114,7 @@ export struct MorningEveningPaperComponent {
// await windowHight.setWindowLayoutFullScreen(true);
// WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff', })
this.topSafeHeight = px2vp(windowHight.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).topRect.height)
this.bottomSafeHeight = px2vp(windowHight.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).bottomRect.height)
const dailyPaperTopicPageId = await SPHelper.default.getSync('dailyPaperTopicPageId', "") as String
console.info(TAG, `aboutToAppear = ` + dailyPaperTopicPageId)
... ... @@ -248,14 +251,15 @@ export struct MorningEveningPaperComponent {
})
}
}
.height('100%')
.height(`calc(100% - ${this.bottomSafeHeight + this.topSafeHeight + 'vp'})`)
PaperTitleComponent()
}
.width('100%')
.height('100%')
.padding({
top: this.topSafeHeight
top: this.topSafeHeight,
bottom: this.bottomSafeHeight
})
// .backgroundColor(Color.Black)
// .backgroundColor(this.pageInfoBean?.backgroundColor ?? Color.Black)
... ...
... ... @@ -449,6 +449,7 @@ export struct MultiPictureDetailPageComponent {
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)
this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment)
}
// this.contentDetailData.photoList = []
if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length === 0) {
... ...
... ... @@ -72,6 +72,7 @@ export struct SpacialTopicPageComponent {
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)
this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment)
// }
this.trySendData2H5()
}
... ... @@ -113,4 +114,4 @@ export struct SpacialTopicPageComponent {
}
this.getDetail()
}
}
\ No newline at end of file
}
... ...
... ... @@ -20,6 +20,8 @@ export class publishCommentModel {
targetType: string = ''
/*评论总数*/
totalCommentNumer: string = '0'
/// 游客评论开关:visitorComment 1:打开;0:关闭
visitorComment: string = "0"
//评论传参
/*评论图片url,多个逗号隔开*/
... ...
... ... @@ -8,9 +8,11 @@ import { HttpUtils } from 'wdNetwork/Index';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import NoMoreLayout from '../../page/NoMoreLayout';
import { EmptyComponent } from '../../view/EmptyComponent';
import { ContentDetailDTO, Params } from 'wdBean/Index';
const TAG = 'CommentComponent';
const testString = '因为读书的人\n是低着头向上看的人\n身处一隅,却能放眼世界\n2,因为读书的人\n总是比不读书的人\n活得有趣一点\n3,因为读书的人\n即使平凡,绝不平庸'
// @Entry
... ... @@ -22,14 +24,20 @@ export struct CommentComponent {
@State isComments: boolean = true
/*必传*/
@ObjectLink publishCommentModel: publishCommentModel
@Consume contentDetailData: ContentDetailDTO
listScroller: ListScroller = new ListScroller(); // scroller控制器
historyOffset: number = 0; // 上次浏览到列表距离顶端的偏移量offset
isloading: boolean = false
@State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource();
@State dialogController: CustomDialogController | null = null;
// @State private browSingModel: commentListModel = new commentListModel()
// 是否为固定高度模式。true时,里面上拉加载更多生效,外层不能包Scroll。
// false时,外层实现加载更多,并通过reachEndIncreament通知开发加载更多,reachEndLoadMoreFinish 通知上层加载更多完成
fixedHeightMode: boolean = false
@Prop @Watch("parentOnReachEnd") reachEndIncreament : number = 0
reachEndLoadMoreFinish?: () => void
// 在自定义组件即将析构销毁时将dialogControlle置空
aboutToDisappear() {
this.dialogController = null // 将dialogController置空
... ... @@ -180,31 +188,52 @@ export struct CommentComponent {
}
}
}, (item: commentItemModel, index: number) => JSON.stringify(item) + index.toString())
// 加载更多
ListItem() {
if (this.hasMore === false) {
if (this.hasMore == false) {
NoMoreLayout()
}
}
}
}
.margin({bottom: 10})
.onReachEnd(() => {
if (!this.fixedHeightMode) {
return
}
if (this.hasMore) {
this.getData()
}
})
.enableScrollInteraction(false)
.enableScrollInteraction(this.fixedHeightMode ? true: false)
// .nestedScroll({
// scrollForward: NestedScrollMode.PARENT_FIRST,
// scrollBackward: NestedScrollMode.SELF_FIRST
// })
}
}
parentOnReachEnd() {
if (this.fixedHeightMode) {
return
}
if (this.hasMore) {
this.getData()
} else {
if (this.reachEndLoadMoreFinish) {
this.reachEndLoadMoreFinish()
}
}
}
//获取数据
async getData() {
commentViewModel.fetchContentCommentList(this.currentPage + '', this.publishCommentModel.targetId,
this.publishCommentModel.targetType)
.then(commentListModel => {
console.log('评论:', JSON.stringify(commentListModel.list))
this.currentPage++
if (Number.parseInt(commentListModel.totalCommentNum) >
... ... @@ -237,6 +266,9 @@ export struct CommentComponent {
} else {
this.hasMore = false
}
if (!this.fixedHeightMode && this.reachEndLoadMoreFinish) {
this.reachEndLoadMoreFinish()
}
})
}
}
... ... @@ -247,6 +279,7 @@ struct ChildCommentItem {
@Link publishCommentModel: publishCommentModel
@Link dialogController: CustomDialogController | null
@ObjectLink item: commentItemModel
@Consume contentDetailData: ContentDetailDTO
build() {
Column() {
... ... @@ -271,6 +304,14 @@ struct ChildCommentItem {
.alignContent(Alignment.Center)
.onClick(() => {
// TODO 跳转个人详情
// 跳转到号主页
if (this.contentDetailData.rmhInfo?.cnMainControl === 1) {
const params: Params = {
creatorId: this.contentDetailData.rmhInfo.rmhId,
pageID: ''
}
WDRouterRule.jumpWithPage(WDRouterPage.peopleShipHomePage, params)
}
})
//昵称
... ... @@ -455,7 +496,7 @@ struct commentHeaderView {
.margin({ left: 8 })
.alignContent(Alignment.Center)
.onClick(() => {
// TODO 跳转个人详情
commentViewModel.jumpToAccountPage(this.item)
})
//昵称
... ...
import { ContentDetailDTO, PageInfoDTO } from 'wdBean/Index'
import { publishCommentModel } from '../model/PublishCommentModel'
@CustomDialog
export struct CommentListDialog {
/// 内部使用
private publishCommentModel: publishCommentModel = new publishCommentModel()
controller?: CustomDialogController
/// 外部初始化
contentDetail?: ContentDetailDTO
pageInfo?: PageInfoDTO
build() {
}
}
\ No newline at end of file
... ...
... ... @@ -11,11 +11,12 @@ export struct CommentTabComponent {
}
@ObjectLink publishCommentModel: publishCommentModel
@Prop contentDetail: ContentDetailDTO
@Prop pageComponentType: number = -1 //1:视频详情页
/*展示类型*/
@State type: number = 1
@State placeHolder: string = '说两句...'
@State dialogController: CustomDialogController | null = null;
styleType : number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏)
styleType: number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏)
/*回调方法*/
dialogControllerConfirm: () => void = () => {
}
... ... @@ -46,16 +47,44 @@ export struct CommentTabComponent {
Row() {
Stack({ alignContent: Alignment.Start }) {
RelativeContainer() {
Image($r('app.media.comment_img_input_hui'))
.objectFit(ImageFit.Fill)
.resizable({ slice: { top: 1, left: 1, right: 20, bottom: 1 } })
if (this.pageComponentType === 1) {
Row() {
}
.width('100%')
.height(30)
.borderRadius(2)
.backgroundColor(this.pageComponentType === 1 ? '#1a1a1a' : Color.Transparent)
.margin({
right: 16,
})
.alignRules({
top: { anchor: "__container__", align: VerticalAlign.Top },
left: { anchor: "__container__", align: HorizontalAlign.Start },
right: { anchor: "__container__", align: HorizontalAlign.End },
bottom: { anchor: "__container__", align: VerticalAlign.Bottom },
})
.id("Image")
.id("RowBg")
} else {
Image($r('app.media.comment_img_input_hui'))
.objectFit(ImageFit.Fill)
.resizable({
slice: {
top: 1,
left: 1,
right: 20,
bottom: 1
}
})
.alignRules({
top: { anchor: "__container__", align: VerticalAlign.Top },
left: { anchor: "__container__", align: HorizontalAlign.Start },
right: { anchor: "__container__", align: HorizontalAlign.End },
bottom: { anchor: "__container__", align: VerticalAlign.Bottom },
})
.id("Image")
}
Text(this.placeHolder)
.fontSize(12)
.fontColor('#999999')
... ... @@ -91,7 +120,7 @@ export struct CommentIconComponent {
@ObjectLink publishCommentModel: publishCommentModel
/*展示类型*/
@State type: number = 1
styleType : number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏)
styleType: number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏)
// aboutToAppear(): void {
// setTimeout(() => {
// this.publishCommentModel.totalCommentNumer = '444'
... ...
... ... @@ -412,33 +412,7 @@ struct QualityCommentItem {
jumpToAccountOwner() {
let url = HttpUrlUtils.getOtherUserDetailDataUrl()
let item : Record<string, string >= {
"creatorId": this.item.fromCreatorId || "",
"userType": `${this.item.fromUserType}`,
"userId": this.item.fromUserId || "-1",
}
HttpBizUtil.post<ResponseDTO<MasterDetailRes>>(url, item).then((result) => {
if (!result.data || result.data.mainControl != 1) {
ToastUtils.longToast("暂时无法查看该创作者主页")
return
}
if (result.data.banControl == 1) {
ToastUtils.longToast("该账号已封禁,不予访问")
return
}
if (result.data.userType === "1") { // 普通用户
let params: Record<string, string> = {'userId': result.data.userId};
WDRouterRule.jumpWithPage(WDRouterPage.otherNormalUserHomePagePage,params)
} else { // 非普通用户
ProcessUtils.gotoPeopleShipHomePage(result.data.creatorId)
}
}).catch(() => {
ToastUtils.longToast("暂时无法查看该创作者主页")
})
commentViewModel.jumpToAccountPage(this.item)
}
jumpToDetail() {
... ...
import { MasterDetailRes } from 'wdBean/Index';
import { SpConstants } from 'wdConstant/Index';
import { DateTimeUtils, Logger, SPHelper, ToastUtils, UserDataLocal } from 'wdKit/Index';
import {
AccountManagerUtils,
DateTimeUtils, DeviceUtil, Logger, SPHelper, ToastUtils, UserDataLocal } from 'wdKit/Index';
import { HttpBizUtil, HttpUrlUtils, HttpUtils, ResponseDTO } from 'wdNetwork/Index';
import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest';
import { ProcessUtils, WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import {
commentItemModel,
commentListModel,
... ... @@ -160,7 +164,9 @@ class CommentViewModel {
publishComment(model: publishCommentModel) {
return new Promise<commentItemModel>((success, fail) => {
let url = HttpUrlUtils.getPublishCommentUrl()
const visitorMode = model.visitorComment == "1" && AccountManagerUtils.isLoginSync() == false
let url = visitorMode ? HttpUrlUtils.getNoUserPublishCommentUrl() : HttpUrlUtils.getPublishCommentUrl()
let bean: Record<string, string> = {};
bean['targetId'] = model.targetId;
... ... @@ -176,6 +182,11 @@ class CommentViewModel {
bean['targetType'] = model.targetType
bean['parentId'] = model.parentId
if (visitorMode) {
bean['deviceId'] = DeviceUtil.clientId()
bean['userName'] = SPHelper.default.getSync(SpConstants.TOURIST_NICK_NAME, "") as string
}
HttpRequest.post<ResponseDTO<commentItemModel>>(url, bean).then((data: ResponseDTO<commentItemModel>) => {
if (data.code != 0) {
ToastUtils.showToast(data.message, 1000);
... ... @@ -185,10 +196,9 @@ class CommentViewModel {
ToastUtils.showToast(data.message, 1000);
let model = data.data as commentItemModel
let userId = HttpUtils.getUserId()
let FIRSTCOMMENTTIME = SPHelper.default.getSync(SpConstants.FIRSTCOMMENTTIME, '')
let firstCommentTime = SPHelper.default.getSync(SpConstants.FIRSTCOMMENTTIME, '') as string
if (!userId && !FIRSTCOMMENTTIME) {
if (visitorMode && firstCommentTime.length == 0) {
//保存首次评论时间
SPHelper.default.saveSync(SpConstants.FIRSTCOMMENTTIME, DateTimeUtils.formatDate(data.timestamp, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN))
}
... ... @@ -472,6 +482,36 @@ class CommentViewModel {
}
return false
}
jumpToAccountPage(commentItem: commentItemModel) {
let url = HttpUrlUtils.getOtherUserDetailDataUrl()
let item : Record<string, string >= {
"creatorId": commentItem.fromCreatorId || "",
"userType": `${commentItem.fromUserType}`,
"userId": commentItem.fromUserId || "-1",
}
HttpBizUtil.post<ResponseDTO<MasterDetailRes>>(url, item).then((result) => {
if (!result.data || result.data.mainControl != 1) {
ToastUtils.longToast("暂时无法查看该创作者主页")
return
}
if (result.data.banControl == 1) {
ToastUtils.longToast("该账号已封禁,不予访问")
return
}
if (result.data.userType === "1") { // 普通用户
let params: Record<string, string> = {'userId': result.data.userId};
WDRouterRule.jumpWithPage(WDRouterPage.otherNormalUserHomePagePage,params)
} else { // 非普通用户
ProcessUtils.gotoPeopleShipHomePage(result.data.creatorId)
}
}).catch(() => {
ToastUtils.longToast("暂时无法查看该创作者主页")
})
}
}
... ...
/**
* 直播页面点赞动画
*/
interface animationItem {
x: string | number;
y: string | number;
opacity: number;
name: string;
key: string;
url: Resource
}
@Component
export struct LikeAnimationView {
@State @Watch('countChange') count: number = 0
@State imgList: Resource[] =
[$r('app.media.like_animation_1'), $r('app.media.like_animation_2'), $r('app.media.like_animation_3')]
@State animationList: animationItem[] = []
countChange() {
this.animationList.push({
name: 'xxxx',
x: 0,
y: 0,
opacity: 1,
key: Math.random() + '',
url: this.getRandomUrl()
})
}
getRandomUrl(): Resource {
if (Math.random() >= 0 && Math.random() >= 0.33) {
return this.imgList[0]
} else if (Math.random() >= 0.33 && Math.random() >= 0.66) {
return this.imgList[1]
} else {
return this.imgList[2]
}
}
startAnimation() {
}
stopAnimation() {
}
aboutToAppear(): void {
}
aboutToDisappear(): void {
}
build() {
Stack() {
ForEach(this.animationList, (item: animationItem) => {
Image(item.url)
.width(48)
.height(48)
}, (item: animationItem) => item.key)
}
}
}
\ No newline at end of file
... ...
import { WDRouterRule, WDRouterPage } from 'wdRouter'
import MinePagePersonalFunctionsItem from '../../viewmodel/MinePagePersonalFunctionsItem'
import { PagePersonFunction } from './PagePersonFunction'
@Component
export default struct MinePagePersonFunctionUI {
... ... @@ -10,30 +11,7 @@ export default struct MinePagePersonFunctionUI {
Grid(){
ForEach(this.personalData,(item:MinePagePersonalFunctionsItem,index:number)=>{
GridItem(){
Row(){
Column(){
Image(item.imgSrc)
.width('46lpx')
.height('46lpx')
.objectFit(ImageFit.Auto)
.interpolation(ImageInterpolation.High)
Text(`${item.msg}`)
.margin({top:'8lpx'})
.height('23lpx')
.fontColor($r('app.color.color_222222'))
.fontSize('23lpx')
}
.alignItems(HorizontalAlign.Center)
.width('100%')
Blank()
.layoutWeight(1)
if(index % 4 < 3 && index != this.personalData.length-1){
Text().backgroundColor($r('app.color.color_222222'))
.opacity(0.1)
.width('2lpx')
.height('29lpx')
}
}
PagePersonFunction({ item: item, noDivider : (index % 4 < 3 && index != this.personalData.length-1) ? false : true})
}.onClick(()=>{
console.log(index+"")
switch (item.msg){
... ... @@ -97,4 +75,5 @@ export default struct MinePagePersonFunctionUI {
.height('234lpx')
.margin({top:'31lpx',left:'23lpx',right:'23lpx' })
}
}
\ No newline at end of file
}
... ...
import MinePagePersonalFunctionsItem from '../../viewmodel/MinePagePersonalFunctionsItem'
@Component
export struct PagePersonFunction{
@ObjectLink item: MinePagePersonalFunctionsItem
@State noDivider:boolean = false
build() {
Row(){
Column(){
Stack({ alignContent: Alignment.TopEnd }){
Image(this.item.imgSrc)
.objectFit(ImageFit.Auto)
.interpolation(ImageInterpolation.High)
if (this.item.isShowRedPoint) {
Button()
.type(ButtonType.Circle)
.width("12lpx")
.height("12lpx")
.backgroundColor($r('app.color.color_ED2800'))
}
}.width('46lpx')
.height('46lpx')
Text(`${this.item.msg}`)
.margin({top:'8lpx'})
.height('23lpx')
.fontColor($r('app.color.color_222222'))
.fontSize('23lpx')
}
.alignItems(HorizontalAlign.Center)
.width('100%')
Blank()
.layoutWeight(1)
if(!this.noDivider){
Text().backgroundColor($r('app.color.color_222222'))
.opacity(0.1)
.width('2lpx')
.height('29lpx')
}
}
}
}
\ No newline at end of file
... ...
import { StringUtils, ToastUtils } from 'wdKit/Index'
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'
import MinePageDatasModel from '../../../model/MinePageDatasModel'
import { MessageItem } from '../../../viewmodel/MessageItem'
import { CustomTitleUI } from '../../reusable/CustomTitleUI'
... ... @@ -86,6 +87,7 @@ export struct MessageListUI {
ToastUtils.shortToast(index+"")
switch (index) {
case 0: //互动消息
WDRouterRule.jumpWithPage(WDRouterPage.interactMessagePage)
break;
case 1: //预约消息
break;
... ...
import MyCollectionViewModel from '../../viewmodel/MyCollectionViewModel';
import InteractMessageViewModel from '../../viewmodel/InteractMessageViewModel';
import PageModel from '../../viewmodel/PageModel';
import { CommonConstants, ViewType } from 'wdConstant'
import { EmptyComponent,WDViewDefaultType } from '../view/EmptyComponent'
import { ContentDTO } from 'wdBean'
import NoMoreLayout from './NoMoreLayout'
import CustomRefreshLoadLayout from './CustomRefreshLoadLayout';
import { CustomSelectUI } from '../view/CustomSelectUI';
import { CustomBottomFuctionUI } from '../view/CustomBottomFuctionUI';
import { BigPicCardComponent } from '../view/BigPicCardComponent';
import { CustomTitleUI } from '../reusable/CustomTitleUI';
import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh';
import { InteractMComponent } from '../InteractMessage/InteractMComponent';
import { InteractMessageModel, WDMessageCenterMessageType } from '../../model/InteractMessageModel';
import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh';
@Entry
@Component
... ... @@ -20,39 +15,40 @@ struct InteractMessagePage {
@State private browSingModel: PageModel = new PageModel()
isloading : boolean = false
@Provide isEditState:boolean = false
@State allDatas :ContentDTO[] = [];
@State allDatas :InteractMessageModel[] = [];
private scroller: Scroller = new Scroller();
@State likeNum: number = 20
@State likeNum: number = 0
@State currentPage: number = 1;
aboutToAppear(){
this.getData()
this.getMessageLikeCount()
}
build() {
Column(){
CustomTitleUI({titleName:'互动消息'})
this.ListLayout()
// if(this.browSingModel.viewType == ViewType.ERROR){
// EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NetworkFailed})
// }else if(this.browSingModel.viewType == ViewType.EMPTY){
// EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NoHistory})
// }else {
// CustomPullToRefresh({
// alldata:this.allDatas,
// scroller:this.scroller,
// customList:()=>{
// this.ListLayout()
// },
// onRefresh:(resolve)=>{
// this.browSingModel.currentPage = 0
// this.getData(resolve)
// },
// onLoadMore:(resolve)=> {
// this.browSingModel.currentPage++
// this.getData()
// }
// })
// }
if(this.browSingModel.viewType == ViewType.ERROR){
EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NetworkFailed})
}else if(this.browSingModel.viewType == ViewType.EMPTY){
EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NoHistory})
}else {
CustomPullToRefresh({
alldata:this.allDatas,
scroller:this.scroller,
customList:()=>{
this.ListLayout()
},
onRefresh:(resolve)=>{
this.browSingModel.currentPage = 0
this.getData(resolve)
},
onLoadMore:(resolve)=> {
this.browSingModel.currentPage++
this.getData()
}
})
}
}
.width(CommonConstants.FULL_WIDTH)
... ... @@ -66,9 +62,9 @@ struct InteractMessagePage {
}
// 下拉刷新
ForEach(this.allDatas, (compDTO: ContentDTO, compIndex: number) => {
ForEach(this.allDatas, (InteractM: InteractMessageModel, compIndex: number) => {
ListItem() {
InteractMComponent()
InteractMComponent({messageModel:InteractM})
}
})
// 加载更多
... ... @@ -112,12 +108,22 @@ struct InteractMessagePage {
}
async getData(resolve?: (value: string | PromiseLike<string>) => void){
MyCollectionViewModel.fetchMyCollectList(2,'1',this.browSingModel.currentPage,getContext(this)).then(collectionItem => {
InteractMessageViewModel.fetchMessageList(WDMessageCenterMessageType.WDMessageCenterMessageType_Interact,this.currentPage).then(InteractMessageMItem => {
if(resolve) resolve('刷新成功')
if (collectionItem && collectionItem.list && collectionItem.list.length > 0) {
if (InteractMessageMItem && InteractMessageMItem.list && InteractMessageMItem.list.length > 0) {
this.browSingModel.viewType = ViewType.LOADED;
this.allDatas.push(...collectionItem.list)
if (collectionItem.list.length === this.browSingModel.pageSize) {
if (this.currentPage === 1) {
this.allDatas = []
}
for (let index = 0; index < InteractMessageMItem.list.length; index++) {
const element = InteractMessageMItem.list[index];
element.InteractMsubM = JSON.parse(element.remark)
}
this.allDatas.push(...InteractMessageMItem.list)
if (InteractMessageMItem.list.length === this.browSingModel.pageSize) {
this.browSingModel.currentPage++;
this.browSingModel.hasMore = true;
} else {
... ... @@ -129,4 +135,11 @@ struct InteractMessagePage {
})
}
async getMessageLikeCount(){
InteractMessageViewModel.getMessageLikeCount().then(num => {
this.likeNum = num
})
}
}
... ...
... ... @@ -53,8 +53,25 @@ export struct MinePageComponent {
this.getUserLogin()
this.getFunctionData()
this.addLoginStatusObserver()
this.getMessageData()
}
getMessageData(){
MinePageDatasModel.getMessageUnReadData().then((value) => {
if(value !=null) {
if(value.activeCount >0 ||value.subscribeCount > 0 || value.systemCount > 0){
this.personalData.forEach((value) => {
if(value.msg == "消息")
value.isShowRedPoint = true
})
}
}
}).catch((err: Error) => {
console.log(TAG, JSON.stringify(err))
})
}
async addLoginStatusObserver(){
this.preferences = await SPHelper.default.getPreferences();
this.preferences.on('change', this.observer);
... ...
... ... @@ -21,6 +21,7 @@ const TAG = 'PageComponent';
export struct PageComponent {
@State private pageModel: PageModel = new PageModel();
@State private pageAdvModel: PageAdModel = new PageAdModel();
@State timer: number = -1
navIndex: number = 0;
pageId: string = "";
channelId: string = "";
... ... @@ -29,6 +30,7 @@ export struct PageComponent {
@Prop @Watch('onAutoRefresh') autoRefresh: number = 0
private listScroller: Scroller = new Scroller();
needload: boolean = true;
build() {
Column() {
if (this.pageModel.viewType == ViewType.LOADING) {
... ... @@ -222,9 +224,10 @@ export struct PageComponent {
}
onChange() {
Logger.info(TAG, `onChangezz id: ${this.pageId} , ${this.channelId} , ${this.navIndex} , navIndex: ${this.currentTopNavSelectedIndex}`);
Logger.info(TAG,
`onChangezz id: ${this.pageId} , ${this.channelId} , ${this.navIndex} , navIndex: ${this.currentTopNavSelectedIndex}`);
if (this.navIndex === this.currentTopNavSelectedIndex) {
if(this.needload){
if (this.needload) {
this.getData();
}
this.needload = false;
... ... @@ -242,13 +245,19 @@ export struct PageComponent {
}
async getData() {
Logger.info(TAG, `getData id: ${this.pageId} , ${this.channelId} , navIndex: ${this.currentTopNavSelectedIndex}`);
this.pageModel.pageId = this.pageId;
this.pageModel.groupId = this.pageId;
this.pageModel.channelId = this.channelId;
this.pageModel.currentPage = 1;
this.pageModel.pageTotalCompSize = 0;
PageHelper.getInitData(this.pageModel, this.pageAdvModel)
if (this.timer) {
clearTimeout(this.timer)
}
this.timer = setTimeout(() => {
Logger.info(TAG, `getData id: ${this.pageId} , ${this.channelId} , navIndex: ${this.currentTopNavSelectedIndex}`);
this.pageModel.pageId = this.pageId;
this.pageModel.groupId = this.pageId;
this.pageModel.channelId = this.channelId;
this.pageModel.currentPage = 1;
this.pageModel.pageTotalCompSize = 0;
PageHelper.getInitData(this.pageModel, this.pageAdvModel)
}, 100)
}
}
... ...
import { insightIntent } from '@kit.IntentsKit';
import { BottomNavDTO, CompDTO, TopNavDTO } from 'wdBean';
import { SpConstants } from 'wdConstant';
import { DisplayUtils, LazyDataSource, Logger, NetworkUtil, SPHelper, ToastUtils } from 'wdKit';
... ... @@ -8,6 +9,7 @@ import { FirstTabTopSearchComponent } from '../search/FirstTabTopSearchComponent
import { AssignChannelParam } from 'wdRouter/src/main/ets/utils/HomeChannelUtils';
import { PeopleShipMainComponent } from '../peopleShip/PeopleShipMainComponent';
import { channelSkeleton } from '../skeleton/channelSkeleton';
import { common } from '@kit.AbilityKit';
const TAG = 'TopNavigationComponent';
... ... @@ -37,6 +39,7 @@ export struct TopNavigationComponent {
// 顶导当前选中/焦点下标
@State currentTopNavSelectedIndex: number = 0;
@State currentTopNavName: string = '';
@State currentTopNavItem: TopNavDTO = {} as TopNavDTO
// 顶导数据
@State @Watch('onTopNavigationDataUpdated') topNavList: TopNavDTO[] = []
@State compList: LazyDataSource<CompDTO> = new LazyDataSource();
... ... @@ -58,6 +61,8 @@ export struct TopNavigationComponent {
@Prop @Watch('onAutoRefresh') autoRefresh: number = 0
// 传递给page的自动刷新通知
@State autoRefresh2Page: number = 0
//保存当前导航选中时的时间戳 意图开始时间
@State executedStartTime: number = new Date().getTime()
// 当前底导index
@State navIndex: number = 0
@State animationDuration: number = 0
... ... @@ -167,6 +172,7 @@ export struct TopNavigationComponent {
this.currentTopNavSelectedIndex = index
this.currentTopNavName = this.myChannelList[index].name
}
this.currentTopNavItem = this.myChannelList[this.currentTopNavSelectedIndex]
}
isBroadcast(item: TopNavDTO) {
... ... @@ -184,6 +190,49 @@ export struct TopNavigationComponent {
return item.channelType === 3
}
//意图共享
topNavInsightIntentShare(item: TopNavDTO){
let tapNavIntent: insightIntent.InsightIntent = {
intentName: 'ViewColumn',
intentVersion: '1.0.1',
identifier: '52dac3b0-6520-4974-81e5-25f0879449b5',
intentActionInfo: {
actionMode: 'EXPECTED',
currentPercentage: 50,
executedTimeSlots: {
executedEndTime: new Date().getTime(),
executedStartTime: this.executedStartTime
}
},
intentEntityInfo: {
entityName: 'ViewColumn',
entityId: String(item.pageId) || '',
displayName: item.name,
logoURL: 'https://www-file.huawei.com/-/media/corporate/images/home/logo/huawei_logo.png',
rankingHint: 99,
isPublicData: true
}
}
try {
let context = getContext(this) as common.UIAbilityContext;
// 共享数据
insightIntent.shareIntent(context, [tapNavIntent], (error) => {
if (error?.code) {
// 处理业务逻辑错误
console.error(`shareIntent failed, error.code: ${error?.code}, error.message: ${error?.message}`);
return;
}
// 执行正常业务
console.log('shareIntent succeed');
});
} catch (error) {
// 处理异常
console.error(`error.code: ${error?.code}, error.message: ${error?.message}`);
}
}
build() {
Column() {
// 顶部搜索、日报logo、早晚报
... ... @@ -278,7 +327,11 @@ export struct TopNavigationComponent {
if (!this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) &&
!this.isLayout(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index])
) {
//在 tab 切换之前意图共享
// this.topNavInsightIntentShare(this.currentTopNavItem)
this.currentTopNavSelectedIndex = index;
this.currentTopNavItem = this.myChannelList[index]
}
if (this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index])) {
// 跳转到播报页面
... ... @@ -416,9 +469,11 @@ export struct TopNavigationComponent {
this.changeByClick = true
this.tabsController.changeIndex(index)
}
})
}
aboutToAppear() {
//处理新闻tab顶导频道数据
this.topNavListHandle()
... ...
... ... @@ -86,7 +86,7 @@ export struct PeopleShipHomeArticleListComponent {
// 加载更多
ListItem() {
if (this.hasMore) {
if (this.hasMore && this.arr && this.arr.length > 0) {
LoadMoreLayout({ isVisible: this.hasMore })
} else if (!this.hasMore && !this.isLoading) {
PeopleShipNoMoreData()
... ...
... ... @@ -43,9 +43,8 @@ export struct PeopleShipHomePageNavComponent {
}).onClick(()=>{
let params = {
'headPhotoUrl': this.detailModel.headPhotoUrl,
'headType': '1'
} as Record<string, string>;
WDRouterRule.jumpWithPage(WDRouterPage.showUserHeaderPage,params)
WDRouterRule.jumpWithPage(WDRouterPage.showHomePageHeaderPage,params)
}).margin({
left: '10vp',
})
... ...
... ... @@ -56,9 +56,8 @@ export struct PeopleShipHomePageTopComponent {
}).onClick(() => {
let params = {
'headPhotoUrl': this.detailModel.headPhotoUrl,
'headType': '1'
} as Record<string, string>;
WDRouterRule.jumpWithPage(WDRouterPage.showUserHeaderPage, params)
WDRouterRule.jumpWithPage(WDRouterPage.showHomePageHeaderPage, params)
})
... ... @@ -369,7 +368,11 @@ export struct PeopleShipHomePageTopComponent {
private computeShowNum(count: number) {
if (count >= 10000) {
return `${(count / 10000).toFixed(1)}万`
let num = ( count / 10000).toFixed(1)
if (Number(num.substring(num.length-1)) == 0) {
num = num.substring(0, num.length-2)
}
return num + '万'
}
return `${count}`
}
... ...
... ... @@ -96,7 +96,7 @@ struct ReserveMorePage {
)
// 加载更多
ListItem() {
if (this.hasMore) {
if (this.hasMore && this.data && this.data.totalCount() > 0) {
LoadMoreLayout({ isVisible: this.hasMore })
} else if (!this.hasMore && !this.isLoading) {
PeopleShipNoMoreData()
... ... @@ -127,7 +127,7 @@ struct ReserveMorePage {
buildItem(item: ContentDTO, index: number) {
Column() {
Stack() {
Image(item.fullColumnImgUrls[0].url)
Image(item.fullColumnImgUrls[0]?.url)
.width('100%')
.height(196)
.borderRadius(4)
... ... @@ -139,8 +139,9 @@ struct ReserveMorePage {
Text(item.newsTitle)
.fontSize(17)
.maxLines(2)
.lineHeight(25)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.margin({ top: 16, left: 12, right: 12 })
.margin({ top: 4, left: 12, right: 12 })
.alignSelf(ItemAlign.Start)
Row() {
Row() {
... ... @@ -148,6 +149,7 @@ struct ReserveMorePage {
.width(20)
.height(20)
.margin({ left: 10, top: 2, bottom: 2, right: 6 })
// Text(DateTimeUtils.formatDate(item.liveInfo.liveStartTime, "MM月dd日 HH:mm"))
Text(this.getReserveDate(item.liveInfo.liveStartTime, 1))
.fontSize(12)
... ... @@ -256,6 +258,9 @@ struct ReserveMorePage {
.height(24)
.objectFit(ImageFit.Auto)
.id("back_icon")
.margin({
left: '16vp'
})
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
left: { anchor: "__container__", align: HorizontalAlign.Start }
... ... @@ -267,10 +272,10 @@ struct ReserveMorePage {
Text(this.title)// .height('42lpx')
.maxLines(1)
.id("title")
.fontSize('35lpx')
.fontSize('18vp')
.fontWeight(400)
.fontColor($r('app.color.color_222222'))
.lineHeight('42lpx')
.lineHeight('22vp')
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
middle: { anchor: "__container__", align: HorizontalAlign.Center }
... ... @@ -284,11 +289,14 @@ struct ReserveMorePage {
@Builder
LiveImage() {
Row() {
Image($r('app.media.reserve_icon'))
.width(22)
.height(18)
Image($r('app.media.reserve_new_icon'))
.width(14)
.height(14)
.margin({
right: 3
})
Text('预约')
.fontSize('11fp')
.fontSize('12vp')
.fontWeight(400)
.fontColor(Color.White)
}
... ...
... ... @@ -131,10 +131,8 @@ export struct SearchResultComponent {
.barWidth('100%')
.barHeight('84lpx')
.animationDuration(0)
.onChange((index: number) => {
this.currentIndex = index
})
.width('100%')
.scrollable(false)
.layoutWeight(1)
}
}.width('100%')
... ...
... ... @@ -15,7 +15,7 @@ export struct CustomBottomFuctionUI {
.height('20')
.margin({right:'31lpx' })
Text(this.isAllSelect?'取消':'全选')
Text(this.isAllSelect?'取消全选':'全选')
.fontColor($r('app.color.color_222222'))
.backgroundColor(Color.White)
}
... ...
... ... @@ -22,7 +22,7 @@ export struct LikeComponent {
@Prop data: Record<string, string>
enableBtn = true
componentType: number = 1 //1: 底部栏目样式 2: 新闻页中间位置样式 3:动态Tab内容下的互动入口
styleType: number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏)
styleType: number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏) 3 透明背景
@State likeCount: number = 0 //点赞数
//上层传值 样例
... ... @@ -50,6 +50,7 @@ export struct LikeComponent {
//2: 新闻页中间位置样式
this.likeCompStyle2()
} else if (this.componentType == 3) {
//卡片底部互动样式
this.likeCompStyle3()
} else if (this.componentType == 4) {
// 直播,点赞按钮底测有灰色圆角背景+右上点赞数量
... ... @@ -67,7 +68,7 @@ export struct LikeComponent {
if (this.likesStyle === 1) {
return {
url: this.likeStatus ? $r(`app.media.ic_like_check`) :
this.styleType == 1 ? $r('app.media.icon_like_default') : $r(`app.media.ic_like_uncheck`),
this.styleType == 1 ? this.componentType == 3?$r(`app.media.CarderInteraction_like`):$r('app.media.icon_like_default') : $r(`app.media.ic_like_uncheck`),
name: '赞'
}
} else if (this.likesStyle === 2) {
... ... @@ -133,8 +134,8 @@ export struct LikeComponent {
Image(this.transLikeStyle().url)
.width(18)
.height(18)
// Text(this.likeStatus ? '已赞' : '点赞')
Text(this.likeCount > 0 ? this.likeCount.toString() : '点赞')
Text(this.likeStatus ? '已赞' : '点赞')
// Text(this.likeCount > 0 ? this.likeCount.toString() : '点赞')
.margin({ left: 4 })
.fontSize(14)
.fontColor(this.likeStatus ? '#ED2800' : '#666666')
... ...
... ... @@ -59,6 +59,7 @@ export struct OperRowListView {
* 7:图集详情页
*/
@Prop componentType: number = 1 //1: 底部栏目样式 2: 新闻页中间位置样式 3:动态Tab内容下的互动入口
@Prop pageComponentType: number = -1 //1:视频详情页
@State likesStyle: number = this.contentDetailData.likesStyle // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空
@State operationButtonList: string[] = ['comment', 'collect', 'share'] // 组件展示条件
@State needLike: boolean = true
... ... @@ -115,6 +116,8 @@ export struct OperRowListView {
}
build() {
// 视频详情页
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
// AudioDialog()
Row() {
... ... @@ -162,6 +165,7 @@ export struct OperRowListView {
bottom: `${this.bottomSafeHeight}px`
// bottom: 50
})
}
/**
... ... @@ -174,12 +178,16 @@ export struct OperRowListView {
CommentTabComponent({
publishCommentModel: this.publishCommentModel,
contentDetail: this.contentDetailData,
onCommentFocus: this.onCommentFocus
onCommentFocus: this.onCommentFocus,
pageComponentType: this.pageComponentType
})
}
}
.flexShrink(1)
.layoutWeight(1)
.margin({
right: this.pageComponentType === 1 ? 16 : 0,
})
if (this.showCommentIcon) {
Column() {
if (this.publishCommentModel?.targetId) {
... ... @@ -330,6 +338,8 @@ export struct OperRowListView {
contentList: [{
contentId: this.contentDetailData?.newsId + '',
contentType: this.contentDetailData?.newsType + '',
relType:this.contentDetailData?.reLInfo?.relType + '',
contentRelId:this.contentDetailData?.reLInfo?.relId + '',
}],
}
... ...
... ... @@ -2,6 +2,8 @@ import { Action, NewspaperListBean, NewspaperListItemBean, NewspaperPositionItem
import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'
import { WDRouterRule } from 'wdRouter/Index'
import { ENewspaperPageDialog } from '../dialog/ENewspaperPageDialog'
import { Logger } from 'wdKit';
import { window } from '@kit.ArkUI';
/**
* 读报纸半屏弹窗
... ... @@ -35,6 +37,12 @@ export struct ENewspaperListDialog {
// listDialogController: CustomDialogController
public closeDialog?: () => void
// 手势滑动相关
private panOption: PanGestureOptions = new PanGestureOptions({ direction: PanDirection.Up | PanDirection.Down })
private topFixedHeight = 124
@State topHeight: number = 124
private deviceHeight: number = 0
//watch监听报纸页码回调
onCurrentPageNumUpdated(): void {
console.log("ENewspaperListDialog-onCurrentPageNumUpdated", "currentPageNum:", this.currentPageNum)
... ... @@ -46,7 +54,13 @@ export struct ENewspaperListDialog {
}
}
aboutToAppear(): void {
async aboutToAppear() {
// 屏幕高度 - 滑动高度计算
let windowClass: window.Window = await window.getLastWindow(getContext(this));
let changeHeight = 85 + 44 + px2vp(windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).topRect.height)
changeHeight += px2vp(windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).bottomRect.height)
this.deviceHeight = px2vp(windowClass.getWindowProperties().windowRect.height) - changeHeight
this.isCurrentViewOpen = true
console.log("ENewspaperListDialog-aboutToAppear", "currentPageNum:", this.currentPageNum)
let _scrollIndex = Number.parseInt(this.currentPageNum)
... ... @@ -56,60 +70,76 @@ export struct ENewspaperListDialog {
}
aboutToDisappear() {
// if (this.pageListDialogController) {
// this.pageListDialogController = null
// }
this.isCurrentViewOpen = false
}
build() {
Stack() {
Column() {
Row()
.width(43)
.height(4)
.backgroundColor('#EDEDED')
.margin({
top: 10,
bottom: 10
})
Column() {
Row()
.width(43)
.height(4)
.backgroundColor('#EDEDED')
.margin({
top: 10,
bottom: 10
})
.onClick(() => {
if (this.closeDialog) {
this.closeDialog()
}
})
Row() {
Text(this.currentPageNum)
.fontSize($r('app.float.font_size_36'))
.fontColor($r('app.color.color_222222'))
.fontFamily('BebasNeueBold')
Text('版')
.fontSize($r('app.float.font_size_16'))
.fontColor($r('app.color.color_222222'))
.margin({ bottom: 6 })
Image($r('app.media.icon_triangle_black'))
.width($r('app.float.border_radius_6'))
.height($r('app.float.border_radius_6'))
.margin({ left: 2, bottom: 6 })
}
.alignItems(VerticalAlign.Bottom)
.margin({ left: 15 })
.alignSelf(ItemAlign.Start)
.onClick(() => {
if (this.closeDialog) {
this.closeDialog()
this.pageDialogShow = !this.pageDialogShow
if (this.pageDialogShow) {
this.pageListDialogController.open()
} else {
this.pageListDialogController.close()
}
})
Row() {
Text(this.currentPageNum)
.fontSize($r('app.float.font_size_36'))
.fontColor($r('app.color.color_222222'))
.fontFamily('BebasNeueBold')
Text('版')
.fontSize($r('app.float.font_size_16'))
.fontColor($r('app.color.color_222222'))
.margin({ bottom: 6 })
Image($r('app.media.icon_triangle_black'))
.width($r('app.float.border_radius_6'))
.height($r('app.float.border_radius_6'))
.margin({ left: 2, bottom: 6 })
Image($r('app.media.line'))
.width('100%')
.height(6)
.margin({ top: 20, left: 16, right: 16 })
.objectFit(ImageFit.Contain)
}
.alignItems(VerticalAlign.Bottom)
.margin({ left: 15 })
.alignSelf(ItemAlign.Start)
.onClick(() => {
this.pageDialogShow = !this.pageDialogShow
if (this.pageDialogShow) {
this.pageListDialogController.open()
} else {
this.pageListDialogController.close()
}
})
.width('100%')
.gesture(
PanGesture(this.panOption)
.onActionStart((event: GestureEvent) => {
Logger.debug('ENewspaperListDialog','Pan start')
})
.onActionUpdate((event: GestureEvent) => {
if (this.topFixedHeight + event.offsetY >= this.topFixedHeight) {
this.topHeight = this.topFixedHeight + event.offsetY
}
Logger.debug('ENewspaperListDialog', 'topHeight:' + this.topHeight)
})
.onActionEnd(() => {
this.onCloseGestureDialog()
})
)
Image($r('app.media.line'))
.width('100%')
.height(6)
.margin({ top: 20, left: 16, right: 16 })
.objectFit(ImageFit.Contain)
List({ scroller: this.listScroller, initialIndex: this.scrollIndex }) {
ForEach(this.newspaperListBean?.list, (item: NewspaperListItemBean, index: number) => {
... ... @@ -137,7 +167,7 @@ export struct ENewspaperListDialog {
.fontSize($r('app.float.font_size_14'))
.fontColor($r('app.color.color_222222'))
.fontWeight(600)
.maxLines(2)
// .maxLines(2)
.margin({
bottom: 8
})
... ... @@ -151,7 +181,7 @@ export struct ENewspaperListDialog {
.margin({
bottom: 8
})
.maxLines(2)
// .maxLines(2)
}
if (positionItem.downTitle) {
... ... @@ -162,7 +192,7 @@ export struct ENewspaperListDialog {
.margin({
bottom: 8
})
.maxLines(2)
// .maxLines(2)
}
if (positionItem.newsTxt) {
Text(positionItem.newsTxt)
... ... @@ -251,16 +281,13 @@ export struct ENewspaperListDialog {
this.currentPageNum = `${firstIndex < 9 ? '0' + (firstIndex + 1) : firstIndex + 1}`
// }
})
.onScroll((scrollOffset: number, scrollState: ScrollState) => {
// console.info(`onScroll scrollState = ScrollState` + scrollState + `, scrollOffset = ` + scrollOffset)
// if (this.scrollOffset == 0) {
// this.scrollOffset = 0
// }
})
}
.margin({ top: 124 })
// .margin({ top: 124 })
.margin({ top: this.topHeight })
.width('100%')
.backgroundColor(Color.White)
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
.onClick(() => {
})
... ... @@ -272,6 +299,33 @@ export struct ENewspaperListDialog {
this.closeDialog()
}
})
.gesture(
PanGesture(this.panOption)
.onActionStart((event: GestureEvent) => {
Logger.debug('ENewspaperListDialog','Pan start')
})
.onActionUpdate((event: GestureEvent) => {
if (event) {
if (this.topFixedHeight + event.offsetY >= this.topFixedHeight) {
this.topHeight = this.topFixedHeight + event.offsetY
}
Logger.debug('ENewspaperListDialog', 'topHeight:' + this.topHeight)
}
})
.onActionEnd(() => {
this.onCloseGestureDialog()
})
)
}
onCloseGestureDialog() {
if (this.topHeight >= this.deviceHeight ) {
if (this.closeDialog) {
this.closeDialog()
}
} else {
this.topHeight = this.topFixedHeight
}
}
updateRecordsData() {
... ...
/**
* WDMessageCenterMessageType 拉取消息类型
*/
export const enum WDMessageCenterMessageType {
WDMessageCenterMessageType_Interact = 1, //互动通知
WDMessageCenterMessageType_Subscribe, //预约消息
WDMessageCenterMessageType_System, //系统消息
}
export interface InteractMessageListModel{
data: InteractMessageMItem
code: number
message: string
success: string
timestamp: number
}
export class InteractMessageMItem{
pageNum:number = 0
pageSize:number = 0
totalCount:number = 0
hasNext:number = 0
list:InteractMessageModel[] = []
constructor(list?:InteractMessageModel[],pageNum?: number,pageSize?: number,totalCount?: number,hasNext?:number) {
}
}
export class InteractMessageModel {
classify: string = '';
contentId: string = '';
contentType: string = '';
id: number = 0;
message: string = '';
platform: string = '';
privateMailId: number = 0;
privateMailIdList: number[] = [];
privateMailIds: string = '';
privateMailNum: number = 0;
read: boolean = true;
source: string = '';
time: string = '';
title: string = '';
userId: string = '';
remark: string = '';
InteractMsubM:InteractMsubModel = new InteractMsubModel;
}
export class InteractMsubModel {
beReply: string = '';
headUrl: string = '';
contentId: string = '';
contentRelObjectid: string = '';
contentTitle: string = '';
commentContent: string = '';
userName: string = '';
userId: string = '';
contentRelId: string = '';
shareUrl: string = '';
userType: string = '';
contentRelType: string = '';
visitor: string = '';
contentType: string = '';
}
export interface InteractMParams {
contentType?: string;
pageNum?: string;
pageSize?: string;
userId?: string;
createTime?: string;
}
export interface InteractMDTO{
success: boolean;
code: number;
message: string;
data: number;
timestamp?: number;
}
\ No newline at end of file
... ...
... ... @@ -24,6 +24,7 @@ import { CommentLikeOperationRequestItem } from '../viewmodel/CommentLikeOperati
import { FollowOperationRequestItem } from '../viewmodel/FollowOperationRequestItem';
import { SpConstants } from 'wdConstant/Index';
import { MessageItem } from '../viewmodel/MessageItem';
import { MessageUnReadItem } from '../viewmodel/MessageUnReadItem';
const TAG = "MinePageDatasModel"
... ... @@ -597,6 +598,33 @@ class MinePageDatasModel{
})
})
}
/**
* 获取消息未读数据
* @param pageSize
* @param pageNum
* @returns
*/
getMessageUnReadData(): Promise<MessageUnReadItem> {
return new Promise<MessageUnReadItem>((success, error) => {
this.fetchMessageUnReadData().then((navResDTO: ResponseDTO<MessageUnReadItem>) => {
if (!navResDTO || navResDTO.code != 0) {
error(null)
return
}
let navigationBean = navResDTO.data as MessageUnReadItem
success(navigationBean);
}).catch((err: Error) => {
error(null)
})
})
}
fetchMessageUnReadData() {
let url = HttpUrlUtils.getMessageUnReadDataUrl()
return WDHttp.get<ResponseDTO<MessageUnReadItem>>(url)
};
}
const minePageDatasModel = MinePageDatasModel.getInstance()
... ...
... ... @@ -43,7 +43,6 @@ export interface MyCollectionListModel{
}
export interface contentListItemParams{
contentId?:string;
contentType?:string;
... ...
... ... @@ -8,5 +8,6 @@ struct SearchPage {
SearchComponent()
}.height('100%')
.width('100%')
.backgroundColor($r('app.color.white'))
}
}
\ No newline at end of file
... ...
import { router } from '@kit.ArkUI';
@Entry
@Component
struct ShowHomePageHeaderPage {
@State headPhotoUrl: string = '';
@State params:Record<string, string> = router.getParams() as Record<string, string>;
onPageShow() {
this.headPhotoUrl = this.params?.['headPhotoUrl'];
}
build() {
Row() {
Image(this.headPhotoUrl)
.alt( $r('app.media.WDAccountOwnerHedaerDefaultIcon') )
.width('100%')
.objectFit(ImageFit.Contain)
}
.width('100%')
.height('100%')
.alignItems(VerticalAlign.Center)
.backgroundColor($r('app.color.color_000000'))
.onClick(()=>{
router.back()
})
}
}
\ No newline at end of file
... ...
... ... @@ -4,18 +4,16 @@ import { router } from '@kit.ArkUI';
@Component
struct ShowUserHeaderPage {
@State headPhotoUrl: string = '';
@State headType: string = ''
@State params:Record<string, string> = router.getParams() as Record<string, string>;
onPageShow() {
this.headPhotoUrl = this.params?.['headPhotoUrl'];
this.headType = this.params?.['headType'] ?? '';
}
build() {
Row() {
Image(this.headPhotoUrl)
.alt(this.headType.length > 0 ? $r('app.media.WDAccountOwnerHedaerDefaultIcon') : $r('app.media.default_head'))
.alt($r('app.media.default_head'))
.width('720lpx')
.height('720lpx')
.objectFit(ImageFit.Auto)
... ...
// import { collcetRecordParams, MyCollectionItem, MyCollectionListModel } from '../model/MyCollectionModel';
import { HttpUrlUtils, HttpUtils, ResponseDTO, WDHttp } from 'wdNetwork';
import { Logger } from 'wdKit';
import promptAction from '@ohos.promptAction';
import {
InteractMDTO,
InteractMessageListModel, InteractMessageMItem, InteractMParams } from '../model/InteractMessageModel';
const TAG = "MyCollectionViewModel"
class InteractMessageViewModel {
private static instance:InteractMessageViewModel
/**
* 单例模式
* @returns
*/
public static getInstance(): InteractMessageViewModel {
if (!InteractMessageViewModel.instance) {
InteractMessageViewModel.instance = new InteractMessageViewModel();
}
return InteractMessageViewModel.instance;
}
// ///互动通知
// WDMessageCenterMessageType_Interact = 1,
//
// ///预约消息
// WDMessageCenterMessageType_Subscribe = 2,
//
// ///系统消息
// WDMessageCenterMessageType_System = 3
BaseGetRequest(contentType:number,pageNum:number){
let userID = HttpUtils.getUserId();
let url = HttpUrlUtils.getMessageListDataUrl()+`?contentType=${contentType}&userId=${userID}&pageSize=${20}&pageNum=${pageNum}`
return WDHttp.get<InteractMessageListModel>(url)
}
fetchMessageList(contentType:number,pageNum:number):Promise<InteractMessageMItem>{
return new Promise((success,error) => {
this.BaseGetRequest(contentType,pageNum).then((navResDTO: InteractMessageListModel) => {
if (!navResDTO || navResDTO.code != 0) {
return
}
Logger.info(TAG, "fetchMessageList then,navResDTO.timeStamp:" + navResDTO.timestamp);
success(navResDTO.data)
}).catch((err: Error) => {
Logger.error(TAG, `fetchMessageList catch, error.name : ${err.name}, error.message:${err.message}`);
error("page data invalid");
})
})
}
getMessageLikeCount():Promise<number>{
return new Promise((success,error) => {
WDHttp.get<InteractMDTO>(HttpUrlUtils.getMessageLikeCount()).then((navResDTO: InteractMDTO) => {
if (navResDTO.code == 0) {
success(navResDTO.data)
}
})
.catch((error: Error) => {
Logger.info(TAG,'executeCollcet','ResponseDTO')
})
})
}
}
const interactMViewModel = InteractMessageViewModel.getInstance();
export default interactMViewModel as InteractMessageViewModel
\ No newline at end of file
... ...
export class MessageUnReadItem{
activeCount: number = 0 //互动通知未读数
subscribeCount: number = 0 //预约消息未读数
systemCount: number = 0 //系统通知未读数
subscribeInfo: SubscribeInfo = new SubscribeInfo()
systemInfo: SystemInfo = new SystemInfo()
activeInfo: ActiveInfo = new ActiveInfo
}
class SubscribeInfo{
classify: string = ""
contentId: string = ""
contentType: string = ""
id: number = -1
message: string = ""
platform: string = ""
privateMailId: number = -1
privateMailIdList: Array< string > = []
privateMailIds: string = ""
privateMailNum: number = -1
read: boolean = false
source: string = ""
time: string = ""
title: string = ""
userId: number = -1
remark: string = ""
}
class SystemInfo{
classify: string = ""
contentType: string = ""
id: number = -1
message: string = ""
platform: string = ""
privateMailId: number = -1
privateMailIdList: Array< string > = []
privateMailIds: string = ""
privateMailNum: number = -1
read: boolean = false
source: string = ""
time: string = ""
title: string = ""
userId: number = -1
}
class ActiveInfo{
id:string = ""
message: string = ""
time: string = ""
title: string = ""
}
\ No newline at end of file
... ...
import FunctionsItem from './FunctionsItem'
@Observed
export default class MinePagePersonalFunctionsItem extends FunctionsItem {
isShowRedPoint:boolean = false
}
\ No newline at end of file
... ...
... ... @@ -24,6 +24,7 @@
"components/page/ThemeListPage",
"pages/ShowUserHeaderPage",
"pages/MineMessagePage",
"components/page/InteractMessagePage"
"components/page/InteractMessagePage",
"pages/ShowHomePageHeaderPage"
]
}
\ No newline at end of file
... ...
... ... @@ -70,6 +70,7 @@ export struct DetailPlayLiveCommon {
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)
this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment)
this.publishCommentModel.commentContent = ''
// }
}
... ...
... ... @@ -121,11 +121,12 @@ export struct PlayUIComponent {
}
}
.width('100%')
// .width(this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? 'calc(100% - 80vp)' : 'calc(100% - 32vp)')
.padding({
top: 15,
bottom: 6,
left: 10,
right: 10
left: this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? '40vp' : '16vp',
right: this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? '40vp' : '16vp'
})
.alignItems(HorizontalAlign.Start)
.visibility(this.isMenuVisible ? Visibility.Visible : Visibility.None)
... ... @@ -292,8 +293,8 @@ export struct PlayUIComponent {
.linearGradient({ angle: 0, colors: [['#99000000', 0], ['#00000000', 1]] })
.width('100%')
.padding({
left: 10,
right: 10,
left: this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? '40vp' : '16vp',
right: this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? '40vp' : '16vp',
top: 15,
bottom: 15
})
... ...
... ... @@ -28,11 +28,11 @@ export struct TopPlayComponent {
updateData() {
//直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停
if (this.liveDetailsBean.liveInfo && this.liveDetailsBean.liveInfo.previewUrl && this.liveDetailsBean.liveInfo.previewUrl.length > 0) {
if (this.liveDetailsBean.liveInfo && this.liveDetailsBean.liveInfo.previewUrl &&
this.liveDetailsBean.liveInfo.previewUrl.length > 0) {
this.imgUrl = this.liveDetailsBean.liveInfo.previewUrl
Logger.debug(TAG, 'ok+' + `${this.imgUrl}`)
}
else if (this.liveDetailsBean.fullColumnImgUrls && this.liveDetailsBean.fullColumnImgUrls.length > 0) {
} else if (this.liveDetailsBean.fullColumnImgUrls && this.liveDetailsBean.fullColumnImgUrls.length > 0) {
this.imgUrl = this.liveDetailsBean.fullColumnImgUrls[0].url
Logger.debug(TAG, 'ok-' + `${this.imgUrl}`)
}
... ... @@ -81,6 +81,7 @@ export struct TopPlayComponent {
.alignSelf(ItemAlign.Center)
}
aboutToDisappear(): void {
async aboutToDisappear(): Promise<void> {
await this.playerController?.release()
}
}
\ No newline at end of file
... ...
... ... @@ -115,6 +115,7 @@ export struct PlayerCommentComponent {
// 收藏、分享、点赞是否需要根据字段显隐
OperRowListView({
styleType: 3,
componentType: 4,
operationButtonList: ['comment', 'collect', 'share', 'like'],
contentDetailData: this.contentDetailData,
publishCommentModel: this.publishCommentModel,
... ...
... ... @@ -37,11 +37,10 @@ export struct PlayerComponent {
}
}
aboutToDisappear(): void {
async aboutToDisappear(): Promise<void> {
this.playerController?.pause()
this.playerController?.stop()
this.playerController?.release()
await this.playerController?.release()
}
updateData() {
... ...
import { ContentDetailDTO } from 'wdBean/Index'
import {
publishCommentModel
} from '../../../../../wdComponent/src/main/ets/components/comment/model/PublishCommentModel'
import { CommentComponent } from '../../../../../wdComponent/src/main/ets/components/comment/view/CommentComponent'
@Component
export struct CommentComponentPage {
scroller: Scroller = new Scroller()
@Consume contentDetailData: ContentDetailDTO
@Consume showCommentList: boolean
@State publishCommentModel: publishCommentModel = new publishCommentModel()
aboutToAppear(): void {
this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')
this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId)
this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle
this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType)
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)
}
build() {
Scroll(this.scroller) {
Stack() {
CommentComponent({
publishCommentModel: this.publishCommentModel
})
Image($r("app.media.ic_close_black"))
.width(20)
.height(20)
.onClick(() => {
this.showCommentList = false
})
.margin({ top: 10, right: 20 })
.position({ x: '100%' })
.markAnchor({ x: '100%' })
}
}
.zIndex(1000)
.backgroundColor(Color.White)
}
}
\ No newline at end of file
... ...
import { ContentDetailDTO, InteractDataDTO } from 'wdBean';
import { PlayerConstants, WDPlayerController, WDPlayerRenderView } from 'wdPlayer';
import { WDPlayerController, WDPlayerRenderView } from 'wdPlayer';
import { ContentDetailRequest } from 'wdDetailPlayApi';
import {
batchLikeAndCollectParams,
... ... @@ -11,6 +11,7 @@ import { HttpUtils } from 'wdNetwork/Index';
import { DateTimeUtils } from 'wdKit/Index';
import { PlayerBottomView } from '../view/PlayerBottomView';
import { PlayerRightView } from '../view/PlayerRightView';
import { CommentComponentPage } from './CommentComponentPage';
const TAG = 'DetailPlayShortVideoPage';
... ... @@ -32,6 +33,7 @@ export struct DetailPlayShortVideoPage {
@Provide followStatus: string = '0' // 关注状态
@Provide isOpenDetail: boolean = false // 查看详情按钮点击
@Provide isDragging: boolean = false // 拖动时间进度条
@Provide showCommentList: boolean = false
@Consume @Watch('videoStatusChange') switchVideoStatus: boolean
@Consume @Watch('pageShowChange') pageShow: number
@Consume topSafeHeight: number
... ... @@ -148,6 +150,7 @@ export struct DetailPlayShortVideoPage {
this.progressVal = Math.floor(position * 100 / duration);
}
this.queryNewsInfoOfUser()
}
async aboutToDisappear(): Promise<void> {
... ... @@ -163,10 +166,14 @@ export struct DetailPlayShortVideoPage {
PlayerBottomView({
playerController: this.playerController
})
PlayerRightView({
playerController: this.playerController
})
CommentComponentPage({}).visibility(this.showCommentList ? Visibility.Visible : Visibility.None)
.position({ y: '100%' })
.markAnchor({ y: '100%' })
}
.height('100%')
.width('100%')
... ... @@ -192,6 +199,7 @@ export struct DetailPlayShortVideoPage {
@Builder
playerViewBuilder() {
WDPlayerRenderView({
playerController: this.playerController,
onLoad: async () => {
... ... @@ -205,10 +213,13 @@ export struct DetailPlayShortVideoPage {
.padding({
bottom: this.videoLandScape === 1 ? 115 : 0,
})
.layoutWeight(1)
.align(this.videoLandScape === 0 ? Alignment.Top : Alignment.Center)
.onClick(() => {
console.error('WDPlayerRenderView=== onClick')
this.playerController?.switchPlayOrPause();
})
}
}
\ No newline at end of file
... ...
... ... @@ -43,7 +43,7 @@ export struct DetailDialog {
.height(200)
Row() {
Image($r('app.media.ic_close'))
Image($r("app.media.ic_close_white"))
.height(24).margin({ top: 20 }).onClick(() => {
this.controller.close()
if (this.isOpenDetail) {
... ...
... ... @@ -3,20 +3,56 @@ import { PlayerTitleView } from './PlayerTitleView'
import { PlayerProgressView } from './PlayerProgressView'
import { PlayerCommentView } from './PlayerCommentView'
import { PlayerTimeSeekView } from './PlayerTimeSeekView'
import { OperRowListView } from '../../../../../wdComponent/src/main/ets/components/view/OperRowListView'
import {
publishCommentModel
} from '../../../../../wdComponent/src/main/ets/components/comment/model/PublishCommentModel'
import { ContentDetailDTO } from 'wdBean/Index';
import { WindowModel } from 'wdKit/Index';
@Component
export struct PlayerBottomView {
private playerController?: WDPlayerController;
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
@Consume showComment?: boolean
@Consume isOpenDetail?: boolean
@Consume isDragging?: boolean
@Consume contentDetailData: ContentDetailDTO
@State publishCommentModel: publishCommentModel = new publishCommentModel()
aboutToAppear(): void {
this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')
this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId)
this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle
this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType)
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)
this.publishCommentModel.commentContent = ''
}
build() {
Column() {
PlayerTitleView()
PlayerProgressView({ playerController: this.playerController })
if (this.showComment) {
PlayerCommentView()
// PlayerCommentView()
OperRowListView({
pageComponentType: 1,
styleType: 3,
componentType: 4,
operationButtonList: ['comment',],
contentDetailData: this.contentDetailData,
publishCommentModel: this.publishCommentModel,
showCommentIcon: false,
onBack: () => {
WindowModel.shared.setWindowLayoutFullScreen(false)
WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', })
}
})
.padding({
bottom: -this.bottomSafeHeight + 'px'
})
}
}
.alignItems(HorizontalAlign.Start)
... ...
... ... @@ -32,6 +32,7 @@ export struct PlayerRightView {
@Consume isOpenDetail: boolean
@Consume isDragging: boolean
@Consume showComment?: boolean
@Consume showCommentList: boolean
@State likesStyle: number = this.contentDetailData.likesStyle // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空
aboutToAppear() {
... ... @@ -343,7 +344,8 @@ export struct PlayerRightView {
}
.margin({ bottom: 20 })
.onClick((event: ClickEvent) => {
ToastUtils.showToast('评论为公共方法,待开发', 1000);
// ToastUtils.showToast('评论为公共方法,待开发', 1000);
this.showCommentList = true
})
}
... ...
... ... @@ -5,6 +5,14 @@
"value": "#FFFFFF"
},
{
"name": "color_transparent",
"value": "#00000000"
},
{
"name": "color_222222",
"value": "#222222"
},
{
"name": "play_track_color",
"value": "#1AFFFFFF"
},
... ... @@ -29,6 +37,18 @@
"value": "#4DFFFFFF"
},
{
"name": "color_666666",
"value": "#666666"
},
{
"name": "color_B0B0B0",
"value": "#B0B0B0"
},
{
"name": "color_EDEDED",
"value": "#EDEDED"
},
{
"name": "divider_color",
"value": "#D3D3D3"
},
... ...
... ... @@ -3,6 +3,22 @@
{
"name": "shared_desc",
"value": "description"
},
{
"name": "footer_text",
"value": "已显示全部内容"
},
{
"name": "pull_up_load_text",
"value": "加载中..."
},
{
"name": "pull_down_refresh_text",
"value": "下拉刷新"
},
{
"name": "release_refresh_text",
"value": "松开刷新"
}
]
}
\ No newline at end of file
... ...
... ... @@ -2,7 +2,10 @@ import HuaweiAuth from './utils/HuaweiAuth'
import { JumpInterceptorAction, RouterJumpInterceptor, WDRouterPage } from 'wdRouter'
import { BusinessError } from '@kit.BasicServicesKit'
import { router } from '@kit.ArkUI'
import { AccountManagerUtils } from 'wdKit/Index'
import { AccountManagerUtils, SPHelper } from 'wdKit/Index'
import { LoginViewModel } from './pages/login/LoginViewModel'
import { SpConstants } from 'wdConstant/Index'
import { ReportDeviceInfo } from './reportDeviceInfo/ReportDeviceInfo'
class LoginJumpHandler implements JumpInterceptorAction {
... ... @@ -37,4 +40,14 @@ export class LoginModule {
}
}
// 启动进入主页 和 每次登录成功调用
static reportDeviceInfo() {
ReportDeviceInfo.reportDeviceInfo().then((res) => {
let nickName = res.touristNickName
if (res.touristNickName) {
SPHelper.default.save(SpConstants.TOURIST_NICK_NAME, res.touristNickName)
}
})
}
}
\ No newline at end of file
... ...
... ... @@ -82,6 +82,30 @@ export class LoginModel {
})
}
// loginType 0:手机号密码 2:手机号登录 3:QQ 4:微信 5:微博 6:APPLEID 7:手机号一键登录8:账号+密码 9:华为一键登录
thirdPartLogin(loginType: number, otherParams: Record<string, string|number>) {
otherParams['loginType'] = loginType
otherParams['deviceId'] = HttpUtils.getDeviceId()
return new Promise<LoginBean>((success, fail) => {
HttpRequest.post<ResponseDTO<LoginBean>>(HttpUrlUtils.getAppLoginUrl(), otherParams).then((data: ResponseDTO<LoginBean>) => {
Logger.debug("LoginViewModel:success2 ", data.message)
if (!data) {
fail("数据为空")
return
}
if (!data.data||data.code != 0) {
fail(data.message)
return
}
success(data.data)
}, (error: Error) => {
fail(error.message)
Logger.debug("LoginViewModel:error2 ", error.toString())
})
})
}
// {"password":"523acd319228efde34e8a30268ee8ca5e4fc421d72affa531676e1765940d22c","phone":"13625644528","loginType":0,"oldPassword":"BA5FD74F827AF9B271FE17CADC489C36","deviceId":"60da5af6-9c59-3566-8622-8c6c00710994"}
appLoginByPassword(phone: string, loginType: number, password: string, oldPassword: string) {
let bean: Record<string, string | number> = {};
... ...
... ... @@ -407,14 +407,9 @@ struct LoginPage {
queryUserDetail(){
this.loginViewModel.queryUserDetail().then(()=>{
router.back({
url: `${WDRouterPage.getBundleInfo()}`
}
)
router.back()
}).catch(()=>{
router.back({
url: `${WDRouterPage.getBundleInfo()}`
})
router.back()
})
}
... ...