yangsunyue_wd

desc:热门评论相关 90%

... ... @@ -513,6 +513,24 @@ export class HttpUrlUtils {
return url
}
/*评论状态*/
static getBatchCommentStatusUrl() {
let url = HttpUrlUtils._hostUrl + "/api/rmrb-comment/comment/zh/c/batchCommentStatus"
return url
}
/*levleIcon*/
static getBatchUserUrl() {
let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-point/auth/level/zh/c/batchUser"
return url
}
/*authIcon 20个一次上限*/
static getDetailListUrl() {
let url = HttpUrlUtils._hostUrl + "/api/rmrb-contact/contact/zh/c/master/detailList"
return url
}
//账户注销
static accountLogoutUrl() {
... ...
... ... @@ -72,6 +72,8 @@ export class WDRouterPage {
static privacySettingPage = new WDRouterPage("wdComponent", "ets/components/page/PrivacySettingPage");
// 关于页
static aboutPage = new WDRouterPage("wdComponent", "ets/components/page/SettingAboutPage");
// 精选评论页
static QualityCommentsPage = new WDRouterPage("wdComponent", "ets/components/page/QualityCommentsPage");
// 设置页
static settingPage = new WDRouterPage("wdComponent", "ets/components/page/SettingPage");
// 设置页
... ...
... ... @@ -17,6 +17,7 @@ import { CardParser } from './CardParser';
import { LiveHorizontalReservationComponent } from './view/LiveHorizontalReservationComponent';
import { ZhGridLayout02 } from './compview/ZhGridLayout02';
import { Card5Component } from './cardview/Card5Component'
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
/**
* comp适配器.
... ... @@ -69,6 +70,11 @@ export struct CompParser {
Text(compDTO.compStyle)
.width(CommonConstants.FULL_PARENT)
.padding(10)
.onClick(()=>{
if (compDTO.compStyle === CompStyle.Zh_Single_Row_06) {//精选评论
WDRouterRule.jumpWithPage(WDRouterPage.QualityCommentsPage)
}
})
// .backgroundColor(Color.Brown) // 展示本页未实现的compStyle
}
}
... ...
... ... @@ -33,9 +33,17 @@ export class commentListModel extends PageModel{
totalCount: number = 0
hasNext: number = 0
list: commentItemModel[] = []
}
export class commentStatusListModel extends PageModel{
pageNum: number = 0
pageSize: number = 0
totalCount: number = 0
hasNext: number = 0
list: commentStatusModel[] = []
}
@Observed
export class commentItemModel {
authorLike: string = ''
... ... @@ -94,9 +102,17 @@ export class commentItemModel {
targetType:string = '';
visitorComment:string = '';
shareInfo:commentItemShareInfoModel = new commentItemShareInfoModel;
// targetId:string = '';
// targetId:string = '';
// targetId:string = '';
api_commentId:string = '';
api_status:string = '';
api_level:string = '';
api_levelHead:string = 'http';
api_userId:string = '';
api_creatorId:string = '';
api_userType:string = '';
api_authIcon:string = '';
}
... ... @@ -105,4 +121,19 @@ export class commentItemShareInfoModel {
shareSummary: string = ''
shareTitle: string = ''
shareUrl: string = ''
}
\ No newline at end of file
}
export class commentStatusModel {
commentId:string = '';
status:string = '';
level:string = '';
levelHead:string = '';
userId:string = '';
creatorId:string = '';
userType:string = '';
authIcon:string = '';
}
... ...
... ... @@ -6,6 +6,13 @@ import { commentItemModel, commentListModel, WDPublicUserType } from '../model/C
import commentViewModel from '../viewmodel/CommentViewModel'
import { CommentText } from './CommentText';
import measure from '@ohos.measure'
import {CommentCustomDialog} from './CommentCustomDialog'
const TAG = 'CommentComponent';
@Entry
@Preview
... ... @@ -13,10 +20,19 @@ import measure from '@ohos.measure'
export struct CommentComponent {
@State private browSingModel: commentListModel = new commentListModel()
isloading: boolean = false
// @State allDatas :commentItemModel[] = [];
@State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource();
dialogController: CustomDialogController = new CustomDialogController({
builder: CommentCustomDialog(),
autoCancel: true,
alignment: DialogAlignment.Bottom,
customStyle: true,
offset: {
dx: 0,
dy: -20
}
})
aboutToAppear() {
this.getData();
this.getData();
... ... @@ -59,7 +75,7 @@ export struct CommentComponent {
.height('32')
.objectFit(ImageFit.Cover)
.borderRadius(16)
Image($r('app.media.icon_border_test'))
Image(item.api_levelHead)
.width('48')
.height('48')
.objectFit(ImageFit.Cover)
... ... @@ -167,7 +183,6 @@ export struct CommentComponent {
// ///1天~2天:1天前
// ///2天~:日期隐藏
Text(DateTimeUtils.getCommentTime(Number.parseFloat(item.createTime)))
.fontColor($r('app.color.color_B0B0B0'))
.fontSize(12)
... ... @@ -212,6 +227,10 @@ export struct CommentComponent {
List() {
ListItemGroup({ header: this.titleHeader() })
.onClick(()=>{
console.log(TAG)
this.dialogController.open()
})
LazyForEach(this.allDatas, (item: commentItemModel, index: number) => {
if (item.hasMore) {
ListItemGroup({ header: this.CommentHeaderItem(item), footer: this.GroupFooterView(item) }) {
... ... @@ -219,6 +238,9 @@ export struct CommentComponent {
ListItem() {
ChildCommentItem();
}
.onClick(()=>{
console.log(TAG)
})
})
}
}else {
... ... @@ -227,6 +249,9 @@ export struct CommentComponent {
ListItem() {
ChildCommentItem();
}
.onClick(()=>{
console.log(TAG)
})
})
}
}
... ...
@Preview
@CustomDialog
export struct CommentCustomDialog {
controller: CustomDialogController = new CustomDialogController({
builder: CommentCustomDialog(),
autoCancel: true,
alignment: DialogAlignment.Bottom,
customStyle: true,
})
build() {
Column() {
Row() {
TextArea({ placeholder: '优质评论会获得最佳评论人的称号' })
.height('100%')
.width('100%')
.backgroundColor($r('app.color.color_transparent'))
}
.backgroundColor('#F9F9F9')
// .width('100%')
.margin({ top: 12,right: 12, left: 12, bottom: 10 })
.height(80)
.borderRadius(4)
Row(){
Row() {
Row({ space: 12 }) {
//语音暂时不做,隐藏
// Image($r('app.media.WDInput_voice')).width(30).height(30)
Image($r('app.media.WDInput_keyboardImage')).width(30).height(30)
}
// Blank()
Row() {
Text('发布')
.backgroundColor('#F89381')
.width(80)
.height(30)
.fontSize(15)
.fontColor(Color.White)
.textAlign(TextAlign.Center)
.borderRadius(4)
}
}.justifyContent(FlexAlign.SpaceBetween)
.width('100%')
.height(60)
// .margin({ right: 12, left: 12 })
// .backgroundColor(Color.Red)
}.padding({left:12, right:12})
}.backgroundColor(Color.White)
.width('100%')
.offset({
y: 20
})
}
}
... ...
... ... @@ -2,7 +2,8 @@ import { ViewType } from 'wdConstant/Index'
import { DateTimeUtils, LazyDataSource, WindowModel } from 'wdKit/Index'
import { commentItemModel, commentListModel } from '../model/CommentModel'
import commentViewModel from '../viewmodel/CommentViewModel'
import { window } from '@kit.ArkUI'
import { router, window } from '@kit.ArkUI'
import { CustomTitleUI } from '../../reusable/CustomTitleUI'
const TAG = 'QualityCommentsComponent';
... ... @@ -10,11 +11,14 @@ const TAG = 'QualityCommentsComponent';
@Preview
@Component
export struct QualityCommentsComponent {
@State tileOpacity: number = 0;
firstPositionY: number = 0;
bottomSafeHeight: string = AppStorage.get<number>('bottomSafeHeight') + 'px';
topSafeHeight: number = AppStorage.get<number>('topSafeHeight') as number;
@State private browSingModel: commentListModel = new commentListModel()
isloading: boolean = false
lastWindowColor:string = '#ffffff'
currentWindowColor:string = '#FF4202'
lastWindowColor: string = '#ffffff'
currentWindowColor: string = '#FF4202'
@State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource();
aboutToDisappear(): void {
... ... @@ -32,25 +36,25 @@ export struct QualityCommentsComponent {
this.fullScreen();
commentViewModel.fetchQualityCommentListLocal(getContext()).then(commentListModel => {
this.allDatas.push(...commentListModel.list)
})
// commentViewModel.fetchQualityCommentList('1').then((commentListModel) => {
// if (commentListModel && commentListModel.list && commentListModel.list.length > 0) {
// // commentListModel.hasMore = true;
// // this.browSingModel.viewType = ViewType.LOADED;
// this.allDatas.push(...commentListModel.list)
// // if (commentListModel.list.length === this.browSingModel.pageSize) {
// // this.browSingModel.currentPage++;
// // this.browSingModel.hasMore = true;
// // } else {
// // this.browSingModel.hasMore = false;
// // }
// } else {
// this.browSingModel.viewType = ViewType.EMPTY;
// }
// commentViewModel.fetchQualityCommentListLocal(getContext()).then(commentListModel => {
// this.allDatas.push(...commentListModel.list)
// })
commentViewModel.fetchQualityCommentList('1').then((commentListModel) => {
if (commentListModel && commentListModel.list && commentListModel.list.length > 0) {
// commentListModel.hasMore = true;
// this.browSingModel.viewType = ViewType.LOADED;
this.allDatas.push(...commentListModel.list)
// if (commentListModel.list.length === this.browSingModel.pageSize) {
// this.browSingModel.currentPage++;
// this.browSingModel.hasMore = true;
// } else {
// this.browSingModel.hasMore = false;
// }
} else {
this.browSingModel.viewType = ViewType.EMPTY;
}
})
}
fullScreen() {
... ... @@ -69,30 +73,143 @@ export struct QualityCommentsComponent {
@Builder
titleHeader() {
Row() {
Image($r('app.media.comment_img_banner')).width('100%').aspectRatio(375 / 283);
Image($r('app.media.comment_img_banner')).width('100%')
.height(283)
// .aspectRatio(375 / 283);
}
.onAreaChange((oldValue: Area, newValue: Area) => {
let persent = Math.abs(Number(newValue.globalPosition.y)) / 150
if (persent > 1) {
persent = 1
}
this.tileOpacity = persent
})
}
/*透明导航栏*/
@Builder
TabbarTransparent() {
RelativeContainer() {
//标题栏目
Image($r('app.media.icon_arrow_left_white'))
.width(24)
.height(24)
.objectFit(ImageFit.Auto)
.id("back_icon")
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
left: { anchor: "__container__", align: HorizontalAlign.Start }
})
.offset({
y: (this.topSafeHeight / 2) + 'px'
})
.margin({ left: 16 })
.onClick(() => {
router.back()
})
}
.visibility(this.tileOpacity > 0 ? 1 : 0)
.height(this.topSafeHeight + vp2px(44) + 'px')
.width('100%')
.backgroundColor($r('app.color.color_transparent'))
}
/*导航栏*/
@Builder
TabbarNormal() {
RelativeContainer() {
//标题栏目
Image($r('app.media.icon_arrow_left'))
.width(24)
.height(24)
.objectFit(ImageFit.Auto)
.id("back_icon")
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
left: { anchor: "__container__", align: HorizontalAlign.Start }
})
.offset({
y: (this.topSafeHeight / 2) + 'px'
})
.margin({ left: 16 })
.onClick(() => {
router.back()
})
Text('精选评论')
// .height('42lpx')
.maxLines(1)
.id("title")
.fontSize('35lpx')
.fontWeight(400)
.fontColor($r('app.color.color_222222'))
.lineHeight('42lpx')
.alignRules({
center: {anchor: "__container__", align: VerticalAlign.Center},
middle: {anchor: "__container__", align: HorizontalAlign.Center}
})
.offset({
y: (this.topSafeHeight / 2) + 'px'
})
}
.visibility(this.tileOpacity > 0 ? 0 : 1)
.opacity(this.tileOpacity)
.height(this.topSafeHeight + vp2px(44) + 'px')
.width('100%')
.backgroundColor($r('app.color.white'))
}
build() {
Column() {
// this.titleHeader()
List({ space: 28 }) {
ListItemGroup({ header: this.titleHeader() })
Stack({ alignContent: Alignment.Top }) {
Scroll() {
Column() {
Stack() {
this.titleHeader()
List({ space: 12 }) {
// ListItemGroup({ header: this.titleHeader() })
LazyForEach(this.allDatas, (item: commentItemModel, index: number) => {
ListItem() {
QualityCommentItem({ item: item }).margin({ left: 12, right: 12 })
}
})
ListItem() {
}.height(this.bottomSafeHeight)
}
.margin({ top: 196 })
.height("100%")
.width("100%")
.edgeEffect(EdgeEffect.Spring)
.nestedScroll({
scrollForward: NestedScrollMode.PARENT_FIRST,
scrollBackward: NestedScrollMode.SELF_FIRST
})
// .margin({ bottom: this.bottomSafeHeight })
// .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
}.alignContent(Alignment.Top)
}.backgroundColor(this.currentWindowColor).width('100%')
}
.friction(0.6)
.scrollBar(BarState.Off)
.edgeEffect(EdgeEffect.None)
.width('100%')
.height('100%')
this.TabbarTransparent()
this.TabbarNormal()
LazyForEach(this.allDatas, (item: commentItemModel, index: number) => {
ListItem() {
QualityCommentItem({ item: item }).margin({ left: 12, right: 12 })
}
// .offset({
// y:-87
// })
})
}
// .contentStartOffset(- 87)
.edgeEffect(EdgeEffect.Spring)
.margin({bottom:this.bottomSafeHeight})
// .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
}.backgroundColor(this.currentWindowColor).height('100%').width('100%')
}
}
}
... ... @@ -103,104 +220,120 @@ struct QualityCommentItem {
build() {
Column() {
/*头像以及昵称*/
RelativeContainer() {
Image(this.item.fromUserHeader)
.width(50)
.height(50)
.borderRadius(25)
.borderWidth(2)
.borderColor(Color.White)
.id('image1')
.alignRules({
top: { anchor: "__container__", align: VerticalAlign.Top },
left: { anchor: "__container__", align: HorizontalAlign.Start }
})
.offset(
{
y: -16
}
)
Text(this.item.fromUserName)
.fontSize(14)
.fontColor('#222222')
.fontWeight(FontWeight.Medium)
.id('text1')
.alignRules({
bottom: { anchor: "image1", align: VerticalAlign.Bottom },
left: { anchor: "image1", align: HorizontalAlign.End }
})
.offset(
{
x: 6,
y: -6 - 16
}
)
}.height(42)
Column().height(16).width('100%').opacity(0)
Column() {
/*评论内容*/
Text() {
ImageSpan($r('app.media.WDBestCommentTitleDotIcon'))
.width(12)
.height(12)
.objectFit(ImageFit.Fill)
.offset({
y: -6
/*头像以及昵称*/
RelativeContainer() {
Image(this.item.fromUserHeader)
.width(50)
.height(50)
.borderRadius(25)
.borderWidth(2)
.borderColor(Color.White)
.id('image1')
.alignRules({
top: { anchor: "__container__", align: VerticalAlign.Top },
left: { anchor: "__container__", align: HorizontalAlign.Start }
})
Span(' ' + this.item.commentContent)
.fontSize(16)
.offset(
{
y: -16
}
)
Text(this.item.fromUserName)
.fontSize(14)
.fontColor('#222222')
.fontWeight(FontWeight.Medium)
}.margin({ top: 10 })
/*分割线*/
Row() {
.id('text1')
.alignRules({
bottom: { anchor: "image1", align: VerticalAlign.Bottom },
left: { anchor: "image1", align: HorizontalAlign.End }
})
.offset(
{
x: 6,
y: -6 - 16
}
)
}.height(42)
Column() {
/*评论内容*/
Text() {
ImageSpan($r('app.media.WDBestCommentTitleDotIcon'))
.width(12)
.height(12)
.objectFit(ImageFit.Fill)
.offset({
y: -6
})
Span(' ' + this.item.commentContent)
.fontSize(16)
.fontColor('#222222')
.fontWeight(FontWeight.Medium)
}.margin({ top: 10 })
/*分割线*/
Row() {
}.width('100%').margin({ top: 10, left: 0, right: 0 }).backgroundColor('#EDEDED').height(2.5);
}.width('100%').margin({ top: 10, left: 0, right: 0 }).backgroundColor('#EDEDED').height(2.5);
/*文章或者评论*/
Row() {
/*文章或者评论*/
Row() {
Image($r('app.media.comment_img_link')).width(16).height(16)
Text(this.item.shareInfo.shareTitle)
.fontSize(14)
.fontColor('#666666')
.margin({ left: 6, right: 12 })
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
}.height(40).layoutWeight(1)
Row() {
Image($r('app.media.comment_img_link')).width(16).height(16)
Text(this.item.shareInfo.shareTitle)
.fontSize(14)
.fontColor('#666666')
.margin({ left: 6, right: 12 })
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
}.height(40).layoutWeight(1)
Image($r('app.media.more')).width(12).height(12)
Image($r('app.media.more')).width(12).height(12)
}.width('100%').height(40).justifyContent(FlexAlign.SpaceBetween)
}.width('100%').height(40).justifyContent(FlexAlign.SpaceBetween)
}
.backgroundColor('#F9F9F9')
.width('100%')
.alignItems(HorizontalAlign.Start)
.borderRadius(4)
.padding({ left: 12, right: 12 })
}
.backgroundColor('#F9F9F9')
.width('100%')
.alignItems(HorizontalAlign.Start)
.borderRadius(4)
.padding({ left: 12, right: 12 })
/*时间 点赞评论*/
Row() {
/*时间 点赞评论*/
Row() {
Text(DateTimeUtils.getCommentTime(DateTimeUtils.getDateTimestamp(this.item.createTime))).fontSize(14).fontColor('#999999')
Text(DateTimeUtils.getCommentTime(DateTimeUtils.getDateTimestamp(this.item.createTime)))
.fontSize(14)
.fontColor('#999999')
Row({space:16}){
Row(){
Image($r('app.media.comment_icon_pinglun')).width(16).height(16)
}
Row({ space: 16 }) {
Row() {
Image($r('app.media.comment_icon_pinglun')).width(16).height(16)
}
Row(){
//comment_like_select
Image($r(this.item.likeNum?'app.media.comment_like_select':'app.media.comment_like_normal')).width(16).height(16)
if (this.item.likeNum){Text(this.item.likeNum).fontColor(this.item.isLike?'#ED2800':'#999999').fontSize(14).margin({left:3})}
Row() {
//comment_like_select
Image($r(this.item.likeNum ? 'app.media.comment_like_select' : 'app.media.comment_like_normal'))
.width(16)
.height(16)
if (this.item.likeNum) {
Text(this.item.likeNum)
.fontColor(this.item.isLike ? '#ED2800' : '#999999')
.fontSize(14)
.margin({ left: 3 })
}
}
}
}
}.height(38).width('100%').justifyContent(FlexAlign.SpaceBetween)
}.height(38).width('100%').justifyContent(FlexAlign.SpaceBetween)
}.backgroundColor('#FFFFFF').padding({ top: 0, left: 16, right: 16 }).borderRadius(4)
}.backgroundColor('#FFFFFF').padding({ top: 0, left: 16, right: 16 }).borderRadius(4)
}
}
}
\ No newline at end of file
}
... ...
import { Logger, ResourcesUtils } from 'wdKit/Index';
import { HttpUrlUtils, ResponseDTO } from 'wdNetwork/Index';
import { HttpBizUtil, HttpUrlUtils, ResponseDTO } from 'wdNetwork/Index';
import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest';
import { commentItemModel, commentListModel } from '../model/CommentModel';
import { commentItemModel, commentListModel, commentStatusListModel, commentStatusModel } from '../model/CommentModel';
import HashMap from '@ohos.util.HashMap';
import { ifaa } from '@kit.OnlineAuthenticationKit';
const TAG = "CommentViewModel"
class CommentViewModel {
private static instance: CommentViewModel
/**
* 单例模式
* @returns
... ... @@ -19,35 +21,34 @@ class CommentViewModel {
return CommentViewModel.instance;
}
/*获取本地mock数据*/
async getCommentLocal(context: Context): Promise<commentListModel> {
Logger.info(TAG, `getBottomNavDataMock start`);
let compRes: ResponseDTO<commentListModel> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<commentListModel>>(context,'comment_local.json' );
let compRes: ResponseDTO<commentListModel> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<commentListModel>>(context, 'comment_local.json');
if (!compRes || !compRes.data) {
Logger.info(TAG, `getAppointmentListDataLocal compRes is empty`);
return new commentListModel()
}
Logger.info(TAG, `getAppointmentListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`);
return compRes.data
return this.fetchCommentStatusAndConfigAuthIcon(compRes.data)
// this.fetchCommentStatusAndConfigAuthIcon(compRes.data)
// return compRes.data
}
/*获取本地mock数据*/
/*获取热门评论本地mock数据*/
async fetchQualityCommentListLocal(context: Context): Promise<commentListModel> {
Logger.info(TAG, `getBottomNavDataMock start`);
let compRes: ResponseDTO<commentListModel> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<commentListModel>>(context,'qualityComment_local.json' );
let compRes: ResponseDTO<commentListModel> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<commentListModel>>(context, 'qualityComment_local.json');
if (!compRes || !compRes.data) {
Logger.info(TAG, `getAppointmentListDataLocal compRes is empty`);
return new commentListModel()
}
Logger.info(TAG, `getAppointmentListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`);
return compRes.data
return this.fetchCommentStatusAndConfigAuthIcon(compRes.data)
}
//qualityComment_local.json
fetchQualityCommentList(pageNum: string) {
/*获取热门评论*/
fetchQualityCommentList(pageNum: string): Promise<commentListModel> {
let url = HttpUrlUtils.getQualityCommentUrl() + `?&pageSize=${10}&pageNum=${pageNum}`
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return new Promise<commentListModel>((success, fail) => {
... ... @@ -62,7 +63,15 @@ class CommentViewModel {
}
let listData = data.data as commentListModel
success(listData)
this.fetchCommentStatusAndConfigAuthIcon(listData).then((commentListModel) =>{
console.log(TAG, 'fetchCommentStatusAndConfigAuthIcon完成')
success(commentListModel)
})
// return this.fetchCommentStatusAndConfigAuthIcon(listData)
// this.fetchCommentStatusAndConfigAuthIcon(listData)
// success(listData)
}, (error: Error) => {
fail(error.message)
Logger.debug(TAG, error.toString())
... ... @@ -70,35 +79,192 @@ class CommentViewModel {
})
}
/*多接口批查*/
fetchCommentStatusAndConfigAuthIcon(model: commentListModel): Promise<commentListModel> {
let commentIDs: string[] = [];
let fromUserIDs: string[] = [];
// BaseGetRequest(contentID:number,contentType:string,pageNum:string){
// let url = HttpUrlUtils.getMyCollectionListDataUrl()+ `?type=${type}&operateTag=${1}&pageSize=${10}&pageNum=${pageNum}`
// if (tagId.length > 0) {
// url = url + `&tagId=${tagId}`
// }
// let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders()
// return WDHttp.get<ResponseDTO<commentListModel>>(url, headers)
// }
//
//
// fetchCommentList(contentID:number,contentType:string,pageNum:string):Promise<commentListModel>{
// return new Promise<commentListModel>((success,error) => {
// this.BaseGetRequest(contentID,contentType,pageNum).then((navResDTO: ResponseDTO<commentListModel>) => {
// if (!navResDTO || navResDTO.code != 0) {
// // success(this.getAppointmentListDataLocal(context))
// return
// }
// Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp);
// let listData = navResDTO.data as commentListModel
// success(listData)
// }).catch((err: Error) => {
// Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`);
// error("page data invalid");
// })
// })
// }
let creatorIDs: string[] = [];
//主评论
for (const element of model.list) {
if ((element.id + '').length > 0) {
commentIDs.push(element.id + '')
}
if ((element.fromUserId + '').length > 0) {
fromUserIDs.push(element.fromUserId)
}
if ((element.fromCreatorId + '').length > 0) {
creatorIDs.push(element.fromCreatorId)
}
//子评论
if (element.childComments) {
for (const obj2 of element.childComments) {
if ((obj2.id + '').length > 0) {
commentIDs.push(obj2.id + '')
}
if ((obj2.fromUserId + '').length > 0) {
fromUserIDs.push(obj2.fromUserId)
}
if ((obj2.fromCreatorId + '').length > 0) {
creatorIDs.push(obj2.fromCreatorId)
}
}
}
}
let promiseArray: Promise<commentStatusListModel | void>[] = [];
//TODO 未登录不用批查
if (commentIDs.length > 0) {
let promise1 = new Promise<void>((success) => {
// HttpRequest HttpBizUtil
let url = HttpUrlUtils.getBatchCommentStatusUrl();
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
let bean: Record<string, string[]> = {};
bean['commentIdList'] = commentIDs;
HttpRequest.post<ResponseDTO<commentStatusModel[]>>(url, bean, headers).then((data: ResponseDTO<commentStatusModel[]>) => {
if (!data || !data.data) {
success()
return
}
if (data.code != 0) {
success()
return
}
if (data.data.length == 0) {
success()
return
}
let listData = data.data as commentStatusModel[]
for (const element of listData) {
for (const commentModel of model.list) {
if (element.commentId == commentModel.id) {
commentModel.api_status = element.status
}
if (commentModel.childComments) {
for (const childCommentModel of commentModel.childComments) {
if (element.commentId == childCommentModel.id) {
childCommentModel.api_status = element.status
}
}
}
}
}
success()
}, (error: Error) => {
success()
Logger.debug(TAG, error.toString())
})
})
promiseArray.push(promise1);
}
if (fromUserIDs.length > 0) {
let promise2 = new Promise<void>((success) => {
let url = HttpUrlUtils.getBatchUserUrl();
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
// HttpRequest HttpBizUtil
HttpRequest.post<ResponseDTO<commentStatusModel[]>>(url, fromUserIDs, headers).then((data: ResponseDTO<commentStatusModel[]>) => {
if (!data || !data.data) {
success()
return
}
if (data.code != 0) {
success()
return
}
if (data.data.length == 0) {
success()
return
}
let listData = data.data as commentStatusModel[]
for (const element of listData) {
for (const commentModel of model.list) {
if (element.userId == commentModel.fromUserId) {
commentModel.api_levelHead = element.levelHead
}
if (commentModel.childComments) {
for (const childCommentModel of commentModel.childComments) {
if (element.userId == childCommentModel.fromUserId) {
childCommentModel.api_levelHead = element.levelHead
}
}
}
}
}
success()
}, (error: Error) => {
success()
Logger.debug(TAG, error.toString())
})
})
promiseArray.push(promise2);
}
//TODO 一次20个上限
if (creatorIDs.length > 0) {
let promise3 = new Promise<void>((success) => {
let url = HttpUrlUtils.getDetailListUrl();
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
let bean: Record<string, string[]> = {};
bean['creatorIdList'] = creatorIDs;
// HttpRequest HttpBizUtil
HttpRequest.post<ResponseDTO<commentStatusModel[]>>(url, bean, headers).then((data: ResponseDTO<commentStatusModel[]>) => {
if (!data || !data.data) {
success()
return
}
if (data.code != 0) {
success()
return
}
if (data.data.length == 0) {
success()
return
}
let listData = data.data as commentStatusModel[]
for (const element of listData) {
for (const commentModel of model.list) {
if (element.creatorId == commentModel.fromCreatorId) {
commentModel.api_authIcon = element.authIcon
}
if (commentModel.childComments) {
for (const childCommentModel of commentModel.childComments) {
if (element.creatorId == childCommentModel.fromCreatorId) {
childCommentModel.api_authIcon = element.authIcon
}
}
}
}
}
success()
}, (error: Error) => {
success()
Logger.debug(TAG, error.toString())
})
})
promiseArray.push(promise3);
}
return new Promise<commentListModel>((success) => {
Promise.all(promiseArray).then(() => {
console.log(TAG, 'Promise.all');
success(model)
})
})
}
}
... ...
import { QualityCommentsComponent } from '../comment/view/QualityCommentsComponent';
@Entry
@Component
struct QualityCommentsPage {
build() {
Column(){
QualityCommentsComponent();
}
}
}
\ No newline at end of file
... ...
... ... @@ -6,6 +6,7 @@
"pages/MineHomePage",
"components/page/SettingPage",
"components/page/SettingAboutPage",
"components/page/QualityCommentsPage",
"components/page/PrivacySettingPage",
"components/page/EditUserInfoPage",
"components/page/EditUserNikeNamePage",
... ...
... ... @@ -502,6 +502,406 @@
"topicType": null,
"uuid": "dcc25c99-8e27-42fc-aa29-861beec958f2",
"visitorComment": 1
}, {
"authorLike": 0,
"avatarFrame": "",
"checkStatus": 2,
"commentContent": "外婆企图",
"commentContentSensitive": "",
"commentLevel": 1,
"commentPics": "",
"commentSensitive": "",
"commentType": "2",
"contentAuthor": 0,
"createTime": "2024-04-01 14:22:37",
"creatorFlag": 0,
"fromCreatorId": "",
"fromUserHeader": "https://cdnjdphoto.aikan.pdnews.cn//zhbj/img/user/2024040114/133af3190cd84eb7a5e70c4c23071881.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg",
"fromUserId": "574444396143685",
"fromUserName": "人民日报网友2Ai3yZ",
"fromUserType": 1,
"h5Url": "",
"highQualityExpireTime": "2024-04-15T18:26:05+0800",
"highQualityTime": "2024-04-12T18:26:05+0800",
"id": 56792966,
"likeNum": 0,
"mySelf": 0,
"pageId": null,
"parentId": -1,
"region": "安徽",
"replyNum": 0,
"rootCommentId": 56792966,
"sensitiveExist": 0,
"sensitiveShow": 1,
"shareInfo": {
"shareCoverUrl": "",
"shareSummary": "说话的艺术,说到底就是生活的艺术。",
"shareTitle": "学会这三种说话方式,受益无穷",
"shareUrl": "https://people.pdnews.cn/column/30044115488-500005262017"
},
"targetId": "30044115488",
"targetRelId": "500005262017",
"targetRelObjectId": "2003",
"targetRelType": 1,
"targetStatus": 0,
"targetTitle": "学会这三种说话方式,受益无穷",
"targetType": 13,
"toUserContentAuthor": 0,
"toUserName": "",
"topFlag": 0,
"topicType": null,
"uuid": "dcc25c99-8e27-42fc-aa29-861beec958f2",
"visitorComment": 1
}, {
"authorLike": 0,
"avatarFrame": "",
"checkStatus": 2,
"commentContent": "外婆企图",
"commentContentSensitive": "",
"commentLevel": 1,
"commentPics": "",
"commentSensitive": "",
"commentType": "2",
"contentAuthor": 0,
"createTime": "2024-04-01 14:22:37",
"creatorFlag": 0,
"fromCreatorId": "",
"fromUserHeader": "https://cdnjdphoto.aikan.pdnews.cn//zhbj/img/user/2024040114/133af3190cd84eb7a5e70c4c23071881.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg",
"fromUserId": "574444396143685",
"fromUserName": "人民日报网友2Ai3yZ",
"fromUserType": 1,
"h5Url": "",
"highQualityExpireTime": "2024-04-15T18:26:05+0800",
"highQualityTime": "2024-04-12T18:26:05+0800",
"id": 56792966,
"likeNum": 0,
"mySelf": 0,
"pageId": null,
"parentId": -1,
"region": "安徽",
"replyNum": 0,
"rootCommentId": 56792966,
"sensitiveExist": 0,
"sensitiveShow": 1,
"shareInfo": {
"shareCoverUrl": "",
"shareSummary": "说话的艺术,说到底就是生活的艺术。",
"shareTitle": "学会这三种说话方式,受益无穷",
"shareUrl": "https://people.pdnews.cn/column/30044115488-500005262017"
},
"targetId": "30044115488",
"targetRelId": "500005262017",
"targetRelObjectId": "2003",
"targetRelType": 1,
"targetStatus": 0,
"targetTitle": "学会这三种说话方式,受益无穷",
"targetType": 13,
"toUserContentAuthor": 0,
"toUserName": "",
"topFlag": 0,
"topicType": null,
"uuid": "dcc25c99-8e27-42fc-aa29-861beec958f2",
"visitorComment": 1
}, {
"authorLike": 0,
"avatarFrame": "",
"checkStatus": 2,
"commentContent": "外婆企图",
"commentContentSensitive": "",
"commentLevel": 1,
"commentPics": "",
"commentSensitive": "",
"commentType": "2",
"contentAuthor": 0,
"createTime": "2024-04-01 14:22:37",
"creatorFlag": 0,
"fromCreatorId": "",
"fromUserHeader": "https://cdnjdphoto.aikan.pdnews.cn//zhbj/img/user/2024040114/133af3190cd84eb7a5e70c4c23071881.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg",
"fromUserId": "574444396143685",
"fromUserName": "人民日报网友2Ai3yZ",
"fromUserType": 1,
"h5Url": "",
"highQualityExpireTime": "2024-04-15T18:26:05+0800",
"highQualityTime": "2024-04-12T18:26:05+0800",
"id": 56792966,
"likeNum": 0,
"mySelf": 0,
"pageId": null,
"parentId": -1,
"region": "安徽",
"replyNum": 0,
"rootCommentId": 56792966,
"sensitiveExist": 0,
"sensitiveShow": 1,
"shareInfo": {
"shareCoverUrl": "",
"shareSummary": "说话的艺术,说到底就是生活的艺术。",
"shareTitle": "学会这三种说话方式,受益无穷",
"shareUrl": "https://people.pdnews.cn/column/30044115488-500005262017"
},
"targetId": "30044115488",
"targetRelId": "500005262017",
"targetRelObjectId": "2003",
"targetRelType": 1,
"targetStatus": 0,
"targetTitle": "学会这三种说话方式,受益无穷",
"targetType": 13,
"toUserContentAuthor": 0,
"toUserName": "",
"topFlag": 0,
"topicType": null,
"uuid": "dcc25c99-8e27-42fc-aa29-861beec958f2",
"visitorComment": 1
}, {
"authorLike": 0,
"avatarFrame": "",
"checkStatus": 2,
"commentContent": "外婆企图",
"commentContentSensitive": "",
"commentLevel": 1,
"commentPics": "",
"commentSensitive": "",
"commentType": "2",
"contentAuthor": 0,
"createTime": "2024-04-01 14:22:37",
"creatorFlag": 0,
"fromCreatorId": "",
"fromUserHeader": "https://cdnjdphoto.aikan.pdnews.cn//zhbj/img/user/2024040114/133af3190cd84eb7a5e70c4c23071881.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg",
"fromUserId": "574444396143685",
"fromUserName": "人民日报网友2Ai3yZ",
"fromUserType": 1,
"h5Url": "",
"highQualityExpireTime": "2024-04-15T18:26:05+0800",
"highQualityTime": "2024-04-12T18:26:05+0800",
"id": 56792966,
"likeNum": 0,
"mySelf": 0,
"pageId": null,
"parentId": -1,
"region": "安徽",
"replyNum": 0,
"rootCommentId": 56792966,
"sensitiveExist": 0,
"sensitiveShow": 1,
"shareInfo": {
"shareCoverUrl": "",
"shareSummary": "说话的艺术,说到底就是生活的艺术。",
"shareTitle": "学会这三种说话方式,受益无穷",
"shareUrl": "https://people.pdnews.cn/column/30044115488-500005262017"
},
"targetId": "30044115488",
"targetRelId": "500005262017",
"targetRelObjectId": "2003",
"targetRelType": 1,
"targetStatus": 0,
"targetTitle": "学会这三种说话方式,受益无穷",
"targetType": 13,
"toUserContentAuthor": 0,
"toUserName": "",
"topFlag": 0,
"topicType": null,
"uuid": "dcc25c99-8e27-42fc-aa29-861beec958f2",
"visitorComment": 1
}, {
"authorLike": 0,
"avatarFrame": "",
"checkStatus": 2,
"commentContent": "外婆企图",
"commentContentSensitive": "",
"commentLevel": 1,
"commentPics": "",
"commentSensitive": "",
"commentType": "2",
"contentAuthor": 0,
"createTime": "2024-04-01 14:22:37",
"creatorFlag": 0,
"fromCreatorId": "",
"fromUserHeader": "https://cdnjdphoto.aikan.pdnews.cn//zhbj/img/user/2024040114/133af3190cd84eb7a5e70c4c23071881.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg",
"fromUserId": "574444396143685",
"fromUserName": "人民日报网友2Ai3yZ",
"fromUserType": 1,
"h5Url": "",
"highQualityExpireTime": "2024-04-15T18:26:05+0800",
"highQualityTime": "2024-04-12T18:26:05+0800",
"id": 56792966,
"likeNum": 0,
"mySelf": 0,
"pageId": null,
"parentId": -1,
"region": "安徽",
"replyNum": 0,
"rootCommentId": 56792966,
"sensitiveExist": 0,
"sensitiveShow": 1,
"shareInfo": {
"shareCoverUrl": "",
"shareSummary": "说话的艺术,说到底就是生活的艺术。",
"shareTitle": "学会这三种说话方式,受益无穷",
"shareUrl": "https://people.pdnews.cn/column/30044115488-500005262017"
},
"targetId": "30044115488",
"targetRelId": "500005262017",
"targetRelObjectId": "2003",
"targetRelType": 1,
"targetStatus": 0,
"targetTitle": "学会这三种说话方式,受益无穷",
"targetType": 13,
"toUserContentAuthor": 0,
"toUserName": "",
"topFlag": 0,
"topicType": null,
"uuid": "dcc25c99-8e27-42fc-aa29-861beec958f2",
"visitorComment": 1
}, {
"authorLike": 0,
"avatarFrame": "",
"checkStatus": 2,
"commentContent": "外婆企图",
"commentContentSensitive": "",
"commentLevel": 1,
"commentPics": "",
"commentSensitive": "",
"commentType": "2",
"contentAuthor": 0,
"createTime": "2024-04-01 14:22:37",
"creatorFlag": 0,
"fromCreatorId": "",
"fromUserHeader": "https://cdnjdphoto.aikan.pdnews.cn//zhbj/img/user/2024040114/133af3190cd84eb7a5e70c4c23071881.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg",
"fromUserId": "574444396143685",
"fromUserName": "人民日报网友2Ai3yZ",
"fromUserType": 1,
"h5Url": "",
"highQualityExpireTime": "2024-04-15T18:26:05+0800",
"highQualityTime": "2024-04-12T18:26:05+0800",
"id": 56792966,
"likeNum": 0,
"mySelf": 0,
"pageId": null,
"parentId": -1,
"region": "安徽",
"replyNum": 0,
"rootCommentId": 56792966,
"sensitiveExist": 0,
"sensitiveShow": 1,
"shareInfo": {
"shareCoverUrl": "",
"shareSummary": "说话的艺术,说到底就是生活的艺术。",
"shareTitle": "学会这三种说话方式,受益无穷",
"shareUrl": "https://people.pdnews.cn/column/30044115488-500005262017"
},
"targetId": "30044115488",
"targetRelId": "500005262017",
"targetRelObjectId": "2003",
"targetRelType": 1,
"targetStatus": 0,
"targetTitle": "学会这三种说话方式,受益无穷",
"targetType": 13,
"toUserContentAuthor": 0,
"toUserName": "",
"topFlag": 0,
"topicType": null,
"uuid": "dcc25c99-8e27-42fc-aa29-861beec958f2",
"visitorComment": 1
}, {
"authorLike": 0,
"avatarFrame": "",
"checkStatus": 2,
"commentContent": "外婆企图",
"commentContentSensitive": "",
"commentLevel": 1,
"commentPics": "",
"commentSensitive": "",
"commentType": "2",
"contentAuthor": 0,
"createTime": "2024-04-01 14:22:37",
"creatorFlag": 0,
"fromCreatorId": "",
"fromUserHeader": "https://cdnjdphoto.aikan.pdnews.cn//zhbj/img/user/2024040114/133af3190cd84eb7a5e70c4c23071881.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg",
"fromUserId": "574444396143685",
"fromUserName": "人民日报网友2Ai3yZ",
"fromUserType": 1,
"h5Url": "",
"highQualityExpireTime": "2024-04-15T18:26:05+0800",
"highQualityTime": "2024-04-12T18:26:05+0800",
"id": 56792966,
"likeNum": 0,
"mySelf": 0,
"pageId": null,
"parentId": -1,
"region": "安徽",
"replyNum": 0,
"rootCommentId": 56792966,
"sensitiveExist": 0,
"sensitiveShow": 1,
"shareInfo": {
"shareCoverUrl": "",
"shareSummary": "说话的艺术,说到底就是生活的艺术。",
"shareTitle": "学会这三种说话方式,受益无穷",
"shareUrl": "https://people.pdnews.cn/column/30044115488-500005262017"
},
"targetId": "30044115488",
"targetRelId": "500005262017",
"targetRelObjectId": "2003",
"targetRelType": 1,
"targetStatus": 0,
"targetTitle": "学会这三种说话方式,受益无穷",
"targetType": 13,
"toUserContentAuthor": 0,
"toUserName": "",
"topFlag": 0,
"topicType": null,
"uuid": "dcc25c99-8e27-42fc-aa29-861beec958f2",
"visitorComment": 1
}, {
"authorLike": 0,
"avatarFrame": "",
"checkStatus": 2,
"commentContent": "外婆企图",
"commentContentSensitive": "",
"commentLevel": 1,
"commentPics": "",
"commentSensitive": "",
"commentType": "2",
"contentAuthor": 0,
"createTime": "2024-04-01 14:22:37",
"creatorFlag": 0,
"fromCreatorId": "",
"fromUserHeader": "https://cdnjdphoto.aikan.pdnews.cn//zhbj/img/user/2024040114/133af3190cd84eb7a5e70c4c23071881.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg",
"fromUserId": "574444396143685",
"fromUserName": "人民日报网友2Ai3yZ",
"fromUserType": 1,
"h5Url": "",
"highQualityExpireTime": "2024-04-15T18:26:05+0800",
"highQualityTime": "2024-04-12T18:26:05+0800",
"id": 56792966,
"likeNum": 0,
"mySelf": 0,
"pageId": null,
"parentId": -1,
"region": "安徽",
"replyNum": 0,
"rootCommentId": 56792966,
"sensitiveExist": 0,
"sensitiveShow": 1,
"shareInfo": {
"shareCoverUrl": "",
"shareSummary": "说话的艺术,说到底就是生活的艺术。",
"shareTitle": "学会这三种说话方式,受益无穷",
"shareUrl": "https://people.pdnews.cn/column/30044115488-500005262017"
},
"targetId": "30044115488",
"targetRelId": "500005262017",
"targetRelObjectId": "2003",
"targetRelType": 1,
"targetStatus": 0,
"targetTitle": "学会这三种说话方式,受益无穷",
"targetType": 13,
"toUserContentAuthor": 0,
"toUserName": "",
"topFlag": 0,
"topicType": null,
"uuid": "dcc25c99-8e27-42fc-aa29-861beec958f2",
"visitorComment": 1
}],
"pageNum": 1,
"pageSize": 10,
... ...