wangliang_wd

Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool into main

* 'main' of http://192.168.1.42/developOne/harmonyPool: (49 commits)
  feat(金刚卡):点击跳转到专题页
  禅道:16610 早晚报时间样式,字体大小及背景样式鸿蒙与安卓不一致
  fix: 16851 人民号分享名片与分享按钮icon点击无反应
  fix: 16734 人民号-推荐页面下的关注按钮与标题重叠
  fix:bug[16812]人民号--搜索下的无图片信息的人民号号主头像鸿蒙与安卓不一致
  图集人民号点击头像跳转到号主页,对接评论点赞组合组件
  修复绑定账号异常提示
  fix: 16734 人民号-推荐页面下的关注按钮与标题重叠
  fix:bug[16837]用户评论任意详情页返回我的-评论后未能获取到评论内容
  fix: 16809 人民号下我的关注图标样式鸿蒙与安卓不一致
  fix:16809 人民号下我的关注图标样式鸿蒙与安卓不一致
  jira: desc:16656 人民号主页中的“+关注”的样式鸿蒙与安卓不一致
  jira: desc:16768 【uat】号主页,号主信息和内容标签tab间距过大
  fix: 16578 进入直播列表。直播预约按钮和时间没有显示
  feat(动态):已关注状态处理
  ref |> Revert "ref |> 新增友盟统计"
  Revert "ref |> 新增埋点封装"
  ref |> 统一 OS、Channel公参字段
  修复验证码bug
  fix:CardMediaInfo取值兼容
  ...
Showing 100 changed files with 1334 additions and 385 deletions

Too many changes to show.

To preserve performance only 100 of 100+ files are displayed.

