王士厅
Showing 61 changed files with 1329 additions and 733 deletions
... ... @@ -181,6 +181,10 @@
"value": "40vp"
},
{
"name": "top_tab_bar_height_common",
"value": "44vp"
},
{
"name": "top_tab_item_max_width",
"value": "300vp"
},
... ...
... ... @@ -68,6 +68,7 @@ export class WDRouterPage {
static loginPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginPage");
static oneKeyLoginPage = new WDRouterPage("wdLogin", "ets/pages/login/OneKeyLoginPage");
static forgetPasswordPage = new WDRouterPage("wdLogin", "ets/pages/login/ForgetPasswordPage");
static verifyPhoneNumberPage = new WDRouterPage("wdLogin", "ets/pages/login/VerifyPhoneNumberPage");
static changeBindPhonePage = new WDRouterPage("wdLogin", "ets/pages/login/ChangeBindPhonePage");
static modifyPasswordPage = new WDRouterPage("wdLogin", "ets/pages/login/ModifyPasswordPage");
//我的 预约
... ...
... ... @@ -49,6 +49,7 @@ const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm';
/**
* 动态详情页UI
* @author wd-zsz
* */
// @Preview
... ... @@ -533,6 +534,8 @@ export struct DynamicDetailComponent {
}
//点赞操作
this.toggleLikeStatus()
//内容点赞/取消点赞埋点
})
// 评论
... ...
import { ContentDTO, NewspaperListItemBean, NewspaperPositionItemBean, Params } from 'wdBean';
import { StringUtils } from 'wdKit';
import { ProcessUtils } from 'wdRouter';
import { TrackingContent,TrackConstants } from 'wdTracking/Index';
import { newsSkeleton } from './skeleton/newsSkeleton';
@Component
... ... @@ -13,6 +14,20 @@ export struct ENewspaperItemComponent {
private itemBeanClicked: NewspaperPositionItemBean = {} as NewspaperPositionItemBean
@State isShowSkeleton: boolean = true
aboutToAppear(): void {
for (let index = 0; index < this.newspaperListItemBean.items.length; index++) {
const element = this.newspaperListItemBean.items[index];
TrackingContent.common(TrackConstants.EventType.Show,TrackConstants.PageName.NewsPaperPage,TrackConstants.PageName.NewsPaperPage
,{
'contentName':element.title,
'contentType':element.newsType,
'contentId':element.newsId,
'panelNumber':this.newspaperListItemBean.pageNum,
'panelName':this.newspaperListItemBean.pageName,
'readMode':'1',
})
}
}
build() {
Stack() {
newsSkeleton()
... ... @@ -70,6 +85,16 @@ export struct ENewspaperItemComponent {
relType:this.itemBeanClicked.relType ?? '0'
} as ContentDTO
ProcessUtils.processPage(content)
//内容点击
TrackingContent.commentClickWithEvent('current_Number_Panel_content_click',TrackConstants.PageName.NewsPaperPage,TrackConstants.PageName.NewsPaperPage
,{
'contentName':this.itemBeanClicked.title,
'contentType':this.itemBeanClicked.newsType,
'contentId':this.itemBeanClicked.newsId,
'panelNumber':this.newspaperListItemBean.pageNum,
'panelName':this.newspaperListItemBean.pageName,
'readMode':'1',
})
this.itemBeanClicked = {} as NewspaperPositionItemBean
}
}
... ...
... ... @@ -10,7 +10,7 @@ import { ENewspaperPageDialog } from '../dialog/ENewspaperPageDialog';
import { RMCalendarBean } from './calendar/RMCalendarBean';
import { newsSkeleton } from './skeleton/newsSkeleton';
import { Logger, ToastUtils, NetworkUtil } from 'wdKit/Index';
import { promptAction } from '@kit.ArkUI';
import { TrackingContent,TrackConstants, TrackingButton } from 'wdTracking/Index';
@Component
export struct ENewspaperPageComponent {
... ... @@ -34,6 +34,15 @@ export struct ENewspaperPageComponent {
let _swiperIndex = Number.parseInt(this.currentPageNum)
console.log("ENewspaperPageComponent-onCurrentPageNumUpdated", "_swiperIndex:", _swiperIndex)
this.swiperIndex = _swiperIndex > 0 ? _swiperIndex - 1 : _swiperIndex
//电子报--版面序号选择点击
TrackingContent.commentClickWithEvent('panel_number_selection_click',TrackConstants.PageName.NewsPaperPage,TrackConstants.PageName.NewsPaperPage
,{
'panelNumber':this.newspaperListBean?.list[this.swiperIndex].pageNum,
'panelName':this.newspaperListBean?.list[this.swiperIndex].pageName,
'currentPanelDate':this.selectDate.toDateString(),
'currentNumber':this.swiperIndex,
})
}
//日历选择弹框
... ... @@ -51,6 +60,14 @@ export struct ENewspaperPageComponent {
this.selectDate =
new Date(date.fullYear ? date.fullYear : 0, date.month ? date.month : 0, date.date ? date.date : 0)
}
//日历选择点击
TrackingContent.commentClickWithEvent('date_selection_click',TrackConstants.PageName.NewsPaperPage,TrackConstants.PageName.NewsPaperPage
,{
'panelNumber':this.newspaperListBean?.list[this.swiperIndex].pageNum,
'panelName':this.newspaperListBean?.list[this.swiperIndex].pageName,
'currentPanelDate':this.selectDate.toDateString(),
'currentNumber':this.swiperIndex,
})
}
}),
alignment: DialogAlignment.Top,
... ... @@ -190,7 +207,7 @@ export struct ENewspaperPageComponent {
if (this.newspaperListBean && this.newspaperListBean.list && this.newspaperListBean.list.length > 0) {
Swiper(this.swiperController) {
ForEach(this.newspaperListBean?.list, (item: NewspaperListItemBean, index: number) => {
ENewspaperItemComponent({ newspaperListItemBean: item })
ENewspaperItemComponent({ newspaperListItemBean: item})
})
}
.index(this.swiperIndex)
... ... @@ -245,6 +262,12 @@ export struct ENewspaperPageComponent {
.id('e_newspaper_next')
.onClick((event: ClickEvent) => {
this.swiperController.showNext()
// 电子报--滑动查看下一版
TrackingButton.click('panelPageViewNextPanel',TrackConstants.PageName.NewsPaperPage,TrackConstants.PageName.NewsPaperPage
,{
'panelNumber':this.newspaperListBean?.list[this.swiperIndex].pageNum,
'panelName':this.newspaperListBean?.list[this.swiperIndex].pageName,
})
})
}
... ... @@ -316,6 +339,14 @@ export struct ENewspaperPageComponent {
}
if (this.newspaperListBean.list && this.newspaperListBean.list.length > 0) {
this.isOpenListDialog = true
//电子报--读报纸点击
TrackingContent.commentClickWithEvent('read_newspaper_click',TrackConstants.PageName.NewsPaperPage,TrackConstants.PageName.NewsPaperPage
,{
'panelNumber':this.newspaperListBean?.list[this.swiperIndex].pageNum,
'panelName':this.newspaperListBean?.list[this.swiperIndex].pageName,
'currentPanelDate':this.selectDate.toDateString(),
'currentNumber':this.swiperIndex,
})
}else {
ToastUtils.showToast('暂无数据', 1000)
}
... ...
... ... @@ -10,7 +10,7 @@ import { BusinessError } from '@kit.BasicServicesKit';
import { router } from '@kit.ArkUI';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter/Index';
import { TrackingPageBrowse } from 'wdTracking/Index';
import { TrackConstants, TrackingButton, TrackingPageBrowse } from 'wdTracking/Index';
const TAG = 'FeedBackActivity'
... ... @@ -22,8 +22,6 @@ const TAG = 'FeedBackActivity'
@Component
export struct FeedBackActivity {
pageShowTime:number = 0;
pageId:string = 'feedbackPage';
pageName:string=this.pageId;
@State canSubmit: boolean = false;
@State textNumLabel: string = '0/500';
contact: string = "";
... ... @@ -66,6 +64,11 @@ export struct FeedBackActivity {
.onChange((select) => {
feedbackTypeBean.isSelect = select
this.canSubmit = this.checkSubmit()
TrackingButton.click('submit_feedback',TrackConstants.PageName.FeedbackPage,TrackConstants.PageName.FeedbackPage,{
'feedback_type':feedbackTypeBean.id+''
})
})
Text(feedbackTypeBean.classifyName)
.fontColor($r('app.color.color_222222'))
... ... @@ -342,9 +345,13 @@ export struct FeedBackActivity {
})
if(!StringUtils.isEmpty(selectType)){
selectType = selectType.substring(0,selectType.length-1)
TrackingButton.click('feedbackPageSubmitFeedback',TrackConstants.PageName.FeedbackPage,TrackConstants.PageName.FeedbackPage,{
'feedbackTypeId':selectType
})
}else{
//
ToastUtils.shortToast($r('app.string.feedback_opinion_type'))
TrackingButton.click('feedbackPageSubmitFeedback',TrackConstants.PageName.FeedbackPage,TrackConstants.PageName.FeedbackPage)
return
}
//内容必填
... ... @@ -389,7 +396,7 @@ export struct FeedBackActivity {
}
onPageHide() {
//页面浏览
TrackingPageBrowse.trackCommonPageExposureEnd(this.pageId,this.pageName,Math.floor((DateTimeUtils.getTimeStamp() - this.pageShowTime)/1000))
TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.FeedbackPage,TrackConstants.PageName.FeedbackPage,Math.floor((DateTimeUtils.getTimeStamp() - this.pageShowTime)/1000))
}
}
\ No newline at end of file
... ...
... ... @@ -67,6 +67,7 @@ export struct MorningEveningPaperComponent {
// 顶部安全高度赋值
@State topSafeHeight: number = 0;
@State bottomSafeHeight: number = 0;
@State isHasTopView: boolean = false;
private audioDataList: AudioDataList[] = []
private playerController: WDPlayerController = new WDPlayerController();
... ... @@ -144,7 +145,10 @@ export struct MorningEveningPaperComponent {
Logger.info(TAG, "pageInfoBean dateTime = " + dateTime)
Logger.info(TAG, "pageInfoBean subTitle = " + this.subTitle)
this.setComponentBgColor(pageInfoBean.backgroundImgUrl)
this.isHasTopView = this.pageInfoBean?.topicInfo?.frontLinkObject?true:false
let coverUrl = this.isHasTopView?this.pageInfoBean?.topicInfo?.frontLinkObject?.coverUrl as string :''
this.setComponentBgColor(coverUrl)
let compInfoBean = await MorningEveningViewModel.getMorningEveningCompInfo(pageInfoBean?.id, pageInfoBean?.groups[0]?.id, currentTime + "", pageInfoBean?.topicInfo?.topicId)
// this.compInfoBean = compInfoBean
... ... @@ -201,11 +205,9 @@ export struct MorningEveningPaperComponent {
// const pixelMap: image.PixelMap = await image2PixelMap(item.icon);
Logger.debug(TAG, "compInfoBean compStyle = " + imageUrl)
const imageSource: image.ImageSource | undefined = await getPicture(imageUrl)
if (imageSource && this.pageInfoBean.topicInfo.frontFlag === 1) {
if (imageUrl.length > 0 && this.pageInfoBean.topicInfo.frontFlag === 1) {
const imageSource: image.ImageSource | undefined = await getPicture(imageUrl)
this.pickColor(imageSource)
} else {
if (this.pageInfoBean.topicInfo.topicPattern === 1) {
this.mixedBgColor = '#66BDBD'
... ... @@ -223,8 +225,7 @@ export struct MorningEveningPaperComponent {
effectKit.createColorPicker(pixelMap, (err, colorPicker) => {
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 = 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)
... ... @@ -271,19 +272,24 @@ export struct MorningEveningPaperComponent {
}
}
.height(`calc(100% - ${this.bottomSafeHeight + this.topSafeHeight + 'vp'})`).scrollBar(BarState.Off)
.onAreaChange((oldValue: Area, newValue: Area) => {
let persent = Math.abs(Number(newValue.globalPosition.y)) / 150
if (persent > 1) {
persent = 1
}
})
PaperTitleComponent()
PaperTitleComponent().margin({top:this.isHasTopView?this.topSafeHeight:0}).backgroundColor(this.mixedBgColor).opacity(this.isHasTopView?0:1)
}
.width('100%')
.height('100%')
.padding({
top: this.topSafeHeight,
bottom: this.bottomSafeHeight
top: this.isHasTopView?0:this.topSafeHeight,
// bottom: this.bottomSafeHeight
})
// .backgroundColor(Color.Black)
// .backgroundColor(this.pageInfoBean?.backgroundColor ?? Color.Black)
.backgroundColor(this.mixedBgColor ?? Color.Black)
}
@Builder
... ...
... ... @@ -32,36 +32,37 @@ export struct topicInfoView {
})
.id('img_cover')
Row() {
Text("查看详情")
.fontSize(14)
.fontColor($r('app.color.white'))
.maxLines(1)
.borderRadius(2)
.padding({ left: 6, top: 4, bottom: 4 })
if (this.frontLinkObject) {
Row() {
Text("查看详情")
.fontSize(14)
.fontColor($r('app.color.white'))
.maxLines(1)
.borderRadius(2)
.padding({ left: 6, top: 4, bottom: 4 })
Image($r('app.media.more_w'))// .height($r('app.float.top_arrow_size'))
.width(12)
.height(12)
.margin({ left: 4, right: 7 })
}
.backgroundColor($r('app.color.color_99636363'))
.margin({ top: 8, left: 16, right: 16, bottom: 16 })
.borderRadius(2)
.onClick(()=>{
if (this.frontLinkObject) {
Image($r('app.media.more_w'))// .height($r('app.float.top_arrow_size'))
.width(12)
.height(12)
.margin({ left: 4, right: 7 })
}
.backgroundColor($r('app.color.color_99636363'))
.margin({ top: 8, left: 16, right: 16, bottom: 16 })
.borderRadius(2)
.onClick(()=>{
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 }
})
.id('row_detail')
}).width(80)
.alignRules({
left: { anchor: "__container__", align: HorizontalAlign.Start },
bottom: { anchor: "__container__", align: VerticalAlign.Bottom }
})
.id('row_detail')
}
Text(this.frontLinkObject?.summary ?? "")
.margin({ top: 10 })
... ...
... ... @@ -174,6 +174,7 @@ export struct CardMediaInfo {
.mediaLogo()
Text(`${this.contentDTO.photoNum}`)
.mediaTextImgtype()
.fontFamily('BebasNeue')
}
.margin({ left: 80,top: 55})
... ...
... ... @@ -27,6 +27,7 @@ export struct Card17Component {
@State str03: string = '';
async aboutToAppear(): Promise<void> {
console.log('Card17Component', JSON.stringify(this.contentDTO))
this.titleInit();
this.clicked = hasClicked(this.contentDTO.objectId)
this.loadImg = await onlyWifiLoadImg();
... ... @@ -65,7 +66,7 @@ export struct Card17Component {
GridRow({ gutter: 2 }) {
GridCol({ span: { xs: 8 } }) {
Image(this.loadImg ?
this.contentDTO.fullColumnImgUrls.length > 0 ? this.contentDTO.fullColumnImgUrls[0].url : '' : '')
this.contentDTO.fullColumnImgUrls.length > 0 ? this.contentDTO.fullColumnImgUrls[0].url || this.contentDTO.fullColumnImgUrls[0].fullUrl : '' : '')
.backgroundColor(this.loadImg ? '#f5f5f5' : 0xf5f5f5)
.width(CommonConstants.FULL_WIDTH)
.height(160)// .aspectRatio(CompUtils.ASPECT_RATIO_16_9)
... ... @@ -77,7 +78,7 @@ export struct Card17Component {
GridCol({ span: { xs: 4 } }) {
Image(this.loadImg ?
this.contentDTO.fullColumnImgUrls.length > 1 ? this.contentDTO.fullColumnImgUrls[1].url : '' : '')
this.contentDTO.fullColumnImgUrls.length > 1 ? this.contentDTO.fullColumnImgUrls[1].url || this.contentDTO.fullColumnImgUrls[1].fullUrl : '' : '')
.backgroundColor(this.loadImg ? '#f5f5f5' : 0xf5f5f5)
.width(CommonConstants.FULL_WIDTH)
.height(79)// .aspectRatio(CompUtils.ASPECT_RATIO_16_9)
... ... @@ -94,7 +95,7 @@ export struct Card17Component {
GridCol({ span: { xs: 4 } }) {
Image(this.loadImg ?
this.contentDTO.fullColumnImgUrls.length > 2 ? this.contentDTO.fullColumnImgUrls[2].url : '' : '')
this.contentDTO.fullColumnImgUrls.length > 2 ? this.contentDTO.fullColumnImgUrls[2].url || this.contentDTO.fullColumnImgUrls[2].fullUrl : '' : '')
.backgroundColor(this.loadImg ? '#f5f5f5' : 0xf5f5f5)
.width(CommonConstants.FULL_WIDTH)
.height(79)// .aspectRatio(CompUtils.ASPECT_RATIO_16_9)
... ...
... ... @@ -97,13 +97,14 @@ struct createImg {
@State loadImg: boolean = false;
async aboutToAppear(): Promise<void> {
console.log("createImg", JSON.stringify(this.contentDTO.fullColumnImgUrls))
this.loadImg = await onlyWifiLoadImg();
}
build() {
GridRow() {
if (this.contentDTO.fullColumnImgUrls[0].landscape === 1 || this.contentDTO.fullColumnImgUrls[0].weight > this.contentDTO.fullColumnImgUrls[0].height) {
if (this.contentDTO.fullColumnImgUrls[0].landscape === 1) {
// 横屏
GridCol({
span: { xs: 12 }
... ... @@ -131,6 +132,7 @@ struct createImg {
.backgroundColor(0xf5f5f5)
.width(CommonConstants.FULL_WIDTH)
.borderRadius($r('app.float.image_border_radius'))
.aspectRatio(172 / 230)
CardMediaInfo({ contentDTO: this.contentDTO })
}
.align(Alignment.BottomEnd)
... ...
... ... @@ -36,18 +36,7 @@ export struct Card2Component {
this.titleInit();
this.loadImg = await onlyWifiLoadImg();
}
calculateTextIndent() {
if (this.contentDTO?.newTags?.length < 5 && this.contentDTO?.newTags?.length > 2) {
return 58;
} else if ((this.contentDTO.newTags?.length !== 0) || (this.contentDTO.seoTags?.length !== 0)) {
// 当newTags或seoTags存在时,应用相同的缩进
return 35;
} else if (this.contentDTO.objectType == '5') {
return 35;
} else {
return 0;
}
}
titleInit() {
if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) {
this.titleMarked = true;
... ... @@ -61,15 +50,39 @@ export struct Card2Component {
Column() {
Column() {
Stack() {
// if(this.contentDTO.objectType == '5'){
// Notes({ objectType: this.contentDTO.objectType }).height(30).align(Alignment.Center)
// }else if(this.contentDTO.objectType == '2'){
// if(this.contentDTO.seoTags){
// Notes({ newTags: this.contentDTO.seoTags }).height(30).align(Alignment.Center)
// }else if(this.contentDTO.newTags){
// Notes({ newTags: this.contentDTO.newTags }).height(30).align(Alignment.Center)
//
// }
// }else {
// if(this.contentDTO.newTags){
// Notes({ newTags: this.contentDTO.newTags }).height(30).align(Alignment.Center)
// }
// }
if(this.contentDTO.objectType == '5'){
Notes({ objectType: this.contentDTO.objectType }).height(30).align(Alignment.Center)
} else {
if (this.contentDTO.seoTags) {
Notes({ newTags: this.contentDTO.seoTags }).height(30).align(Alignment.Center)
} else if (this.contentDTO.newTags) {
}
if (this.contentDTO.newTags) {
Notes({ newTags: this.contentDTO.newTags }).height(30).align(Alignment.Center)
}
}
//新闻标题
// 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)
... ... @@ -86,7 +99,10 @@ export struct Card2Component {
.lineHeight(27)
.textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
.align(Alignment.Start)
.textIndent(this.calculateTextIndent())
.textIndent((this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) > 2 &&
(this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) < 5 ? 58 :
((this.contentDTO.newTags?.length > 0 || this.contentDTO.seoTags?.length > 0) || this.contentDTO.objectType == '5') ? 35 :
0 )
}.alignContent(Alignment.TopStart)
//.textIndent(this.contentDTO.objectType == '5' ? 35 : 0)
... ...
... ... @@ -27,6 +27,7 @@ export struct Card5Component {
@State str03: string = '';
async aboutToAppear(): Promise<void> {
console.log('Card2Component', JSON.stringify(this.compDTO))
this.clicked = hasClicked(this.contentDTO.objectId)
this.loadImg = await onlyWifiLoadImg();
... ... @@ -47,9 +48,9 @@ export struct Card5Component {
Image(this.loadImg ? this.contentDTO.coverUrl : '')
.backgroundColor(0xf5f5f5)
.width(CommonConstants.FULL_WIDTH)
.autoResize(true)
.borderRadius($r('app.float.image_border_radius'))
if (this.titleShowPolicy === 1 || this.titleShowPolicy === null) {
.aspectRatio(343 / 225)
if (this.titleShowPolicy === 1 || this.titleShowPolicy === null || this.titleShowPolicy === '') {
Row()
.width(CommonConstants.FULL_WIDTH)
.height(59)
... ...
... ... @@ -32,19 +32,6 @@ export struct Card6Component {
this.loadImg = await onlyWifiLoadImg();
this.clicked = hasClicked(this.contentDTO.objectId)
}
calculateTextIndent() {
if (this.contentDTO?.newTags?.length < 5 && this.contentDTO?.newTags?.length > 2) {
return 58;
} else if ((this.contentDTO.newTags?.length !== 0) || (this.contentDTO.seoTags?.length !== 0)) {
// 当newTags或seoTags存在时,应用相同的缩进
return 35;
} else if (this.contentDTO.objectType == '5') {
return 35;
} else {
return 0;
}
}
titleInit() {
if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) {
this.titleMarked = true;
... ... @@ -74,7 +61,8 @@ export struct Card6Component {
} else {
if (this.contentDTO.seoTags) {
Notes({ newTags: this.contentDTO.seoTags }).height(30).align(Alignment.Center)
} else if (this.contentDTO.newTags) {
}
if (this.contentDTO.newTags) {
Notes({ newTags: this.contentDTO.newTags }).height(30).align(Alignment.Center)
}
}
... ... @@ -97,7 +85,10 @@ export struct Card6Component {
.maxLines(3)
.alignSelf(ItemAlign.Start)
.textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
.textIndent(this.calculateTextIndent())
.textIndent((this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) > 2 &&
(this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) < 5 ? 58 :
((this.contentDTO.newTags?.length > 0 || this.contentDTO.seoTags?.length > 0) || this.contentDTO.objectType == '5') ? 35 :
0 )
}.alignContent(Alignment.TopStart)
}
... ...
... ... @@ -279,6 +279,7 @@ export struct CommentComponent {
if (commentListModel && commentListModel.list && commentListModel.list.length > 0) {
this.allDatas.clearAllData() // 防止数据重复问题
commentListModel.list.forEach(element => {
element.hasMore = Number.parseInt(element.childCommentNum) ? true : false
let newModel = commentViewModel.deepCopyCommentItemModel(element)
... ...
import { DisplayUtils, EmitterEventId, EmitterUtils } from 'wdKit/Index'
import { DisplayUtils, EmitterEventId, EmitterUtils, ToastUtils } from 'wdKit/Index'
import { publishCommentModel } from '../model/PublishCommentModel'
import { CommentCustomDialog } from './CommentCustomDialog'
import measure from '@ohos.measure'
import { ContentDetailDTO } from 'wdBean/Index'
import { HttpUtils } from 'wdNetwork/Index'
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'
@Preview
@Component
... ... @@ -120,6 +122,21 @@ export struct CommentTabComponent {
if(this.contentDetail.appstyle === 9) return
this.onCommentFocus && this.onCommentFocus()
// 未登录,游客评论未打开 则先登录
if (!HttpUtils.isLogin()) {
if (this.contentDetail.visitorComment != 1) {
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
return
}
}
if (this.contentDetail.openComment != 1 && this.contentDetail.commentDisplay != 1) {
ToastUtils.showToast("暂时无法评论", 3000)
return
}
//TODO: 用户被禁言 也不能评论
this.publishCommentModel.rootCommentId = '-1';
this.publishCommentModel.parentId = '-1';
this.publishCommentModel.placeHolderText = "说两句..."
... ...
import { ViewType } from 'wdConstant/Index'
import { DateTimeUtils, LazyDataSource, ToastUtils, WindowModel } from 'wdKit/Index'
import { DateTimeUtils, LazyDataSource, Logger, ToastUtils, WindowModel } from 'wdKit/Index'
import { commentItemModel } from '../model/CommentModel'
import commentViewModel from '../viewmodel/CommentViewModel'
import { router, window } from '@kit.ArkUI'
... ... @@ -37,6 +37,7 @@ export struct QualityCommentsComponent {
aboutToDisappear(): void {
// windowClass.setWindowSystemBarProperties({ statusBarColor: '#000' })
this.dialogController = null // 将dialogController置空
WindowModel.shared.setWindowLayoutFullScreen(false)
}
onPageShow(): void {
... ... @@ -50,6 +51,7 @@ export struct QualityCommentsComponent {
aboutToAppear(): void {
this.getData();
this.showAlert()
WindowModel.shared.setWindowLayoutFullScreen(true)
}
showAlert() {
... ... @@ -106,8 +108,15 @@ export struct QualityCommentsComponent {
// .aspectRatio(375 / 283);
}
.onAreaChange((oldValue: Area, newValue: Area) => {
let persent = Math.abs(Number(newValue.globalPosition.y)) / 150
if (Number(oldValue.globalPosition.y) == 0 && Number(newValue.globalPosition.y) > 30) {
this.firstPositionY = Number(newValue.globalPosition.y)
return
}
Logger.debug(TAG, "oldValue.globalPosition.y : " + oldValue.globalPosition.y)
Logger.debug(TAG,
"newValue.globalPosition.y : " + newValue.globalPosition.y + `,this.topSafeHeight : ` + this.topSafeHeight)
let persent =
Math.abs(Number(newValue.globalPosition.y) - this.firstPositionY) / 150 //- this.topSafeHeight) / 283
if (persent > 1) {
persent = 1
}
... ... @@ -129,65 +138,61 @@ export struct QualityCommentsComponent {
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
left: { anchor: "__container__", align: HorizontalAlign.Start }
})
.offset({
y: (this.topSafeHeight / 2) + 'px'
})
})// .offset({
// y: (this.topSafeHeight / 2) + 'px'
// })
.margin({ left: 16 })
.onClick(() => {
router.back()
})
}
.visibility(this.tileOpacity > 0 ? 1 : 0)
.height(this.topSafeHeight + vp2px(44) + 'px')
// .height(this.topSafeHeight + vp2px(44) + 'px')
.height(44)
.width('100%')
.backgroundColor($r('app.color.color_transparent'))
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP])
}
/*导航栏*/
@Builder
TabbarNormal() {
RelativeContainer() {
//标题栏目
Image($r('app.media.icon_arrow_left'))
.width(24)
.height(24)
.objectFit(ImageFit.Auto)
.id("back_icon")
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
left: { anchor: "__container__", align: HorizontalAlign.Start }
})
.offset({
y: (this.topSafeHeight / 2) + 'px'
})
.margin({ left: 16 })
.onClick(() => {
router.back()
})
Column() {
Row() {
}
.width('100%')
.height(px2vp(this.topSafeHeight))
.backgroundColor($r('app.color.white'))
.opacity(this.tileOpacity)
Text('精选评论')// .height('42lpx')
.maxLines(1)
.id("title")
.fontSize('35lpx')
.fontWeight(400)
.fontColor($r('app.color.color_222222'))
.lineHeight('42lpx')
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
middle: { anchor: "__container__", align: HorizontalAlign.Center }
})
.offset({
y: (this.topSafeHeight / 2) + 'px'
})
Stack({ alignContent: Alignment.Start }) {
Row() {
Text('精选评论')// .height('42lpx')
.maxLines(1)
.id("title")
.fontSize('35lpx')
.fontWeight(400)
.fontColor($r('app.color.color_222222'))
.lineHeight('42lpx')
}
.height(44)
.width('100%')
.justifyContent(FlexAlign.Center)
.alignItems(VerticalAlign.Center)
.opacity(this.tileOpacity)
.backgroundColor($r('app.color.white'))
Image(this.tileOpacity < 0.8 ? $r('app.media.icon_arrow_left_white') : $r('app.media.icon_arrow_left'))
.width(24)
.height(24)
.objectFit(ImageFit.Auto)
.margin({ left: 16 })
.onClick(() => {
router.back()
})
}
}
.visibility(this.tileOpacity > 0 ? 0 : 1)
.opacity(this.tileOpacity)
.height(this.topSafeHeight + vp2px(44) + 'px')
.width('100%')
.backgroundColor($r('app.color.white'))
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP])
}
build() {
... ... @@ -212,12 +217,10 @@ export struct QualityCommentsComponent {
.friction(0.6)
.scrollBar(BarState.Off)
.edgeEffect(EdgeEffect.None)
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
this.TabbarTransparent()
// this.TabbarTransparent()
this.TabbarNormal()
}
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
}
... ... @@ -276,28 +279,15 @@ struct QualityCommentItem {
/*头像以及昵称*/
RelativeContainer() {
Image(this.item.fromUserHeader)
this.headerView()
if ((!this.item.api_authIcon || this.item.api_authIcon.length == 0)
&& this.item.fromUserType === 1
&& ((this.item.api_levelHead && this.item.api_levelHead.length > 0)
|| (this.item.avatarFrame && this.item.avatarFrame.length > 0))) {
this.borderView()
}
.alt($r(commentViewModel.adjustUserType(this.item.fromUserType) ?
'app.media.WDAccountOwnerHedaerDefaultIcon' : 'app.media.WDAccountDefaultIcon'))
.width(50)
.height(50)
.borderRadius(25)
.borderWidth(2)
.borderColor(Color.White)
.id('image1')
.alignRules({
top: { anchor: "__container__", align: VerticalAlign.Top },
left: { anchor: "__container__", align: HorizontalAlign.Start }
})
.offset(
{
y: -16
}
)
.onClick(() => {
this.jumpToAccountOwner()
})
Text(this.item.fromUserName)
.fontSize(14)
.fontColor('#222222')
... ... @@ -401,12 +391,83 @@ struct QualityCommentItem {
}
@Builder headerView() {
Stack() {
Stack() {
Image(this.item.fromUserHeader)
.alt(commentViewModel.adjustUserType(this.item.fromUserType) ? $r('app.media.WDAccountOwnerHedaerDefaultIcon') : $r('app.media.WDAccountDefaultIcon'))
.width(50)
.height(50)
.borderRadius(24)
.borderWidth(2)
.borderColor(Color.White)
.objectFit(ImageFit.Cover)
if (this.item.api_authIcon && this.item.api_authIcon.length > 0) {
Image(this.item.api_authIcon) // 加v
.width(12).height(12)
.objectFit(ImageFit.Cover)
}
}.width(50).height(50)
.alignContent(Alignment.BottomEnd)
}
.width(50)
.height(50)
.alignContent(Alignment.Center)
.id('image1')
.alignRules({
top: { anchor: "__container__", align: VerticalAlign.Top },
left: { anchor: "__container__", align: HorizontalAlign.Start }
})
.offset(
{
y: -16
}
)
.onClick(() => {
this.jumpToAccountOwner()
})
}
@Builder borderView() {
Image(this.customBorderIconURL())
.objectFit(ImageFit.Cover)
.width(70)
.height(70)
.id('image2')
.alignRules({
middle: { anchor: "image1", align: HorizontalAlign.Center },
center: { anchor: "image1", align: VerticalAlign.Center }
})
.offset(
{
y: -16
}
)
.onClick(() => {
this.jumpToAccountOwner()
})
}
customBorderIconURL() : string {
if (this.item.avatarFrame.length > 0) {
return this.item.avatarFrame
}
if (this.item.fromUserType === 1) {
return this.item.api_levelHead
}
return ""
}
jumpToAccountOwner() {
commentViewModel.jumpToAccountPage(this.item)
commentViewModel.jumpToAccountPage(this.item, () => {
WindowModel.shared.setWindowLayoutFullScreen(false)
})
}
jumpToDetail() {
WindowModel.shared.setWindowLayoutFullScreen(false)
// programInfoModel.api_isCommentAction = YES;
let content = new ContentDTO()
content.objectId = this.item.targetId;
... ... @@ -439,6 +500,7 @@ struct QualityCommentItem {
// 未登录,跳转登录
const user_id = HttpUtils.getUserId()
if (!user_id) {
WindowModel.shared.setWindowLayoutFullScreen(false)
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
return
}
... ...
import { CompDTO, ContentDTO, } from 'wdBean';
import { CompDTO, ContentDTO } from 'wdBean';
import { BreakpointConstants, CommonConstants } from 'wdConstant';
import { BreakPointType, Logger } from 'wdKit';
import { CompUtils } from '../../utils/CompUtils';
... ... @@ -11,6 +11,7 @@ import { InfomationCardClick } from '../../utils/infomationCardClick'
const TAG = 'Zh_Carousel_Layout-01';
/**
* 轮播组件,即Banner/轮播大图/焦点图/自动滑动
* 样式:
... ... @@ -47,9 +48,11 @@ export struct ZhCarouselLayout01 {
@StorageLink('currentBreakpoint') @Watch('watchCurrentBreakpoint') currentBreakpoint: string =
BreakpointConstants.BREAKPOINT_XS;
@State compDTO: CompDTO = {} as CompDTO
@State firstWd: number = 0
@State SecondWd: number = 0
@State swiperIndex: number = 0
private data: MyDataSource = new MyDataSource([])
watchCurrentBreakpoint() {
... ... @@ -75,6 +78,7 @@ export struct ZhCarouselLayout01 {
}
build() {
if (this.compDTO?.operDataList?.length) {
Stack() {
Swiper() {
... ... @@ -206,9 +210,19 @@ struct CarouselLayout01CardView {
Blank()
// 文本信息
Stack() {
if (this.item.objectType == '5' || this.item.objectType == '6') {
if(this.item.objectType == '5'){
Notes({ objectType: this.item.objectType })
} else {
if (this.item.seoTags) {
Notes({ newTags: this.item.seoTags })
}
if (this.item.newTags) {
Notes({ newTags: this.item.newTags })
}
}
// if (this.item.objectType == '5' || this.item.objectType == '6') {
// Notes({ objectType: this.item.objectType })
// }
Text(`${this.item.corner}${this.item.newsTitle}`)
.width(CommonConstants.FULL_PARENT)
.fontColor(Color.White)
... ... @@ -218,7 +232,10 @@ struct CarouselLayout01CardView {
.align(Alignment.Bottom)
.maxLines(CompUtils.MAX_LINES_2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.textIndent(this.item.objectType == '5' ? 35 : 0)
.textIndent((this.item.newTags?.length || this.item.seoTags?.length) > 2 &&
(this.item.newTags?.length ||this.item.seoTags?.length) < 5 ? 58 :
((this.item.newTags?.length > 0 || this.item.seoTags?.length > 0) ||this.item.objectType == '5') ? 35 :
0 )
}
// .height(39)
.padding({
... ...
... ... @@ -5,9 +5,11 @@ import { MineAppointmentItem } from '../../../viewmodel/MineAppointmentItem';
import { LazyDataSource, StringUtils } from 'wdKit';
import MinePageDatasModel from '../../../model/MinePageDatasModel';
import { EmptyComponent } from '../../view/EmptyComponent';
import { Action } from 'wdBean/Index';
import { Action, ContentDTO } from 'wdBean/Index';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh';
import { TrackingContent, TrackConstants, TrackParamConvert, ParamType } from 'wdTracking/Index';
import { TrackingUtils } from 'wdTracking/src/main/ets/common/TrackingUtils';
const TAG = "AppointmentListUI"
... ... @@ -77,7 +79,9 @@ export struct AppointmentListUI {
AppointmentListChildComponent({ item: item })
}
.onClick(() => {
//TODO 跳转
let contentDTO = getParams(item)
TrackingContent.common(TrackConstants.EventType.Click,TrackConstants.PageName.My_Saved_Live,TrackConstants.PageName.My_Saved_Live,TrackParamConvert.program(contentDTO))
let action = {
type:"2",
params:{
... ... @@ -90,6 +94,12 @@ export struct AppointmentListUI {
} as Action
WDRouterRule.jumpWithPage(WDRouterPage.detailPlayLiveCommon, action)
})
.onVisibleAreaChange([0.0, 1.0], (isVisible: boolean, currentRatio: number) => {
if (isVisible) {
let contentDTO = getParams(item)
TrackingContent.common(TrackConstants.EventType.Show, TrackConstants.PageName.My_Saved_Live,TrackConstants.PageName.My_Saved_Live, TrackParamConvert.program(contentDTO))
}
})
}, (item: MineAppointmentItem, index: number) => index.toString())
//没有更多数据 显示提示
... ... @@ -175,4 +185,15 @@ export struct AppointmentListUI {
console.log(TAG, JSON.stringify(dealData))
return dealData
}
}
\ No newline at end of file
}
function getParams(item: MineAppointmentItem) : ContentDTO{
let contentDTO = new ContentDTO();
contentDTO.objectType = item.relType + ""
contentDTO.objectId = item.liveId + ""
contentDTO.newsTitle = item.title
// contentDTO.channelId =
// contentDTO.rmhPlatform
return contentDTO
}
\ No newline at end of file
... ...
... ... @@ -5,6 +5,7 @@ import MinePageDatasModel from '../../../model/MinePageDatasModel'
import { CommentLikeOperationRequestItem } from '../../../viewmodel/CommentLikeOperationRequestItem'
import { CommentListItem } from '../../../viewmodel/CommentListItem'
import measure from '@ohos.measure'
import { TrackingContent, TrackConstants, TrackParamConvert } from 'wdTracking/Index'
@Component
export struct ChildCommentComponent {
... ... @@ -16,6 +17,7 @@ export struct ChildCommentComponent {
@State isOverLines: boolean = false
@State isOverLinesParent: boolean = false
testText:string = "1,因为读书的人\n是低着头向上看的人\n身处一隅,却能放眼世界\n2,因为读书的人\n总是比不读书的人\n活得有趣一点\n3,因为读书的人\n即使平凡,绝不平庸"
@Link fromPage:number
build() {
Column() {
... ... @@ -195,11 +197,12 @@ export struct ChildCommentComponent {
}.height('69lpx')
.justifyContent(FlexAlign.Center)
.onClick(() => {
let content = new ContentDTO()
content.objectId = this.data.targetId;
content.relType = this.data.targetRelType + "";
content.relId = this.data.targetRelId;
content.objectType = this.data.targetType + "";
let content = getParams(this.data)
if(this.fromPage === 0 ){
TrackingContent.common(TrackConstants.EventType.Click,TrackConstants.PageName.Main_Personal,TrackConstants.PageName.Main_Personal,TrackParamConvert.program(content))
}else{
TrackingContent.common(TrackConstants.EventType.Click,TrackConstants.PageName.Customer_Personal,TrackConstants.PageName.Customer_Personal,TrackParamConvert.program(content))
}
ProcessUtils.processPage(content)
})
}
... ... @@ -284,3 +287,20 @@ function textStyle() {
.lineHeight('46lpx')
}
function getParams(item: CommentListItem) : ContentDTO{
let contentDTO = new ContentDTO();
// contentDTO.objectType = item.targetType + ""
// contentDTO.objectId = item.targetId + ""
// contentDTO.newsTitle = item.targetTitle
// contentDTO.channelId =
// contentDTO.rmhPlatform =
contentDTO.objectId = item.targetId;
contentDTO.relType = item.targetRelType + "";
contentDTO.relId = item.targetRelId;
contentDTO.objectType = item.targetType + "";
contentDTO.newsTitle = item.targetTitle
return contentDTO
}
... ...
... ... @@ -8,6 +8,8 @@ import { ChildCommentComponent } from './ChildCommentComponent';
import { MineCommentListDetailItem } from '../../../viewmodel/MineCommentListDetailItem';
import { OtherUserCommentLikeStatusRequestItem } from '../../../viewmodel/OtherUserCommentLikeStatusRequestItem';
import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh';
import { ContentDTO } from 'wdBean/Index';
import { TrackingContent, TrackConstants, TrackParamConvert } from 'wdTracking/Index';
const TAG = "HomePageBottomCommentComponent"
... ... @@ -83,9 +85,15 @@ export struct HomePageBottomCommentComponent {
ChildCommentComponent({
data: item,
levelHead: UserDataLocal.getUserLevelHeaderUrl(),
isLastItem: index === this.data_comment.totalCount() - 1
isLastItem: index === this.data_comment.totalCount() - 1,
fromPage:0
})
}
}.onVisibleAreaChange([0.0, 1.0], (isVisible: boolean, currentRatio: number) => {
if (isVisible) {
let contentDTO = getParams(item)
TrackingContent.common(TrackConstants.EventType.Show, TrackConstants.PageName.Main_Personal,TrackConstants.PageName.Main_Personal, TrackParamConvert.program(contentDTO))
}
})
}, (item: CommentListItem, index: number) => index.toString())
//没有更多数据 显示提示
... ... @@ -217,4 +225,23 @@ export struct HomePageBottomCommentComponent {
this.isGetRequest = true
})
}
}
\ No newline at end of file
}
function getParams(item: CommentListItem) : ContentDTO{
let contentDTO = new ContentDTO();
// contentDTO.objectType = item.targetType + ""
// contentDTO.objectId = item.targetId + ""
// contentDTO.newsTitle = item.targetTitle
// contentDTO.channelId =
// contentDTO.rmhPlatform =
contentDTO.objectId = item.targetId;
contentDTO.relType = item.targetRelType + "";
contentDTO.relId = item.targetRelId;
contentDTO.objectType = item.targetType + "";
contentDTO.newsTitle = item.targetTitle
return contentDTO
}
... ...
... ... @@ -8,6 +8,8 @@ import { OtherUserCommentLikeStatusRequestItem } from '../../../viewmodel/OtherU
import { ChildCommentComponent } from './ChildCommentComponent';
import { EmptyComponent } from '../../view/EmptyComponent';
import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh';
import { ContentDTO } from 'wdBean/Index';
import { TrackingContent, TrackConstants, TrackParamConvert } from 'wdTracking/Index';
const TAG = "HomePageBottomComponent"
/**
... ... @@ -84,9 +86,15 @@ export struct OtherHomePageBottomCommentComponent {
ChildCommentComponent({
data: item,
levelHead: this.levelHead,
isLastItem: index === this.data_comment.totalCount() - 1
isLastItem: index === this.data_comment.totalCount() - 1,
fromPage:1
})
}
}.onVisibleAreaChange([0.0, 1.0], (isVisible: boolean, currentRatio: number) => {
if (isVisible) {
let contentDTO = getParams(item)
TrackingContent.common(TrackConstants.EventType.Show, TrackConstants.PageName.Customer_Personal,TrackConstants.PageName.Customer_Personal, TrackParamConvert.program(contentDTO))
}
})
}, (item: CommentListItem, index: number) => index.toString())
//没有更多数据 显示提示
... ... @@ -214,4 +222,22 @@ export struct OtherHomePageBottomCommentComponent {
this.isGetRequest = true
})
}
}
\ No newline at end of file
}
function getParams(item: CommentListItem) : ContentDTO{
let contentDTO = new ContentDTO();
// contentDTO.objectType = item.targetType + ""
// contentDTO.objectId = item.targetId + ""
// contentDTO.newsTitle = item.targetTitle
// contentDTO.channelId =
// contentDTO.rmhPlatform =
contentDTO.objectId = item.targetId;
contentDTO.relType = item.targetRelType + "";
contentDTO.relId = item.targetRelId;
contentDTO.objectType = item.targetType + "";
contentDTO.newsTitle = item.targetTitle
return contentDTO
}
... ...
... ... @@ -56,7 +56,7 @@ struct PeopleShipHomePage {
.height(px2vp(this.topSafeHeight))
.width("100%")
.backgroundColor($r('app.color.white'))
.visibility(this.attentionOpacity ? 1 : 0)
.visibility(this.topOpacity > 0 ? Visibility.Visible : Visibility.None)
.opacity(this.topOpacity )
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP])
}
... ...
import { WindowModel } from 'wdKit/Index';
import { QualityCommentsComponent } from '../comment/view/QualityCommentsComponent';
@Entry
@Component
struct QualityCommentsPage {
onPageShow(): void {
WindowModel.shared.setWindowLayoutFullScreen(true)
}
onPageHide(): void {
WindowModel.shared.setWindowLayoutFullScreen(false)
}
build() {
Column(){
Column() {
QualityCommentsComponent();
}
... ...
... ... @@ -368,7 +368,6 @@ export struct TopNavigationComponent {
.alignItems(VerticalAlign.Center)
.justifyContent(FlexAlign.Center)
.onClick(() => {
TrackingButton.click("", TrackConstants.PageName.Search, "PEOPLE")
WDRouterRule.jumpWithPage(WDRouterPage.searchPage)
})
}
... ...
... ... @@ -172,7 +172,8 @@ export struct TopNavigationComponentNew {
.onClick(() => {
if (NetworkUtil.isNetConnected()) {
ProcessUtils.gotoMorningEveningPaper()
TrackingButton.click('morning_evening_news_click',TrackConstants.SummaryType.MorningAndEveningNews,TrackConstants.SummaryType.MorningAndEveningNews)
TrackingButton.click('morning_evening_news_click', TrackConstants.SummaryType.MorningAndEveningNews,
TrackConstants.SummaryType.MorningAndEveningNews)
} else {
ToastUtils.showToast('网络出小差了,请检查网络后重试', 1000)
}
... ... @@ -240,7 +241,7 @@ export struct TopNavigationComponentNew {
.width('24vp')
.height('24vp')
}
.height('40vp')
.height($r('app.float.top_tab_bar_height_common'))
.width('40vp')
.margin({ right: 10 })
.alignItems(VerticalAlign.Center)
... ... @@ -251,7 +252,9 @@ export struct TopNavigationComponentNew {
'right': { 'anchor': '__container__', 'align': HorizontalAlign.End }
})
.onClick(() => {
WDRouterRule.jumpWithPage(WDRouterPage.searchPage)
TrackingButton.searchClick(TrackConstants.PageName.Search, "PEOPLE")
let params = { 'tabName': "PEOPLE" } as Record<string, string>
WDRouterRule.jumpWithPage(WDRouterPage.searchPage, params)
})
List({ scroller: this.listScroller }) {
... ... @@ -264,9 +267,9 @@ export struct TopNavigationComponentNew {
.listDirection(Axis.Horizontal)
.scrollBar(BarState.Off)
.edgeEffect(EdgeEffect.None)
.height($r('app.float.top_tab_bar_height'))
.height($r('app.float.top_tab_bar_height_common'))
.backgroundColor(this.barBackgroundColor)
.padding({ top: 6 })
.margin({top:10})
.onAreaChange((oldValue: Area, newValue: Area) => {
let width = Number.parseFloat(newValue.width.toString())
this.tabsWidth = Number.isNaN(width) ? 0 : width
... ...
... ... @@ -97,6 +97,7 @@ export struct PeopleShipHomeArticleListComponent {
}
}
}
.cachedCount(4)
.backgroundColor(Color.Transparent)
.width("100%")
.height("100%")
... ...
... ... @@ -8,10 +8,11 @@ export struct PeopleShipHomeAttentionComponent {
Flex({ alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Button({type: ButtonType.Normal, stateEffect: false } ) {
Stack() {
Image(this.isAttention == '0'? $r('app.media.home_attention_no_left') : $r('app.media.home_attention_left'))
Row()
.width('100%')
.height('100%')
.objectFit(ImageFit.Cover)
.backgroundColor(this.isAttention == '0'? $r('app.color.color_ED2800') : $r('app.color.color_F5F5F5'))
.borderRadius("5lpx")
Row() {
if(this.isAttention == '0') {
if(this.isLoadingAttention) {
... ...
... ... @@ -78,8 +78,9 @@ export struct FirstTabTopSearchComponent {
.backgroundImage($r('app.media.background_search'))
.backgroundImageSize(ImageSize.Cover)
.onClick(() => {
TrackingButton.click("", TrackConstants.PageName.Search, "NEWS")
WDRouterRule.jumpWithPage(WDRouterPage.searchPage)
TrackingButton.searchClick( TrackConstants.PageName.Search, "NEWS")
let params = { 'tabName': "NEWS" } as Record<string, string>
WDRouterRule.jumpWithPage(WDRouterPage.searchPage,params)
})
}
}
\ No newline at end of file
... ...
import router from '@ohos.router'
import { NetworkUtil, StringUtils, ToastUtils } from 'wdKit'
import { ParamType, TrackConstants, Tracking } from 'wdTracking/Index'
import SearcherAboutDataModel from '../../model/SearcherAboutDataModel'
import { SearchHistoryItem } from '../../viewmodel/SearchHistoryItem'
import { SearchRelatedItem } from '../../viewmodel/SearchRelatedItem'
... ... @@ -30,7 +31,8 @@ export struct SearchComponent {
@State relatedSearchContentsData: SearchRelatedItem[] = []
scroller: Scroller = new Scroller()
@State count:string[] = []
@State isGetRequest:boolean = false;
@State isGetRequest:boolean = false
@Link fromTabName: string
aboutToAppear() {
//获取提示滚动
... ... @@ -175,6 +177,7 @@ export struct SearchComponent {
}
searchResData(content:string){
trackSearchClick(this.fromTabName,content)
//赋值
this.searchText = content
//保存搜索记录
... ... @@ -386,4 +389,16 @@ export struct SearchComponent {
this.isClickedInputSearch = false
this.isClickedHintSearch = false
}
}
function trackSearchClick(upOneLevelPageName: string,keyword:string){
let params: ParamType = {}
params["keyword"] = keyword
params["searchType"] = "0"
params["pageName"] = TrackConstants.PageName.Search
params["pageId"] = TrackConstants.PageName.Search
params["upOneLevelPageName"] = upOneLevelPageName
Tracking.event("search_confirm_click", params)
}
\ No newline at end of file
... ...
... ... @@ -190,12 +190,20 @@ export struct SearchResultContentComponent {
})
let isRemain : boolean = false
SearcherAboutDataModel.getCreatorDetailListData({creatorIdList:creatorIdList}).then((rem) => {
resultData.list.forEach((value) => {
resultData.list.forEach((value: SearchResultContentItem) => {
const landscape = value.data.landscape
let photos: FullColumnImgUrlDTO[] = []
// if (value.data.appStyle === 4) {
value.data.appStyleImages.split("&&").forEach((value) => {
const resizeParams = this.extractResizeParams(value)
photos.push({ fullUrl: value,weight:resizeParams.width,height:resizeParams.height, } as FullColumnImgUrlDTO)
photos.push(
{
fullUrl: value,
weight:resizeParams.width,
height:resizeParams.height,
landscape: Number(landscape),
} as FullColumnImgUrlDTO
)
})
// }
let contentDTO = this.dataTransform(rem,value, photos);
... ...
... ... @@ -213,8 +213,7 @@ export struct AccountAndSecurityLayout {
WDRouterRule.jumpWithPage(WDRouterPage.modifyPasswordPage)
}else{
//设置密码
let pageType = {'pageType': 1} as Record<string, number>;
WDRouterRule.jumpWithPage(WDRouterPage.forgetPasswordPage, pageType)
WDRouterRule.jumpWithPage(WDRouterPage.verifyPhoneNumberPage)
}
}else if (index == 3) {
trackButtonClick("accountManagementPageAccountCancellation")
... ...
... ... @@ -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, TrackingButton } from 'wdTracking/Index';
import { TrackingPageBrowse, TrackConstants, TrackingButton, ParamType, Tracking } from 'wdTracking/Index';
const TAG = "MineHomePage"
... ... @@ -251,6 +251,7 @@ struct MineHomePage {
.animationDuration(0)
.onChange((index: number) => {
this.currentIndex = index
trackTabFirstClick(index === 0 ? "评论":"关注")
})
.vertical(false)
.barHeight("77lpx")
... ... @@ -437,6 +438,7 @@ struct MineHomePage {
}.onClick(()=>{
this.currentIndex = index
this.controller.changeIndex(this.currentIndex)
trackTabFirstClick(index === 0 ? "评论":"关注")
})
.height('77lpx')
.width('70lpx')
... ... @@ -535,3 +537,12 @@ struct MineHomePage {
.lineHeight('31lpx')
}
function trackTabFirstClick(firstLevelTabName: string){
let params: ParamType = {}
params["firstLevelTabName"] = firstLevelTabName
params["pageName"] = TrackConstants.PageName.Main_Personal
params["pageId"] = TrackConstants.PageName.Main_Personal
Tracking.event("main_personal_home_page_tab_click", params)
}
... ...
import router from '@ohos.router'
import { Params } from 'wdBean';
import { DateTimeUtils, NetworkUtil, StringUtils } from 'wdKit';
import { TrackingPageBrowse, TrackConstants } from 'wdTracking/Index';
import { TrackingPageBrowse, TrackConstants, ParamType, Tracking } from 'wdTracking/Index';
import { OtherHomePageBottomCommentComponent } from '../components/mine/home/OtherHomePageBottomCommentComponent';
import { OtherHomePageBottomFollowComponent } from '../components/mine/home/OtherHomePageBottomFollowComponent';
import { CustomTitleUI } from '../components/reusable/CustomTitleUI';
... ... @@ -219,6 +219,7 @@ struct OtherNormalUserHomePage {
.animationDuration(0)
.onChange((index: number) => {
this.currentIndex = index
trackTabFirstClick(index === 0 ? "评论":"关注")
})
.vertical(false)
.barHeight('77lpx')
... ... @@ -370,6 +371,7 @@ struct OtherNormalUserHomePage {
}.onClick(()=>{
this.currentIndex = index
this.controller.changeIndex(this.currentIndex)
trackTabFirstClick(index === 0 ? "评论":"关注")
})
.height('77lpx')
.width('70lpx')
... ... @@ -448,3 +450,13 @@ struct OtherNormalUserHomePage {
.lineHeight('31lpx')
}
function trackTabFirstClick(firstLevelTabName: string){
let params: ParamType = {}
params["firstLevelTabName"] = firstLevelTabName
params["pageName"] = TrackConstants.PageName.Customer_Personal
params["pageId"] = TrackConstants.PageName.Customer_Personal
Tracking.event("customer_personal_home_page_tab_click", params)
}
... ...
import { DateTimeUtils } from 'wdKit/Index';
import { TrackingPageBrowse, TrackConstants } from 'wdTracking/Index';
import { SearchComponent } from '../components/search/SearchComponent'
import { router } from '@kit.ArkUI';
@Entry
@Component
struct SearchPage {
@State params:Record<string, string> = router.getParams() as Record<string, string>;
@State fromTabName: string = 'NEWS';
pageShowTime:number = 0;
pageHideTime:number = 0;
onPageShow() {
this.fromTabName = this.params?.['tabName'];
this.pageShowTime = DateTimeUtils.getTimeStamp()
}
... ... @@ -21,7 +25,7 @@ struct SearchPage {
build() {
Column(){
SearchComponent()
SearchComponent({fromTabName:$fromTabName})
}.height('100%')
.width('100%')
.backgroundColor($r('app.color.white'))
... ...
... ... @@ -177,9 +177,9 @@ export class ColorUtils {
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 red: number = color.red ;
const green: number = color.green ;
const blue: number = color.blue;
const max: number = Math.max(red, green, blue);
const min: number = Math.min(red, green, blue);
... ...
... ... @@ -181,6 +181,10 @@
"value": "40vp"
},
{
"name": "top_tab_bar_height_common",
"value": "44vp"
},
{
"name": "top_tab_item_max_width",
"value": "300vp"
},
... ...
... ... @@ -38,6 +38,7 @@ export struct DetailPlayLivePage {
aboutToAppear(): void {
Logger.info(TAG, `wyj-aboutToAppear`)
this.listener?.on("change", (mediaQueryResult) => {
Logger.info(TAG, `change;${mediaQueryResult.matches}`)
if (mediaQueryResult?.matches) {
... ... @@ -85,6 +86,7 @@ export struct DetailPlayLivePage {
}
.height('100%')
.width('100%')
// 设置底部绘制延伸到导航条
}
... ...
... ... @@ -17,7 +17,7 @@ const TAG: string = 'TabLiveComponent';
export struct TabLiveComponent {
liveViewModel: LiveViewModel = new LiveViewModel()
@State liveList: Array<LiveRoomItemBean> = []
@Consume liveDetailsBean: LiveDetailsBean
@Consume @Watch('updateData') liveDetailsBean: LiveDetailsBean
@State private pageModel: PageModel = new PageModel()
aboutToAppear(): void {
... ... @@ -81,6 +81,10 @@ export struct TabLiveComponent {
}
getLiveList() {
if (!this.liveDetailsBean || !this.liveDetailsBean.newsId) {
// 参数不够,直接拦截接口
return
}
this.pageModel.currentPage = 1
this.liveViewModel.getLiveList(
this.pageModel.currentPage,
... ... @@ -147,4 +151,12 @@ export struct TabLiveComponent {
aboutToDisappear(): void {
}
updateData() {
if (this.liveList.length > 0) {
// TODO 拦截刷新?根据业务斟酌下
return
}
this.getLiveList()
}
}
\ No newline at end of file
... ...
... ... @@ -21,6 +21,8 @@ export struct PlayUIComponent {
@State isPlayStatus: boolean = true
@Consume displayDirection: DisplayDirection
@Prop isShowBottom: boolean
onChangeMenuVisible() {
if (!this.liveDetailsBean || !this.liveDetailsBean.liveInfo ||
this.liveDetailsBean?.liveInfo?.liveState === 'wait') {
... ... @@ -59,7 +61,10 @@ export struct PlayUIComponent {
if (this.liveDetailsBean && this.liveDetailsBean.liveInfo) {
this.getTopUIComponent()
this.getMiddleUIComponent()
this.getBottomUIComponent()
if(this.isShowBottom){
this.getBottomUIComponent()
}
}
}
.width('100%')
... ... @@ -92,7 +97,7 @@ export struct PlayUIComponent {
.maxLines(1)
.textOverflow({ overflow: TextOverflow.MARQUEE })
.fontSize(this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? '18vp' : '16vp')
.fontWeight(this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? 600 : 500)
.fontWeight(this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? 600 : 500)
.fontColor(Color.White)
.textAlign(TextAlign.Start)
.layoutWeight(1)
... ...
import { LiveDetailsBean } from 'wdBean/Index';
import { StringUtils } from 'wdKit/Index';
import { WDAliPlayerController, WDPlayerController, WDPlayerRenderLiveView } from 'wdPlayer/Index';
import { PlayerConstants, WDAliPlayerController, WDPlayerController, WDPlayerRenderLiveView } from 'wdPlayer/Index';
import { PlayUIComponent } from './PlayUIComponent';
import { Logger } from 'wdKit/Index';
import { PictureLoading } from '../../vertical/PictureLoading';
const TAG: string = 'TopPlayComponent'
... ... @@ -16,13 +17,37 @@ export struct TopPlayComponent {
@State isWait: boolean = false
//已结束直播
@State isEnd: boolean = false
//播放错误
@State isError: boolean = false
// loading 控制字段
@State isLoading: boolean = false
// 获取播放资源能播放了
@State isCanPlay: boolean = false
private playUrl: string = ""
private xComponentIsLoaded: boolean = false
aboutToAppear(): void {
if (this.playerController) {
this.playerController.onCanplay = () => {
this.isCanPlay = true
this.isLoading = true
this.playerController?.play()
}
this.playerController.onStatusChange = (status: number) => {
if (status === PlayerConstants.STATUS_ERROR) {
this.isError = true
this.isLoading = true
this.isCanPlay = false
} else {
this.isError = false
}
}
}
this.updateData()
... ... @@ -39,6 +64,9 @@ export struct TopPlayComponent {
Logger.debug(TAG, 'ok-' + `${this.imgUrl}`)
}
this.isWait = this.liveDetailsBean?.liveInfo?.liveState == 'wait'
if(this.isWait ){
this.isLoading = true
}
this.isEnd = this.liveDetailsBean?.liveInfo?.liveState === 'end' &&
StringUtils.isEmpty(this.liveDetailsBean?.liveInfo?.vlive[0]?.replayUri)
if (!this.isWait && this.liveDetailsBean.liveInfo && this.liveDetailsBean.liveInfo.vlive.length > 0) {
... ... @@ -74,6 +102,8 @@ export struct TopPlayComponent {
WDPlayerRenderLiveView({
playerController: this.playerController,
onLoad: async () => {
this.isLoading = false
this.isError = false
this.xComponentIsLoaded = true
this.tryToPlay()
}
... ... @@ -81,18 +111,56 @@ export struct TopPlayComponent {
.height('100%')
.width('100%')
.visibility(this.isWait ? Visibility.None : Visibility.Visible)
Image(this.imgUrl)
.objectFit(ImageFit.Cover)
.visibility(this.isWait || this.isEnd ? Visibility.Visible : Visibility.None)
.contrast(this.isEnd ? 0.2 : 1)
.width('100%')
PlayUIComponent({ playerController: this.playerController })
PictureLoading().visibility(this.isLoading ? Visibility.None : Visibility.Visible)
// 视频播放器上的控制面板和信息
PlayUIComponent({ playerController: this.playerController, isShowBottom: this.isCanPlay })
Text('直播已结束')
.fontSize('20fp')
.fontWeight(500)
.fontColor(Color.White)
.visibility(this.isEnd ? Visibility.Visible :
Visibility.None)
Column() {
Text('直播加载中,请稍候重试')
.fontSize('20fp')
.fontWeight(500)
.margin({ top: 16 })
.fontColor(Color.White)
Button('点击重试')
.type(ButtonType.Normal)
.width(80)
.height(28)
.backgroundColor(Color.Transparent)
.fontColor('#ffcccccc')
.border({ width: 1 })
.borderColor('#4dffffff')
.borderRadius(4)
.fontSize($r('app.float.font_size_12'))
.margin({ top: 16 })
.padding(0)
.onClick(() => {
this.isLoading = false
this.isError = false
this.xComponentIsLoaded = true
this.tryToPlay()
})
}.width('100%').visibility(this.isError ? Visibility.Visible :
Visibility.None)
}
.width('100%')
.alignSelf(ItemAlign.Center)
... ...
... ... @@ -13,6 +13,11 @@ export struct PictureLoading {
Logger.info(TAG, 'pictures preview')
}
aboutToDisappear(): void {
Logger.info(TAG, 'aboutToDisappear')
}
build() {
Row() {
Image(this.imagePath)
... ...
... ... @@ -79,6 +79,7 @@ export struct PlayerComponent {
playerController: this.playerController,
onLoad: () => {
this.isCanplay = true
console.error('WDAliPlayerController','------1------------')
this.playerController?.firstPlay(this.playUrl);
}
}).margin({ top: 195 }).height(211)
... ...
export { add } from "./src/main/ets/utils/Calc"
export { SettingPasswordParams } from "./src/main/ets/pages/login/SettingPasswordLayout"
export { SettingPasswordParams } from "./src/main/ets/pages/login/SettingPasswordPage"
export { LoginModule } from './src/main/ets/LoginModule'
\ No newline at end of file
... ...
... ... @@ -3,7 +3,7 @@ import { LoginInputComponent } from './LoginInputComponent'
import { LoginViewModel } from './LoginViewModel'
import router from '@ohos.router'
import { WDRouterRule, WDRouterPage } from 'wdRouter';
import { SettingPasswordParams } from './SettingPasswordLayout'
import { SettingPasswordParams } from './SettingPasswordPage'
import { Router } from '@ohos.arkui.UIContext'
import { CustomToast, EmitterEventId, EmitterUtils, NetworkUtil, SPHelper, StringUtils, ToastUtils } from 'wdKit/Index'
import { SpConstants } from 'wdConstant/Index'
... ... @@ -22,7 +22,6 @@ struct ForgetPasswordPage {
@State isSubmit: boolean = false //是否可以提交 默认不可以
loginViewModel: LoginViewModel = new LoginViewModel()
@State @Watch('onCodeSend') isCodeSend: boolean = false //验证码点击发送事件
pageType:number = (router.getParams() as Record<string, number>)['pageType']; //0、登录->忘记密码 1、设置->重置密码 3、设置->更换手机号页面2(不知道是啥)
phone:string = (router.getParams() as Record<string, number>)['phone'] + ""; //登录 密码登录 填写手机号 点击忘记密码 带过来手机号
@State pageTitle:string = '找回密码';
@State codeStateSuccess:boolean=false
... ... @@ -57,7 +56,7 @@ struct ForgetPasswordPage {
codeContent: $codeContent,
isSubmit: $isSubmit,
isCodeSend: $isCodeSend,
pageType:this.pageType,
pageType:0,
codeStateSuccess:$codeStateSuccess
})
Row() {
... ... @@ -81,21 +80,8 @@ struct ForgetPasswordPage {
}
aboutToAppear() {
if (router.getParams()) {
let params = router.getParams() as Record<string, number>
this.pageType = params['pageType']
Logger.info(TAG, 'params.contentID:' + params.contentID);
}
if (this.pageType == 0){
this.pageTitle = '找回密码'
if(StringUtils.isNotEmpty(this.phone) && this.phone.indexOf("****") === -1){
this.phoneContent = this.phone
}
}else if (this.pageType == 1){
this.pageTitle = '验证当前手机号'
}
if (this.isCodeSend) {
this.sendVerifyCode()
if(StringUtils.isNotEmpty(this.phone) && this.phone.indexOf("****") === -1){
this.phoneContent = this.phone
}
}
... ... @@ -105,20 +91,7 @@ struct ForgetPasswordPage {
return
}
if(this.pageType == 1){
this.loginViewModel.sendVerifyCodeByToken().then(()=>{
this.showToastTip("已发送")
this.codeStateSuccess=true
this.isCodeSend=false
}).catch((message: string)=>{
this.showToastTip(message)
this.codeStateSuccess=false
this.isCodeSend=false
})
return
}
if(this.pageType == 0 && this.phoneContent.indexOf("****")!=-1){
if(this.phoneContent.indexOf("****")!=-1){
//设置密码 忘记密码跳转过来的 需要使用上面方法
this.loginViewModel.sendVerifyCodeByToken().then(()=>{
this.showToastTip("已发送")
... ... @@ -168,22 +141,8 @@ struct ForgetPasswordPage {
if (this.isEmpty(this.codeContent)) {
return
}
if(this.pageType == 1){
this.loginViewModel.checkVerifyCodeByToken(this.codeContent).then(()=>{
let params: SettingPasswordParams = {
pageID:'1',
phoneContent:this.phoneContent,
codeContent:this.codeContent,
pageType:this.pageType
}
WDRouterRule.jumpWithPage(WDRouterPage.settingPasswordPage, params)
}).catch((message: string)=>{
this.showToastTip(message)
})
return
}
if(this.pageType == 0 && this.phoneContent.indexOf("****")!=-1){
if(this.phoneContent.indexOf("****")!=-1){
this.loginViewModel.checkVerifyCodeByToken(this.codeContent).then(()=>{
let params: SettingPasswordParams = {
pageID:'1',
... ... @@ -203,7 +162,7 @@ struct ForgetPasswordPage {
pageID:'1',
phoneContent:this.phoneContent,
codeContent:this.codeContent,
pageType:this.pageType
pageType:0
}
WDRouterRule.jumpWithReplacePage(WDRouterPage.settingPasswordPage, params)
... ... @@ -218,53 +177,6 @@ struct ForgetPasswordPage {
return (obj == undefined || obj == null || obj == '');
}
changeBindPhone(){
if (!this.isSubmit) {
return
}
if (this.isEmpty(this.phoneContent)) {
return
}
if (this.isEmpty(this.codeContent)) {
return
}
this.loginViewModel.changeBindPhone(this.phoneContent,this.codeContent).then(()=>{
ToastUtils.shortToast('绑定成功')
this.querySecurity()
}).catch((message: string) => {
if (message != '') {
ToastUtils.shortToast(message)
}
})
}
querySecurity(){
this.loginViewModel.querySecurity().then(()=>{
SPHelper.default.save(SpConstants.USER_PHONE,this.phoneContent)
this.sendEmitEvent()
router.back()
}).catch(()=>{
})
}
sendEmitEvent(){
// 定义一个eventId为1的事件,事件优先级为Low
let event: emitter.InnerEvent = {
eventId: EmitterEventId.PHONE_CHANGE_SUCCESS,
priority: emitter.EventPriority.LOW
};
let eventData: emitter.EventData = {
data: {
content: this.phoneContent,
}
};
// 发送eventId为1的事件,事件内容为eventData
emitter.emit(event, eventData);
}
showToastTip(msg:string){
this.toastText = msg
this.dialogToast.open()
... ...
... ... @@ -10,7 +10,7 @@ export struct LoginInputComponent {
@Link isCodeSend: boolean //验证码控件是否点击 默认没有 发送接口
@Link isSubmit: boolean //是否可以提交
isFirst:boolean=true//是否第一次获取验证码
pageType?:number; //0、登录->忘记密码 1、设置->重置密码 3、设置->更换手机号页面2
pageType?:number; //0、登录->忘记密码
lastTime: number = 0
@Link @Watch('startCount') codeStateSuccess: boolean //验证码获取成功与否回调 成功显示倒计时
@Watch('onCheckChange') @Prop protocolState: boolean = false //协议勾选状态
... ... @@ -33,9 +33,6 @@ export struct LoginInputComponent {
}
async aboutToAppear(){
if (this.pageType == 1 ) {
this.phoneContent = await SPHelper.default.get(SpConstants.USER_PHONE,"") as string;
}
if(this.pageType == 0 ){
let phone = await SPHelper.default.get(SpConstants.USER_PHONE,"") as string
if(StringUtils.isNotEmpty(phone)){
... ... @@ -43,29 +40,9 @@ export struct LoginInputComponent {
}
}
}
@Builder
addCodeLayout() {
if (this.pageType == 1){
TextInput({ text: this.securityPhone(this.phoneContent) })
.placeholderColor("#CCCCCC")
.fontSize(16)
.height(48)
.maxLength(11)
.margin({ top: 36 })
.backgroundColor("#F5F5F5")
.borderRadius(4)
.enabled(false)
.type(InputType.PhoneNumber)
.onChange((content) => {
this.phoneContent = content
this.isSubmit = (this.phoneContent.length >= 11 && this.codeContent.length >= 4)
if (content.length >= 11) {
this.codeBtnState = true
} else {
this.codeBtnState = false
}
})
}else{
//修改密码 里面的 忘记密码(已登录)
if(StringUtils.isNotEmpty(this.phoneContent) && this.phoneContent.indexOf("****")!=-1 && this.pageType == 0){
TextInput({ text: this.securityPhone(this.phoneContent) })
... ... @@ -115,7 +92,6 @@ export struct LoginInputComponent {
}
})
}
}
Row() {
... ...
... ... @@ -177,11 +177,10 @@ struct LoginPage {
.onClick(() => {
TrackingButton.click("loginPageForgotPassword",TrackConstants.PageName.Login_Page,TrackConstants.PageName.Login_Page)
if(StringUtils.isNotEmpty(this.accountContent) && StringUtils.photoMatch(this.accountContent)){
let pageType = { 'pageType': 0, 'phone': Number(this.accountContent) } as Record<string, number>;
let pageType = { 'phone': Number(this.accountContent) } as Record<string, number>;
WDRouterRule.jumpWithPage(WDRouterPage.forgetPasswordPage, pageType)
}else{
let pageType = { 'pageType': 0 } as Record<string, number>;
WDRouterRule.jumpWithPage(WDRouterPage.forgetPasswordPage, pageType)
WDRouterRule.jumpWithPage(WDRouterPage.forgetPasswordPage)
}
})
}
... ... @@ -378,6 +377,7 @@ struct LoginPage {
TrackingButton.click("loginPageLoginButton",TrackConstants.PageName.Phone_Login_Page,TrackConstants.PageName.Phone_Login_Page)
this.loginViewModel.appLogin(this.phoneContent, 2, this.codeContent).then((data) => {
Logger.debug(TAG, "requestLogin: " + data.jwtToken)
this.showToastTip('登录成功')
///同步兴趣tag
let interestsModel = new InterestsHobbiesModel()
interestsModel.updateInterests()
... ...
... ... @@ -29,10 +29,12 @@ struct LoginProtocolWebview {
this.contentID = params.contentID
}
if (params.contentID == "1") { //"人民日报客户端网络服务使用协议"
this.webUrl = this.userProtocol
this.webUrl = await SPHelper.default.get(SpConstants.NET_SERVICE_PROTOCOL, this.userProtocol) as string
this.webviewController.loadUrl(this.webUrl)
} else if(params.contentID == "2"){ //"人民日报客户端用户隐私协议"
this.webUrl = this.privateProtocol
this.webUrl = await SPHelper.default.get(SpConstants.PRIVATE_PROTOCOL, this.privateProtocol) as string
this.webviewController.loadUrl(this.webUrl)
}else if(params.contentID == "3"){ //注销协议
... ...
... ... @@ -166,8 +166,7 @@ struct ModifyPasswordPage {
Column() {
Text("忘记密码").fontSize(12).maxLines(3).fontColor(0x999999).padding({top:'10lpx'})
.onClick(()=>{
let pageType = { 'pageType': 0 } as Record<string, number>;
WDRouterRule.jumpWithPage(WDRouterPage.forgetPasswordPage, pageType)
WDRouterRule.jumpWithPage(WDRouterPage.forgetPasswordPage)
})
}
.width('100%')
... ...
import ArrayList from '@ohos.util.ArrayList';
import { Params } from '../../../../../../../commons/wdRouter/oh_modules/wdBean/Index';
import router from '@ohos.router';
import { LoginViewModel } from './LoginViewModel';
import { CustomToast, Logger, SPHelper, ToastUtils } from 'wdKit';
import {
SpConstants
} from '../../../../../../../commons/wdNetwork/oh_modules/wdConstant/src/main/ets/constants/SpConstants'
import data_preferences from '@ohos.data.preferences';
import { WDRouterPage, WDRouterRule } from 'wdRouter';
const TAG = "SettingPasswordLayout"
export interface SettingPasswordParams {
pageID: string;
phoneContent?: string;
codeContent?: string;
tempToken?:string;
pageType?:number; //0、登录->忘记密码 1、设置->重置密码 2、设置->更换手机号页面1 3、设置->更换手机号页面2
}
export default class AccoutPageDataModel {
// 页面数据
compType: number // 0:标题 / 1:密码输入框 / 2:验证码输入框 / 3:desc描述 / 4:按钮 / 5:logo / 6:子标题 7:手机号输入框 7:空白
compLogo: string
compTitle: string
compSubTitle: string = '';
compDesc: string
compButtonTitle: string
inputPlacholder: string
inputTag: number
constructor(compType: number, compTitle: string, compLogo: string, compDesc: string, compButtonTitle: string, inputPlacholder: string, inputTag: number) {
this.compType = compType
this.compTitle = compTitle
this.compLogo = compLogo
this.compDesc = compDesc
this.compButtonTitle = compButtonTitle
this.inputPlacholder = inputPlacholder
this.inputTag = inputTag
}
}
@Entry
@Component
export struct SettingPasswordLayout {
@State listData: Array<AccoutPageDataModel> = new Array(); // 页面配置数据
@State btnStatus: boolean = false;
pageId:number = 0;
phoneContent:string = '';
codeContent:string = '';
tempToken:string = '';
password01: string = '';
password02: string = '';
passwordOri: string = '';
loginViewModel = new LoginViewModel()
pageType?:number; //0、登录->忘记密码 1、设置->重置密码 2、设置->更换手机
@State toastText:string = ""
dialogToast: CustomDialogController = new CustomDialogController({
builder: CustomToast({
msg: this.toastText,
}),
autoCancel: false,
alignment: DialogAlignment.Center,
customStyle: true,
maskColor:"#00000000"
})
aboutToAppear() {
let params:SettingPasswordParams = router.getParams() as SettingPasswordParams;
this.pageId = parseInt(params.pageID);
this.getPageListData(this.pageId)
this.phoneContent = params.phoneContent!;
this.codeContent = params.codeContent!;
this.pageType = params.pageType;
}
getPageListData(pageId:number) {
switch (pageId) {
case 0:
// 验证/更换手机号
this.listData.push(new AccoutPageDataModel(0, '更换手机号', '', '', '', '', 0))
this.listData.push(new AccoutPageDataModel(7, '', '', '', '', '请输入手机号', 10010))
this.listData.push(new AccoutPageDataModel(2, '', '', '', '', '验证码', 10088))
this.listData.push(new AccoutPageDataModel(4, '', '', '', '确认', '', 0))
break;
case 1:
// 设置密码
this.listData.push(new AccoutPageDataModel(0, '设置密码', '', '', '', '', 0))
this.listData.push(new AccoutPageDataModel(1, '', '', '', '', '请输入密码', 10086))
this.listData.push(new AccoutPageDataModel(1, '', '', '', '', '再次输入密码', 10087))
this.listData.push(new AccoutPageDataModel(3, '', '', '提示:密码长度6~20位,使用大写字母、小写字母、数字、特殊字符中三种或三种以上', '', '', 0))
this.listData.push(new AccoutPageDataModel(4, '', '', '', '确认', '', 0))
break;
case 2:
// 修改密码
this.listData.push(new AccoutPageDataModel(0, '修改密码', '', '', '', '', 0))
this.listData.push(new AccoutPageDataModel(1, '', '', '', '', '请输入原密码', 10010))
this.listData.push(new AccoutPageDataModel(1, '', '', '', '', '请输入新密码', 10086))
this.listData.push(new AccoutPageDataModel(1, '', '', '', '', '请再请输入原密码', 10087))
this.listData.push(new AccoutPageDataModel(3, '', '', '提示:密码长度6~20位,使用大写字母、小写字母、数字、特殊字符中三种或三种以上', '', '', 0))
this.listData.push(new AccoutPageDataModel(4, '', '', '', '确认', '', 0))
this.listData.push(new AccoutPageDataModel(3, '', '', '忘记密码', '', '', 0))
break;
case 3:
// 绑定手机号
this.listData.push(new AccoutPageDataModel(0, '绑定手机号', '', '', '', '', 0))
this.listData.push(new AccoutPageDataModel(7, '', '', '', '', '请输入手机号', 10010))
this.listData.push(new AccoutPageDataModel(2, '', '', '', '', '验证码', 10088))
this.listData.push(new AccoutPageDataModel(4, '', '', '', '确认', '', 0))
break;
case 4:
// 有logo的
this.listData.push(new AccoutPageDataModel(5, '', '', '', '', '' , 0))
this.listData.push(new AccoutPageDataModel(0, '修改密码', '', '', '', '', 0))
this.listData.push(new AccoutPageDataModel(1, '', '', '', '', '请输入原密码', 10010))
this.listData.push(new AccoutPageDataModel(1, '', '', '', '', '请输入新密码', 10086))
this.listData.push(new AccoutPageDataModel(1, '', '', '', '', '请再请输入原密码', 10087))
this.listData.push(new AccoutPageDataModel(2, '', '', '', '', '验证码', 10088))
this.listData.push(new AccoutPageDataModel(3, '', '', '提示:密码长度6~20位,使用大写字母、小写字母、数字、特殊字符中三种或三种以上', '', '', 0))
this.listData.push(new AccoutPageDataModel(4, '', '', '', '确认', '', 0))
this.listData.push(new AccoutPageDataModel(3, '', '', '忘记密码', '', '', 0))
break;
default:
break;
}
}
build() {
Navigation() {
this.settingList() //滑动区域
}.titleMode(NavigationTitleMode.Mini)
.title('')
}
// 页面布局
@Builder settingList() {
Column() {
List() {
ForEach(this.listData, (item: AccoutPageDataModel, index: number) => {
ListItem() {
if (item.compType == 0) {
this.getTitleCell(item, HorizontalAlign.Start)
} else if (item.compType == 1) {
this.getPasswordCell(item)
} else if (item.compType == 2) {
this.getCodeCell(item)
} else if (item.compType == 3) {
if (index == this.listData.length - 1) {
this.getDescCell(item, HorizontalAlign.Center)
} else {
this.getDescCell(item, HorizontalAlign.Start)
}
} else if (item.compType == 4) {
this.getButtonCell(item)
} else if (item.compType == 5) {
this.getLogoCell(item)
} else if (item.compType == 7) {
this.getPhoneCell(item)
} else {
Text('' + item.compType)
}
}
})
}
// .divider({
// strokeWidth: 1,
// startMargin: 15,
// endMargin: 10,
// color: '#f0f0f0'
// })
}.width('100%').padding('30lpx')
}
/***************************** UI元素 ******************************************/
// 标题
@Builder getTitleCell(item: AccoutPageDataModel, alignTitle: HorizontalAlign) {
Column() {
Text(item.compTitle).fontWeight(FontWeight.Bold).fontSize(20).maxLines(1)
}
.width('100%')
.height('75lpx')
.alignItems(alignTitle)
}
// 密码输入框
@Builder getPasswordCell(item: AccoutPageDataModel) {
Row() {
Row() {
TextInput({ placeholder: item.inputPlacholder })
.placeholderColor("#CCCCCC")
.passwordIcon({onIconSrc:$r("app.media.login_password_on"),offIconSrc:$r("app.media.login_password_off")})
.type(InputType.Password)
.showPasswordIcon(true)
.backgroundColor('#00000000')
.onChange((value: string) => {
this.inputTextChange(value, item.inputTag)
})
.onSubmit((EnterKeyType) => {
this.showToastTip('submit')
})
}
.alignItems(VerticalAlign.Center)
.height('80lpx')
.backgroundColor('#f5f5f5')
.borderRadius('4vp')
}
.width('100%')
.height('110lpx')
.backgroundColor(0xffffff0)
.alignItems(VerticalAlign.Center)
}
// 手机号输入框
@Builder getPhoneCell(item: AccoutPageDataModel) {
Row() {
Row() {
TextInput({ placeholder: item.inputPlacholder })
.placeholderColor("#CCCCCC")
.backgroundColor('#00000000')
.onChange((value: string) => {
this.inputTextChange(value, item.inputTag)
})
.onSubmit((EnterKeyType) => {
this.showToastTip('submit')
})
}
.alignItems(VerticalAlign.Center)
.height('80lpx')
.backgroundColor('#f5f5f5')
.borderRadius('4vp')
}
.width('100%')
.height('110lpx')
.backgroundColor(0xffffff0)
.alignItems(VerticalAlign.Center)
}
// 验证码码输入框
@Builder getCodeCell(item: AccoutPageDataModel) {
Row() {
Stack() {
Image($r('app.media.get_code_bg')).width('100%').borderRadius('4vp')
Row() {
TextInput({ placeholder: item.inputPlacholder })
.placeholderColor("#CCCCCC")
.backgroundColor('#00000000')
.width('67.28%')
.onChange((value: string) => {
this.inputTextChange(value, item.inputTag)
})
Button('发送验证码')
.width('32.71%')
.backgroundColor('#00000000')
.fontColor('#da3e22')
}
.width('100%')
}.height('80lpx')
}
.width('100%')
.height('110lpx')
.backgroundColor(0xffffff0)
.alignItems(VerticalAlign.Center)
}
// desc
@Builder getDescCell(item: AccoutPageDataModel, alignTitle: HorizontalAlign) {
Column() {
Text(item.compDesc).fontSize(12).maxLines(3).fontColor(0x999999).padding({top:'10lpx'})
.onClick(()=>{
if (item.compDesc == '忘记密码') {
this.showToastTip('密码不符合密码规范')
}
})
}
.width('100%')
.height('85lpx')
.alignItems(alignTitle)
}
// 按钮
@Builder getButtonCell(item: AccoutPageDataModel) {
Row() {
Button(item.compButtonTitle, { type: ButtonType.Normal, stateEffect: true })
.width('100%')
.height('80lpx')
.backgroundColor(this.btnStatus ? '#da3e22' : '#e5856d')
.fontColor('#fff')
.borderRadius('4vp')
.onClick(() => {
this.buttonClick()
})
}
.padding({top:'25lpx'})
.alignItems(VerticalAlign.Center)
.width('100%')
.height('120lpx')
}
// 标题
@Builder getLogoCell(item: AccoutPageDataModel) {
Column() {
Image(item.compLogo).height('150lpx').width('150lpx')
}
.width('100%')
.height('200lpx')
}
/***************************** 事件处理 ******************************************/
// 提交按钮点击事件
async buttonClick() {
if (this.btnStatus) {
// 需要+手机号校验
if (this.password01.length < 6 || this.password01.length > 20) {
this.showToastTip('密码不符合密码规范')
return
}
if (this.password01 != this.password02) {
this.showToastTip('两次输入的密码不一致,请重新输入')
return
}
if(this.pageId == 1){ //设置密码
SPHelper.default.get(SpConstants.USER_TEMP_TOKEN, '').then((str) => {
this.loginViewModel.forgotPassword(this.password01, str.toString()).then((data =>{
if (this.pageType == 0) {//登录页
this.showToastTip("修改成功")
router.back({
url: `${WDRouterPage.getLoginBundleInfo()}`
})
}else if(this.pageType == 1){//设置
let params: Params = {
pageID: 'AccountAndSecurityLayout'
}
this.showToastTip("修改成功")
router.back({
params:params,
url: `${WDRouterPage.getSettingBundleInfo()}`
})
// WDRouterRule.jumpWithPage(WDRouterPage.settingPage, params)
}
}))
.catch((err: string) => {
this.showToastTip(err)
});
}).catch((err: string) => {
this.showToastTip(err)
Logger.error(TAG, 'catch err:' + JSON.stringify(err));
});
}
}
}
// 输入框数据变动:输入数据处理
inputTextChange(text: string, tag: number) {
if (tag == 10086) {
this.password01 = text;
} else if (tag == 10087) {
this.password02 = text;
} else {
this.passwordOri = text;
}
if (this.password01) {
if ((this.password01.length >= 6 && this.password01.length <= 20) && (this.password02.length >= 6 && this.password02.length <= 20)) {
this.btnStatus = true;
} else {
this.btnStatus = false;
}
}
}
showToastTip(msg:string){
this.toastText = msg
this.dialogToast.open()
}
}
import { SettingPasswordLayout } from './SettingPasswordLayout';
import ArrayList from '@ohos.util.ArrayList';
import { Params } from '../../../../../../../commons/wdRouter/oh_modules/wdBean/Index';
import router from '@ohos.router';
import { LoginViewModel } from './LoginViewModel';
import { CustomToast, DateTimeUtils, Logger, SPHelper, ToastUtils } from 'wdKit';
import {
SpConstants
} from '../../../../../../../commons/wdNetwork/oh_modules/wdConstant/src/main/ets/constants/SpConstants'
import data_preferences from '@ohos.data.preferences';
import { WDRouterPage, WDRouterRule } from 'wdRouter';
import { TrackingPageBrowse, TrackConstants, TrackingButton } from 'wdTracking/Index';
const TAG = "SettingPasswordLayout"
export interface SettingPasswordParams {
pageID: string;
phoneContent?: string;
codeContent?: string;
tempToken?:string;
pageType?:number; //0、登录->忘记密码 1、设置->重置密码
}
export default class AccoutPageDataModel {
// 页面数据
compType: number // 0:标题 / 1:密码输入框 / 2:验证码输入框 / 3:desc描述 / 4:按钮 / 5:logo / 6:子标题 7:手机号输入框 7:空白
compLogo: string
compTitle: string
compSubTitle: string = '';
compDesc: string
compButtonTitle: string
inputPlacholder: string
inputTag: number
constructor(compType: number, compTitle: string, compLogo: string, compDesc: string, compButtonTitle: string, inputPlacholder: string, inputTag: number) {
this.compType = compType
this.compTitle = compTitle
this.compLogo = compLogo
this.compDesc = compDesc
this.compButtonTitle = compButtonTitle
this.inputPlacholder = inputPlacholder
this.inputTag = inputTag
}
}
@Entry
@Component
struct SettingPasswordPage {
@State message: string = 'Hello World'
export struct SettingPasswordPage {
@State listData: Array<AccoutPageDataModel> = new Array(); // 页面配置数据
@State btnStatus: boolean = false;
pageId:number = 0;
phoneContent:string = '';
codeContent:string = '';
tempToken:string = '';
password01: string = '';
password02: string = '';
passwordOri: string = '';
loginViewModel = new LoginViewModel()
pageType?:number; //0、登录->忘记密码 1、设置->重置密码
@State toastText:string = ""
dialogToast: CustomDialogController = new CustomDialogController({
builder: CustomToast({
msg: this.toastText,
}),
autoCancel: false,
alignment: DialogAlignment.Center,
customStyle: true,
maskColor:"#00000000"
})
pageShowResetTime:number = 0;
pageHideResetTime:number = 0;
pageShowSetTime:number = 0;
pageHideSetTime:number = 0;
onPageShow(): void {
if (this.pageType === 0){//重置密码
this.pageShowResetTime = DateTimeUtils.getTimeStamp()
}else{
this.pageShowSetTime = DateTimeUtils.getTimeStamp()
}
}
onPageHide(): void {
if (this.pageType === 0){
this.pageHideResetTime = DateTimeUtils.getTimeStamp()
}else{
this.pageHideSetTime = DateTimeUtils.getTimeStamp()
}
let duration = 0
if(this.pageType === 0){
duration = Math.floor((this.pageHideResetTime - this.pageShowResetTime)/1000)
}else{
duration = Math.floor((this.pageHideSetTime - this.pageShowSetTime)/1000)
}
if(this.pageType === 0){
TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Reset_Password,TrackConstants.PageName.Reset_Password,duration)
}else{
TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Setup_Passwd,TrackConstants.PageName.Setup_Passwd,duration)
}
}
aboutToAppear() {
let params:SettingPasswordParams = router.getParams() as SettingPasswordParams;
this.pageId = parseInt(params.pageID);
this.getPageListData(this.pageId)
this.phoneContent = params.phoneContent!;
this.codeContent = params.codeContent!;
this.pageType = params.pageType;
}
getPageListData(pageId:number) {
switch (pageId) {
case 0:
break;
case 1:
// 设置密码
this.listData.push(new AccoutPageDataModel(0, '设置密码', '', '', '', '', 0))
this.listData.push(new AccoutPageDataModel(1, '', '', '', '', '请输入密码', 10086))
this.listData.push(new AccoutPageDataModel(1, '', '', '', '', '再次输入密码', 10087))
this.listData.push(new AccoutPageDataModel(3, '', '', '提示:密码长度6~20位,使用大写字母、小写字母、数字、特殊字符中三种或三种以上', '', '', 0))
this.listData.push(new AccoutPageDataModel(4, '', '', '', '确认', '', 0))
break;
case 2:
break;
case 3:
break;
case 4:
break;
}
}
build() {
Navigation() {
this.settingList() //滑动区域
}.titleMode(NavigationTitleMode.Mini)
.title('')
}
// 页面布局
@Builder settingList() {
Column() {
List() {
ForEach(this.listData, (item: AccoutPageDataModel, index: number) => {
ListItem() {
if (item.compType == 0) {
this.getTitleCell(item, HorizontalAlign.Start)
} else if (item.compType == 1) {
this.getPasswordCell(item)
} else if (item.compType == 2) {
this.getCodeCell(item)
} else if (item.compType == 3) {
if (index == this.listData.length - 1) {
this.getDescCell(item, HorizontalAlign.Center)
} else {
this.getDescCell(item, HorizontalAlign.Start)
}
} else if (item.compType == 4) {
this.getButtonCell(item)
} else if (item.compType == 5) {
this.getLogoCell(item)
} else if (item.compType == 7) {
this.getPhoneCell(item)
} else {
Text('' + item.compType)
}
}
})
}
}.width('100%')
.padding('30lpx')
.height('100%')
}
/***************************** UI元素 ******************************************/
// 标题
@Builder getTitleCell(item: AccoutPageDataModel, alignTitle: HorizontalAlign) {
Column() {
Text(item.compTitle).fontWeight(FontWeight.Bold).fontSize(20).maxLines(1)
}
.width('100%')
.height('75lpx')
.alignItems(alignTitle)
}
// 密码输入框
@Builder getPasswordCell(item: AccoutPageDataModel) {
Row() {
Column() {
SettingPasswordLayout()
Row() {
TextInput({ placeholder: item.inputPlacholder })
.placeholderColor("#CCCCCC")
.passwordIcon({onIconSrc:$r("app.media.login_password_on"),offIconSrc:$r("app.media.login_password_off")})
.type(InputType.Password)
.showPasswordIcon(true)
.backgroundColor('#00000000')
.onChange((value: string) => {
this.inputTextChange(value, item.inputTag)
})
.onSubmit((EnterKeyType) => {
this.showToastTip('submit')
})
}
.width('100%')
.alignItems(VerticalAlign.Center)
.height('80lpx')
.backgroundColor('#f5f5f5')
.borderRadius('4vp')
}
.height('100%')
.width('100%')
.height('110lpx')
.backgroundColor(0xffffff0)
.alignItems(VerticalAlign.Center)
}
// 手机号输入框
@Builder getPhoneCell(item: AccoutPageDataModel) {
Row() {
Row() {
TextInput({ placeholder: item.inputPlacholder })
.placeholderColor("#CCCCCC")
.backgroundColor('#00000000')
.onChange((value: string) => {
this.inputTextChange(value, item.inputTag)
})
.onSubmit((EnterKeyType) => {
this.showToastTip('submit')
})
}
.alignItems(VerticalAlign.Center)
.height('80lpx')
.backgroundColor('#f5f5f5')
.borderRadius('4vp')
}
.width('100%')
.height('110lpx')
.backgroundColor(0xffffff0)
.alignItems(VerticalAlign.Center)
}
// 验证码码输入框
@Builder getCodeCell(item: AccoutPageDataModel) {
Row() {
Stack() {
Image($r('app.media.get_code_bg')).width('100%').borderRadius('4vp')
Row() {
TextInput({ placeholder: item.inputPlacholder })
.placeholderColor("#CCCCCC")
.backgroundColor('#00000000')
.width('67.28%')
.onChange((value: string) => {
this.inputTextChange(value, item.inputTag)
})
Button('发送验证码')
.width('32.71%')
.backgroundColor('#00000000')
.fontColor('#da3e22')
}
.width('100%')
}.height('80lpx')
}
.width('100%')
.height('110lpx')
.backgroundColor(0xffffff0)
.alignItems(VerticalAlign.Center)
}
// desc
@Builder getDescCell(item: AccoutPageDataModel, alignTitle: HorizontalAlign) {
Column() {
Text(item.compDesc).fontSize(12).maxLines(3).fontColor(0x999999).padding({top:'10lpx'})
.onClick(()=>{
if (item.compDesc == '忘记密码') {
this.showToastTip('密码不符合密码规范')
}
})
}
.width('100%')
.height('85lpx')
.alignItems(alignTitle)
}
// 按钮
@Builder getButtonCell(item: AccoutPageDataModel) {
Row() {
Button(item.compButtonTitle, { type: ButtonType.Normal, stateEffect: true })
.width('100%')
.height('80lpx')
.backgroundColor(this.btnStatus ? '#da3e22' : '#e5856d')
.fontColor('#fff')
.borderRadius('4vp')
.onClick(() => {
this.buttonClick()
})
}
.padding({top:'25lpx'})
.alignItems(VerticalAlign.Center)
.width('100%')
.height('120lpx')
}
// 标题
@Builder getLogoCell(item: AccoutPageDataModel) {
Column() {
Image(item.compLogo).height('150lpx').width('150lpx')
}
.width('100%')
.height('200lpx')
}
}
\ No newline at end of file
/***************************** 事件处理 ******************************************/
// 提交按钮点击事件
async buttonClick() {
if (this.btnStatus) {
if(this.pageType === 0){
TrackingButton.click("resetPasswordPageConfirmButton",TrackConstants.PageName.Reset_Password,TrackConstants.PageName.Reset_Password)
}else{
TrackingButton.click("setPasswordPageConfirm",TrackConstants.PageName.Setup_Passwd,TrackConstants.PageName.Setup_Passwd)
}
// 需要+手机号校验
if (this.password01.length < 6 || this.password01.length > 20) {
this.showToastTip('密码不符合密码规范')
return
}
if (this.password01 != this.password02) {
this.showToastTip('两次输入的密码不一致,请重新输入')
return
}
if(this.pageId == 1){ //设置密码
SPHelper.default.get(SpConstants.USER_TEMP_TOKEN, '').then((str) => {
this.loginViewModel.forgotPassword(this.password01, str.toString()).then((data =>{
if (this.pageType == 0) {//登录页
this.showToastTip("修改成功")
router.back({
url: `${WDRouterPage.getLoginBundleInfo()}`
})
}else if(this.pageType == 1){//设置
let params: Params = {
pageID: 'AccountAndSecurityLayout'
}
this.showToastTip("修改成功")
router.back({
params:params,
url: `${WDRouterPage.getSettingBundleInfo()}`
})
}
}))
.catch((err: string) => {
this.showToastTip(err)
});
}).catch((err: string) => {
this.showToastTip(err)
Logger.error(TAG, 'catch err:' + JSON.stringify(err));
});
}
}
}
// 输入框数据变动:输入数据处理
inputTextChange(text: string, tag: number) {
if (tag == 10086) {
this.password01 = text;
} else if (tag == 10087) {
this.password02 = text;
} else {
this.passwordOri = text;
}
if (this.password01) {
if ((this.password01.length >= 6 && this.password01.length <= 20) && (this.password02.length >= 6 && this.password02.length <= 20)) {
this.btnStatus = true;
} else {
this.btnStatus = false;
}
}
}
showToastTip(msg:string){
this.toastText = msg
this.dialogToast.open()
}
}
... ...
import { CustomToast, DateTimeUtils, Logger, SPHelper } from 'wdKit/Index'
import { WDRouterRule, WDRouterPage } from 'wdRouter/Index'
import { LoginViewModel } from './LoginViewModel'
import { SettingPasswordParams } from './SettingPasswordPage'
import { router } from '@kit.ArkUI'
import { SpConstants } from 'wdConstant/Index'
import { TrackingPageBrowse, TrackConstants, TrackingButton } from 'wdTracking/Index'
const TAG = 'VerifyPhoneNumberPage'
//设置密码(第一次) 验证当前手机号 页面
@Entry
@Component
struct VerifyPhoneNumberPage {
@State phoneContent: string = ''
@State codeContent: string = ''
@State isSubmit: boolean = false //是否可以提交 默认不可以
loginViewModel: LoginViewModel = new LoginViewModel()
@State @Watch('onCodeSend') isCodeSend: boolean = false //验证码点击发送事件
@State pageTitle:string = '验证当前手机号';
@State @Watch('startCount') codeStateSuccess:boolean=false
lastTime: number = 0
@State codeBtnState: boolean = false
@State timeCount: number = 60
isFirst:boolean=true//是否第一次获取验证码
pageShowTime:number = 0;
pageHideTime:number = 0;
onCodeSend() {
if (this.isCodeSend) {
TrackingButton.click("checkingPhoneNumberPageSendVerificationCode",TrackConstants.PageName.Checking_PhoneNum,TrackConstants.PageName.Checking_PhoneNum)
this.sendVerifyCode()
}
}
onPageShow() {
this.pageShowTime = DateTimeUtils.getTimeStamp()
}
onPageHide(): void {
this.pageHideTime = DateTimeUtils.getTimeStamp()
let duration = 0
duration = Math.floor((this.pageHideTime - this.pageShowTime)/1000)
TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Checking_PhoneNum,TrackConstants.PageName.Checking_PhoneNum,duration)
}
async aboutToAppear(): Promise<void> {
this.phoneContent = await SPHelper.default.get(SpConstants.USER_PHONE,"") as string;
}
@State toastText:string = ""
dialogToast: CustomDialogController = new CustomDialogController({
builder: CustomToast({
msg: this.toastText,
}),
autoCancel: false,
alignment: DialogAlignment.Center,
customStyle: true,
maskColor:"#00000000"
})
build() {
Column() {
Image($r('app.media.login_back_icon')).width(24).height(24).margin({ left: 15, top: 10 }).onClick(() => {
router.back()
})
Text(this.pageTitle).fontSize(22).fontColor('#333333').fontWeight(FontWeight.Bold).margin({ left: 25, top: 112 })
Column() {
TextInput({ text: this.securityPhone(this.phoneContent) })
.placeholderColor("#CCCCCC")
.fontSize(16)
.height(48)
.maxLength(11)
.margin({ top: 36 })
.backgroundColor("#F5F5F5")
.borderRadius(4)
.enabled(false)
.type(InputType.PhoneNumber)
.onChange((content) => {
this.phoneContent = content
this.isSubmit = (this.phoneContent.length >= 11 && this.codeContent.length >= 4)
if (content.length >= 11) {
this.codeBtnState = true
} else {
this.codeBtnState = false
}
})
Row() {
TextInput({ text: this.codeContent,placeholder: "验证码" })
.placeholderColor("#CCCCCC")
.layoutWeight(1)
.fontSize(16)
.height(48)
.type(InputType.Number)
.fontColor("#222222")
.backgroundColor("#00000000")
.borderRadius({ topLeft: 4, bottomLeft: 4 })
.onChange((value) => {
this.codeContent = value
this.isSubmit = (this.phoneContent.length >= 11 && this.codeContent.length >= 4)
})
Text(this.codeStateSuccess ? this.timeCount + "s" : this.isFirst?"发送验证码":'重新获取')
.fontColor(this.codeBtnState?'#ED2800':'#80ED2800')
.width(110)
.fontSize(14)
.fontWeight( FontWeight.Bold)
.height(48)
.textAlign(TextAlign.Center)
.enabled(this.codeStateSuccess?false:true)
.onClick(() => {
if (this.phoneContent.length < 11) {
return
}
let currentTime = DateTimeUtils.getTimeStamp()
if (currentTime - this.lastTime < 500) {
return
}
this.lastTime = currentTime;
this.isCodeSend = true
})
}.margin({ top: 12 })
.height(48)
.alignItems(VerticalAlign.Center)
.justifyContent(FlexAlign.Start)
.backgroundImage($r('app.media.code_login_bg'))
.backgroundImageSize({width:'100%',height:48})
}.width('100%').padding({ left: 25, right: 25 })
Row() {
Text("确认")
.layoutWeight(1)
.fontColor(this.isSubmit ?"#FFFFFFFF":"#66FFFFFF")
.borderRadius(4)
.fontSize(18)
.textAlign(TextAlign.Center)
.fontWeight(FontWeight.Medium)
.margin({ top: 26 })
.height(44)
.backgroundColor(this.isSubmit ?"#ED2800":"#99ED2800")
.enabled(this.isSubmit ? true : false)
.onClick(() => {
this.checkVerifyCode()
})
}.padding({ left: 25, right: 25 }).width('100%')
}.width('100%').height('100%').alignItems(HorizontalAlign.Start)
}
//发送验证码
sendVerifyCode() {
if (this.isEmpty(this.phoneContent)) {
return
}
this.loginViewModel.sendVerifyCodeByToken().then(()=>{
this.showToastTip("已发送")
this.codeStateSuccess=true
this.isCodeSend=false
}).catch((message: string)=>{
this.showToastTip(message)
this.codeStateSuccess=false
this.isCodeSend=false
})
}
//校验验证码
checkVerifyCode() {
TrackingButton.click("checkingPhoneNumberPageConfirm",TrackConstants.PageName.Checking_PhoneNum,TrackConstants.PageName.Checking_PhoneNum)
if (!this.isSubmit) {
return
}
if (this.isEmpty(this.phoneContent)) {
return
}
if (this.isEmpty(this.codeContent)) {
return
}
this.loginViewModel.checkVerifyCodeByToken(this.codeContent).then(()=>{
let params: SettingPasswordParams = {
pageID:'1',
phoneContent:this.phoneContent,
codeContent:this.codeContent,
pageType:1
}
WDRouterRule.jumpWithPage(WDRouterPage.settingPasswordPage, params)
}).catch((message: string)=>{
this.showToastTip(message)
})
}
isEmpty(obj: undefined|null|string): boolean {
return (obj == undefined || obj == null || obj == '');
}
showToastTip(msg:string){
this.toastText = msg
this.dialogToast.open()
}
securityPhone(phoneNum:string):string{
let securityNum:string;
let needSecurityString = phoneNum.substring(3, phoneNum.length - 4);
securityNum = phoneNum.replace(needSecurityString,'****')
return securityNum;
}
startCount() {
this.isFirst = false
let time = setInterval(() => {
Logger.debug("倒计时:" + this.timeCount)
this.timeCount--
if (this.timeCount < 1) {
this.codeStateSuccess = false
this.timeCount = 60
clearInterval(time)
}
}, 1000)
}
}
\ No newline at end of file
... ...
... ... @@ -5,10 +5,10 @@
"pages/login/ForgetPasswordPage",
"pages/login/LoginProtocolWebview",
"pages/login/SettingPasswordPage",
"pages/login/SettingPasswordLayout",
"pages/guide/GuidePages",
"pages/login/OneKeyLoginPage",
"pages/login/ModifyPasswordPage",
"pages/login/ChangeBindPhonePage"
"pages/login/ChangeBindPhonePage",
"pages/login/VerifyPhoneNumberPage"
]
}
\ No newline at end of file
... ...
... ... @@ -2,7 +2,8 @@ export namespace TrackConstants {
export enum EventType {
Show = 0,
Click = 1
Click = 1,
CurrentNumberPanelContentExposure = 2,
}
// 行为类型
... ... @@ -24,7 +25,8 @@ export namespace TrackConstants {
UnSubscribe = "unSubscribe",
CloseInterestCard = "closeInterestCard",
SelectInterestCard = "selectInterestCard",
//电子报当前页曝光
CurrentNumberPanelContentExposure = "current_Number_Panel_content_exposure",
}
// 分享聚道
... ... @@ -208,5 +210,11 @@ export namespace TrackConstants {
///兴趣偏好页
Interest = "preferenceSelectionPage",
//意见反馈
FeedbackPage = 'feedbackPage',
//动态详情
DynamicDetailPage = 'dynamicDetailPage',
//早晚报
NewsPaperPage = 'newsPaperPage',
}
}
\ No newline at end of file
... ...
... ... @@ -22,7 +22,15 @@ export class TrackParamConvert {
static pageCompProgram(pageInfo?: PageInfoDTO, comp?: CompInfoBean, program?: ContentDTO) : ParamType {
let params = TrackingUtils.generateParams()
if (program) {
params["contentType"] = program.objectType
params["contentId"] = program.objectId
params["contentName"] = program.newsTitle
params["channelSourceId"] = program.channelId
params["rmhPlatform"] = program.rmhPlatform
TrackParamConvert.appendRecommend(program, params)
}
//TODO: 转换参数
return params
... ...
... ... @@ -16,6 +16,13 @@ export class TrackingButton {
Tracking.event("name_click", params)
}
static searchClick( pageId: string, pageName: string, extParams?: ParamType) {
let params = TrackingUtils.generateParams(extParams)
params["pageId"] = pageId
params["pageName"] = pageName
Tracking.event("search_button_click ", params)
}
}
\ No newline at end of file
... ...
... ... @@ -29,6 +29,10 @@ export class TrackingContent {
params["action"] = TrackConstants.ActionType.Show
TrackingUtils.fillPositionWith(params)
Tracking.event("content_exposure", params)
}else if(eventType === TrackConstants.EventType.CurrentNumberPanelContentExposure){
params["action"] = TrackConstants.ActionType.Show
TrackingUtils.fillPositionWith(params)
Tracking.event(TrackConstants.ActionType.CurrentNumberPanelContentExposure, params)
}
}
... ... @@ -82,6 +86,10 @@ export class TrackingContent {
}
static commentClick(pageId: string, pageName: string, extParams?: ParamType) {
TrackingContent.commentClickWithEvent("content_comment_click",pageId,pageName,extParams);
}
static commentClickWithEvent(event: string,pageId: string, pageName: string, extParams?: ParamType) {
let params = TrackingUtils.generateParams(extParams)
if (pageId.length) {
params["pageId"] = pageId
... ... @@ -91,7 +99,7 @@ export class TrackingContent {
}
params["action"] =TrackConstants.ActionType.Comment
TrackingUtils.fillPositionWith(params)
Tracking.event("content_comment_click", params)
Tracking.event(event, params)
}
static commentShare(pageId: string, pageName: string, extParams?: ParamType) {
... ...
... ... @@ -2,7 +2,7 @@ import { ENewspaperPageComponent } from 'wdComponent';
import { DateTimeUtils, Logger } from 'wdKit';
import common from '@ohos.app.ability.common';
import window from '@ohos.window';
import { TrackingPageBrowse } from 'wdTracking/Index';
import { TrackingPageBrowse ,TrackConstants} from 'wdTracking/Index';
const TAG = 'ENewspaper';
... ... @@ -10,8 +10,6 @@ const TAG = 'ENewspaper';
@Component
struct ENewspaper {
pageShowTime:number = 0;
pageId:string = 'newsPaperPage';
pageName:string=this.pageId;
// 获取UIAbility上下文
context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext
... ... @@ -59,7 +57,7 @@ struct ENewspaper {
this.setSystemBar('#FFFFFFFF','#00000000', '#000000')
Logger.info(TAG, 'onPageHide');
//页面浏览
TrackingPageBrowse.trackCommonPageExposureEnd(this.pageId,this.pageName,Math.floor((DateTimeUtils.getTimeStamp() - this.pageShowTime)/1000))
TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.NewsPaperPage,TrackConstants.PageName.NewsPaperPage,Math.floor((DateTimeUtils.getTimeStamp() - this.pageShowTime)/1000))
}
onBackPress() {
... ...
... ... @@ -2,15 +2,13 @@ import { DateTimeUtils, Logger } from 'wdKit';
import { DynamicDetailComponent } from 'wdComponent';
import router from '@ohos.router';
import { Params, Action } from 'wdBean';
import { TrackingPageBrowse } from 'wdTracking/Index';
import { TrackingPageBrowse,TrackConstants } from 'wdTracking/Index';
const TAG = 'DynamicDetailPage';
@Entry
@Component
struct DynamicDetailPage {
pageShowTime:number = 0;
pageId:string = 'dynamicDetailPage';
pageName:string=this.pageId;
@State relId: string = ''
@State contentId: string = ''
@State relType: string = ''
... ... @@ -39,7 +37,7 @@ struct DynamicDetailPage {
}
onPageHide() {
//页面浏览
TrackingPageBrowse.trackCommonPageExposureEnd(this.pageId,this.pageName,Math.floor((DateTimeUtils.getTimeStamp() - this.pageShowTime)/1000))
TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.DynamicDetailPage,TrackConstants.PageName.DynamicDetailPage,Math.floor((DateTimeUtils.getTimeStamp() - this.pageShowTime)/1000))
}
}
\ No newline at end of file
... ...
... ... @@ -4,6 +4,7 @@ import { WDRouterPage } from 'wdRouter';
import { SPHelper } from 'wdKit/Index';
import { SpConstants } from 'wdConstant/Index';
import { ButtonOptions, promptAction } from '@kit.ArkUI';
import { ParamType, TrackConstants, TrackingContent } from 'wdTracking/Index';
@Entry
@Component
... ... @@ -34,6 +35,8 @@ struct LaunchInterestsHobbiesPage {
//直接跳过到首页
//跳转首页
WDRouterRule.jumpWithReplacePage(WDRouterPage.mainPage)
this.trackingLaunchJumpOver(false)
})
}
.width('100%')
... ... @@ -148,6 +151,9 @@ struct LaunchInterestsHobbiesPage {
this.saveTagIds()
//跳转首页
WDRouterRule.jumpWithReplacePage(WDRouterPage.mainPage)
this.trackingLaunchJumpOver(true)
})
}
.width('100%')
... ... @@ -185,4 +191,17 @@ struct LaunchInterestsHobbiesPage {
}
SPHelper.default.saveSync(SpConstants.PUBLICVISUTORMODE_INTERESTTAGS,tags)
}
trackingLaunchJumpOver(selectOrJump:boolean){
let tags = SPHelper.default.getSync(SpConstants.PUBLICVISUTORMODE_INTERESTTAGS,'') as string
let action = selectOrJump?TrackConstants.ActionType.SelectInterestCard:TrackConstants.ActionType.CloseInterestCard
let pageParam: ParamType = {
'interestContentOptions':tags,
'itemId':tags,
'action':action,
'sceneId':'9999',
'cnsTraceId':'selfHold',
}
TrackingContent.common(TrackConstants.EventType.Click,TrackConstants.PageName.Interest,TrackConstants.PageName.Interest,pageParam)
}
}
\ No newline at end of file
... ...
... ... @@ -111,6 +111,7 @@ export struct VideoChannelPage {
}, (item: TopNavDTO) => item.channelId + '')
}
.width('100%')
.justifyContent(FlexAlign.Center)
.backgroundColor(this.currentTopNavSelectedIndex === 0 ? Color.Transparent : Color.White)
... ... @@ -128,13 +129,16 @@ export struct VideoChannelPage {
.alignItems(VerticalAlign.Center)
.justifyContent(FlexAlign.Center)
.onClick(() => {
TrackingButton.click("", TrackConstants.PageName.Search, "VIDEOS")
WDRouterRule.jumpWithPage(WDRouterPage.searchPage)
TrackingButton.searchClick(TrackConstants.PageName.Search, "VIDEOS")
let params = { 'tabName': "VIDEOS" } as Record<string, string>
WDRouterRule.jumpWithPage(WDRouterPage.searchPage,params)
})
.backgroundColor(Color.Transparent)
}
.zIndex(20)
.height($r('app.float.top_tab_bar_height_common'))
.margin({top:10})
.visibility(this.displayDirection === DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None)
}
... ... @@ -172,6 +176,7 @@ export struct VideoChannelPage {
.cachedCount(-1)
.displayCount(1, true)
.alignSelf(ItemAlign.Start)
.effectMode(EdgeEffect.None)
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP])
.onChange((index: number) => {
this.currentTopNavSelectedIndex = index
... ...