陈剑华

Merge remote-tracking branch 'origin/main'

... ... @@ -2,8 +2,8 @@
"app": {
"bundleName": "com.peopledailychina.hosactivity",
"vendor": "$string:app_vendor",
"versionCode": 7397,
"versionName": "7.3.9.7",
"versionCode": 7398,
"versionName": "7.3.9.8",
"icon": "$media:app_icon",
"label": "$string:app_name"
}
... ...
... ... @@ -58,6 +58,10 @@ export class HttpUtils {
return SPHelper.default.getSync(SpConstants.USER_ID, "") as string
}
public static getCreatorId(): string {
return SPHelper.default.getSync(SpConstants.USER_CREATOR_ID, "") as string
}
public static getUserType(): string {
return SPHelper.default.getSync(SpConstants.USER_Type, "") as string
}
... ...
... ... @@ -1042,30 +1042,32 @@ struct createImg {
@Builder
longPicTip(weight: number, height: number) {
Flex({ direction: FlexDirection.Row }) {
Image($r('app.media.icon_long_pic'))
.width(12)
.height(12)
.margin({ right: 4 })
Text('长图')
.fontSize(10)
.fontWeight(400)
.textShadow({
radius: 1,
color: `rgba(0,0,0,0.5)`,
offsetY:1,
offsetX:1
})
.fontColor(0xffffff)
.fontFamily('PingFang SC')
.visibility(
weight / height > 2 || height / weight > 2
? Visibility.Visible : Visibility.None
)
if (weight / height > 2 || height / weight > 2){
Flex({ direction: FlexDirection.Row }) {
Image($r('app.media.icon_long_pic'))
.width(12)
.height(12)
.margin({ right: 4 })
Text('长图')
.fontSize(10)
.fontWeight(400)
.textShadow({
radius: 1,
color: `rgba(0,0,0,0.5)`,
offsetY:1,
offsetX:1
})
.fontColor(0xffffff)
.fontFamily('PingFang SC')
.visibility(
weight / height > 2 || height / weight > 2
? Visibility.Visible : Visibility.None
)
}
.width(48)
.align(Alignment.BottomEnd)
.padding({ bottom: 8 })
}
.width(48)
.align(Alignment.BottomEnd)
.padding({ bottom: 8 })
}
build() {
... ...
... ... @@ -339,7 +339,7 @@ export struct MorningEveningPaperComponent {
compListItem: this.compListItem,
})
.margin({
top: this.isHasTopView || this.audioPlayUrl.length > 0 ? 0 : 44+this.topSafeHeight
top: this.isHasTopView || this.audioPlayUrl.length > 0 ? 10 : 44+this.topSafeHeight
})
}
}
... ... @@ -429,7 +429,7 @@ export struct MorningEveningPaperComponent {
})
}
.margin({ left: 12, right: 12 })
.height(56)
.height(36)
.alignItems(VerticalAlign.Center)
.justifyContent(FlexAlign.SpaceBetween)
}
... ...
... ... @@ -230,10 +230,10 @@ export struct MultiPictureDetailItemComponent {
GestureGroup(
GestureMode.Exclusive,
// 单击返回上一层
TapGesture({ count: 1 })
.onAction(() => {
router.back()
}),
// TapGesture({ count: 1 })
// .onAction(() => {
// router.back()
// }),
// TODO:知识点:双击切换图片大小
TapGesture({ count: 2 })
.onAction(() => {
... ...
... ... @@ -187,30 +187,32 @@ struct createImg {
@Builder
longPicTip(weight: number, height: number) {
// Flex({ direction: FlexDirection.Row }) {
// Image($r('app.media.icon_long_pic'))
// .width(12)
// .height(12)
// .margin({ right: 4 })
// Text('长图')
// .fontSize(10)
// .fontWeight(400)
// .textShadow({
// radius: 1,
// color: `rgba(0,0,0,0.5)`,
// offsetY:1,
// offsetX:1
// })
// .fontColor(0xffffff)
// .fontFamily('PingFang SC')
// .visibility(
// weight / height > 2 || height / weight > 2
// ? Visibility.Visible : Visibility.None
// )
// }
// .width(48)
// .align(Alignment.BottomEnd)
// .padding({ bottom: 8 })
if (weight / height > 2 || height / weight > 2){
Flex({ direction: FlexDirection.Row }) {
Image($r('app.media.icon_long_pic'))
.width(12)
.height(12)
.margin({ right: 4 })
Text('长图')
.fontSize(10)
.fontWeight(400)
.textShadow({
radius: 1,
color: `rgba(0,0,0,0.5)`,
offsetY:1,
offsetX:1
})
.fontColor(0xffffff)
.fontFamily('PingFang SC')
.visibility(
weight / height > 2 || height / weight > 2
? Visibility.Visible : Visibility.None
)
}
.width(48)
.align(Alignment.BottomEnd)
.padding({ bottom: 8 })
}
}
build() {
... ...
... ... @@ -151,6 +151,7 @@ export class commentStatusListModel extends PageModel {
@Observed
export class commentStatusModel {
commentId: string = '';
uuid: string = ''
status: boolean = false;
level: string = '';
levelHead: string = '';
... ...
... ... @@ -874,13 +874,13 @@ struct commentFooterView {
}
}
if (this.item.id) { // 审核通过的才显示点赞
// if (this.item.id) { // 审核通过的才显示点赞
Row({ space: 6 }) {
Text(this.item.likeNum)
.fontColor(this.item.api_status?$r('app.color.color_ED2800') : $r('app.color.color_666666'))
Text(this.item.likeNum + "")
.fontColor(this.item.api_status == true ?$r('app.color.color_ED2800') : $r('app.color.color_666666'))
.fontSize(14)
Image(this.item.api_status ? $r('app.media.comment_like_select') : $r('app.media.comment_like_normal'))
Image(this.item.api_status == true ? $r('app.media.comment_like_select') : $r('app.media.comment_like_normal'))
.size({
width: 16,
height: 16
... ... @@ -890,7 +890,7 @@ struct commentFooterView {
.onClick(() => {
this.clickLike()
})
}
// }
}
// .alignItems(VerticalAlign.Bottom)
.justifyContent(FlexAlign.SpaceBetween)
... ...
import { ViewType } from 'wdConstant/Index'
import { DateTimeUtils, LazyDataSource, Logger, ToastUtils, WindowModel } from 'wdKit/Index'
import { DateTimeUtils, LazyDataSource, Logger, NumberFormatterUtils, ToastUtils, WindowModel } from 'wdKit/Index'
import { commentItemModel } from '../model/CommentModel'
import commentViewModel from '../viewmodel/CommentViewModel'
import { router, window } from '@kit.ArkUI'
... ... @@ -387,6 +387,12 @@ struct QualityCommentItem {
Row({ space: 16 }) {
Row() {
Image($r('app.media.comment_icon_pinglun')).width(16).height(16)
if (this.item.replyNum && this.item.replyNum.length > 0 && this.item.replyNum != '0') {
Text(NumberFormatterUtils.formatNumberWithWan(this.item.replyNum))
.fontSize(14)
.fontColor('#999999')
.margin({ left: 3 })
}
}.height('100%')
.onClick(() => {
this.replyComment()
... ...
... ... @@ -54,7 +54,7 @@ class CommentViewModel {
return
}
let listData = data.data as commentListModel
this.fetchCommentStatusAndConfigAuthIcon(listData, false).then((commentListModel) => {
this.fetchCommentStatusAndConfigAuthIcon(listData, false, contentId).then((commentListModel) => {
console.log(TAG, 'fetchCommentStatusAndConfigAuthIcon完成')
if (pageNum !== "1") {
... ... @@ -63,7 +63,7 @@ class CommentViewModel {
}
// 热门评论批查
this.fetchCommentStatusAndConfigAuthIcon(listData, true).then((commentListModel) => {
this.fetchCommentStatusAndConfigAuthIcon(listData, true, contentId).then((commentListModel) => {
console.log(TAG, 'hot comment fetchCommentStatusAndConfigAuthIcon完成')
listData.hotList.forEach((item) => {
... ... @@ -101,7 +101,7 @@ class CommentViewModel {
// success(listData)
this.fetchCommentStatusAndConfigAuthIcon(listData).then((commentListModel) => {
this.fetchCommentStatusAndConfigAuthIcon(listData, false, contentId).then((commentListModel) => {
console.log(TAG, 'fetchCommentStatusAndConfigAuthIcon完成')
success(commentListModel)
})
... ... @@ -160,7 +160,8 @@ class CommentViewModel {
// userHeaderUrl string
// 【迭代二新增】当前用户的头像url
bean['commentId'] = model.id;
bean['commentId'] = (model.id + "").length > 0 ? (model.id + "") : "0";
bean['uuid'] = model.uuid;
bean['targetId'] = model.targetId;
bean['targetType'] = model.targetType;
bean['status'] = model.api_status ? '1' : '0';
... ... @@ -207,14 +208,14 @@ class CommentViewModel {
bean['userName'] = SPHelper.default.getSync(SpConstants.TOURIST_NICK_NAME, "") as string
}
HttpBizUtil.post<ResponseDTO<commentItemModel>>(url, bean).then((data: ResponseDTO<commentItemModel>) => {
HttpBizUtil.post<ResponseDTO<commentItemModel>>(url, bean).then(async (data: ResponseDTO<commentItemModel>) => {
if (data.code != 0) {
ToastUtils.showToast(data.message, 1000);
fail()
return
}
ToastUtils.showToast(data.message, 1000);
let model = data.data as commentItemModel
let comment = data.data as commentItemModel
let firstCommentTime = SPHelper.default.getSync(SpConstants.FIRSTCOMMENTTIME, '') as string
... ... @@ -222,7 +223,15 @@ class CommentViewModel {
//保存首次评论时间
SPHelper.default.saveSync(SpConstants.FIRSTCOMMENTTIME, DateTimeUtils.formatDate(data.timestamp, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN))
}
success(model)
comment.targetId = model.targetId
comment.targetRelId = model.targetRelId
comment.targetRelType = model.targetRelType
comment.targetType = model.targetType
comment.targetRelObjectId = model.targetRelObjectId
await this.fetchCurrentUserAuthIcons(comment)
let newModel = commentViewModel.deepCopyCommentItemModel(comment)
success(newModel)
}, (error: Error) => {
ToastUtils.showToast('评论失败', 1000);
fail()
... ... @@ -231,10 +240,32 @@ class CommentViewModel {
})
}
async fetchCurrentUserAuthIcons(model: commentItemModel) {
if (false == HttpUtils.isLogin()) {
return
}
if (HttpUtils.getUserType() == "1") { // 普通用户
let fromUserIDs = [HttpUtils.getUserId()];
const response = await HttpRequest.post<ResponseDTO<commentStatusModel[]>>(HttpUrlUtils.getBatchUserUrl(), fromUserIDs)
if (response && response.data && response.data.length > 0) {
model.api_levelHead = response.data[0].levelHead
}
} else { // 创作者
let bean: Record<string, string[]> = {"creatorIdList": [HttpUtils.getCreatorId()]};
const response = await HttpRequest.post<ResponseDTO<commentStatusModel[]>>(HttpUrlUtils.getDetailListUrl(), bean)
if (response && response.data && response.data.length > 0) {
model.api_authIcon = response.data[0].authIcon
}
}
}
/*多接口批查*/
fetchCommentStatusAndConfigAuthIcon(model: commentListModel, hot: boolean = false): Promise<commentListModel> {
// hot 表示是否批查热门评论
// targetId 是指针对某一篇稿件的评论场景
fetchCommentStatusAndConfigAuthIcon(model: commentListModel, hot: boolean = false, targetId?: string): Promise<commentListModel> {
let commentIDs: string[] = [];
let uuidIDs: string[] = [];
let fromUserIDs: string[] = [];
... ... @@ -242,8 +273,10 @@ class CommentViewModel {
//主评论
for (const element of (hot ? model.hotList : model.list)) {
if ((element.id + '').length > 0) {
if ((element.id + '').length > 0 && (element.id + "") != "0") {
commentIDs.push(element.id + '')
} else {
uuidIDs.push(element.uuid)
}
if ((element.fromUserId + '').length > 0) {
fromUserIDs.push(element.fromUserId)
... ... @@ -256,8 +289,10 @@ class CommentViewModel {
//子评论
if (element.childComments) {
for (const obj2 of element.childComments) {
if ((obj2.id + '').length > 0) {
if ((obj2.id + '').length > 0 && (obj2.id + "") != "0") {
commentIDs.push(obj2.id + '')
} else {
uuidIDs.push(obj2.uuid)
}
if ((obj2.fromUserId + '').length > 0) {
fromUserIDs.push(obj2.fromUserId)
... ... @@ -278,8 +313,10 @@ class CommentViewModel {
let promise1 = new Promise<void>((success) => {
// HttpRequest HttpBizUtil
let url = HttpUrlUtils.getBatchCommentStatusUrl();
let bean: Record<string, string[]> = {};
let bean: Record<string, string | string[]> = {};
bean['commentIdList'] = commentIDs;
bean['targetId'] = targetId ?? ""
bean['uuidList'] = uuidIDs
HttpRequest.post<ResponseDTO<commentStatusModel[]>>(url, bean).then((data: ResponseDTO<commentStatusModel[]>) => {
if (!data || !data.data) {
success()
... ... @@ -297,13 +334,25 @@ class CommentViewModel {
//点赞
for (const element of listData) {
for (const commentModel of (hot ? model.hotList : model.list)) {
if (element.commentId == commentModel.id) {
commentModel.api_status = element.status
if ((commentModel.id + '').length > 0 && (commentModel.id + "") != "0") {
if (element.commentId == commentModel.id) {
commentModel.api_status = element.status
}
} else {
if (element.uuid == commentModel.uuid) {
commentModel.api_status = element.status
}
}
if (commentModel.childComments) {
for (const childCommentModel of commentModel.childComments) {
if (element.commentId == childCommentModel.id) {
childCommentModel.api_status = element.status
if ((childCommentModel.id + '').length > 0 && (childCommentModel.id + "") != "0") {
if (element.commentId == childCommentModel.id) {
childCommentModel.api_status = element.status
}
} else {
if (element.uuid == childCommentModel.uuid) {
childCommentModel.api_status = element.status
}
}
}
}
... ... @@ -421,7 +470,7 @@ class CommentViewModel {
newModel.api_customType = model.api_customType
newModel.authorLike = model.authorLike
newModel.avatarFrame = model.avatarFrame
newModel.avatarFrame = model.avatarFrame ?? ""
newModel.checkStatus = model.checkStatus
newModel.childCommentNum = model.childCommentNum
newModel.childComments = model.childComments
... ... @@ -455,7 +504,7 @@ class CommentViewModel {
newModel.mySelf = model.mySelf
newModel.parentId = model.parentId
newModel.region = model.region
newModel.replyNum = model.replyNum
newModel.replyNum = model.replyNum + ""
newModel.rootCommentId = model.rootCommentId
newModel.sensitiveExist = model.sensitiveExist
newModel.sensitiveShow = model.sensitiveShow
... ...
... ... @@ -46,6 +46,7 @@ export struct ZhSingleRow03 {
@State moreWidth:number = 22
@State moreTips: string = ''
scroller: Scroller = new Scroller()
@Consume @Watch('pageShowForUpdateData') pageShow :number
resetMoreTips() {
console.log('resetMoreTips', this.moreWidth, this.initMoreWidth)
... ... @@ -89,7 +90,7 @@ export struct ZhSingleRow03 {
}
async aboutToAppear(): Promise<void> {
if (HttpUtils.getUserId()) {
if (HttpUtils.isLogin()) {
this.getReserveState();
}
this.loadImg = await onlyWifiLoadImg();
... ... @@ -118,11 +119,23 @@ export struct ZhSingleRow03 {
}
}
})
// 可能有被动强制退出清空
EmitterUtils.receiveEvent(EmitterEventId.FORCE_USER_LOGIN_OUT, () => {
this.getReserveState()
})
}
pageShowForUpdateData() {
this.getReserveState()
}
// 请求所有预约状态
async getReserveState() {
if (false == HttpUtils.isLogin()) {
this.reservedIds = []
return
}
const reserveBean: reserveReqItem[] = this.compDTO.operDataList.map((item: ContentDTO) => {
const reqItem: reserveReqItem = {
liveId: item.objectId.toString(),
... ...
... ... @@ -443,8 +443,8 @@ export struct PaperSingleColumn999CardView {
Stack({ alignContent: Alignment.BottomEnd }) {
Image(this.item?.coverUrl)
.borderRadius(5)
.objectFit(ImageFit.Cover)
.aspectRatio(319 / 200) ///图片设计比例
.objectFit(ImageFit.Fill)
.aspectRatio(319 / 179) ///图片设计比例
.padding({ top: 10 })
//视频
if (this.item?.videoInfo) {
... ... @@ -490,7 +490,7 @@ export struct PaperSingleColumn999CardView {
// autoplay: true,
// loop: true,
// })
Text(this.buildLiveStateString())
.fontColor(Color.White)
.fontSize($r('app.float.vp_12'))
... ...
... ... @@ -178,10 +178,10 @@ export struct TopNavigationComponentNew {
// left: 6,
// right: 6
// })
.borderRadius({
topLeft: 6,
topRight: 6
})
// .borderRadius({
// topLeft: 6,
// topRight: 6
// })
.backgroundColor(CompUtils.isRMH(this.navItem) || CompUtils.isNews(this.navItem) ? Color.White : Color.Transparent)
}
... ...
... ... @@ -113,6 +113,16 @@ export struct MultiPictureListPage {
this.swiperIndex = targetIndex
this.currentUrl = this.photoList[targetIndex]?.picPath
})
.gesture(
GestureGroup(
GestureMode.Exclusive,
// 单击返回上一层
TapGesture({ count: 1 })
.onAction(() => {
router.back()
})
)
)
Flex({
direction: FlexDirection.Row,
... ...
... ... @@ -14,7 +14,7 @@
},
{
"name": "play_track_color",
"value": "#1AFFFFFF"
"value": "#33FFFFFF"
},
{
"name": "play_selected_color",
... ... @@ -26,7 +26,7 @@
},
{
"name": "pause_track_color",
"value": "#1AFFFFFF"
"value": "#33FFFFFF"
},
{
"name": "pause_selected_color",
... ...
... ... @@ -49,6 +49,10 @@ struct Index {
EmitterUtils.receiveEvent(EmitterEventId.AUDIO_CHANGE_TITLe, (val:string | undefined) => {
this.audioTitle = val
// 播放稿件修改时进度条清零
this.progressVal = 0
this.currentTime = '00:00'
this.totalTime = '00:00'
})
EmitterUtils.receiveEvent(EmitterEventId.AUDIO_CHANGE_STATUS, (val: number | string | undefined) => {
... ... @@ -98,13 +102,20 @@ struct Index {
build() {
Stack({ alignContent: Alignment.End }) {
Progress({ value: 0, total: 100, type: ProgressType.Linear })
Progress(
{
value: this.progressVal,
total: 100,
type: ProgressType.Linear,
})
.style({
enableSmoothEffect: false
})
.color("#ED2800")
.backgroundColor($r('app.color.white'))
.width("100%")
.height(3)
.margin({ top: 57 })
.value(this.progressVal)
.visibility(this.isExpand ? Visibility.Visible : Visibility.Hidden)
Stack({ alignContent: Alignment.End }) {
Column() { //标题 时间 进度条
... ...