张善主

Merge remote-tracking branch 'origin/main'

# Conflicts:
#	sight_harmony/features/wdBean/src/main/ets/bean/component/CompDTO.ets
#	sight_harmony/features/wdComponent/src/main/ets/components/view/HorizontalStrokeCardThreeTwoRadioForMoreComponent.ets
Showing 51 changed files with 864 additions and 933 deletions
... ... @@ -38,6 +38,7 @@ export class SpConstants{
static LOCATION_PROVINCE_NAME = "location_province_name" //定位,省份名称
static LOCATION_DISTRICT_CODE = "location_district_code" //定位,区县,返回9位,如:合肥-瑶海区-310115114
static LOCATION_PERMISSION_REFUSE = "location_permission_refuse" //定位
static LOCATION_FIRST_POSITION = 'location_first_position'// 定位后顶导首次使用地理信息
//启动页数据存储key
static APP_LAUNCH_PAGE_DATA_MODEL = 'app_launch_page_data_model'
... ...
... ... @@ -9,4 +9,6 @@ export class InteractDataDTO {
likeNum: number | string = 0;
readNum: number = 0;
shareNum: number = 0;
}
\ No newline at end of file
... ...
import { InteractDataDTO } from '../content/InteractDataDTO';
import { FullColumnImgUrlDTO } from '../detail/FullColumnImgUrlDTO';
export interface slideShows {
fullColumnImgUrls: FullColumnImgUrlDTO[];
linkUrl?: string;
newsId: string;
newsTitle?: string;
newsTitleColor?: string;
objectLevel?: string;
objectType: string;
pageId?: string;
photoNum?: string;
publishTime: number;
relId: string;
source?: string;
timeBlurred?: string;
videoDuration?: string;
videoLandscape?: string;
videoUrl?: string;
voiceDuration?: string;
@Observed
export class slideShows {
fullColumnImgUrls?: FullColumnImgUrlDTO[];
linkUrl: string='';
newsId: string = '';
newsTitle: string='';
newsTitleColor: string='';
objectLevel: string='';
objectType: string ='';
pageId: string='';
photoNum: string='';
publishTime: number=0;
relId: string='';
source: string='';
timeBlurred: string='';
videoDuration: string='';
videoLandscape: string='';
videoUrl: string='';
voiceDuration: string='';
interactDataDto? :InteractDataDTO
}
\ No newline at end of file
... ...
... ... @@ -7,7 +7,6 @@
"main": "Index.ets",
"version": "1.0.0",
"dependencies": {
"@ohos/lottie": "2.0.10",
"wdConstant": "file:../../commons/wdConstant",
"wdPlayer": "file:../../features/wdPlayer",
"wdLogin": "file:../../features/wdLogin",
... ...
... ... @@ -186,8 +186,8 @@ export struct CardParser {
contentDTO: contentDTO,
compDTO: this.compDTO,
pageId: this.pageId,
pageName: this.pageName
pageName: this.pageName,
index:this.compIndex
})
} else {
// todo:组件未实现 / Component Not Implemented
... ...
... ... @@ -72,7 +72,7 @@ export struct CompParser {
build() {
Column() {
//Text(JSON.stringify(this.compDTO.compStyle))
// Text(JSON.stringify(this.compDTO.compStyle))
this.componentBuilder();
}
}
... ... @@ -90,16 +90,18 @@ export struct CompParser {
}
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_01 &&
this.compDTO.imageScale === 2) { // && compDTO.name ==="横划卡"
// Text('LiveHorizontalCardComponent')
LiveHorizontalCardComponent({ compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName })
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_01 && this.compDTO.imageScale === 3) {
if (this.compDTO.operDataList.length > 1) {
// Text('HorizontalStrokeCardThreeTwoRadioForMoreComponent')
HorizontalStrokeCardThreeTwoRadioForMoreComponent({
compDTO: this.compDTO,
pageId: this.pageId,
pageName: this.pageName
})
} else {
// Text('HorizontalStrokeCardThreeTwoRadioForOneComponent')
HorizontalStrokeCardThreeTwoRadioForOneComponent({
compDTO: this.compDTO,
pageId: this.pageId,
... ...
... ... @@ -5,6 +5,7 @@ import { promptAction } from '@kit.ArkUI';
import { image } from '@kit.ImageKit';
import { photoAccessHelper } from '@kit.MediaLibraryKit';
import fs from '@ohos.file.fs';
import { NetworkUtil } from 'wdKit';
const PERMISSIONS: Array<Permissions> = [
'ohos.permission.READ_IMAGEVIDEO',
... ... @@ -47,7 +48,12 @@ export struct ImageDownloadComponent {
}
aboutToAppear(): void {
this.onChangeUrl()
// 注册监听网络连接
let netStatus = NetworkUtil.isNetConnected()
if (netStatus) {
// 有网络
this.onChangeUrl()
}
}
async onChangeUrl(): Promise<void> {
... ...
... ... @@ -27,6 +27,7 @@ export struct MultiPictureDetailItemComponent {
private MultiPictureDetailItem: PhotoListBean = {} as PhotoListBean
//alt app.media.picture_loading 设计稿尺寸
@State imageWidth:string | number = 167
private scroller: Scroller = new Scroller()
async aboutToAppear() {
... ... @@ -179,41 +180,46 @@ export struct MultiPictureDetailItemComponent {
build() {
Row() {
if(this.imageUri != null && (this.imageUri.includes('.gif') || this.imageUri.includes('.GIF'))){
Image(this.imageUri)// TODO:知识点:宽高只根据其尺寸设置一个,通过保持宽高比来设置另一个属性
.alt($r('app.media.datail_imageLoading_w'))
.width(this.imageWidth)
.objectFit(ImageFit.Auto)// TODO:知识点:保持宽高比进行缩放,可以超出父组件,以便实现多图切换的增强功能
.interpolation(ImageInterpolation.High)
.autoResize(false)
.transform(this.matrix)// TODO:知识点:通过matrix控制图片的缩放
.defaultFocus(true)
.offset({
// TODO:知识点:通过offset控制图片的偏移
x: this.imageOffsetInfo.currentX,
y: this.imageOffsetInfo.currentY
})
.onComplete(event => {
this.imageWidth = '100%'
})
}else{
Image(this.imagePixelMap)// TODO:知识点:宽高只根据其尺寸设置一个,通过保持宽高比来设置另一个属性
.alt($r('app.media.datail_imageLoading_w'))
.width(this.imageWidth)
.objectFit(ImageFit.Auto)// TODO:知识点:保持宽高比进行缩放,可以超出父组件,以便实现多图切换的增强功能
.interpolation(ImageInterpolation.High)
.autoResize(false)
.transform(this.matrix)// TODO:知识点:通过matrix控制图片的缩放
.defaultFocus(true)
.offset({
// TODO:知识点:通过offset控制图片的偏移
x: this.imageOffsetInfo.currentX,
y: this.imageOffsetInfo.currentY
})
.onComplete(event => {
this.imageWidth = '100%'
})
Scroll(this.scroller) {
if(this.imageUri != null && (this.imageUri.includes('.gif') || this.imageUri.includes('.GIF'))){
Image(this.imageUri)// TODO:知识点:宽高只根据其尺寸设置一个,通过保持宽高比来设置另一个属性
.alt($r('app.media.datail_imageLoading_w'))
.width(this.imageWidth)
.objectFit(ImageFit.Auto)// TODO:知识点:保持宽高比进行缩放,可以超出父组件,以便实现多图切换的增强功能
.interpolation(ImageInterpolation.High)
.autoResize(false)
.transform(this.matrix)// TODO:知识点:通过matrix控制图片的缩放
.defaultFocus(true)
.offset({
// TODO:知识点:通过offset控制图片的偏移
x: this.imageOffsetInfo.currentX,
y: this.imageOffsetInfo.currentY
})
.onComplete(event => {
this.imageWidth = '100%'
})
}else{
Image(this.imagePixelMap || 'app.media.datail_imageLoading_w')// TODO:知识点:宽高只根据其尺寸设置一个,通过保持宽高比来设置另一个属性
.alt($r('app.media.datail_imageLoading_w'))
.width(this.imageWidth)
.objectFit(ImageFit.Auto)// TODO:知识点:保持宽高比进行缩放,可以超出父组件,以便实现多图切换的增强功能
.interpolation(ImageInterpolation.High)
.autoResize(false)
.transform(this.matrix)// TODO:知识点:通过matrix控制图片的缩放
.defaultFocus(true)
.offset({
// TODO:知识点:通过offset控制图片的偏移
x: this.imageOffsetInfo.currentX,
y: this.imageOffsetInfo.currentY
})
.onComplete(event => {
this.imageWidth = '100%'
})
}
}
.scrollable(ScrollDirection.Vertical)
.scrollBarWidth(0)
.height(this.imageDefaultSize.height || "100%")
}
.onBlur(() => {
this.resetCurrentImageInfo();
... ...
import { Action, H5ReceiveDetailBean, ContentDetailDTO, InteractDataDTO } from 'wdBean';
import { Action, H5ReceiveDetailBean, ContentDetailDTO, InteractDataDTO, TopicInfo } from 'wdBean';
import { WdWebComponent } from 'wdWebComponent';
import { CommonConstants } from 'wdConstant'
import { BridgeWebViewControl } from 'wdJsBridge/Index';
... ... @@ -41,6 +41,8 @@ export struct SpacialTopicPageComponent {
@State isNetConnected: boolean = true
@Provide topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
@State showComment: boolean = false
@State topicInfo: TopicInfo = {} as TopicInfo
private trySendData2H5() {
if (!this.webPrepared || !this.dataPrepared) {
return
... ... @@ -140,16 +142,22 @@ export struct SpacialTopicPageComponent {
if(pageInfoMsg && pageInfoMsg.data){
this.contentDetailData.openComment = Number(pageInfoMsg.data.topicInfo?.commentFlag)
this.contentDetailData.commentDisplay = Number(pageInfoMsg.data.topicInfo?.commentShowFlag)
if(pageInfoMsg.data.topicInfo?.shareOpen === 1){
console.log('contentDetailData pageInfoMsg.data', JSON.stringify(pageInfoMsg.data))
this.topicInfo = pageInfoMsg.data.topicInfo
this.contentDetailData.newsId = Number(this.topicInfo.topicId)
this.contentDetailData.newsType = this.topicInfo.topicType
if(this.topicInfo?.shareOpen === 1){
this.contentDetailData.shareInfo.shareOpen = this.topicInfo?.shareOpen
console.log('contentDetailData this.topicInfo', JSON.stringify(this.topicInfo))
if (!this.operationButtonList.includes('share')) {
this.operationButtonList.push('share');
}
}else{
} else {
this.operationButtonList = this.operationButtonList.filter(e =>e !== 'share')
}
}
console.log('contentDetailData',this.contentDetailData)
console.log('contentDetailData', JSON.stringify(this.contentDetailData))
}
}
}
... ... @@ -199,6 +207,7 @@ export struct SpacialTopicPageComponent {
contentDetailData: this.contentDetailData,
publishCommentModel: this.publishCommentModel,
operationButtonList: this.operationButtonList,
topicInfo: this.topicInfo,
styleType: 1,
onCommentIconClick:()=>{
this.showCommentList = true
... ...
... ... @@ -6,8 +6,12 @@ import router from '@ohos.router'
@Reusable
@Component
export struct CardSourceInfo {
@State contentDTO: ContentDTO = new ContentDTO();
@State @Watch('checkData') contentDTO: ContentDTO = new ContentDTO();
@ObjectLink compDTO: CompDTO
// 特殊稿件内部item展示的来源信息
isCompInnerSource: boolean = false
// 是否有展示的信息,如来源,标签、时间、评论
@State viewShowData: boolean = true
aboutToAppear(): void {
}
... ... @@ -21,6 +25,7 @@ export struct CardSourceInfo {
aboutToDisappear(): void {
}
handleTimeStr() {
return DateTimeUtils.getCommentTime(
this.contentDTO.publishTime.includes(' ')
... ... @@ -54,7 +59,6 @@ export struct CardSourceInfo {
return true
}
/**
* 全域数字显示规则
* 1、当数量为千位以內时,显示数字,不保留小数点,比如 4585
... ... @@ -64,17 +68,17 @@ export struct CardSourceInfo {
* 5、0 和空 不显示
*/
handlerNum(number: string) {
const num = number??'0';
const num = number ?? '0';
if (Number.parseInt(num) <= 9999) {
return Number.parseInt(num).toString()
} else if (Number.parseInt(num) > 9999 && Number.parseInt(num) <= 99999999) {
const num1: string = num.slice(0, -4); // 万
const num2: string = num.slice(-4, -3); // 千
return num2 === '0' ? num1 +'万' : num1 + '.' + num2 + '万'
return num2 === '0' ? num1 + '万' : num1 + '.' + num2 + '万'
} else if (Number.parseInt(num) > 99999999) {
const num1: string = num.slice(0, -8); // 亿
const num2: string = num.slice(-8, -7);
return num2 === '0' ? num1 +'亿' : num1 + '.' + num2 + '亿'
return num2 === '0' ? num1 + '亿' : num1 + '.' + num2 + '亿'
}
return num
}
... ... @@ -88,18 +92,20 @@ export struct CardSourceInfo {
build() {
Flex({ alignItems: ItemAlign.Center }) {
// 标签
if (this.contentDTO.corner) {
Text(this.contentDTO.corner)
.fontSize($r("app.float.font_size_11"))
.fontColor($r("app.color.color_ED2800"))
.margin({ right: 2 })
.margin({ right: 6 })
}
if(this.contentDTO.cornerMark){
if (this.contentDTO.cornerMark) {
Text(this.contentDTO.cornerMark)
.fontSize($r("app.float.font_size_11"))
.fontColor($r("app.color.color_ED2800"))
.margin({ right: 2 })
.margin({ right: 6 })
}
// 来源信息
if (this.contentDTO.rmhPlatform === 1) {
Text(this.contentDTO.rmhInfo?.rmhName)
.fontSize($r("app.float.font_size_11"))
... ... @@ -113,62 +119,57 @@ export struct CardSourceInfo {
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
}
if (((this.contentDTO.rmhPlatform === 1 && this.contentDTO.rmhInfo?.rmhName && this.contentDTO.rmhInfo?.rmhName != '') || (this.contentDTO.source && this.contentDTO.source != '')) && (this.getContentDtoBean()?.interactData?.commentNum
// || DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)) != ''
|| (this.contentDTO.isSearch || this.contentDTO.isCollection ||
!this.contentDTO.isSearch && DateTimeUtils.getCommentTime
(Number
.parseFloat(this
.contentDTO.publishTime))
.indexOf
('-') === -1)
)) {
// 点
if (((this.contentDTO.rmhPlatform === 1 && this.contentDTO.rmhInfo?.rmhName &&
this.contentDTO.rmhInfo?.rmhName != '') || (this.contentDTO.source && this.contentDTO.source != '')) &&
(this.getContentDtoBean()?.interactData?.commentNum
// || DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)) != ''
|| (this.contentDTO.isSearch || this.contentDTO.isCollection ||
!this.contentDTO.isSearch && DateTimeUtils.getCommentTime
(Number
.parseFloat(this
.contentDTO.publishTime))
.indexOf
('-') === -1)
)) {
Image($r("app.media.point"))
.width(11)
.height(11)
}
// 新闻tab下的卡片,2天之前的不显示时间。但是如果是搜索情况下展示的卡片,显示时间
// if (this.contentDTO.isSearch || this.contentDTO.isCollection ||
// (!this.contentDTO.isSearch &&
// DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)).indexOf('-') === -1)) {
//
// Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)))
// .fontSize($r("app.float.font_size_11"))
// .fontColor($r("app.color.color_B0B0B0"))
// .flexShrink(0);
// }
// if (this.contentDTO.source && this.showTime()) {
// Text(this.handleTimeStr())
// .fontSize($r("app.float.font_size_11"))
// .fontColor($r("app.color.color_B0B0B0"))
// .flexShrink(0)
// .margin({right: 4})
// }
// 发布日期
if (this.showTime()) {
Text(this.handleTimeStr())
.fontSize($r("app.float.font_size_11"))
.fontColor($r("app.color.color_B0B0B0"))
.flexShrink(0)
.margin({right: 4})
.margin({ right: 4 })
}
if (Number(this.getContentDtoBean()?.interactData?.commentNum) > 0 && this.showCommentNum()) {
// 评论数
if (!this.isCompInnerSource && Number(this.getContentDtoBean()?.interactData?.commentNum) > 0 &&
this.showCommentNum()) {
Text(`${this.handlerNum(this.getContentDtoBean()?.interactData?.commentNum.toString())}评`)
.fontSize($r("app.float.font_size_11"))
.fontColor($r("app.color.color_B0B0B0"))
.flexShrink(0)
} else {
if (this.isCompInnerSource && this.contentDTO.interactData && this.contentDTO.interactData?.commentNum > 0) {
Text(`${this.handlerNum(this.contentDTO.interactData?.commentNum.toString())}评`)
.fontSize($r("app.float.font_size_11"))
.fontColor($r("app.color.color_B0B0B0"))
.flexShrink(0)
}
}
// if (this.getContentDtoBean()?.interactData?.commentNum && this.contentDTO.source) {
// Text(`${this.getContentDtoBean()?.interactData?.commentNum}评`)
// .fontSize($r("app.float.font_size_11"))
// .fontColor($r("app.color.color_B0B0B0"))
// .flexShrink(0)
// .visibility(Number(this.getContentDtoBean()?.interactData?.commentNum) === 0 ? Visibility.None :
// Visibility.Visible)
// }
}
.width(CommonConstants.FULL_WIDTH)
.margin({ top: 8 })
.margin({ top: this.viewShowData ? 8 : 0 })
}
/**
... ... @@ -184,4 +185,45 @@ export struct CardSourceInfo {
}
return this.compDTO.operDataList[0]
}
/**
* 检测是否有展示的数据
*/
checkData() {
let have = false
if (this.contentDTO.corner) {
have = true
}
if (this.contentDTO.cornerMark) {
have = true
}
if (this.contentDTO.rmhPlatform === 1) {
have = true
} else if (this.contentDTO.source) {
have = true
}
// 发布日期
if (this.showTime()) {
have = true
}
// 评论数
if (!this.isCompInnerSource && Number(this.getContentDtoBean()?.interactData?.commentNum) > 0 &&
this.showCommentNum()) {
have = true
} else {
if (this.isCompInnerSource && this.contentDTO.interactData && this.contentDTO.interactData?.commentNum > 0) {
have = true
}
}
if (have) {
} else {
this.viewShowData = false
}
}
}
\ No newline at end of file
... ...
import { ContentDTO, slideShows, VideoInfoDTO, CompDTO } from 'wdBean';
import { ContentDTO, slideShows, VideoInfoDTO, CompDTO, InteractDataDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant';
import { ProcessUtils } from 'wdRouter';
import { CardSourceInfo } from '../cardCommon/CardSourceInfo';
... ... @@ -8,6 +8,8 @@ import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { InfomationCardClick } from '../../utils/infomationCardClick'
import { SearchShowRed, titleInitRes, textItem } from '../../utils/searchShowRed';
import router from '@ohos.router'
import { BasePageHelp } from '../page/template/BasePageHelp';
import { Logger } from 'wdKit/Index';
/**
* 大专题卡--CompStyle: 10
... ... @@ -25,11 +27,39 @@ export struct Card10Component {
@State titleMarked: boolean = false;
@State textArr: textItem[] = []
@State hideDetail: boolean = false;
basePageHelp: BasePageHelp = new BasePageHelp
// 稿件参与批查,需要对列表信息单独重绘
@State isBatchData: boolean = false
async aboutToAppear(): Promise<void> {
this.titleInit();
this.loadImg = await onlyWifiLoadImg();
this.initHideDetail();
if (!this.hideDetail) {
this.isBatchData = false
// 批查评论数据
let interactArray = this.basePageHelp.getCompInteractParams(this.contentDTO.slideShows)
if (interactArray.contentList != null && interactArray.contentList.length > 0) {
this.basePageHelp.requestCompInteractData(interactArray)
.then((result) => {
if (result != null && result.length > 0) {
this.isBatchData = true
this.contentDTO.slideShows.forEach((slideShowBean) => {
let newsId = slideShowBean.newsId
for (let interactBean of result) {
console.debug(TAG, JSON.stringify(interactBean))
if (newsId == interactBean.contentId) {
slideShowBean.interactDataDto = interactBean
break
}
}
})
}
})
}
}
}
initHideDetail() {
... ... @@ -40,7 +70,7 @@ export struct Card10Component {
}
titleInit() {
const titleInitRes:titleInitRes = SearchShowRed.titleInit(this.contentDTO.title);
const titleInitRes: titleInitRes = SearchShowRed.titleInit(this.contentDTO.title);
this.titleMarked = titleInitRes.titleMarked;
this.textArr = titleInitRes.textArr;
}
... ... @@ -63,16 +93,16 @@ export struct Card10Component {
Span(this.contentDTO.newsTitle)
}
}
.width(CommonConstants.FULL_WIDTH)
.fontSize($r('app.float.font_size_18'))
.fontWeight(600)
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.margin({ bottom: 19 })
.onClick((event: ClickEvent) => {
InfomationCardClick.track(this.compDTO, this.contentDTO, this.pageId, this.pageName)
ProcessUtils.processPage(this.contentDTO)
})
.width(CommonConstants.FULL_WIDTH)
.fontSize($r('app.float.font_size_18'))
.fontWeight(600)
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.margin({ bottom: 19 })
.onClick((event: ClickEvent) => {
InfomationCardClick.track(this.compDTO, this.contentDTO, this.pageId, this.pageName)
ProcessUtils.processPage(this.contentDTO)
})
}
// 大图
Stack() {
... ... @@ -94,17 +124,14 @@ export struct Card10Component {
// 专题列表--后端返回三个,
if (!this.hideDetail) {
Column() {
ForEach(this.contentDTO.slideShows, (item: slideShows, index: number) => {
this.timelineItem(item, index)
if (index < this.contentDTO.slideShows.length - 1) {
// 在不是最后一个元素的情况下添加分隔符
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 0, right: 0 });
}
})
if (this.isBatchData) {
this.drawCompList()
} else {
this.drawCompList()
}
}
}
// 底部-查看更多。根据接口返回的isMore判断是否显示查看更多
if (this.contentDTO.hasMore == 1 && !this.hideDetail) {
... ... @@ -141,37 +168,54 @@ export struct Card10Component {
}
@Builder
drawCompList() {
Column() {
ForEach(this.contentDTO.slideShows, (item: slideShows, index: number) => {
this.timelineItem(item, index)
if (index < this.contentDTO.slideShows.length - 1) {
// 在不是最后一个元素的情况下添加分隔符
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 0, right: 0 });
}
})
}
}
@Builder
timelineItem(item: slideShows, index: number) {
Row() {
Column() {
Stack() {
if (item.objectType == '5') {
Notes({ objectType: 5 })
}
Text(item.newsTitle)
.fontSize($r('app.float.font_size_17'))
.fontWeight(400)
.fontColor($r('app.color.color_222222'))
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.textIndent(item.objectType == '5' ? 38 : 0)
}.alignContent(Alignment.TopStart)
Blank()
//bottom 评论等信息
CardSourceInfo(
{
compDTO: this.compDTO,
contentDTO: this.createContent(item)
}
)
}
.layoutWeight(1)
.height(78)
.alignItems(HorizontalAlign.Start)
// 有图片资源的
if (item.fullColumnImgUrls && item.fullColumnImgUrls[0] && item.fullColumnImgUrls[0].url) {
Column() {
Stack() {
if (item.objectType == '5') {
Notes({ objectType: 5 })
}
Text(item.newsTitle)
.fontSize($r('app.float.font_size_17'))
.fontWeight(400)
.fontColor($r('app.color.color_222222'))
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.textIndent(item.objectType == '5' ? 38 : 0)
}.alignContent(Alignment.TopStart)
Blank()
//bottom 评论等信息
CardSourceInfo(
{
isCompInnerSource: true,
compDTO: this.compDTO,
contentDTO: this.createContent(item)
}
)
}
.layoutWeight(1)
.height(78)
.alignItems(HorizontalAlign.Start)
// 右侧图片
if (item.fullColumnImgUrls[0] && item.fullColumnImgUrls[0].url) {
Stack() {
Image(this.loadImg ? item.fullColumnImgUrls[0].url : '')
.backgroundColor(0xf5f5f5)
... ... @@ -186,6 +230,33 @@ export struct Card10Component {
}
.alignContent(Alignment.BottomEnd)
.height(78)
}else{
Column() {
Stack() {
if (item.objectType == '5') {
Notes({ objectType: 5 })
}
Text(item.newsTitle)
.fontSize($r('app.float.font_size_17'))
.fontWeight(400)
.fontColor($r('app.color.color_222222'))
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.textIndent(item.objectType == '5' ? 38 : 0)
}.alignContent(Alignment.TopStart)
//bottom 评论等信息
CardSourceInfo(
{
isCompInnerSource: true,
compDTO: this.compDTO,
contentDTO: this.createContent(item)
}
)
}
.layoutWeight(1)
.alignItems(HorizontalAlign.Start)
}
}
.padding({ top: 10, bottom: 10 })
... ... @@ -201,8 +272,9 @@ export struct Card10Component {
private createContent(item: slideShows): ContentDTO {
let contentDTO = new ContentDTO()
contentDTO.publishTime = item.publishTime.toString() || '';
contentDTO.publishTime = item.publishTime?.toString() || '';
contentDTO.source = item.source || '';
contentDTO.interactData = item.interactDataDto
return contentDTO;
}
... ...
... ... @@ -55,7 +55,7 @@ export struct Card14Component {
)
}
// 左标题,右图
Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.Start }) {
Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceBetween }) {
Text() {
if (this.titleMarked) {
... ...
... ... @@ -19,7 +19,7 @@ export struct LiveBigImage02Component {
@State contentDTO: ContentDTO = new ContentDTO();
@State loadImg: boolean = false;
@State clicked: boolean = false;
index: number = 0
async aboutToAppear() {
const curRouter = router.getState().name;
this.clicked = hasClicked(this.contentDTO.objectId,curRouter)
... ... @@ -102,8 +102,7 @@ export struct LiveBigImage02Component {
lottieWidth: 14,
lottieHeight: 14,
autoplay: true,
loop: true,
title: item.newsTitle
loop: true
})
.margin({
right: '2vp'
... ...
... ... @@ -14,28 +14,16 @@ export struct LottieView {
private politeChickyController: CanvasRenderingContext2D =
new CanvasRenderingContext2D(); // CanvasRenderingContext2D对象
private animateItem: AnimationItem | null = null; // 初始化loadAnimation接口的返回对象
@Prop title: string
// 页面隐藏销毁动画
// onPageHide(): void {
// this.animateItem?.destroy()
//
// if (this.onComplete) {
// this.animateItem?.removeEventListener('complete', this.onComplete)
// }
// }
/**
* 加载动画
* @param autoplay 控制动画是否自动播放参数
*/
loadAnimation() {
// 销毁动画,减少缓存
if (this.animateItem !== null) {
this.animateItem.destroy(this.name);
this.animateItem = null;
}
this.onDestroyAnimation()
this.animateItem = lottie.loadAnimation({
container: this.politeChickyController,
renderer: 'canvas',
... ... @@ -55,31 +43,18 @@ export struct LottieView {
}
aboutToAppear(): void {
// console.error('XXXXZZZZ', '-------aboutToAppear-------' + this.title)
//lottie?.play()
// if(this.init){
// if(this.animateItem = null){
// this.loadAnimation();
// }
// }
/**
* 摧毁动画
*/
onDestroyAnimation(){
// 销毁动画,减少缓存
if (this.animateItem !== null) {
this.animateItem.destroy(this.name);
this.animateItem = null;
}
}
aboutToDisappear(): void {
// console.error('XXXXZZZZ', '-------aboutToDisappear-------' + this.title)
// if(this.init){
// lottie?.destroy(this.name)
//
// if (this.onComplete) {
// this.animateItem?.removeEventListener('complete', this.onComplete)
// }
// this.animateItem = null;
// // }
}
build() {
Stack({ alignContent: Alignment.TopStart }) {
... ... @@ -92,10 +67,10 @@ export struct LottieView {
this.onReady(this.animateItem)
}
})
.onDisAppear(() => {
lottie.destroy(this.name)
this.animateItem = null;
}).onAppear(()=>{
.onDisAppear(()=>{
this.onDestroyAnimation()
})
.onAppear(()=>{
this.loadAnimation();
})
... ...
... ... @@ -34,20 +34,13 @@ export default struct MinePageUserSimpleInfoUI {
Row(){
//头像
Stack(){
if (this.headPhotoUrl.length > 0){
Image(this.headPhotoUrl)
.alt(this.userType === "1"?$r('app.media.default_head'):$r('app.media.AccountOwner_DefaultIcon'))
.width(`${this.calcHeight(100)}lpx`)
.height(`${this.calcHeight(100)}lpx`)
.objectFit(ImageFit.Cover)
.borderRadius(50)
}else {
Image(this.userType === "1"?$r('app.media.default_head'):$r('app.media.AccountOwner_DefaultIcon'))
.width(`${this.calcHeight(100)}lpx`)
.height(`${this.calcHeight(100)}lpx`)
.objectFit(ImageFit.Cover)
.borderRadius(50)
}
Image(this.isLogin?(this.headPhotoUrl?this.headPhotoUrl:this.userType === "1"?$r('app.media.default_head'):$r('app.media.AccountOwner_DefaultIcon')):$r('app.media.default_head'))
.alt($r('app.media.default_head'))
.width(`${this.calcHeight(100)}lpx`)
.height(`${this.calcHeight(100)}lpx`)
.objectFit(ImageFit.Cover)
.borderRadius(50)
if(StringUtils.isNotEmpty(this.levelHead)){
Image(this.levelHead)
... ...
... ... @@ -395,7 +395,7 @@ export struct PaperSingleColumn999CardView {
private item: ContentDTO = new ContentDTO();
private index: number = -1;
@State isRead: boolean = false;//已读状态
@State interactData: InteractDataDTO = {} as InteractDataDTO;
@State interactData: InteractDataDTO = new InteractDataDTO
@Consume @Watch('onChangeCommentList') commentList: InteractDataDTO[]
getPublishTime(): string {
... ...
... ... @@ -298,7 +298,7 @@ struct ChannelSubscriptionLayout {
Text(INDEX_SETTING_SUBTITLE)
.fontSize(12)
.fontWeight(400)
.fontColor('#222222')
.fontColor('#80222222')
}
.width('100%')
.margin({ top: 22, bottom: 16 })
... ...
import { CompDTO,
import {
CompDTO,
ContentBean,
ContentDTO,
InteractDataDTO,
InteractParam, LiveRoomDataBean, ReserveBean, ReserveItemBean } from 'wdBean/Index'
InteractParam,
LiveRoomDataBean,
ReserveBean,
ReserveItemBean,
slideShows
} from 'wdBean/Index'
import { BaseDTO } from 'wdBean/src/main/ets/bean/component/BaseDTO'
import { CollectionUtils, DateTimeUtils, LazyDataSource, Logger, StringUtils } from 'wdKit/Index'
import { HttpUtils, ResponseDTO } from 'wdNetwork/Index'
... ... @@ -22,7 +28,7 @@ export class BasePageHelp {
if (HttpUtils.getUserId()) {
let time = DateTimeUtils.getTimeStamp().toString()
Logger.debug(TAG, 'getAppointmentInfo-->'+time)
Logger.debug(TAG, 'getAppointmentInfo-->' + time)
const reserveBean = this.transformToLiveDetailsBeans(compList)
LiveModel.getAppointmentStatus(reserveBean).then((result) => {
Logger.debug(TAG, '是否预约数据:' + ` ${JSON.stringify(result)}`)
... ... @@ -116,11 +122,11 @@ export class BasePageHelp {
return idList.join(',')
}
/**
* 批查稿件的互动数据,如 评论人数等
* @param compList
* @returns
*/
/**
* 批查稿件的互动数据,如 评论人数等
* @param compList
* @returns
*/
async getInteractData(compList: CompDTO[]) {
let param: InteractParam = this.getInteractParams(compList);
const SIZE = 20;
... ... @@ -165,13 +171,17 @@ export class BasePageHelp {
allInteractDataList.push(...value);
}
})
// 批查全部完成,统一设置到comp里
// this.resetInteract(allInteractDataList, compList);
success(allInteractDataList);
})
})
}
/**
* 收集信息流页面,可参与批查稿件的业务信息
* @param compList
* @returns
*/
private getInteractParams(compList: CompDTO[]): InteractParam {
if (compList == null || compList.length == 0) {
return {} as InteractParam;
... ... @@ -204,6 +214,34 @@ export class BasePageHelp {
return param;
}
/**
* 获取组件中需要参与批查业务信息
* @param slideShowArray
* @returns
*/
public getCompInteractParams(slideShowArray: slideShows[]): InteractParam {
if (slideShowArray == null || slideShowArray.length == 0) {
return {} as InteractParam;
}
let param: InteractParam = {} as InteractParam;
param.contentList = new Array<ContentBean>();
slideShowArray.forEach((value) => {
let bean = {} as ContentBean;
bean.contentId = value.newsId;
bean.contentType = value.objectType;
param.contentList.push(bean);
})
return param
}
/**
* 查询互动相关数据,如收藏数、评论数等
* @param param
* @returns
*/
private createInteractDataPromise(param: InteractParam) {
return new Promise<InteractDataDTO[]>((success, error) => {
PageRepository.fetchInteractData(param).then((resDTO: ResponseDTO<InteractDataDTO[]>) => {
... ... @@ -221,12 +259,24 @@ export class BasePageHelp {
});
}
async requestCompInteractData(param: InteractParam): Promise<InteractDataDTO[]> {
return new Promise<InteractDataDTO[]>((success, error) => {
this.createInteractDataPromise(param).then((result) => {
if (!CollectionUtils.isArray(result)) {
success(new Array<InteractDataDTO>());
return;
}
success(result);
})
})
}
/**
* 刷新互动数据到compList
* @param interact 批查互动数据结果
* @param compList comp list
*/
resetInteract(interact: InteractDataDTO[], compList: BaseDTO[]) {
resetInteract(interact: InteractDataDTO[], compList: BaseDTO[]) {
if (interact == null || interact.length == 0) {
return
}
... ... @@ -252,6 +302,4 @@ export class BasePageHelp {
}
})
}
}
\ No newline at end of file
... ...
... ... @@ -41,6 +41,7 @@ export default struct TemplatePageComponent {
extra: string = ''
async aboutToAppear() {
Logger.debug(TAG, 'aboutToAppear')
this.requestPageData()
... ... @@ -78,9 +79,6 @@ export default struct TemplatePageComponent {
})
}
aboutToDisappear(): void {
}
build() {
if (this.templatePage.pageCompType === TemplatePageStateType.LOADING) {
... ...
import { ContentDTO } from 'wdBean/Index';
import { BaseDTO } from 'wdBean/src/main/ets/bean/component/BaseDTO';
import { LazyDataSource } from 'wdKit/Index';
import { WDViewDefaultType } from '../../view/EmptyComponent';
... ...
... ... @@ -85,8 +85,8 @@ export default struct CustomLayout {
name: this.animateName,
path: "lottie/refresh_step1.json", // 路径加载动画只支持entry/src/main/ets 文件夹下的相对路径
})
this.animateItem.goToAndStop(1)
}
this.animateItem.goToAndStop(1)
let total = CustomLayout.REFRESH_HEIGHT
let progress = offset * 100 / total
this.animateItem?.goToAndStop(this.getFramesByProgress(progress), true);
... ... @@ -103,9 +103,6 @@ export default struct CustomLayout {
path: "lottie/refresh_step2.json", // 路径加载动画只支持entry/src/main/ets 文件夹下的相对路径
})
}
// this.animateItem2.isLoaded
// TODO 是否拦截重复触发
this.animateItem2.goToAndPlay(1)
}
getFramesByProgress(progress: number): number {
... ...
... ... @@ -18,14 +18,18 @@ export struct CustomPullToRefresh {
.setAnimDuration(500);
private refreshSettings: RenderingContextSettings = new RenderingContextSettings(true)
private refreshContext: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.refreshSettings)
private refreshingSettings: RenderingContextSettings = new RenderingContextSettings(true)
private refreshingContext: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.refreshingSettings)
private loadMoreSettings: RenderingContextSettings = new RenderingContextSettings(true)
private loadMoreContext: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.loadMoreSettings)
private refreshAnimation: AnimationItem | null = null;
private refreshingAnimation: AnimationItem | null = null;
private loadMoreAnimation: AnimationItem | null = null;
private refreshAnimName: string = "refresh";
private refreshingAnimName: string = "refreshing";
private loadMoreAnimName: string = "loadMore";
private refreshAnimationDestroy = true
private refreshingAnimationDestroy = true
// refresh-1,refreshing-2,refreshed-3,idle-4
@State @Watch('stateChange') private refreshState: number = 4;
... ... @@ -102,7 +106,10 @@ export struct CustomPullToRefresh {
lottie.destroy(this.refreshingAnimName);
this.refreshAnimation?.removeEventListener('DOMLoaded')
this.refreshAnimation?.removeEventListener('destroy')
this.refreshingAnimation?.removeEventListener('DOMLoaded')
this.refreshingAnimation?.removeEventListener('destroy')
this.refreshAnimation = null
this.refreshingAnimation = null
}
@Builder
... ... @@ -120,9 +127,23 @@ export struct CustomPullToRefresh {
})
.onDisAppear(() => {
lottie.destroy(this.refreshAnimName);
})
.visibility(this.refreshState == 1 ? Visibility.Visible : Visibility.Hidden)
Canvas(this.refreshingContext)
.width(60)
.height(60)
.backgroundColor(Color.Transparent)
.onReady(() => {
// 可在此生命回调周期中加载动画,可以保证动画尺寸正确
//抗锯齿的设置
this.refreshContext.imageSmoothingEnabled = true;
this.refreshContext.imageSmoothingQuality = 'medium'
})
.onDisAppear(() => {
lottie.destroy(this.refreshingAnimName);
})
.visibility((this.refreshState == 1 || this.refreshState == 2) ? Visibility.Visible : Visibility.Hidden)
.visibility(this.refreshState == 2 ? Visibility.Visible : Visibility.Hidden)
Text('已更新至最新')
.fontSize(14)
... ... @@ -175,10 +196,7 @@ export struct CustomPullToRefresh {
}
private refreshAnim(percent: number) {
if (this.refreshAnimation == null || this.refreshAnimation.name != this.refreshAnimName ||
this.refreshAnimationDestroy) {
this.refreshAnimation?.destroy(this.refreshAnimName)
this.refreshAnimation?.destroy(this.refreshingAnimName)
if (this.refreshAnimation == null || this.refreshAnimationDestroy) {
this.refreshAnimation = lottie.loadAnimation({
container: this.refreshContext,
renderer: 'canvas', // canvas 渲染模式
... ... @@ -212,21 +230,19 @@ export struct CustomPullToRefresh {
}
private refreshingAnim() {
// Logger.error('zzzz', 'animate2, 1')
// 先销毁之前的动画
if (this.refreshAnimation == null || this.refreshAnimation.name != this.refreshingAnimName ||
this.refreshAnimationDestroy) {
this.refreshAnimation?.destroy(this.refreshAnimName)
this.refreshAnimation?.destroy(this.refreshingAnimName)
this.refreshAnimation = lottie.loadAnimation({
container: this.refreshContext,
if (this.refreshingAnimation == null || this.refreshingAnimationDestroy) {
this.refreshingAnimation?.destroy(this.refreshingAnimName)
this.refreshingAnimation = lottie.loadAnimation({
container: this.refreshingContext,
renderer: 'canvas', // canvas 渲染模式
loop: 10,
autoplay: true,
name: this.refreshingAnimName,
path: "lottie/refresh_step2.json", // 路径加载动画只支持entry/src/main/ets 文件夹下的相对路径
})
this.addRefreshAnimListener()
this.refreshingAnimationDestroy = false
this.addRefreshingAnimListener()
}
// Logger.error('zzzz', 'animate2, 2')
}
... ... @@ -242,6 +258,13 @@ export struct CustomPullToRefresh {
});
}
private addRefreshingAnimListener() {
this.refreshingAnimation?.addEventListener('destroy', (args: Object): void => {
// Logger.error('zzzz', "lottie destroy");
this.refreshingAnimationDestroy = true
});
}
loadMoreAnimate() {
if (this.loadMoreAnimation == null) {
this.loadMoreAnimation = lottie.loadAnimation({
... ...
... ... @@ -66,31 +66,31 @@ export struct SearchComponent {
this.breakpointSystem.unregister();
}
getRelatedSearchContent() {
if (StringUtils.isNotEmpty(this.searchText)) {
SearcherAboutDataModel.getRelatedSearchContentData(encodeURI(this.searchText), getContext(this)).then((value) => {
getRelatedSearchContent(searchText: string) {
if (StringUtils.isNotEmpty(searchText)) {
SearcherAboutDataModel.getRelatedSearchContentData(encodeURI(searchText), getContext(this)).then((value) => {
if (value != null && value.length > 0) {
this.relatedSearchContentsData = []
value.forEach(item => {
let tempValue: string = item
let tempArr: string[] = []
if (tempValue.indexOf(this.searchText) === -1) {
if (tempValue.indexOf(searchText) === -1) {
tempArr.push(item)
this.relatedSearchContentsData.push(new SearchRelatedItem(item, tempArr))
} else {
while (tempValue.indexOf(this.searchText) != -1) {
let index = tempValue.indexOf(this.searchText)
while (tempValue.indexOf(searchText) != -1) {
let index = tempValue.indexOf(searchText)
if (index === 0) {
try {
tempArr.push(this.searchText)
tempValue = tempValue.substring(this.searchText.length, tempValue.length)
tempArr.push(searchText)
tempValue = tempValue.substring(searchText.length, tempValue.length)
} catch (e) {
}
} else {
try {
tempArr.push(tempValue.substring(0, index))
tempArr.push(this.searchText)
tempValue = tempValue.substring(index + this.searchText.length, tempValue.length)
tempArr.push(searchText)
tempValue = tempValue.substring(index + searchText.length, tempValue.length)
} catch (e) {
}
}
... ... @@ -356,7 +356,7 @@ export struct SearchComponent {
this.resetSearch()
} else {
if (this.hasInputContent) {
this.getRelatedSearchContent()
this.getRelatedSearchContent(value)
}
}
})
... ...
... ... @@ -142,7 +142,7 @@ export struct SearchResultComponent {
SearchResultContentComponent({ keywords: this.searchText, searchType: item ,sameSearch:this.sameSearch,isCurrentShow:this.currentIndex === index})
}.tabBar(this.TabBuilder(index, item))
.layoutWeight(1)
}, (item: string, index: number) => index.toString())
}, (item: string) => item)
}
.vertical(false)
.barMode(BarMode.Fixed)
... ...
... ... @@ -10,7 +10,7 @@ import {
} from 'wdBean/Index'
import { LiveInfoDTO } from 'wdBean/src/main/ets/bean/detail/LiveInfoDTO'
import { VoiceInfoDTO } from 'wdBean/src/main/ets/bean/detail/VoiceInfoDTO'
import { LazyDataSource, StringUtils, UserDataLocal } from 'wdKit/Index'
import { LazyDataSource, StringUtils, UserDataLocal } from 'wdKit/Index'
import MinePageDatasModel from '../../model/MinePageDatasModel'
import SearcherAboutDataModel from '../../model/SearcherAboutDataModel'
import { CreatorDetailRequestItem } from '../../viewmodel/CreatorDetailRequestItem'
... ... @@ -19,8 +19,7 @@ import { FollowListDetailItem } from '../../viewmodel/FollowListDetailItem'
import { FollowListStatusRequestItem } from '../../viewmodel/FollowListStatusRequestItem'
import { QueryListIsFollowedItem } from '../../viewmodel/QueryListIsFollowedItem'
import { SearchResultContentData } from '../../viewmodel/SearchResultContentData'
import {
SearchResultContentItem, SearchRmhDescription } from '../../viewmodel/SearchResultContentItem'
import { SearchResultContentItem, SearchRmhDescription } from '../../viewmodel/SearchResultContentItem'
import { CardParser } from '../CardParser'
import { FollowChildComponent } from '../mine/follow/FollowChildComponent'
import { ListHasNoMoreDataUI } from '../reusable/ListHasNoMoreDataUI'
... ... @@ -30,6 +29,7 @@ import { JSON } from '@kit.ArkTS'
import { MoreComponent } from '../cardview/MoreComponent'
import { Card9Component } from '../cardview/Card9Component'
import { WDRouterRule, WDRouterPage } from 'wdRouter/Index'
import { EmptyComponent, WDViewDefaultType } from '../view/EmptyComponent'
const TAG = "SearchResultContentComponent"
... ... @@ -38,7 +38,7 @@ export struct SearchResultContentComponent {
@State keywords: string = ""
@State searchType: string = ""
@State data: LazyDataSource<ContentDTO> = new LazyDataSource();
tempList : ContentDTO[] = []
tempList: ContentDTO[] = []
@State data_rmh: SearchRmhDescription[] = []
@State count: number = -1;
@State isLoading: boolean = false
... ... @@ -48,14 +48,14 @@ export struct SearchResultContentComponent {
scroller: Scroller = new Scroller()
private scroller2: Scroller = new Scroller()
@State ellipseW: number = 0
@State moreWidth:number = 20
@State moreWidth: number = 20
@State listLeft: number = 0
@State isEnd: boolean = false
@Watch('updateData') @Prop sameSearch:number = 0
@Prop isCurrentShow:boolean = false;
@Watch('updateData') @Prop sameSearch: number = 0
@Prop isCurrentShow: boolean = false;
updateData(){
if(this.isCurrentShow){
updateData() {
if (this.isCurrentShow) {
this.data_rmh = []
this.data.clearAllData()
... ... @@ -115,7 +115,7 @@ export struct SearchResultContentComponent {
data.headerPhotoUrl = item.headPhotoUrl.split("?")[0]
data.mainControl = item.mainControl + ""
if(data_temp.length === 1){
if (data_temp.length === 1) {
this.bean.headPhotoUrl = item.headPhotoUrl.split("?")[0]
this.bean.cnUserName = item.userName
this.bean.creatorId = item.creatorId
... ... @@ -133,8 +133,8 @@ export struct SearchResultContentComponent {
} else {
this.bean.cnFansNum = item.fansNum + ""
}
let regex:RegExp = new RegExp('\n','g')
this.bean.introduction = item.introduction.replace(regex,'')
let regex: RegExp = new RegExp('\n', 'g')
this.bean.introduction = item.introduction.replace(regex, '')
this.bean.mainControl = item.mainControl
this.bean.banControl = item.banControl
... ... @@ -148,9 +148,13 @@ export struct SearchResultContentComponent {
data_temp.forEach((data) => {
this.data_rmh.push(data)
})
if (this.data_rmh.length > 0) {
this.count = 1
}
//只有一条创作者,获取 创作者信息
if (this.data_rmh.length === 1) {
if(StringUtils.isNotEmpty(UserDataLocal.getUserId())){
if (StringUtils.isNotEmpty(UserDataLocal.getUserId())) {
//查询是否被关注
let status = new FollowListStatusRequestItem()
status.creatorIds.push(new QueryListIsFollowedItem(this.data_rmh[0].creatorId))
... ... @@ -159,7 +163,7 @@ export struct SearchResultContentComponent {
}).catch((err: Error) => {
console.log(TAG, "请求失败")
})
}else{
} else {
this.bean.status = ""
}
}
... ... @@ -192,53 +196,55 @@ export struct SearchResultContentComponent {
})
})
SearcherAboutDataModel.getInteractListData(data, getContext(this)).then((newValue) => {
newValue.forEach((item) => {
resultData.list.forEach((data) => {
if (item.contentId == data.data.id) {
data.data.collectNum = item.collectNum + ""
data.data.commentNum = item.commentNum + ""
data.data.likeNum = item.likeNum + ""
data.data.readNum = item.readNum + ""
data.data.shareNum = item.shareNum + ""
}
if (data.contentList.length > 0) {
SearcherAboutDataModel.getInteractListData(data, getContext(this)).then((newValue) => {
newValue.forEach((item) => {
resultData.list.forEach((data) => {
if (item.contentId == data.data.id) {
data.data.collectNum = item.collectNum + ""
data.data.commentNum = item.commentNum + ""
data.data.likeNum = item.likeNum + ""
data.data.readNum = item.readNum + ""
data.data.shareNum = item.shareNum + ""
}
})
})
})
// 批量号主信息
let creatorIdList: string[] = []
resultData.list.forEach((value:SearchResultContentItem) => {
creatorIdList.push(value.data.creatorId)
})
SearcherAboutDataModel.getCreatorDetailListData({creatorIdList:creatorIdList}).then((rem) => {
// 批量号主信息
let creatorIdList: string[] = []
resultData.list.forEach((value: SearchResultContentItem) => {
const landscape = value.data.landscape
let photos: FullColumnImgUrlDTO[] = []
// if (value.data.appStyle === 4) {
creatorIdList.push(value.data.creatorId)
})
SearcherAboutDataModel.getCreatorDetailListData({ creatorIdList: creatorIdList }).then((rem) => {
resultData.list.forEach((value: SearchResultContentItem) => {
const landscape = value.data.landscape
let photos: FullColumnImgUrlDTO[] = []
// if (value.data.appStyle === 4) {
value.data.appStyleImages.split("&&").forEach((value) => {
let resizeParams = MinePageDatasModel.extractResizeParams(value)
if(resizeParams && resizeParams.length === 2){
if (resizeParams && resizeParams.length === 2) {
photos.push(
{
fullUrl: value,
weight:resizeParams[0],
height:resizeParams[1],
weight: resizeParams[0],
height: resizeParams[1],
landscape: Number(landscape),
} as FullColumnImgUrlDTO
)
}
})
// }
let contentDTO = this.dataTransform(rem,value, photos);
if(value.data.type != "13"){
this.data.push(contentDTO)
if(value.data.sameContentList != null && value.data.sameContentList.length > 0) {
let contentDTO2 = new ContentDTO();
contentDTO2.sameContentListJson = JSON.stringify(value.data.sameContentList)
contentDTO2.sameContentListSize = value.data.sameContentList.length
this.data.push(contentDTO2)
// }
let contentDTO = this.dataTransform(rem, value, photos);
if (value.data.type != "13") {
this.data.push(contentDTO)
if (value.data.sameContentList != null && value.data.sameContentList.length > 0) {
let contentDTO2 = new ContentDTO();
contentDTO2.sameContentListJson = JSON.stringify(value.data.sameContentList)
contentDTO2.sameContentListSize = value.data.sameContentList.length
this.data.push(contentDTO2)
}
}
}
})
})
this.tempList = []
this.data.notifyDataReload()
... ... @@ -249,30 +255,38 @@ export struct SearchResultContentComponent {
this.hasMore = false
}
this.isLoading = false
}).catch((err: Error) => {
console.log(TAG, JSON.stringify(err))
})
}).catch((err: Error) => {
console.log(TAG, JSON.stringify(err))
console.log(TAG, "请求失败")
this.isLoading = false
this.count = this.count === -1 ? 0 : this.count
})
}).catch((err: Error) => {
console.log(TAG, "请求失败")
this.isLoading = false
this.count = this.count === -1 ? 0 : this.count
})
} else {
this.hasMore = false
}
}
build() {
Column() {
if (this.count == 0) {
ListHasNoMoreDataUI({ style: 2 })
EmptyComponent({
emptyType: WDViewDefaultType.WDViewDefaultType_NoSearchResult,
emptyButton: false,
}).height('70%')
} else {
List({scroller:this.scroller2}) {
if (this.data_rmh != null && this.data_rmh.length > 0){
if (this.data_rmh.length === 1){
ListItem(){
List({ scroller: this.scroller2 }) {
if (this.data_rmh != null && this.data_rmh.length > 0) {
if (this.data_rmh.length === 1) {
ListItem() {
FollowChildComponent({ data: this.bean, type: 1 })
}.padding({left:"31lpx",right:"31lpx"})
}else{
ListItem(){
Column(){
}.padding({ left: "31lpx", right: "31lpx" })
} else {
ListItem() {
Column() {
this.SearchListUI()
}
}
... ... @@ -283,43 +297,46 @@ export struct SearchResultContentComponent {
Column() {
if (this.searchType == "activity") {
ActivityItemComponent({ contentDTO: item })
}else if(item.sameContentListSize > 0){
} else if (item.sameContentListSize > 0) {
MoreComponent({ contentDTO: item })
}else if(item.appStyle == "9"){
Column(){
Card9Component({ compDTO: new CompDTO, contentDTO:item, pageId: "", pageName: "" })
} else if (item.appStyle == "9") {
Column() {
Card9Component({
compDTO: new CompDTO,
contentDTO: item,
pageId: "",
pageName: ""
})
Divider().strokeWidth(5).color('#f5f5f5').padding({ left: 0, right: 0 })
}
} else {
if(this.data?.get(index + 1)?.sameContentListSize > 0) {
if (this.data?.get(index + 1)?.sameContentListSize > 0) {
Divider()
.width('100%')
.color($r('app.color.color_F5F5F5'))
.strokeWidth(4)
}
CardParser({compDTO:new CompDTO, contentDTO: item })
CardParser({ compDTO: new CompDTO, contentDTO: item })
}
if (index != this.data.totalCount() - 1) {
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
// Divider()
// .width('100%')
// .height('1lpx')
// .color($r('app.color.color_F5F5F5'))
// .strokeWidth('1lpx')
}
}
}
}, (item: ContentDTO, index: number) => index.toString())
//没有更多数据 显示提示
if (!this.hasMore && this.data.totalCount() > 0) {
if (!this.hasMore && (this.data.totalCount() > 0 || (this.data_rmh != null && this.data_rmh.length > 0))) {
ListItem() {
ListHasNoMoreDataUI()
}
}
}.cachedCount(5)
}
.cachedCount(5)
.edgeEffect(EdgeEffect.None)
.scrollBar(BarState.Off)
.height('100%')
.onReachEnd(() => {
console.log(TAG, "触底了");
if (!this.isLoading) {
... ... @@ -329,28 +346,29 @@ export struct SearchResultContentComponent {
}
}
.backgroundColor($r('app.color.white'))
.height('100%')
.width('100%')
}
@Builder
SearchListUI() {
List({initialIndex: 0,space:'8lpx',scroller: this.scroller}) {
ListItemGroup(){
List({ initialIndex: 0, space: '8lpx', scroller: this.scroller }) {
ListItemGroup() {
ForEach(this.data_rmh, (item: SearchRmhDescription, index: number) => {
ListItem() {
SearchCreatorComponent({item:item})
SearchCreatorComponent({ item: item })
}
.width('150lpx')
.height('100%')
})
}.offset({ left: this.listLeft })
ListItem(){
if (this.data_rmh.length === 10){
ListItem() {
if (this.data_rmh.length === 10) {
this.itemEnd()
}
}.height('100%')
.margin({left:'23lpx'})
.margin({ left: '23lpx' })
}
.edgeEffect(EdgeEffect.None)
.scrollBar(BarState.Off)
... ... @@ -359,10 +377,10 @@ export struct SearchResultContentComponent {
.height('219lpx')
.onReachEnd(() => {
this.isEnd = true
console.log(TAG,'is end')
console.log(TAG, 'is end')
})
.onScrollFrameBegin((offset: number, state: ScrollState) => {
console.log(TAG,'offset', offset)
console.log(TAG, 'offset', offset)
if (!this.scroller.isAtEnd()) {
this.isEnd = false
}
... ... @@ -374,31 +392,35 @@ export struct SearchResultContentComponent {
.parallelGesture(
PanGesture({ direction: PanDirection.Horizontal, distance: 1 })
.onActionStart((event: GestureEvent) => {
console.info(TAG,'Pan start')
console.info(TAG, 'Pan start')
})
.onActionUpdate((event: GestureEvent) => {
///小于10个不展示滑动
if (this.data_rmh.length < 10) return;
if (this.data_rmh.length < 10) {
return;
}
if (event && this.isEnd) {
// console.log('event.offsetX',event.offsetX)
this.listLeft = event.offsetX < -60 ? -60 : event.offsetX > 0 ? 0 : event.offsetX
this.ellipseW = (-this.listLeft) / 1.5
console.log(TAG,"this.ellipseW==>" + this.ellipseW)
console.log(TAG, "this.ellipseW==>" + this.ellipseW)
}
})
.onActionEnd((event: GestureEvent) => {
if (this.data_rmh.length < 10) return;
console.info(TAG,'Pan end')
if (this.data_rmh.length < 10) {
return;
}
console.info(TAG, 'Pan end')
this.listLeft = 0
// this.moreWidth = 20
if (event.offsetX < 0 && this.ellipseW >=20) {
console.log(TAG,'跳转')
if (event.offsetX < 0 && this.ellipseW >= 20) {
console.log(TAG, '跳转')
let params: Params = {
pageID: this.keywords
}
WDRouterRule.jumpWithPage(WDRouterPage.searchCreatorPage,params)
WDRouterRule.jumpWithPage(WDRouterPage.searchCreatorPage, params)
}
this.ellipseW = 0
})
... ... @@ -411,18 +433,17 @@ export struct SearchResultContentComponent {
.strokeWidth('12lpx')
}
@Builder
itemEnd() {
Row() {
Ellipse()
.width(2* this.ellipseW)
.width(2 * this.ellipseW)
.height('100%')
.fill('rgb(240,235,238)')
.position({ left: -this.ellipseW, top: 0 })
Column(){
Text(this.ellipseW === 0 ? '' : this.ellipseW < 20? '查看更多' : '松手查看')
Column() {
Text(this.ellipseW === 0 ? '' : this.ellipseW < 20 ? '查看更多' : '松手查看')
.width('19lpx')
.fontSize('19lpx')
.fontWeight('400lpx')
... ... @@ -437,153 +458,153 @@ export struct SearchResultContentComponent {
.height('100%')
}
private dataTransform(rem:CreatorDetailResponseItem[],value: SearchResultContentItem, photos: FullColumnImgUrlDTO[]): ContentDTO {
let rmhInfo = this.getRmhInfo(rem,value)
console.log('获取photos',JSON.stringify(photos))
console.log('获取value2',JSON.stringify(value))
let liveType = value.data?.liveType;
let seoTags = value.data?.seoTags
let cornerMark = value.data?.cornerMark
let contentDTO = new ContentDTO();
contentDTO.liveType = liveType?liveType: ""
contentDTO.seoTags = seoTags?seoTags: ""
contentDTO.cornerMark = cornerMark?cornerMark: ""
contentDTO.appStyle = value.data.appStyle + ""
contentDTO.cityCode = value.data.cityCode
contentDTO.coverSize = ""
contentDTO.coverType = value.data.type == "5" ? 1 : -1
contentDTO.coverUrl =
this.searchType == "activity" ? value.data.zhChannelPageImg : value.data.appStyleImages.split("&&")[0];
contentDTO.description = value.data.description
contentDTO.districtCode = value.data.districtCode
contentDTO.endTime = value.data.endTime
contentDTO.hImageUrl = ""
contentDTO.heatValue = ""
contentDTO.innerUrl = ""
contentDTO.landscape = Number.parseInt(value.data.landscape)
contentDTO.linkUrl = value.data.linkUrl
contentDTO.openLikes = Number.parseInt(value.data.openLikes)
contentDTO.openUrl = ""
contentDTO.pageId = value.data.pageId
contentDTO.programAuth = ""
contentDTO.programId = ""
contentDTO.programName = ""
contentDTO.programSource = -1
contentDTO.programType = Number.parseInt(value.data.status)
contentDTO.provinceCode = value.data.provinceCode
contentDTO.showTitleEd = value.data.showTitleEd
contentDTO.showTitleIng = value.data.showTitleIng
contentDTO.showTitleNo = value.data.showTitleNo
contentDTO.startTime = value.data.startTime
contentDTO.subType = ""
contentDTO.subtitle = ""
contentDTO.title = value.data.title
contentDTO.vImageUrl = ""
contentDTO.screenType = ""
contentDTO.source = StringUtils.isEmpty(value.data.creatorName) ? value.data.sourceName : value.data.creatorName
contentDTO.objectId = value.data.id
contentDTO.objectType = value.data.type
contentDTO.channelId = value.data.channelId
contentDTO.relId = value.data.relId
contentDTO.relType = value.data.relType
contentDTO.newsTitle = value.data.titleLiteral;
contentDTO.publishTime =
StringUtils.isNotEmpty(value.data.firstPublishTime) ? value.data.firstPublishTime : value.data.publishTime
contentDTO.visitorComment = -1
contentDTO.fullColumnImgUrls = photos
contentDTO.newsSummary = ""
contentDTO.hasMore = -1
contentDTO.slideShows = []
contentDTO.voiceInfo = {} as VoiceInfoDTO
contentDTO.tagWord = -1
contentDTO.isSelect = true
contentDTO.rmhInfo = {} as RmhInfoDTO
contentDTO.photoNum = StringUtils.isEmpty(value.data.picCount) ? 0 : Number(value.data.picCount)
contentDTO.liveInfo = {} as LiveInfoDTO;
contentDTO.videoInfo = {
videoDuration: Number.parseInt(value.data.duration)
} as VideoInfoDTO;
let interact = new InteractDataDTO()
interact.collectNum = value.data.collectNum
interact.commentNum = value.data.commentNum
interact.contentId = value.data.id
interact.contentType = Number.parseInt(value.data.type)
interact.likeNum = value.data.likeNum
interact.readNum = Number.parseInt(value.data.readNum)
interact.shareNum = Number.parseInt(value.data.shareNum)
contentDTO.interactData = interact
contentDTO.corner = ''
contentDTO.rmhPlatform = 0
contentDTO.newTags = ''
contentDTO.isSearch = true
contentDTO.publishTimestamp = ""
contentDTO.bottomNavId = '';
contentDTO.openType = '';
contentDTO.extra = '';
contentDTO.titleShow = value.data.titleShow == "1" ? 0 : 1
contentDTO.rmhInfo = rmhInfo
contentDTO.shareFlag = value.data.shareFlag
contentDTO.contentText = value.data.contentText
return contentDTO;
private dataTransform(rem: CreatorDetailResponseItem[], value: SearchResultContentItem,
photos: FullColumnImgUrlDTO[]): ContentDTO {
let rmhInfo = this.getRmhInfo(rem, value)
console.log('获取photos', JSON.stringify(photos))
console.log('获取value2', JSON.stringify(value))
let liveType = value.data?.liveType;
let seoTags = value.data?.seoTags
let cornerMark = value.data?.cornerMark
let contentDTO = new ContentDTO();
contentDTO.liveType = liveType ? liveType : ""
contentDTO.seoTags = seoTags ? seoTags : ""
contentDTO.cornerMark = cornerMark ? cornerMark : ""
contentDTO.appStyle = value.data.appStyle + ""
contentDTO.cityCode = value.data.cityCode
contentDTO.coverSize = ""
contentDTO.coverType = value.data.type == "5" ? 1 : -1
contentDTO.coverUrl =
this.searchType == "activity" ? value.data.zhChannelPageImg : value.data.appStyleImages.split("&&")[0];
contentDTO.description = value.data.description
contentDTO.districtCode = value.data.districtCode
contentDTO.endTime = value.data.endTime
contentDTO.hImageUrl = ""
contentDTO.heatValue = ""
contentDTO.innerUrl = ""
contentDTO.landscape = Number.parseInt(value.data.landscape)
contentDTO.linkUrl = value.data.linkUrl
contentDTO.openLikes = Number.parseInt(value.data.openLikes)
contentDTO.openUrl = ""
contentDTO.pageId = value.data.pageId
contentDTO.programAuth = ""
contentDTO.programId = ""
contentDTO.programName = ""
contentDTO.programSource = -1
contentDTO.programType = Number.parseInt(value.data.status)
contentDTO.provinceCode = value.data.provinceCode
contentDTO.showTitleEd = value.data.showTitleEd
contentDTO.showTitleIng = value.data.showTitleIng
contentDTO.showTitleNo = value.data.showTitleNo
contentDTO.startTime = value.data.startTime
contentDTO.subType = ""
contentDTO.subtitle = ""
contentDTO.title = value.data.title
contentDTO.vImageUrl = ""
contentDTO.screenType = ""
contentDTO.source = StringUtils.isEmpty(value.data.creatorName) ? value.data.sourceName : value.data.creatorName
contentDTO.objectId = value.data.id
contentDTO.objectType = value.data.type
contentDTO.channelId = value.data.channelId
contentDTO.relId = value.data.relId
contentDTO.relType = value.data.relType
contentDTO.newsTitle = value.data.titleLiteral;
contentDTO.publishTime =
StringUtils.isNotEmpty(value.data.firstPublishTime) ? value.data.firstPublishTime : value.data.publishTime
contentDTO.visitorComment = -1
contentDTO.fullColumnImgUrls = photos
contentDTO.newsSummary = ""
contentDTO.hasMore = -1
contentDTO.slideShows = []
contentDTO.voiceInfo = {} as VoiceInfoDTO
contentDTO.tagWord = -1
contentDTO.isSelect = true
contentDTO.rmhInfo = {} as RmhInfoDTO
contentDTO.photoNum = StringUtils.isEmpty(value.data.picCount) ? 0 : Number(value.data.picCount)
contentDTO.liveInfo = {} as LiveInfoDTO;
contentDTO.videoInfo = {
videoDuration: Number.parseInt(value.data.duration)
} as VideoInfoDTO;
let interact = new InteractDataDTO()
interact.collectNum = value.data.collectNum
interact.commentNum = value.data.commentNum
interact.contentId = value.data.id
interact.contentType = Number.parseInt(value.data.type)
interact.likeNum = value.data.likeNum
interact.readNum = Number.parseInt(value.data.readNum)
interact.shareNum = Number.parseInt(value.data.shareNum)
contentDTO.interactData = interact
contentDTO.corner = ''
contentDTO.rmhPlatform = 0
contentDTO.newTags = ''
contentDTO.isSearch = true
contentDTO.publishTimestamp = ""
contentDTO.bottomNavId = '';
contentDTO.openType = '';
contentDTO.extra = '';
contentDTO.titleShow = value.data.titleShow == "1" ? 0 : 1
contentDTO.rmhInfo = rmhInfo
contentDTO.shareFlag = value.data.shareFlag
contentDTO.contentText = value.data.contentText
return contentDTO;
}
// 搜索数据转化rmhInfo
private getRmhInfo(rem:CreatorDetailResponseItem[],value:SearchResultContentItem){
let obj = value.data
let rmhInfo:RmhInfoDTO = {
rmhHeadUrl:obj.headerPhotoUrl,
rmhName:obj.creatorName,
rmhId:obj.creatorId,
authIcon:obj.authIcon,
authTitle: obj.authTitle,
authTitle2: '',
banControl: 0,
cnIsAttention: 0,
cnAttention: 0,
cnlsComment: 0,
cnlsLike: 0,
cnMainControl: 0,
cnShareControl: 0,
cnIsComment: 0,
cnIsLike:0,
posterShareControl: 0,
rmhDesc: obj.introduction,
userId: obj.userId,
userType: obj.userType,
honoraryIcon:'',
rmhPlatform:0
}
if(rem.length>0){
rem.forEach(item=>{
if(item.creatorId === obj.creatorId){
rmhInfo = {
rmhHeadUrl:item.headPhotoUrl,
rmhName:item.userName,
rmhId:item.creatorId,
authIcon:item.authIcon,
authTitle: item.authTitle,
authTitle2: '',
banControl: 0,
cnIsAttention:item.isAttention,
cnAttention: 0,
cnlsComment: 0,
cnlsLike: 0,
cnMainControl: 0,
cnShareControl: 0,
cnIsComment: 0,
cnIsLike:0,
posterShareControl: 0,
rmhDesc: item.introduction,
userId: item.userId,
userType: item.userType,
honoraryIcon:'',
rmhPlatform:0
}
// 搜索数据转化rmhInfo
private getRmhInfo(rem: CreatorDetailResponseItem[], value: SearchResultContentItem) {
let obj = value.data
let rmhInfo: RmhInfoDTO = {
rmhHeadUrl: obj.headerPhotoUrl,
rmhName: obj.creatorName,
rmhId: obj.creatorId,
authIcon: obj.authIcon,
authTitle: obj.authTitle,
authTitle2: '',
banControl: 0,
cnIsAttention: 0,
cnAttention: 0,
cnlsComment: 0,
cnlsLike: 0,
cnMainControl: 0,
cnShareControl: 0,
cnIsComment: 0,
cnIsLike: 0,
posterShareControl: 0,
rmhDesc: obj.introduction,
userId: obj.userId,
userType: obj.userType,
honoraryIcon: '',
rmhPlatform: 0
}
if (rem.length > 0) {
rem.forEach(item => {
if (item.creatorId === obj.creatorId) {
rmhInfo = {
rmhHeadUrl: item.headPhotoUrl,
rmhName: item.userName,
rmhId: item.creatorId,
authIcon: item.authIcon,
authTitle: item.authTitle,
authTitle2: '',
banControl: 0,
cnIsAttention: item.isAttention,
cnAttention: 0,
cnlsComment: 0,
cnlsLike: 0,
cnMainControl: 0,
cnShareControl: 0,
cnIsComment: 0,
cnIsLike: 0,
posterShareControl: 0,
rmhDesc: item.introduction,
userId: item.userId,
userType: item.userType,
honoraryIcon: '',
rmhPlatform: 0
}
})
}
return rmhInfo
}
})
}
return rmhInfo
}
}
\ No newline at end of file
... ...
... ... @@ -58,7 +58,9 @@ export struct EmptyComponent {
@State emptyHeight: string | number = CommonConstants.FULL_PARENT;
@State emptyType: number = WDViewDefaultType.WDViewDefaultType_Default; // 缺省图类型,传枚举
@State emptyButton: boolean = false
@State isBlack: boolean = false // 背景是否为黑色 默认白色
@State timeNum: number = 10
/**
* The empty image width percentage setting.
*/
... ... @@ -135,7 +137,7 @@ export struct EmptyComponent {
})
if (this.isShowButton()) {
if (this.emptyType !== 15) {
if (this.emptyType !== 15 && !this.isBlack) {
Button('点击重试')
.type(ButtonType.Normal)
.width(80)
... ... @@ -253,7 +255,7 @@ export struct EmptyComponent {
}
isShowButton() {
if (this.emptyType === 1 || this.emptyType === 9 || this.emptyType === 15) {
if (this.emptyType === 1 || this.emptyType === 9 || this.emptyType === 15 && this.emptyButton) {
return true
} else {
return false
... ...
import { image } from '@kit.ImageKit';
import { matrix4, promptAction, window } from '@kit.ArkUI';
import { BusinessError } from '@kit.BasicServicesKit';
import { ScaleModel } from '../../model/ScaleModel';
import { OffsetModel } from '../../model/OffsetModel';
import { windowSizeManager } from '../../utils/Managers';
import { runWithAnimation } from '../../utils/FuncUtils';
import { PhotoListBean } from 'wdBean/Index';
import { http } from '@kit.NetworkKit';
// TODO:知识点:组件复用
@Reusable
@Component
export struct ImageItemView {
// @Consume private bgc: Color;
@Link isEnableSwipe: boolean; // TODO:需求:多图切换
@State isEnableOffset: boolean = false;
@State imageScaleInfo: ScaleModel = new ScaleModel(1.0, 1.0, 1.5, 0.3);
@State imageOffsetInfo: OffsetModel = new OffsetModel(0, 0);
@State matrix: matrix4.Matrix4Transit = matrix4.identity().copy();
@State imagePixelMap: image.PixelMap | null = null; // 当前图片pixelMap,用于Image组件显示
@State fitWH: "width" | "height" | undefined = undefined; // 表示当前图片是根据宽度适配还是高度适配
@State imageDefaultSize: image.Size = { width: 0, height: 0 }; // 图片默认大小,即,与屏幕大小最适配的显示大小
imageUri: string = ""; // 当前图片uri
imageWHRatio: number = 0; // 图片原始宽高比
private MultiPictureDetailItem: PhotoListBean = {} as PhotoListBean
@State imageBuffer: ArrayBuffer | undefined = undefined; // 图片ArrayBuffer
//alt app.media.picture_loading 设计稿尺寸
@State imageWidth:string | number = 167
private scroller: Scroller = new Scroller()
aboutToAppear(): void {
this.imageUri = this.MultiPictureDetailItem.picPath
this.getPicture()
}
/**
* 通过http的request方法从网络下载图片资源
*/
async getPicture() {
// 每一个httpRequest对应一个HTTP请求任务,不可复用
let httpRequest = http.createHttp();
// 用于订阅HTTP响应头事件
httpRequest.on('headersReceive', (header: Object) => {
console.info('header: ' + JSON.stringify(header));
});
// 用于订阅HTTP流式响应数据接收事件
let res = new ArrayBuffer(0);
httpRequest.on('dataReceive', (data: ArrayBuffer) => {
const newRes = new ArrayBuffer(res.byteLength + data.byteLength);
const resView = new Uint8Array(newRes);
resView.set(new Uint8Array(res));
resView.set(new Uint8Array(data), res.byteLength);
res = newRes;
// console.info('dataReceive res length: ' + res.byteLength);
});
// 用于订阅HTTP流式响应数据接收完毕事件
httpRequest.on('dataEnd', () => {
this.transcodePixelMap(res);
// 判断网络获取到的资源是否为ArrayBuffer类型
console.info(`dataEnd getPicture ${res}`)
if (res instanceof ArrayBuffer) {
console.info(`dataEnd getPicture`)
this.imageBuffer = res as ArrayBuffer;
}
console.info('No more data in response, data receive end');
});
httpRequest.requestInStream(this.imageUri,
(error: BusinessError, data: number) => {
if (error) {
// 下载失败时弹窗提示检查网络,不执行后续逻辑
promptAction.showToast({
message: $r('app.string.image_request_fail'),
duration: 2000
})
this.getPicture()
console.error(`http reqeust failed with. Code: ${error.code}, message: ${error.message}`);
return;
}
// 取消订阅HTTP响应头事件
httpRequest.off('headersReceive');
// 取消订阅HTTP流式响应数据接收事件
httpRequest.off('dataReceive');
// 取消订阅HTTP流式响应数据接收完毕事件
httpRequest.off('dataEnd');
// 当该请求使用完毕时,调用destroy方法主动销毁
httpRequest.destroy();
}
)
}
/**
* 使用createPixelMap将ArrayBuffer类型的图片装换为PixelMap类型
* @param data:网络获取到的资源
*/
transcodePixelMap(data: ArrayBuffer) {
const imageData: ArrayBuffer = data;
// 通过ArrayBuffer创建图片源实例。
const imageSource: image.ImageSource = image.createImageSource(imageData);
this.initCurrentImageInfo(imageSource);
}
/**
* 根据图片宽高比及窗口大小计算图片的默认宽高,即,图片最适配屏幕的大小
* @param imageWHRatio:图片原始宽高比
* @param size:窗口大小{with:number,height:number}
* @returns image.Size
*/
calcImageDefaultSize(imageWHRatio: number, size: window.Size): image.Size {
let width = 0
let height = 0;
width = size.width;
height = size.width / imageWHRatio;
return { width: width, height: height };
}
/**
* TODO:知识点:根据图片大小(宽高<=屏幕宽高)和屏幕大小计算图片放大适配屏幕进行显示的缩放倍率
* @param imageSize:图片当前大小
* @param windowSize:窗口大小
* @returns:缩放倍率
*/
calcFitScaleRatio(imageSize: image.Size, windowSize: window.Size): number {
let ratio: number = 1.0;
if (windowSize.width > imageSize.width) {
ratio = windowSize.width / imageSize.width;
} else {
ratio = windowSize.height / imageSize.height;
}
return ratio;
}
/**
* 设置当前图片的相关信息:uri、whRatio、pixelMap、fitWH、defaultSize、maxScaleValue
* TODO:知识点:提前获取图片的信息,以进行Image组件的尺寸设置及后续的相关计算
*/
initCurrentImageInfo(imageSource: image.ImageSource): void {
this.matrix = matrix4.identity().copy();
// const imageSource: image.ImageSource = image.createImageSource(this.imageUri);
imageSource.getImageInfo(0).then((data: image.ImageInfo) => {
this.imageWHRatio = data.size.width / data.size.height;
console.error(`this.imageDefaultSize this.imageWHRatio = ${this.imageWHRatio}`);
console.error(`this.imageDefaultSize width = ${data.size.width}`);
console.error(`this.imageDefaultSize height = ${data.size.height}`);
this.imageDefaultSize = this.calcImageDefaultSize(this.imageWHRatio, windowSizeManager.get());
console.error(`this.imageDefaultSize = ${JSON.stringify(windowSizeManager.get())}`);
console.error(`this.imageDefaultSize = ${JSON.stringify(this.imageDefaultSize)}`);
if (this.imageDefaultSize.width === windowSizeManager.get().width) {
this.fitWH = "width";
} else {
this.fitWH = "height";
}
this.imageScaleInfo.maxScaleValue += this.fitWH === "width" ?
(windowSizeManager.get().height / this.imageDefaultSize.height) :
(windowSizeManager.get().width / this.imageDefaultSize.width);
}).catch((err: BusinessError) => {
console.error(`[error][getImageInfo]${err.message}`);
});
imageSource.createPixelMap().then((data: image.PixelMap) => {
this.imagePixelMap = data;
}).catch((err: BusinessError) => {
console.error(`[error][createPixelMap]${err.message}`);
});
this.isEnableOffset = false;
this.imageScaleInfo.reset();
this.imageOffsetInfo.reset();
}
/**
* 在图片消失时,将当前图片的信息设置为默认值
*/
resetCurrentImageInfo(): void {
this.imageScaleInfo.reset();
this.imageOffsetInfo.reset();
this.matrix = matrix4.identity().copy();
}
/**
* TODO:需求:在偏移时评估是否到达边界,以便进行位移限制与图片的切换
* @returns:长度为4的boolean数组,表示上下左右是否到达边界
*/
evaluateBound(): boolean[] {
return [false, false, false, false];
}
build() {
Stack() {
Scroll(this.scroller) {
if(this.imageUri != null && (this.imageUri.includes('.gif') || this.imageUri.includes('.GIF'))){
Image(this.imageUri)// TODO:知识点:宽高只根据其尺寸设置一个,通过保持宽高比来设置另一个属性
.alt($r('app.media.datail_imageLoading_w'))
.width(this.imageWidth)
.objectFit(ImageFit.Auto)// TODO:知识点:保持宽高比进行缩放,可以超出父组件,以便实现多图切换的增强功能
.interpolation(ImageInterpolation.High)
.autoResize(false)
.transform(this.matrix)// TODO:知识点:通过matrix控制图片的缩放
.defaultFocus(true)
.offset({
// TODO:知识点:通过offset控制图片的偏移
x: this.imageOffsetInfo.currentX,
y: this.imageOffsetInfo.currentY
})
.onComplete(event => {
this.imageWidth = '100%'
})
} else {
Image(this.imagePixelMap)// TODO:知识点:宽高只根据其尺寸设置一个,通过保持宽高比来设置另一个属性
.alt($r('app.media.datail_imageLoading_w'))
.width(this.imageWidth)
.objectFit(ImageFit.Auto)// TODO:知识点:保持宽高比进行缩放,可以超出父组件,以便实现多图切换的增强功能
.interpolation(ImageInterpolation.High)
.autoResize(false)
.transform(this.matrix)// TODO:知识点:通过matrix控制图片的缩放
.defaultFocus(true)
.offset({
// TODO:知识点:通过offset控制图片的偏移
x: this.imageOffsetInfo.currentX,
y: this.imageOffsetInfo.currentY
})
.onComplete(event => {
this.imageWidth = '100%'
})
}
}
.scrollable(ScrollDirection.Vertical)
.scrollBarWidth(0)
.constraintSize({
maxHeight: this.imageDefaultSize.height
})
}
.onBlur(() => {
this.resetCurrentImageInfo();
})
// .backgroundColor(this.bgc)
.alignContent(Alignment.Center)
.width("100%")
.height("100%")
.backgroundColor(Color.Black)
.gesture(
GestureGroup(
GestureMode.Exclusive,
// TODO:知识点:双击切换图片大小
TapGesture({ count: 2 })
.onAction(() => {
let fn: Function;
// 已经是放大状态下,双击缩小
if (this.imageScaleInfo.scaleValue > this.imageScaleInfo.defaultScaleValue) {
fn = () => {
this.isEnableSwipe = true;
this.imageScaleInfo.reset();
this.imageOffsetInfo.reset();
this.matrix = matrix4.identity().copy();
};
} else {
// 已经是缩小状态,双击放大
fn = () => {
this.isEnableSwipe = false;
const ratio: number = this.calcFitScaleRatio(this.imageDefaultSize, windowSizeManager.get());
this.imageScaleInfo.scaleValue = ratio;
this.imageOffsetInfo.reset();
this.matrix = matrix4.identity().scale({
x: ratio,
y: ratio,
}).copy();
this.imageScaleInfo.stash();
}
}
runWithAnimation(fn);
}),
// 单击切换背景色
// TapGesture({ count: 1 }).onAction(() => {
// runWithAnimation(() => {
// this.bgc = this.bgc === Color.White ? Color.Black : Color.White;
// });
// }),
// TODO:知识点:双指捏合缩放图片
PinchGesture({ fingers: 2, distance: 1 })
.onActionUpdate((event: GestureEvent) => {
this.imageScaleInfo.scaleValue = this.imageScaleInfo.lastValue * event.scale;
// TODO:知识点:缩放时不允许大于最大缩放因子+额外缩放因子,不允许小于默认大小-额外缩放因子,额外缩放因子用于提升用户体验
if (this.imageScaleInfo.scaleValue > this.imageScaleInfo.maxScaleValue *
(1 + this.imageScaleInfo.extraScaleValue)
) {
this.imageScaleInfo.scaleValue = this.imageScaleInfo.maxScaleValue *
(1 + this.imageScaleInfo.extraScaleValue);
}
if (this.imageScaleInfo.scaleValue < this.imageScaleInfo.defaultScaleValue *
(1 - this.imageScaleInfo.extraScaleValue)) {
this.imageScaleInfo.scaleValue = this.imageScaleInfo.defaultScaleValue *
(1 - this.imageScaleInfo.extraScaleValue);
}
// TODO:知识点:matrix默认缩放中心为组件中心
this.matrix = matrix4.identity().scale({
x: this.imageScaleInfo.scaleValue,
y: this.imageScaleInfo.scaleValue,
}).copy();
console.debug(this.imageScaleInfo.toString());
})
.onActionEnd((event: GestureEvent) => {
/**
* TODO:知识点:当小于默认大小时,恢复为默认大小
*/
if (this.imageScaleInfo.scaleValue < this.imageScaleInfo.defaultScaleValue) {
runWithAnimation(() => {
this.imageScaleInfo.reset();
this.imageOffsetInfo.reset();
this.matrix = matrix4.identity().copy();
})
}
// TODO:知识点:当大于最大缩放因子时,恢复到最大
if (this.imageScaleInfo.scaleValue > this.imageScaleInfo.maxScaleValue) {
runWithAnimation(() => {
this.imageScaleInfo.scaleValue = this.imageScaleInfo.maxScaleValue;
this.matrix = matrix4.identity()
.scale({
x: this.imageScaleInfo.maxScaleValue,
y: this.imageScaleInfo.maxScaleValue
});
})
}
this.imageScaleInfo.stash();
}),
// // TODO:知识点:滑动图片
// PanGesture({ fingers: 1 })// TODO:需求:默认大小下左右滑动应当是切换图片
// .onActionUpdate((event: GestureEvent) => {
// if (this.imageScaleInfo.scaleValue === this.imageScaleInfo.defaultScaleValue) {
// // 默认大小下不允许移动
// return;
// }
// this.imageOffsetInfo.currentX = this.imageOffsetInfo.lastX + event.offsetX;
// this.imageOffsetInfo.currentY = this.imageOffsetInfo.lastY + event.offsetY;
// })
// .onActionEnd((event: GestureEvent) => {
// this.imageOffsetInfo.stash();
// })
),
)
}
}
\ No newline at end of file
... ... @@ -72,13 +72,26 @@ export struct LiveHorizontalCardComponent {
// }
if (this.compDTO.linkUrl) {
let taskAction: Action = {
type: 'JUMP_H5_BY_WEB_VIEW',
type: 'JUMP_INNER_NEW_PAGE',
params: {
url: this.compDTO.linkUrl
url: this.compDTO.linkUrl,
pageID: 'SPACIAL_TOPIC_PAGE',
contentID: this.compDTO.objectId,
extra: {
relId: this.compDTO.relId,
relType: this.compDTO.relType,
pageId: this.compDTO.pageId
}
} as Params,
};
this.compDTO.operDataList = []
console.log('LiveHorizontalCardComponent', JSON.stringify(this.compDTO))
console.log('LiveHorizontalCardComponent', this.compDTO.relId)
console.log('LiveHorizontalCardComponent', this.compDTO.relType)
console.log('LiveHorizontalCardComponent', JSON.stringify(taskAction))
WDRouterRule.jumpWithAction(taskAction)
} else {
// console.log('LiveHorizontalCardComponent', 'jumpToLiveMorePage')
this.jumpToLiveMorePage()
}
} else {
... ... @@ -90,6 +103,7 @@ export struct LiveHorizontalCardComponent {
linkUrl: this.compDTO.linkUrl,
pageId: this.compDTO.pageId
} as ContentDTO
// console.log('LiveHorizontalCardComponent', 'ProcessUtils.processPage')
ProcessUtils.processPage(contentDTO)
}
}
... ...
... ... @@ -59,7 +59,7 @@ export struct LiveOperRowListView {
@State needLike: boolean = true
@State styleType: number = -1
@State bgColor: ResourceColor = Color.White
@State interactData: InteractDataDTO = {} as InteractDataDTO
@State interactData: InteractDataDTO = new InteractDataDTO
@State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
@State dialogController: CustomDialogController | null = null;
... ...
... ... @@ -6,7 +6,8 @@ import {
ContentDetailDTO,
contentListParams,
InteractDataDTO,
postExecuteCollectRecordParams
postExecuteCollectRecordParams,
TopicInfo
} from 'wdBean';
import router from '@ohos.router';
import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel';
... ... @@ -94,6 +95,7 @@ export struct OperRowListView {
@Consume pageId: string
@State likesStyle: number | string = 1 // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空
@State openLikes: boolean = false // 是否可以点赞 1:可以 0:不可以
@Prop topicInfo?: TopicInfo = {} as TopicInfo
async aboutToAppear() {
console.info(TAG, 'this.needLike', this.needLike)
... ... @@ -416,7 +418,33 @@ export struct OperRowListView {
}
share() {
WDShare.shareContent(this.contentDetailData)
if (this.topicInfo && Object.keys(this.topicInfo).length > 0) {
console.info(TAG, 'contentDetailData this.topicInfo', JSON.stringify(this.topicInfo))
let contentDetailData: ContentDetailDTO = {
newsId: this.topicInfo?.topicId && Number.parseInt(this.topicInfo.topicId),
shareInfo:{
appCustomContentId: this.topicInfo?.topicId,
appCustomContentType: this.topicInfo?.topicType + '',
shareTitle: this.topicInfo?.shareTitle,
shareSummary: this.topicInfo?.shareSummary,
appCustomImageUrl: this.topicInfo?.shareCoverUrl,
sharePosterCoverUrl: this.topicInfo?.sharePosterCoverUrl,
shareUrl: this.topicInfo?.shareUrl,
appCustomTargetRelId: this.topicInfo?.relId,
appCustomTargetRelType: this.topicInfo?.relType,
appCustomShowReport: false,
appCustomShowLike: -1,
shareOpen: 1,
sharePosterOpen: this.topicInfo?.posterFlag,
appCustomShowPoster: this.topicInfo?.posterFlag && this.topicInfo?.posterFlag > 0 ? 1 : -1,
}
} as ContentDetailDTO
WDShare.setTopicBeanToShareBean(contentDetailData.shareInfo , this.topicInfo)
WDShare.shareContent(contentDetailData,TrackConstants.PageName.Eletronic_Paper,TrackConstants.PageName.Eletronic_Paper)
} else {
console.info(TAG, 'this.contentDetailData')
WDShare.shareContent(this.contentDetailData)
}
}
// 已登录->查询用户对作品收藏状态
... ...
import { PhotoListBean } from 'wdBean/Index';
import { display, router } from '@kit.ArkUI';
import { ImageItemView } from '../components/view/ImageItemView';
import { ImageDownloadComponent } from '../components/ImageDownloadComponent';
import { MultiPictureDetailItemComponent } from '../components/MultiPictureDetailItemComponent';
import { Action } from 'wdBean';
import { WindowModel } from 'wdKit/Index';
... ... @@ -68,11 +69,10 @@ export struct MultiPictureListPage {
})
.id("backImg")
if (this.photoList && this.photoList?.length > 0) {
Swiper(this.swiperController) {
ForEach(this.photoList, (item: PhotoListBean) => {
ImageItemView({ MultiPictureDetailItem: item, isEnableSwipe: this.isEnableSwipe })
MultiPictureDetailItemComponent({ MultiPictureDetailItem: item, isEnableSwipe: this.isEnableSwipe })
})
}
.index(this.swiperIndex)
... ... @@ -135,7 +135,6 @@ export struct MultiPictureListPage {
middle: { anchor: "__container__", align: HorizontalAlign.Center }
})
}
ImageDownloadComponent({ url: this.currentUrl })
.alignRules({
bottom: { anchor: "__container__", align: VerticalAlign.Bottom },
... ... @@ -152,6 +151,7 @@ export struct MultiPictureListPage {
.width('100%')
.height('100%')
.id('e_picture_container')
.backgroundColor(Color.Black)
}
aboutToDisappear(): void {
... ...
import { HttpUrlUtils, HttpUtils, ResponseDTO, WDHttp } from 'wdNetwork';
import { DateTimeUtils, Logger, StringUtils, EmitterUtils, EmitterEventId } from 'wdKit';
import { DateTimeUtils, EmitterEventId, EmitterUtils, Logger, SPHelper, StringUtils } from 'wdKit';
import {
batchLikeAndCollectResult,
... ... @@ -7,8 +7,11 @@ import {
ContentDetailDTO,
ContentDTO,
contentListParams,
FeedbackTypeBean,
GoldenPositionExtraBean,
InteractDataDTO,
LiveReviewDTO,
LiveRoomDataBean,
MorningEveningPaperDTO,
NavigationBodyDTO,
NavigationDetailDTO,
... ... @@ -22,13 +25,10 @@ import {
postExecuteCollectRecordParams,
postExecuteLikeParams,
postInteractAccentionOperateParams,
postRecommendListParams,
GoldenPositionExtraBean,
FeedbackTypeBean,
LiveRoomDataBean
postRecommendListParams
} from 'wdBean';
import { PageUIReqBean } from '../components/page/bean/PageUIReqBean';
import { ArrayList } from '@kit.ArkTS';
import { SpConstants } from 'wdConstant/Index';
const TAG = 'HttpRequest';
... ... @@ -243,6 +243,14 @@ export class PageRepository {
url = url + "&districtCode=" + HttpUtils.getDistrictCode()
+ "&provinceCode=" + provinceCode
+ "&cityCode=" + HttpUtils.getCityCode()
let per=SPHelper.default.getSync(SpConstants.LOCATION_FIRST_POSITION,true)
if(per){
//检测首次获取地理信息
url = url+'&firstLocation=1'
SPHelper.default.save(SpConstants.LOCATION_FIRST_POSITION,false)
}
}
if (myChannelIds) {
url = url + `&channelIds=${myChannelIds}`
... ...
... ... @@ -5,11 +5,25 @@
*/
export class SearchResultCountItem{
/*
"allTotal":0,
"activityTotal":0,
"cmsTotal":0,
"trueTotal":0,
"pageSize":1,
"keyword":"wuhuhuan",
"totalCount":0,
"pageNum":1,
"videoTotal":0,
"rmhTotal":5
*/
keyword:string ='' //搜索关键字
allTotal: number = 0 //所有tab总量
cmsTotal: number = 0 //精选总量
rmhTotal: number = 0 //人民号总量
videoTotal: number = 0 //视频总量
activityTotal: number = 0 //活动数据总量
}
\ No newline at end of file
... ...
... ... @@ -7,7 +7,6 @@
"main": "Index.ets",
"version": "1.0.0",
"dependencies": {
"@ohos/lottie": "2.0.10",
"wdComponent": "file:../../features/wdComponent",
"wdPlayer": "file:../../features/wdPlayer",
"wdNetwork": "file:../../commons/wdNetwork",
... ...
... ... @@ -221,9 +221,15 @@ export struct PlayUIComponent {
.padding({
top: 1,
right: 4,
bottom: 1
bottom: 1,
})
// .margin({left: this.contentDetailData?.rmhInfo ? 0 : 34})
.margin(
{
left: this.contentDetailData?.rmhInfo
? 0
: this.displayDirection === DisplayDirection.VIDEO_HORIZONTAL ? 34 : 0
}
)
}
//回看
else if (this.contentDetailData.liveInfo?.liveState == 'end') {
... ...
... ... @@ -85,6 +85,7 @@ export struct PlayerTitleComponent {
Row() {
this.getLiveStatusView()
}
.margin({left: this.contentDetailData.rmhInfo?.rmhName ? 0 : 34})
}
.width('100%')
... ... @@ -144,7 +145,6 @@ export struct PlayerTitleComponent {
.fontWeight(400)
.fontColor(Color.White)
}
}
.backgroundColor('#4D000000')
.borderRadius(2)
... ... @@ -154,7 +154,6 @@ export struct PlayerTitleComponent {
top: 0,
bottom: 0
} : 4)
.margin({left: this.contentDetailData.rmhInfo?.rmhName ? 0 : 34})
}
}
}
... ...
... ... @@ -7,7 +7,6 @@
"main": "Index.ets",
"version": "1.0.0",
"dependencies": {
"@ohos/lottie": "2.0.0",
"wdPlayer": "file:../../features/wdPlayer",
"wdKit": "file:../../commons/wdKit",
"wdBean": "file:../../features/wdBean",
... ...
... ... @@ -204,7 +204,7 @@ export struct DetailVideoListPage {
build() {
if (this.netStatus !== undefined) {
EmptyComponent({
emptyType: 1, emptyButton: true, retry: () => {
emptyType: 1, emptyButton: true, isBlack: true, retry: () => {
this.getContentDetail(this.contentId, this.relId, this.relType)
}
})
... ...
... ... @@ -86,7 +86,7 @@ export struct PlayerFullScreenView {
.margin({ left: 10 })
}
Image($r(`app.media.ic_share`)).height(24).width(24)
Image($r(`app.media.ic_share_empty`)).height(24).width(24)
.onClick(() => {
this.share()
})
... ...
... ... @@ -36,6 +36,7 @@ struct GuidePages {
ChildItem(index: number) {
RelativeContainer() {
Image(this.guideImage[index])
.objectFit(ImageFit.Contain)
.alignRules({
top: { anchor: "__container__", align: VerticalAlign.Top },
bottom: { anchor: "__container__", align: VerticalAlign.Bottom }
... ...
... ... @@ -124,6 +124,14 @@ struct LoginPage {
onPageHide(): void {
///关闭禁止截图
this.isPrivacyMode = false
this.disableScreenCapture()
this.loginPageBrowse()
}
loginPageBrowse(){
this.pageHideTime = DateTimeUtils.getTimeStamp()
let duration = 0
duration = Math.floor((this.pageHideTime - this.pageShowTime)/1000)
... ... @@ -261,10 +269,6 @@ struct LoginPage {
right: { anchor: "__container__", align: HorizontalAlign.End }
})
.onClick(() => {
///关闭禁止截图
this.isPrivacyMode = false
this.disableScreenCapture()
router.back()
})
.id('id_close')
... ... @@ -375,7 +379,7 @@ struct LoginPage {
.lineHeight(`${this.calcHeight(38)}lpx`)
}
.onClick(() => {
this.onPageHide()
this.loginPageBrowse()
if(this.checkCodePage){
trackTypeClick(0,TrackConstants.PageName.Phone_Login_Page)
... ...
... ... @@ -221,11 +221,12 @@ struct ModifyPasswordPage {
.width('100%')
Column() {
Text("忘记密码").fontSize(12).maxLines(3).fontColor(0x999999).padding({top:`${this.calcHeight(10)}lpx`})
Text("忘记密码").fontSize(14).maxLines(3).fontColor(0x999999).padding({top:`${this.calcHeight(10)}lpx`})
.onClick(()=>{
WDRouterRule.jumpWithPage(WDRouterPage.forgetPasswordPage)
})
}
.margin({top:15})
.width('100%')
.height(`${this.calcHeight(85)}lpx`)
.alignItems(HorizontalAlign.Center)
... ...
... ... @@ -45,10 +45,10 @@ export class WDShare {
}
//专题分享数据转换
static setTopicBeanToShareBean(shareBean: ShareInfoDTO, topicInfoBean: TopicInfo){
shareBean.appCustomTopicType = topicInfoBean.topicType+''
static setTopicBeanToShareBean(shareBean: ShareInfoDTO, topicInfoBean?: TopicInfo){
shareBean.appCustomTopicType = topicInfoBean?.topicType+''
//21:文章专题,22:音频专题,23:直播专题,24:话题专题,25:早晚报专题,26:时间链
if(25 == topicInfoBean.topicType){
if(25 == topicInfoBean?.topicType){
shareBean.appCustomShowPosterType = 6
shareBean.appCustomTopicPattern = topicInfoBean.topicPattern
shareBean.appCustomPublishTime = topicInfoBean.topicDate
... ... @@ -76,11 +76,11 @@ export class WDShare {
//文章/直播/话题专题(H5普通文章专题,包含时间链)
shareBean.appCustomShowPosterType = 8
//海报的头图
shareBean.sharePosterCoverUrl = topicInfoBean.backgroundImgUrl
shareBean.sharePosterCoverUrl = topicInfoBean?.backgroundImgUrl || ''
shareBean.appCustomIsFrontDaily = false
shareBean.appCustomPosterTitle = topicInfoBean.title
shareBean.appCustomPosterSummary = topicInfoBean.summary
if(topicInfoBean.shareContentList != null && topicInfoBean.shareContentList.length>0){
shareBean.appCustomPosterTitle = topicInfoBean?.title || ''
shareBean.appCustomPosterSummary = topicInfoBean?.summary || ''
if(topicInfoBean?.shareContentList != null && topicInfoBean?.shareContentList && topicInfoBean.shareContentList.length > 0){
shareBean.appCustomSharePosterItemList = [] as SharePosterItemBean[]
shareBean.appCustomSharePosterItemList.length = topicInfoBean.shareContentList.length
for (let index = 0; index < topicInfoBean.shareContentList.length; index++) {
... ...
... ... @@ -10,7 +10,8 @@
"main": "",
"version": "1.0.0",
"dependencies": {
"@ohos/pulltorefresh": "^2.0.5",
"@ohos/pulltorefresh": "^2.0.6-rc.0",
"@ohos/lottie": "v2.0.11-rc.6",
"@mpaas/udid": "0.0.2",
"@mpaas/upgrade": "0.0.2",
"@mpaas/framework": "0.0.2",
... ...
... ... @@ -7,7 +7,6 @@
"main": "",
"version": "1.0.0",
"dependencies": {
"@ohos/lottie": "v2.0.11-rc.6",
"wdComponent": "file:../../features/wdComponent",
"wdConstant": "file:../../commons/wdConstant",
"wdKit": "file:../../commons/wdKit",
... ...
... ... @@ -91,11 +91,11 @@ struct LaunchAdvertisingPage {
Text('广告')
.fontColor(Color.White)
.textAlign(TextAlign.Center)
.fontSize('24lpx')
.width('72lpx')
.height('36lpx')
.fontSize(12)
.width(36)
.height(18)
.borderRadius(2)
.margin({top:'15lpx',left:'19lpx'})
.margin({top:'8px',left:'10px'})
.backgroundColor('#80000000')
.margin({left:16})
}
... ... @@ -104,13 +104,13 @@ struct LaunchAdvertisingPage {
Button(){
Text(this.time + 's 跳过')
.fontSize('27lpx')
.fontSize(14)
.fontColor(Color.White)
.margin({left:'28lpx',right:'28lpx'})
.margin({left:14,right:14})
}
.width('148lpx')
.height('56lpx')
.margin({top:'10lpx',right:'19lpx'})
.width(74)
.height(28)
.margin({top:5,right:10})
.backgroundColor('#80000000')
.onClick(() => {
this.trackingLaunchJumpOver()
... ... @@ -125,21 +125,21 @@ struct LaunchAdvertisingPage {
Button(){
Row(){
Text(this.defaultModel.isAd == '1'?'点击跳转至详情或第三方应用':'点击跳转至详情')
.fontSize('31lpx')
.fontSize(16)
.fontColor(Color.White)
.margin({
left:'55lpx'
left:28
})
Image($r('app.media.Slice'))
.width('46lpx')
.height('46lpx')
.margin({right:'55lpx'})
.width(28)
.height(23)
.margin({right:28})
}.alignItems(VerticalAlign.Center)
}
.width('566lpx')
.height('111lpx')
.width(284)
.height(56)
.margin({
bottom: '51lpx'
bottom: 26
})
.borderWidth(1)
.borderColor(Color.White)
... ... @@ -151,8 +151,8 @@ struct LaunchAdvertisingPage {
if(this.defaultModel.screenType == '1') {
Column(){
Image($r('app.media.LaunchPage_logo'))
.width('278lpx')
.height('154lpx')
.width(140)
.height(77)
.margin({top:20})
}.width('100%').height('16%').backgroundColor(Color.White)
// .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
... ...
... ... @@ -40,11 +40,11 @@ struct LaunchInterestsHobbiesPage {
Row(){
Blank()
Text('跳过')
.fontSize('27lpx')
.fontSize(14)
.fontColor('#333333')
.width('54lpx')
.height('35lpx')
.margin({top:'30lpx',right:'46lpx'})
.width(30)
.height(18)
.margin({top:15,right:23})
.onClick(()=>{
//直接跳过到首页
//跳转首页
... ... @@ -58,20 +58,20 @@ struct LaunchInterestsHobbiesPage {
.justifyContent(FlexAlign.End)
Text('选择感兴趣的内容')
.fontSize('46lpx')
.fontSize(23)
.fontWeight(FontWeight.Bold)
.textAlign(TextAlign.Center)
.fontColor('#333333')
.width('100%')
.height('61lpx')
.margin({top:'54lpx'})
.height(30)
.margin({top:27})
Text('完善信息,将为您推荐个性化的内容')
.fontSize('27lpx')
.fontSize(14)
.textAlign(TextAlign.Center)
.fontColor('#9E9E9E')
.width('100%')
.height('35lpx')
.margin({top:'12lpx'})
.height(17)
.margin({top:6})
if(!this.isConnectNetwork){
EmptyComponent({ emptyType: 1,emptyHeight:"60%" ,retry: () => {
... ... @@ -141,39 +141,36 @@ struct LaunchInterestsHobbiesPage {
})
}
.width('90%')
.margin({top:'61lpx',bottom:'300lpx'})
.margin({top:30,bottom:150})
.columnsTemplate('1fr 1fr 1fr')
.columnsGap('23lpx')
.rowsGap('23lpx')
.scrollBar(BarState.Off)
}
}
.width('100%')
.height('100%')
}
.width('100%')
.height(`calc(100% - ${158 + 'lpx'})`)
// .backgroundColor(Color.Red)
.height(`calc(100% - ${260 + 'px'})`)
Stack({alignContent:Alignment.Center}){
Button(this.selectCount == 0?'选好了':'选好了(' + this.selectCount + ')')
.fontSize('35lpx')
.fontSize(18)
.fontColor('#FFFFFF')
.backgroundColor('#ED2800')
.type(ButtonType.Normal)
.borderRadius('10lpx')
.width('662lpx')
.height('84lpx')
.margin({top:'10lpx'})
.borderRadius(5)
.width(320)
.height(44)
.margin({top:5})
Image('')
.width('662lpx')
.height('84lpx')
.margin({top:'10lpx'})
.width(320)
.height(44)
.margin({top:5})
.backgroundColor(Color.White)
.opacity(this.selectCount == 0 ? 0.6 : 0)
.borderRadius('10lpx')
.borderRadius(5)
.onClick(()=>{
if (this.selectCount == 0) {
this.dialogToast.open()
... ... @@ -188,8 +185,8 @@ struct LaunchInterestsHobbiesPage {
})
}
.width('100%')
.height('108lpx')
.margin({top:0})
.height(54)
.margin({top:5})
// .backgroundColor(Color.Orange)
}
.width('100%')
... ...
... ... @@ -166,10 +166,10 @@ struct LaunchPage {
Stack({alignContent:Alignment.Bottom}){
Image($r('app.media.LaunchPage_logo'))
.width('278lpx')
.height('154lpx')
.width(139)
.height(87)
.margin({
bottom:'48lpx'
bottom:24
})
}
... ...
... ... @@ -525,7 +525,7 @@ export struct MultiPictureDetailPageComponent {
@Builder
noNet() {
EmptyComponent({
emptyType: 1, emptyButton: true, retry: () => {
emptyType: 1, emptyButton: true, isBlack: true, retry: () => {
this.getContentDetailData()
}
})
... ... @@ -534,6 +534,7 @@ export struct MultiPictureDetailPageComponent {
center: { anchor: "__container__", align: VerticalAlign.Center },
middle: { anchor: "__container__", align: HorizontalAlign.Center }
})
.backgroundColor(Color.Black)
}
@Builder
... ...