张善主

Merge remote-tracking branch 'origin/main'

Showing 20 changed files with 408 additions and 95 deletions
... ... @@ -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");
//我的 预约
... ...
... ... @@ -144,7 +144,8 @@ export struct MorningEveningPaperComponent {
Logger.info(TAG, "pageInfoBean dateTime = " + dateTime)
Logger.info(TAG, "pageInfoBean subTitle = " + this.subTitle)
this.setComponentBgColor(pageInfoBean.backgroundImgUrl)
this.setComponentBgColor(this.pageInfoBean?.topicInfo?.frontLinkObject?.coverUrl as string)
let compInfoBean = await MorningEveningViewModel.getMorningEveningCompInfo(pageInfoBean?.id, pageInfoBean?.groups[0]?.id, currentTime + "", pageInfoBean?.topicInfo?.topicId)
// this.compInfoBean = compInfoBean
... ... @@ -223,8 +224,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)
... ... @@ -272,18 +272,17 @@ export struct MorningEveningPaperComponent {
}
.height(`calc(100% - ${this.bottomSafeHeight + this.topSafeHeight + 'vp'})`).scrollBar(BarState.Off)
PaperTitleComponent()
PaperTitleComponent().margin({top:this.topSafeHeight})
}
.width('100%')
.height('100%')
.padding({
top: this.topSafeHeight,
bottom: this.bottomSafeHeight
})
// .padding({
// top: this.topSafeHeight,
// bottom: this.bottomSafeHeight
// })
// .backgroundColor(Color.Black)
// .backgroundColor(this.pageInfoBean?.backgroundColor ?? Color.Black)
.backgroundColor(this.mixedBgColor ?? Color.Black)
}
@Builder
... ...
... ... @@ -32,6 +32,7 @@ export struct topicInfoView {
})
.id('img_cover')
if (this.frontLinkObject) {
Row() {
Text("查看详情")
.fontSize(14)
... ... @@ -49,19 +50,19 @@ export struct topicInfoView {
.margin({ top: 8, left: 16, right: 16, bottom: 16 })
.borderRadius(2)
.onClick(()=>{
if (this.frontLinkObject) {
let contentDTO :ContentDTO = new ContentDTO();
contentDTO.objectType = this.frontLinkObject?.newsType.toString()
contentDTO.objectId = this.frontLinkObject?.newsId
contentDTO.linkUrl = this.frontLinkObject?.linkUrl
ProcessUtils.processPage(contentDTO)
}
}).width(80)
.alignRules({
left: { anchor: "__container__", align: HorizontalAlign.Start },
bottom: { anchor: "__container__", align: VerticalAlign.Bottom }
})
.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})
... ...
... ... @@ -26,14 +26,11 @@ export struct CardSourceInfo {
let flag: boolean = false;
if (curRouter === 'MainPage') {
if (this.isTwoDaysAgo(publishTime)) {
console.log('curRouter 01')
flag = false
} else {
console.log('curRouter 02')
flag = true;
}
} else {
console.log('curRouter 03')
flag = true;
}
return flag;
... ... @@ -111,8 +108,7 @@ export struct CardSourceInfo {
.flexShrink(0)
.margin({right: 4})
}
if (this.getContentDtoBean()?.interactData?.commentNum && this.contentDTO.source) {
if (this.getContentDtoBean()?.interactData?.commentNum) {
Text(`${this.getContentDtoBean()?.interactData?.commentNum}评`)
.fontSize($r("app.float.font_size_11"))
.fontColor($r("app.color.color_B0B0B0"))
... ... @@ -120,6 +116,15 @@ export struct CardSourceInfo {
.visibility(Number(this.getContentDtoBean()?.interactData?.commentNum) === 0 ? Visibility.None :
Visibility.Visible)
}
// if (this.getContentDtoBean()?.interactData?.commentNum && this.contentDTO.source) {
// Text(`${this.getContentDtoBean()?.interactData?.commentNum}评`)
// .fontSize($r("app.float.font_size_11"))
// .fontColor($r("app.color.color_B0B0B0"))
// .flexShrink(0)
// .visibility(Number(this.getContentDtoBean()?.interactData?.commentNum) === 0 ? Visibility.None :
// Visibility.Visible)
// }
}
.width(CommonConstants.FULL_WIDTH)
.margin({ top: 8 })
... ...
... ... @@ -80,9 +80,8 @@ export struct RmhTitle {
async aboutToAppear(): Promise<void> {
this.getBatchAttentionStatus()
let page = router.getState();
if (page.path.includes('/page/PeopleShipHomePage') || page.path.includes('/pages/MainPage')) {
const curRouter = router.getState().name;
if (curRouter === 'MainPage') {
this.hideTime = true;
}
... ...
... ... @@ -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)
... ...
... ... @@ -50,20 +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.objectType == '2'){
if(this.contentDTO.seoTags){
} else {
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){
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)
... ... @@ -80,10 +99,9 @@ export struct Card2Component {
.lineHeight(27)
.textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
.align(Alignment.Start)
.textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 :
(this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) ||
this.contentDTO.objectType == '5' ? 35 : 0 || (this.contentDTO.objectType === '2' && (this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) > 2 && (this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) < 5) ? 58 :
(this.contentDTO.objectType === '2' && (this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) > 0 || this.contentDTO.objectType === '5') ? 35 :
.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)
... ...
... ... @@ -32,7 +32,6 @@ export struct Card6Component {
this.loadImg = await onlyWifiLoadImg();
this.clicked = hasClicked(this.contentDTO.objectId)
}
titleInit() {
if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) {
this.titleMarked = true;
... ... @@ -57,11 +56,17 @@ export struct Card6Component {
// .margin({ right: 2 })
// }
Stack() {
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)
}
if (this.contentDTO.newTags) {
Notes({ newTags: this.contentDTO.newTags }).height(27).align(Alignment.Center)
} else if (this.contentDTO.objectType == '5') {
Notes({ objectType: this.contentDTO.objectType }).height(27).align(Alignment.Center)
Notes({ newTags: this.contentDTO.newTags }).height(30).align(Alignment.Center)
}
}
Text() {
if (this.titleMarked) {
... ... @@ -80,9 +85,10 @@ export struct Card6Component {
.maxLines(3)
.alignSelf(ItemAlign.Start)
.textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
.textIndent(this.contentDTO?.newTags?.length < 5 && this.contentDTO?.newTags?.length > 2 ? 58 :
(this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) ||
this.contentDTO.objectType == '5' ? 35 : 0)
.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)
}
... ...
import ArrayList from '@ohos.util.ArrayList'
import { MineSettingComponent } from '../setting/MineSettingComponent';
import { AccountAndSecurityLayout } from '../setting/AccountAndSecurityLayout';
import router from '@ohos.router';
import { Action, Params } from 'wdBean';
import { Params } from 'wdBean';
import { DateTimeUtils } from 'wdKit/Index';
import { TrackingPageBrowse, TrackConstants, TrackingButton } from 'wdTracking/Index';
import { TrackingPageBrowse, TrackConstants } from 'wdTracking/Index';
@Entry
@Component
struct SettingPage {
@State message: string = 'Hello World 02'
@State pageType: string = 'mainSetting';
@State params:Params = router.getParams() as Params;
@State enterActivityTime:number = 0;
@Provide pageShow: number = -1
@Provide pageHide: number = -1
pageShowSettingTime:number = 0;
pageHideSettingTime:number = 0;
pageShowAccountTime:number = 0;
pageHideAccountTime:number = 0;
onPageShow() {
this.pageShow = Math.random()
this.pageType = this.params.pageID;
this.enterActivityTime = DateTimeUtils.getTimeStamp()
if (this.pageType == 'mainSetting'){
this.pageShowSettingTime = DateTimeUtils.getTimeStamp()
}else{
this.pageShowAccountTime = DateTimeUtils.getTimeStamp()
}
}
onPageHide(): void {
this.pageHide = Math.random()
if (this.pageType == 'mainSetting'){
this.pageHideSettingTime = DateTimeUtils.getTimeStamp()
}else{
this.pageHideAccountTime = DateTimeUtils.getTimeStamp()
}
let duration = 0
if(this.pageType == 'mainSetting'){
duration = Math.floor((this.pageHideSettingTime - this.pageShowSettingTime)/1000)
}else{
duration = Math.floor((this.pageHideAccountTime - this.pageShowAccountTime)/1000)
}
if(this.pageType == 'mainSetting'){
TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Setting,TrackConstants.PageName.Setting,duration)
}else{
TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Account_Management,TrackConstants.PageName.Account_Management,duration)
}
}
... ...
import { SpConstants } from 'wdConstant';
import { Logger, SPHelper, ToastUtils, EmitterEventId, EmitterUtils } from 'wdKit';
import { Logger, SPHelper, ToastUtils, EmitterEventId, EmitterUtils, DateTimeUtils } from 'wdKit';
import {MineMainSettingFunctionItem} from '../../viewmodel/MineMainSettingFunctionItem';
import MineSettingDatasModel from '../../model/MineSettingDatasModel';
import router from '@ohos.router';
... ... @@ -11,7 +11,7 @@ import { LogoutViewModel } from '../../viewmodel/LogoutViewModel';
import { CustomLogoutDialog } from './CustomLogoutDialog';
import { emitter } from '@kit.BasicServicesKit';
import { ConfirmLogoutDialog } from './ConfirmLogoutDialog';
import { TrackingButton, TrackConstants } from 'wdTracking/Index';
import { TrackingButton, TrackConstants, TrackingPageBrowse } from 'wdTracking/Index';
export { SettingPasswordParams } from "wdLogin"
@Component
... ... @@ -22,8 +22,37 @@ export struct AccountAndSecurityLayout {
@State protocolState: boolean = false //协议勾选状态
@State isAccountPage: boolean = true
@State ifSetPassword: boolean = false //是否设置过密码
@Consume pageShow :number
@Consume @Watch('pageHideForUpdateData') pageHide :number
@Watch("checkSetPassword") @Prop enterActivityTime:number = 0;
logoutLayoutShowTime:number = 0;
logoutLayoutHideTime:number = 0;
pageShowAccountTime:number = 0;
pageHideAccountTime:number = 0;
//注销账户 浏览埋点
logoutLayoutHide(){
this.logoutLayoutHideTime = DateTimeUtils.getTimeStamp()
let duration = 0
duration = Math.floor((this.logoutLayoutHideTime - this.logoutLayoutShowTime)/1000)
TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Cancel_Account,TrackConstants.PageName.Cancel_Account,duration)
}
//账户管理 浏览埋点
logoutLayoutHide2(){
this.pageHideAccountTime = DateTimeUtils.getTimeStamp()
let duration = 0
duration = Math.floor((this.pageHideAccountTime - this.pageShowAccountTime)/1000)
TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Account_Management,TrackConstants.PageName.Account_Management,duration)
}
pageHideForUpdateData(){
if(!this.isAccountPage){
this.logoutLayoutHide()
}else{
this.logoutLayoutHide2()
}
}
logoutViewModel = new LogoutViewModel()
dialogController: CustomDialogController = new CustomDialogController({
... ... @@ -57,6 +86,7 @@ export struct AccountAndSecurityLayout {
aboutToAppear() {
this.pageShowAccountTime = DateTimeUtils.getTimeStamp()
// 获取设置页面数据
this.getAccountAndSecurityData()
this.addEmitEvent()
... ... @@ -183,13 +213,12 @@ 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")
this.isAccountPage=false
// WDRouterRule.jumpWithPage(WDRouterPage.forgetPasswordPage, pageType)
this.logoutLayoutShowTime = DateTimeUtils.getTimeStamp()
}
})
... ... @@ -253,6 +282,8 @@ export struct AccountAndSecurityLayout {
})
.onClick(() => {
this.isAccountPage=true
this.pageShowAccountTime = DateTimeUtils.getTimeStamp()
this.logoutLayoutHide()
this.protocolState=false
})
.id('backImage')
... ... @@ -330,6 +361,7 @@ export struct AccountAndSecurityLayout {
Text() {
Span("我已阅读并同意").fontColor("#999999").fontSize(12)
Span("《用户注销协议》").fontColor("#ED2800").fontSize(12).onClick(() => {
TrackingButton.click("cancelAccountPageUserLogoffAgreement",TrackConstants.PageName.Cancel_Account,TrackConstants.PageName.Cancel_Account)
let bean = { contentID: "3", pageID: "" } as Params
WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage, bean)
})
... ... @@ -351,6 +383,7 @@ export struct AccountAndSecurityLayout {
if (!this.protocolState) {
return
}
TrackingButton.click("cancelAccountPageconfirmCancelAccount",TrackConstants.PageName.Cancel_Account,TrackConstants.PageName.Cancel_Account)
this.dialogController.open()
})
... ... @@ -454,6 +487,7 @@ export struct AccountAndSecurityLayout {
//注销账号
requestLogout() {
TrackingButton.click("cancelAccountPageCancelAccountSuccess",TrackConstants.PageName.Cancel_Account,TrackConstants.PageName.Cancel_Account)
this.logoutViewModel.requestLogout().then(()=>{
ToastUtils.shortToast("注销成功")
router.back()
... ...
... ... @@ -22,7 +22,7 @@ interface ILikeStyleResp {
export struct LikeComponent {
@Consume contentDetailData: ContentDetailDTO
@Prop pageComponentType: number
@State likesStyle: number = this.contentDetailData.likesStyle // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空
@State likesStyle: number | string = 1 // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空
@State likeStatus: boolean = false
viewModel: LikeViewModel = new LikeViewModel()
@Prop @Watch('onDataUpdated') data: Record<string, string>
... ... @@ -41,6 +41,14 @@ export struct LikeComponent {
// this.data['status'] = "1"
aboutToAppear() {
// 2:竖屏直播页 3:图集 4:横屏直播页
if(this.pageComponentType == 2 || this.pageComponentType == 4) {
// 点赞样式 love爱心型 thumb点赞手势 mourning 蜡烛(默哀) pray 祈福
this.likesStyle = this.contentDetailData?.liveInfo?.likesStyle
} else {
// 内容用 点赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空
this.likesStyle = this.contentDetailData.likesStyle
}
this.onDataUpdated()
}
... ... @@ -80,7 +88,7 @@ export struct LikeComponent {
* 将点赞样式转换为icon
*/
transLikeStyle(): ILikeStyleResp {
if (this.likesStyle === 1) {
if (this.likesStyle === 1 || this.likesStyle === 'love' || this.likesStyle === 'thumb') {
return {
url: this.likeStatus ? $r(`app.media.ic_like_check`) :
this.styleType == 1 ?
... ... @@ -88,12 +96,12 @@ export struct LikeComponent {
$r(`app.media.ic_like_uncheck`),
name: '赞'
}
} else if (this.likesStyle === 2) {
} else if (this.likesStyle === 2 || this.likesStyle === 'pray') {
return {
url: this.likeStatus ? $r(`app.media.ic_thub_check`) : $r(`app.media.ic_thub_uncheck`),
name: '祈祷'
}
} else if (this.likesStyle === 3) {
} else if (this.likesStyle === 3 || this.likesStyle === 'mourning') {
return {
url: this.likeStatus ? $r(`app.media.ic_candle_check`) :
$r(`app.media.ic_candle_uncheck`),
... ... @@ -143,6 +151,7 @@ export struct LikeComponent {
}
.width(154)
.height(40)
.visibility(this.likesStyle == 4 || this.likesStyle == 'empty' ? Visibility.None : Visibility.Visible)
}
@Builder
... ... @@ -160,6 +169,7 @@ export struct LikeComponent {
.onClick(() => {
this.clickButtonEvent()
})
.visibility(this.likesStyle == 4 || this.likesStyle == 'empty' ? Visibility.None : Visibility.Visible)
}
@Builder
... ... @@ -173,7 +183,10 @@ export struct LikeComponent {
.onClick(() => {
this.clickButtonEvent()
})
}.width(24).height(24)
}
.width(24)
.height(24)
.visibility(this.likesStyle == 4 || this.likesStyle == 'empty' ? Visibility.None : Visibility.Visible)
}
@Builder
... ... @@ -248,6 +261,7 @@ export struct LikeComponent {
}.width(24).height(24).onClick(() => {
this.clickButtonEvent()
})
.visibility(this.likesStyle == 4 || this.likesStyle == 'empty' ? Visibility.None : Visibility.Visible)
}
@Builder
... ... @@ -284,6 +298,7 @@ export struct LikeComponent {
}
.width(36)
.height(42)
.visibility(this.likesStyle == 4 || this.likesStyle == 'empty' ? Visibility.None : Visibility.Visible)
}
... ...
... ... @@ -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);
... ...
... ... @@ -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、登录->忘记密码 3、设置->更换手机号页面2
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() {
... ...
... ... @@ -378,6 +378,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"){ //注销协议
... ...
import { CustomToast, DateTimeUtils, Logger, SPHelper } from 'wdKit/Index'
import { WDRouterRule, WDRouterPage } from 'wdRouter/Index'
import { LoginViewModel } from './LoginViewModel'
import { SettingPasswordParams } from './SettingPasswordLayout'
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
... ...
... ... @@ -9,6 +9,7 @@
"pages/guide/GuidePages",
"pages/login/OneKeyLoginPage",
"pages/login/ModifyPasswordPage",
"pages/login/ChangeBindPhonePage"
"pages/login/ChangeBindPhonePage",
"pages/login/VerifyPhoneNumberPage"
]
}
\ 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
... ...
... ... @@ -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
... ...