zhanglun_wd

Merge remote-tracking branch 'origin/main' into main

Showing 37 changed files with 868 additions and 268 deletions
... ... @@ -34,11 +34,10 @@ export struct ENewspaperItemComponent {
.visibility(this.isShowSkeleton ? Visibility.Visible : Visibility.None)
Image(this.newspaperListItemBean.pagePic)
.width('100%')
.aspectRatio(378 / 566)
.objectFit(ImageFit.Fill)
.onComplete(() => {
this.isShowSkeleton = false
})
.objectFit(ImageFit.Fill)
.visibility(this.isShowSkeleton ? Visibility.None : Visibility.Visible)
Canvas(this.context)
... ... @@ -49,7 +48,7 @@ export struct ENewspaperItemComponent {
})
}
.padding({ top: 16, right: 16, bottom: 16, left: 16 })
.padding({ top:14, right: 10, bottom: 14, left: 10 })
.margin({ left: 10, right: 10 })
.backgroundColor(Color.White)
.width('100%')
... ...
... ... @@ -28,6 +28,8 @@ export struct ENewspaperPageComponent {
@State swiperIndex: number = 0;
//当前选择的日期标记
@State selectDate: Date = new Date()
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
@State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
//watch监听报纸页码回调
onCurrentPageNumUpdated(): void {
... ... @@ -102,7 +104,10 @@ export struct ENewspaperPageComponent {
//获取宽高尺寸
this.screenWidth = this.displayTool.width
this.picWidth = this.screenWidth - vp2px(52)
this.picHeight = this.picWidth * 566 / 378
let screenHeight = this.displayTool.height;
// bottomSafeHeight 底导高度 topSafeHeight 顶导高度 44 顶部高度 60 底部高度
let height = screenHeight -this.bottomSafeHeight - this.topSafeHeight - vp2px(44) - vp2px(60)
this.picHeight = height
// 默认日期
const date = new Date()
const month = date.getMonth() + 1
... ... @@ -213,10 +218,11 @@ export struct ENewspaperPageComponent {
}
.index(this.swiperIndex)
.width('100%')
.height(px2vp(this.picHeight) + 32)
// newspaper_shadow 44 高度 e_newspaper_content 35 margin top
.height(px2vp(this.picHeight) - 44 - 35)
.vertical(true)
.autoPlay(false)
.cachedCount(3)
.cachedCount(1)
.indicator(false)
.loop(false)
.displayCount(1)
... ... @@ -234,6 +240,7 @@ export struct ENewspaperPageComponent {
Image($r('app.media.newspaper_shadow'))
.height($r('app.float.vp_12'))
.width('100%')
.margin({ left: 10, right: 10, top: -1 })
.objectFit(ImageFit.Contain)
.alignRules({
... ...
... ... @@ -11,6 +11,7 @@ import { router } from '@kit.ArkUI';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter/Index';
import { TrackConstants, TrackingButton, TrackingPageBrowse } from 'wdTracking/Index';
import inputMethod from '@ohos.inputMethod';
const TAG = 'FeedBackActivity'
... ... @@ -23,14 +24,15 @@ const TAG = 'FeedBackActivity'
export struct FeedBackActivity {
pageShowTime:number = 0;
@State canSubmit: boolean = false;
@State textNumLabel: string = '0/500';
contact: string = "";
@State textNumLabel: number = 0;
email: string = "";
//UI
scroller: Scroller = new Scroller();
@State isNetConnected: boolean = true
@State editValue: FeedbackTypeBean = {classifyName:''} as FeedbackTypeBean
@State feedbackTypeBeans: FeedbackTypeBean[] = [] as FeedbackTypeBean[]
//添加图片
addPic: PhotoListBean = {itemType:1} as PhotoListBean
... ... @@ -107,7 +109,7 @@ export struct FeedBackActivity {
.width(CommonConstants.FULL_WIDTH)
.margin({ left: 24, top: $r('app.float.vp_12') })
Stack({ alignContent: Alignment.BottomEnd }) {
TextArea({ placeholder: $r('app.string.feedback_comments') })
TextArea({ placeholder: $r('app.string.feedback_comments'),text: this.editValue.classifyName})
.width(CommonConstants.FULL_WIDTH)
.height(CommonConstants.FULL_HEIGHT)
.fontColor($r('app.color.color_222222'))
... ... @@ -116,12 +118,20 @@ export struct FeedBackActivity {
.placeholderFont({size:$r('app.float.font_size_13_2')})
.padding({bottom:96})
.backgroundColor($r('app.color.color_F5F5F5'))
.outlineColor($r('app.color.color_F5F5F5'))
.align(Alignment.TopStart)
.maxLength(500)
.onChange((value) => {
// Logger.debug(TAG, "onChange" + value + "/" + this.passwordContent)
this.contact = value
this.textNumLabel = value.length+"/500"
if(value.length> 500){
//隐藏键盘
inputMethod.getController().stopInputSession();
ToastUtils.shortToast($r('app.string.res_feedback_commentsFail'))
// Logger.debug(TAG, "onChange > 500 " + value)
this.editValue = {classifyName:value.substring(0,500)} as FeedbackTypeBean
}else{
this.editValue.classifyName = value
}
// Logger.debug(TAG, "onChange " + value)
this.textNumLabel = value.length
this.canSubmit = this.checkSubmit()
})
GridRow({
... ... @@ -185,9 +195,17 @@ export struct FeedBackActivity {
})
}
.margin({bottom: $r('app.float.vp_12'), right: $r('app.float.vp_12'),left: $r('app.float.vp_12')})
Text(this.textNumLabel)
Text(){
ContainerSpan(){
if(this.textNumLabel<500){
Span(this.textNumLabel+'/500').fontColor($r('app.color.color_999999'))
}else{
Span(this.textNumLabel+'').fontColor($r('app.color.color_ED2800'))
Span('/500').fontColor($r('app.color.color_999999'))
}
}
}
.margin({bottom: $r('app.float.vp_12'), right: $r('app.float.vp_11')})
.fontColor($r('app.color.color_999999'))
.fontSize($r('app.float.font_size_13_5'))
}
.height(200)
... ... @@ -279,7 +297,7 @@ export struct FeedBackActivity {
* */
checkSubmit(): boolean {
if(StringUtils.isEmpty(this.contact) || this.contact.length < 10){
if(StringUtils.isEmpty(this.editValue.classifyName) || this.editValue.classifyName.length < 10){
return false
}
... ... @@ -395,7 +413,7 @@ export struct FeedBackActivity {
return
}
//内容必填
if(StringUtils.isEmpty(this.contact) || this.contact.length < 10 || this.contact.length>500){
if(StringUtils.isEmpty(this.editValue.classifyName) || this.editValue.classifyName.length < 10 || this.editValue.classifyName.length>500){
ToastUtils.shortToast($r('app.string.res_feedback_commentsFail'))
return
}
... ... @@ -403,7 +421,7 @@ export struct FeedBackActivity {
try {
let feedBackParams: FeedBackParams = {
//反馈内容
"content": this.contact,
"content": this.editValue.classifyName,
//投诉类型 id
"classifyFlagIds": selectType,
//设备
... ...
... ... @@ -224,7 +224,7 @@ export struct MorningEveningPaperComponent {
if (imageSource) {
const pixelMap: image.PixelMap = await imageNet2PixelMap(imageSource);
effectKit.createColorPicker(pixelMap, (err, colorPicker) => {
let color = colorPicker.getMainColorSync();
let color = colorPicker.getLargestProportionColor();
Logger.debug(TAG, "compInfoBean compStyle = " + color)
// color = ColorUtils.getMorningEveningPaperRgb({red:color.red,green:color.green,blue:color.blue,alpha:color.alpha})
// 将取色器选取的color示例转换为十六进制颜色代码
... ... @@ -273,6 +273,7 @@ export struct MorningEveningPaperComponent {
}
}
// .height(`calc(100% - ${this.bottomSafeHeight + this.topSafeHeight + 'vp'})`)
.edgeEffect(EdgeEffect.None) // 必须设置列表为滑动到边缘无效果
.scrollBar(BarState.Off)
.onWillScroll(scrollOffset =>{
this.scrollOffset = this.scrollOffset + scrollOffset as number
... ...
... ... @@ -152,11 +152,9 @@ export struct SingleColumn999Component {
scrollBackward: NestedScrollMode.SELF_FIRST
})
} else {
if (this.compListItem && this.compListItem?.operDataList) {
EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NoListContent})
}
}
}
// public buildLanes(): number {
// return new BreakPointType({ xs: 1, sm: 1, md: 2, lg: 3 }).getValue(this.currentBreakpoint)
... ... @@ -176,6 +174,5 @@ export struct SingleColumn999Component {
index: index,
})
}
}
}
\ No newline at end of file
... ...
... ... @@ -107,8 +107,6 @@ export struct CardMediaInfo {
.margin({
right: '2vp'
})
// Image($r('app.media.card_live'))
// .mediaLogo()
Text('直播中')
.mediaText()
} else if (this.contentDTO?.liveType === 'end' && this.contentDTO?.linkUrl) {
... ... @@ -116,10 +114,17 @@ export struct CardMediaInfo {
.mediaLogo()
Text('回看')
.mediaText()
}else if(this.contentDTO?.liveInfo?.liveState === 'end' && !this.contentDTO?.linkUrl){
}else if(this.contentDTO?.liveType === 'end' && !this.contentDTO?.linkUrl){
Text('已结束')
.mediaText()
}else if(!this.contentDTO?.liveType && this.contentDTO?.linkUrl){
// 加个防护,生产有出现这样的特例
Image($r('app.media.card_play'))
.mediaLogo()
Text('回看')
.mediaText()
}
}else {
// 当liveInfo存在时后
... ... @@ -129,6 +134,7 @@ export struct CardMediaInfo {
Text('预约')
.mediaText()
} else if (this.contentDTO?.liveInfo?.liveState === 'running') {
Row(){
LottieView({
name: 'live_status_wait',
path: "lottie/live_detail_living.json",
... ... @@ -136,14 +142,14 @@ export struct CardMediaInfo {
lottieHeight: 14,
autoplay: true,
loop: true,
})
.margin({
}).margin({
right: '2vp'
})
// Image($r('app.media.card_live'))
// .mediaLogo()
Text('直播中')
.mediaText()
}
} else if (this.contentDTO?.liveInfo?.liveState === 'end' && this.contentDTO?.liveInfo?.replayUri) {
Image($r('app.media.card_play'))
.mediaLogo()
... ... @@ -154,7 +160,6 @@ export struct CardMediaInfo {
Text('已结束')
.mediaText()
}
}
// 备注直播间观看人数在轮播图卡不显示
if(this.beused !== 'Zh_Carousel_Layout_01'){
... ... @@ -165,15 +170,6 @@ export struct CardMediaInfo {
.mediaText()
}
}
// } else if (this.contentDTO?.liveInfo?.liveState === 'end' && this.contentDTO?.liveInfo
// ?.replayUri) {
// // Image($r('app.media.card_live'))
// // .mediaLogo()
// Text('直播结束')
// .mediaText()
// }
}
} else if (this.contentDTO.objectType === '9') {
// 显示组图;图片数量
... ...
... ... @@ -19,14 +19,67 @@ export struct ZhSingleRow02 {
@State pageId: string = '';
@State pageName: string = '';
@State compDTO: CompDTO = {} as CompDTO
@State initMoreWidth: number = 16;
@State moreWidth:number = 16
@State moreTips: string = ''
scroller: Scroller = new Scroller()
resetMoreTips() {
console.log('resetMoreTips', this.moreWidth, this.initMoreWidth)
if (this.moreWidth < this.initMoreWidth * 2) {
this.moreTips = '查看更多';
}
}
edgeAnimation() {
if (this.moreWidth < this.initMoreWidth * 3) {
if (!this.moreTips) {
this.moreTips = '查看更多';
}
this.moreWidth = this.moreWidth + 2
}
if (this.moreWidth > this.initMoreWidth * 2) {
this.moreTips = '松手查看';
} else {
}
}
reverseEdgeAnimation() {
if (this.moreWidth > this.initMoreWidth) {
this.moreWidth = this.moreWidth - 2
}
this.resetMoreTips()
}
resetEdgeAnimation() {
if (this.moreWidth > this.initMoreWidth) {
this.moreWidth = this.moreWidth - 1
this.resetEdgeAnimation();
}
this.resetMoreTips()
}
toMore() {
if (this.moreWidth > this.initMoreWidth * 2) {
if (this.compDTO?.objectType === '11') {
ProcessUtils.jumpChannelTab(this.compDTO.objectId, this.compDTO.pageId as string, this.compDTO.objectTitle)
} else if (this.compDTO?.objectType === '5') {
ProcessUtils._gotoSpecialTopic(this.compDTO.linkUrl)
} else if (this.compDTO?.objectType === '6') {
ProcessUtils._gotoDefaultWeb(this.compDTO.linkUrl)
}
}
}
build() {
Column() {
//顶部
this.CompHeader(this.compDTO)
Row(){
// 列表内容
List() {
Scroll(this.scroller) {
Row() {
Row() {
ForEach(this.compDTO.operDataList, (item: ContentDTO, index: number) => {
CreatorItem({
item,
... ... @@ -35,15 +88,52 @@ export struct ZhSingleRow02 {
pageId: this.pageId,
pageName: this.pageName
})
.margin({right: index === this.compDTO.operDataList.length - 1 ? $r('app.float.card_comp_pagePadding_lf') : 0})
.margin({ right: 8 })
})
}
.listDirection(Axis.Horizontal)
.scrollBar(BarState.Off)
.edgeEffect(EdgeEffect.None)
if (this.compDTO.operDataList.length >= 2) {
Column() {
if (this.moreWidth > this.initMoreWidth + 2) {
Text(this.moreTips)
.fontSize(8)
.fontColor(0x858585)
.width(8)
}
}
.justifyContent(FlexAlign.Center)
.align(Alignment.Center)
.height('100%')
.width(this.moreWidth)
.backgroundColor(0xe9e9e9)
.borderRadius({ topLeft: 5, bottomLeft: 5 })
}
}
}
.width(CommonConstants.FULL_WIDTH)
.height(208)
.align(Alignment.Start)
.scrollable(this.compDTO.operDataList.length >= 2 ? ScrollDirection.Horizontal : ScrollDirection.None)
.scrollBar(BarState.Off)
.edgeEffect(EdgeEffect.None)
.onReachEnd(() => {
this.edgeAnimation()
})
.onScrollStop(() => {
// this.resetEdgeAnimation();
})
.onScroll((xOffset: number, yOffset: number) => {
if (xOffset < 0) {
this.reverseEdgeAnimation();
}
})
.onTouch((event?: TouchEvent) => {
if(event) {
if (event.type === TouchType.Up) {
this.toMore();
this.resetEdgeAnimation();
}
}
})
}
.padding({
left: $r('app.float.card_comp_pagePadding_lf'),
... ... @@ -126,6 +216,7 @@ struct CreatorItem {
.width(156)
.height(208)
.backgroundColor(0xf5f5f5)
.borderRadius(5)
Row()
.width(156)
... ... @@ -134,6 +225,7 @@ struct CreatorItem {
direction: GradientDirection.Bottom,
colors: [['rgba(0, 0, 0, 0.0)', 0.0], ['rgba(0, 0, 0, 0.3)', 1.0]]
})
.borderRadius(5)
Text(this.item.newsTitle)
.fontColor(0xffffff)
.fontSize(14)
... ... @@ -145,7 +237,6 @@ struct CreatorItem {
}
.width(156)
.height(208)
.margin({ right: 11 })
.borderColor($r('app.color.color_EDEDED'))
.borderRadius($r('app.float.image_border_radius'))
}
... ...
... ... @@ -40,17 +40,61 @@ export struct ZhSingleRow03 {
@State pageId: string = '';
@State pageName: string = '';
@State compDTO: CompDTO = {} as CompDTO
@State isEndEdge: boolean = false;
// @State reserveStatus: reserveItem[] = []
@State reservedIds: string[] = [];
@State loadImg: boolean = false;
@State initMoreWidth: number = 16;
@State moreWidth:number = 16
@State moreTips: string = ''
scroller: Scroller = new Scroller()
resetMoreTips() {
console.log('resetMoreTips', this.moreWidth, this.initMoreWidth)
if (this.moreWidth < this.initMoreWidth * 2) {
this.moreTips = '查看更多';
}
}
edgeAnimation() {
if (this.moreWidth < this.initMoreWidth * 3) {
if (!this.moreTips) {
this.moreTips = '查看更多';
}
this.moreWidth = this.moreWidth + 2
}
if (this.moreWidth > this.initMoreWidth * 2) {
this.moreTips = '松手查看';
} else {
}
}
reverseEdgeAnimation() {
if (this.moreWidth > this.initMoreWidth) {
this.moreWidth = this.moreWidth - 2
}
this.resetMoreTips()
}
resetEdgeAnimation() {
if (this.moreWidth > this.initMoreWidth) {
this.moreWidth = this.moreWidth - 1
this.resetEdgeAnimation();
}
this.resetMoreTips()
}
toMore() {
if (this.moreWidth > this.initMoreWidth * 2) {
this.jumpToMore()
}
}
async aboutToAppear(): Promise<void> {
this.getReserveState();
this.loadImg = await onlyWifiLoadImg();
}
scroller: Scroller = new Scroller()
// 请求所有预约状态
async getReserveState() {
... ... @@ -117,25 +161,51 @@ export struct ZhSingleRow03 {
Scroll(this.scroller){
Row() {
Row() {
ForEach(this.compDTO.operDataList, (item: ContentDTO) => {
this.ItemCard(item)
})
}
if (this.compDTO.operDataList.length >= 2) {
Column() {
if (this.moreWidth > this.initMoreWidth + 2) {
Text(this.moreTips)
.fontSize(8)
.fontColor(0x858585)
.width(8)
}
.scrollable(ScrollDirection.Horizontal)
.scrollBar(BarState.Off)
.onScrollEdge((side: Edge) => {
if (side === Edge.End) {
this.isEndEdge = true;
}
.justifyContent(FlexAlign.Center)
.align(Alignment.Center)
.width(this.moreWidth)
.backgroundColor(0xf9f9f9)
.borderRadius({ topLeft: 5, bottomLeft: 5 })
.height(116)
}
}
}
.align(Alignment.Start)
.scrollable(this.compDTO.operDataList.length >= 2 ? ScrollDirection.Horizontal : ScrollDirection.None)
.scrollBar(BarState.Off)
.edgeEffect(EdgeEffect.None)
.onReachEnd(() => {
this.edgeAnimation()
})
.onScrollStop(() => {
if (this.isEndEdge) {
this.jumpToMore();
}
// this.resetEdgeAnimation();
})
.onScroll((xOffset: number, yOffset: number) => {
this.isEndEdge = false;
if (xOffset < 0) {
this.reverseEdgeAnimation();
}
})
.onTouch((event?: TouchEvent) => {
if(event) {
if (event.type === TouchType.Up) {
this.toMore();
this.resetEdgeAnimation();
}
}
})
}
.padding({
... ...
... ... @@ -6,24 +6,25 @@ import { TrackingButton, TrackConstants } from 'wdTracking/Index';
@Component
export default struct MinePageMoreFunctionUI {
@Link moreData: MinePageMoreFunctionModel[]
@Link percent:number
build() {
Column() {
Column() {
Text("更多功能")
.fontColor($r('app.color.color_222222'))
.fontSize('29lpx')
.margin({ left: "31lpx" })
.lineHeight('46lpx')
.fontSize(`${this.calcHeight(29)}lpx`)
.margin({ left: `${this.calcHeight(31)}lpx` })
.lineHeight(`${this.calcHeight(46)}lpx`)
.fontWeight(FontWeight.Bold)
}.height('92lpx')
}.height(`${this.calcHeight(92)}lpx`)
.width('100%')
.justifyContent(FlexAlign.Center)
.alignItems(HorizontalAlign.Start)
Text().backgroundColor($r('app.color.color_F5F5F5'))
.width('100%')
.height('1lpx')
.height(`${this.calcHeight(1)}lpx`)
List() {
ForEach(this.moreData, (item: MinePageMoreFunctionModel, index: number) => {
... ... @@ -31,39 +32,42 @@ export default struct MinePageMoreFunctionUI {
Column() {
Column() {
Row() {
Row(){
if (item.imgSrc) {
Image(item.imgSrc)
.width('38lpx')
.height('38lpx')
.margin({ right: '15lpx' })
.width(`${this.calcHeight(38)}lpx`)
.height(`${this.calcHeight(38)}lpx`)
.margin({ right: `${this.calcHeight(15)}lpx` })
.objectFit(ImageFit.Auto)
.interpolation(ImageInterpolation.High)
}
Text(`${item.msg}`)
.width('456lpx')
.height('38lpx')
.height(`${this.calcHeight(38)}lpx`)
.fontColor($r('app.color.color_666666'))
.fontSize('29lpx')
.fontSize(`${this.calcHeight(29)}lpx`)
.fontWeight(400)
}.alignItems(VerticalAlign.Center)
.justifyContent(FlexAlign.Start)
Blank()
Image($r('app.media.mine_user_arrow_2'))
.width('27lpx')
.height('27lpx')
.width(`${this.calcHeight(27)}lpx`)
.height(`${this.calcHeight(27)}lpx`)
.objectFit(ImageFit.Auto)
.interpolation(ImageInterpolation.High)
.margin({ left: '81lpx', right: '29lpx' })
.margin({ left: `${this.calcHeight(81)}lpx`, right: `${this.calcHeight(29)}lpx` })
}.alignItems(VerticalAlign.Center)
.justifyContent(FlexAlign.SpaceBetween)
.width("100%")
}.height(`${this.calcHeight(108)}lpx`)
.justifyContent(FlexAlign.Center)
}.height('108lpx')
.justifyContent(FlexAlign.Center)
.alignItems(HorizontalAlign.Start)
.padding({ left: '27lpx' })
.padding({ left: `${this.calcHeight(27)}lpx` })
.width("100%")
if (index != this.moreData.length - 1) {
Text().backgroundColor($r('app.color.color_F5F5F5'))
.width('612lpx')
.height('1lpx')
.width(`612lpx`)
.height(`${this.calcHeight(1)}lpx`)
}
}
}
... ... @@ -83,15 +87,21 @@ export default struct MinePageMoreFunctionUI {
ProcessUtils.gotoFeedBackActivity()
}
})
.height('117lpx')
.height(`${this.calcHeight(117)}lpx`)
.width("100%")
})
}.onScrollFrameBegin((offset, state) => {
return { offsetRemain: 0 }
})
.width("100%")
}
.backgroundColor($r('app.color.white'))
.borderRadius(8)
.margin({ left: '23lpx', right: '23lpx', top: "19lpx" })
.margin({ left: `${this.calcHeight(23)}lpx`, right: `${this.calcHeight(23)}lpx`, top: `${this.calcHeight(19)}lpx` })
}
calcHeight(value:number): number{
return value * this.percent
}
}
... ...
... ... @@ -11,12 +11,13 @@ const TAG = "MinePagePersonFunctionUI"
export default struct MinePagePersonFunctionUI {
@Link personalData:MinePagePersonalFunctionsItem[]
@Prop isLogin:boolean
@Link percent:number
build() {
Grid(){
ForEach(this.personalData,(item:MinePagePersonalFunctionsItem,index:number)=>{
GridItem(){
PagePersonFunction({ item: item, noDivider : (index % 5 < 4 && index != this.personalData.length-1) ? false : true})
PagePersonFunction({ item: item, noDivider : (index % 5 < 4 && index != this.personalData.length-1) ? false : true,percent:$percent})
}.onClick(()=>{
console.log(index+"")
switch (item.msg){
... ... @@ -77,14 +78,14 @@ export default struct MinePagePersonFunctionUI {
break;
}
}
}).width('142lpx')
.height('117lpx')
})/*.width(`${this.calcHeight(142)}lpx`)*/
.height(`${this.calcHeight(117)}lpx`)
})
}
.rowsTemplate('1fr')
.columnsTemplate('1fr 1fr 1fr 1fr 1fr')
.height('117lpx')
.margin({top:'31lpx'})
.height(`${this.calcHeight(117)}lpx`)
.margin({top:`${this.calcHeight(31)}lpx`})
}
messageClick(){
... ... @@ -94,6 +95,10 @@ export default struct MinePagePersonFunctionUI {
console.log(TAG, JSON.stringify(err))
})
}
calcHeight(value:number): number{
return value * this.percent
}
}
function trackButtonClick(buttonName: string){
... ...
... ... @@ -13,6 +13,7 @@ export default struct MinePageUserSimpleInfoUI {
userType:string = "1"
@State levelHead:string = ""
@State levelId:number = 0
@Link percent:number
loginStateChange(){
if(this.isLogin){
... ... @@ -29,20 +30,20 @@ export default struct MinePageUserSimpleInfoUI {
Stack(){
Image(this.headPhotoUrl==""?$r('app.media.default_head'):this.headPhotoUrl)
.alt($r('app.media.default_head'))
.width('100lpx')
.height('100lpx')
.width(`${this.calcHeight(100)}lpx`)
.height(`${this.calcHeight(100)}lpx`)
.objectFit(ImageFit.Cover)
.borderRadius(50)
if(StringUtils.isNotEmpty(this.levelHead)){
Image(this.levelHead)
.width('130lpx')
.height('130lpx')
.width(`${this.calcHeight(130)}lpx`)
.height(`${this.calcHeight(130)}lpx`)
.objectFit(ImageFit.Cover)
.borderRadius(50)
}
}.width('130lpx')
.height('130lpx')
}.width(`${this.calcHeight(130)}lpx`)
.height(`${this.calcHeight(130)}lpx`)
.alignContent(Alignment.Center)
.onClick(()=>{
this.jumpLogin()
... ... @@ -58,13 +59,13 @@ export default struct MinePageUserSimpleInfoUI {
.maxLines(1)
.fontWeight(FontWeight.Bold)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.fontSize('33lpx')
.lineHeight("46lpx")
.fontSize(`${this.calcHeight(33)}lpx`)
.lineHeight(`${this.calcHeight(46)}lpx`)
Image($r('app.media.mine_user_edit'))
.width('27lpx')
.height('27lpx')
.margin({left:'15lpx'})
.width(`${this.calcHeight(27)}lpx`)
.height(`${this.calcHeight(27)}lpx`)
.margin({left:`${this.calcHeight(15)}lpx`})
.objectFit(ImageFit.Cover)
Blank()
}.width('100%')
... ... @@ -75,39 +76,39 @@ export default struct MinePageUserSimpleInfoUI {
Stack(){
Image($r('app.media.mine_grade_bg'))
.width('84lpx')
.height('29lpx')
.width(`${this.calcHeight(84)}lpx`)
.height(`${this.calcHeight(29)}lpx`)
.objectFit(ImageFit.Auto)
Text(`等级${this.levelId}`)
.textAlign(TextAlign.Center)
.fontColor($r('app.color.white'))
.fontSize('19lpx')
.width('50lpx')
.height('29lpx')
}.margin({top:'15lpx'})
.fontSize(`${this.calcHeight(19)}lpx`)
.width(`${this.calcHeight(50)}lpx`)
.height(`${this.calcHeight(29)}lpx`)
}.margin({top:'`${this.calcHeight(15)}lpx`'})
}.alignItems(HorizontalAlign.Start)
.margin({top:'12lpx',left:'23lpx'})
.width('352lpx')
.margin({top:`${this.calcHeight(12)}lpx`,left:`${this.calcHeight(23)}lpx`})
.width(`${this.calcHeight(352)}lpx`)
}else{
Row(){
Text("登录注册")
.fontColor($r('app.color.color_222222'))
.fontSize('38lpx')
.lineHeight("46lpx")
.fontSize(`${this.calcHeight(38)}lpx`)
.lineHeight(`${this.calcHeight(46)}lpx`)
.fontWeight(600)
Image($r('app.media.mine_user_edit'))
.width('11lpx')
.height('20lpx')
.margin({left:'15lpx'})
.width(`${this.calcHeight(11)}lpx`)
.height(`${this.calcHeight(20)}lpx`)
.margin({left:`${this.calcHeight(15)}lpx`})
.objectFit(ImageFit.Cover)
Blank()
}.onClick(()=>{
this.jumpLogin()
trackButtonClick("myPageUserLogin")
})
.margin({top:'11lpx',left:'23lpx'})
.width('352lpx')
.margin({top:`${this.calcHeight(11)}lpx`,left:`${this.calcHeight(23)}lpx`})
.width(`${this.calcHeight(352)}lpx`)
}
Blank()
... ... @@ -116,15 +117,15 @@ export default struct MinePageUserSimpleInfoUI {
Text("签到")
.textAlign(TextAlign.Start)
.width('108lpx')
.height('46lpx')
.height(`${this.calcHeight(46)}lpx`)
.fontColor($r('app.color.color_AD6000'))
.backgroundColor($r('app.color.color_FFC460'))
.fontWeight(500)
.position({x:'23lpx'})
.padding({left:'35lpx'})
Image($r("app.media.mine_sign_icon"))
.width('50lpx')
.height('50lpx')
.width(`${this.calcHeight(50)}lpx`)
.height(`${this.calcHeight(50)}lpx`)
}.width('131lpx')
.visibility(Visibility.Hidden)
}.backgroundColor($r('app.color.white'))
... ... @@ -201,6 +202,10 @@ export default struct MinePageUserSimpleInfoUI {
WDRouterRule.jumpWithPage(WDRouterPage.mineHomePage)
}
}
calcHeight(value:number): number{
return value * this.percent
}
}
function trackButtonClick(buttonName: string){
... ...
... ... @@ -4,6 +4,7 @@ import MinePagePersonalFunctionsItem from '../../viewmodel/MinePagePersonalFunct
export struct PagePersonFunction{
@ObjectLink item: MinePagePersonalFunctionsItem
@State noDivider:boolean = false
@Link percent:number
build() {
Row(){
... ... @@ -15,18 +16,18 @@ export struct PagePersonFunction{
if (this.item.isShowRedPoint) {
Button()
.type(ButtonType.Circle)
.width("12lpx")
.height("12lpx")
.width(`${this.calcHeight(12)}lpx`)
.height(`${this.calcHeight(12)}lpx`)
.backgroundColor($r('app.color.color_ED2800'))
}
}.width('46lpx')
.height('46lpx')
}.width(`${this.calcHeight(46)}lpx`)
.height(`${this.calcHeight(46)}lpx`)
Text(`${this.item.msg}`)
.margin({top:'8lpx'})
.height('23lpx')
.margin({top:`${this.calcHeight(8)}lpx`})
.height(`${this.calcHeight(23)}lpx`)
.fontColor($r('app.color.color_222222'))
.fontSize('23lpx')
.fontSize(`${this.calcHeight(23)}lpx`)
}
.alignItems(HorizontalAlign.Center)
.width('100%')
... ... @@ -35,10 +36,13 @@ export struct PagePersonFunction{
if(!this.noDivider){
Text().backgroundColor($r('app.color.color_222222'))
.opacity(0.1)
.width('2lpx')
.height('29lpx')
.width(`${this.calcHeight(2)}lpx`)
.height(`${this.calcHeight(29)}lpx`)
}
}
}
calcHeight(value:number): number{
return value * this.percent
}
}
\ No newline at end of file
... ...
... ... @@ -11,6 +11,14 @@ import { FollowOperationRequestItem } from '../../../viewmodel/FollowOperationRe
export struct FollowChildComponent{
@ObjectLink data: FollowListDetailItem
@State type:number = 0
@State columnHeight:number = 202
aboutToAppear(): void {
if(this.type == 0 && StringUtils.isEmpty(this.data.introduction)){
this.columnHeight = 202 - 31
}
}
build() {
if(this.type == 0 ){
... ... @@ -82,6 +90,7 @@ export struct FollowChildComponent{
.justifyContent(FlexAlign.Center)
.width('100lpx')
.backgroundColor($r("app.color.color_F5F5F5"))
.borderRadius("6lpx")
.height('46lpx')
.onClick(()=>{
this.followOperation()
... ... @@ -114,7 +123,7 @@ export struct FollowChildComponent{
.justifyContent(FlexAlign.SpaceBetween)
.alignItems(VerticalAlign.Top)
}.height('202lpx')
}.height(`${this.columnHeight}lpx`)
.justifyContent(FlexAlign.Start)
Divider()
... ... @@ -198,6 +207,7 @@ export struct FollowChildComponent{
}
.backgroundColor($r("app.color.color_F5F5F5"))
.justifyContent(FlexAlign.Center)
.borderRadius("6lpx")
.width('100lpx')
.height('46lpx')
.onClick(()=>{
... ...
... ... @@ -10,7 +10,10 @@ const TAG = "FollowFirstTabsComponent"
export struct FollowFirstTabsComponent{
@State currentIndex: number = 0
@Prop changeIndex: number
private controller: TabsController = new TabsController()
private swiperController: SwiperController = new SwiperController()
private listScroller: Scroller = new Scroller()
@State data:FollowListItem[] = []
fontColor: string = '#999999'
selectedFontColor: string = '#000000'
... ... @@ -20,7 +23,7 @@ export struct FollowFirstTabsComponent{
this.getFollowTabList()
EmitterUtils.receiveEvent(EmitterEventId.MY_FOLLOW_EMPTY, (() => {
if(this.controller != null && this.data.length>1 ){
if(this.swiperController != null && this.data.length>1 ){
this.jumpFollowNextPage()
}
}))
... ... @@ -33,7 +36,7 @@ export struct FollowFirstTabsComponent{
this.data.push(element)
})
if(this.controller != null && this.data.length>1 && this.changeIndex === 1){
if(this.swiperController != null && this.data.length>1 && this.changeIndex === 1){
this.jumpFollowNextPage()
}
}).catch((err:Error)=>{
... ... @@ -45,7 +48,7 @@ export struct FollowFirstTabsComponent{
//个人主页 跳转 关注页 tab 2
let intervalID = setInterval(() => {
this.currentIndex = 1
this.controller.changeIndex(this.currentIndex)
this.swiperController.changeIndex(this.currentIndex)
clearInterval(intervalID);
}, 500);
}
... ... @@ -70,7 +73,8 @@ export struct FollowFirstTabsComponent{
}
}.onClick(()=>{
this.currentIndex = index
this.controller.changeIndex(this.currentIndex)
this.swiperController.changeIndex(this.currentIndex)
this.listScroller.scrollToIndex(index, true, ScrollAlign.CENTER)
trackTabFirstClick(item.directoryName)
})
.height('100%')
... ... @@ -90,28 +94,38 @@ export struct FollowFirstTabsComponent{
.layoutWeight(1)
.width('100%')
}else{
Tabs({ barPosition: BarPosition.Start, controller: this.controller }) {
Column(){
List({ scroller: this.listScroller }){
ForEach(this.data, (item: FollowListItem, index: number ) => {
ListItem(){
this.TabBuilder(index,item)
}
}, (item: FollowListItem, index: number) => index.toString())
}.listDirection(Axis.Horizontal)
.backgroundColor($r('app.color.white'))
.width("100%")
.height("84lpx")
.edgeEffect(EdgeEffect.None)
.scrollBar(BarState.Off)
Swiper(this.swiperController){
ForEach(this.data, (item: FollowListItem, index: number ) => {
TabContent(){
FollowSecondTabsComponent({data:$data,firstIndex:index})
}.tabBar(this.TabBuilder(index,item))
.backgroundColor($r('app.color.white'))
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
}, (item: FollowListItem, index: number) => index.toString())
}
.vertical(false)
.barMode(BarMode.Scrollable)
.barWidth('100%')
.barBackgroundColor($r('app.color.white'))
.barHeight('84lpx')
.animationDuration(0)
.onChange((index: number) => {
this.currentIndex = index
trackTabFirstClick(this.data[index].directoryName)
this.listScroller.scrollToIndex(index, true, ScrollAlign.CENTER)
})
.width('100%')
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
.layoutWeight(1)
.loop(false)
.indicator(false)
.effectMode(EdgeEffect.None)
}.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
}
}.width('100%')
.height("100%")
... ...
... ... @@ -98,6 +98,7 @@ export struct FollowListDetailUI {
ListItem() {
ListHasNoMoreDataUI()
}
.margin({bottom:"40lpx"})
}
}
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
... ... @@ -143,13 +144,11 @@ export struct FollowListDetailUI {
value.list.forEach((value) => {
let fansNum: number = value.fansNum
let fansNumString = ""
if (fansNum > 10000) {
let temp = (fansNum / 10000) + ""
let index = temp.indexOf('.')
if (index != -1) {
temp = temp.substring(0, index + 2)
} else {
temp = temp
if (fansNum >= 10000) {
let temp = (fansNum / 10000) .toFixed(1)
if (Number(temp.substring(temp.length-1)) == 0) {
temp = temp.substring(0, temp.length-2)
}
fansNumString = temp + "万"
} else {
... ...
... ... @@ -7,7 +7,7 @@ export struct FollowSecondTabsComponent{
@Link data:FollowListItem[]
@State firstIndex:number = 0
@State currentIndex: number = 0
private controller: TabsController = new TabsController()
private swiperController: SwiperController = new SwiperController()
fontColor: string = '#000000'
selectedFontColor: string = '#ED2800'
... ... @@ -77,20 +77,16 @@ export struct FollowSecondTabsComponent{
.alignItems(VerticalAlign.Top)
.height('100%')
Tabs({ barPosition: BarPosition.Start, controller: this.controller }) {
Swiper(this.swiperController ) {
ForEach(this.data[this.firstIndex].children, (item: FollowSecondListItem, index: number ) => {
TabContent(){
FollowThirdTabsComponent({data:$data,firstIndex:$firstIndex,secondIndex:index})
}.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
}, (item: FollowListItem, index: number) => index.toString())
}
.loop(false)
.vertical(true)
.barMode(BarMode.Scrollable)
.animationDuration(0)
.onChange((index: number) => {
this.currentIndex = index
})
.barWidth(0)
.indicator(false)
.disableSwipe(true)
.effectMode(EdgeEffect.None)
.height('100%')
.layoutWeight(1)
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
... ... @@ -110,7 +106,7 @@ export struct FollowSecondTabsComponent{
}
.onClick(()=>{
this.currentIndex = index
this.controller.changeIndex(this.currentIndex)
this.swiperController.changeIndex(this.currentIndex)
})
.justifyContent(FlexAlign.Center)
.height('84lpx')
... ...
... ... @@ -10,8 +10,8 @@ export struct FollowThirdTabsComponent{
@Link firstIndex: number
@State secondIndex:number = -1
private controller: TabsController = new TabsController()
private swiperController: SwiperController = new SwiperController()
private listScroller: Scroller = new Scroller()
fontColor: string = '#666666'
selectedFontColor: string = '#222222'
... ... @@ -50,7 +50,8 @@ export struct FollowThirdTabsComponent{
}
.onClick(()=>{
this.currentIndex = index
this.controller.changeIndex(this.currentIndex)
this.swiperController.changeIndex(this.currentIndex)
this.listScroller.scrollToIndex(index, true, ScrollAlign.CENTER)
})
.offset({x:index === 0?"0lpx":"-5lpx"})
.height('80lpx')
... ... @@ -62,31 +63,47 @@ export struct FollowThirdTabsComponent{
@Builder FollowThirdUI(){
Column(){
Column() {
// 页签
Row() {
Scroll() {
Row() {
List({ scroller: this.listScroller }){
ForEach(this.data[this.firstIndex].children[this.secondIndex].children, (item: FollowThirdListItem, index: number ) => {
ListItem(){
this.TabBuilder(index,item)
})
}
.justifyContent(FlexAlign.Start)
})
}
.align(Alignment.Start)
.scrollable(ScrollDirection.Horizontal)
.backgroundColor($r('app.color.white'))
.edgeEffect(EdgeEffect.None)
.scrollBar(BarState.Off)
.listDirection(Axis.Horizontal)
.width('100%')
.height("84lpx")
.padding({left:'31lpx',right:'48lpx'})
}
.alignItems(VerticalAlign.Bottom)
.width('100%')
}
.backgroundColor($r('app.color.white'))
.alignItems(HorizontalAlign.Start)
.width('100%')
Tabs({ barPosition: BarPosition.Start, controller: this.controller }) {
// Column() {
// // 页签
// Row() {
// Scroll() {
// Row() {
// ForEach(this.data[this.firstIndex].children[this.secondIndex].children, (item: FollowThirdListItem, index: number ) => {
// this.TabBuilder(index,item)
// })
// }
// .justifyContent(FlexAlign.Start)
// }
// .align(Alignment.Start)
// .scrollable(ScrollDirection.Horizontal)
// .scrollBar(BarState.Off)
// .width('100%')
// .padding({left:'31lpx',right:'48lpx'})
// }
// .alignItems(VerticalAlign.Bottom)
// .width('100%')
// }
// .backgroundColor($r('app.color.white'))
// .alignItems(HorizontalAlign.Start)
// .width('100%')
Swiper(this.swiperController ) {
ForEach(this.data[this.firstIndex].children[this.secondIndex].children, (item: FollowThirdListItem, index: number ) => {
TabContent(){
Column(){
... ... @@ -96,12 +113,12 @@ export struct FollowThirdTabsComponent{
.backgroundColor($r('app.color.white'))
}, (item: FollowListItem, index: number) => index.toString())
}
.barHeight(0)
.vertical(false)
.barMode(BarMode.Scrollable)
.animationDuration(0)
.loop(false)
.indicator(false)
.disableSwipe(true)
.effectMode(EdgeEffect.None)
.onChange((index: number) => {
this.currentIndex = index
// this.currentIndex = index
})
.width('100%')
.layoutWeight(1)
... ...
... ... @@ -5,7 +5,7 @@ import MinePageDatasModel from '../../model/MinePageDatasModel'
import MinePageUserSimpleInfoUI from '../mine/MinePageUserSimpleInfoUI'
import MinePagePersonFunctionUI from '../mine/MinePagePersonFunctionUI'
import MinePageMoreFunctionUI from '../mine/MinePageMoreFunctionUI'
import { DateTimeUtils, SPHelper, StringUtils } from 'wdKit'
import { BreakpointSystem, DateTimeUtils, SPHelper, StringUtils } from 'wdKit'
import { SpConstants } from 'wdConstant'
import dataPreferences from '@ohos.data.preferences';
import { MergeRecordDialog } from '../../dialog/MergeRecordDialog'
... ... @@ -59,6 +59,20 @@ export struct MinePageComponent {
pageHideTime:number = 0;
pageFirstCreateTime:number = 0;
@Prop isMinePage:boolean = false;
@StorageProp('currentBreakpoint') @Watch("currentChanged")currentBreakpoint: string = 'sm';
private breakpointSystem = new BreakpointSystem();
@State percent:number = 1
currentChanged(){
if(this.currentBreakpoint == "md" || this.currentBreakpoint == "lg"){
//大屏幕 折叠屏 或者ipad
this.percent = 0.7
}else {
this.percent = 1
}
console.log(TAG,"currentBreakpoint==>"+this.percent)
}
//第一次还没创建时候 pageShow 接收不到监听
async pageShowForUpdateData() {
... ... @@ -85,11 +99,14 @@ export struct MinePageComponent {
}
aboutToAppear(){
this.breakpointSystem.register();
this.pageFirstCreateTime = DateTimeUtils.getTimeStamp()
this.getFunctionData()
this.getUserLogin()
this.addLoginStatusObserver()
console.log(TAG,"currentBreakpoint==>"+this.currentBreakpoint)
this.currentChanged()
}
getMessageData(){
... ... @@ -119,6 +136,7 @@ export struct MinePageComponent {
}
aboutToDisappear(): void {
this.breakpointSystem.unregister();
if(this.preferences){
this.preferences.off('change', this.observer);
}
... ... @@ -139,7 +157,7 @@ export struct MinePageComponent {
Stack(){
Image($r('app.media.mine_head_bg'))
.width('100%')
.height('657lpx')
.height(`${657 * this.percent}lpx`)
.objectFit(ImageFit.Auto)
this.MinePageUI()
}
... ... @@ -155,16 +173,16 @@ export struct MinePageComponent {
@Builder MinePageUI(){
Column(){
//头像层
MinePageUserSimpleInfoUI({isLogin:this.isLogin})
MinePageUserSimpleInfoUI({isLogin:this.isLogin,percent:$percent})
//Grid 区域
MinePagePersonFunctionUI({personalData:$personalData,isLogin:this.isLogin})
MinePagePersonFunctionUI({personalData:$personalData,isLogin:this.isLogin,percent:$percent})
//Card
//MinePageCardUI()
//创作者区域
//MinePageCreatorFunctionUI({creatorData:$creatorData})
//更多功能
MinePageMoreFunctionUI({moreData:$moreData})
MinePageMoreFunctionUI({moreData:$moreData,percent:$percent})
}.width('100%')
.height('100%')
.justifyContent(FlexAlign.Start)
... ...
... ... @@ -8,6 +8,62 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent {
@State compDTO: CompDTO = {} as CompDTO
@State pageId: string = '';
@State pageName: string = '';
@State initMoreWidth: number = 16;
@State moreWidth:number = 16
@State moreTips: string = ''
scroller: Scroller = new Scroller()
resetMoreTips() {
console.log('resetMoreTips', this.moreWidth, this.initMoreWidth)
if (this.moreWidth < this.initMoreWidth * 2) {
this.moreTips = '查看更多';
}
}
edgeAnimation() {
if (this.moreWidth < this.initMoreWidth * 3) {
if (!this.moreTips) {
this.moreTips = '查看更多';
}
this.moreWidth = this.moreWidth + 2
}
if (this.moreWidth > this.initMoreWidth * 2) {
this.moreTips = '松手查看';
} else {
}
}
reverseEdgeAnimation() {
if (this.moreWidth > this.initMoreWidth) {
this.moreWidth = this.moreWidth - 2
}
this.resetMoreTips()
}
resetEdgeAnimation() {
if (this.moreWidth > this.initMoreWidth) {
this.moreWidth = this.moreWidth - 1
this.resetEdgeAnimation();
}
this.resetMoreTips()
}
toMore() {
if (this.moreWidth > this.initMoreWidth * 2) {
if (this.compDTO.linkUrl) {
let taskAction: Action = {
type: 'JUMP_H5_BY_WEB_VIEW',
params: {
url: this.compDTO.linkUrl
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
} else {
this.jumpToLiveMorePage()
}
}
}
build() {
Column() {
... ... @@ -48,15 +104,15 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent {
})
}.justifyContent(FlexAlign.SpaceBetween)
.padding({ left: 16, right: 16 })
// .padding({ left: 16, right: 16 })
.margin({ top: 8, bottom: 8 })
.width('100%')
// .backgroundColor($r("app.color.white"))
List({ space: 12 }) {
Scroll(this.scroller) {
Row() {
Row() {
ForEach(this.compDTO.operDataList, (item: ContentDTO, index: number) => {
ListItem() {
Column() {
Image(item.coverUrl)
.aspectRatio(1.5)
... ... @@ -75,30 +131,68 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent {
.width(150)
.lineHeight(19)
}
}
.padding({ left: (index == 0) ? 16 : 0, right: (index == this.compDTO.operDataList.length - 1) ? 16 : 0 })
.padding({ right: 16 })
// .offset({x:16})
.onClick(() => {
InfomationCardClick.track(this.compDTO, item, this.pageId, this.pageName)
ProcessUtils.processPage(item)
})
})
}.listDirection(Axis.Horizontal)
}
if (this.compDTO.operDataList.length > 2) {
Column() {
if (this.moreWidth > this.initMoreWidth + 2) {
Text(this.moreTips)
.fontSize(8)
.fontColor(0x858585)
.width(8)
}
}
.justifyContent(FlexAlign.Center)
.align(Alignment.Center)
.width(this.moreWidth)
.backgroundColor(0xf1f3f4)
.borderRadius({ topLeft: 5, bottomLeft: 5 })
.height(this.compDTO.operDataList.length == 2 ? 180 : 146)
}
}
}
.align(Alignment.Start)
.scrollable(this.compDTO.operDataList.length > 2 ? ScrollDirection.Horizontal : ScrollDirection.None)
.scrollBar(BarState.Off)
.width('100%')
.edgeEffect(EdgeEffect.None)
.onReachEnd(() => {
this.edgeAnimation()
})
.onScrollStop(() => {
// this.resetEdgeAnimation();
})
.onScroll((xOffset: number, yOffset: number) => {
if (xOffset < 0) {
this.reverseEdgeAnimation();
}
})
.onTouch((event?: TouchEvent) => {
if(event) {
if (event.type === TouchType.Up) {
this.toMore();
this.resetEdgeAnimation();
}
}
})
// .width('100%')
// .backgroundColor($r("app.color.color_FE4B05"))
// .padding({left:16,right:16})
// .margin({left:16,right:16})
}
.width("100%")
// .width("100%")
.padding({
top: 14,
left: 0,
right: 0,
bottom: 14
left: $r('app.float.card_comp_pagePadding_lf'),
right: $r('app.float.card_comp_pagePadding_lf'),
top: $r('app.float.card_comp_pagePadding_tb'),
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.backgroundColor($r("app.color.white"))
// .backgroundColor($r("app.color.color_FE4B05"))
... ...
... ... @@ -18,6 +18,62 @@ export struct LiveHorizontalCardComponent {
@State pageName: string = '';
@State compDTO: CompDTO = {} as CompDTO
@State loadImg: boolean = false;
@State initMoreWidth: number = 16;
@State moreWidth:number = 16
@State moreTips: string = ''
scroller: Scroller = new Scroller()
resetMoreTips() {
console.log('resetMoreTips', this.moreWidth, this.initMoreWidth)
if (this.moreWidth < this.initMoreWidth * 2) {
this.moreTips = '查看更多';
}
}
edgeAnimation() {
if (this.moreWidth < this.initMoreWidth * 3) {
if (!this.moreTips) {
this.moreTips = '查看更多';
}
this.moreWidth = this.moreWidth + 2
}
if (this.moreWidth > this.initMoreWidth * 2) {
this.moreTips = '松手查看';
} else {
}
}
reverseEdgeAnimation() {
if (this.moreWidth > this.initMoreWidth) {
this.moreWidth = this.moreWidth - 2
}
this.resetMoreTips()
}
resetEdgeAnimation() {
if (this.moreWidth > this.initMoreWidth) {
this.moreWidth = this.moreWidth - 1
this.resetEdgeAnimation();
}
this.resetMoreTips()
}
toMore() {
if (this.moreWidth > this.initMoreWidth * 2) {
if (this.compDTO.linkUrl) {
let taskAction: Action = {
type: 'JUMP_H5_BY_WEB_VIEW',
params: {
url: this.compDTO.linkUrl
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
} else {
this.jumpToLiveMorePage()
}
}
}
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
... ... @@ -63,15 +119,16 @@ export struct LiveHorizontalCardComponent {
})
}
}.justifyContent(FlexAlign.SpaceBetween)
.padding({ left: 16, right: 16 })
// .padding({ left: 16, right: 16 })
.margin({ top: 8, bottom: 8 })
.width(CommonConstants.FULL_WIDTH)
// 多个
if (this.compDTO.operDataList.length >= 2) {
List({ space: 12 }) {
Scroll(this.scroller) {
Row() {
Row() {
ForEach(this.compDTO.operDataList, (item: ContentDTO, index: number) => {
ListItem() {
Column() {
Stack({ alignContent: Alignment.BottomEnd }) {
Image(this.loadImg ? item.coverUrl : '')
... ... @@ -96,8 +153,7 @@ export struct LiveHorizontalCardComponent {
.margin({ top: 8 })
.width(this.compDTO.operDataList.length == 2 ? 210 : 150)
}
}
.padding({ left: (index == 0) ? 16 : 0, right: (index == this.compDTO.operDataList.length - 1) ? 16 : 0 })
.padding({ right: 16 })
.onClick(() => {
InfomationCardClick.track(this.compDTO, item, this.pageId, this.pageName)
if (item.objectType != '0') {
... ... @@ -107,8 +163,47 @@ export struct LiveHorizontalCardComponent {
})
})
}
.listDirection(Axis.Horizontal)
if (this.compDTO.operDataList.length >= 2) {
Column() {
if (this.moreWidth > this.initMoreWidth + 2) {
Text(this.moreTips)
.fontSize(8)
.fontColor(0x858585)
.width(8)
}
}
.justifyContent(FlexAlign.Center)
.align(Alignment.Center)
.width(this.moreWidth)
.backgroundColor(0xf1f3f4)
.borderRadius({ topLeft: 5, bottomLeft: 5 })
.height(this.compDTO.operDataList.length == 2 ? 180 : 146)
}
}
}
.align(Alignment.Start)
.scrollable(this.compDTO.operDataList.length >= 2 ? ScrollDirection.Horizontal : ScrollDirection.None)
.scrollBar(BarState.Off)
.edgeEffect(EdgeEffect.None)
.onReachEnd(() => {
this.edgeAnimation()
})
.onScrollStop(() => {
// this.resetEdgeAnimation();
})
.onScroll((xOffset: number, yOffset: number) => {
if (xOffset < 0) {
this.reverseEdgeAnimation();
}
})
.onTouch((event?: TouchEvent) => {
if(event) {
if (event.type === TouchType.Up) {
this.toMore();
this.resetEdgeAnimation();
}
}
})
.width(CommonConstants.FULL_WIDTH)
.height(this.compDTO.operDataList.length == 2 ? 180 : 136)
} else if (this.compDTO.operDataList.length) {
... ... @@ -116,9 +211,12 @@ export struct LiveHorizontalCardComponent {
LiveHorizontalCardForOneComponent({ contentDTO: this.compDTO.operDataList[0] })
}
}
.width(CommonConstants.FULL_WIDTH)
// .width(CommonConstants.FULL_WIDTH)
.padding({
top: 14,
left: $r('app.float.card_comp_pagePadding_lf'),
right: $r('app.float.card_comp_pagePadding_lf'),
top: $r('app.float.card_comp_pagePadding_tb'),
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.backgroundColor($r("app.color.white"))
}
... ...
... ... @@ -4,9 +4,7 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { SpConstants } from 'wdConstant/Index';
import measure from '@ohos.measure'
import { ParamType, TrackConstants, TrackingContent } from 'wdTracking/Index';
import {
ContentDetailDTO,
} from 'wdBean';
import { ContentDetailDTO, } from 'wdBean';
import { LiveModel } from '../../viewmodel/LiveModel';
import { HttpUtils } from 'wdNetwork/Index';
import vibrator from '@ohos.vibrator';
... ... @@ -47,6 +45,7 @@ export struct LiveLikeComponent {
this.onDetailUpdated()
this.contentTrackingDict()
}
async onDetailUpdated() {
// 2:竖屏直播页 4:横屏直播页
// 点赞样式 love爱心型 thumb点赞手势 mourning 蜡烛(默哀) pray 祈福
... ... @@ -61,13 +60,13 @@ export struct LiveLikeComponent {
this.getLikeCount()
}
contentTrackingDict(){
contentTrackingDict() {
this.pageParam = {
'contentType': `${this.contentDetailData.newsType}`,
'contentId': `${this.contentDetailData.newsId}`,
'contentName': `${this.contentDetailData.newsTitle || ''}`,
}
if(this.contentDetailData.newsType == 2) {
if (this.contentDetailData.newsType == 2) {
this.PageName = TrackConstants.PageName.Live_Detail // 直播
}
}
... ... @@ -118,7 +117,9 @@ export struct LiveLikeComponent {
.width(36)
.height(36)
.borderRadius(18)
.backgroundColor((this.pageComponentType === 4 || this.pageComponentType === 2) ? '#4D000000' : this.pageComponentType === 8 ? Color.Transparent : '#FFF5F5F5')
.backgroundColor((this.pageComponentType === 4 || this.pageComponentType === 2) ? '#4D000000' :
this.pageComponentType === 8 ? Color.Transparent : '#FFF5F5F5')
if (this.likeCount != 0) {
RelativeContainer() {
Image(this.styleType == 1 ? $r('app.media.comment_icon_number_bg') : $r('app.media.ic_like_back_Select'))
... ... @@ -211,6 +212,16 @@ export struct LiveLikeComponent {
console.error(`An unexpected error occurred. Code: ${e.code}, message: ${e.message}`);
}
this.likeCount++
this.likeStatus = true
//内容点赞、取消点赞Tracking 1点赞 0取消点赞
TrackingContent.like(true, TrackConstants.PageName.DynamicDetail, TrackConstants.PageName.DynamicDetail,
{
'contentType': `${this.contentDetailData.newsType}`,
'contentId': `${this.contentDetailData.newsId}`,
'contentName': `${this.contentDetailData.newsTitle || ''}`,
})
}).catch(() => {
})
... ... @@ -245,6 +256,7 @@ export struct LiveLikeComponent {
this.likeCount = 0
})
}
private getMeasureText(text: string) {
let width = measure.measureText({
textContent: text,
... ...
... ... @@ -15,6 +15,7 @@
"wdBean": "file:../../features/wdBean",
"wdConstant": "file:../../commons/wdConstant",
"wdDetailPlayApi": "file:../../features/wdDetailPlayApi",
"wdRouter": "file:../../commons/wdRouter"
"wdRouter": "file:../../commons/wdRouter",
"wdTracking": "file:../../features/wdTracking"
}
}
... ...
... ... @@ -4,9 +4,10 @@ import router from '@ohos.router';
import { DetailPlayLivePage } from './DetailPlayLivePage';
import { DetailPlayVLivePage } from './DetailPlayVLivePage';
import { Logger, ToastUtils } from 'wdKit/Index';
import { DateTimeUtils, Logger, ToastUtils } from 'wdKit/Index';
import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment/model/PublishCommentModel';
import { PictureLoading } from '../widgets/vertical/PictureLoading';
import { TrackConstants, TrackingButton, TrackingPageBrowse } from 'wdTracking/Index';
const TAG = 'DetailPlayLiveCommon'
... ... @@ -22,6 +23,7 @@ const TAG = 'DetailPlayLiveCommon'
@Component
export struct DetailPlayLiveCommon {
private liveViewModel: LiveViewModel = new LiveViewModel()
pageShowTime: number = 0;
@Provide relId: string = ''
@Provide contentId: string = ''
@Provide relType: string = ''
... ... @@ -36,7 +38,6 @@ export struct DetailPlayLiveCommon {
@Provide publishCommentModel: publishCommentModel = new publishCommentModel()
// 横屏或竖屏 general-竖屏,news-横屏
@State liveLandscape: string = ''
@State isLoading: boolean = false
async aboutToAppear(): Promise<void> {
... ... @@ -49,6 +50,11 @@ export struct DetailPlayLiveCommon {
}
aboutToDisappear(): void {
console.error("XXXXZZZZ", '---aboutToDisappear------------')
}
build() {
Column() {
// 直播预约或横屏直播统一进横屏直播
... ... @@ -58,7 +64,7 @@ export struct DetailPlayLiveCommon {
} else if (this.liveLandscape === 'general') {
// 沉浸式直播
DetailPlayVLivePage()
}else {
} else {
PictureLoading().visibility(this.isLoading ? Visibility.None : Visibility.Visible)
}
}
... ... @@ -78,12 +84,12 @@ export struct DetailPlayLiveCommon {
if (data) {
let detailData = data[0]
//人民号类型单独获取直播地址
if (detailData.rmhPlatform === 1) {
if (detailData.rmhPlatform === 1 && detailData.liveInfo?.liveState === 'running') {
let vliveId = detailData.liveInfo.vlive[0].vliveId as string
console.error(TAG, 'vliveId==' + vliveId)
let pullStreamAddressData = await this.liveViewModel.getLiveRoomPullAddress(vliveId) as GetPullAddressBean
console.error(TAG, 'vliveId==' + vliveId)
if (pullStreamAddressData) {
console.log(TAG, ' GetPullAddressBean:', JSON.stringify(pullStreamAddressData))
let m3u8uUrl = pullStreamAddressData.transCode[0].m3u8Url
... ... @@ -120,13 +126,12 @@ export struct DetailPlayLiveCommon {
this.playUrl = detailData.liveInfo.vlive[0].replayUri
}
} else {
this.isLoading
ToastUtils.shortToast('内容不存在')
router.back()
}
},()=>{
}, () => {
this.isLoading
ToastUtils.shortToast('内容不存在')
router.back()
... ... @@ -134,16 +139,21 @@ export struct DetailPlayLiveCommon {
})
}
onPageShow() {
this.pageShow = Math.random()
Logger.info(TAG, 'onPageShow')
this.pageShowTime = DateTimeUtils.getTimeStamp()
}
onPageHide() {
this.pageHide = Math.random()
Logger.info(TAG, 'onPageHide')
console.error("XXXXZZZZ", '---onPageHide------------')
//页面浏览
TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Live_Detail,
TrackConstants.PageName.Live_Detail
, Math.floor((DateTimeUtils.getTimeStamp() - this.pageShowTime) / 1000))
}
onBackPress(): boolean | void {
... ...
... ... @@ -9,6 +9,7 @@ import { router, window } from '@kit.ArkUI';
import { WDAliPlayerController } from 'wdPlayer/Index';
import { LiveOperRowListView } from 'wdComponent';
import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment/model/PublishCommentModel';
import { TrackConstants, TrackingContent } from 'wdTracking/Index';
let TAG: string = 'DetailPlayLivePage';
... ... @@ -34,7 +35,6 @@ export struct DetailPlayLivePage {
@Consume @Watch('onBackPressCus') pageBackPress: number
@Consume contentDetailData: ContentDetailDTO
@Consume publishCommentModel: publishCommentModel
// 尽量不要动属性。用来作为输入了评论之后,值传递
@State lastInputedLiveComment: LiveRoomItemBean = {} as LiveRoomItemBean // 上次输入的直播间消息
@State lastInputedChatComment: LiveRoomItemBean = {} as LiveRoomItemBean // 上次输入的大家聊消息
... ... @@ -69,10 +69,12 @@ export struct DetailPlayLivePage {
TopPlayComponent({ playerController: this.playerController })
.height(this.displayDirection == DisplayDirection.VERTICAL ? 211 : '100%')
TabComponent({ tabs: this.tabs,
TabComponent({
tabs: this.tabs,
changeToTab: this.changeToTab,
lastInputedLiveComment: this.lastInputedLiveComment,
lastInputedChatComment: this.lastInputedChatComment})
lastInputedChatComment: this.lastInputedChatComment
})
.layoutWeight(1)
.visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None)
... ... @@ -95,6 +97,13 @@ export struct DetailPlayLivePage {
} else {
this.lastInputedChatComment = result
}
// 发布评论埋点
TrackingContent.commentClick(TrackConstants.PageName.DynamicDetail, TrackConstants.PageName.DynamicDetail,
{
'contentType': `${this.contentDetailData.newsType}`,
'contentId': `${this.contentDetailData.newsId}`,
'contentName': `${this.contentDetailData.newsTitle || ''}`,
});
})
}
}
... ...
... ... @@ -7,6 +7,7 @@ import { WDAliPlayerController } from 'wdPlayer/Index';
import { DisplayDirection } from 'wdConstant/Index';
import { LiveEmptyComponent, WDLiveViewDefaultType } from 'wdComponent/Index';
import { PlayerEndView } from '../widgets/vertical/PlayerEndView';
import { TrackConstants, TrackingButton } from 'wdTracking/Index';
const storage = LocalStorage.getShared();
const TAG = 'DetailPlayVLivePage'
... ... @@ -96,6 +97,9 @@ export struct DetailPlayVLivePage {
.markAnchor({ x: 56, y: this.bottomSafeHeight })
.onClick(() => {
this.swiperController.showNext()
// 埋点
TrackingButton.click('clearScreen', TrackConstants.PageName.Live_Detail,
TrackConstants.PageName.Live_Detail)
})
}
... ... @@ -116,7 +120,5 @@ export struct DetailPlayVLivePage {
console.error(TAG, 'getLiveDetails catch', message)
})
}
}
... ...
... ... @@ -39,6 +39,8 @@ export class LiveViewModel {
console.log(TAG, 'getContentDetail:', JSON.stringify(resDTO.data))
if (resDTO.data) {
success(resDTO.data)
}else {
fail("数据为空")
}
}).catch(() => {
fail("数据为空")
... ...
... ... @@ -4,6 +4,7 @@ import { DateTimeUtils, StringUtils, ToastUtils } from 'wdKit/Index'
import { LiveViewModel } from '../../viewModel/LiveViewModel'
import { HttpUtils } from 'wdNetwork/Index'
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'
import { ParamType, TrackConstants, TrackingContent } from 'wdTracking/Index'
@Component
export struct LiveCountdownComponent {
... ... @@ -19,6 +20,7 @@ export struct LiveCountdownComponent {
//是否预约过直播
@State isAppointmentLive: boolean = false
liveViewModel: LiveViewModel = new LiveViewModel()
pageParam: ParamType = {}
aboutToAppear(): void {
//注册字体
... ... @@ -30,6 +32,15 @@ export struct LiveCountdownComponent {
this.textTimerController.start()
}, 0)
this.updateData()
this.contentTrackingDict()
}
contentTrackingDict() {
this.pageParam = {
'contentType': `${this.liveDetailsBean.newsType}`,
'contentId': `${this.liveDetailsBean.newsId}`,
'contentName': `${this.liveDetailsBean.newsTitle || ''}`,
}
}
build() {
... ... @@ -141,7 +152,7 @@ export struct LiveCountdownComponent {
}
//2024-04-01 19:44:00-trim->2024-04-0119:44:00
if (StringUtils.isNotEmpty(this.liveDetailsBean.liveInfo?.planStartTime)) {
let playStartTimeTmp = this.liveDetailsBean.liveInfo?.planStartTime+''
let playStartTimeTmp = this.liveDetailsBean.liveInfo?.planStartTime + ''
this.month = Number(playStartTimeTmp.substring(5, 7)).toString()
this.day = playStartTimeTmp.substring(8, 10)
this.hour = playStartTimeTmp.substring(11, 13)
... ... @@ -152,7 +163,7 @@ export struct LiveCountdownComponent {
getLiveAppointmentStatus() {
this.liveViewModel.getLiveAppointmentStatus(
this.liveDetailsBean.reLInfo ? this.liveDetailsBean.reLInfo.relId : '',
this.liveDetailsBean.newsId+''
this.liveDetailsBean.newsId + ''
).then(
(data) => {
this.isAppointmentLive = data
... ... @@ -165,15 +176,19 @@ export struct LiveCountdownComponent {
liveAppointment() {
this.liveViewModel.liveAppointment(
this.liveDetailsBean.reLInfo ? this.liveDetailsBean.reLInfo.relId : '',
this.liveDetailsBean.newsId+'',
this.liveDetailsBean.newsId + '',
!this.isAppointmentLive).then(
(data) => {
if (data.success) {
this.isAppointmentLive = !this.isAppointmentLive
if (this.isAppointmentLive) {
ToastUtils.showToast('预约成功', 1000)
TrackingContent.subscribeClick(true, TrackConstants.PageName.Live_Detail,
TrackConstants.PageName.Live_Detail, this.pageParam)
} else {
ToastUtils.showToast('取消预约成功', 1000)
TrackingContent.subscribeClick(false, TrackConstants.PageName.Live_Detail,
TrackConstants.PageName.Live_Detail, this.pageParam)
}
}
},
... ...
... ... @@ -34,7 +34,6 @@ export struct TabComponent {
build() {
Column() {
// 页签
Row() {
Scroll() {
... ...
... ... @@ -3,6 +3,7 @@ import { Logger, StringUtils } from 'wdKit/Index';
import { PlayerConstants, WDAliPlayerController, WDPlayerRenderLiveView } from 'wdPlayer/Index';
import { PlayUIComponent } from './PlayUIComponent';
import { PictureLoading } from '../../vertical/PictureLoading';
import { ParamType, TrackConstants } from 'wdTracking/Index';
const TAG: string = 'TopPlayComponent'
... ... @@ -31,15 +32,15 @@ export struct TopPlayComponent {
@Provide playSourceState: number = 0
private playUrl: string = ""
private xComponentIsLoaded: boolean = false
pageParam: ParamType = {}
aboutToAppear(): void {
if (this.playerController) {
this.playerController.onCanplay = () => {
Logger.debug(TAG, 'onCanplay==>')
this.isCanPlay = true
this.isLoading = true
this.playerController?.play()
}
this.playerController.onStatusChange = (status: number) => {
... ... @@ -147,7 +148,16 @@ export struct TopPlayComponent {
Logger.debug(TAG, "播放地址为空")
return
}
this.playerController?.firstPlay(this.playUrl);
this.contentTrackingDict()
this.playerController?.firstPlay(this.playUrl, TrackConstants.PageName.Live_Detail, this.pageParam);
}
contentTrackingDict() {
this.pageParam = {
'contentType': `${this.contentDetailData.newsType}`,
'contentId': `${this.contentDetailData.newsId}`,
'contentName': `${this.contentDetailData.newsTitle || ''}`,
}
}
build() {
... ...
... ... @@ -11,6 +11,7 @@ import { ChartItemCompereComponent } from './ChartItemCompereComponent'
import { ChatItemComponent } from './ChartItemComponent'
import { router } from '@kit.ArkUI'
import { EmitterEventId, EmitterUtils, Logger, SPHelper, WindowModel } from 'wdKit/Index'
import { TrackConstants, TrackingContent } from 'wdTracking/Index'
const TAG = "PlayerCommentComponent"
/**
... ... @@ -105,6 +106,7 @@ export struct PlayerCommentComponent {
contentDetailData: this.contentDetailData,
onCommentInputFocus: () => {
},
onCommentInputed: (content) => {
if (content.comment) {
... ... @@ -116,6 +118,14 @@ export struct PlayerCommentComponent {
this.liveChatList.push(result)
this.scroller.scrollEdge(Edge.Bottom)
})
// 发布评论埋点
TrackingContent.commentClick(TrackConstants.PageName.DynamicDetail, TrackConstants.PageName.DynamicDetail,
{
'contentType': `${this.contentDetailData.newsType}`,
'contentId': `${this.contentDetailData.newsId}`,
'contentName': `${this.contentDetailData.newsTitle || ''}`,
});
}
},
onBack: () => {
... ...
import { ContentDetailDTO } from 'wdBean/Index';
import { AliPlayerRenderView, WDAliPlayerController, WDPlayerRenderVLiveView } from 'wdPlayer/Index';
import { ParamType, TrackConstants } from 'wdTracking/Index';
import { PictureLoading } from './PictureLoading';
const TAG = 'PlayerComponent'
@Component
export struct PlayerComponent {
private playerController?: WDAliPlayerController
@Consume @Watch('updateData') contentDetailData: ContentDetailDTO
@Consume @Watch('pageShowChange') pageShow: number
... ... @@ -21,6 +21,7 @@ export struct PlayerComponent {
@State liveStreamType: number | null = -1
@State playUrl: string = ''
@State isCanplay: boolean = false
pageParam: ParamType = {}
pageShowChange() {
this.playerController?.play()
... ... @@ -76,7 +77,8 @@ export struct PlayerComponent {
playerController: this.playerController,
onLoad: () => {
this.isCanplay = true
this.playerController?.firstPlay(this.playUrl);
this.contentTrackingDict()
this.playerController?.firstPlay(this.playUrl, TrackConstants.PageName.Live_Detail, this.pageParam);
}
})
} else if (this.liveStreamType == 0) {
... ... @@ -84,7 +86,8 @@ export struct PlayerComponent {
playerController: this.playerController,
onLoad: () => {
this.isCanplay = true
this.playerController?.firstPlay(this.playUrl);
this.contentTrackingDict()
this.playerController?.firstPlay(this.playUrl, TrackConstants.PageName.Live_Detail, this.pageParam);
}
}).margin({ top: 195 }).height(211)
}
... ... @@ -106,4 +109,12 @@ export struct PlayerComponent {
.height('100%')
.width('100%')
}
contentTrackingDict() {
this.pageParam = {
'contentType': `${this.contentDetailData.newsType}`,
'contentId': `${this.contentDetailData.newsId}`,
'contentName': `${this.contentDetailData.newsTitle || ''}`,
}
}
}
\ No newline at end of file
... ...
import { WDAliPlayerController, WDPlayerController } from 'wdPlayer/Index'
import { WDAliPlayerController } from 'wdPlayer/Index'
import { PlayerUIComponent } from './PlayerUIComponent'
@Component
... ...
... ... @@ -7,8 +7,8 @@ struct GuidePages {
// guideImage = [$r('app.media.guide_static1'), $r('app.media.guide_static2'), $r('app.media.guide_static3'), $r('app.media.guide_static4'),$r('app.media.guide_static5')]
// guideTitle = [$r('app.media.guide_title1'), $r('app.media.guide_title2'), $r('app.media.guide_title3'), $r('app.media.guide_title4'),$r('app.media.guide_title5')]
// guideIndex = [$r('app.media.guide_index1'), $r('app.media.guide_index2'), $r('app.media.guide_index3'),$r('app.media.guide_index4'), $r('app.media.guide_button')]
guideImage = [$r('app.media.guide_Static')]
guideIndex = [$r('app.media.guide_button')]
guideImage = [$r('app.media.guide_Static'),'']
guideIndex = [$r('app.media.guide_button'),'']
build() {
Column() {
... ... @@ -17,10 +17,16 @@ struct GuidePages {
this.ChildItem(index)
}, (item: number) => JSON.stringify(item))
}.loop(false).disableSwipe(true)
}.loop(false)
.indicator(false)
.width('100%')
.height('100%')
.effectMode(EdgeEffect.None)
.onChange(index => {
if (index == 1) {
WDRouterRule.jumpWithReplacePage(WDRouterPage.launchInterestsPage)
}
})
}.width('100%')
.height('100%')
... ...
... ... @@ -13,7 +13,8 @@ import {
import { initGlobalPlayerSettings, setupPlayerConfig } from '../utils/GlobalSetting';
import prompt from '@ohos.promptAction';
import { PlayerConstants, AVPlayerStatus, Events } from '../constants/PlayerConstants';
import { Logger, StringUtils } from 'wdKit/Index';
import { DateTimeUtils, Logger, StringUtils } from 'wdKit/Index';
import { ParamType, TrackingPlay } from 'wdTracking/Index';
const TAG = "WDAliPlayerController"
... ... @@ -50,6 +51,11 @@ export class WDAliPlayerController {
public onCanplay?: () => void;
public onStatusChange?: (status: number) => void;
public onFirstFrameDisplay?: () => void
// 埋点字段
private creatStartTime: number = 0; //开始加载时间
private creatEndTime: number = 0; //加载完成时间
private pageParam: ParamType = {}
private pageName: string = ''
constructor() {
Logger.info(TAG, "初始化")
... ... @@ -102,11 +108,29 @@ export class WDAliPlayerController {
if (this.onFirstFrameDisplay) {
this.onFirstFrameDisplay()
}
if (this.pageParam) {
console.log('播放视频pageParam', JSON.stringify(this.pageParam))
// 播放埋点
TrackingPlay.videoPositivePlay(Math.floor((DateTimeUtils.getTimeStamp() - this.creatStartTime) / 1000),
this.pageName, this.pageName, this.pageParam)
}
}
});
this.avPlayer?.setOnCompletionListener({
onCompletion: () => {
Logger.debug(TAG, "播放完成")
if (this.pageParam) {
let initDuration = Math.floor(Number(this.duration) / 1000)
let currentPlayTime: number = Math.floor((DateTimeUtils.getTimeStamp() - this.creatStartTime) / 1000) //当前播放时间
console.log('播放结束')
// 播放结束埋点
TrackingPlay.videoPlayEnd(currentPlayTime, initDuration, currentPlayTime, this.pageName, this.pageName,
this.pageParam)
}
}
});
this.avPlayer?.setOnInfoListener({
... ... @@ -197,6 +221,9 @@ export class WDAliPlayerController {
this.errorMesage = errorInfo.getMsg()
this.status = PlayerConstants.STATUS_ERROR;
this.watchStatus();
console.log('播放错误',JSON.stringify(error))
TrackingPlay.videoPlayError(errorInfo.getMsg(), this.pageName, this.pageName, this.pageParam)
}
});
this.avPlayer?.setOnLoadingStatusListener({
... ... @@ -265,12 +292,20 @@ export class WDAliPlayerController {
}
}
async firstPlay(url: string) {
async firstPlay(url: string, pageName?: string, pageParam?: ParamType) {
if (StringUtils.isEmpty(url)) {
Logger.error(TAG, "播放链接为空")
return
}
this.creatStartTime = DateTimeUtils.getTimeStamp()
if (pageName) {
this.pageName = pageName
}
if (pageParam) {
this.pageParam = pageParam
}
this.url = url;
if (this.avPlayer == null) {
Logger.info(TAG, "等待播放器初始化")
... ... @@ -457,11 +492,7 @@ export class WDAliPlayerController {
if (this.onStatusChange) {
this.onStatusChange(this.status)
}
// if (this.status === PlayConstants.STATUS_START) {
// globalThis.windowClass.setWindowKeepScreenOn(true);
// } else {
// globalThis.windowClass.setWindowKeepScreenOn(false);
// }
}
playError(msg?: string) {
... ...
... ... @@ -113,6 +113,29 @@ export class TrackingContent {
}
/**
* 直播预约埋点
* @param isSubscribeFlag
* @param pageId
* @param pageName
* @param extParams
*/
static subscribeClick(isSubscribeFlag:boolean ,pageId: string, pageName: string,extParams?: ParamType){
let params = TrackingUtils.generateParams(extParams)
if (pageId.length) {
params["pageId"] = pageId
}
if (pageName.length) {
params["pageName"] = pageName
}
let event = isSubscribeFlag?'live_subscribe_click':'cancel_live_subscribe_click'
TrackingUtils.fillPositionWith(params)
Tracking.event(event, params)
}
// 内容下载点击事件 1.图片 2.音频 3.视频
static download(donwloadContentType: number, pageId: string, pageName: string, extParams?: ParamType) {
let params = TrackingUtils.generateParams(extParams)
... ...
... ... @@ -103,8 +103,8 @@ struct LaunchAdvertisingPage {
.fontSize('24lpx')
.width('72lpx')
.height('36lpx')
.borderRadius(5)
.margin({top:'10lpx',left:'19lpx'})
.borderRadius(2)
.margin({top:'15lpx',left:'19lpx'})
.backgroundColor('#80000000')
}
.width('100%')
... ... @@ -191,7 +191,7 @@ struct LaunchAdvertisingPage {
this.trackingLaunchClick()
if(this.defaultModel.linkUrl.length > 0){
if (this.defaultModel.objectType == '2') {
if (this.defaultModel.openType == '2') {
//端外打开
ProcessUtils.jumpExternalWebPage(this.defaultModel.linkUrl)
}else {
... ...
... ... @@ -3,8 +3,9 @@ import { WDRouterRule } from 'wdRouter';
import { WDRouterPage } from 'wdRouter';
import { SPHelper } from 'wdKit/Index';
import { SpConstants } from 'wdConstant/Index';
import { ButtonOptions, promptAction } from '@kit.ArkUI';
import { ButtonOptions, promptAction, window } from '@kit.ArkUI';
import { ParamType, TrackConstants, TrackingContent } from 'wdTracking/Index';
import { ImageKnifeComponent } from '@ohos/imageknife';
@Entry
@Component
... ... @@ -13,7 +14,6 @@ struct LaunchInterestsHobbiesPage {
@State selectCount: number = 0
@State interestsArray: InterestsList[] = []
aboutToAppear(){
//请求接口,获取兴趣偏好数据
this.requestInterestsData()
... ... @@ -21,6 +21,8 @@ struct LaunchInterestsHobbiesPage {
build() {
Column() {
Stack(){
Column(){
Row(){
Blank()
Text('跳过')
... ... @@ -28,7 +30,7 @@ struct LaunchInterestsHobbiesPage {
.fontColor('#333333')
.width('54lpx')
.height('35lpx')
.margin({top:'27lpx',right:'46lpx'})
.margin({right:'46lpx'})
.onClick(()=>{
//直接跳过到首页
//跳转首页
... ... @@ -60,12 +62,16 @@ struct LaunchInterestsHobbiesPage {
ForEach(this.interestsArray,(item:InterestsList,index:number)=>{
GridItem(){
Stack({alignContent:Alignment.TopStart}){
Image(item.pic)
ImageKnifeComponent({imageKnifeOption:{loadSrc:item.pic}})
.width('100%')
.height('100%')
.backgroundColor(Color.White)
.borderRadius(5)
// Image(item.pic)
// .width('100%')
// .height('100%')
// .backgroundColor(Color.White)
// .borderRadius(5)
Stack(){
Image('')
.width('100%')
... ... @@ -74,7 +80,6 @@ struct LaunchInterestsHobbiesPage {
.opacity(item.choose?0.5:0)
.borderRadius(5)
}
Stack(){
Column({}){
Text(item.name)
... ... @@ -111,16 +116,21 @@ struct LaunchInterestsHobbiesPage {
})
})
}
.width('90%')
.height('70%')
.margin({top:'61lpx'})
// .height('70%')
.margin({top:'61lpx',bottom:'240lpx'})
.columnsTemplate('1fr 1fr 1fr')
// .rowsTemplate('1fr 1fr 1fr 1fr')
.columnsGap('23lpx')
.rowsGap('23lpx')
.scrollBar(BarState.Off)
}
.width('100%')
.height('100%')
}
.width('100%')
.height(`calc(100% - ${108 + 'lpx'})`)
// .backgroundColor(Color.Red)
Stack({alignContent:Alignment.Center}){
Button(this.selectCount == 0?'选好了':'选好了(' + this.selectCount + ')')
... ... @@ -131,9 +141,11 @@ struct LaunchInterestsHobbiesPage {
.borderRadius('10lpx')
.width('662lpx')
.height('84lpx')
.margin({top:'10lpx'})
Image('')
.width('662lpx')
.height('84lpx')
.margin({top:'10lpx'})
.backgroundColor(Color.White)
.opacity(this.selectCount == 0 ? 0.6 : 0)
.borderRadius('10lpx')
... ... @@ -156,10 +168,8 @@ struct LaunchInterestsHobbiesPage {
}
.width('100%')
.height('108lpx')
// .position({y:})
// .margin({bottom:'1',top:'1'})
.backgroundColor('#FFFFFF')
.margin({top:0})
// .backgroundColor(Color.Orange)
}
.width('100%')
.height('100%')
... ...