... ... @@ -23,6 +23,10 @@
{
"name": "load_net_data_none",
"value": "no data"
},
{
"name": "location_reason",
"value": " "
}
]
}
... ...
... ... @@ -53,5 +53,15 @@ export class AppUtils {
}
return '';
}
static getAppChannel() {
// TODO: 待确认,暂时写死一个
return "rmrb_china_0000"
}
static getOSName() {
// TODO: 待确认,暂时写死Android
return "Harmony"
}
}
... ...
... ... @@ -70,10 +70,16 @@ export class DeviceUtil {
}
/**
* 获取设备型号: HUAWEI Mate 60 Pro
*/
static getMarketName() {
return deviceInfo.marketName
}
/**
* 客户端日志链路追踪traceid生成:在每个请求头加上参数Key:EagleEye-TraceID ,value为32位生成随机值
*/
static getRandomUUIDForTraceID(): string {
deviceInfo.productModel
return util.generateRandomUUID().toUpperCase().replace('-', '')
return util.generateRandomUUID().toUpperCase().replace(/-/g, '')
}
}
... ...
... ... @@ -6,6 +6,9 @@
"ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
"specifiers": {
"@ohos/axios@^2.1.1": "@ohos/axios@2.2.0",
"@umeng/analytics@^1.0.19": "@umeng/analytics@1.0.19",
"@umeng/common@^1.0.21": "@umeng/common@1.0.21",
"libcommon.so@../../oh_modules/.ohpm/@umeng+common@1.0.21/oh_modules/@umeng/common/src/main/cpp/types/libcommon": "libcommon.so@../../oh_modules/.ohpm/@umeng+common@1.0.21/oh_modules/@umeng/common/src/main/cpp/types/libcommon",
"wdConstant@../wdConstant": "wdConstant@../wdConstant",
"wdKit@../wdKit": "wdKit@../wdKit"
},
... ... @@ -16,6 +19,26 @@
"resolved": "https://repo.harmonyos.com/ohpm/@ohos/axios/-/axios-2.2.0.har",
"registryType": "ohpm"
},
"@umeng/analytics@1.0.19": {
"name": "@umeng/analytics",
"integrity": "sha512-0m9z5l8to+POjDl9UkCQC8s4P+e2E1OILwUglC7ME4QwqfH44e59GLJtQdwF0h6kwpsy3YBft4SoWK8MYbuP7g==",
"resolved": "https://ohpm.openharmony.cn/ohpm/@umeng/analytics/-/analytics-1.0.19.har",
"registryType": "ohpm"
},
"@umeng/common@1.0.21": {
"name": "@umeng/common",
"integrity": "sha512-EbXsd4OoRisTQf5egNY/+z1D2bvrYw9VwC2xu3EJA9TiDPSbnaJZ5+yltA/Se6yZ4oCcFvq6e5/AAfPuumunbw==",
"resolved": "https://ohpm.openharmony.cn/ohpm/@umeng/common/-/common-1.0.21.har",
"registryType": "ohpm",
"dependencies": {
"libcommon.so": "./src/main/cpp/types/libcommon"
}
},
"libcommon.so@../../oh_modules/.ohpm/@umeng+common@1.0.21/oh_modules/@umeng/common/src/main/cpp/types/libcommon": {
"name": "libcommon.so",
"resolved": "../../oh_modules/.ohpm/@umeng+common@1.0.21/oh_modules/@umeng/common/src/main/cpp/types/libcommon",
"registryType": "local"
},
"wdConstant@../wdConstant": {
"name": "wdconstant",
"resolved": "../wdConstant",
... ... @@ -24,7 +47,11 @@
"wdKit@../wdKit": {
"name": "wdkit",
"resolved": "../wdKit",
"registryType": "local"
"registryType": "local",
"dependencies": {
"@umeng/common": "^1.0.21",
"@umeng/analytics": "^1.0.19"
}
}
}
}
\ No newline at end of file
... ...
import { SpConstants } from 'wdConstant';
import { DateTimeUtils, DeviceUtil, SPHelper, StringUtils } from 'wdKit';
import { AppUtils, DateTimeUtils, DeviceUtil, SPHelper, StringUtils } from 'wdKit';
import { HttpUtils } from '../utils/HttpUtils';
import { HostEnum, HostManager } from './HttpHostManager';
... ... @@ -11,16 +11,16 @@ export class HttpParams {
let headers: Record<string, string> = {};
// 通用请求头
headers['User-Agent'] = 'Dalvik/2.1.0 (Linux; U; Android 13; 22101317C Build/TKQ1.221013.002)' // TODO
headers['channel'] = 'rmrb_china_0000' // 自有渠道
headers['channel'] = AppUtils.getAppChannel()
headers['plat'] = DeviceUtil.getPlat()
headers['Content-Type'] = 'application/json; charset=utf-8'
headers['device_id'] = DeviceUtil.clientId()
headers['build_version'] = HttpParams.getVersion()
headers['adcode'] = HttpUtils.getProvinceCode()
headers['os_version'] = DeviceUtil.getOsVersion()
headers['system'] = 'Android' // TODO 后续是否新增鸿蒙标识
headers['versionCode'] = HttpParams.getVersionCode()
headers['version_name'] = HttpParams.getVersionName()
headers['system'] = AppUtils.getOSName()
headers['versionCode'] = AppUtils.getAppVersionCode()
headers['version_name'] = AppUtils.getAppVersionName()
headers['EagleEye-TraceID'] = DeviceUtil.getRandomUUIDForTraceID()
headers['imei'] = DeviceUtil.clientId()
headers['Accept-Language'] = 'zh'
... ...
... ... @@ -67,7 +67,7 @@ export class ProcessUtils {
linkUrl: advert.linkUrl,
pageId: advert.pageId,
objectId: advert.objectId,
objectType: advert.objectType,
objectType: advert.objectType.toString(),
relId: advert.relId,
bottomNavId: advert.bottomNavId
} as ContentDTO;
... ... @@ -124,6 +124,7 @@ export class ProcessUtils {
//动态详情页(动态图文)
case ContentConstants.TYPE_FOURTEEN:
ProcessUtils.gotoDynamicDetailPage(content);
break;
//动态详情页(动态视频)
case ContentConstants.TYPE_FIFTEEN:
ProcessUtils.gotoDynamicDetailPage(content);
... ... @@ -322,6 +323,8 @@ export class ProcessUtils {
extra: {
relType: content?.relType,
relId: content?.relId,
extra: content?.extra,
title: content?.newsTitle
} as ExtraDTO
} as Params,
};
... ...
... ... @@ -9,13 +9,17 @@ import router from '@ohos.router';
import Url from '@ohos.url'
import { ContentDTO, PhotoListBean } from 'wdBean';
import { handleJsCallAppService } from './JsCallAppService'
import { HttpUtils } from 'wdNetwork/Index';
const TAG = 'JsBridgeBiz'
class AppInfo {
plat: string = ''
system: string = ''
networkStatus: number = 1
screenStatusBarHeight: number = 40 // TODO 这里需要动态获取
screenTabbarSafeHeight: number = 42 // TODO 这里需要动态获取
imei: string = HttpUtils.getImei()
device_id: string = HttpUtils.getDeviceId()
// TODO 完善
}
... ...
... ... @@ -4,6 +4,7 @@ import { Logger } from 'wdKit/Index';
import { performJSCallNative } from './JsBridgeBiz';
import { H5CallNativeType } from './H5CallNativeType';
import { Message } from 'wdJsBridge/src/main/ets/bean/Message';
import { DateTimeUtils } from 'wdKit'
const TAG = 'WdWebLocalComponent';
... ... @@ -22,6 +23,13 @@ export struct WdWebLocalComponent {
@State positionLeft: number = 0
@State positionTop: number = 0
@State videoLandscape: string = '1'
@State curRate: PlaybackSpeed = PlaybackSpeed.Speed_Forward_1_00_X
@State sliderStartTime: string = '';
@State currentTime: number = 0;
@State durationTime: number = 0;
@State durationStringTime: string = '';
@State isPause: boolean = true;
controller: VideoController = new VideoController()
build() {
Column() {
... ... @@ -77,12 +85,78 @@ export struct WdWebLocalComponent {
})
if (this.videoUrl) {
Video({ src: this.videoUrl })
Stack({ alignContent: Alignment.Bottom }) {
Video({
src: this.videoUrl,
currentProgressRate: this.curRate,
controller: this.controller
})
.borderRadius(5)
.controls(false)
.autoPlay(true)
.objectFit(ImageFit.Contain)
.onStart(() => {
this.isPause = false
})
.onPause(() => {
this.isPause = true
})
.onPrepared((event) => {
if (event) {
this.durationTime = event.duration
}
})
.onUpdate((event) => {
if (event) {
this.currentTime = event.time
}
})
Row() {
Image($r(this.isPause ? 'app.media.icon_play' : 'app.media.icon_pause'))
.width(24)
.height(24)
.onClick(()=>{
if(this.isPause){
this.controller.start()
}else{
this.controller.pause()
}
})
Row() {
Text(DateTimeUtils.getFormattedDuration(this.currentTime * 1000)).fontSize(12).fontColor(Color.White).fontWeight(600)
Slider({
value: this.currentTime,
min: 0,
max: this.durationTime
})
.width("50%")
.selectedColor('#ED2800')
.margin({ left: 4, right: 4 })
// .blockStyle({
// type: SliderBlockType.IMAGE,
// image: $r('app.media.slider_block')
// })
// .blockSize({ width: 18, height: 12 })
.onChange((value: number, mode: SliderChangeMode) => {
this.controller.setCurrentTime(value);
})
Text(DateTimeUtils.getFormattedDuration(this.durationTime * 1000)).fontSize(12).fontColor(Color.White).fontWeight(600)
}
.justifyContent(FlexAlign.Center)
Image($r('app.media.icon_full_screen'))
.width(24)
.height(24)
.onClick(()=>{
this.controller.requestFullscreen(true)
})
}
.opacity(0.8)
.width("100%")
.justifyContent(FlexAlign.SpaceAround)
}
.width(this.positionWidth)
.height(this.positionHeight)
.borderRadius(5)
.alignRules({
top: { anchor: "__container__", align: VerticalAlign.Top },
})
... ... @@ -92,7 +166,6 @@ export struct WdWebLocalComponent {
})
.id("video")
}
}
}.width('100%')
.height(this.webHeight)
... ...
... ... @@ -130,8 +130,6 @@ export { LiveInfoDTO } from './src/main/ets/bean/detail/LiveInfoDTO';
export { postRecommendListParams } from './src/main/ets/bean/detail/postRecommendListParams';
export { postThemeListParams } from './src/main/ets/bean/detail/postThemeListParams';
export { LiveDTO } from './src/main/ets/bean/peoples/LiveDTO';
export { contentVideosDTO } from './src/main/ets/bean/content/contentVideosDTO';
... ... @@ -165,3 +163,7 @@ export {
AttentionBatchDTO,
CreatorDTO
} from './src/main/ets/bean/peoples/AttentionBatchDTO';
export { GoldenPositionExtraBean } from './src/main/ets/bean/content/GoldenPositionExtraBean';
export { ClassBean } from './src/main/ets/bean/content/ClassBean';
export { CreatorsBean } from './src/main/ets/bean/content/CreatorsBean';
... ...
... ... @@ -17,4 +17,6 @@ export interface ExtraDTO extends ItemDTO {
photoList: PhotoListBean[];
swiperIndex?: number
commentId?: string;
extra?:string
title: string
}
\ No newline at end of file
... ...
import { FullColumnImgUrlDTO } from '../detail/FullColumnImgUrlDTO';
import { LiveInfoDTO } from '../detail/LiveInfoDTO';
import { VideoInfoDTO } from '../detail/VideoInfoDTO';
import { InteractDataDTO } from './InteractDataDTO';
import { slideShows } from '../morningevening/slideShows';
import { VoiceInfoDTO } from '../detail/VoiceInfoDTO';
import { RmhInfoDTO } from '../detail/RmhInfoDTO';
import { commentInfo } from './commentInfo';
import { ArrayList } from '@kit.ArkTS';
export interface ClassBean {
secondClassifyName:string
classifyName:string
}
\ No newline at end of file
... ...
... ... @@ -83,4 +83,5 @@ export interface ContentDTO {
bottomNavId:string;
// 链接类型: 0:无链接;1:内链(文章);2:外链
openType:string
extra:string
}
\ No newline at end of file
... ...
export interface CreatorsBean {
id:number
name:string
}
\ No newline at end of file
... ...
import { ArrayList } from '@kit.ArkTS';
import { ClassBean } from './ClassBean';
import { CreatorsBean } from './CreatorsBean';
export interface GoldenPositionExtraBean {
sort:number
pageNum:number
pageSize:number
channelId:string
topicId:string
keyWord:string
aggregateType:string
poolCode:string
showPublishStartTime:string
showPublishEndTime:string
keywordsType:string
keywords:ArrayList<string>
classifys: ArrayList<ClassBean>
creatorTags: ArrayList<CreatorsBean>
}
\ No newline at end of file
... ...
... ... @@ -18,4 +18,5 @@ export interface RmhInfoDTO {
rmhName: string;
userId: string;
userType: string;
honoraryIcon:string;
}
... ...
export interface postThemeListParams {
sort: number;
pageNum: number;
pageSize: number;
}
\ No newline at end of file
... ... @@ -25,6 +25,7 @@ import { Card2Component } from './cardview/Card2Component';
import { Card5Component } from './cardview/Card5Component';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { AdvCardParser } from './cardViewAdv/AdvCardParser';
import PageModel from '../viewmodel/PageModel';
/**
* comp适配器.
... ... @@ -34,7 +35,9 @@ import { AdvCardParser } from './cardViewAdv/AdvCardParser';
@Component
export struct CompParser {
@State compDTO: CompDTO = {} as CompDTO
compIndex: number = 0;
@State private pageModel: PageModel = new PageModel();
@State compIndex: number = 0;
build() {
Column() {
... ... @@ -44,7 +47,7 @@ export struct CompParser {
@Builder
componentBuilder(compDTO: CompDTO, compIndex: number) {
if (compDTO.operDataList[0]?.objectType !== '3' && compDTO.operDataList[0]?.objectType !== '13') { //暂时屏蔽活动和音频详情入口
//if (compDTO.operDataList[0]?.objectType !== '3' && compDTO.operDataList[0]?.objectType !== '13') { //暂时屏蔽活动和音频详情入口
if (compDTO.compStyle === CompStyle.Label_03) {
LabelComponent({ compDTO: compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
... ... @@ -100,7 +103,8 @@ export struct CompParser {
ZhSingleColumn09({ compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Card_Comp_Adv) { // 广告
AdvCardParser({compDTO})
AdvCardParser({pageModel:this.pageModel,compDTO})
//Text(`compIndex = ${compIndex}`).width('100%').fontSize('12fp').fontColor(Color.Red).padding({ left: 16, right: 16 })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (!Number.isNaN(Number(compDTO.compStyle))) {
CardParser({ contentDTO: compDTO.operDataList[0] });
... ... @@ -119,6 +123,6 @@ export struct CompParser {
}
}
}
// }
}
... ...
... ... @@ -97,15 +97,29 @@ export struct DynamicDetailComponent {
.height($r('app.float.margin_32'))
.objectFit(ImageFit.Cover)
.borderRadius($r('app.float.margin_16'))
Image($r('app.media.icon_border_test'))
Image(this.contentDetailData.rmhInfo?.honoraryIcon)
.width($r('app.float.margin_48'))
.height($r('app.float.margin_48'))
.objectFit(ImageFit.Cover)
.borderRadius($r('app.float.margin_24'))
if(!StringUtils.isEmpty(this.contentDetailData.rmhInfo?.authIcon)){
Stack() {
Image(this.contentDetailData.rmhInfo?.authIcon)
.width($r('app.float.vp_12'))
.height($r('app.float.vp_12'))
.objectFit(ImageFit.Cover)
}
.width($r('app.float.margin_48'))
.height($r('app.float.margin_48'))
.alignContent(Alignment.BottomEnd)
}
}
.width($r('app.float.margin_48'))
.height($r('app.float.margin_48'))
.alignContent(Alignment.Center)
.onClick(() => {
ProcessUtils.gotoPeopleShipHomePage(this.contentDetailData.rmhInfo == null ?"":this.contentDetailData.rmhInfo.rmhId)
})
Column(){
//昵称
Text(this.contentDetailData.rmhInfo?.rmhName)
... ... @@ -128,7 +142,7 @@ export struct DynamicDetailComponent {
.margin({right: $r('app.float.margin_6')})
if(!StringUtils.isEmpty(this.followStatus)){
if (this.followStatus == '0') {
Text('关注')
Text('+关注')
.width($r('app.float.margin_54'))
.height($r('app.float.margin_24'))
.textAlign(TextAlign.Center)
... ... @@ -147,7 +161,8 @@ export struct DynamicDetailComponent {
.textAlign(TextAlign.Center)
.fontSize($r('app.float.font_size_12'))
.borderRadius($r('app.float.vp_3'))
.borderColor($r('app.color.color_CCCCCC'))
.borderColor($r('app.color.color_CCCCCC_1A'))
.backgroundColor($r('app.color.color_CCCCCC_1A'))
.fontColor($r('app.color.color_CCCCCC'))
.onClick(() => {
this.handleAccention()
... ... @@ -300,7 +315,7 @@ export struct DynamicDetailComponent {
}
}
}
.padding({ left: this.contentDetailData.videoInfo[0].videoLandScape === 1?0: 16,top: $r('app.float.margin_8')})
.padding({ left: this.contentDetailData.videoInfo[0].videoLandScape === 1?0: 25,top: $r('app.float.margin_8')})
.onClick((event: ClickEvent) => {
ProcessUtils.processPage(this.mJumpInfo)
})
... ... @@ -312,8 +327,8 @@ export struct DynamicDetailComponent {
.fontSize($r('app.float.font_size_12'))
.lineHeight($r('app.float.margin_16'))
.margin({ top: $r('app.float.margin_16')
,left: $r('app.float.margin_16')
,right: $r('app.float.margin_16') })
,left: $r('app.float.vp_12')
,right: $r('app.float.vp_12') })
//微信/朋友圈/微博
Row(){
Image($r('app.media.xxhdpi_pic_wechat'))
... ...
import { Logger, NumberFormatterUtils, DateTimeUtils, EmitterUtils, EmitterEventId, NetworkUtil } from 'wdKit';
import {
Logger,
NumberFormatterUtils,
DateTimeUtils,
EmitterUtils,
EmitterEventId,
NetworkUtil,
DisplayUtils
} from 'wdKit';
import {
Action,
ContentDetailDTO,
... ... @@ -41,6 +49,7 @@ export struct ImageAndTextPageComponent {
@State publishCommentModel: publishCommentModel = new publishCommentModel()
@State operationButtonList: string[] = ['comment', 'collect', 'share']
@State isNetConnected: boolean = true
@State info: Area | null = null
build() {
Column() {
... ... @@ -131,8 +140,11 @@ export struct ImageAndTextPageComponent {
Divider().strokeWidth(6).color('#f5f5f5')
CommentComponent({
publishCommentModel: this.publishCommentModel
}).onAreaChange((oldValue: Area, newValue: Area) => {
this.info = newValue
})
// .onMeasureSize()
}
}
}
... ... @@ -144,29 +156,26 @@ export struct ImageAndTextPageComponent {
.scrollBar(BarState.Off)
.align(Alignment.Top)
if(!this.isNetConnected) {
if (!this.isNetConnected) {
EmptyComponent({
emptyType: 1,
emptyButton: true,
retry: () => {
this.getDetail()
}
})
}else{
}).padding({ bottom: 200 })
} else {
if (!this.isPageEnd) {
detailedSkeleton()
}
}
//底部交互区
if (this.contentDetailData?.length) {
OperRowListView({
contentDetailData: this.contentDetailData[0],
publishCommentModel: this.publishCommentModel,
operationButtonList: this.operationButtonList,
})
}
}
}
.width(CommonConstants.FULL_WIDTH)
... ... @@ -308,7 +317,16 @@ export struct ImageAndTextPageComponent {
if (targetId) {
if (targetId == this.publishCommentModel.targetId) {
// 滚动到评论列表
if (this.info) {
// let height = DisplayUtils.getDeviceHeight() / 2
let offSetY = this.info?.globalPosition.y as number
//头部距离48
this.scroller.scrollTo({
yOffset: offSetY - 100,
xOffset: 0,
animation: { duration: 1000, curve: Curve.Ease }
})
}
}
}
})
... ...
// import { FrontLinkObject, MorningEveningPaperDTO, PageInfoBean } from 'wdBean';
import { CompList, PageInfoBean } from 'wdBean';
import { DateTimeUtils, Logger, SPHelper } from 'wdKit/Index';
import { DateTimeUtils, Logger, SPHelper, WindowModel } from 'wdKit/Index';
import { PaperReaderSimpleDialog } from '../../dialog/PaperReaderDialog';
import { MorningEveningViewModel } from '../../viewmodel/MorningEveningViewModel';
// import { AudioBarView } from './AudioBarView';
... ... @@ -102,6 +102,7 @@ export struct MorningEveningPaperComponent {
async aboutToAppear() {
let windowHight: window.Window = await window.getLastWindow(getContext(this));
await windowHight.setWindowLayoutFullScreen(true);
WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff', })
this.topSafeHeight = px2vp(windowHight.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).topRect.height)
let dailyPaperTopicPageId = await SPHelper.default.getSync('dailyPaperTopicPageId', "") as String
... ... @@ -173,6 +174,7 @@ export struct MorningEveningPaperComponent {
async aboutToDisappear() {
let windowHight: window.Window = await window.getLastWindow(getContext(this));
await windowHight.setWindowLayoutFullScreen(false);
WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', })
}
onPageHide() {
... ...
... ... @@ -34,7 +34,7 @@ export struct PaperTitleComponent {
Text(this.subTitle ?? '')// Text('2024年\n1月16日')
// .width(50)
.margin({ left: 5 })
.fontSize(12)
.fontSize(8)
.fontColor($r('app.color.white'))
.maxLines(2)
... ... @@ -47,7 +47,8 @@ export struct PaperTitleComponent {
.alignItems(VerticalAlign.Center)
.alignRules({
left: { anchor: "img_logo1", align: HorizontalAlign.End },
center: { anchor: "__container__", align: VerticalAlign.Center } })
center: { anchor: "__container__", align: VerticalAlign.Center }
})
.id('row_paper_date')
Image($r('app.media.icon_close'))
... ... @@ -55,7 +56,8 @@ export struct PaperTitleComponent {
.width($r('app.float.top_arrow_size'))
.alignRules({
right: { anchor: "__container__", align: HorizontalAlign.End },
center: { anchor: "__container__", align: VerticalAlign.Center } })
center: { anchor: "__container__", align: VerticalAlign.Center }
})
.id('img_close')
.onClick((event: ClickEvent) => {
// console.info(TAG, "img_close")
... ... @@ -68,11 +70,12 @@ export struct PaperTitleComponent {
.width($r('app.float.top_arrow_size'))
.alignRules({
right: { anchor: "img_close", align: HorizontalAlign.Start },
center: { anchor: "__container__", align: VerticalAlign.Center } })
center: { anchor: "__container__", align: VerticalAlign.Center }
})
.id('img_share')
.margin({ right: 13 })
}
// .margin({ left: 14, right: 14 })
.margin({ left: 14, right: 14 })
.height($r('app.float.top_bar_height'))
// .backgroundColor(Color.Black)
... ...
... ... @@ -5,7 +5,8 @@ import {
PhotoListBean,
postInteractBrowsOperateParams,
postBatchAttentionStatusParams,
postInteractAccentionOperateParams
postInteractAccentionOperateParams,
Params
} from 'wdBean';
import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
import display from '@ohos.display';
... ... @@ -44,6 +45,7 @@ export struct MultiPictureDetailPageComponent {
@State netStatus: number | undefined = undefined // 存储网络状态用来展示缺省图
@State showDownload: Boolean = false // 控制是否显示下载默认隐藏
@State publishCommentModel: publishCommentModel = new publishCommentModel()
@State operationButtonList: string[] = ['comment', 'like', 'collect', 'share']
//watch监听页码回调
onCurrentPageNumUpdated(): void {
... ... @@ -98,19 +100,31 @@ export struct MultiPictureDetailPageComponent {
if (this.contentDetailData.rmhPlatform == 1) {
Row() {
Row({ space: 8 }) {
if (this.getImgUrl()){
Row() {
Image(this.contentDetailData?.rmhInfo?.rmhHeadUrl)
Image(this.getImgUrl())
.borderRadius(24)
.aspectRatio(1)
.border({ width: 1, color: Color.White, style: BorderStyle.Solid })
.alt($r('app.media.picture_loading'))
.width(36)
.height(36)
.objectFit(ImageFit.Fill)
.interpolation(ImageInterpolation.High)
.onClick(() => {
if (this.contentDetailData.rmhInfo?.cnMainControl === 1) {
// 号主页
const params: Params = {
creatorId: this.contentDetailData.rmhInfo.rmhId,
pageID: ''
}
WDRouterRule.jumpWithPage(WDRouterPage.peopleShipHomePage, params)
}
})
}
.width('13%')
.height('100%')
}
Row() {
Flex({
... ... @@ -190,6 +204,7 @@ export struct MultiPictureDetailPageComponent {
middle: { anchor: "__container__", align: HorizontalAlign.Center }
})
.id('e_attention')
.visibility(!this.showDownload ? Visibility.Visible : Visibility.None)
}
if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length > 0) {
Swiper(this.swiperController) {
... ... @@ -305,10 +320,8 @@ export struct MultiPictureDetailPageComponent {
OperRowListView({
contentDetailData: this.contentDetailData,
publishCommentModel: this.publishCommentModel,
operationButtonList: this.operationButtonList,
})
.width('100%')
.height(56)
.border({ width: { top: 0.5 }, color: '#FFFFFF' })
}
.visibility(!this.showDownload ? Visibility.Visible : Visibility.None)
Column(){
... ... @@ -385,6 +398,7 @@ export struct MultiPictureDetailPageComponent {
if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length === 0) {
// 暂无内容
this.netStatus = 0
this.operationButtonList = []
Logger.info(TAG, `this.netStatus:${JSON.stringify(this.netStatus)}`)
}
Logger.info(TAG, `contentDetailData:${JSON.stringify(this.contentDetailData)}`)
... ... @@ -399,12 +413,17 @@ export struct MultiPictureDetailPageComponent {
Logger.info(TAG, `fetchDetailData then,err: ${JSON.stringify(err)}`);
// 内容获取失败
this.netStatus = 9
this.operationButtonList = []
})
} catch (exception) {
}
}
getImgUrl() {
return this.contentDetailData?.rmhInfo?.rmhHeadUrl || this.contentDetailData?.userInfo?.userHeadUrl
}
// 记录浏览历史
private getInteractBrowsOperate() {
try {
... ...
... ... @@ -16,7 +16,7 @@ export struct CardMediaInfo {
build() {
Row() {
if (this.contentDTO.objectType === '1' || this.contentDTO.objectType === '15') {
if (this.contentDTO?.objectType === '1' || this.contentDTO?.objectType === '15') {
// 点播、动态视频
Row() {
Image($r('app.media.card_play'))
... ... @@ -30,23 +30,23 @@ export struct CardMediaInfo {
// liveInfo.liveState 直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停
// 显示直播信息
Row() {
if (this.contentDTO.liveInfo.liveState === 'wait') {
if (this.contentDTO?.liveInfo?.liveState === 'wait') {
Image($r('app.media.card_wait'))
.mediaLogo()
Text('预约')
.mediaText()
} else if (this.contentDTO.liveInfo.liveState === 'running') {
} else if (this.contentDTO?.liveInfo?.liveState === 'running') {
Image($r('app.media.card_live'))
.mediaLogo()
Text('直播中')
.mediaText()
} else if (this.contentDTO.liveInfo.liveState === 'end' && this.contentDTO.liveInfo.replayUri) {
} else if (this.contentDTO?.liveInfo?.liveState === 'end' && this.contentDTO?.liveInfo?.replayUri) {
Image($r('app.media.card_play'))
.mediaLogo()
Text('回看')
.mediaText()
} else if (this.contentDTO.liveInfo.liveState === 'end' && this.contentDTO.liveInfo
.replayUri) {
} else if (this.contentDTO?.liveInfo?.liveState === 'end' && this.contentDTO?.liveInfo
?.replayUri) {
// Image($r('app.media.card_live'))
// .mediaLogo()
Text('直播结束')
... ...
... ... @@ -31,6 +31,7 @@ export struct RmhTitle {
.fontColor($r('app.color.color_222222'))
.fontWeight(600)
.alignSelf(ItemAlign.Start)
Flex({alignContent: FlexAlign.Start, wrap: FlexWrap.NoWrap}) {
Row() {
if (this.publishTime) {
Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.publishTime)))
... ... @@ -46,6 +47,9 @@ export struct RmhTitle {
.maxLines(1)
.alignSelf(ItemAlign.Start)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.textAlign(TextAlign.Start)
}
.width('75%')
}
}
... ...
... ... @@ -7,6 +7,7 @@ import { CardAdvBigImageComponent } from './CardAdvBigImageComponent';
import { CardAdvVideoComponent } from './CardAdvVideoComponent';
import { CardAdvGanMiComponent } from './CardAdvGanMiComponent';
import { CardAdvVideoExComponent } from './CardAdvVideoExComponent';
import PageModel from '../../viewmodel/PageModel';
/**
* @Description: 广告稿件解析类
... ... @@ -19,28 +20,29 @@ import { CardAdvVideoExComponent } from './CardAdvVideoExComponent';
@Component
export struct AdvCardParser {
@State compDTO: CompDTO = {} as CompDTO;
pageModel: PageModel = new PageModel();
build() {
this.contentBuilder(this.compDTO);
this.contentBuilder(this.pageModel, this.compDTO);
}
@Builder
contentBuilder(compDTO: CompDTO) {
contentBuilder(pageModel: PageModel, compDTO: CompDTO) {
if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_5) { //三图广告
CardAdvThreeImageComponent({ compDTO })
CardAdvThreeImageComponent({ pageModel, compDTO })
} else if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_6) { //小图广告
CardAdvSmallImageComponent({ compDTO })
CardAdvSmallImageComponent({ pageModel, compDTO })
} else if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_7 ||
compDTO.matInfo.advSubType === CompStyle.Card_Adv_12) { // 长通栏广告 和 顶部长通栏广告
CardAdvLongImageComponent({ compDTO })
CardAdvLongImageComponent({ pageModel, compDTO })
} else if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_8) { //大图广告
CardAdvBigImageComponent({ compDTO })
CardAdvBigImageComponent({ pageModel, compDTO })
} else if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_9) { //视频广告
CardAdvVideoComponent({ compDTO })
CardAdvVideoComponent({ pageModel, compDTO })
} else if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_10) { //展会广告
CardAdvVideoExComponent({ compDTO })
CardAdvVideoExComponent({ pageModel, compDTO})
} else if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_11) { //冠名广告
CardAdvGanMiComponent({ compDTO })
CardAdvGanMiComponent({ pageModel, compDTO })
}
}
}
\ No newline at end of file
... ...
import { CompDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import PageModel from '../../viewmodel/PageModel';
import { CardAdvBottom } from './CardAdvBottom';
const TAG: string = 'Card2Component';
... ... @@ -16,12 +17,9 @@ const TAG: string = 'Card2Component';
@Component
export struct CardAdvBigImageComponent {
@State compDTO: CompDTO = {} as CompDTO
pageModel: PageModel = new PageModel();
aboutToAppear(): void {
}
aboutToDisappear(): void {
... ... @@ -43,7 +41,7 @@ export struct CardAdvBigImageComponent {
.borderColor($r('app.color.color_0D000000'))
.width(CommonConstants.FULL_WIDTH)
CardAdvBottom().margin({
CardAdvBottom({pageModel:this.pageModel,compDTO:this.compDTO}).margin({
top: 8,
})
}
... ...
import { CompDTO } from 'wdBean/Index';
import { Logger } from 'wdKit/Index';
import PageModel from '../../viewmodel/PageModel';
/**
* @Description: 广告稿件 底部标签+删除按钮
... ... @@ -10,7 +12,8 @@ import { CompDTO } from 'wdBean/Index';
*/
@Component
export struct CardAdvBottom {
@State compDTO: CompDTO = {} as CompDTO;
pageModel: PageModel = new PageModel();
@State compDTO: CompDTO = {} as CompDTO
build() {
... ... @@ -36,6 +39,30 @@ export struct CardAdvBottom {
.borderColor($r('app.color.color_EDEDED'))
.borderRadius(4)
}.width('100%')
}.width('100%').onClick(() => {
this.delComp()
})
}
/**
* 删除稿件
*/
private delComp() {
if (this.pageModel) {
let a = this.compDTO;
let currentIndex = -1
for (let i = 0; i < this.pageModel.compList.size(); i++) {
let b = this.pageModel.compList.getData(i)
if (a.compStyle === b.compStyle && a.matInfo === b.matInfo) {
currentIndex = i
break;
}
}
Logger.error("ZZZXXXXX","currentIndex====>"+currentIndex);
if (currentIndex >= 0) {
this.pageModel.compList.deleteItem(currentIndex)
}
}
}
}
\ No newline at end of file
... ...
... ... @@ -4,8 +4,10 @@ import { AdvExtraData, AdvExtraItemData } from 'wdBean/src/main/ets/bean/adv/Adv
import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import PageModel from '../../viewmodel/PageModel';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
import { CardAdvTop } from './CardAdvTop';
const TAG: string = 'Card2Component';
... ... @@ -22,6 +24,7 @@ export struct CardAdvGanMiComponent {
@State compDTO: CompDTO = {} as CompDTO
@State advExtraData: AdvExtraData = {} as AdvExtraData
@State advLength: number = 0;
pageModel: PageModel = new PageModel();
aboutToAppear(): void {
... ... @@ -53,41 +56,7 @@ export struct CardAdvGanMiComponent {
.borderColor($r('app.color.color_0D000000'))
// 广告标签和删除功能
Row() {
Text($r('app.string.comp_advertisement'))
.fontSize('10fp')
.fontColor($r('app.color.white'))
.width(28)
.height(16)
.backgroundColor('#4D000000')
.borderRadius(3)
.textAlign(TextAlign.Center)
Blank()
Stack() {
Image($r('app.media.comp_adv_close_white'))
.width(9)
.height(9)
.borderRadius({
topLeft: '4vp',
topRight: '4vp',
bottomLeft: '4vp',
bottomRight: '4vp'
})
}
.width(18)
.height(14)
.backgroundColor('#4D000000')
.borderWidth(0.5)
.borderColor($r('app.color.white'))
.borderRadius(3)
}.width('100%').padding({
top: 8,
left: 8,
right: 8
})
CardAdvTop({ pageModel: this.pageModel, compDTO: this.compDTO })
}
.alignContent(Alignment.Top)
.width(CommonConstants.FULL_WIDTH)
... ... @@ -100,7 +69,7 @@ export struct CardAdvGanMiComponent {
//
List({ space: 8 }) {
ForEach(this.advExtraData.item, (content: AdvExtraItemData) => {
ForEach(this.advExtraData.item, (content: AdvExtraItemData, index: number) => {
ListItem() {
// 广告列表信息
... ... @@ -123,7 +92,10 @@ export struct CardAdvGanMiComponent {
.width('100%')
.margin({ top: 8 })
}.width(this.advLength >= 3 ? 150 : this.advLength == 2 ? 210 : '100%').onClick(() => {
}
.width(this.advLength >= 3 ? 150 : this.advLength == 2 ? 210 : '100%')
.margin({ left: index === 0 ? this.advLength == 1 ? 0 : 16 : 0 })
.onClick(() => {
let matInfo: CompAdvMatInfoBean = {
linkUrl: content.linkUrl,
... ... @@ -142,7 +114,7 @@ export struct CardAdvGanMiComponent {
.listDirection(Axis.Horizontal)
.edgeEffect(EdgeEffect.None)
.scrollBar(BarState.Off)
.contentStartOffset(this.advLength == 1 ? 0 : 16)
// .contentStartOffset(this.advLength == 1 ? 0 : 16)
.contentEndOffset(this.advLength == 1 ? 0 : 16)
.margin({ top: 10, bottom: 10 })
.padding({
... ... @@ -150,7 +122,6 @@ export struct CardAdvGanMiComponent {
right: this.advLength == 1 ? 16 : 0,
})
// 更多按钮
commonButton(this.advExtraData)
... ...
//全标题 "appStyle":"2",
import { CompDTO, ContentDTO } from 'wdBean';
import { CompDTO } from 'wdBean';
import { CommonConstants, CompStyle } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
import PageModel from '../../viewmodel/PageModel';
import { CardAdvBottom } from './CardAdvBottom';
const TAG: string = 'Card2Component';
... ... @@ -18,15 +17,11 @@ const TAG: string = 'Card2Component';
*/
@Component
export struct CardAdvLongImageComponent {
@State compDTO: CompDTO = {} as CompDTO
@State haveTitle : boolean = true
@State haveTitle: boolean = true
pageModel: PageModel = new PageModel();
aboutToAppear(): void {
this.haveTitle = this.compDTO.matInfo.advSubType === CompStyle.Card_Adv_7;
}
... ... @@ -37,12 +32,10 @@ export struct CardAdvLongImageComponent {
build() {
Column() {
//新闻标题
if(this.haveTitle ){
if (this.haveTitle) {
Text(this.compDTO.matInfo.advTitle).width('100%').bottomTextStyle().margin({ bottom: 8, })
}
//长图
Image(this.compDTO.matInfo.matImageUrl[0])
.width(CommonConstants.FULL_WIDTH)
... ... @@ -51,7 +44,7 @@ export struct CardAdvLongImageComponent {
.borderWidth(0.5)
.borderColor($r('app.color.color_0D000000'))
CardAdvBottom().margin({
CardAdvBottom({ pageModel: this.pageModel, compDTO:this.compDTO }).margin({
top: 8,
})
}
... ...
... ... @@ -5,6 +5,7 @@ import { ProcessUtils } from 'wdRouter';
import measure from '@ohos.measure';
import { DisplayUtils } from 'wdKit/Index';
import { CardAdvBottom } from './CardAdvBottom';
import PageModel from '../../viewmodel/PageModel';
const TAG: string = 'CardAdvSmallImageComponent';
... ... @@ -20,7 +21,7 @@ const TAG: string = 'CardAdvSmallImageComponent';
export struct CardAdvSmallImageComponent {
@State compDTO: CompDTO = {} as CompDTO
@State isBigThreeLine: boolean = false // 标题的行数大于等于3行 是true
pageModel: PageModel = new PageModel();
aboutToAppear(): void {
// 计算标题文本行数
... ... @@ -68,7 +69,7 @@ export struct CardAdvSmallImageComponent {
.margin({ left: 12 })
CardAdvBottom().width('62%').id('bottom_adv').alignRules({
CardAdvBottom({pageModel:this.pageModel,compDTO:this.compDTO}).width('62%').id('bottom_adv').alignRules({
bottom: { anchor: this.isBigThreeLine ? '' : 'adv_imag', align: VerticalAlign.Bottom },
right: { anchor: this.isBigThreeLine ? '' : 'adv_imag', align: HorizontalAlign.Start },
top: { anchor: this.isBigThreeLine ? 'title_name' : '', align: VerticalAlign.Bottom },
... ...
... ... @@ -2,6 +2,7 @@
import { CompDTO, ContentDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import PageModel from '../../viewmodel/PageModel';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
import { CardAdvBottom } from './CardAdvBottom';
... ... @@ -19,7 +20,7 @@ const TAG: string = 'Card2Component';
@Component
export struct CardAdvThreeImageComponent {
@State compDTO: CompDTO = {} as CompDTO
pageModel: PageModel = new PageModel();
aboutToAppear(): void {
}
... ... @@ -63,7 +64,7 @@ export struct CardAdvThreeImageComponent {
.margin({ top: 8 })
// 广告工具组件
CardAdvBottom().width('100%').margin({ top: 8 })
CardAdvBottom({pageModel:this.pageModel,compDTO:this.compDTO}).width('100%').margin({ top: 8 })
}
.width('100%')
.justifyContent(FlexAlign.Start)
... ...
import { CompDTO } from 'wdBean/Index';
import { Logger } from 'wdKit/Index';
import PageModel from '../../viewmodel/PageModel';
/**
* @Description: 广告稿件 顶部标签+删除按钮
* @Author:
* @Email: liyubing@wondertek.com.cn
* @CreateDate:
* @UpdateRemark: 更新说明
* @Version: 1.0
*/
@Component
export struct CardAdvTop {
pageModel: PageModel = new PageModel();
compDTO: CompDTO = {} as CompDTO
build() {
Row() {
Text($r('app.string.comp_advertisement'))
.fontSize('10fp')
.fontColor($r('app.color.white'))
.width(28)
.height(16)
.backgroundColor('#4D000000')
.borderRadius(4)
.textAlign(TextAlign.Center)
Blank()
Stack() {
Image($r('app.media.comp_adv_close_white'))
.width(9)
.height(9)
.borderRadius({
topLeft: '4vp',
topRight: '4vp',
bottomLeft: '4vp',
bottomRight: '4vp'
})
}
.width(18)
.height(14)
.backgroundColor('#4D000000')
.borderWidth(0.5)
.borderColor($r('app.color.white'))
.borderRadius(4)
}.width('100%').padding({
top: 8,
left: 8,
right: 8
}).onClick(() => {
this.delComp()
})
}
/**
* 删除稿件
*/
private delComp() {
if (this.pageModel) {
let a = this.compDTO;
let currentIndex = -1
for (let i = 0; i < this.pageModel.compList.size(); i++) {
let b = this.pageModel.compList.getData(i)
if (a.compStyle === b.compStyle && a.matInfo === b.matInfo) {
currentIndex = i
break;
}
}
Logger.error("ZZZXXXXX","currentIndex====>"+currentIndex);
if (currentIndex >= 0) {
this.pageModel.compList.deleteItem(currentIndex)
}
}
}
}
\ No newline at end of file
... ...
... ... @@ -2,6 +2,7 @@
import { CompDTO, ContentDTO, VideoInfoDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import PageModel from '../../viewmodel/PageModel';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
import { CardAdvBottom } from './CardAdvBottom';
... ... @@ -20,7 +21,7 @@ const TAG: string = 'Card2Component';
export struct CardAdvVideoComponent {
@State compDTO: CompDTO = {} as CompDTO
@State contentDTO: ContentDTO = {} as ContentDTO
pageModel: PageModel = new PageModel();
aboutToAppear(): void {
// this.contentDTO.objectType = '1'
... ... @@ -54,7 +55,7 @@ export struct CardAdvVideoComponent {
.width(CommonConstants.FULL_WIDTH)
.margin({ top: 8 })
CardAdvBottom().margin({
CardAdvBottom({pageModel:this.pageModel,compDTO:this.compDTO}).margin({
top: 8,
})
}
... ...
... ... @@ -3,6 +3,8 @@ import { AdvExtraData, AdvExtraItemData } from 'wdBean/src/main/ets/bean/adv/Adv
import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import PageModel from '../../viewmodel/PageModel';
import { CardAdvTop } from './CardAdvTop';
const TAG: string = 'Card2Component';
... ... @@ -18,6 +20,7 @@ const TAG: string = 'Card2Component';
export struct CardAdvVideoExComponent {
@State compDTO: CompDTO = {} as CompDTO
@State advExtraData: AdvExtraData = {} as AdvExtraData
pageModel: PageModel = new PageModel();
aboutToAppear(): void {
... ... @@ -45,42 +48,7 @@ export struct CardAdvVideoExComponent {
.borderColor($r('app.color.color_0D000000'))
Row() {
Text($r('app.string.comp_advertisement'))
.fontSize('10fp')
.fontColor($r('app.color.white'))
.width(28)
.height(16)
.backgroundColor('#4D000000')
.borderRadius(4)
.textAlign(TextAlign.Center)
Blank()
Stack() {
Image($r('app.media.comp_adv_close_white'))
.width(9)
.height(9)
.borderRadius({
topLeft: '4vp',
topRight: '4vp',
bottomLeft: '4vp',
bottomRight: '4vp'
})
}
.width(18)
.height(14)
.backgroundColor('#4D000000')
.borderWidth(0.5)
.borderColor($r('app.color.white'))
.borderRadius(4)
}.width('100%').padding({
top: 8,
left: 8,
right: 8
})
CardAdvTop({ pageModel: this.pageModel, compDTO: this.compDTO })
}
.alignContent(Alignment.Top)
.width(CommonConstants.FULL_WIDTH)
... ...
... ... @@ -2,6 +2,7 @@ import { ContentDTO, slideShows } from 'wdBean';
import { CommonConstants } from 'wdConstant';
import { ProcessUtils } from 'wdRouter';
import { CardSourceInfo } from '../cardCommon/CardSourceInfo';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo';
/**
* 大专题卡--CompStyle: 10
... ... @@ -23,9 +24,6 @@ export struct Card10Component {
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.margin({ bottom: 19 })
.onClick((event: ClickEvent) => {
ProcessUtils.processPage(this.contentDTO)
})
}
// 大图
Stack() {
... ... @@ -111,12 +109,23 @@ export struct Card10Component {
// 右侧图片
if (item.fullColumnImgUrls[0] && item.fullColumnImgUrls[0].url) {
Stack() {
Image(item.fullColumnImgUrls[0].url)
.width(117)
.height(78)
.objectFit(ImageFit.Cover)
.borderRadius($r('app.float.image_border_radius'))
.margin({ left: 12 })
CardMediaInfo({
contentDTO: {
objectType: String(item.objectType),
videoInfo: { videoDuration: Number(item.videoDuration) as number },
photoNum: Number(item.photoNum),
voiceInfo: { voiceDuration: Number(item.voiceDuration) as number }
} as ContentDTO
})
}
.alignContent(Alignment.BottomEnd)
}
}
.padding({ top: 10, bottom: 10 })
... ...
... ... @@ -15,7 +15,7 @@ export class publishCommentModel {
/*【迭代二新增】关联的频道id/专题id; 页面必传*/
targetRelObjectId: string = ""
/*【迭代二新增】是否是重点稿件 1是 0否 页面必传*/
keyArticle: string = ''
keyArticle: string = '0'
/*内容类别, 1:点播,2:直播,3:活动,4:广告,5:专题,6:链接,7:榜单,8:图文,9:组图,10:H5新闻,11:频道,12:组件,13:音频,14:动态(13和14为中文版新增) 页面必传*/
targetType: string = ''
/*评论总数*/
... ...
... ... @@ -9,8 +9,9 @@ import measure from '@ohos.measure'
import { CommentCustomDialog } from './CommentCustomDialog'
import { publishCommentModel } from '../model/PublishCommentModel';
import { ifaa } from '@kit.OnlineAuthenticationKit';
import { HttpUrlUtils } from 'wdNetwork/Index';
import { HttpUrlUtils, HttpUtils } from 'wdNetwork/Index';
import NoMoreLayout from '../../page/NoMoreLayout';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
const TAG = 'CommentComponent';
... ... @@ -181,9 +182,6 @@ export struct CommentComponent {
if (this.hasMore === false) NoMoreLayout()
}
}
// .onScrollFrameBegin((offset: number, state: ScrollState)=>{
//
// })
.onReachEnd(()=>{
if (this.hasMore) {
this.getData()
... ... @@ -559,6 +557,12 @@ struct commentFooterView {
}
.onClick(() => {
// 未登录,跳转登录
const user_id = HttpUtils.getUserId()
if (!user_id) {
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
return
}
commentLikeChange(this.item)
commentViewModel.commentLike(this.item).then(() => {
}).catch(() => {
... ...
... ... @@ -7,17 +7,17 @@ import commentViewModel from '../viewmodel/CommentViewModel'
@Preview
@CustomDialog
export struct CommentCustomDialog {
@ObjectLink publishCommentModel: publishCommentModel
controller?: CustomDialogController
confirm: (value: Record<string, string>) => void = () => {
}
@State private emojiSwitch: boolean = false
textInputController: TextAreaController = new TextAreaController()
@State positionInfo: CaretOffset = { index: 0, x: 0, y: 0 }
aboutToAppear(): void {
// this.textInputController.caretPosition(0)
}
publishCommentRequest() {
... ... @@ -25,7 +25,7 @@ export struct CommentCustomDialog {
// this.publishCommentModel.commentContent = this.commentText
//TODO 判断类型
this.publishCommentModel.commentType = '2'
commentViewModel.publishComment(this.publishCommentModel).then((model:commentItemModel) => {
commentViewModel.publishComment(this.publishCommentModel).then((model: commentItemModel) => {
this.publishCommentModel.commentContent = ''
//
... ... @@ -74,12 +74,13 @@ export struct CommentCustomDialog {
.height(30)
.onClick(() => {
// this.commentText = this.commentText + '神鼎'
this.positionInfo = this.textInputController.getCaretOffset()
this.emojiSwitch = !this.emojiSwitch
if (this.emojiSwitch) {
this.textInputController.stopEditing()
} else {
this.textInputController.caretPosition(this.textInputController.getTextContentRect().x)
// this.textInputController.caretPosition(this.textInputController.getTextContentRect().x)
}
})
... ... @@ -116,7 +117,7 @@ export struct CommentCustomDialog {
//表情view
if (this.emojiSwitch) {
emojiView()
emojiView({ publishCommentModel: this.publishCommentModel }).height(150)
}
}.backgroundColor(Color.White)
... ... @@ -129,8 +130,88 @@ export struct CommentCustomDialog {
@Component
struct emojiView {
@ObjectLink publishCommentModel: publishCommentModel
/*没找到获取系统emoji的方案*/
private emojiString = '😀,😁,😂,😃,😄,😅,😆,😇,😈,😉,😊,😋,😌,😍,😎,😏,😐,😑,😒,😓,😔,😕,😖,😗,😘,😙,😚,😛,😜,😝,😞,😟,😠,😡,😢,😣,😤,😥,😦,😧,😨,😩,😪,😫,😬,😭,😮,😯,😰,😱,😲,😳,😴,😵,😶,😷,😸,😹,😺,😻,😼,😽,😾,😿,🙀,🙅,🙆,🙇,🙈,🙉,🙊,🙋,🙌,🙍,🙎,🙏'
private displayArray: string[][] = []
private swiperController: SwiperController = new SwiperController()
aboutToAppear(): void {
this.displayArray = chunk(this.emojiString.split(','), 20)
//补上删除按钮以及空白占位
let lastElement = this.displayArray.slice(-1)[0];
if (lastElement.length < 20) {
let needLength = (20 - lastElement.length)
for (let index = 0; index < needLength; index++) {
lastElement.push('')
}
}
this.displayArray.forEach(element => {
element.push('删除')
});
}
build() {
// String.fromCodePoint()
Swiper(this.swiperController) {
ForEach(this.displayArray, (array: [], index) => {
Column() {
Grid() {
ForEach(array, (emoji: string, subIndex: number) => {
GridItem() {
Text() {
if (emoji == '删除') {
ImageSpan($r('app.media.wdInput_delete'))
} else {
Span(emoji)
}
}.textAlign(TextAlign.Center).width(30).height(30)
// .backgroundColor(Color.Orange)
}.onClick(() => {
if (emoji == '删除') {
this.publishCommentModel.commentContent = this.publishCommentModel.commentContent.substring(0, this.publishCommentModel.commentContent.length -1)
} else if (emoji == '') {
} else {
this.publishCommentModel.commentContent = this.publishCommentModel.commentContent + emoji
}
})
})
}
.maxCount(6)
.columnsTemplate('1fr 1fr 1fr 1fr 1fr 1fr 1fr')
.rowsGap(10)
.layoutDirection(GridDirection.Row)
Row().height(40)
}
})
}
.indicator(true)
.vertical(false)
.height(140)
}
}
function chunk<T>(array: T[], size: number): T[][] {
const result: T[][] = [];
for (let i = 0; i < array.length; i += size) {
result.push(array.slice(i, i + size));
}
return result;
}
... ...
import { ViewType } from 'wdConstant/Index'
import { DateTimeUtils, LazyDataSource, WindowModel } from 'wdKit/Index'
import { commentItemModel, commentListModel } from '../model/CommentModel'
import { commentItemModel } from '../model/CommentModel'
import commentViewModel from '../viewmodel/CommentViewModel'
import { router, window } from '@kit.ArkUI'
import { CustomTitleUI } from '../../reusable/CustomTitleUI'
import { MyCommentDataSource } from '../model/MyCommentDataSource'
import { HttpUrlUtils } from 'wdNetwork/Index'
import PageModel from '../../../viewmodel/PageModel'
import { HttpUtils } from 'wdNetwork/Index'
import { ErrorComponent } from '../../view/ErrorComponent'
import { EmptyComponent , WDViewDefaultType} from '../../view/EmptyComponent'
import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh'
import { EmptyComponent, WDViewDefaultType } from '../../view/EmptyComponent'
import NoMoreLayout from '../../page/NoMoreLayout'
import { CommentCustomDialog } from './CommentCustomDialog'
import { publishCommentModel } from '../model/PublishCommentModel'
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'
const TAG = 'QualityCommentsComponent';
... ... @@ -24,9 +23,6 @@ export struct QualityCommentsComponent {
@State hasMore: boolean = true;
@State currentPage: number = 1;
private scroller: Scroller = new Scroller();
@State tileOpacity: number = 0;
firstPositionY: number = 0;
bottomSafeHeight: string = AppStorage.get<number>('bottomSafeHeight') + 'px';
... ... @@ -34,6 +30,11 @@ export struct QualityCommentsComponent {
lastWindowColor: string = '#ffffff'
currentWindowColor: string = '#FF4202'
@State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource();
@State dialogController: CustomDialogController | null = null;
/*必传*/
@State publishCommentModel: publishCommentModel = new publishCommentModel()
aboutToDisappear(): void {
... ... @@ -43,13 +44,33 @@ export struct QualityCommentsComponent {
windowClass.setWindowLayoutFullScreen(false)
// windowClass.setWindowSystemBarProperties({ statusBarColor: '#000' })
this.dialogController = null // 将dialogController置空
}
aboutToAppear(): void {
this.fullScreen();
this.getData();
this.showAlert()
}
showAlert(){
this.dialogController = new CustomDialogController({
builder: CommentCustomDialog({
confirm: (value: Record<string, string>) => {
},
publishCommentModel: this.publishCommentModel
}),
autoCancel: true,
alignment: DialogAlignment.Bottom,
customStyle: true,
offset: {
dx: 0,
dy: -20
},
})
}
getData(resolve?: (value: string | PromiseLike<string>) => void){
... ... @@ -217,7 +238,7 @@ export struct QualityCommentsComponent {
// ListItemGroup({ header: this.titleHeader() })
LazyForEach(this.allDatas, (item: commentItemModel, index: number) => {
ListItem() {
QualityCommentItem({ item: item, index: index }).margin({ left: 12, right: 12 })
QualityCommentItem({ item: item, index: index , dialogController:this.dialogController, publishCommentModel:this.publishCommentModel}).margin({ left: 12, right: 12 })
}
})
// 加载更多
... ... @@ -243,16 +264,6 @@ export struct QualityCommentsComponent {
}
@Builder
testLayout(){
List({ space: 12, scroller:this.scroller }){
LazyForEach(this.allDatas, (item: commentItemModel, index: number) => {
ListItem() {
QualityCommentItem({ item: item, index: index }).margin({ left: 12, right: 12 })
}
})
}
}
}
... ... @@ -261,6 +272,8 @@ export struct QualityCommentsComponent {
@Component
struct QualityCommentItem {
@ObjectLink publishCommentModel: publishCommentModel
dialogController: CustomDialogController | null = null;
@ObjectLink item: commentItemModel
index: number = 0
... ... @@ -360,7 +373,20 @@ struct QualityCommentItem {
Row({ space: 16 }) {
Row() {
Image($r('app.media.comment_icon_pinglun')).width(16).height(16)
}
}.onClick(()=>{
this.publishCommentModel.targetId = this.item.targetId
this.publishCommentModel.targetRelId = this.item.targetRelId
this.publishCommentModel.targetTitle = this.item.targetTitle
this.publishCommentModel.targetRelType = this.item.targetRelType
this.publishCommentModel.targetRelObjectId = this.item.targetRelObjectId
this.publishCommentModel.targetType = this.item.targetType
// this.publishCommentModel.keyArticle = this.item.keyArticle
this.publishCommentModel.rootCommentId = this.item.rootCommentId
this.publishCommentModel.parentId = this.item.id
this.dialogController?.open()
})
Row() {
Image($r(this.item.api_status ? 'app.media.comment_like_select' : 'app.media.comment_like_normal'))
... ... @@ -373,6 +399,12 @@ struct QualityCommentItem {
.margin({ left: 3 })
}
}.onClick(() => {
// 未登录,跳转登录
const user_id = HttpUtils.getUserId()
if (!user_id) {
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
return
}
commentLikeChange(this.item)
commentViewModel.commentLike(this.item).then(() => {
}).catch(() => {
... ...
... ... @@ -4,6 +4,7 @@ import { postInteractAccentionOperateParams } from 'wdBean';
import { PageRepository } from '../../repository/PageRepository';
import { ProcessUtils } from 'wdRouter';
import { HttpUtils } from 'wdNetwork/Index';
import { DateTimeUtils } from 'wdKit';
/**
* 直播预约卡
... ... @@ -17,6 +18,22 @@ export struct ZhSingleRow03 {
@State compDTO: CompDTO = {} as CompDTO
scroller: Scroller = new Scroller()
format(timeNum: number) {
const todayDate = new Date().setHours(0,0,0,0)
const parseDate = new Date(timeNum).setHours(0,0,0,0);
if (todayDate === parseDate) {
return '今天'
} else { const str = DateTimeUtils.formatDate(timeNum, 'MM月dd日')
const month: string = str.split('月')[0];
if (month[0] === "0") {
return str.slice(1)
} else {
return str.slice(0)
}
}
}
build() {
Column() {
//顶部
... ... @@ -42,7 +59,8 @@ export struct ZhSingleRow03 {
Row() {
Flex({justifyContent: FlexAlign.SpaceBetween}){
Row() {
Text(item.liveInfo.liveStartTime.split(' ')[0].slice(5).split('-').join('月')+'日')
Text(this.format(new Date(item.liveInfo.liveStartTime).getTime()))
// Text(item.liveInfo.liveStartTime.split(' ')[0].slice(5).split('-').join('月')+'日')
.margin({right: 6})
.fontColor(0x000000)
.fontSize(13)
... ... @@ -106,7 +124,7 @@ export struct ZhSingleRow03 {
.width(3)
.height(16)
.margin({ right: 4 })
Text('直播预')
Text('直播预')
.fontSize($r("app.float.font_size_17"))
.fontColor($r("app.color.color_222222"))
.fontWeight(600)
... ...
... ... @@ -9,13 +9,12 @@ export default struct MinePageMoreFunctionUI {
build() {
Column() {
Column() {
Text(`更多功能`)
.width('456lpx')
.height('38lpx')
.fontColor($r('app.color.color_666666'))
Text("更多功能")
.fontColor($r('app.color.color_222222'))
.fontSize('29lpx')
.margin({ left: "31lpx" })
.fontWeight('600lpx')
.lineHeight('46lpx')
.fontWeight(FontWeight.Bold)
}.height('92lpx')
.width('100%')
.justifyContent(FlexAlign.Center)
... ...
... ... @@ -85,6 +85,7 @@ export struct FollowFirstTabsComponent{
.vertical(false)
.barMode(BarMode.Scrollable)
.barWidth('100%')
.barBackgroundColor($r('app.color.white'))
.barHeight('84lpx')
.animationDuration(0)
.onChange((index: number) => {
... ...
... ... @@ -70,9 +70,15 @@ export struct FollowListDetailUI {
Column() {
if (this.count === 0) {
if (this.isGetRequest == true) {
if(this.creatorDirectoryId === -1){
EmptyComponent({ emptyType: 14,emptyHeight:"100%" })
.layoutWeight(1)
.width('100%')
}else{
EmptyComponent({ emptyType: 16,emptyHeight:"100%" })
.layoutWeight(1)
.width('100%')
}
}
} else {
... ...
import { FollowListItem, FollowThirdListItem } from '../../../viewmodel/FollowListItem'
import { FollowListDetailUI } from './FollowListDetailUI'
import measure from '@ohos.measure'
@Component
export struct FollowThirdTabsComponent{
... ... @@ -11,8 +12,8 @@ export struct FollowThirdTabsComponent{
private controller: TabsController = new TabsController()
fontColor: string = '#999999'
selectedFontColor: string = '#000000'
fontColor: string = '#666666'
selectedFontColor: string = '#222222'
build(){
if(this.data != null){
... ... @@ -26,32 +27,44 @@ export struct FollowThirdTabsComponent{
@Builder TabBuilder(index: number, item: FollowThirdListItem) {
Column(){
Row(){
Image(index === 0?$r("app.media.ic_collect_left_left"):(index === this.data[this.firstIndex].children[this.secondIndex].children.length-1?$r('app.media.ic_collect_right_left'):$r('app.media.ic_collect_mid_left')))
.width(index === 0?"19lpx":"35lpx")
.height('61lpx')
.objectFit(ImageFit.Fill)
Text(item.directoryName)
.fontSize('30lpx')
.textAlign(TextAlign.Center)
.fontWeight(this.currentIndex === index ? 600 : 400)
.fontSize('27lpx')
.fontWeight(this.currentIndex === index ? "600lpx" : "400lpx")
.fontColor(this.currentIndex === index ? this.selectedFontColor : this.fontColor)
.lineHeight('38lpx')
.backgroundColor($r('app.color.color_F9F9F9'))
.padding('13lpx')
.maxLines(1)
.lineHeight('35lpx')
.backgroundImage($r('app.media.ic_collect_mid'))
.backgroundImageSize(ImageSize.Cover)
.padding({top:"13lpx",bottom:"13lpx"})
Image(index === 0?$r("app.media.ic_collect_left_right"):(index === this.data[this.firstIndex].children[this.secondIndex].children.length-1?$r('app.media.ic_collect_right_right'):$r('app.media.ic_collect_mid_right')))
.width(index === this.data[this.firstIndex].children[this.secondIndex].children.length-1?"19lpx":"35lpx")
.height('61lpx')
.objectFit(ImageFit.Fill)
}
}
.onClick(()=>{
this.currentIndex = index
this.controller.changeIndex(this.currentIndex)
})
.height('84lpx')
.margin({right:'9lpx'})
.padding({left:'20lpx',right:index === this.data[this.firstIndex].children[this.secondIndex].children.length-1?"20lpx":"0lpx"})
.justifyContent(FlexAlign.Center)
.offset({x:index === 0?"0lpx":"-5lpx"})
.height('80lpx')
.justifyContent(FlexAlign.End)
}
@Builder FollowThirdUI(){
Column(){
Column() {
// 页签
Row({ space: 7 }) {
Row() {
Scroll() {
Row() {
ForEach(this.data[this.firstIndex].children[this.secondIndex].children, (item: FollowThirdListItem, index: number ) => {
... ... @@ -63,8 +76,8 @@ export struct FollowThirdTabsComponent{
.align(Alignment.Start)
.scrollable(ScrollDirection.Horizontal)
.scrollBar(BarState.Off)
.width('90%')
.padding({left:'11lpx'})
.width('100%')
.padding({left:'31lpx',right:'48lpx'})
}
.alignItems(VerticalAlign.Bottom)
.width('100%')
... ... @@ -77,11 +90,6 @@ export struct FollowThirdTabsComponent{
ForEach(this.data[this.firstIndex].children[this.secondIndex].children, (item: FollowThirdListItem, index: number ) => {
TabContent(){
Column(){
Divider().width('100%')
.height('2lpx')
.strokeWidth('1lpx')
.backgroundColor($r('app.color.color_EDEDED'))
.margin({left:'20lpx'})
FollowListDetailUI({creatorDirectoryId:this.data[this.firstIndex].children[this.secondIndex].children[index].id})
}
}
... ... @@ -99,4 +107,19 @@ export struct FollowThirdTabsComponent{
}
}
getMeasureText(text: string,index:number) {
let width = measure.measureText({
textContent: text,
fontSize: px2fp(27),
lineHeight: px2fp(35)
})
if(index === 0){
return width + 19+ 35
}else if(index === this.data[this.firstIndex].children[this.secondIndex].children.length-1){
return width + 35+ 35
}else{
return width + 35+ 19
}
}
}
\ No newline at end of file
... ...
import { ContentDTO, Params } from 'wdBean';
import { DateTimeUtils, LazyDataSource, SPHelper,UserDataLocal } from 'wdKit';
import { ProcessUtils, WDRouterPage, WDRouterRule } from 'wdRouter';
import { WDRouterPage, WDRouterRule } from 'wdRouter';
import MinePageDatasModel from '../../../model/MinePageDatasModel';
import { CommentListItem } from '../../../viewmodel/CommentListItem';
import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem';
... ... @@ -106,6 +105,7 @@ export struct HomePageBottomComponent{
EmptyComponent({emptyType:14})
.layoutWeight(1)
.width('100%')
.offset({y:"-200lpx"})
}
}.layoutWeight(1)
.justifyContent(FlexAlign.Start)
... ... @@ -114,6 +114,7 @@ export struct HomePageBottomComponent{
EmptyComponent({emptyType:11})
.layoutWeight(1)
.width('100%')
.offset({y:"-200lpx"})
}
}
}else{
... ... @@ -323,6 +324,27 @@ export struct HomePageBottomComponent{
data.push(new CommentListItem(item.fromUserHeader,item.fromUserName,item.targetTitle,item.createTime,commentContent,item.likeNum,0,item.id,item.targetId,item.targetType,item.targetRelId,item.targetRelObjectId,item.targetRelType,item.targetStatus,item.checkStatus,parentCommentContent,parentCommentUserName))
})
if(status.commentIdList.length === 0){
data.forEach((item)=>{
let publishTime = DateTimeUtils.getCommentTime(DateTimeUtils.parseDate(item.createTime,DateTimeUtils.PATTERN_DATE_TIME_HYPHEN))
this.data_comment.push(new CommentListItem(item.fromUserHeader,item.fromUserName,item.targetTitle,publishTime,item.commentContent,item.likeNum,item.like_status,item.id,item.targetId,item.targetType,item.targetRelId,item.targetRelObjectId,item.targetRelType,item.targetStatus,item.checkStatus,item.parentCommentContent,item.parentCommentUserName))
})
this.data_comment.notifyDataReload()
this.count = this.data_comment.totalCount()
this.commentNum = value.totalCount
if (this.data_comment.totalCount() < value.totalCount) {
this.curPageNum++
}else {
this.hasMore = false
}
this.isLoading = false
this.isGetRequest = true
return
}
MinePageDatasModel.getOtherUserCommentLikeStatusData(status,getContext(this)).then((newValue)=>{
newValue.forEach((item)=>{
data.forEach((list)=>{
... ...
... ... @@ -139,6 +139,27 @@ export struct OtherHomePageBottomCommentComponent {
data.push(new CommentListItem(item.fromUserHeader, item.fromUserName, item.targetTitle, item.createTime, commentContent, item.likeNum, 0, item.id, item.targetId, item.targetType, item.targetRelId, item.targetRelObjectId, item.targetRelType, item.targetStatus, item.checkStatus, parentCommentContent, parentCommentUserName))
})
if(status.commentIdList.length === 0){
data.forEach((item) => {
this.data_comment.push(new CommentListItem(item.fromUserHeader, item.fromUserName, item.targetTitle, item.createTime, item.commentContent, item.likeNum, item.like_status, item.id, item.targetId, item.targetType, item.targetRelId, item.targetRelObjectId, item.targetRelType, item.targetStatus, item.checkStatus, item.parentCommentContent, item.parentCommentUserName))
})
this.data_comment.notifyDataReload()
this.count = this.data_comment.totalCount()
this.commentNum = value.totalCount
if (this.data_comment.totalCount() < value.totalCount) {
this.curPageNum++
} else {
this.hasMore = false
}
this.isLoading = false
this.isGetRequest = true
return
}
MinePageDatasModel.getOtherUserCommentLikeStatusData(status, getContext(this)).then((newValue) => {
newValue.forEach((item) => {
data.forEach((list) => {
... ...
... ... @@ -319,7 +319,7 @@ struct ChannelDialog {
}
}
}),
PanGesture({ fingers: 1, direction: null, distance: 0 })
PanGesture({ fingers: 1, direction: this.isEditIng ? PanDirection.All:PanDirection.None, distance: 0 })
.onActionStart((event: GestureEvent) => {
this.dragItem = item.num
this.dragRefOffsetX = 0
... ...
... ... @@ -3,6 +3,7 @@ import { RefreshLayoutBean } from './RefreshLayoutBean';
/**
* Custom layout to show refresh or load.
* @deprecated
*/
@Component
export default struct CustomLayout {
... ...
... ... @@ -3,8 +3,6 @@ import { Logger } from 'wdKit';
import { EmptyComponent } from '../view/EmptyComponent';
import PageModel from '../../viewmodel/PageModel';
import { autoRefresh, listTouchEvent } from '../../utils/PullDownRefresh';
import RefreshLayout from './RefreshLayout';
import { RefreshLayoutBean } from './RefreshLayoutBean';
import LoadMoreLayout from './LoadMoreLayout';
import { CompParser } from '../CompParser';
import { CompDTO } from 'wdBean';
... ... @@ -14,6 +12,8 @@ import { ProcessUtils } from 'wdRouter/Index';
import PageAdModel from '../../viewmodel/PageAdvModel';
import PageNoMoreLayout from './PageNoMoreLayout';
import { NoMoreBean } from './NoMoreBean';
import { RefreshLayoutBean } from '../refresh/RefreshLayoutBean';
import RefreshLayout from '../refresh/RefreshLayout';
const TAG = 'PageComponent';
... ... @@ -66,15 +66,15 @@ export struct PageComponent {
// 下拉刷新
ListItem() {
RefreshLayout({
refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullDown, this.pageModel.pullDownRefreshImage,
this.pageModel.pullDownRefreshText, this.pageModel.pullDownRefreshHeight)
refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullDown, this.pageModel.load,
this.pageModel.offsetY)
})
}
LazyForEach(this.pageModel.compList, (compDTO: CompDTO, compIndex: number) => {
ListItem() {
Column() {
CompParser({ compDTO: compDTO, compIndex: compIndex });
CompParser({ pageModel: this.pageModel, compDTO: compDTO, compIndex: compIndex });
}
}
},
... ...
... ... @@ -99,8 +99,12 @@ struct PeopleShipHomePage {
}
async aboutToAppear() {
aboutToAppear() {
this.getData()
}
private async getData() {
try {
// 获取页面信息
this.detailModel = await PeopleShipHomePageDataModel.getPeopleShipHomePageDetailInfo(this.creatorId, '', '')
... ... @@ -117,8 +121,6 @@ struct PeopleShipHomePage {
} catch (exception) {
}
}
findFollowStata(followList: QueryListIsFollowedItem[]) {
... ... @@ -156,8 +158,10 @@ struct PeopleShipHomePage {
PageRepository.postInteractAccentionOperate(params).then(res => {
if (this.isAttention == '1') {
this.isAttention = '0'
this.detailModel.fansNum -= 1
} else {
this.isAttention = '1'
this.detailModel.fansNum += 1
}
this.isLoadingAttention = false
})
... ...
... ... @@ -3,6 +3,7 @@ import { RefreshLayoutBean } from './RefreshLayoutBean';
/**
* The refresh layout component.
* @deprecated
*/
@Component
export default struct RefreshLayout {
... ...
/**
* Custom refresh load layout data.
* @deprecated
*/
@Observed
export class RefreshLayoutBean {
... ...
import { ContentDTO } from 'wdBean';
import { ContentDTO , Action,GoldenPositionExtraBean} from 'wdBean';
import { CommonConstants ,ViewType} from 'wdConstant';
import PageViewModel from '../../viewmodel/PageViewModel';
import RefreshLayout from '../page/RefreshLayout';
... ... @@ -22,9 +22,14 @@ struct ThemeListPage {
currentPage: number = 1;
pageSize: number = 20;
title: string = '金刚位聚合页'
extra: string = ''
aboutToAppear(): void {
PageViewModel.postThemeList(this.sort, this.currentPage, this.pageSize).then((liveReviewDTO) => {
let par:Action = router.getParams() as Action;
let params = par?.params;
this.extra = params?.extra?.extra || '';
this.title = params?.extra?.title || '';
PageViewModel.postThemeList(this.sort, this.currentPage, this.pageSize,this.extra).then((liveReviewDTO) => {
console.log(`postThemeList${JSON.stringify(liveReviewDTO)}`)
this.data.push(...liveReviewDTO.list)
if(this.data.getDataArray().length > 0){
... ...
... ... @@ -339,8 +339,8 @@ export struct TopNavigationComponent {
}else {
Row() {
Image($r('app.media.icon_search'))
.width(18)
.height(18)
.width('24vp')
.height('24vp')
}
.height('40vp')
.width('40vp')
... ...
... ... @@ -3,31 +3,29 @@ import { FollowListDetailItem } from '../../viewmodel/FollowListDetailItem';
@Component
export struct PeopleShipAttentionContentListHeadComponent {
@State index: number = 0
@ObjectLink item: FollowListDetailItem
build() {
Column(){
Column() {
// 头像
PeopleShipHomePageHeadComponent({
diameter: 48,
iconDiameter: 16,
headPhotoUrl: this.index == 0 ? $r('app.media.attention_mine') :
((this.item.attentionHeadPhotoUrl && this.item.attentionHeadPhotoUrl.length > 0) ?
this.item.attentionHeadPhotoUrl : $r('app.media.WDAccountOwnerHedaerDefaultIcon')),
authIcon: this.index == 0 ? '' : this.item.authIcon
headPhotoUrl: (this.item.attentionHeadPhotoUrl && this.item.attentionHeadPhotoUrl.length > 0) ?
this.item.attentionHeadPhotoUrl : $r('app.media.WDAccountOwnerHedaerDefaultIcon'),
authIcon: this.item.authIcon
}).margin({
bottom: '8vp'
})
Text(this.index == 0 ? '我的关注' : this.item.attentionUserName)
Text(this.item.attentionUserName)
.fontColor($r('app.color.color_666666'))
.fontSize($r('app.float.vp_13'))
.fontWeight(400)
.height('18vp')
.lineHeight('18vp')
.maxLines(1)
.textOverflow({overflow: TextOverflow.Ellipsis})
.textOverflow({ overflow: TextOverflow.Ellipsis })
.padding({
left: '2vp',
right: '2vp'
... ... @@ -36,7 +34,7 @@ export struct PeopleShipAttentionContentListHeadComponent {
.alignItems(HorizontalAlign.Center)
.width('78vp')
.margin({
left: this.index == 0 ? '8vp' : '4vp',
left: '4vp',
top: '14vp',
bottom: '14vp'
})
... ...
... ... @@ -6,37 +6,72 @@ import { PeopleShipAttentionContentListHeadComponent } from './PeopleShipAttenti
@Component
export struct PeopleShipAttentionContentListTopComponent {
@Prop followList: FollowListDetailItem[]
build() {
Column() {
List(){
List() {
ListItem() {
PeopleShipAttentionContentListHeadComponent({
index: 0,
item: this.followList[0]
})
this.PeopleShipFollowTop()
}.onClick(() => {
// 跳转到关注列表-我的
WDRouterRule.jumpWithPage(WDRouterPage.followListPage)
})
ForEach(this.followList, (item: FollowListDetailItem, index: number) => {
ForEach(this.followList, (item: FollowListDetailItem) => {
ListItem() {
PeopleShipAttentionContentListHeadComponent({
index: index + 1,
item: item
})
}.onClick(() => {
let creatorId = item.attentionCreatorId || ''
ProcessUtils.gotoPeopleShipHomePage(creatorId)
})
}, (item: FollowListDetailItem) => item.attentionCreatorId)
}, (item: FollowListDetailItem, index: number) => item.attentionCreatorId + index)
}
.listDirection(Axis.Horizontal)
.scrollBar(BarState.Off)
.width('100%')
.height('102vp')
Divider().strokeWidth(1).color($r('app.color.color_F5F5F5'))
}
}
@Builder
PeopleShipFollowTop() {
Column() {
// 头像
Image($r('app.media.attention_mine'))
.alt($r('app.media.attention_mine'))
.width(48)
.height(48)
.borderRadius(24)
.objectFit(ImageFit.ScaleDown)
.backgroundColor($r('app.color.color_F5F5F5'))
.margin({
bottom: '8vp'
})
Text('我的关注')
.fontColor($r('app.color.color_666666'))
.fontSize($r('app.float.vp_13'))
.fontWeight(400)
.height('18vp')
.lineHeight('18vp')
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.padding({
left: '2vp',
right: '2vp'
})
}
.alignItems(HorizontalAlign.Center)
.width('78vp')
.margin({
left: '8vp',
top: '14vp',
bottom: '14vp'
})
}
}
... ...
... ... @@ -280,6 +280,7 @@ export struct PeopleShipMainComponent {
//批量查询各类型内容动态数据接口
this.checkContentInteractData(listData.list, resolve)
} else {
this.hasMore = false;
this.resolveEnd(true, resolve)
}
... ...
... ... @@ -25,12 +25,27 @@ export struct PeopleShipRecommendHeadComponent {
})
}.margin({ top: 12, bottom: 8 })
Row() {
Text(this.rmhInfo.userName)
.fontColor($r('app.color.color_222222'))
.fontSize($r('app.float.vp_14'))
.fontWeight(600)
.maxLines(1)
.textOverflow({overflow: TextOverflow.Ellipsis})
if (this.rmhInfo.authIcon) {
Image(this.rmhInfo.authIcon)
.width('12vp')
.height('12vp')
.borderRadius(6)
.objectFit(ImageFit.Cover)
.margin({
left: '2vp'
})
}
}
.alignItems(VerticalAlign.Center)
.justifyContent(FlexAlign.Center)
Text(this.rmhInfo.introduction)
.fontColor($r('app.color.color_B0B0B0'))
... ...
import { ToastUtils } from 'wdKit';
@Component
export struct PeopleShipHomeAttentionComponent {
@Consume isAttention: string
... ... @@ -18,7 +20,14 @@ export struct PeopleShipHomeAttentionComponent {
.height(20)
.color($r('app.color.color_fff'))
}else {
Text('+ 关注')
Image($r('app.media.people_ship_top_add'))
.objectFit(ImageFit.Auto)
.width('16vp')
.height('16pv')
.margin({
right: '4vp'
})
Text('关注')
.fontColor(Color.White)
.fontSize($r('app.float.vp_14'))
.fontWeight(500)
... ... @@ -104,7 +113,7 @@ export struct PeopleShipHomeAttentionComponent {
left: '-5vp'
})
.onClick(() => {
ToastUtils.showToast('分享为公共方法,待开发', 1000);
})
}
... ...
... ... @@ -24,7 +24,7 @@ export struct PeopleShipHomeListComponent {
// 列表
else if (this.publishCount == 0) {
// 无数据展示
EmptyComponent({emptyType: 13}).height(DisplayUtils.getDeviceHeight() - this.topHeight)
EmptyComponent({emptyType: 12}).height(DisplayUtils.getDeviceHeight() - this.topHeight)
} else {
Column() {
Column() {
... ... @@ -38,14 +38,17 @@ export struct PeopleShipHomeListComponent {
}
.justifyContent(FlexAlign.Start)
}
.backgroundColor(Color.White)
.align(Alignment.Start)
.scrollable(ScrollDirection.Horizontal)
.scrollBar(BarState.Off)
.width('100%')
}
.backgroundColor(Color.White)
.alignItems(VerticalAlign.Bottom)
.width('100%')
}
.justifyContent(FlexAlign.Start)
.height('44vp')
.alignItems(HorizontalAlign.Start)
.width('100%')
... ...
import router from '@ohos.router'
import { PeopleShipUserDetailData } from 'wdBean'
import { PeopleShipHomePageHeadComponent } from './PeopleShipHomePageHeadComponent'
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'
import { ToastUtils } from 'wdKit';
@Component
export struct PeopleShipHomePageNavComponent {
... ... @@ -38,8 +40,13 @@ export struct PeopleShipHomePageNavComponent {
iconDiameter: 10,
headPhotoUrl: (this.detailModel.headPhotoUrl && this.detailModel.headPhotoUrl.length > 0 ) ? this.detailModel.headPhotoUrl : $r('app.media.WDAccountOwnerHedaerDefaultIcon'),
authIcon: this.detailModel.authIcon
})
.margin({
}).onClick(()=>{
let params = {
'headPhotoUrl': this.detailModel.headPhotoUrl,
'headType': '1'
} as Record<string, string>;
WDRouterRule.jumpWithPage(WDRouterPage.showUserHeaderPage,params)
}).margin({
left: '10vp',
})
.visibility((this.topOpacity > 0.5 ? Visibility.Visible : Visibility.Hidden))
... ... @@ -56,7 +63,25 @@ export struct PeopleShipHomePageNavComponent {
if (this.isAttention == '0') {
// 关注
Button('+ 关注', { type: ButtonType.Normal, stateEffect: true })
Button({ type: ButtonType.Normal, stateEffect: true }) {
Row(){
Image($r('app.media.people_ship_top_add'))
.objectFit(ImageFit.Auto)
.width('12vp')
.height('12pv')
.margin({
right: '2vp'
})
Text('关注')
.fontSize($r('app.float.vp_12'))
.fontColor(Color.White)
}
.alignSelf(ItemAlign.Center)
.justifyContent(FlexAlign.Center)
.width('100%')
.height('100%')
}
.borderRadius(4)
.backgroundColor($r('app.color.color_ED2800'))
.width('54vp')
... ... @@ -71,8 +96,6 @@ export struct PeopleShipHomePageNavComponent {
left: '12vp',
})
.padding(0)
.fontSize($r('app.float.vp_12'))
.fontColor(Color.White)
.visibility((this.attentionOpacity ? Visibility.Visible : Visibility.Hidden))
} else {
Button('已关注', { type: ButtonType.Normal, stateEffect: true })
... ... @@ -104,7 +127,7 @@ export struct PeopleShipHomePageNavComponent {
.objectFit(ImageFit.Auto)
.margin({ right: '10vp' })
.onClick(() => {
ToastUtils.showToast('分享为公共方法,待开发', 1000);
})
}
.width('100%')
... ...
... ... @@ -5,7 +5,7 @@ export struct PeopleShipHomePageAttestationComponent {
build() {
Row() {
Text(this.name)
.lineHeight('16vp')
.lineHeight('18vp')
.fontColor($r('app.color.color_ED2800'))
.fontSize($r('app.float.vp_11'))
.backgroundColor($r('app.color.color_1AED2800'))
... ... @@ -16,21 +16,27 @@ export struct PeopleShipHomePageAttestationComponent {
left: '16vp',
})
.padding({
top: '3vp',
bottom: '3vp',
right: '6vp',
left: '6vp'
top: '1vp',
bottom: '1vp',
right: '4vp',
left: '4vp'
})
Text(this.content)
.lineHeight('22vp')
.lineHeight('18vp')
.fontSize($r('app.float.vp_12'))
.layoutWeight(1)
.fontColor($r('app.color.color_222222'))
.textAlign(TextAlign.Start)
.align(Alignment.Center)
.padding(0)
.margin({
right: '16vp'
})
.padding({
top: '1vp',
bottom: '1vp',
})
}
.width('100%')
.alignItems(VerticalAlign.Top)
... ...
... ... @@ -9,6 +9,7 @@ export struct PeopleShipHomePageHeadComponent {
Stack({ alignContent: Alignment.BottomEnd }) {
// 头像
Image( this.headPhotoUrl )
.alt($r('app.media.WDAccountOwnerHedaerDefaultIcon'))
.width(this.diameter)
.height(this.diameter)
.borderRadius(this.diameter/2)
... ...
... ... @@ -7,6 +7,7 @@ import { PeopleShipHomePageDataModel } from '../../viewmodel/PeopleShipHomePageD
import { InfluenceData, PeopleShipUserDetailData } from 'wdBean'
import { PeopleShipHomeAttentionComponent } from './PeopleShipHomeAttentionComponent'
import { HWLocationUtils } from 'wdHwAbility'
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'
@Component
... ... @@ -27,30 +28,37 @@ export struct PeopleShipHomePageTopComponent {
@State collapseTxt: string = '…展开';
private subTxt: string = '';
@State content: string = ''
@State topFixedHeight: number = 320
@State topFixedHeight: number = 286
@State lineInNum: number = 1
@Link topHeight: number
@State provinceName: string = ''
build() {
Column() {
Stack({ alignContent: Alignment.TopStart}) {
Stack({ alignContent: Alignment.TopStart }) {
// 顶部图片
Image($r('app.media.home_page_bg'))
.width('100%')
.height('120vp')
.objectFit(ImageFit.Fill)
.backgroundColor(Color.Black)
.backgroundColor(Color.White)
// 头像和名称
Row() {
// 头像
PeopleShipHomePageHeadComponent({
diameter: 80,
iconDiameter: 20,
headPhotoUrl:(this.detailModel.headPhotoUrl && this.detailModel.headPhotoUrl.length > 0) ? this.detailModel.headPhotoUrl : $r('app.media.WDAccountOwnerHedaerDefaultIcon') ,
headPhotoUrl: (this.detailModel.headPhotoUrl && this.detailModel.headPhotoUrl.length > 0) ? this.detailModel.headPhotoUrl : $r('app.media.WDAccountOwnerHedaerDefaultIcon'),
authIcon: this.detailModel.authIcon
}).margin({
left: '10vp',
bottom: '20vp'
}).onClick(() => {
let params = {
'headPhotoUrl': this.detailModel.headPhotoUrl,
'headType': '1'
} as Record<string, string>;
WDRouterRule.jumpWithPage(WDRouterPage.showUserHeaderPage, params)
})
... ... @@ -61,7 +69,7 @@ export struct PeopleShipHomePageTopComponent {
.fontColor($r('app.color.color_222222'))
.fontWeight(500)
.textAlign(TextAlign.Start)
.textOverflow({overflow: TextOverflow.Ellipsis})
.textOverflow({ overflow: TextOverflow.Ellipsis })
.maxLines(2)
.layoutWeight(1)
.margin({
... ... @@ -78,49 +86,50 @@ export struct PeopleShipHomePageTopComponent {
.width('100%')
.height('180vp')
.backgroundColor(Color.Transparent)
// 认证id:1蓝2黄,蓝v 只有官方认证,黄v有领域和身份认证
// 官方认证
if(this.detailModel.authId == 1 && this.detailModel.categoryAuth.length > 0) {
PeopleShipHomePageAttestationComponent({name: '官方认证', content: this.detailModel.categoryAuth})
if (this.detailModel.authId == 1 && this.detailModel.categoryAuth.length > 0) {
PeopleShipHomePageAttestationComponent({ name: '官方认证', content: this.detailModel.categoryAuth})
.margin({
top: '10vp',
top: '0vp',
bottom: '10vp'
})
}
if(this.detailModel.authId == 2) {
if (this.detailModel.authTitle && this.detailModel.authTitle.length > 0 ){
PeopleShipHomePageAttestationComponent({name: '领域认证', content: this.detailModel.authTitle})
if (this.detailModel.authId == 2) {
if (this.detailModel.authTitle && this.detailModel.authTitle.length > 0) {
PeopleShipHomePageAttestationComponent({ name: '领域认证', content: this.detailModel.authTitle })
.margin({
top: '10vp',
bottom: '10vp'
top: '0vp',
bottom: (this.detailModel.authPersonal && this.detailModel.authPersonal.length > 0) ? '6vp' : '10vp'
})
}
if (this.detailModel.authPersonal && this.detailModel.authPersonal.length > 0 ){
PeopleShipHomePageAttestationComponent({name: '身份认证', content: this.detailModel.authPersonal})
if (this.detailModel.authPersonal && this.detailModel.authPersonal.length > 0) {
PeopleShipHomePageAttestationComponent({ name: '身份认证', content: this.detailModel.authPersonal })
.margin({
top: '10vp',
top: '0vp',
bottom: '10vp'
})
}
}
// 简介
if(this.lineInNum > 3) {
if (this.lineInNum > 3) {
Row() {
Text() {
Span(this.content)
.fontColor($r('app.color.color_222222'))
Span(this.collapseTxt)
.onClick(()=>{
if(this.isCollapse){
.onClick(() => {
if (this.isCollapse) {
this.maxLines = Infinity;
this.content = `简介:${this.detailModel.introduction}`
this.isCollapse = false;
this.collapseTxt = '收起';
this.topHeight = this.topFixedHeight + 21 * this.lineInNum
}else{
} else {
this.isCollapse = true;
this.collapseTxt = '…展开';
this.content = this.subTxt;
... ... @@ -130,30 +139,36 @@ export struct PeopleShipHomePageTopComponent {
.fontColor($r('app.color.color_B0B0B0'))
}
.backgroundColor(Color.Transparent)
.lineHeight('21vp')
.width('100%')
.maxLines(this.maxLines)
.textOverflow({overflow: TextOverflow.Ellipsis})
.textOverflow({ overflow: TextOverflow.Ellipsis })
.fontSize($r('app.float.vp_14'))
.key('home_page_introduction')
.margin({
.padding({
left: '16vp',
right: '16vp',
})
}.width('100%')
.backgroundColor(Color.Transparent)
.alignItems(VerticalAlign.Top)
}else {
} else {
Row() {
Text(`简介:${this.detailModel.introduction}`)
.fontSize($r('app.float.vp_14'))
.fontColor($r('app.color.color_222222'))
.lineHeight('21vp')
.width('100%')
.maxLines(3)
.textOverflow({overflow: TextOverflow.Ellipsis})
.margin({
.textOverflow({ overflow: TextOverflow.Ellipsis })
.padding({
left: '16vp',
right: '16vp',
})
.backgroundColor(Color.Transparent)
}.width('100%')
.backgroundColor(Color.Transparent)
.alignItems(VerticalAlign.Top)
}
... ... @@ -164,7 +179,6 @@ export struct PeopleShipHomePageTopComponent {
.fontSize($r('app.float.vp_12'))
.fontColor($r('app.color.color_999999'))
.textAlign(TextAlign.Start)
.width('100%')
.alignSelf(ItemAlign.Start)
.margin({
right: '16vp',
... ... @@ -247,7 +261,8 @@ export struct PeopleShipHomePageTopComponent {
.height('6vp')
}
.width('100%')
.height('100%')
// .height('100%')
}
async aboutToAppear() {
... ... @@ -265,17 +280,15 @@ export struct PeopleShipHomePageTopComponent {
}
// 不听减去2个字-一直到时3行
private compIntroductionTextHeights() {
let introduction = `简介:${this.detailModel.introduction}`
let lineInNum1 = this.getTextLineNum(introduction, DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14'))
while (lineInNum1 > 3 ) {
while (lineInNum1 > 3) {
introduction = introduction.substring(0, introduction.length - 2);
lineInNum1 = this.getTextLineNum(introduction, DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14'))
lineInNum1 = this.getTextLineNum(introduction + this.collapseTxt, DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14'))
}
introduction = introduction.substring(0, introduction.length - 3);
// introduction = introduction.substring(0, introduction.length - 3);
Logger.debug('PeopleShipHomePageTopComponent', '3行简介:', `${introduction}`)
this.subTxt = introduction;
... ... @@ -285,7 +298,7 @@ export struct PeopleShipHomePageTopComponent {
private getTextLineNum(text: string, constraintWidth: number, lineHeight: number, fontSize: number | string | Resource) {
let size = this.topMeasureText(text, constraintWidth, lineHeight, fontSize)
let height: number = Number(size.height)
return Math.ceil(px2vp(height)/lineHeight)
return Math.ceil(px2vp(height) / lineHeight)
}
private topMeasureText(text: string, constraintWidth: number, lineHeight: number, fontSize: number | string | Resource) {
... ... @@ -299,7 +312,7 @@ export struct PeopleShipHomePageTopComponent {
async onIntroductionUpdated() {
if (this.content.length == 0 && this.detailModel.introduction ) {
if (this.content.length == 0 && this.detailModel.introduction) {
this.lineInNum = this.getTextLineNum(`简介:${this.detailModel.introduction}`, DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14'))
if (this.lineInNum > 3) {
this.compIntroductionTextHeights()
... ... @@ -307,43 +320,48 @@ export struct PeopleShipHomePageTopComponent {
}
}
if (this.detailModel) {
this.topFixedHeight = 308
this.topFixedHeight = 286
if (this.detailModel.region && this.detailModel.region.length > 0) {
this.provinceName = this.detailModel.region
}else {
} else {
this.provinceName = await this.computeIPRegion(this.detailModel.province)
}
if(this.detailModel.authId == 1 && this.detailModel.categoryAuth.length > 0) {
this.topFixedHeight += this.getTextLineNum(this.detailModel.categoryAuth, DisplayUtils.getDeviceWidth() - 90, 22, $r('app.float.vp_12'))*22
if (this.detailModel.authId == 1 && this.detailModel.categoryAuth.length > 0) {
this.topFixedHeight += this.getTextLineNum(this.detailModel.categoryAuth, DisplayUtils.getDeviceWidth() - 90, 22, $r('app.float.vp_12')) * 18
this.topFixedHeight += 12
}
else if(this.detailModel.authId == 2) {
if (this.detailModel.authTitle && this.detailModel.authTitle.length > 0 ){
this.topFixedHeight += this.getTextLineNum(this.detailModel.authTitle, DisplayUtils.getDeviceWidth() - 90, 22, $r('app.float.vp_12'))*22
else if (this.detailModel.authId == 2) {
if (this.detailModel.authTitle && this.detailModel.authTitle.length > 0) {
this.topFixedHeight += this.getTextLineNum(this.detailModel.authTitle, DisplayUtils.getDeviceWidth() - 90, 22, $r('app.float.vp_12')) * 18
if (this.detailModel.authPersonal && this.detailModel.authPersonal.length > 0){
this.topFixedHeight += 8
}else{
this.topFixedHeight += 12
}
if (this.detailModel.authPersonal && this.detailModel.authPersonal.length > 0 ){
if (this.detailModel.authTitle && this.detailModel.authTitle.length > 0 ){
this.topFixedHeight += 10
}
this.topFixedHeight += this.getTextLineNum(this.detailModel.authPersonal, DisplayUtils.getDeviceWidth() - 90, 22, $r('app.float.vp_12'))*22
if (this.detailModel.authPersonal && this.detailModel.authPersonal.length > 0) {
this.topFixedHeight += this.getTextLineNum(this.detailModel.authPersonal, DisplayUtils.getDeviceWidth() - 90, 22, $r('app.float.vp_12')) * 18
this.topFixedHeight += 12
}
}
this.lineInNum = this.getTextLineNum(`简介:${this.detailModel.introduction}`, DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14'))
if (this.lineInNum <= 3) {
this.topFixedHeight += (21 * this.lineInNum)
this.topHeight = this.topFixedHeight
}else {
this.topHeight = this.topFixedHeight + (this.isCollapse ? 21*3 : 21 * this.lineInNum )
this.topHeight = this.topFixedHeight + (21 * this.lineInNum)
} else {
this.lineInNum = this.getTextLineNum(`简介:${this.detailModel.introduction}` + '收起', DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14'))
this.topHeight = this.topFixedHeight + (this.isCollapse ? 21 * 3 : 21 * this.lineInNum)
}
// IP归属地
if (this.provinceName && this.provinceName.length > 0) {
this.topFixedHeight += 28
this.topHeight += 28
}
}
}
private computeShowNum(count: number) {
if(count >= 10000) {
return `${(count/10000).toFixed(1)}万`
if (count >= 10000) {
return `${(count / 10000).toFixed(1)}万`
}
return `${count}`
}
... ... @@ -352,7 +370,7 @@ export struct PeopleShipHomePageTopComponent {
private async computeIPRegion(province: string) {
if (province && province.length) {
try {
let provinceName = await HWLocationUtils.getProvinceName(province) ;
let provinceName = await HWLocationUtils.getProvinceName(province);
return provinceName
} catch (e) {
return ''
... ... @@ -360,5 +378,4 @@ export struct PeopleShipHomePageTopComponent {
}
return ''
}
}
\ No newline at end of file
... ...
import { RefreshLayoutBean } from '../refresh/RefreshLayoutBean';
import RefreshLoadLayout from '../refresh/RefreshLoadLayout';
/**
* The refresh layout component.
*/
@Component
export default struct RefreshLayout {
@ObjectLink refreshBean: RefreshLayoutBean;
build() {
Column() {
if (this.refreshBean.isVisible) {
RefreshLoadLayout({
refreshBean: new RefreshLayoutBean(this.refreshBean.isVisible, this.refreshBean.loadStatus, this.refreshBean.offset)
})
}
}
}
}
\ No newline at end of file
... ...
/**
* 下拉刷新数据bean.
*/
@Observed
export class RefreshLayoutBean {
/**
* Custom refresh load layout isVisible.
*/
isVisible: boolean;
loadStatus: number; // 1-下拉刷新 2-松开刷新 3-刷新完成
offset: number;
constructor(isVisible: boolean, loadStatus: LoadStatus, offset: number) {
this.isVisible = isVisible;
this.loadStatus = loadStatus;
this.offset = offset;
}
}
export const enum LoadStatus {
/**
* 触发刷新前,有下拉动作了
*/
IDLE,
/**
* 触发刷新前,有下拉动作了
*/
PRELOAD,
/**
* 刷新中
*/
LOADING,
/**
* 触发刷新结束,展示‘已更新最新’
*/
LOADED,
}
\ No newline at end of file
... ...
import lottie, { AnimationItem } from '@ohos/lottie';
import { LoadStatus, RefreshLayoutBean } from './RefreshLayoutBean';
/**
* Custom layout to show refresh or load.
* TODO 待优化
*/
@Component
export default struct CustomLayout {
// 设置刷新view高度
static readonly REFRESH_HEIGHT: number = 90;
@ObjectLink @Watch('onOffsetChange') refreshBean: RefreshLayoutBean;
private mainRenderingSettings: RenderingContextSettings = new RenderingContextSettings(true)
private mainCanvasRenderingContext: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.mainRenderingSettings)
private mainRenderingSettings2: RenderingContextSettings = new RenderingContextSettings(true)
private mainCanvasRenderingContext2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.mainRenderingSettings2)
private animateItem: AnimationItem | null = null;
private animateItem2: AnimationItem | null = null;
private animateName: string = "refresh";
private animateName2: string = "refreshing";
@State private layoutHeight: number = 0;
build() {
Stack({ alignContent: Alignment.Center }) {
Canvas(this.mainCanvasRenderingContext)
.width(60)
.height(60)
.backgroundColor(Color.Transparent)
.onReady(() => {
// 可在此生命回调周期中加载动画,可以保证动画尺寸正确
//抗锯齿的设置
this.mainCanvasRenderingContext.imageSmoothingEnabled = true;
this.mainCanvasRenderingContext.imageSmoothingQuality = 'medium'
})
.onDisAppear(() => {
lottie.destroy(this.animateName);
})
.visibility(this.refreshBean.loadStatus === LoadStatus.PRELOAD ? Visibility.Visible : Visibility.Hidden)
Canvas(this.mainCanvasRenderingContext2)
.width(60)
.height(60)
.backgroundColor(Color.Transparent)
.onReady(() => {
// 可在此生命回调周期中加载动画,可以保证动画尺寸正确
//抗锯齿的设置
this.mainCanvasRenderingContext2.imageSmoothingEnabled = true;
this.mainCanvasRenderingContext2.imageSmoothingQuality = 'medium'
})
.onDisAppear(() => {
lottie.destroy(this.animateName2);
})
.visibility(this.refreshBean.loadStatus === LoadStatus.LOADING ? Visibility.Visible : Visibility.Hidden)
Text('已更新至最新')
.fontSize(17)
.textAlign(TextAlign.Center)
.fontColor('#bbbbbb')
.visibility(this.refreshBean.loadStatus != LoadStatus.LOADED ? Visibility.Hidden : Visibility.Visible)
}
.clip(true)
.width('100%')
.height(this.layoutHeight)
}
animate1(offset: number) {
if (this.animateItem == null) {
this.animateItem = lottie.loadAnimation({
container: this.mainCanvasRenderingContext,
renderer: 'canvas', // canvas 渲染模式
loop: 1,
autoplay: true,
name: this.animateName,
path: "lottie/refresh_step1.json", // 路径加载动画只支持entry/src/main/ets 文件夹下的相对路径
})
}
this.animateItem.goToAndStop(1)
let total = CustomLayout.REFRESH_HEIGHT
let progress = offset * 100 / total
this.animateItem?.goToAndStop(this.getFramesByProgress(progress), true);
}
animate2() {
if (this.animateItem2 == null) {
this.animateItem2 = lottie.loadAnimation({
container: this.mainCanvasRenderingContext2,
renderer: 'canvas', // canvas 渲染模式
loop: 10,
autoplay: true,
name: this.animateName2,
path: "lottie/refresh_step2.json", // 路径加载动画只支持entry/src/main/ets 文件夹下的相对路径
})
}
// this.animateItem2.isLoaded
// TODO 是否拦截重复触发
this.animateItem2.goToAndPlay(1)
}
getFramesByProgress(progress: number): number {
if (this.animateItem == null) {
return 1;
}
let progressTmp = progress
let total = this.animateItem.totalFrames;
let frame = Math.floor(total * progressTmp / 100);
if (frame >= total - 1) {
frame = total - 1
}
return frame;
}
onOffsetChange() {
if (!this.refreshBean.isVisible) {
return
}
if (this.refreshBean.loadStatus === LoadStatus.PRELOAD) {
// 下拉刷新
this.animate1(this.refreshBean.offset)
} else if (this.refreshBean.loadStatus == LoadStatus.LOADING) {
// 正在刷新
this.animate2()
} else {
// 刷新完成
lottie.destroy()
}
let maxH = CustomLayout.REFRESH_HEIGHT
let tmpHeight = this.refreshBean.offset > maxH ? maxH : this.refreshBean.offset
if (this.refreshBean.loadStatus === LoadStatus.LOADED) {
if (tmpHeight <= 0) {
setTimeout(() => {
// 延时设置0,让“已更新到最新”展示
this.layoutHeight = 0
}, 1500)
}
} else {
// 直接设置高度
this.layoutHeight = tmpHeight
}
}
}
\ No newline at end of file
... ...
... ... @@ -11,7 +11,7 @@ export struct SearchCreatorComponent{
Stack({alignContent: Alignment.Bottom}){
Image(this.item.headerPhotoUrl)
.width('92lpx')
.alt($r('app.media.default_head'))
.alt($r('app.media.icon_default_head_mater'))
.height('92lpx')
.margin({bottom:'15lpx'})
.borderRadius(50)
... ...
... ... @@ -194,7 +194,8 @@ export struct SearchResultContentComponent{
isSearch: true,
publishTimestamp:"",
bottomNavId:'',
openType:''
openType:'',
extra:''
}
this.data.push(contentDTO)
... ...
... ... @@ -81,9 +81,9 @@ export struct AccountAndSecurityLayout {
// 收到eventId为1的事件后执行该回调
let callback = (eventData: emitter.EventData): void => {
promptAction.showToast({
message: JSON.stringify(eventData)
});
// promptAction.showToast({
// message: JSON.stringify(eventData)
// });
if(eventData&&eventData.data){
this.listData[0].subTitle = eventData.data['content']
}
... ...
... ... @@ -3,7 +3,7 @@ import { EmptyComponent } from '../view/EmptyComponent'
@Entry
@Component
export struct DefaultPage {
@State type: number = 1
@State type: number = 15
retry() {
console.log('daj点击了重试')
... ... @@ -13,7 +13,6 @@ export struct DefaultPage {
Row() {
EmptyComponent({
emptyType: this.type,
emptyButton: true,
retry: () => {
this.retry()
}
... ...
... ... @@ -231,11 +231,11 @@ export struct EmptyComponent {
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoSearchResult) {
imageString = $r('app.media.icon_no_result')
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoNetwork) {
imageString = $r('app.media.icon_no_net')
imageString = $r('app.media.icon_no_net1')
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_ContentFailed) {
imageString = $r('app.media.icon_no_content')
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoCreation) {
imageString = $r('app.media.icon_no_appointmentMade')
imageString = $r('app.media.icon_no_works1')
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoBooking) {
imageString = $r('app.media.icon_no_appointmentMade')
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NetworkFailed) {
... ...
... ... @@ -9,17 +9,18 @@ export struct MergeRecordDialog {
build() {
Column() {
Text("合并游客记录到当前账号,可避免信息丢失")
.fontColor("#222222")
.fontColor("#333333")
.fontSize(18)
.width("100%")
.fontWeight(FontWeight.Bold)
.textAlign(TextAlign.Center)
.margin({ top: 20 })
.margin({ top: 25 })
.padding({left:24,right:24})
Divider().color("#999999").width("100%").margin({ top: 20 }).height('1vp')
Divider().color("#08000000").width("100%").margin({ top: 20 }).height('2vp')
Row() {
Text('取消')
.fontSize(16)
.fontSize(18)
.fontColor("#648DF2")
.layoutWeight(1)
.fontWeight(FontWeight.Medium)
... ... @@ -31,28 +32,22 @@ export struct MergeRecordDialog {
}
})
.height('100%')
// Divider().color("#999999").height('100%').width('0.5vp')
.height(50)
Divider().color("#eeeeee").height(44).width(1).margin({top:3}).strokeWidth(1).vertical(true)
Text('一键合并')
.fontSize(16)
.fontSize(18)
.fontColor("#648DF2")
.layoutWeight(1)
.fontWeight(FontWeight.Medium)
.textAlign(TextAlign.Center)
.border({
width: { left: 1 },
color: "#999999",
style: { left: BorderStyle.Solid }
})
.onClick(() => {
this.controller.close()
if (this.confirm) {
this.confirm()
}
})
.height('100%')
.height(50)
}.layoutWeight(1).justifyContent(FlexAlign.Center)
}.height(140).backgroundColor(Color.White).borderRadius(10).width('74%')
}.height(140).backgroundColor(Color.White).borderRadius(14).width('75%')
}
}
\ No newline at end of file
... ...
... ... @@ -4,16 +4,18 @@ import { router } from '@kit.ArkUI';
@Component
struct ShowUserHeaderPage {
@State headPhotoUrl: string = '';
@State headType: string = ''
@State params:Record<string, string> = router.getParams() as Record<string, string>;
onPageShow() {
this.headPhotoUrl = this.params?.['headPhotoUrl'];
this.headType = this.params?.['headType'] ?? '';
}
build() {
Row() {
Image(this.headPhotoUrl)
.alt($r('app.media.default_head'))
.alt(this.headType.length > 0 ? $r('app.media.WDAccountOwnerHedaerDefaultIcon') : $r('app.media.default_head'))
.width('720lpx')
.height('720lpx')
.objectFit(ImageFit.Auto)
... ...
... ... @@ -22,7 +22,7 @@ import {
postExecuteLikeParams,
postInteractAccentionOperateParams,
postRecommendListParams,
postThemeListParams
GoldenPositionExtraBean
} from 'wdBean';
import { PageUIReqBean } from '../components/page/bean/PageUIReqBean';
... ... @@ -437,7 +437,7 @@ export class PageRepository {
* @param params
* @returns
* */
static postThemeList(params: postThemeListParams) {
static postThemeList(params: GoldenPositionExtraBean) {
let url = HttpUrlUtils.getThemeListUrl()
Logger.info(TAG, "postThemeList url = " + url + JSON.stringify(params))
return WDHttp.post<ResponseDTO<LiveReviewDTO>>(url, params)
... ...
... ... @@ -3,6 +3,7 @@ import { touchMoveLoadMore, touchUpLoadMore } from './PullUpLoadMore';
import PageModel from '../viewmodel/PageModel';
import PageHelper from '../viewmodel/PageHelper';
import PageAdModel from '../viewmodel/PageAdvModel';
import { LoadStatus } from '../components/refresh/RefreshLayoutBean';
export function listTouchEvent(pageModel: PageModel, pageAdvModel: PageAdModel, event: TouchEvent) {
switch (event.type) {
... ... @@ -46,7 +47,7 @@ export function listTouchEvent(pageModel: PageModel, pageAdvModel: PageAdModel,
export function touchMovePullRefresh(pageModel: PageModel, event: TouchEvent) {
if (pageModel.startIndex === 0) {
pageModel.isPullRefreshOperation = true;
let height = vp2px(pageModel.pullDownRefreshHeight);
let height = vp2px(Const.CUSTOM_REFRESH_DECIDE_HEIGHT);
pageModel.offsetY = event.touches[0].y - pageModel.downY;
// The sliding offset is greater than the pull-down refresh layout height, and the refresh condition is met.
if (pageModel.offsetY >= height) {
... ... @@ -98,12 +99,14 @@ export function pullRefreshState(pageModel: PageModel, state: number) {
pageModel.isCanRefresh = false;
pageModel.isRefreshing = false;
pageModel.isVisiblePullDown = true;
pageModel.load = LoadStatus.PRELOAD
break;
case RefreshState.Release:
pageModel.pullDownRefreshText = $r('app.string.release_refresh_text');
pageModel.pullDownRefreshImage = $r('app.media.ic_pull_up_refresh');
pageModel.isCanRefresh = true;
pageModel.isRefreshing = false;
pageModel.load = LoadStatus.PRELOAD
break;
case RefreshState.Refreshing:
pageModel.offsetY = vp2px(pageModel.pullDownRefreshHeight);
... ... @@ -111,18 +114,21 @@ export function pullRefreshState(pageModel: PageModel, state: number) {
pageModel.pullDownRefreshImage = $r('app.media.ic_pull_up_load');
pageModel.isCanRefresh = true;
pageModel.isRefreshing = true;
pageModel.load = LoadStatus.LOADING
break;
case RefreshState.Success:
pageModel.pullDownRefreshText = $r('app.string.refresh_success_text');
pageModel.pullDownRefreshImage = $r('app.media.ic_succeed_refresh');
pageModel.isCanRefresh = true;
pageModel.isRefreshing = true;
pageModel.load = LoadStatus.LOADED
break;
case RefreshState.Fail:
pageModel.pullDownRefreshText = $r('app.string.refresh_fail_text');
pageModel.pullDownRefreshImage = $r('app.media.ic_fail_refresh');
pageModel.isCanRefresh = true;
pageModel.isRefreshing = true;
pageModel.load = LoadStatus.LOADED
break;
default:
break;
... ...
... ... @@ -36,6 +36,10 @@ export class RefreshConstants {
*/
static readonly CUSTOM_LAYOUT_HEIGHT: number = 80;
/**
* 下拉刷新,判定距离
*/
static readonly CUSTOM_REFRESH_DECIDE_HEIGHT: number = 20;
/**
* Full the width.
*/
static readonly FULL_WIDTH: string = '100%';
... ...
... ... @@ -116,7 +116,6 @@ export class PageHelper {
//移除音频 和 活动
this.collectPageComp(pageModel, pageDto)
// pageModel.compList.push(...pageDto.compList)
// TODO 暂时去掉互动数据,待优化。(主要是互动数据返回,如何渲染到ui上)
... ... @@ -161,10 +160,8 @@ export class PageHelper {
flag = false
}
let pageCompSize = pageCompList.length // 信息流组件业务数量
console.error("ZZZXXXXX", " start--->" + pageCompSize);
// console.error("ZZZXXXXX", " start--->" + pageCompSize);
if (pageCompSize == 0) {
flag = false
}
... ... @@ -227,7 +224,7 @@ export class PageHelper {
let changeContentDTO = (matInfo: CompAdvMatInfoBean) => {
let advContentBean: ContentDTO = {} as ContentDTO;
advContentBean.newsTitle = matInfo.advTitle
advContentBean.objectType = matInfo.advType == "0" ? matInfo.advType : "4"
advContentBean.objectType = matInfo.advType == "0" ? matInfo.advType.toString() : "4"
advContentBean.coverUrl = matInfo.matImageUrl[0]
advContentBean.linkUrl = matInfo.linkUrl
advContentBean.openType = matInfo.linkType
... ... @@ -263,7 +260,7 @@ export class PageHelper {
if (advPosition <= pageModel.pageTotalCompSize && advPosition >= a) {
let b = advPosition - a;
console.error('ZZZXXXXX', matInfo.advSubType + '-------------' + matInfo.advTitle + " "+ advPosition + " "+a+" "+b)
// console.error('ZZZXXXXX', matInfo.advSubType + '-------------' + matInfo.advTitle + " " + advPosition + " " + a + " " + b)
if (b <= pageCompSize && b >= 0) {
let advComp: CompDTO = {
... ... @@ -281,15 +278,13 @@ export class PageHelper {
}
}
}
}
}
}
}
console.error("ZZZXXXXX", " end--->" + pageCompList.length);
// console.error("ZZZXXXXX", " end--->" + pageCompList.length);
}
... ... @@ -310,13 +305,14 @@ export class PageHelper {
//移除音频 和 活动
this.collectPageComp(pageModel, data)
//
// pageModel.compList.push(...data.compList)
PageViewModel.getInteractData(data.compList).then((data: CompDTO[]) => {
// 刷新,替换所有数据
pageModel.compList.updateItems(sizeBefore, data)
pageModel.timestamp = DateTimeUtils.getTimeStamp().toString()
})
// TODO 暂时屏蔽,此处代码会造成 广告逻辑错乱,只有第一页有广告数据,随着加载更多,第二页也会出现广告数据
// PageViewModel.getInteractData(data.compList).then((data: CompDTO[]) => {
// // 刷新,替换所有数据
// pageModel.compList.updateItems(sizeBefore, data)
// pageModel.timestamp = DateTimeUtils.getTimeStamp().toString()
// })
}
}).catch((err: string | Resource) => {
promptAction.showToast({ message: err });
... ... @@ -339,15 +335,21 @@ export class PageHelper {
if (contentInfo && (contentInfo.objectType === '13' || contentInfo.objectType === '3')) {
Logger.debug(TAG, 'getGroupData 移除音频 和 活动');
} else {
// 暂时屏蔽活动和音频详情入口
if (element.operDataList[0]?.objectType === '3' || element.operDataList[0]?.objectType === '13') {
} else {
pageCompList.add(element)
}
}
}
// 记录
pageModel.pageTotalCompSize = pageCompList.length + pageModel.pageTotalCompSize
console.error("ZZZXXXXX", " collectPageComp--->" + pageModel.pageTotalCompSize);
// console.error("ZZZXXXXX", " collectPageComp--->" + pageModel.pageTotalCompSize);
// 处理页面广告数据,投放到页面的位置
// this.handlePageCompAdvPostion(pageCompList, pageModel, pageDto);
this.handlePageCompAdvPostion(pageCompList, pageModel, pageDto);
//遍历所有组件和稿件数据 push到页面
... ...
... ... @@ -6,6 +6,7 @@ import { PageUIReqBean } from '../components/page/bean/PageUIReqBean';
import { GroupInfoDTO, PageInfoDTO } from 'wdBean/src/main/ets/bean/navigation/PageInfoDTO';
import { AdvRuleBean, CompAdvBean } from 'wdBean/src/main/ets/bean/adv/AdvsRuleBean';
import { WDViewDefaultType } from '../components/view/EmptyComponent';
import { LoadStatus } from '../components/refresh/RefreshLayoutBean';
/**
* 页面下拉刷新、上拉加载数据bean。
... ... @@ -33,6 +34,7 @@ export default class PageModel {
pullDownRefreshImage: Resource = $r('app.media.ic_pull_down_refresh');
pullDownRefreshHeight: number = Const.CUSTOM_LAYOUT_HEIGHT;
isVisiblePullDown: boolean = false;
load: LoadStatus = LoadStatus.IDLE;
pullUpLoadText: Resource = $r('app.string.pull_up_load_text');
pullUpLoadImage: Resource = $r('app.media.ic_pull_up_load');
pullUpLoadHeight: number = Const.CUSTOM_LAYOUT_HEIGHT;
... ...
... ... @@ -8,7 +8,8 @@ import {
NavigationBodyDTO,
PageDTO,
PageInfoBean,
PageInfoDTO
PageInfoDTO,
GoldenPositionExtraBean
} from 'wdBean';
import { CollectionUtils, Logger, ResourcesUtils, StringUtils } from 'wdKit';
... ... @@ -379,10 +380,13 @@ export class PageViewModel extends BaseViewModel {
})
}
async postThemeList(sort: number, pageNum: number, pageSize: number) : Promise<LiveReviewDTO> {
async postThemeList(sort: number, pageNum: number, pageSize: number,extra: string) : Promise<LiveReviewDTO> {
let bean: GoldenPositionExtraBean = JSON.parse(extra)
bean.pageNum = pageNum
bean.pageSize = pageSize
return new Promise<LiveReviewDTO>((success, error) => {
Logger.info(TAG, `postThemeList pageInfo start`);
PageRepository.postThemeList({ sort, pageNum, pageSize }).then((resDTO) => {
PageRepository.postThemeList(bean).then((resDTO) => {
if (!resDTO || !resDTO.data) {
Logger.error(TAG, 'postThemeList then navResDTO is empty');
error('resDTO is empty');
... ...
... ... @@ -97,6 +97,10 @@
"value": "#CCCCCC"
},
{
"name": "color_CCCCCC_1A",
"value": "#1ACCCCCC"
},
{
"name": "color_EDEDED",
"value": "#EDEDED"
},
... ...
export { add } from "./src/main/ets/utils/Calc"
export { HWLocationUtils } from './src/main/ets/location/HWLocationUtils'
export { WDPushNotificationManager } from "./src/main/ets/notification/WDPushNotificationManager"
\ No newline at end of file
... ...
import { pushCommon, pushService } from '@kit.PushKit';
import { AAID } from '@kit.PushKit';
import { AccountManagerUtils, Logger, SPHelper, UserDataLocal } from 'wdKit/Index';
import { BusinessError } from '@kit.BasicServicesKit';
import notificationManager from '@ohos.notificationManager';
import { common, Want } from '@kit.AbilityKit';
const TAG = "NotificationManager"
/*
* 远程推送通知管理类
* Push Kit: https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/push-introduction-0000001726287974
* Notification Kit: https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/notification-overview-0000001822162741
* */
export class WDPushNotificationManager {
private static instance: WDPushNotificationManager
static getInstance() : WDPushNotificationManager {
if (!WDPushNotificationManager.instance) {
WDPushNotificationManager.instance = new WDPushNotificationManager()
}
return WDPushNotificationManager.instance
}
async requestEnableNotifications(context: common.UIAbilityContext) : Promise<boolean> {
let enabled = await notificationManager.isNotificationEnabled()
if (!enabled) {
try {
await notificationManager.requestEnableNotification(context)
enabled = true
} catch (err) {
Logger.error(TAG, "请求通知权限报错: " + JSON.stringify(err))
let error = err as BusinessError
if (error.code == 1600004) {
Logger.error(TAG, "请求通知权限 - 用户已拒绝")
}
}
}
Logger.info(TAG, "推送 enabled " + enabled)
return enabled
}
async fetchTokenAndBindProfileId() {
try {
const pushToken: string = await pushService.getToken();
Logger.info(TAG, "获取推送token: " + pushToken)
//TODO: pushToken 上传至服务器
SPHelper.default.save("devicePushToken", pushToken)
if (AccountManagerUtils.isLoginSync()) {
this.bindUserProfileId(UserDataLocal.getUserId())
}
} catch (err) {
Logger.error(TAG, "获取推送token失败: " + JSON.stringify(err))
}
}
// 禁止推送
stopPush() {
pushService.deleteToken()
}
/// 应用匿名标识符
async getAAID() {
let aaid: string = ""
try {
aaid = await AAID.getAAID();
Logger.info(TAG, "获取应用匿名标识符AAID: " + aaid)
} catch (err) {
Logger.error(TAG, "获取应用匿名标识符AAID失败: " + JSON.stringify(err))
}
return aaid
}
// TODO: 登录时调用
bindUserProfileId(profileId: string) {
pushService.bindAppProfileId(pushCommon.AppProfileType.PROFILE_TYPE_APPLICATION_ACCOUNT, profileId).then(() => {
Logger.info(TAG, "推送绑定profileId 成功: " + profileId)
}).catch((err: BusinessError) => {
Logger.error(TAG, "推送绑定profileId失败: " + profileId + " " + JSON.stringify(err))
});
}
unbindUserProfileId(profileId: string) {
pushService.unbindAppProfileId(profileId).then(() => {
Logger.info(TAG, "推送解绑profileId 成功: " + profileId)
}).catch((err: BusinessError) => {
Logger.error(TAG, "推送解绑profileId失败: " + profileId + " " + JSON.stringify(err))
});
}
sendLocalNotification() {
let notificationRequest: notificationManager.NotificationRequest = {
id: 1,
content: {
notificationContentType: notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
normal: {
title: "test_title",
text: "test_text",
additionalText: "test_additionalText"
}
}
};
notificationManager.publish(notificationRequest).then(() => {
console.info("publish success");
}).catch((err: BusinessError) => {
console.error(`publish fail: ${JSON.stringify(err)}`);
});
}
setBadgeNumber(number: number) : Promise<void> {
return notificationManager.setBadgeNumber(number)
}
// 接收推送数据,包括启动和二次点击拉起
// 参考:https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/push-dev-0000001727885258
onWant(want: Want) {
Logger.info(TAG, "接收到推送?: " + JSON.stringify(want.parameters))
}
}
\ No newline at end of file
... ...
... ... @@ -3,10 +3,6 @@
{
"name": "shared_desc",
"value": "description"
},
{
"name": "location_reason",
"value": " "
}
]
}
\ No newline at end of file
... ...