陈剑华

Merge remote-tracking branch 'origin/main'

Showing 19 changed files with 149 additions and 77 deletions
... ... @@ -3,6 +3,7 @@ import { ContentDetailDTO, TopicInfo } from 'wdBean/Index';
import { ToastUtils } from 'wdKit';
import { WDShare } from 'wdShare/Index';
import { TrackConstants } from 'wdTracking/Index';
import font from '@ohos.font';
/**
* 早晚报页面标题bar
... ... @@ -14,6 +15,10 @@ export struct PaperTitleComponent {
@Consume subTitle?: string
@Consume topicInfo: TopicInfo
aboutToAppear() {
font.registerFont({
familyName: 'SourceHanSerifSC-Heavy',
familySrc: $rawfile('font/SourceHanSerifSC-Heavy.ttf')
})
}
build() {
... ... @@ -54,7 +59,7 @@ export struct PaperTitleComponent {
.margin({ left: 10 })
.fontSize(22)
.fontColor($r('app.color.white'))
.fontFamily('Source Han Serif CN')
.fontFamily('SourceHanSerifSC-Heavy')
.maxLines(1)
... ... @@ -125,7 +130,7 @@ export struct PaperTitleComponent {
@Builder
rightDecorateBuilder() {
Row()
.width('100vp')
.width('80vp')
.height('18vp')
.clip(new Path({
commands: `M${vp2px(9)} 0 H${vp2px(91)} V${vp2px(18)} L0 ${vp2px(18)} Z`
... ...
... ... @@ -11,6 +11,8 @@ import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
import { InfomationCardClick } from '../../utils/infomationCardClick';
import { SearchShowRed, titleInitRes, textItem } from '../../utils/searchShowRed';
import router from '@ohos.router'
import { ToastUtils } from 'wdKit';
import MinePageDatasModel from '../../model/MinePageDatasModel';
const TAG: string = 'Card2Component'
/**
... ... @@ -140,7 +142,22 @@ export struct Card2Component {
this.clicked = true;
}
persistentStorage(this.contentDTO.objectId);
this.jumpDetail()
})
}
/**
* 是否需要判断某种类型才需要判断内容是否存在的场景,目前测试没发现问题
*/
jumpDetail(){
MinePageDatasModel.getAssertDetailData(this.contentDTO.relId,this.contentDTO.objectId,this.contentDTO.relType).then((value) => {
if(value == "1"){
ProcessUtils.processPage(this.contentDTO)
}else{
ToastUtils.shortToast("内容不存在")
}
}).catch((err: Error) => {
console.log(TAG, JSON.stringify(err))
})
}
}
... ...
... ... @@ -131,6 +131,7 @@ export struct CommentComponent {
Column() {
if (showGapLine) {
Blank().height(12)
Divider().strokeWidth(6).color('#f5f5f5')
}
... ... @@ -493,7 +494,11 @@ struct ChildCommentItem {
.onClick(() => {
this.replyComment()
})
if (this.item.commentPics.length > 0) {
Image(this.item.commentPics)
.width(88).height(88)
.margin({top: 6 + (this.item.commentContent.length > 0 ? 0 : 15), left: 95})
}
commentFooterView({
item: this.item,
... ... @@ -712,6 +717,12 @@ struct commentHeaderView {
this.replyComment()
})
if (this.item.commentPics.length > 0) {
Image(this.item.commentPics)
.width(88).height(88)
.margin({top: 6 + (this.item.commentContent.length > 0 ? 0 : 15), left: 60})
}
commentFooterView({
item: this.item,
dialogController: this.dialogController,
... ...
... ... @@ -36,6 +36,8 @@ export struct CommentCustomDialog {
textInputController: TextAreaController = new TextAreaController()
@State positionInfo: CaretOffset = { index: 0, x: 0, y: 0 }
@State publishButtonOpacity: number = 0.5
@State inputViewHeight: number = 80
@Provide maxInputLength: number = 100
aboutToAppear(): void {
}
... ... @@ -98,15 +100,32 @@ export struct CommentCustomDialog {
.width('100%')
.backgroundColor($r('app.color.color_transparent'))
.caretColor("#ED2800")
.maxLength(this.maxInputLength)
.onWillInsert(data => {
if (this.publishCommentModel.commentContent.length + data.insertValue.length > this.maxInputLength) {
ToastUtils.showToast("已达到输入上限", 3000)
return false
}
return true
})
.onChange(value => {
this.publishCommentModel.commentContent = value;
if ((this.textInputController.getTextContentLineCount() - 3) > 0) {
this.inputViewHeight = 80 + (this.textInputController.getTextContentLineCount() - 3) * 18
}
if (value.length > 0) {
this.publishButtonOpacity = 1.0
} else {
this.publishButtonOpacity = 0.5
}
})
.onPaste(value => {
if (this.publishCommentModel.commentContent.length + value.length > this.maxInputLength) {
ToastUtils.showToast("已达到输入上限", 3000)
}
})
.onFocus(() => {
if (this.emojiSwitch) {
this.emojiSwitch = false
... ... @@ -119,7 +138,7 @@ export struct CommentCustomDialog {
.backgroundColor('#F9F9F9')
// .width('100%')
.margin({ top: 12, right: 12, left: 12, bottom:10})
.height(80)
.height(this.inputViewHeight)
.borderRadius(4)
Row() {
... ... @@ -198,7 +217,24 @@ export struct CommentCustomDialog {
}
if (this.voiceSwitch) {
VoiceInputView({voiceRecoginizerResult:(result: string) => {
this.publishCommentModel.commentContent = result;
let beforeStr = ""
let afterStr = ""
const offset = this.textInputController.getCaretOffset().index
if (offset > 0) {
beforeStr = this.publishCommentModel.commentContent.slice(0, offset)
}
if (offset < this.publishCommentModel.commentContent.length) {
afterStr = this.publishCommentModel.commentContent.slice(offset)
}
if (this.publishCommentModel.commentContent.length + result.length > this.maxInputLength) {
let length = this.maxInputLength - this.publishCommentModel.commentContent.length
if (length < result.length) {
result.substring(0, length)
}
ToastUtils.showToast("已达到输入上限", 3000)
}
this.publishCommentModel.commentContent = beforeStr + result + afterStr
}}).height(150)
}
... ... @@ -213,6 +249,7 @@ export struct CommentCustomDialog {
@Component
struct emojiView {
@Consume maxInputLength: number
@ObjectLink publishCommentModel: publishCommentModel
/*没找到获取系统emoji的方案*/
private emojiArray = ["😀","😁","😂","😃","😄","😅","😆","😇","😈","😉","😊","😋","😌","😍","😎","😏","😐","😑","😒","😓","😔","😕","😖","😗","😘","😙","😚","😛","😜","😝","😞","😟","😠","😡","😢","😣","😤","😥","😦","😧","😨","😩","😪","😫","😬","😭","😮","😯","😰","😱","😲","😳","😴","😵","😶","😷","😸","😹","😺","😻","😼","😽","😾","😿","🙀","🙅","🙆","🙇","🙈","🙉","🙊","🙋","🙌","🙍","🙎","🙏"]
... ... @@ -284,6 +321,10 @@ struct emojiView {
} else {
Logger.debug(TAG, "charCode: " + emoji.charCodeAt(0) + " ==> " + emoji)
if (this.publishCommentModel.commentContent.length + emoji.length > this.maxInputLength) {
ToastUtils.showToast("已达到输入上限", 3000)
return
}
this.publishCommentModel.commentContent = this.publishCommentModel.commentContent + emoji
}
... ...
import { ContentDTO } from 'wdBean/Index'
import { StringUtils, UserDataLocal } from 'wdKit/Index'
import { DateTimeUtils, StringUtils, UserDataLocal } from 'wdKit/Index'
import MinePageDatasModel from '../../../model/MinePageDatasModel'
import { CommentLikeOperationRequestItem } from '../../../viewmodel/CommentLikeOperationRequestItem'
import { CommentListItem } from '../../../viewmodel/CommentListItem'
... ... @@ -45,7 +45,7 @@ export struct ChildCommentComponent {
.fontColor($r('app.color.color_222222'))
.margin({ bottom: 1 })
.maxLines(1)
Text(`${this.data.createTime}`)
Text(DateTimeUtils.getCommentTime(DateTimeUtils.getDateTimestamp(this.data.createTime)))
.fontColor($r('app.color.color_B0B0B0'))
.fontSize(12)
.lineHeight(16)
... ...
... ... @@ -288,7 +288,7 @@ struct ChannelSubscriptionLayout {
}else {
Image(item.channelId === this.indexSettingChannelId ? $r('app.media.index_setting_button_active') :
$r('app.media.index_setting_button'))
.objectFit(ImageFit.Contain)
.objectFit(ImageFit.Fill)
.rotate({
angle: index === 1 ? 180 : 0
})
... ...
... ... @@ -260,7 +260,7 @@ export struct TopNavigationComponentNew {
buildTabBarItems(mourningCheckFn: (channelId: string) => boolean) {
ForEach(this.topNavList, (navItem: TopNavDTO, index: number) => {
ListItem() {
this.tabBarBuilder(navItem, index)
this.tabBarBuilder(navItem, index,true)
}
.grayscale(mourningCheckFn(`${navItem.channelId}`) ? 1 : 0)
});
... ... @@ -374,7 +374,7 @@ export struct TopNavigationComponentNew {
* @param index
*/
@Builder
tabBarBuilder(item: TopNavDTO, index: number) {
tabBarBuilder(item: TopNavDTO, index: number,isRmh:boolean = false) {
Column() {
if (item.iconUrl && item.iconCUrl) {
... ... @@ -398,11 +398,17 @@ export struct TopNavigationComponentNew {
})
.maxLines(this.MAX_LINE)
.id(index.toString())
if(isRmh){
Image($r('app.media.icon_channel_active'))//.colorFilter(ColorUtils.getDrawingColorFilter(this.getBothColor("")))
.width(20)
.height(3)
.visibility(this.currentTopNavSelectedIndex === index?Visibility.Visible:Visibility.Hidden)
}else{
if (this.currentTopNavSelectedIndex === index) {
Image($r('app.media.icon_channel_active'))//.colorFilter(ColorUtils.getDrawingColorFilter(this.getBothColor("")))
.width(20)
.height(3)
}
}
}
... ...
... ... @@ -89,29 +89,28 @@ export struct PeopleShipMainComponent {
if (this.viewType == ViewType.LOADING) {
this.LoadingLayout()
}
// else if (this.viewType == ViewType.ERROR) {
else if (this.viewType == ViewType.ERROR) {
//缺省页
EmptyComponent({
emptyType: this.pageModel.emptyType,
emptyButton: true,
retry: () => {
this.getData()
}
})
.grayscale(this.GrayManage.get().isRmhMourning(`${this.channelId}`) ? 1 : 0)
} else if (this.viewType == ViewType.EMPTY) {
// //缺省页
// // EmptyComponent({
// // emptyType: this.pageModel.emptyType,
// // emptyButton: true,
// // retry: () => {
// // this.getData()
// // }
// // })
// // .grayscale(this.GrayManage.get().isRmhMourning(`${this.channelId}`) ? 1 : 0)
//
// } else if (this.viewType == ViewType.EMPTY) {
// // //缺省页
// // EmptyComponent({
// // emptyType: this.pageModel.emptyType,
// // emptyButton: true,
// // retry: () => {
// // this.getData()
// // }
// // })
// // .grayscale(this.GrayManage.get().isRmhMourning(`${this.channelId}`) ? 1 : 0)
//
// }
EmptyComponent({
emptyType: this.pageModel.emptyType,
emptyButton: true,
retry: () => {
this.getData()
}
})
.grayscale(this.GrayManage.get().isRmhMourning(`${this.channelId}`) ? 1 : 0)
}
else {
if (this.followList.length == 0) {
this.ListLayout()
... ...
... ... @@ -12,14 +12,14 @@ export struct detailedSkeleton {
Column() {
Column() {
textArea('100%', 20)
textArea('50%', 20)
textArea('52.5%', 20)
}
.SkeletonStyle()
.alignItems(HorizontalAlign.Start)
Column() {
textArea('30%', 12)
textArea('30%', 12)
textArea('23%', 12)
textArea('23%', 12)
}
.SkeletonStyle()
.alignItems(HorizontalAlign.Start)
... ...
import router from '@ohos.router'
import { DateTimeUtils, NetworkUtil, StringUtils, WindowModel } from 'wdKit';
import { DateTimeUtils, NetworkUtil, NumberFormatterUtils, StringUtils, WindowModel } from 'wdKit';
import { WDRouterPage, WDRouterRule } from 'wdRouter';
import { editModelParams } from '../model/EditInfoModel';
import { HomePageBottomCommentComponent } from '../components/mine/home/HomePageBottomCommentComponent';
... ... @@ -154,7 +154,7 @@ struct MineHomePage {
Row() {
Row() {
Text(this.handlerNum(this.browseNum.toString()))
Text(`${NumberFormatterUtils.formatNumberWithWan(this.browseNum)}`)
.textStyle()
Text("阅读")
.textStyle2()
... ... @@ -168,7 +168,7 @@ struct MineHomePage {
.vertical(true)
.opacity(0.4)
Row() {
Text(this.handlerNum(this.commentNum.toString()))
Text(`${NumberFormatterUtils.formatNumberWithWan(this.commentNum)}`)
.textStyle()
Text("评论")
.textStyle2()
... ... @@ -182,7 +182,7 @@ struct MineHomePage {
.vertical(true)
.opacity(0.4)
Row() {
Text(this.handlerNum(this.attentionNum.toString()))
Text(`${NumberFormatterUtils.formatNumberWithWan(this.attentionNum)}`)
.textStyle()
Text("关注")
.textStyle2()
... ... @@ -520,23 +520,6 @@ struct MineHomePage {
})
}
handlerNum(number: string) {
const num = number??'0';
if (Number.parseInt(num) <= 9999) {
return Number.parseInt(num).toString()
} else if (Number.parseInt(num) > 9999 && Number.parseInt(num) <= 99999999) {
const num1: string = num.slice(0, -4); // 万
const num2: string = num.slice(-4, -3); // 千
return num2 === '0' ? num1 +'万' : num1 + '.' + num2 + '万'
} else if (Number.parseInt(num) > 99999999) {
const num1: string = num.slice(0, -8); // 亿
const num2: string = num.slice(-8, -7);
return num2 === '0' ? num1 +'亿' : num1 + '.' + num2 + '亿'
}
return num
}
getUserLevel(){
MinePageDatasModel.getUserLevelData(getContext(this)).then((value)=>{
if(value!=null){
... ...
import router from '@ohos.router'
import { Params } from 'wdBean';
import { DateTimeUtils, NetworkUtil, StringUtils } from 'wdKit';
import { DateTimeUtils, NetworkUtil, NumberFormatterUtils, StringUtils } from 'wdKit';
import { TrackingPageBrowse, TrackConstants, ParamType, Tracking } from 'wdTracking/Index';
import { OtherHomePageBottomCommentComponent } from '../components/mine/home/OtherHomePageBottomCommentComponent';
import { OtherHomePageBottomFollowComponent } from '../components/mine/home/OtherHomePageBottomFollowComponent';
... ... @@ -129,7 +129,7 @@ struct OtherNormalUserHomePage {
Row() {
Row() {
Text(`${this.browseNum}`)
Text(`${NumberFormatterUtils.formatNumberWithWan(this.browseNum)}`)
.textStyle()
Text("阅读")
.textStyle2()
... ... @@ -143,7 +143,7 @@ struct OtherNormalUserHomePage {
.vertical(true)
.opacity(0.4)
Row() {
Text(`${this.commentNum}`)
Text(`${NumberFormatterUtils.formatNumberWithWan(this.commentNum)}`)
.textStyle()
Text("评论")
.textStyle2()
... ... @@ -156,7 +156,7 @@ struct OtherNormalUserHomePage {
.vertical(true)
.opacity(0.4)
Row() {
Text(`${this.attentionNum}`)
Text(`${NumberFormatterUtils.formatNumberWithWan(this.attentionNum)}`)
.textStyle()
Text("关注")
.textStyle2()
... ...
... ... @@ -143,7 +143,7 @@ export struct DetailPlayVLivePage {
Stack({ alignContent: Alignment.Top }) {
// 直播背景图,模糊处理
Image(this.liveDetailPageLogic.imgUrl)
Image(this.liveDetailPageLogic.getLiveCoverUrl())
.height('100%')
.width('100%')
.blur(100)
... ...
... ... @@ -84,4 +84,11 @@ export class LiveDetailPageLogic {
}
}
getLiveCoverUrl() {
if (this.contentDetailData.fullColumnImgUrls.length > 0) {
return this.contentDetailData.fullColumnImgUrls[0].url
}
return ''
}
}
\ No newline at end of file
... ...
... ... @@ -18,8 +18,8 @@ export struct TabChatItemComponent {
build() {
Row() {
Image(StringUtils.isEmpty(this.item.senderUserAvatarUrl) ? $r('app.media.default_head') :
this.item.senderUserAvatarUrl)
Image(this.item.senderUserAvatarUrl)
.alt($r('app.media.default_head'))
.borderRadius(90)
.width(24)
.height(24)
... ...
... ... @@ -16,7 +16,8 @@ export struct TabLiveItemComponent {
build() {
Column() {
Row() {
Image(StringUtils.isEmpty(this.item.senderUserAvatarUrl) ? $r('app.media.default_head') : this.item.senderUserAvatarUrl)
Image(this.item.senderUserAvatarUrl)
.alt($r('app.media.default_head'))
.borderRadius(90)
.width(24)
.height(24)
... ...
... ... @@ -258,7 +258,7 @@ export struct PlayUIComponent {
.fontWeight(400)
.fontColor(Color.White)
if (this.liveRoomDataBean.pv > 0 && !StringUtils.isEmpty(this.liveUrl)) {
if (this.liveRoomDataBean.pv > 0) {
Image($r('app.media.icon_live_player_status_end'))
.width(12)
.height(12)
... ...
... ... @@ -164,6 +164,7 @@ export struct PlayerEndView {
.borderRadius(4)
if (this.contentDetailData.rmhInfo != null) {
Image(this.contentDetailData.rmhInfo?.rmhHeadUrl)
.alt($r('app.media.default_head'))
.width(80)
.height(80)
.borderRadius(40)
... ...
... ... @@ -88,7 +88,6 @@ export struct DetailVideoListPage {
}
await this.getContentDetail(this.contentId, this.relId, this.relType)
}
await this.queryVideoList()
// console.log(TAG, 'aboutToAppear', JSON.stringify(action.params))
} else {
... ... @@ -100,7 +99,7 @@ export struct DetailVideoListPage {
aboutToAppear() {
// 在视频详情页
this.peopleShipHomeCreatorId = AppStorage.get<string>('peopleShipHomeCreatorId') || '';
// console.info(`cj2024 peopleShipHomeCreatorId = ${this.peopleShipHomeCreatorId}`)
// console.info(TAG, `cj2024 peopleShipHomeCreatorId = ${this.peopleShipHomeCreatorId}`)
if (this.peopleShipHomeCreatorId) {
// 从人民号号主传过来的
this.getPeopleShipHomeDetail(this.peopleShipHomeCreatorId);
... ... @@ -246,6 +245,8 @@ export struct DetailVideoListPage {
// console.log('获取互动点赞等数据===', JSON.stringify(res))
})
this.data.push(resDTO.data[0])
// console.log(TAG, 'getContentDetail 视频列表===', JSON.stringify(this.data))
await this.queryVideoList()
}
})
}
... ... @@ -332,7 +333,7 @@ export struct DetailVideoListPage {
// console.log(TAG, 'cj2024 queryVideoList:', JSON.stringify(res.data))
await this.getContentInteract(res.data)
this.data = this.data.concat(res.data)
// console.log('视频列表===', JSON.stringify(res.data))
// console.log(TAG, 'queryVideoList 视频列表===', JSON.stringify(this.data))
}
})
}
... ...
... ... @@ -232,15 +232,15 @@ export struct VideoChannelPage {
.backgroundColor(Color.Transparent)
}
//顶部渐变遮罩
// .linearGradient({
// colors: [
// ['rgba(0, 0, 0, 0.0)', 0.0], ['rgba(0, 0, 0, 0.3)', 1.0]
// ]
// })
.zIndex(20)
.height($r('app.float.top_tab_bar_height_common'))
.margin({
.height(44 + px2vp(this.topSafeHeight))
//顶部渐变遮罩
.linearGradient({
direction: GradientDirection.Top, // 渐变方向
colors: this.currentTopNavSelectedIndex === 0 ? [['rgba(18, 18, 18, 0)', 0],
['rgba(18, 18, 18, 0.5)', 1.0]] : []// 数组末尾元素占比小于1时满足重复着色效果
})
.padding({
top: px2vp(this.topSafeHeight)
})
.visibility(this.displayDirection === DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None)
... ...