王士厅
Showing 24 changed files with 160 additions and 85 deletions
... ... @@ -49,17 +49,23 @@ export struct WdWebLocalComponent {
Row() {
RelativeContainer() {
// Web({ src: this.webResource, controller: this.webviewControl, renderMode: RenderMode.SYNC_RENDER })
Web({ src: this.webResource, controller: this.webviewControl })
Web({
src: this.webResource,
controller: this.webviewControl,
renderMode: RenderMode.SYNC_RENDER
})// Web({ src: this.webResource, controller: this.webviewControl })
.domStorageAccess(true)
.databaseAccess(true)
.javaScriptAccess(true)
.imageAccess(true)
.mixedMode(MixedMode.All)
.onlineImageAccess(true)
.enableNativeEmbedMode(true)// .layoutMode(WebLayoutMode.FIT_CONTENT)
// .nestedScroll({ scrollForward: NestedScrollMode.SELF_FIRST, scrollBackward: NestedScrollMode.PARENT_FIRST })
.height(this.webHeight)
.enableNativeEmbedMode(true)
.layoutMode(WebLayoutMode.FIT_CONTENT)
.nestedScroll({
scrollForward: NestedScrollMode.SELF_FIRST,
scrollBackward: NestedScrollMode.PARENT_FIRST
})// .height(this.webHeight)
.onPageBegin((event) => {
this.onPageBegin(event?.url);
})
... ... @@ -241,6 +247,7 @@ export struct WdWebLocalComponent {
Logger.debug(TAG, 'onLoadIntercept return false');
return false
}
onReloadStateChanged() {
Logger.info(TAG, `onReloadStateChanged:::refresh, this.reload: ${this.reload}`);
if (this.reload > 0) {
... ...
... ... @@ -151,7 +151,7 @@ export struct CardSourceInfo {
.flexShrink(0)
.margin({right: 4})
}
if (this.getContentDtoBean()?.interactData?.commentNum && this.showCommentNum()) {
if (Number(this.getContentDtoBean()?.interactData?.commentNum) > 0 && this.showCommentNum()) {
Text(`${this.handlerNum(this.getContentDtoBean()?.interactData?.commentNum.toString())}评`)
.fontSize($r("app.float.font_size_11"))
.fontColor($r("app.color.color_B0B0B0"))
... ...
... ... @@ -27,11 +27,19 @@ export struct Card9Component {
@State textArr: textItem[] = []
pageShowTime:number = 0;
pageHideTime:number = 0;
@State hideDetail: boolean = false;
onPageShow() {
this.pageShowTime = DateTimeUtils.getTimeStamp()
}
initHideDetail() {
const curRouter = router.getState().name;
if (curRouter === 'MyCollectionListPage') {
this.hideDetail = true;
}
}
//内容浏览Tracking
onPageHide(): void {
this.pageHideTime = DateTimeUtils.getTimeStamp()
... ... @@ -46,6 +54,7 @@ export struct Card9Component {
// this.loadImg = await onlyWifiLoadImg();
const curRouter = router.getState().name;
this.clicked = hasClicked(this.contentDTO.objectId, curRouter)
this.initHideDetail();
}
titleInit() {
... ... @@ -108,14 +117,16 @@ export struct Card9Component {
}.alignContent(Alignment.BottomStart)
// 时间线--后端返回三个,
if (!this.hideDetail) {
Column() {
ForEach(this.contentDTO.slideShows, (item: slideShows, index: number) => {
this.timelineItem(item, index, index === this.contentDTO.slideShows.length - 1)
})
}
}
// 底部-查看更多。根据接口返回的isMore判断是否显示查看更多
if (this.contentDTO.hasMore == 1) {
if (this.contentDTO.hasMore == 1 && !this.hideDetail) {
Row() {
Text("查看更多")
.fontSize($r("app.float.font_size_14"))
... ...
... ... @@ -292,6 +292,10 @@ struct indicatorAnimations {
// Image($r('app.media.swiper_indicator_gray'))
// .width('100%')
// .height(2)
Image($r('app.media.swiper_indicator_gray'))
.width('100%')
.height(2)
Image($r('app.media.swiper_indicator_white'))
.width(this.leftW)
.height(2)
... ... @@ -323,6 +327,9 @@ struct indicatorAnimations {
// Image($r('app.media.swiper_indicator_gray'))
// .width('100%')
// .height(2)
Image($r('app.media.swiper_indicator_gray'))
.width('100%')
.height(2)
Image($r('app.media.swiper_indicator_white'))
.width(this.rightW)
.height(2)
... ...
... ... @@ -110,6 +110,7 @@ struct localCard {
.margin({ bottom: 6 })
.flexShrink(0)
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
Text(this.operDataListItem.newsTitle)
.width(CommonConstants.FULL_PARENT)
... ...
import { StringUtils, UserDataLocal } from 'wdKit'
import { SpConstants } from 'wdConstant/Index'
import { SPHelper, StringUtils, UserDataLocal } from 'wdKit'
import { WDRouterPage, WDRouterRule } from 'wdRouter'
import { TrackingButton, TrackConstants } from 'wdTracking/Index'
import MinePageDatasModel from '../../model/MinePageDatasModel'
... ... @@ -8,7 +9,7 @@ const TAG = "MinePageUserSimpleInfoUI"
@Component
export default struct MinePageUserSimpleInfoUI {
@Watch('loginStateChange') @Prop isLogin :boolean
@State userName:string = "登注册"
@State userName:string = "登注册"
@State headPhotoUrl:string = ""
userType:string = "1"
@State levelHead:string = ""
... ... @@ -17,6 +18,10 @@ export default struct MinePageUserSimpleInfoUI {
loginStateChange(){
if(this.isLogin){
///已登录状态,先获取本地数据
this.userName = SPHelper.default.getSync(SpConstants.USER_NAME,"") as string
this.headPhotoUrl = SPHelper.default.getSync(SpConstants.USER_HEAD_PHOTO_URL,"") as string
this.getUserInfo()
}else{
this.headPhotoUrl = ""
... ... @@ -57,7 +62,7 @@ export default struct MinePageUserSimpleInfoUI {
Text(this.userName)
.fontColor($r('app.color.color_222222'))
.maxLines(1)
.fontWeight(FontWeight.Bold)
.fontWeight(FontWeight.Medium)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.fontSize(`${this.calcHeight(33)}lpx`)
.lineHeight(`${this.calcHeight(46)}lpx`)
... ... @@ -74,6 +79,7 @@ export default struct MinePageUserSimpleInfoUI {
trackButtonClick("myPageUserName")
})
if (this.levelId !== 0){
Stack(){
Image($r('app.media.mine_grade_bg'))
.width(`${this.calcHeight(84)}lpx`)
... ... @@ -86,6 +92,7 @@ export default struct MinePageUserSimpleInfoUI {
.width(this.levelId>9?`${this.calcHeight(69)}lpx`:`${this.calcHeight(50)}lpx`)
.height(`${this.calcHeight(29)}lpx`)
}.margin({top:'`${this.calcHeight(15)}lpx`'})
}
}.alignItems(HorizontalAlign.Start)
.margin({top:`${this.calcHeight(12)}lpx`,left:`${this.calcHeight(23)}lpx`})
.width(`${this.calcHeight(352)}lpx`)
... ...
... ... @@ -6,7 +6,7 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter';
import {AreaPickerDialog} from '../view/areaPickerDialog/AreaPickerDialog'
import {EditUserInfoCustomDialog} from '../view/areaPickerDialog/EditUserInfoCustomDialog'
import {EditUserSexCustomDialog} from '../view/areaPickerDialog/EditUserSexCustomDialog'
import { AreaListModel } from '../../model/AreaListModel';
import { AreaListManageModel, AreaListModel } from '../../model/AreaListModel';
import router from '@ohos.router';
import TrackingPageBrowseUtils from '../../utils/TrackingPageBrowseUtils'
import { TrackConstants } from 'wdTracking/Index';
... ... @@ -22,8 +22,12 @@ struct EditUserInfoPage {
@State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
@State firstSelect:number = 0
@State secondSelect:number = 0
@State thirdSelect:number = 0
dialogController: CustomDialogController = new CustomDialogController({
builder: AreaPickerDialog({dataSource:this.dataSource,
builder: AreaPickerDialog({dataSource:this.dataSource,firstSelect:this.firstSelect,secondSelect:this.secondSelect,thirdSelect:this.thirdSelect,
confirmCallback:(province:string,city:string,county:string,address:string)=>{
this.currentUserInfo.userExtend.province = province;
this.currentUserInfo.userExtend.city = city;
... ... @@ -31,6 +35,7 @@ struct EditUserInfoPage {
this.currentUserInfo.userExtend.address = address;
this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_region
this.updateEditModel()
this.getAreaIndex()
}
}),
alignment: DialogAlignment.Bottom,
... ... @@ -232,6 +237,30 @@ struct EditUserInfoPage {
getAreaList(){
EditInfoViewModel.getAreaList(getContext(this)).then((value) =>{
this.dataSource.push(...value)
this.getAreaIndex()
})
}
getAreaIndex(){
///地区选择器当前位置
if (this.currentUserInfo.userExtend.province.length > 0) {
this.dataSource.forEach((element,index) => {
if (element.label === this.currentUserInfo.userExtend.province) {
this.firstSelect = index
let currentFirst = EditInfoViewModel.getAreaListManageModel(element)
currentFirst.children.forEach((element,index) => {
if (element.label === this.currentUserInfo.userExtend.city) {
this.secondSelect = index
let currentSecondBean = EditInfoViewModel.getAreaListManageModel(element)
currentSecondBean.children.forEach((element,index) => {
if (element.label === this.currentUserInfo.userExtend.county) {
this.thirdSelect = index
}
});
}
});
}
});
}
}
}
... ...
... ... @@ -202,10 +202,6 @@ export struct TopNavigationComponentNew {
//防止多次点击
if (!this.isClickMorningEveningPaper) {
this.isClickMorningEveningPaper = true;
let c = setInterval(() => {
this.isClickMorningEveningPaper = false
}, 1000);
this.clickMorningEveningPaper()
}
})
... ... @@ -705,11 +701,15 @@ export struct TopNavigationComponentNew {
} else {
ToastUtils.showToast('暂无早晚报信息', 1000)
}
this.isClickMorningEveningPaper = false
}).catch((err: string) => {
ToastUtils.showToast('暂无早晚报信息', 1000)
this.isClickMorningEveningPaper = false
})
} else {
ToastUtils.showToast('网络出小差了,请检查网络后重试', 1000)
this.isClickMorningEveningPaper = false
}
}
... ...
... ... @@ -291,7 +291,7 @@ export struct SearchResultContentComponent {
Divider().strokeWidth(5).color('#f5f5f5').padding({ left: 0, right: 0 })
}
} else {
if(this.data.get(index + 1).sameContentListSize > 0) {
if(this.data?.get(index + 1)?.sameContentListSize > 0) {
Divider()
.width('100%')
.color($r('app.color.color_F5F5F5'))
... ...
... ... @@ -87,7 +87,7 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent {
}
showMore() {
return !!this.compDTO.dataSourceType || !(this.compDTO?.objectType === '0' || this.compDTO?.objectType === '')
return (!!this.compDTO.dataSourceType && this.compDTO.dataSourceType !== 'OBJECT_POS') || !(this.compDTO?.objectType === '0' || this.compDTO?.objectType === '')
}
build() {
... ...
... ... @@ -100,7 +100,7 @@ export struct LiveHorizontalCardComponent {
}
showMore() {
return !!this.compDTO.dataSourceType || !(this.compDTO?.objectType === '0' || this.compDTO?.objectType === '')
return (!!this.compDTO.dataSourceType && this.compDTO.dataSourceType !== 'OBJECT_POS') || !(this.compDTO?.objectType === '0' || this.compDTO?.objectType === '')
}
... ...
... ... @@ -12,6 +12,11 @@ export struct AreaPickerDialog {
title: string = '修改地区'
@Provide dataSource: AreaListModel[] = []
result: JSON[] = [];
firstSelect:number = 0
secondSelect:number = 0
thirdSelect:number = 0
confirmCallback: (province:string,city:string,county:string,address:string) => void = () => {
}
... ... @@ -52,9 +57,9 @@ export struct AreaPickerDialog {
.strokeWidth(1)
Row(){
FirstLevelComponent().width('33%')
SecondLevelComponent().width('33%')
ThirdLevelComponent().width('33%')
FirstLevelComponent({select:this.firstSelect}).width('33%')
SecondLevelComponent({currentSelect:this.secondSelect}).width('33%')
ThirdLevelComponent({currentSelect:this.thirdSelect}).width('33%')
}
}
.backgroundColor(0xffffff)
... ...
... ... @@ -7,7 +7,7 @@ export struct SecondLevelComponent {
@State select: number = 0;
@Consume @Watch('onFirstChange') currentFirst: AreaListManageModel;
@Consume currentSecondBean: AreaListManageModel
currentSelect:number = 0
build() {
Column(){
Column(){
... ... @@ -35,7 +35,13 @@ export struct SecondLevelComponent {
}
onFirstChange(){
if (this.currentSelect > 0){
this.select = this.currentSelect
this.currentSelect = 0
}else {
this.select = 0
}
if (!this.currentFirst) {
this.mTip = '暂无数据';
} else {
... ...
... ... @@ -8,7 +8,7 @@ export struct ThirdLevelComponent {
@Consume @Watch('onFirstChange') currentFirst: AreaListManageModel;
@Consume @Watch('onSecondChange') currentSecondBean: AreaListManageModel;
@Consume currentThirdBean: AreaListManageModel
currentSelect:number = 0
build() {
Column(){
Column(){
... ... @@ -36,11 +36,21 @@ export struct ThirdLevelComponent {
}
onFirstChange(){
this.select = 0
// if (this.currentSelect > 0){
// this.select = this.currentSelect
// this.currentSelect = 0
// }else {
// this.select = 0
// }
}
onSecondChange(){
if (this.currentSelect > 0){
this.select = this.currentSelect
this.currentSelect = 0
}else {
this.select = 0
}
if (!this.currentSecondBean) {
this.mTip = '暂无数据';
} else {
... ...
export interface AreaListData{
success: boolean;
code: number;
message: string;
data: AreaListModel[];
timestamp?: number;
}
export interface AreaListModel{
... ...
... ... @@ -27,8 +27,9 @@ export function viewBlogInsightIntentShare(context: common.UIAbilityContext, ent
let insightIntentArray: insightIntent.InsightIntent [] = []
let identifier = generateUUID()
if (compList?.length > 0) {
compList?.forEach((item: CompDTO | CompList) => {
item.operDataList.forEach((_item: ContentDTO) => {
compList?.forEach((comp: CompDTO | CompList) => {
comp.operDataList.forEach((item: ContentDTO) => {
console.log('zzzz',JSON.stringify(item))
let viewBlogInsightIntentItem: insightIntent.InsightIntent = {
intentName: 'ViewBlog',
intentVersion: '1.0.1',
... ... @@ -43,25 +44,26 @@ export function viewBlogInsightIntentShare(context: common.UIAbilityContext, ent
},
intentEntityInfo: {
entityName: 'Blog',
entityId: _item?.objectId,
displayName: _item?.newsTitle,
entityId: item?.objectId || '',//必传
displayName: item?.newsTitle || '', //必传
entityGroupId, //channelId
logoURL: _item?.coverUrl,
metadataModificationTime: _item?.publishTimestamp,
blogTitle: _item?.newsTitle,
logoURL: item?.coverUrl,
metadataModificationTime: Number(item?.publishTime) || 0,//int
blogTitle: item?.newsTitle,
blogType: 'Normal',
blogCategory: item.name,
categoryDisplayName: item.name,
blogSubTitle: _item?.newsSummary.length > 20 ?
_item?.newsSummary.substring(0, 20) : _item?.newsSummary,
blogAuthor: _item?.source,
blogPublishTime: _item?.publishTimestamp,
tag: _item?.newTags.split(','),
likeCount: _item?.interactData?.likeNum || 0,
forwardCount: _item?.interactData?.shareNum || 0,
commentCount: _item?.interactData?.commentNum || 0,
favorites: _item?.interactData?.collectNum || 0,
viewCount: _item?.interactData?.readNum || 0,
blogCategory: entityGroupId === '2001' ? '推荐' : '热点',
categoryDisplayName: item.newsTitle,//卡片上的主标题
description: item?.newsSummary || '',//必传
blogSubTitle: item?.newsSummary.length > 20 ?
item?.newsSummary.substring(0, 20) : item?.newsSummary,
blogAuthor: item?.source,
blogPublishTime: item?.publishTime,//string
tag: item?.newTags.split(','),
likeCount: item?.interactData?.likeNum || 0,
forwardCount: item?.interactData?.shareNum || 0,
commentCount: item?.interactData?.commentNum || 0,
favorites: item?.interactData?.collectNum || 0,
viewCount: item?.interactData?.readNum || 0,
rankingHint: 99
}
}
... ... @@ -84,6 +86,7 @@ export function viewBlogInsightIntentShare(context: common.UIAbilityContext, ent
export function viewBlogItemInsightIntentShare(context: common.UIAbilityContext, item: ContentDetailDTO,
interactData?: InteractDataDTO) {
let identifier = generateUUID()
console.log('zzzz',JSON.stringify(item))
let viewBlogInsightIntentItem: insightIntent.InsightIntent = {
intentName: 'ViewBlog',
intentVersion: '1.0.1',
... ... @@ -93,19 +96,20 @@ export function viewBlogItemInsightIntentShare(context: common.UIAbilityContext,
},
intentEntityInfo: {
entityName: 'Blog',
entityId: String(item?.newsId),
displayName: item?.newsTitle,
entityId: String(item?.newsId) || '',
displayName: item?.newsTitle || '',
entityGroupId: String(item?.reLInfo?.channelId), //channelId
logoURL: item.fullColumnImgUrls.length > 0 ? item.fullColumnImgUrls[0]?.url : item.firstFrameImageUri,
metadataModificationTime: item?.publishTime,
metadataModificationTime: new Date(item.publishTime).getTime() || 0,
blogTitle: item?.newsTitle,
blogType: 'Normal',
blogCategory: item,
categoryDisplayName: '', //TODO 分类名称
blogCategory: item?.reLInfo?.channelId === 2001 ? '推荐' : '热点',
categoryDisplayName: item.newsTitle || '',
blogSubTitle: item?.newsSummary.length > 20 ?
item?.newsSummary.substring(0, 20) : item?.newsSummary,
description: item?.newsSummary || '',//必传
blogAuthor: item?.newsSourceName,
blogPublishTime: item?.publishTime,
blogPublishTime: `${new Date(item.publishTime).getTime()}` || '',
tag: item?.newsTags.split(','),
viewCount: item?.viewCount || 0,
likeCount: interactData?.likeNum || 0,
... ...
... ... @@ -4,7 +4,7 @@ import {
EditListInfo, editModel, editModelParams, WDEditDataModelType } from '../model/EditInfoModel';
import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork';
import { Logger, ResourcesUtils } from 'wdKit';
import { AreaListManageModel, AreaListModel } from '../model/AreaListModel';
import { AreaListManageModel, AreaListModel,AreaListData } from '../model/AreaListModel';
import promptAction from '@ohos.promptAction';
const TAG = "EditInfoViewModel"
... ... @@ -74,17 +74,16 @@ class EditInfoViewModel {
getAreaList(context: Context):PromiseLike<AreaListModel[]>{
return new Promise((success, error) => {
WDHttp.get<AreaListData>(HttpUrlUtils.getHost() + HttpUrlUtils.APPOINTMENT_userArea_PATH).then((navResDTO: AreaListData) => {
if (navResDTO.code == 0) {
success(navResDTO.data)
}else {
success(this.getAreaListLocal(context))
}
}).catch((error: Error) => {
Logger.info(TAG,'executeCollcet','ResponseDTO')
success(this.getAreaListLocal(context))
// HttpRequest.post(HttpUrlUtils.APPOINTMENT_AccountOwner_PATH).then((navResDTO:ResponseDTO) =>{
// if (navResDTO.code == 200) {
// // let editM = navResDTO.data as EditInfoModel
// // success(JSON.parse(navResDTO.data)
// }
// }).catch((error: Error) => {
// Logger.info(TAG,'getAreaList','EditInfoViewModel')
// success(this.getAreaListLocal(context))
//
// })
})
})
}
... ...
... ... @@ -11,17 +11,5 @@
"compressNativeLibs": true,
"deliveryWithInstall": true,
"pages": "$profile:main_pages",
"requestPermissions": [
{
"name": "ohos.permission.APPROXIMATELY_LOCATION",
"reason": "$string:location_reason",
"usedScene": {
"abilities": [
"FormAbility"
],
"when": "inuse"
}
}
]
}
}
\ No newline at end of file
... ...
... ... @@ -246,6 +246,8 @@ export class LoginViewModel {
}
if(data.userExtend.headPhotoUrl!=undefined){
SPHelper.default.saveSync(SpConstants.USER_HEAD_PHOTO_URL, data.userExtend.headPhotoUrl)
}else {
SPHelper.default.deleteSync(SpConstants.USER_HEAD_PHOTO_URL)
}
if(data.userExtend.birthday!=undefined){
SPHelper.default.saveSync(SpConstants.USER_BIRTHDAY, data.userExtend.birthday)
... ...
... ... @@ -69,7 +69,7 @@ struct OneKeyLoginPage {
}
onPageHide(): void {
const duration = (Date.now() - this.pageStartDate!)
const duration = Math.floor((Date.now() - this.pageStartDate!)/1000)
TrackingPageBrowse.trackCommonPageExposureEnd(this.pageName, this.pageName, duration)
}
... ...
... ... @@ -6,7 +6,7 @@ import { Tracking } from './Tracking'
export class TrackingPageBrowse {
/// 页面浏览事件
// duration 浏览时长,上层计算,单位
// duration 浏览时长,上层计算,单位秒
static trackCommonPageExposureEnd(pageId: string, pageName: string, duration: number ,extParams?: ParamType) {
let params = TrackingUtils.generateParams(extParams)
if (pageId.length) {
... ... @@ -16,7 +16,7 @@ export class TrackingPageBrowse {
params["pageName"] = pageName
}
params["duration"] = duration / 1000
params["duration"] = duration
params["action"] = TrackConstants.ActionType.Browse
TrackingUtils.fillPositionWith(params)
Tracking.event("channel_exposure", params)
... ...
import { LogoutViewModel, PermissionDesComponent } from 'wdComponent';
import { LogoutViewModel } from 'wdComponent';
import { BreakpointConstants } from 'wdConstant';
import { common } from '@kit.AbilityKit';
import { BreakpointSystem, EmitterEventId, EmitterUtils, Logger, MpaasUpgradeCheck, WindowModel } from 'wdKit';
import { promptAction, window } from '@kit.ArkUI';
import { UpgradeTipDialog } from "./upgradePage/UpgradeTipDialog"
... ... @@ -20,7 +19,6 @@ struct MainPage {
private breakpointSystem: BreakpointSystem = new BreakpointSystem()
@StorageLink('currentBreakpoint') @Watch('watchCurrentBreakpoint') currentBreakpoint: string =
BreakpointConstants.BREAKPOINT_XS;
@State isPermission: boolean = false
upgradeDialogController?: CustomDialogController
watchCurrentBreakpoint() {
... ... @@ -37,9 +35,6 @@ struct MainPage {
EmitterUtils.receiveEvent(EmitterEventId.FORCE_USER_LOGIN_OUT, () => {
LogoutViewModel.clearLoginInfo()
})
EmitterUtils.receiveEvent(EmitterEventId.LOCATION, () => {
this.isPermission = true
})
}
pageTransition() {
... ... @@ -114,9 +109,6 @@ struct MainPage {
build() {
Stack({ alignContent: Alignment.Top }) {
BottomNavigationComponent()
if (this.isPermission) {
PermissionDesComponent()
}
}
}
}
... ...