陈剑华

Merge remote-tracking branch 'origin/main'

# Conflicts:
#	sight_harmony/features/wdComponent/src/main/ets/components/cardview/MoreComponent.ets
Showing 51 changed files with 1527 additions and 268 deletions
... ... @@ -13,6 +13,11 @@ export class ContentConstants {
*/
static readonly TYPE_LIVE: string = "2";
/**
* 3:活动
*/
static readonly TYPE_Activity: string = "3";
static readonly TYPE_FOUR: string = "4";
/**
* 5:专题详情
... ...
... ... @@ -106,7 +106,7 @@ export class ProcessUtils {
case ContentConstants.TYPE_AUDIO:
ProcessUtils.gotoAudio(content)
break;
case ContentConstants.TYPE_TELETEXT:
case ContentConstants.TYPE_TELETEXT:case ContentConstants.TYPE_Activity:
// 图文详情,跳转h5
if (content?.linkUrl) { //有 linkUrl 走专题页展示逻辑
ProcessUtils.gotoSpecialTopic(content,true)
... ...
... ... @@ -175,3 +175,6 @@ export { ReserveItemBean } from './src/main/ets/bean/live/ReserveItemBean';
export { FeedbackTypeBean } from './src/main/ets/bean/detail/FeedbackTypeBean';
export { FeedBackParams } from './src/main/ets/bean/content/FeedBackParams';
... ...
... ... @@ -90,6 +90,8 @@ export class ContentDTO implements BaseDTO {
// 链接类型: 0:无链接;1:内链(文章);2:外链
openType: string = '';
extra: string = ''
sameContentList:ContentDTO[] = []
sameContentListJson:string = ""
/*
本地辅助字段
*/
... ...
export interface FeedBackParams {
content:string
classifyFlagIds:string
userContact:string
userName:string
appVersion:string
appDevice:string
}
\ No newline at end of file
... ...
export interface FeedbackTypeBean {
classifyName: string;
id: number;
isselect: boolean;
isSelect: boolean;
}
\ No newline at end of file
... ...
... ... @@ -6,7 +6,7 @@ export interface TopicInfo {
commentFlag: number;
commentPreviewFlag: number;
commentShowFlag: number;
// frontFlag?: any;
frontFlag: number;
frontLinkObject?: FrontLinkObject;
posterFlag: number;
posterUrl: string;
... ...
... ... @@ -16,6 +16,8 @@ export { LikeComponent } from "./src/main/ets/components/view/LikeComponent"
export { TopNavigationComponent } from "./src/main/ets/components/page/TopNavigationComponent"
export { TopNavigationComponentNew } from "./src/main/ets/components/page/TopNavigationComponentNew"
export { LabelComponent } from "./src/main/ets/components/view/LabelComponent"
export { BannerComponent } from "./src/main/ets/components/view/BannerComponent"
... ...
import { FeedbackTypeBean, PhotoListBean } from 'wdBean/Index';
import { FeedBackParams, FeedbackTypeBean, PhotoListBean } from 'wdBean/Index';
import { AppUtils,
DeviceUtil,
FastClickUtil, Logger, NetworkUtil, StringUtils, ToastUtils, UserDataLocal } from 'wdKit/Index';
... ... @@ -33,8 +33,6 @@ export struct FeedBackActivity {
//添加图片
addPic: PhotoListBean = {itemType:1} as PhotoListBean
@State pics: PhotoListBean[] = [this.addPic] as PhotoListBean[]
// 选择媒体文件的最大数目
selectNum = 3;
async aboutToAppear() {
await this.getContentDetailData()
... ... @@ -60,9 +58,9 @@ export struct FeedBackActivity {
GridCol({
}) {
Row(){
Toggle({ type: ToggleType.Checkbox, isOn: false })
Toggle({ type: ToggleType.Checkbox, isOn: feedbackTypeBean.isSelect })
.onChange((select) => {
feedbackTypeBean.isselect = select
feedbackTypeBean.isSelect = select
this.canSubmit = this.checkSubmit()
})
Text(feedbackTypeBean.classifyName)
... ... @@ -140,7 +138,6 @@ export struct FeedBackActivity {
if(await FastClickUtil.isMinDelayTime()){
return
}
let temp: PhotoListBean[] = [] as PhotoListBean[]
temp.length = this.pics.length - 1;
let tempIndex = 0;
... ... @@ -267,7 +264,8 @@ export struct FeedBackActivity {
// 设置photoPicker的参数
let PhotoSelectOptions = new picker.PhotoSelectOptions();
PhotoSelectOptions.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE; // 过滤选择媒体文件类型
PhotoSelectOptions.maxSelectNumber = this.selectNum; // 选择媒体文件的最大数目
let max = 3-this.pics.length+1
PhotoSelectOptions.maxSelectNumber = max; // 选择媒体文件的最大数目
let mediaFlag = false;
let photoPicker = new picker.PhotoViewPicker(); // 使用图库选择器对象前,需要先创建PhotoViewPicker实例
photoPicker.select(PhotoSelectOptions).then((PhotoSelectResult) => {
... ... @@ -278,26 +276,35 @@ export struct FeedBackActivity {
// 其中包含Array<string>类型的photoUris,为返回图库选择后的媒体文件的uri数组;还包含boolean类型的isOriginalPhoto,指示返回图库选择后的媒体文件是否为原图。
// 声明变量array,其取值为PhotoSelectResult中的数组。
array = PhotoSelectResult['photoUris'];
let beforeLen = this.pics.length;
let startIndex = this.pics.length-1;
let beforeLen = this.pics.length + array.length;
let totalLen = this.pics.length+array.length;
if(totalLen > 3){
totalLen = 3
}
this.pics.length = totalLen;
// this.pics.length = totalLen;
let tempPics = [] as PhotoListBean[]
tempPics.length = totalLen;
let startIndex = 0;
this.pics.forEach((value) => {
if(value.itemType == 2){
value.id = startIndex
tempPics[startIndex] = value;
startIndex = startIndex+1;
mediaFlag = true;
}
})
array.forEach((value) => {
let pic: PhotoListBean = {itemType:2,picPath:value} as PhotoListBean
pic.id = startIndex
this.pics[startIndex] = pic
tempPics[startIndex] = pic;
startIndex = startIndex+1;
mediaFlag = true;
Logger.info(TAG, `select image/video uri: ${value}`);
})
if(this.pics.length<=3 && beforeLen != 3 && array.length != 3){
if(startIndex<3){
this.addPic.id = startIndex
this.pics[this.pics.length-1]=this.addPic;
tempPics[startIndex]=this.addPic;
}
this.pics = tempPics;
}
if (mediaFlag) {
this.getFilenameByUriForMedia(array);
... ... @@ -325,8 +332,8 @@ export struct FeedBackActivity {
//问题类型必选
let selectType = ""
this.feedbackTypeBeans.forEach((value) => {
if(value.isselect){
selectType = selectType+","
if(value.isSelect){
selectType = selectType+value.id+","
}
})
if(!StringUtils.isEmpty(selectType)){
... ... @@ -343,29 +350,31 @@ export struct FeedBackActivity {
}
try {
let map: HashMap<String,String> = {} as HashMap<String,String>
//反馈内容
map.set("content", this.contact);
//投诉类型 id
map.set("classifyFlagIds", selectType);
if(!StringUtils.isEmpty(this.email)){
let feedBackParams: FeedBackParams = {
//反馈内容
"content": this.contact,
//投诉类型 id
"classifyFlagIds": selectType,
//设备
"appVersion": "V" + AppUtils.getAppVersionName(),
"appDevice": "harmony" + DeviceUtil.getDisplayVersion() + " " + DeviceUtil.getProductModel()
} as FeedBackParams
//邮箱
map.set("userContact", this.email);
if(!StringUtils.isEmpty(this.email)){
feedBackParams.userContact = this.email
}
//用户名称
if (!StringUtils.isEmpty(UserDataLocal.getUserName())) {
map.set("userName", UserDataLocal.getUserName());
if(!StringUtils.isEmpty(UserDataLocal.getUserName())){
feedBackParams.userName = UserDataLocal.getUserName()
}
//设备
map.set("appVersion", "V" + AppUtils.getAppVersionName());
map.set("appDevice", "harmony" + DeviceUtil.getDisplayVersion() + " " + DeviceUtil.getProductModel());
// //投诉图片
// if (imageUrl.size() > 0) {
// String[] str = imageUrl.toArray(new String[imageUrl.size()]);
// map.set("imageUrls", str);
// }
await MultiPictureDetailViewModel.feedBackCommit(map)
await MultiPictureDetailViewModel.feedBackCommit(feedBackParams)
router.back();
} catch (exception) {
console.log('请求失败',JSON.stringify(exception))
}
... ...
... ... @@ -23,6 +23,9 @@ import { PeopleShipMainViewModel } from '../../viewmodel/PeopleShipMainViewModel
import { AudioSuspensionModel } from '../../viewmodel/AudioSuspensionModel'
import { viewColumInsightIntentShare } from '../../utils/InsightIntentShare'
import { common } from '@kit.AbilityKit';
import TrackingPageBrowseUtils from '../../utils/TrackingPageBrowseUtils'
import {TrackConstants,TrackParamConvert}from 'wdTracking/Index'
import { ColorUtils } from '../../utils/ColorUtils';
const TAG = 'MorningEveningPaperComponent';
... ... @@ -200,13 +203,18 @@ export struct MorningEveningPaperComponent {
const imageSource: image.ImageSource | undefined = await getPicture(imageUrl)
if (imageSource) {
if (imageSource && this.pageInfoBean.topicInfo.frontFlag === 1) {
this.pickColor(imageSource)
} else {
this.mixedBgColor = this.pageInfoBean.backgroundColor
if (this.pageInfoBean.topicInfo.topicPattern === 1) {
this.mixedBgColor = '#66BDBD'
}else if(this.pageInfoBean.topicInfo.topicPattern === 2){
this.mixedBgColor = '#E78E17'
}else {
this.mixedBgColor = '#2F2170'
}
}
}
private async pickColor(imageSource: image.ImageSource | undefined) {
... ... @@ -216,6 +224,7 @@ export struct MorningEveningPaperComponent {
let color = colorPicker.getMainColorSync();
Logger.debug(TAG, "compInfoBean compStyle = " + color)
color = ColorUtils.getMorningEveningPaperRgb({red:color.red,green:color.green,blue:color.blue,alpha:color.alpha})
// 将取色器选取的color示例转换为十六进制颜色代码
this.mixedBgColor = "#" + color.alpha.toString(16) + color.red.toString(16) + color.green.toString(16) + color.blue.toString(16);
Logger.debug(TAG, "compInfoBean compStyle = " + this.mixedBgColor)
... ... @@ -230,9 +239,15 @@ export struct MorningEveningPaperComponent {
// WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', })
}
onPageShow(){
TrackingPageBrowseUtils.TrackingPageBrowseExposureStart()
}
onPageHide() {
this.status = PlayerConstants.STATUS_PAUSE;
this.playerController?.pause();
TrackingPageBrowseUtils.TrackingPageBrowseExposureEnd('','',TrackParamConvert.pageInfoBean_ParamType(this.pageInfoBean))
}
build() {
... ...
import { FrontLinkObject } from 'wdBean';
import { ContentDTO, FrontLinkObject } from 'wdBean';
import { ProcessUtils } from 'wdRouter/Index';
/**
* 早晚报,topic
... ... @@ -47,7 +48,15 @@ export struct topicInfoView {
.backgroundColor($r('app.color.color_99636363'))
.margin({ top: 8, left: 16, right: 16, bottom: 16 })
.borderRadius(2)
// .backgroundColor(Color.Red)
.onClick(()=>{
if (this.frontLinkObject) {
let contentDTO :ContentDTO = new ContentDTO();
contentDTO.objectType = this.frontLinkObject?.newsType.toString()
contentDTO.objectId = this.frontLinkObject?.newsId
contentDTO.linkUrl = this.frontLinkObject?.linkUrl
ProcessUtils.processPage(contentDTO)
}
}).width(80)
.alignRules({
left: { anchor: "__container__", align: HorizontalAlign.Start },
bottom: { anchor: "__container__", align: VerticalAlign.Bottom }
... ...
... ... @@ -138,6 +138,7 @@ export struct SpacialTopicPageComponent {
contentDetailData: this.contentDetailData,
publishCommentModel: this.publishCommentModel,
operationButtonList: this.operationButtonList,
styleType: 1,
})
}
}.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT)
... ...
... ... @@ -43,9 +43,9 @@ export struct Card11Component {
Column() {
Stack() {
if (this.contentDTO.newTags) {
Notes({ newTags: this.contentDTO.newTags }).height(27).align(Alignment.Center)
Notes({ newTags: this.contentDTO.newTags }).height(30).align(Alignment.Center)
} else if (this.contentDTO.objectType == '5') {
Notes({ objectType: this.contentDTO.objectType }).height(27).align(Alignment.Center)
Notes({ objectType: this.contentDTO.objectType }).height(30).align(Alignment.Center)
}
Text() {
if (this.titleMarked) {
... ...
... ... @@ -52,9 +52,11 @@ export struct Card2Component {
Stack() {
//新闻标题
if (this.contentDTO.newTags) {
Notes({ newTags: this.contentDTO.newTags })
Notes({ newTags: this.contentDTO.newTags }).height(30).align(Alignment.Center)
//Notes({ newTags: this.contentDTO.newTags })
} else if (this.contentDTO.objectType == '5') {
Notes({ objectType: this.contentDTO.objectType })
Notes({ objectType: this.contentDTO.objectType }).height(30).align(Alignment.Center)
//Notes({ objectType: this.contentDTO.objectType })
}
Text() {
... ...
... ... @@ -49,29 +49,32 @@ export struct Card4Component {
Column() {
//body
Column() {
//新闻标题
if (this.contentDTO.newTags) {
Notes({ newTags: this.contentDTO.newTags })
} else if (this.contentDTO.objectType == '5') {
Notes({ objectType: this.contentDTO.objectType })
}
Text() {
if (this.titleMarked) {
Span(this.str01)
Span(this.str02)
.fontColor(0xED2800)
Span(this.str03)
} else {
Span(this.contentDTO.newsTitle)
Stack() {
if (this.contentDTO.newTags) {
Notes({ newTags: this.contentDTO.newTags }).height(19).align(Alignment.Center)
} else if (this.contentDTO.objectType == '5') {
Notes({ objectType: this.contentDTO.objectType }).height(19).align(Alignment.Center)
}
Text() {
if (this.titleMarked) {
Span(this.str01)
Span(this.str02)
.fontColor(0xED2800)
Span(this.str03)
} else {
Span(this.contentDTO.newsTitle)
}
}
}
.fontSize($r('app.float.font_size_18'))
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 :
(this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) ||
this.contentDTO.objectType == '5' ? 30 : 0)
.textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 :
(this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) ||
this.contentDTO.objectType == '5' ? 30 : 0)
}.alignContent(Alignment.TopStart)
//新闻标题
//三图
Stack(){
Row() {
... ...
... ... @@ -6,6 +6,7 @@ const TAG: string = 'More_Comp';
@Entry
@Component
export struct MoreComponent {
@State contentDTO: ContentDTO = new ContentDTO();
build() {
Row() {
... ...
... ... @@ -206,7 +206,7 @@ struct CarouselLayout01CardView {
Blank()
// 文本信息
Stack() {
if (this.item.objectType == '5') {
if (this.item.objectType == '5' || this.item.objectType == '6') {
Notes({ objectType: this.item.objectType })
}
Text(`${this.item.corner}${this.item.newsTitle}`)
... ...
... ... @@ -38,25 +38,32 @@ export struct AppointmentListChildComponent {
.interpolation(ImageInterpolation.High)
if (this.item.relType === 1) {
if (this.item.status == "wait") {
Row() {
Row() {
Image($r('app.media.reserve_icon'))
.width('42lpx')
.height('35lpx')
.width('27lpx')
.height('27lpx')
.objectFit(ImageFit.Auto)
.interpolation(ImageInterpolation.High)
.margin({right:"6lpx"})
Text("预约")
.fontWeight(400)
.fontSize('21lpx')
.backgroundColor($r('app.color.color_4D000000'))
.fontSize('23lpx')
.textShadow({
radius: 2,
color: `rgba(0,0,0,0.3)`,
offsetY:2,
offsetX:0
})
.fontColor($r('app.color.white'))
.lineHeight('31lpx')
.layoutWeight(1)
.textAlign(TextAlign.Center)
.textAlign(TextAlign.Start)
}.width('94lpx')
.margin({ bottom: '15lpx', right: '15lpx' })
.alignItems(VerticalAlign.Center)
}.width('100%')
.height('100%')
.alignItems(VerticalAlign.Bottom)
... ... @@ -78,7 +85,7 @@ export struct AppointmentListChildComponent {
.width('100%')
Row() {
Row() {
if (this.item.relType === 2) {
if (this.item.status == "end") {
Image($r('app.media.play_status_history_icon'))
.objectFit(ImageFit.Auto)
.interpolation(ImageInterpolation.High)
... ... @@ -88,6 +95,16 @@ export struct AppointmentListChildComponent {
Text('已结束').fontColor($r('app.color.color_999999'))
.fontWeight('500lpx')
.fontSize('23lpx')
}else if(this.item.status == "running"){
Image($r('app.media.play_status_icon'))
.objectFit(ImageFit.Auto)
.interpolation(ImageInterpolation.High)
.width('38lpx')
.height('38lpx')
.margin({ right: '12lpx' })
Text('已开始').fontColor($r('app.color.color_999999'))
.fontWeight('500lpx')
.fontSize('23lpx')
} else {
Image($r('app.media.play_status_icon'))
.objectFit(ImageFit.Auto)
... ... @@ -118,7 +135,7 @@ export struct AppointmentListChildComponent {
Blank()
.layoutWeight(1)
if (this.item.relType === 1) {
if (this.item.status === "wait") {
Text(this.item.isAppointment ? "已预约" : "预约")
.fontWeight(400)
.fontSize('23lpx')
... ... @@ -132,8 +149,19 @@ export struct AppointmentListChildComponent {
.onClick(() => {
this.dialogController.open()
})
}else if(this.item.status == "running"){
Text("去观看" )
.fontWeight(400)
.fontSize('23lpx')
.backgroundColor($r('app.color.color_ED2800'))
.fontColor($r('app.color.white'))
.lineHeight('31lpx')
.textAlign(TextAlign.Center)
.width('100lpx')
.height('46lpx')
.borderRadius('6lpx')
} else {
Text(this.item.relType === 2 ? "去观看" : "看回放")
Text("看回放")
.fontWeight(400)
.fontSize('23lpx')
.backgroundColor($r('app.color.color_ED2800'))
... ...
... ... @@ -7,17 +7,20 @@ import MinePageDatasModel from '../../../model/MinePageDatasModel';
import { EmptyComponent } from '../../view/EmptyComponent';
import { Action } from 'wdBean/Index';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh';
const TAG = "AppointmentListUI"
@Component
export struct AppointmentListUI {
@State data: LazyDataSource<MineAppointmentItem> = new LazyDataSource();
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
@State count: number = 0;
@State isLoading: boolean = false
@State hasMore: boolean = true
curPageNum: number = 1;
@State isGetRequest: boolean = false
private scroller: Scroller = new Scroller();
aboutToAppear() {
this.getNewPageData()
... ... @@ -26,7 +29,7 @@ export struct AppointmentListUI {
build() {
Column() {
//标题栏目
CustomTitleUI({ titleName: "预约列表" })
CustomTitleUI({ titleName: "我的预约" })
if (this.count == 0) {
if (this.isGetRequest == true) {
EmptyComponent({ emptyType: 10 })
... ... @@ -35,45 +38,29 @@ export struct AppointmentListUI {
}
} else {
//刷新控件 TODO
//List
List({ space: '6lpx' }) {
LazyForEach(this.data, (item: MineAppointmentItem, index: number) => {
ListItem() {
AppointmentListChildComponent({ item: item })
}
.onClick(() => {
//TODO 跳转
let action = {
type:"2",
params:{
extra:{
relId:item.relId,
relType:item.relType.toString()
},
contentID:item.liveId.toString()
}
} as Action
WDRouterRule.jumpWithPage(WDRouterPage.detailPlayLiveCommon, action)
})
}, (item: MineAppointmentItem, index: number) => index.toString())
//没有更多数据 显示提示
if (!this.hasMore) {
ListItem() {
ListHasNoMoreDataUI()
CustomPullToRefresh({
alldata:this.data,
scroller:this.scroller,
customList:()=>{
this.ListLayout()
},
onRefresh:(resolve)=>{
this.curPageNum = 1;
this.hasMore = true
this.isGetRequest = false
this.data.clear()
if (!this.isLoading){
this.getNewPageData()
if(resolve) resolve('刷新成功')
}
},
onLoadMore:(resolve)=> {
if (!this.isLoading) {
this.isLoading = true
this.getNewPageData()
}
}
}
.cachedCount(4)
.scrollBar(BarState.Off)
.margin({ top: '23lpx', left: '23lpx', right: '23lpx' })
.layoutWeight(1)
.onReachEnd(() => {
console.log(TAG, "触底了");
if (!this.isLoading) {
//加载分页数据
this.getNewPageData()
}
})
}
... ... @@ -83,6 +70,42 @@ export struct AppointmentListUI {
.width('100%')
}
@Builder ListLayout(){
List({ space:6,scroller: this.scroller }) {
LazyForEach(this.data, (item: MineAppointmentItem, index: number) => {
ListItem() {
AppointmentListChildComponent({ item: item })
}
.onClick(() => {
//TODO 跳转
let action = {
type:"2",
params:{
extra:{
relId:item.relId,
relType:item.relType.toString()
},
contentID:item.liveId.toString()
}
} as Action
WDRouterRule.jumpWithPage(WDRouterPage.detailPlayLiveCommon, action)
})
}, (item: MineAppointmentItem, index: number) => index.toString())
//没有更多数据 显示提示
if (!this.hasMore) {
ListItem() {
ListHasNoMoreDataUI()
}.padding({bottom:px2vp(this.bottomSafeHeight) + 20})
}
}
.cachedCount(4)
.scrollBar(BarState.Off)
.edgeEffect(EdgeEffect.None)
.margin({ top: '23lpx', left: '23lpx', right: '23lpx'})
.layoutWeight(1)
}
getNewPageData() {
this.isLoading = true
if (this.hasMore) {
... ...
... ... @@ -6,6 +6,8 @@ import { MessageItem } from '../../../viewmodel/MessageItem'
import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh'
import { CustomTitleUI } from '../../reusable/CustomTitleUI'
import { MessageListItemUI } from './MessageListItemUI'
import {TrackingButton,TrackConstants}from 'wdTracking/Index'
import TrackingPageBrowseUtils from '../../../utils/TrackingPageBrowseUtils'
const TAG = "MessageListUI"
... ... @@ -185,6 +187,7 @@ export struct MessageListUI {
}
.padding({ left: "31lpx", right: "31lpx" })
.onClick(() => {
this.messageCenterCommonButtonTracking(index)
switch (index) {
case 0: //互动消息
if(item.unReadCount > 0){
... ... @@ -210,6 +213,25 @@ export struct MessageListUI {
}
}
messageCenterCommonButtonTracking(index:number){
let buttonName:string = ''
switch (index) {
case 0: //互动消息
buttonName = 'myNotificationPageInteractiveMessage'
break;
case 1: //预约消息
buttonName = 'myNotificationPageAppointmentMessage'
break;
case 2: //历史推送
buttonName = 'myNotificationPageHistoricalPush'
break;
case 3: //系统消息
buttonName = 'myNotificationPageSystemMessage'
break;
}
TrackingButton.click(buttonName,TrackConstants.PageName.My_Notification,TrackConstants.PageName.My_Notification)
}
sendEnterEvent(type:number){
MinePageDatasModel.sendEnterMessageData(type).then((value) => {
... ...
... ... @@ -411,7 +411,9 @@ export struct PaperSingleColumn999CardView {
result = `${minutes}分钟前`;
} else if (hours < 24) {
result = `${hours}小时前`;
} else {
} else if(hours > 24 && hours <48){
result = '1天前';
}else {
result = '';
}
... ... @@ -483,10 +485,14 @@ export struct PaperSingleColumn999CardView {
.fontSize(12)
.fontColor('#B0B0B0')
.margin({ left: 16 })
Image($r('app.media.point'))
.width(16)
.height(16)
.margin({ top: 10, bottom: 10 })
///不显示时间或者不显示评论
if (this.getPublishTime().length > 0 || this.item.objectType != '2' && this.interactData && this.interactData.commentNum && Number(this.interactData.collectNum) > 0) {
Image($r('app.media.point'))
.width(16)
.height(16)
.margin({ top: 10, bottom: 10 })
}
}
Text(this.getPublishTime())
... ... @@ -497,7 +503,7 @@ export struct PaperSingleColumn999CardView {
Text(this.interactData.commentNum + "评")
.fontSize(12)
.fontColor('#B0B0B0')
.margin({ left: 6 })
.margin({ left: this.getPublishTime().length >0? 6:0 })
}
}
.justifyContent(FlexAlign.Start)
... ...
... ... @@ -6,6 +6,8 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter';
import {AreaPickerDialog} from '../view/areaPickerDialog/AreaPickerDialog'
import { AreaListModel } from '../../model/AreaListModel';
import router from '@ohos.router';
import TrackingPageBrowseUtils from '../../utils/TrackingPageBrowseUtils'
import { TrackConstants } from 'wdTracking/Index';
@Entry
@Component
... ... @@ -37,6 +39,11 @@ struct EditUserInfoPage {
onPageShow(){
this.updateUserNameAndIntroduction()
TrackingPageBrowseUtils.TrackingPageBrowseExposureStart()
}
onPageHide(): void {
TrackingPageBrowseUtils.TrackingPageBrowseExposureEnd(TrackConstants.PageName.Edit_Information,TrackConstants.PageName.Edit_Information)
}
build() {
... ...
... ... @@ -13,6 +13,8 @@ import { contentListItemParams } from '../../model/MyCollectionModel';
import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh';
import { MyCustomDialog } from '../reusable/MyCustomDialog'
import { NetworkUtil } from 'wdKit/Index';
import TrackingPageBrowseUtils from '../../utils/TrackingPageBrowseUtils'
import { TrackConstants } from 'wdTracking/Index';
@Entry
@Component
... ... @@ -45,6 +47,15 @@ struct MyCollectionListPage {
aboutToAppear(){
this.getData()
}
onPageShow(){
TrackingPageBrowseUtils.TrackingPageBrowseExposureStart()
}
onPageHide(): void {
TrackingPageBrowseUtils.TrackingPageBrowseExposureEnd(TrackConstants.PageName.My_Collect,TrackConstants.PageName.My_Collect)
}
build() {
... ...
... ... @@ -2,7 +2,7 @@ import { CommonConstants, ViewType } from 'wdConstant';
import { Logger } from 'wdKit';
import { EmptyComponent } from '../view/EmptyComponent';
import PageModel from '../../viewmodel/PageModel';
import { autoRefresh, listTouchEvent } from '../../utils/PullDownRefresh';
import { autoRefresh, onActionEnd, onActionStart, onActionUpdate } from '../../utils/PullDownRefresh';
import LoadMoreLayout from './LoadMoreLayout';
import { CompParser } from '../CompParser';
import { CompDTO } from 'wdBean';
... ... @@ -14,9 +14,6 @@ import PageNoMoreLayout from './PageNoMoreLayout';
import { NoMoreBean } from './NoMoreBean';
import { RefreshLayoutBean } from '../refresh/RefreshLayoutBean';
import RefreshLayout from '../refresh/RefreshLayout';
import json from '@ohos.util.json';
import { viewBlogInsightIntentShare, ActionMode } from '../../utils/InsightIntentShare'
import { common } from '@kit.AbilityKit';
const TAG = 'PageComponent';
@Component
... ... @@ -31,6 +28,7 @@ export struct PageComponent {
// 自动刷新通知
@Prop @Watch('onAutoRefresh') autoRefresh: number = 0
private listScroller: Scroller = new Scroller();
private panOption: PanGestureOptions = new PanGestureOptions({ direction: PanDirection.Up | PanDirection.Down })
needload: boolean = true;
build() {
Column() {
... ... @@ -51,13 +49,26 @@ export struct PageComponent {
}
.width(CommonConstants.FULL_PARENT)
.height(CommonConstants.FULL_PARENT)
.onTouch((event: TouchEvent | undefined) => {
if (event) {
if (this.pageModel.viewType === ViewType.LOADED) {
listTouchEvent(this.pageModel, this.pageAdvModel, event);
}
}
})
// .onTouch((event: TouchEvent | undefined) => {
// if (event) {
// if (this.pageModel.viewType === ViewType.LOADED) {
// listTouchEvent(this.pageModel, this.pageAdvModel, event);
// }
// }
// })
// 对接新的下拉刷新手势,替换touch事件
.parallelGesture(
PanGesture(this.panOption)
.onActionStart((event?: GestureEvent) => {
onActionStart(this.pageModel, this.pageAdvModel, event)
})
.onActionUpdate((event?: GestureEvent) => {
onActionUpdate(this.pageModel, this.pageAdvModel, event)
})
.onActionEnd(() => {
onActionEnd(this.pageModel, this.pageAdvModel)
})
)
}
... ...
... ... @@ -460,9 +460,19 @@ export struct TopNavigationComponent {
}
/**
* 判断是否当前页面处理逻辑,如消息通知,只需要切换到当前底导的处理,过滤掉非当前。
*/
private isCurrentPage(): boolean {
return this._currentNavIndex === this.navIndex
}
/**
* 频道id变化,即指定频道跳转场景
*/
onAssignChannelChange() {
if (!this.isCurrentPage()) {
return
}
let channelId = this.assignChannel.channelId
let index = -1
if (this._currentNavIndex === 0) {
... ...
import { BottomNavDTO, CompDTO, TopNavDTO } from 'wdBean';
import { SpConstants } from 'wdConstant';
import { DisplayUtils, LazyDataSource, Logger, NetworkUtil, SPHelper, ToastUtils } from 'wdKit';
import { ProcessUtils, WDRouterPage, WDRouterRule } from 'wdRouter';
import { PageComponent } from './PageComponent';
import { ChannelSubscriptionLayout } from './ChannelSubscriptionLayout';
import { FirstTabTopSearchComponent } from '../search/FirstTabTopSearchComponent';
import { AssignChannelParam } from 'wdRouter/src/main/ets/utils/HomeChannelUtils';
import { PeopleShipMainComponent } from '../peopleShip/PeopleShipMainComponent';
import { channelSkeleton } from '../skeleton/channelSkeleton';
const TAG = 'TopNavigationComponent';
PersistentStorage.persistProp('channelIds', '');
PersistentStorage.persistProp('indexSettingChannelId', 2002);
const storage = LocalStorage.getShared();
/**
* 顶部页签导航栏/顶导
*/
@Entry(storage)
@Component
export struct TopNavigationComponentNew {
/**
* @deprecated
*/
private groupId: number = 0
/**
* @deprecated TODO type判断
*/
private currentBottomNavName: string = ''
private swiperController: SwiperController = new SwiperController()
private listScroller: Scroller = new Scroller()
@Consume barBackgroundColor: Color
/**
* @deprecated
*/
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
/**
* @deprecated
*/
@State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
@Link _currentNavIndex?: number;
// 顶导当前选中/焦点下标
@State currentTopNavSelectedIndex: number = 0;
// 顶导数据
@State @Watch('onTopNavigationDataUpdated') topNavList: TopNavDTO[] = []
@StorageProp('indexSettingChannelId') indexSettingChannelId: number = 2002
//我的频道id列表
@State channelIds: number[] = []
//本地缓存频道id列表
@StorageProp('channelIds') storageChannelIds: string = ''
@State homeChannelList: TopNavDTO[] = []
// 我的频道列表
@State myChannelList: TopNavDTO[] = []
// 更多频道列表
@State moreChannelList: TopNavDTO[] = []
// 地方频道列表
@State localChannelList: TopNavDTO[] = []
readonly MAX_LINE: number = 1;
@ObjectLink @Watch('onAssignChannelChange') assignChannel: AssignChannelParam
// 底导传递过来的自动刷新通知
@Prop @Watch('onAutoRefresh') autoRefresh: number = 0
// 传递给page的自动刷新通知
@State autoRefresh2Page: number = 0
// 当前底导index
@State bottomNavIndex: number = 0
@State animationDuration: number = 0
@State indicatorLeftMargin: number = 0
@State indicatorWidth: number = 0
private tabsWidth: number = 0
build() {
Column() {
// 频道分类list
RelativeContainer() {
this.tabBar()
Swiper(this.swiperController) {
ForEach(this.currentBottomNavName === '新闻' ? this.myChannelList : this.topNavList,
(navItem: TopNavDTO, index: number) => {
if (this.currentBottomNavName === '人民号' && navItem.name === '关注') {
PeopleShipMainComponent({
currentTopNavSelectedIndex: $currentTopNavSelectedIndex,
navIndex: index,
pageId: navItem.pageId + '',
channelId: navItem.channelId + '',
})
} else
if (!this.isBroadcast(navItem) && !this.isLayout(navItem)) {
PageComponent({
currentTopNavSelectedIndex: $currentTopNavSelectedIndex,
navIndex: index,
pageId: navItem.pageId + '',
channelId: navItem.channelId + '',
autoRefresh: this.autoRefresh2Page
})
} else {
channelSkeleton()
}
})
}
.loop(false)
.indicator(false)
.effectMode(EdgeEffect.None)
.index(this.currentTopNavSelectedIndex)
.cachedCount(0)
.id('pageContent')
.alignRules({
'top': { 'anchor': 'tabList', 'align': VerticalAlign.Bottom },
'middle': { 'anchor': '__container__', 'align': HorizontalAlign.Center },
'bottom': { 'anchor': '__container__', 'align': VerticalAlign.Bottom }
})
.onChange((index) => {
Logger.info(TAG, `onChange index : ${index}`);
if (this.isBroadcastByIndex(index)) {
// 跳转到播报页面
ProcessUtils.gotoBroadcastPage(this.myChannelList[index].pageId)
let nextIndex = this.currentTopNavSelectedIndex > index ? index - 1 : index + 1
if (nextIndex < this.myChannelList.length) {
this.changePage(nextIndex)
}
} else if (this.isLayoutByIndex(index)) {
ProcessUtils.gotoENewsPaper()
let nextIndex = this.currentTopNavSelectedIndex > index ? index - 1 : index + 1
if (nextIndex < this.myChannelList.length) {
this.changePage(nextIndex)
}
} else {
this.currentTopNavSelectedIndex = index;
this.changePage(this.currentTopNavSelectedIndex)
}
})
}
.width('100%')
.height('100%')
}
}
@Builder
topBar() {
Column() {
Row() {
FirstTabTopSearchComponent()
Image($r('app.media.icon_ren_min_ri_bao'))
.width(72)
.height(29)
.onClick(() => {
ProcessUtils.gotoENewsPaper()
})
Stack({ alignContent: Alignment.Center }) {
Image($r('app.media.background_read_paper_home'))
.width('100%')
.height('100%')
.objectFit(ImageFit.Contain)
Row() {
Image($r('app.media.icon_read_paper_home'))
.width(18)
.height(18)
Text('早晚报')
.fontColor("#666666")
.fontSize($r('app.float.font_size_13'))
}
.alignItems(VerticalAlign.Center)
.justifyContent(FlexAlign.Center)
}
.height(30)
.width(124)
.onClick(() => {
if (NetworkUtil.isNetConnected()) {
ProcessUtils.gotoMorningEveningPaper()
} else {
ToastUtils.showToast('网络出小差了,请检查网络后重试', 1000)
}
})
}.width('100%')
.justifyContent(FlexAlign.SpaceBetween)
}
.width('100%')
.height(40)
.padding({ top: 10 })
.backgroundColor($r('app.color.white'))
.id('topBar')
}
@Builder
tabBar() {
// TODO 判断是否新闻tab,修改方法(,_currentNavIndex==0 都不对,需要用type)(用topStyle)
if (this.currentBottomNavName === '新闻') {
// 顶部搜索、日报logo、早晚报
this.topBar()
ChannelSubscriptionLayout({
currentTopNavSelectedIndex: $currentTopNavSelectedIndex,
indexSettingChannelId: this.indexSettingChannelId,
homeChannelList: this.homeChannelList,
myChannelList: $myChannelList,
moreChannelList: $moreChannelList,
localChannelList: $localChannelList,
channelIds: $channelIds,
changeTab: (index) => {
this.changePage(index)
}
})
.id('channelManageBtn')
.alignRules({
'top': { 'anchor': 'topBar', 'align': VerticalAlign.Bottom },
'right': { 'anchor': '__container__', 'align': HorizontalAlign.End }
})
List({ scroller: this.listScroller }) {
ForEach(this.myChannelList, (navItem: TopNavDTO, index: number) => {
ListItem() {
this.tabBarBuilder(navItem, index)
}
})
}
.listDirection(Axis.Horizontal)
.scrollBar(BarState.Off)
.edgeEffect(EdgeEffect.None)
.padding({ left: 8, top: 6, right: 0 })
.height($r('app.float.top_tab_bar_height'))
.backgroundColor(this.barBackgroundColor)
.onAreaChange((oldValue: Area, newValue: Area) => {
let width = Number.parseFloat(newValue.width.toString())
this.tabsWidth = Number.isNaN(width) ? 0 : width
})
.id('tabList')
.alignRules({
'top': { 'anchor': 'topBar', 'align': VerticalAlign.Bottom },
'left': { 'anchor': '__container__', 'align': HorizontalAlign.Start },
'right': { 'anchor': 'channelManageBtn', 'align': HorizontalAlign.Start }
})
} else {
Row() {
Image($r('app.media.icon_search'))
.width('24vp')
.height('24vp')
}
.height('40vp')
.width('40vp')
.margin({ right: 10 })
.alignItems(VerticalAlign.Center)
.justifyContent(FlexAlign.Center)
.id('searchBtn')
.alignRules({
'top': { 'anchor': '__container__', 'align': VerticalAlign.Top },
'right': { 'anchor': '__container__', 'align': HorizontalAlign.End }
})
.onClick(() => {
WDRouterRule.jumpWithPage(WDRouterPage.searchPage)
})
List({ scroller: this.listScroller }) {
ForEach(this.topNavList, (navItem: TopNavDTO, index: number) => {
ListItem() {
this.tabBarBuilder(navItem, index)
}
})
}
.listDirection(Axis.Horizontal)
.scrollBar(BarState.Off)
.edgeEffect(EdgeEffect.None)
.height($r('app.float.top_tab_bar_height'))
.backgroundColor(this.barBackgroundColor)
.padding({ top: 6 })
.onAreaChange((oldValue: Area, newValue: Area) => {
let width = Number.parseFloat(newValue.width.toString())
this.tabsWidth = Number.isNaN(width) ? 0 : width
})
.id('tabList')
.alignRules({
'top': { 'anchor': '__container__', 'align': VerticalAlign.Top },
'middle': { 'anchor': '__container__', 'align': HorizontalAlign.Center }
})
}
}
@Builder
tabBarBuilder(item: TopNavDTO, index: number) {
Column() {
Text(item?.name)
.fontSize($r('app.float.selected_text_size'))
.fontWeight(this.currentTopNavSelectedIndex === index ? FontWeight.Bold : FontWeight.Normal)
.fontColor(this.currentTopNavSelectedIndex === index ? Color.Black : "#999999")
.padding({ top: $r('app.float.top_tab_item_padding_top'), bottom: $r('app.float.top_tab_item_padding_bottom') })
.maxLines(this.MAX_LINE)
.id(index.toString())
.onAreaChange((oldValue: Area, newValue: Area) => {
if (this.currentTopNavSelectedIndex === index &&
(this.indicatorLeftMargin === 0 || this.indicatorWidth === 0)) {
if (newValue.position.x != undefined) {
let positionX = Number.parseFloat(newValue.position.x.toString())
this.indicatorLeftMargin = Number.isNaN(positionX) ? 0 : positionX
}
let width = Number.parseFloat(newValue.width.toString())
this.indicatorWidth = Number.isNaN(width) ? 0 : width
}
})
if (this.currentTopNavSelectedIndex === index) {
Row()
.width(20)
.height(3)
.backgroundImage($r('app.media.icon_channel_active'), ImageRepeat.NoRepeat)
.backgroundImageSize(ImageSize.Contain)
}
}
.hoverEffect(HoverEffect.Highlight)
.constraintSize({
minWidth: $r('app.float.top_tab_item_min_width'),
maxWidth: $r('app.float.top_tab_item_max_width')
})
// .backgroundColor(Color.Transparent)
.padding({
left: $r('app.float.top_tab_item_padding_horizontal'),
right: $r('app.float.top_tab_item_padding_horizontal'),
bottom: 2,
})
.id(`col_tabBar${index}`)
// .margin({ right: this.myChannelList.length === index + 1 ? 36 : 0 })
.onClick(() => {
Logger.debug(TAG, `onClick, index: ${index}`);
if (this.currentTopNavSelectedIndex === index) {
// 当前tab,单击事件
this.doAutoRefresh()
} else {
if (this.isBroadcastByIndex(index)) {
// 跳转到播报页面
ProcessUtils.gotoBroadcastPage(this.myChannelList[index].pageId)
} else if (this.isLayoutByIndex(index)) {
ProcessUtils.gotoENewsPaper()
} else {
this.currentTopNavSelectedIndex = index
this.changePage(index)
}
}
})
}
private changePage(index: number) {
this.swiperController.changeIndex(index)
this.listScroller.scrollToIndex(index, true, ScrollAlign.CENTER)
}
//处理新闻tab顶导频道数据
topNavListHandle() {
let cityName = SPHelper.default.getSync(SpConstants.LOCATION_CITY_NAME, '') as string
let _channelIds: number [] = []
let _myChannelList: TopNavDTO [] = []
let _storageChannelIds: string [] = [] //list1
let defaultMyChannelList: TopNavDTO[] = []
let defaultList = [...this.topNavList]
defaultList.sort((a, b) => {
return a.num - b.num;
});
//defaultMyChannelList
defaultList.forEach(item => {
if (item.defaultPermitted === 1 || item.movePermitted === 0 || item.delPermitted === 0 ||
item.headlinesOn === 1) {
defaultMyChannelList.push(item);
}
if (item.defaultPermitted === 1) {
this.homeChannelList.push(item)
}
})
//有缓存频道id
if (this.storageChannelIds) {
_storageChannelIds = this.storageChannelIds.split(',')
}
defaultMyChannelList.forEach(item => {
item.myChannel = '1'
if (item.defaultPermitted === 1) {
item.homeChannel = '1'
}
let index = defaultList.findIndex(_item => _item.channelId === item.channelId)
if (index !== -1) {
defaultList.splice(index, 1)
}
})
defaultList.unshift(...defaultMyChannelList)
defaultList.forEach((item, index) => {
if (this.storageChannelIds && _storageChannelIds.includes(String(item.channelId))) {
item.myChannel = '1'
}
if (item.channelType === 2) {
if (cityName.includes(item.name)) {
item.myChannel = '1'
}
item.localChannel = '1'
}
if (index >= 11) {
if (item.channelType === 1) {
item.moreChannel = '1'
}
} else {
if (item.channelType === 1 && item.myChannel !== '1') {
item.moreChannel = '1'
}
}
//频道分类
if (item.name !== '播报') { //暂时隐藏播报
if (item.myChannel === '1') {
_myChannelList.push(item)
_channelIds.push(item.channelId)
} else if (item.moreChannel === '1') {
this.moreChannelList.push(item)
} else if (item.localChannel === '1' && item.myChannel !== '1') {
this.localChannelList.push(item)
}
}
})
if (cityName) {
let index = _myChannelList.findIndex(ele => cityName.includes(ele.name))
const localChannelitem = _myChannelList.splice(index, 1)[0];
// 将当前地区频道插入到第四个
_myChannelList.splice(3, 0, localChannelitem);
}
this.channelIds = _channelIds
this.myChannelList = _myChannelList
//缓存首页频道
let index = this.myChannelList.findIndex(_item => _item?.channelId === this.indexSettingChannelId)
if (index > -1) {
this.currentTopNavSelectedIndex = index
}
}
private isBroadcast(item?: TopNavDTO): boolean {
// TODO 用id channelId = '2066'
return item?.name === '播报'
}
private isLayout(item?: TopNavDTO): boolean {
// TODO 用id channelId = '2006'
return item?.name === '版面'
}
private isBroadcastByIndex(index: number): boolean {
let item = this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]
return this.isBroadcast(item)
}
private isLayoutByIndex(index: number): boolean {
let item = this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]
return this.isLayout(item)
}
private isSpecialChannel(item?: TopNavDTO) {
// 版面、播报,可以用这个判断
return item?.channelType === 3
}
aboutToAppear() {
//处理新闻tab顶导频道数据
this.topNavListHandle()
this.changePage(this.currentTopNavSelectedIndex)
}
aboutToDisappear() {
AppStorage.set('channelIds', this.channelIds.join(','))
}
onTopNavigationDataUpdated() {
Logger.info(TAG,
`onTopNavigationDataUpdated currentTopNavIndex: ${this.currentTopNavSelectedIndex},topNavList.length:${this.topNavList.length}`);
}
onAutoRefresh() {
if (this.bottomNavIndex != this._currentNavIndex) {
return
}
// 通知page刷新
this.autoRefresh2Page++
}
private doAutoRefresh() {
// 通知page刷新
this.autoRefresh2Page++
}
/**
* 判断是否当前页面处理逻辑,如消息通知,只需要切换到当前底导的处理,过滤掉非当前。
*/
private isCurrentPage(): boolean {
return this._currentNavIndex === this.bottomNavIndex
}
/**
* 频道id变化,即指定频道跳转场景
*/
onAssignChannelChange() {
if (!this.isCurrentPage()) {
return
}
let channelId = this.assignChannel.channelId
let index = -1
if (this._currentNavIndex === 0) {
// 第一个,新闻,先拿我的,再拿其他
index = this.getChannelByMine(channelId)
if (index == -1) {
// 不在我的里,需要临时新增频道展示
let channel = this.getChannelByOthers(channelId)
if (channel) {
this.myChannelList.push(channel)
setTimeout(() => {
this.changePage(this.myChannelList.length - 1)
}, 20)
}
} else {
// 直接切换
this.changePage(index)
}
} else {
index = this.getChannelByTopNav(channelId)
if (index > -1) {
// 找到了,直接切换,否则不处理
this.changePage(index)
}
}
}
/**
* 非新闻,从topNav里拿数据
*/
private getChannelByTopNav(channelId: string) {
for (let i = 0; i < this.topNavList.length; i++) {
let topNavDTO: TopNavDTO = this.topNavList[i]
if (topNavDTO.channelId.toString() === channelId) {
return i
}
}
return -1
}
/**
* 新闻,从myChannelList里拿数据
*/
private getChannelByMine(channelId: string) {
for (let i = 0; i < this.myChannelList.length; i++) {
let topNavDTO: TopNavDTO = this.myChannelList[i]
if (topNavDTO?.channelId?.toString() === channelId) {
return i
}
}
return -1
}
/**
* 新闻,从其他里拿数据
*/
private getChannelByOthers(channelId: string) {
for (let i = 0; i < this.moreChannelList.length; i++) {
let topNavDTO: TopNavDTO = this.moreChannelList[i]
if (topNavDTO.channelId?.toString() === channelId) {
return topNavDTO
}
}
for (let j = 0; j < this.localChannelList.length; j++) {
let topNavDTO: TopNavDTO = this.localChannelList[j]
if (topNavDTO.channelId?.toString() === channelId) {
return topNavDTO
}
}
return null
}
private getTextInfo(index: number): Record<string, number> {
let strJson = getInspectorByKey(index.toString())
try {
let obj: Record<string, string> = JSON.parse(strJson)
let rectInfo: number[][] = JSON.parse('[' + obj.$rect + ']')
return { 'left': px2vp(rectInfo[0][0]), 'width': px2vp(rectInfo[1][0] - rectInfo[0][0]) }
} catch (error) {
return { 'left': 0, 'width': 0 }
}
}
private getCurrentIndicatorInfo(index: number, event: TabsAnimationEvent): Record<string, number> {
let nextIndex = index
if (index > 0 && event.currentOffset > 0) {
nextIndex--
} else if (index < 3 && event.currentOffset < 0) {
nextIndex++
}
let indexInfo = this.getTextInfo(index)
let nextIndexInfo = this.getTextInfo(nextIndex)
let swipeRatio = Math.abs(event.currentOffset / this.tabsWidth)
let currentIndex = swipeRatio > 0.5 ? nextIndex : index // 页面滑动超过一半,tabBar切换到下一页。
let currentLeft = indexInfo.left + (nextIndexInfo.left - indexInfo.left) * swipeRatio
let currentWidth = indexInfo.width + (nextIndexInfo.width - indexInfo.width) * swipeRatio
return { 'index': currentIndex, 'left': currentLeft, 'width': currentWidth }
}
private startAnimateTo(duration: number, leftMargin: number, width: number) {
animateTo({
duration: duration, // 动画时长
curve: Curve.Linear, // 动画曲线
iterations: 1, // 播放次数
playMode: PlayMode.Normal, // 动画模式
onFinish: () => {
console.info('play end')
}
}, () => {
this.indicatorLeftMargin = leftMargin
this.indicatorWidth = width
})
}
}
\ No newline at end of file
... ...
... ... @@ -26,7 +26,6 @@ export struct CustomTitleUI {
}
Text(this.titleName)
.height('42lpx')
.maxLines(1)
.id("title")
.fontSize('35lpx')
... ...
... ... @@ -49,7 +49,7 @@ export struct SearchComponent {
getRelatedSearchContent() {
if(StringUtils.isNotEmpty(this.searchText)){
SearcherAboutDataModel.getRelatedSearchContentData(encodeURI(this.searchText),getContext(this)).then((value) => {
if (value != null) {
if (value != null && value.length > 0) {
this.relatedSearchContentsData = []
value.forEach(item=>{
let tempValue:string = item
... ... @@ -81,6 +81,9 @@ export struct SearchComponent {
this.relatedSearchContentsData.push(new SearchRelatedItem(item,tempArr))
}
})
}else{
this.hasInputContent = false
this.relatedSearchContentsData = []
}
}).catch((err: Error) => {
console.log(TAG, JSON.stringify(err))
... ... @@ -228,7 +231,7 @@ export struct SearchComponent {
Row() {
//左
Stack({ alignContent: Alignment.Start }) {
if (this.searchTextData != null && this.searchTextData.length > 0 && !this.hasInputContent) {
if (this.searchTextData != null && this.searchTextData.length > 0 && !this.hasInputContent && StringUtils.isEmpty(this.searchText)) {
Swiper(this.swiperController) {
ForEach(this.searchTextData, (item: string, index: number) => {
Text(item)
... ...
... ... @@ -20,12 +20,16 @@ import { FollowListDetailItem } from '../../viewmodel/FollowListDetailItem'
import { FollowListStatusRequestItem } from '../../viewmodel/FollowListStatusRequestItem'
import { QueryListIsFollowedItem } from '../../viewmodel/QueryListIsFollowedItem'
import { SearchResultContentData } from '../../viewmodel/SearchResultContentData'
import { SearchResultContentItem, SearchRmhDescription } from '../../viewmodel/SearchResultContentItem'
import {
SearchDescription,
SearchResultContentItem, SearchRmhDescription } from '../../viewmodel/SearchResultContentItem'
import { CardParser } from '../CardParser'
import { FollowChildComponent } from '../mine/follow/FollowChildComponent'
import { ListHasNoMoreDataUI } from '../reusable/ListHasNoMoreDataUI'
import { ActivityItemComponent } from './ActivityItemComponent'
import { SearchCreatorComponent } from './SearchCreatorComponent'
import { JSON } from '@kit.ArkTS'
import { MoreComponent } from '../cardview/MoreComponent'
const TAG = "SearchResultContentComponent"
... ... @@ -34,6 +38,7 @@ export struct SearchResultContentComponent {
@State keywords: string = ""
@State searchType: string = ""
@State data: LazyDataSource<ContentDTO> = new LazyDataSource();
tempList : ContentDTO[] = []
@State data_rmh: SearchRmhDescription[] = []
@State count: number = -1;
@State isLoading: boolean = false
... ... @@ -62,7 +67,7 @@ export struct SearchResultContentComponent {
getNewSearchResultData() {
this.isLoading = true
if (this.hasMore) {
SearcherAboutDataModel.getSearchResultListData("15", `${this.curPageNum}`, this.searchType, this.keywords,
SearcherAboutDataModel.getSearchResultListData("20", `${this.curPageNum}`, this.searchType, this.keywords,
getContext(this)).then((value) => {
console.log('SearcherAboutDataModel', JSON.stringify(value))
if (!this.data || value.list.length == 0) {
... ... @@ -183,9 +188,8 @@ export struct SearchResultContentComponent {
resultData.list.forEach((value:SearchResultContentItem) => {
creatorIdList.push(value.data.creatorId)
})
let isRemain : boolean = false
SearcherAboutDataModel.getCreatorDetailListData({creatorIdList:creatorIdList}).then((rem) => {
resultData.list.forEach((value) => {
let photos: FullColumnImgUrlDTO[] = []
// if (value.data.appStyle === 4) {
... ... @@ -196,42 +200,98 @@ export struct SearchResultContentComponent {
// }
let contentDTO = this.dataTransform(rem,value, photos);
if(value.data.type != "13"){
this.data.push(contentDTO)
this.tempList.push(contentDTO)
if(value.data.sameContentList != null && value.data.sameContentList.length > 0) {
let contentDTO2 = new ContentDTO();
contentDTO2.sameContentListJson = JSON.stringify(value.data.sameContentList)
isRemain = true
this.tempList.push(contentDTO2)
}
}
})
if(!isRemain){
this.tempList.forEach((value) => {
this.data.push(value)
})
this.tempList = []
this.data.notifyDataReload()
this.count = this.data.totalCount()
if (this.count < resultData.totalCount) {
this.curPageNum++
} else {
this.hasMore = false
}
this.isLoading = false
}else{
this.dealSameContent(resultData.totalCount)
}
}).catch((err: Error) => {
console.log(TAG, JSON.stringify(err))
})
this.data.notifyDataReload()
this.count = this.data.totalCount()
if (this.data.totalCount() < resultData.totalCount) {
this.curPageNum++
} else {
this.hasMore = false
}
}).catch((err: Error) => {
console.log(TAG, "请求失败")
this.isLoading = false
this.count = this.count === -1 ? 0 : this.count
})
}
if (this.count === 0 && resultData.list.length > 0) {
this.count = -1
if (!this.isLoading) {
//加载分页数据
this.getNewSearchResultData()
async dealSameContent(count:number){
this.tempList.forEach(async (tempValue) => {
if(StringUtils.isNotEmpty(tempValue.sameContentListJson)){
let data: contentListParams = {
contentList: []
}
} else if (this.count <= 10 && resultData.list.length > 0) {
if (!this.isLoading) {
//加载分页数据
this.getNewSearchResultData()
let resultData : SearchDescription[] = JSON.parse(tempValue.sameContentListJson) as SearchDescription[]
if(resultData!=null){
resultData.forEach((item) => {
data.contentList.push({
contentId: item.id + '',
contentType: Number.parseInt(item.type)
})
})
let newValue = await SearcherAboutDataModel.getInteractListData(data, getContext(this))
newValue.forEach((item) => {
resultData.forEach((data) => {
if (item.contentId == data.id) {
data.collectNum = item.collectNum + ""
data.commentNum = item.commentNum + ""
data.likeNum = item.likeNum + ""
data.readNum = item.readNum + ""
data.shareNum = item.shareNum + ""
}
})
})
let creatorIdList: string[] = []
resultData.forEach((value:SearchDescription) => {
creatorIdList.push(value.creatorId)
})
let rem = await SearcherAboutDataModel.getCreatorDetailListData({creatorIdList:creatorIdList})
resultData.forEach((value) => {
let photos: FullColumnImgUrlDTO[] = []
value.appStyleImages.split("&&").forEach((value) => {
const resizeParams = this.extractResizeParams(value)
photos.push({ fullUrl: value,weight:resizeParams.width,height:resizeParams.height, } as FullColumnImgUrlDTO)
})
let contentDTO = this.dataTransform2(rem,value, photos);
tempValue.sameContentList.push(contentDTO)
})
}
}
}).catch((err: Error) => {
console.log(TAG, "请求失败")
this.isLoading = false
this.count = this.count === -1 ? 0 : this.count
})
this.tempList.forEach((value) => {
this.data.push(value)
})
this.tempList = []
this.data.notifyDataReload()
this.count = this.data.totalCount()
if (this.count < count) {
this.curPageNum++
} else {
this.hasMore = false
}
this.isLoading = false
}
build() {
... ... @@ -258,6 +318,8 @@ export struct SearchResultContentComponent {
Column() {
if (this.searchType == "activity") {
ActivityItemComponent({ contentDTO: item })
}else if(item.sameContentList != null && item.sameContentList.length > 0){
MoreComponent({ contentDTO: item })
} else {
CardParser({compDTO:new CompDTO, contentDTO: item })
}
... ... @@ -284,7 +346,6 @@ export struct SearchResultContentComponent {
.onReachEnd(() => {
console.log(TAG, "触底了");
if (!this.isLoading) {
//加载分页数据
this.getNewSearchResultData()
}
})
... ... @@ -476,10 +537,94 @@ export struct SearchResultContentComponent {
contentDTO.shareFlag = value.data.shareFlag
contentDTO.contentText = value.data.contentText
return contentDTO;
}
private dataTransform2(rem:CreatorDetailResponseItem[],value: SearchDescription, photos: FullColumnImgUrlDTO[]): ContentDTO {
let rmhInfo = this.getRmhInfo2(rem,value)
console.log('获取photos',JSON.stringify(photos))
console.log('获取value2',JSON.stringify(value))
let contentDTO = new ContentDTO();
contentDTO.appStyle = value.appStyle + ""
contentDTO.cityCode = value.cityCode
contentDTO.coverSize = ""
contentDTO.coverType = value.type == "5" ? 1 : -1
contentDTO.coverUrl =
this.searchType == "activity" ? value.zhChannelPageImg : value.appStyleImages.split("&&")[0];
contentDTO.description = value.description
contentDTO.districtCode = value.districtCode
contentDTO.endTime = value.endTime
contentDTO.hImageUrl = ""
contentDTO.heatValue = ""
contentDTO.innerUrl = ""
contentDTO.landscape = Number.parseInt(value.landscape)
contentDTO.linkUrl = value.linkUrl
contentDTO.openLikes = Number.parseInt(value.openLikes)
contentDTO.openUrl = ""
contentDTO.pageId = value.pageId
contentDTO.programAuth = ""
contentDTO.programId = ""
contentDTO.programName = ""
contentDTO.programSource = -1
contentDTO.programType = Number.parseInt(value.status)
contentDTO.provinceCode = value.provinceCode
contentDTO.showTitleEd = value.showTitleEd
contentDTO.showTitleIng = value.showTitleIng
contentDTO.showTitleNo = value.showTitleNo
contentDTO.startTime = value.startTime
contentDTO.subType = ""
contentDTO.subtitle = ""
contentDTO.title = value.title
contentDTO.vImageUrl = ""
contentDTO.screenType = ""
contentDTO.source = StringUtils.isEmpty(value.creatorName) ? value.sourceName : value.creatorName
contentDTO.objectId = value.id
contentDTO.objectType = value.type
contentDTO.channelId = value.channelId
contentDTO.relId = value.relId
contentDTO.relType = value.relType
contentDTO.newsTitle = value.titleLiteral;
contentDTO.publishTime =
StringUtils.isNotEmpty(value.firstPublishTime) ? value.firstPublishTime : value.publishTime
contentDTO.visitorComment = -1
contentDTO.fullColumnImgUrls = photos
contentDTO.newsSummary = ""
contentDTO.hasMore = -1
contentDTO.slideShows = []
contentDTO.voiceInfo = {} as VoiceInfoDTO
contentDTO.tagWord = -1
contentDTO.isSelect = true
contentDTO.rmhInfo = {} as RmhInfoDTO
contentDTO.photoNum = -1
contentDTO.liveInfo = {} as LiveInfoDTO;
contentDTO.videoInfo = {
videoDuration: Number.parseInt(value.duration)
} as VideoInfoDTO;
let interact = new InteractDataDTO()
interact.collectNum = value.collectNum
interact.commentNum = value.commentNum
interact.contentId = value.id
interact.contentType = Number.parseInt(value.type)
interact.likeNum = value.likeNum
interact.readNum = Number.parseInt(value.readNum)
interact.shareNum = Number.parseInt(value.shareNum)
contentDTO.interactData = interact
contentDTO.corner = ''
contentDTO.rmhPlatform = 0
contentDTO.newTags = ''
contentDTO.isSearch = true
contentDTO.publishTimestamp = ""
contentDTO.bottomNavId = '';
contentDTO.openType = '';
contentDTO.extra = '';
contentDTO.titleShow = value.type == "5" ? 1 : 0;
contentDTO.rmhInfo = rmhInfo
contentDTO.shareFlag = value.shareFlag
contentDTO.contentText = value.contentText
return contentDTO;
}
}
// 搜索数据转化rmhInfo
private getRmhInfo(rem:CreatorDetailResponseItem[],value:SearchResultContentItem){
let obj = value.data
... ... @@ -535,6 +680,65 @@ export struct SearchResultContentComponent {
}
return rmhInfo
}
// 搜索数据转化rmhInfo
private getRmhInfo2(rem:CreatorDetailResponseItem[],value:SearchDescription){
let obj = value
let rmhInfo:RmhInfoDTO = {
rmhHeadUrl:obj.headerPhotoUrl,
rmhName:obj.creatorName,
rmhId:obj.creatorId,
authIcon:obj.authIcon,
authTitle: obj.authTitle,
authTitle2: '',
banControl: 0,
cnIsAttention: 0,
cnAttention: 0,
cnlsComment: 0,
cnlsLike: 0,
cnMainControl: 0,
cnShareControl: 0,
cnIsComment: 0,
cnIsLike:0,
posterShareControl: 0,
rmhDesc: obj.introduction,
userId: obj.userId,
userType: obj.userType,
honoraryIcon:''
}
if(rem.length>0){
rem.forEach(item=>{
if(item.creatorId === obj.creatorId){
rmhInfo = {
rmhHeadUrl:item.headPhotoUrl,
rmhName:item.userName,
rmhId:item.creatorId,
authIcon:item.authIcon,
authTitle: item.authTitle,
authTitle2: '',
banControl: 0,
cnIsAttention:item.isAttention,
cnAttention: 0,
cnlsComment: 0,
cnlsLike: 0,
cnMainControl: 0,
cnShareControl: 0,
cnIsComment: 0,
cnIsLike:0,
posterShareControl: 0,
rmhDesc: item.introduction,
userId: item.userId,
userType: item.userType,
honoraryIcon:''
}
}
})
}
return rmhInfo
}
private extractResizeParams(url: string) {
const heightRegex = /h_(\d+)/; // 匹配高度参数,如h_450
const widthRegex = /w_(\d+)/; // 匹配宽度参数,如w_800
... ...
... ... @@ -178,43 +178,43 @@ export struct LikeComponent {
.width(24)
.height(24)
if (this.likeCount > 0){
RelativeContainer() {
Image(this.likeStatus ? $r('app.media.ic_like_back_Select') : $r('app.media.ic_like_back'))
.objectFit(ImageFit.Fill)
.resizable({
slice: {
top: 1,
left: 20,
right: 1,
bottom: 1
}
})
.alignRules({
top: { anchor: "Text", align: VerticalAlign.Top },
left: { anchor: "Text", align: HorizontalAlign.Start },
right: { anchor: "Text", align: HorizontalAlign.End },
bottom: { anchor: "Text", align: VerticalAlign.Bottom },
})
.id("Image")
RelativeContainer() {
Image(this.likeStatus ? $r('app.media.ic_like_back_Select') : $r('app.media.ic_like_back'))
.objectFit(ImageFit.Fill)
.resizable({
slice: {
top: 1,
left: 20,
right: 1,
bottom: 1
}
})
.alignRules({
top: { anchor: "Text", align: VerticalAlign.Top },
left: { anchor: "Text", align: HorizontalAlign.Start },
right: { anchor: "Text", align: HorizontalAlign.End },
bottom: { anchor: "Text", align: VerticalAlign.Bottom },
})
.id("Image")
Text(NumberFormatterUtils.formatNumberWithWan(this.likeCount || ''))// Text("44444444")
.fontSize(8)
.fontColor('#ffffff')// .backgroundColor('#ED2800')
.height(12)
.textAlign(TextAlign.Center)
.alignRules({
top: { anchor: "__container__", align: VerticalAlign.Top },
left: { anchor: "__container__", align: HorizontalAlign.Start }
})/*动态计算文字宽度*/
.width(this.getMeasureText(NumberFormatterUtils.formatNumberWithWan(this.likeCount || '')) +
12)// .backgroundColor(Color.Green)
.id("Text")
.visibility(this.likeCount > 0 ? Visibility.Visible : Visibility.Hidden)
Text(NumberFormatterUtils.formatNumberWithWan(this.likeCount || ''))// Text("44444444")
.fontSize(8)
.fontColor('#ffffff')// .backgroundColor('#ED2800')
.height(12)
.textAlign(TextAlign.Center)
.alignRules({
top: { anchor: "__container__", align: VerticalAlign.Top },
left: { anchor: "__container__", align: HorizontalAlign.Start }
})/*动态计算文字宽度*/
.width(this.getMeasureText(NumberFormatterUtils.formatNumberWithWan(this.likeCount || '')) +
12)// .backgroundColor(Color.Green)
.id("Text")
.visibility(this.likeCount > 0 ? Visibility.Visible : Visibility.Hidden)
}
.offset({
x: 12
})
}
.offset({
x: 12
})
}
// Column() {
// // Image(this.likeStatus ? $r('app.media.icon_like_select') : $r('app.media.icon_like_default'))
... ... @@ -259,19 +259,21 @@ export struct LikeComponent {
.width(36)
.height(36)
.borderRadius(18)
.backgroundColor((this.pageComponentType === 4 || this.pageComponentType === 2) ? '#4D000000' : '#FFF5F5F5')
.backgroundColor((this.pageComponentType === 4 || this.pageComponentType === 2) ? '#4D000000' : this.pageComponentType === 8 ? Color.Transparent : '#FFF5F5F5')
Row() {
Text(NumberFormatterUtils.formatNumberWithWan(this.likeCount || ''))
.fontSize(8)
.fontColor(Color.White)
.padding({ left: 4, right: 2 })
.padding({ left: 8, right: 2 })
}
.height(12)
.alignItems(VerticalAlign.Center)
.position({ x: '100%', })
.position({ x: '100%', y: 10 })
.markAnchor({ x: '100%' })
.backgroundImage($r('app.media.ic_like_back'))
.backgroundImageSize(ImageSize.Auto)
.backgroundImageSize({height: 13})
.width(this.getMeasureText(NumberFormatterUtils.formatNumberWithWan(this.likeCount || '')) +
12)
.visibility(this.likeCount > 0 ? Visibility.Visible : Visibility.Hidden)
}
.width(36)
... ...
... ... @@ -88,8 +88,7 @@ export struct OperRowListView {
@State dialogController: CustomDialogController | null = null;
async aboutToAppear() {
console.info(TAG, '22222----', this.styleType)
console.info(TAG, '3333----', this.needLike)
console.info(TAG, 'this.needLike', this.needLike)
this.handleStyle()
this.onDetailUpdated()
EmitterUtils.receiveEvent(EmitterEventId.AUDIO_CHANGE_STATUS, (val: number | string | undefined) => {
... ... @@ -108,7 +107,7 @@ export struct OperRowListView {
}
async onDetailUpdated() {
console.info(TAG, '111111----', this.styleType)
console.info(TAG, 'this.styleType', this.styleType)
this.handleStyle()
if (!this.contentDetailData) {
return
... ... @@ -199,7 +198,7 @@ export struct OperRowListView {
.padding({
top: 10,
// bottom: 10
bottom: `${this.bottomSafeHeight}px`
bottom: px2vp(this.bottomSafeHeight)
// bottom: 50
})
}
... ... @@ -380,7 +379,7 @@ export struct OperRowListView {
{
contentId: this.contentDetailData?.newsId + '',
contentType: this.contentDetailData?.newsType + '',
contentRelId: this.contentDetailData?.reLInfo?.relId + '',
contentRelId: this.contentDetailData?.reLInfo?.relId || '' + '',
}
]
}
... ... @@ -397,7 +396,6 @@ export struct OperRowListView {
* 收藏、取消收藏
*/
async toggleCollectStatus() {
console.log(TAG, '收藏点击')
// 未登录,跳转登录
const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
console.log(TAG, '收藏点击,登录', user_id)
... ... @@ -411,15 +409,13 @@ export struct OperRowListView {
contentList: [{
contentId: this.contentDetailData?.newsId + '',
contentType: this.contentDetailData?.newsType + '',
relType: this.contentDetailData?.reLInfo?.relType + '',
contentRelId: this.contentDetailData?.reLInfo?.relId + '',
relType: this.contentDetailData?.reLInfo?.relType || '' + '',
contentRelId: this.contentDetailData?.reLInfo?.relId || '' + '',
}],
}
// console.log(TAG, '收藏点击', JSON.stringify(params))
console.log(TAG, '收藏点击', JSON.stringify(params))
PageRepository.postExecuteCollectRecord(params).then(res => {
console.log(TAG, '收藏点击 res', JSON.stringify(res))
console.log(TAG, '收藏点击 this.newsStatusOfUser', JSON.stringify(this.newsStatusOfUser))
if (this.newsStatusOfUser) {
this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1
if (this.newsStatusOfUser.collectStatus === 1) {
... ... @@ -427,6 +423,7 @@ export struct OperRowListView {
}
this.queryContentInteractCount()
}
console.log(TAG, '收藏点击 this.newsStatusOfUser', JSON.stringify(this.newsStatusOfUser))
})
}
... ...
... ... @@ -7,7 +7,7 @@ import { HomePageBottomFollowComponent } from '../components/mine/home/HomePageB
import MinePageDatasModel from '../model/MinePageDatasModel';
import { EmptyComponent } from '../components/view/EmptyComponent';
import { CustomTitleUI } from '../components/reusable/CustomTitleUI';
import { TrackingPageBrowse, TrackConstants } from 'wdTracking/Index';
import { TrackingPageBrowse, TrackConstants, TrackingButton } from 'wdTracking/Index';
const TAG = "MineHomePage"
... ... @@ -454,6 +454,9 @@ struct MineHomePage {
}, 1000);
//route 跳转写这里 TODO
WDRouterRule.jumpWithPage(WDRouterPage.editUserInfoPage)
//编辑资料只有个人主页
TrackingButton.click('mainPersonalHomePageEditorialMaterial',TrackConstants.PageName.Main_Personal,TrackConstants.PageName.Main_Personal)
}
}
getUserInfo(){
... ...
import { MessageListUI } from '../components/mine/message/MessageListUI';
import {TrackConstants}from 'wdTracking/Index'
import TrackingPageBrowseUtils from '../utils/TrackingPageBrowseUtils'
@Entry
@Component
struct MineMessagePage {
onPageShow(): void {
TrackingPageBrowseUtils.TrackingPageBrowseExposureStart()
}
onPageHide(): void {
TrackingPageBrowseUtils.TrackingPageBrowseExposureEnd(TrackConstants.PageName.My_Notification,TrackConstants.PageName.My_Notification)
}
build() {
Column(){
MessageListUI()
... ...
... ... @@ -173,4 +173,47 @@ export class ColorUtils {
alpha: (color & 0xFF000000) >> 24
}
}
public static getMorningEveningPaperRgb(color: ColorRgb): ColorRgb{
// RGB颜色取值范围是0~255,需要转换为0~1的浮点数
const red: number = color.red / MAX_RGB_VALUE;
const green: number = color.green / MAX_RGB_VALUE;
const blue: number = color.blue / MAX_RGB_VALUE;
const max: number = Math.max(red, green, blue);
const min: number = Math.min(red, green, blue);
const delta: number = max - min;
// 色调
let hue: number = 0;
// 饱和度
let saturation: number = 0;
// 明度
let value: number = 0;
// 计算hue值
if (max === min) {
hue = 0;
} else if (Math.abs(max - red) < Number.EPSILON) {
hue = (green >= blue ? ((green - blue) / delta) * 60 : ((green - blue) / delta) * 60 + 360);
} else if (Math.abs(max - green) < Number.EPSILON) {
hue = (((blue - red) / delta) + 2) * 60;
} else if (Math.abs(max - blue) < Number.EPSILON) {
hue = (((red - green) / delta) + 4) * 60;
}
// 计算saturation值
saturation = 0.9;
// 计算value值
value = 0.3;
return ColorUtils.hsv2rgb({
hue: hue,
saturation: saturation,
value: value,
alpha: color.alpha
})
}
}
\ No newline at end of file
... ...
... ... @@ -34,8 +34,7 @@ export function viewBlogInsightIntentShare(context: common.UIAbilityContext, ent
intentVersion: '1.0.1',
identifier,
intentActionInfo: {
actionMode,
currentPercentage: 50,
actionMode
//目前不考虑发生时段
// executedTimeSlots: {
// executedEndTime: new Date().getTime(),
... ... @@ -91,8 +90,7 @@ export function viewBlogItemInsightIntentShare(context: common.UIAbilityContext,
intentVersion: '1.0.1',
identifier,
intentActionInfo: {
actionMode: ActionMode.EXECUTED,
currentPercentage: 50,
actionMode: ActionMode.EXECUTED
},
intentEntityInfo: {
entityName: 'Blog',
... ... @@ -138,8 +136,7 @@ export function viewColumInsightIntentShare(context: common.UIAbilityContext, en
intentVersion: '1.0.1',
identifier: generateUUID(),
intentActionInfo: {
actionMode: ActionMode.EXECUTED,
currentPercentage: 50,
actionMode: ActionMode.EXECUTED
},
intentEntityInfo: {
entityName: 'Column',
... ...
... ... @@ -4,7 +4,87 @@ import PageModel from '../viewmodel/PageModel';
import PageHelper from '../viewmodel/PageHelper';
import PageAdModel from '../viewmodel/PageAdvModel';
import { LoadStatus } from '../components/refresh/RefreshLayoutBean';
import { Logger } from 'wdKit/Index';
/***********新的下拉、上拉手势 start **********/
export function onActionStart(pageModel: PageModel, pageAdvModel: PageAdModel, event?: GestureEvent) {
if (event === undefined) {
return
}
pageModel.downY = event.offsetY;
pageModel.lastMoveY = event.offsetY;
}
export function onActionUpdate(pageModel: PageModel, pageAdvModel: PageAdModel, event?: GestureEvent) {
if (event === undefined) {
return
}
if ((pageModel.isRefreshing === true) || (pageModel.isLoading === true)) {
return;
}
let isDownPull = event.offsetY - pageModel.lastMoveY > 0;
if (((isDownPull === true) || (pageModel.isPullRefreshOperation === true)) &&
(pageModel.isCanLoadMore === false)) {
actionUpdatePullRefresh(pageModel, event);
} else {
actionUpdateLoadMore(pageModel, event);
}
pageModel.lastMoveY = event.offsetY;
}
export function onActionEnd(pageModel: PageModel, pageAdvModel: PageAdModel) {
if ((pageModel.isRefreshing === true) || (pageModel.isLoading === true)) {
return;
}
if ((pageModel.isPullRefreshOperation === true)) {
touchUpPullRefresh(pageModel, pageAdvModel);
} else {
// touchUpLoadMore(pageModel);
}
}
export function actionUpdatePullRefresh(pageModel: PageModel, event: GestureEvent) {
if (pageModel.startIndex === 0) {
pageModel.isPullRefreshOperation = true;
let height = vp2px(Const.CUSTOM_REFRESH_DECIDE_HEIGHT);
pageModel.offsetY = event.offsetY - pageModel.downY;
if (pageModel.offsetY >= height) {
pullRefreshState(pageModel, RefreshState.Release);
pageModel.offsetY = height + pageModel.offsetY * Const.Y_OFF_SET_COEFFICIENT;
} else {
pullRefreshState(pageModel, RefreshState.DropDown);
}
if (pageModel.offsetY < 0) {
pageModel.offsetY = 0;
pageModel.isPullRefreshOperation = false;
}
}
}
export function actionUpdateLoadMore(model: PageModel, event: GestureEvent) {
// list size +1
if (model.endIndex >= model.compList.totalCount() - 3 && model.endIndex <= model.compList.totalCount()) {
// model.offsetY = event.touches[0].y - model.downY;
// if (Math.abs(model.offsetY) > vp2px(model.pullUpLoadHeight) / 2) {
// model.isCanLoadMore = true;
// model.isVisiblePullUpLoad = true;
// model.offsetY = -vp2px(model.pullUpLoadHeight) + model.offsetY * Const.Y_OFF_SET_COEFFICIENT;
// }
// 不用分页动画,直接预加载
model.isCanLoadMore = true;
model.isVisiblePullUpLoad = true;
touchUpLoadMore(model);
}
}
/***********新的下拉、上拉手势 end **********/
//下拉刷新上拉加载更多组件
/**
* @deprecated
*/
export function listTouchEvent(pageModel: PageModel, pageAdvModel: PageAdModel, event: TouchEvent) {
switch (event.type) {
case TouchType.Down:
... ... @@ -16,7 +96,8 @@ export function listTouchEvent(pageModel: PageModel, pageAdvModel: PageAdModel,
return;
}
let isDownPull = event.touches[0].y - pageModel.lastMoveY > 0;
if (((isDownPull === true) || (pageModel.isPullRefreshOperation === true)) && (pageModel.isCanLoadMore === false)) {
if (((isDownPull === true) || (pageModel.isPullRefreshOperation === true)) &&
(pageModel.isCanLoadMore === false)) {
// Finger movement, processing pull-down refresh.
touchMovePullRefresh(pageModel, event);
} else {
... ... @@ -44,6 +125,9 @@ export function listTouchEvent(pageModel: PageModel, pageAdvModel: PageAdModel,
}
}
/**
* @deprecated
*/
export function touchMovePullRefresh(pageModel: PageModel, event: TouchEvent) {
if (pageModel.startIndex === 0) {
pageModel.isPullRefreshOperation = true;
... ...
import { DateTimeUtils } from 'wdKit/Index';
import { ParamType, TrackingPageBrowse } from 'wdTracking/Index';
class TrackingPageBrowseUtils {
private static instance: TrackingPageBrowseUtils
pageShowTime:number = 0;
pageHideTime:number = 0;
/**
* 单例模式
* @returns
*/
public static getInstance(): TrackingPageBrowseUtils {
if (!TrackingPageBrowseUtils.instance) {
TrackingPageBrowseUtils.instance = new TrackingPageBrowseUtils();
}
return TrackingPageBrowseUtils.instance;
}
TrackingPageBrowseExposureStart(){
this.pageShowTime = DateTimeUtils.getTimeStamp()
}
TrackingPageBrowseExposureEnd(pageId: string, pageName: string,extParams?: ParamType){
this.pageHideTime = DateTimeUtils.getTimeStamp()
let duration = 0
duration = Math.floor((this.pageHideTime - this.pageShowTime)/1000)
TrackingPageBrowse.trackCommonPageExposureEnd(pageId,pageName,duration,extParams)
}
}
const pageBrowseUtils = TrackingPageBrowseUtils.getInstance();
export default pageBrowseUtils as TrackingPageBrowseUtils
\ No newline at end of file
... ...
... ... @@ -8,11 +8,12 @@ import { ContentDetailDTO,
postBatchAttentionStatusResult,
postInteractBrowsOperateParams,
InteractDataDTO,
FeedbackTypeBean
FeedbackTypeBean,
FeedBackParams
} from 'wdBean';
import { PageRepository } from '../repository/PageRepository';
import { ArrayList } from '@kit.ArkTS';
import { ToastUtils} from 'wdKit/Index';
const TAG = 'MultiPictureDetailViewModel';
export class MultiPictureDetailViewModel {
... ... @@ -158,15 +159,16 @@ export class MultiPictureDetailViewModel {
})
}
static async feedBackCommit(params:HashMap<String,String>): Promise<ResponseDTO> {
return new Promise<ResponseDTO>((success, error) => {
static async feedBackCommit(params:FeedBackParams): Promise<object> {
return new Promise<object>((success, error) => {
Logger.info(TAG, `fetchDetailData start`);
WDHttp.post(HttpUrlUtils.getHost() + HttpUrlUtils.FEEDBACK_COMMIT_PATH,params).then((resDTO: ResponseDTO) => {
WDHttp.post(HttpUrlUtils.getHost() + HttpUrlUtils.FEEDBACK_COMMIT_PATH,params).then((resDTO: object) => {
success(resDTO);
ToastUtils.shortToast('反馈成功')
}).catch((err: Error) => {
Logger.error(TAG, `fetchDetailData catch, error.name : ${err.name}, error.message:${err.message}`);
error(err);
ToastUtils.shortToast('反馈失败')
})
})
}
... ...
... ... @@ -5,7 +5,7 @@ export class SearchResultContentItem{
resultType:string = ""
}
class SearchDescription{
export class SearchDescription{
likeEnable: string = ""
previewUri: string = ""
firstFrameImageBucket: string = ""
... ... @@ -178,7 +178,7 @@ class SearchDescription{
likeNum: string= ""
readNum: string= ""
shareNum: string= ""
sameContentList:SearchDescription[] = []
}
@Observed
... ...
... ... @@ -33,8 +33,8 @@ export struct DetailPlayLiveCommon {
this.relId = params?.extra?.relId || '';
this.relType = params?.extra?.relType || '';
this.contentId = params?.contentID || '';
await this.getContentDetail()
this.getLiveDetails()
this.getContentDetail()
}
build() {
... ... @@ -55,8 +55,8 @@ export struct DetailPlayLiveCommon {
/**
* 查询视频详情用于评论展示
*/
async getContentDetail() {
await this.liveViewModel.getContentDetail(this.contentId, this.relId, this.relType)
getContentDetail() {
this.liveViewModel.getContentDetail(this.contentId, this.relId, this.relType)
.then((data: Array<ContentDetailDTO>) => {
console.log(TAG, '查询视频详情用于评论展示 getContentDetail:', JSON.stringify(data))
if (data) {
... ... @@ -72,6 +72,8 @@ export struct DetailPlayLiveCommon {
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType || '')
this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment || '')
this.publishCommentModel.commentContent = ''
this.getLiveDetails()
// }
}
})
... ...
... ... @@ -53,17 +53,23 @@ export struct DetailPlayLivePage {
console.error(TAG, 'this.publishCommentModel', this.publishCommentModel.targetId)
}
async aboutToDisappear() {
Logger.info(TAG, `wyj-aboutToDisappear`)
await this.playerController?.stop()
await this.playerController?.release()
}
build() {
Column() {
TopPlayComponent({ playerController: this.playerController })
.layoutWeight(211)
.height(211)
TabComponent({ tabs: this.tabs, changeToTab: this.changeToTab })
.layoutWeight(503)
.layoutWeight(1)
.visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None)
OperRowListView({
componentType: 4,
operationButtonList: ['comment', 'collect', 'share', 'like'],
styleType: 1,
contentDetailData: this.contentDetailData,
publishCommentModel: this.publishCommentModel,
showCommentIcon: false,
... ... @@ -79,12 +85,7 @@ export struct DetailPlayLivePage {
}
.height('100%')
.width('100%')
}
async aboutToDisappear() {
Logger.info(TAG, `wyj-aboutToDisappear`)
await this.playerController?.stop()
await this.playerController?.release()
// 设置底部绘制延伸到导航条
}
onPageShowCus(): void {
... ...
... ... @@ -90,7 +90,7 @@ export struct DetailDialog {
}).layoutWeight(1)
OperRowListView({
componentType: 1,
componentType: 4,
pageComponentType: 8,
showBackIcon: false,
operationButtonList: ['comment', 'like', 'collect', 'share'],
... ...
... ... @@ -31,7 +31,7 @@ export struct PlayerFullScreenView {
WindowModel.shared.setWindowSystemBarEnable([])
this.timer = setInterval(() => {
this.showOperator = false
}, 5)
}, 5000)
}
aboutToDisappear(): void {
... ... @@ -41,13 +41,20 @@ export struct PlayerFullScreenView {
restartTimer() {
clearInterval(this.timer)
this.showOperator = true
this.timer = setInterval(() => {
this.showOperator = false
}, 5)
}, 5000)
}
build() {
Stack() {
Row() {
}.height('100%').width('100%')
.onClick(() => {
this.restartTimer()
})
this.headerBuilder()
this.bottomBuilder()
... ... @@ -55,9 +62,7 @@ export struct PlayerFullScreenView {
.zIndex(99999)
.height('100%')
.width('100%')
.onClick(() => {
this.restartTimer()
})
}
@Builder
... ... @@ -94,6 +99,8 @@ export struct PlayerFullScreenView {
.alignItems(VerticalAlign.Center)
.justifyContent(FlexAlign.SpaceBetween)
.padding({ left: 40, right: 40 })
.animation({ duration: 2000 })
.visibility(this.showOperator ? Visibility.Visible : Visibility.Hidden)
.linearGradient({
direction: GradientDirection.Bottom, // 渐变方向
colors: [['rgba(0,0,0,0.5)', 0],
... ... @@ -152,6 +159,8 @@ export struct PlayerFullScreenView {
.markAnchor({ y: '100%' })
.align(Alignment.Bottom)
.padding({ left: 40, right: 40 })
.animation({ duration: 2000 })
.visibility(this.showOperator ? Visibility.Visible : Visibility.Hidden)
.linearGradient({
direction: GradientDirection.Bottom, // 渐变方向
colors: [['rgba(0,0,0,0.5)', 0],
... ...
... ... @@ -91,8 +91,8 @@ export struct PlayerRightView {
contentList: [{
contentId: this.contentDetailData?.newsId + '',
contentType: this.contentDetailData?.newsType + '',
relType: this.contentDetailData?.reLInfo?.relType + '',
contentRelId: this.contentDetailData?.reLInfo?.relId + '',
relType: this.contentDetailData?.reLInfo?.relType || '' + '',
contentRelId: this.contentDetailData?.reLInfo?.relId || '' + '',
}],
}
... ...
import { CompInfoBean, ContentDetailDTO, ContentDTO, PageInfoDTO } from 'wdBean/Index';
import { CompInfoBean, ContentDetailDTO, ContentDTO, PageInfoBean, PageInfoDTO } from 'wdBean/Index';
import { ParamType } from './PublicParams';
import { TrackConstants } from './TrackConstants';
import { TrackingUtils } from './TrackingUtils';
export class TrackParamConvert {
... ... @@ -70,7 +71,7 @@ export class TrackParamConvert {
return param
}
private static appendRecommend(detail: ContentDetailDTO, to: ParamType) {
private static appendRecommend(detail: object, to: ParamType) {
//TODO: ContentDetailDTO 增加推荐字段
... ... @@ -85,4 +86,42 @@ export class TrackParamConvert {
/// 这里填写默认值,后续在action=browse时,再重写
to["duration"] = 0
}
///早晚报 专题
static pageInfoBean_ParamType(pageInfo: PageInfoBean) : ParamType {
let topTypeString: string = '';
switch (pageInfo.topicInfo.topicType){
case 21:
topTypeString = TrackConstants.SummaryType.Article
break;
case 22:
topTypeString = TrackConstants.SummaryType.Audio
break;
case 23:
topTypeString = TrackConstants.SummaryType.Live
break;
case 24:
topTypeString = TrackConstants.SummaryType.Talk
break;
case 25:
topTypeString = TrackConstants.SummaryType.MorningAndEveningNews
break;
case 26:
topTypeString = TrackConstants.SummaryType.TimeAxis
break;
}
let param: ParamType = {
"summaryId": pageInfo.topicInfo.topicId,
"summaryType": topTypeString,
"specialLink": pageInfo.topicInfo.shareUrl,
"channelSourceId": pageInfo.name,
"pageId": 'summaryDetailPage',
}
TrackParamConvert.appendRecommend(pageInfo, param)
return param
}
}
\ No newline at end of file
... ...
... ... @@ -4,12 +4,8 @@ import { WDRouterPage } from 'wdRouter';
import { Logger, SPHelper } from 'wdKit/Index';
import { SpConstants } from 'wdConstant/Index';
import LaunchDataModel from '../viewModel/LaunchDataModel'
import { LaunchModel } from '../viewModel/LaunchModel';
import { ifaa } from '@kit.OnlineAuthenticationKit';
import common from '@ohos.app.ability.common';
import Want from '@ohos.app.ability.Want';
import { BusinessError } from '@ohos.base';
import { ParamType, TrackConstants, TrackingButton, TrackingContent } from 'wdTracking/Index';
@Entry
... ... @@ -18,6 +14,7 @@ struct LaunchAdvertisingPage {
@State time: number = 4
timer :number = -1
@State model : LaunchDataModel = {} as LaunchDataModel
pageParam: ParamType = {}
enter() {
... ... @@ -29,7 +26,6 @@ struct LaunchAdvertisingPage {
}
aboutToAppear(): void {
let dataModelStr : string = SPHelper.default.getSync(SpConstants.APP_LAUNCH_PAGE_DATA_MODEL,'') as string
let dataModel : LaunchDataModel = JSON.parse(dataModelStr)
this.model = dataModel
... ... @@ -38,7 +34,9 @@ struct LaunchAdvertisingPage {
//设置倒计时时间
this.time = this.model.launchAdInfo[0].displayDuration
}
this.contentTrackingDict()
this.trackingLaunchShow()
}
... ... @@ -96,6 +94,7 @@ struct LaunchAdvertisingPage {
.backgroundColor('#80000000')
.onClick(() => {
this.enter()
this.trackingLaunchJumpOver()
})
}
.width('100%')
... ... @@ -176,13 +175,15 @@ struct LaunchAdvertisingPage {
action(){
//跳转 url linkUrl https://news.bjd.com.cn/2024/03/19/10724331.shtml
// openType 端外 端内 打开
///埋点
this.trackingLaunchClick()
if(this.model.launchAdInfo.length){
if (this.model.launchAdInfo[0].matInfo.openType == '2') {
//端外打开
ProcessUtils.jumpExternalWebPage(this.model.launchAdInfo[0].matInfo.linkUrl)
//clearInterval(this.timer)
}else {
//端内打开
ProcessUtils.gotoDefaultWebPage(this.model.launchAdInfo[0].matInfo.linkUrl)
... ... @@ -192,6 +193,25 @@ struct LaunchAdvertisingPage {
}
}
contentTrackingDict(){
this.pageParam = {
'adType':'0',
'adId':this.model.launchAdInfo[0]?.matInfo.id.toString(),
'adName':this.model.launchAdInfo[0]?.matInfo.advTitle,
'regionName':'0'
}
}
trackingLaunchJumpOver(){
TrackingButton.click('skip_click',TrackConstants.PageName.Open_Screen,TrackConstants.PageName.Open_Screen)
}
trackingLaunchShow(){
TrackingContent.common(TrackConstants.EventType.Show,TrackConstants.PageName.Open_Screen,TrackConstants.PageName.Open_Screen,this.pageParam)
}
trackingLaunchClick(){
TrackingContent.common(TrackConstants.EventType.Click,TrackConstants.PageName.Open_Screen,TrackConstants.PageName.Open_Screen,this.pageParam)
}
}
\ No newline at end of file
... ...
... ... @@ -4,7 +4,7 @@ import { EmitterEventId, EmitterUtils, Logger, StringUtils } from 'wdKit';
import { HttpUtils } from 'wdNetwork/Index';
import HomeChannelUtils, { AssignChannelParam } from 'wdRouter/Index';
import { MinePageComponent } from 'wdComponent/src/main/ets/components/page/MinePageComponent';
import { CompUtils, TopNavigationComponent } from 'wdComponent/Index';
import { CompUtils, TopNavigationComponent, TopNavigationComponentNew } from 'wdComponent/Index';
import { VideoChannelPage } from './VideoChannelPage';
import ChannelViewModel from 'wdComponent/src/main/ets/viewmodel/ChannelViewModel';
... ... @@ -17,6 +17,7 @@ let storage = LocalStorage.getShared();
@Entry(storage)
@Component
export struct BottomNavigationComponent {
private isNewTopPage = true // TODO 顶导重构页面开关,false,则用原来的顶导
@Provide bottomRectHeight: number = 0
@Provide topRectHeight: number = 0
@Provide isLayoutFullScreen: boolean = false
... ... @@ -82,15 +83,28 @@ export struct BottomNavigationComponent {
autoRefresh: this.autoRefresh
})
} else {
TopNavigationComponent({
groupId: navItem.id,
topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073),
_currentNavIndex: $currentNavIndex,
navIndex: index,
currentBottomNavName: navItem.name,
assignChannel: this.assignChannel,
autoRefresh: this.autoRefresh
})
if (this.isNewTopPage) {
TopNavigationComponentNew({
groupId: navItem.id,
topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073),
_currentNavIndex: $currentNavIndex,
bottomNavIndex: index,
currentBottomNavName: navItem.name,
assignChannel: this.assignChannel,
autoRefresh: this.autoRefresh
})
} else {
TopNavigationComponent({
groupId: navItem.id,
topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073),
_currentNavIndex: $currentNavIndex,
navIndex: index,
currentBottomNavName: navItem.name,
assignChannel: this.assignChannel,
autoRefresh: this.autoRefresh
})
}
}
}
.tabBar(this.tabBarBuilder(navItem, index))
... ...
... ... @@ -26,6 +26,7 @@ export interface NetLayerLauncherADMaterialModel{
matType : string //1 video 其他 image
startStyle : number // 1 WDDisplayStyle_Full 全屏样式 其他 WDDisplayStyle_Logo 底部logo样式
advTitle : string
id:number
matImageUrl : string[] //取firstObject
matVideoUrl : string
... ...