王士厅

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

# Conflicts:
#	sight_harmony/features/wdComponent/src/main/ets/components/calendar/RMCalendar.ets
... ... @@ -60,10 +60,11 @@ export struct ENewspaperPageComponent {
//watch监听报纸页码回调
onCurrentPageNumUpdated(): void {
console.log("ENewspaperPageComponent-onCurrentPageNumUpdated", "currentPageNum:", this.currentPageNum)
let _swiperIndex = Number.parseInt(this.currentPageNum)
console.log("ENewspaperPageComponent-onCurrentPageNumUpdated", "_swiperIndex:", _swiperIndex)
this.swiperIndex = _swiperIndex > 0 ? _swiperIndex - 1 : _swiperIndex
// let _swiperIndex = Number.parseInt(this.currentPageNum)
// console.log("ENewspaperPageComponent-onCurrentPageNumUpdated", "_swiperIndex:", _swiperIndex)
// this.swiperIndex = _swiperIndex > 0 ? _swiperIndex - 1 : _swiperIndex
this.swiperIndex = this.newspaperListBean?.list.findIndex(_item => _item?.pageNum === this.currentPageNum)
//电子报--版面序号选择点击
TrackingContent.clickWithEvent('panel_number_selection_click', TrackConstants.PageName.NewsPaperPage,
TrackConstants.PageName.NewsPaperPage
... ... @@ -140,7 +141,8 @@ export struct ENewspaperPageComponent {
let screenHeight = this.displayTool.height;
// bottomSafeHeight 底导高度 topSafeHeight 顶导高度 44 顶部高度 60 底部高度
// newspaper_shadow 49 高度 e_newspaper_content 59 margin top
let height = screenHeight - this.bottomSafeHeight - this.topSafeHeight - vp2px(44) - vp2px(60) - vp2px(49) -vp2px(59)
let height =
screenHeight - this.bottomSafeHeight - this.topSafeHeight - vp2px(44) - vp2px(60) - vp2px(49) - vp2px(59)
this.picHeight = height
let ratio = this.ratio == '100%' ? 1 : 0.5
... ... @@ -178,6 +180,7 @@ export struct ENewspaperPageComponent {
this.swiperController.changeIndex(this.swiperIndex)
});
}
resize() {
this.screenWidth = this.windowClass?.getWindowProperties()?.windowRect.width || this.displayTool.width
// 2000折叠屏 TODO DeviceUtil 方法完善了换判断条件
... ... @@ -264,7 +267,7 @@ export struct ENewspaperPageComponent {
.width(px2vp(this.picWidth))
.height(px2vp(this.picHeight))
.margin({ top: 59, left: 10, right: 10 })
// .padding({ right: 10, left: 10 })
// .padding({ right: 10, left: 10 })
}
if (this.newspaperListBean && this.newspaperListBean.list && this.newspaperListBean.list.length > 0) {
... ... @@ -424,7 +427,7 @@ export struct ENewspaperPageComponent {
.width('100%')
.height('100%')
.backgroundColor($r('app.color.color_80000000'))
// .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
// .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
.id('e_newspaper_container')
if (this.isOpenListDialog) {
... ... @@ -457,7 +460,7 @@ export struct ENewspaperPageComponent {
try {
if (NetworkUtil.isNetConnected()) {
let listBean =
await NewspaperViewModel.getNewspaperList(this.calendarDate, this.itemPicWidth + 'x' + this.itemPicHeight)
await NewspaperViewModel.getNewspaperList(this.calendarDate, this.itemPicWidth + 'x' + this.itemPicHeight)
this.newspaperListBean = listBean;
} else {
this.showToastTip('网络出小差了,请检查网络后重试')
... ...
... ... @@ -16,7 +16,7 @@ import { topicInfoView } from './topicInfoView';
import { DateFormatUtil, PlayerConstants, WDPlayerController } from 'wdPlayer';
import { AudioDataList } from 'wdBean/src/main/ets/bean/morningevening/AudioDataList';
import { image } from '@kit.ImageKit';
import { getPicture, imageNet2PixelMap } from '../../utils/ImageUtils';
import { findMaxPixel, getPicture, imageNet2PixelMap, traverseAllPixel } from '../../utils/ImageUtils';
import { effectKit } from '@kit.ArkGraphics2D';
import { window } from '@kit.ArkUI';
import { PeopleShipMainViewModel } from '../../viewmodel/PeopleShipMainViewModel';
... ... @@ -25,7 +25,7 @@ import { viewColumInsightIntentShare } from '../../utils/InsightIntentShare'
import { common } from '@kit.AbilityKit';
import TrackingPageBrowseUtils from '../../utils/TrackingPageBrowseUtils'
import {TrackConstants,TrackParamConvert}from 'wdTracking/Index'
import { ColorUtils } from '../../utils/ColorUtils';
import { ColorHsv, ColorRgb, ColorUtils } from '../../utils/ColorUtils';
import { EmptyComponent,WDViewDefaultType } from '../view/EmptyComponent';
import { EmitterEventId, EmitterUtils } from 'wdKit/Index'
... ... @@ -238,14 +238,20 @@ export struct MorningEveningPaperComponent {
private async pickColor(imageSource: image.ImageSource | undefined) {
if (imageSource) {
const pixelMap: image.PixelMap = await imageNet2PixelMap(imageSource);
effectKit.createColorPicker(pixelMap, (err, colorPicker) => {
let color = colorPicker.getMainColorSync();
console.log(TAG, "compInfoBean compStyle = " + color)
// color = ColorUtils.getMorningEveningPaperRgb({red:color.red,green:color.green,blue:color.blue,alpha:color.alpha})
// 将取色器选取的color示例转换为十六进制颜色代码
this.mixedBgColor = "#" + color.alpha.toString(16) + color.red.toString(16) + color.green.toString(16) + color.blue.toString(16);
console.log(TAG, "compInfoBean compStyle = " + this.mixedBgColor)
});
let allPixels: number[] = await traverseAllPixel(pixelMap);
let maxPixel: number = findMaxPixel(allPixels);
let rgb: ColorRgb = ColorUtils.numberToRgb(maxPixel);
let hsv: ColorHsv = ColorUtils.rgb2hsv(rgb);
rgb = ColorUtils.hsv2rgb(hsv);
this.mixedBgColor = "#" + rgb.red.toString(16) + rgb.green.toString(16) + rgb.blue.toString(16);
// effectKit.createColorPicker(pixelMap, (err, colorPicker) => {
// let color = colorPicker.getMainColorSync();
// console.log(TAG, "compInfoBean compStyle = " + color)
// // color = ColorUtils.getMorningEveningPaperRgb({red:color.red,green:color.green,blue:color.blue,alpha:color.alpha})
// // 将取色器选取的color示例转换为十六进制颜色代码
// this.mixedBgColor = "#" + color.alpha.toString(16) + color.red.toString(16) + color.green.toString(16) + color.blue.toString(16);
// console.log(TAG, "compInfoBean compStyle = " + this.mixedBgColor)
// });
}
}
... ...
... ... @@ -4,7 +4,9 @@ import { WDRouterRule } from 'wdRouter/Index'
import { ENewspaperPageDialog } from '../dialog/ENewspaperPageDialog'
import { Logger } from 'wdKit';
import { font, window } from '@kit.ArkUI';
const TAG: string = 'ENewspaperListDialog';
/**
* 读报纸半屏弹窗
* 弹窗嵌套参考资料(https://developer.harmonyos.com/cn/docs/documentation/doc-references-V2/ts-methods-custom-dialog-box-0000001580345722-V2)
... ... @@ -18,9 +20,7 @@ export struct ENewspaperListDialog {
private listScroller: Scroller = new Scroller()
@State scrollOffset: number = 0
@State isCurrentViewOpen: boolean = false
@Consume bottomSafeHeight:number
firstFlag : boolean = true
@Consume bottomSafeHeight: number
//文字版选择弹框
pageListDialogController: CustomDialogController = new CustomDialogController({
builder: ENewspaperPageDialog({
... ... @@ -42,26 +42,34 @@ export struct ENewspaperListDialog {
// 那么此处需要将指向自己的controller放在所有controller的后面
// listDialogController: CustomDialogController
public closeDialog?: () => void
// 手势滑动相关
private panOption: PanGestureOptions = new PanGestureOptions({ direction: PanDirection.Up | PanDirection.Down })
private topFixedHeight = 124
@State topHeight: number = 124
private deviceHeight: number = 0
selectPageNum : boolean = true
//watch监听报纸页码回调
onCurrentPageNumUpdated(): void {
this.firstFlag = false
console.log(TAG, "onCurrentPageNumUpdated currentPageNum:", this.currentPageNum)
let _scrollIndex = Number.parseInt(this.currentPageNum)
console.log(TAG, "onCurrentPageNumUpdated _scrollIndex:", _scrollIndex)
let scrollIndexEnd = _scrollIndex > 0 ? _scrollIndex - 1 : _scrollIndex
// console.log(TAG, "onCurrentPageNumUpdated currentPageNum:", this.currentPageNum)
// let _scrollIndex = Number.parseInt(this.currentPageNum)
// console.log(TAG, "onCurrentPageNumUpdated _scrollIndex:", _scrollIndex)
// let scrollIndexEnd = _scrollIndex > 0 ? _scrollIndex - 1 : _scrollIndex
if (this.newspaperListBean != undefined) {
this.selectPageNum = false
// 从业务数据中找到编号
let scrollIndexEnd = this.newspaperListBean?.list.findIndex(_item => _item?.pageNum === this.currentPageNum)
console.log(TAG, "onCurrentPageNumUpdated scrollIndexEnd:", scrollIndexEnd)
console.log(TAG, "onCurrentPageNumUpdated scrollIndexEnd:", scrollIndexEnd)
console.log(TAG, "onCurrentPageNumUpdated (!this.isCurrentViewOpen):", ""+!this.isCurrentViewOpen)
if (!this.isCurrentViewOpen) {
this.listScroller.scrollToIndex(scrollIndexEnd)
console.log(TAG, "onCurrentPageNumUpdated (!this.isCurrentViewOpen):", "" + !this.isCurrentViewOpen)
if (!this.isCurrentViewOpen) {
this.listScroller.scrollToIndex(scrollIndexEnd)
}
}
}
... ... @@ -73,16 +81,18 @@ export struct ENewspaperListDialog {
})
// 屏幕高度 - 滑动高度计算
let windowClass: window.Window = await window.getLastWindow(getContext(this));
let changeHeight = 85 + 44 + px2vp(windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).topRect.height)
let changeHeight = 85 + 44 + px2vp(windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).topRect.height)
changeHeight += px2vp(windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).bottomRect.height)
this.deviceHeight = px2vp(windowClass.getWindowProperties().windowRect.height) - changeHeight
this.isCurrentViewOpen = true
console.log(TAG, "aboutToAppear currentPageNum:", this.currentPageNum)
let _scrollIndex = Number.parseInt(this.currentPageNum)
console.log(TAG, "aboutToAppear _scrollIndex:", _scrollIndex)
this.scrollIndex = _scrollIndex > 0 ? _scrollIndex - 1 : _scrollIndex
// let _scrollIndex = Number.parseInt(this.currentPageNum)
// console.log(TAG, "aboutToAppear _scrollIndex:", _scrollIndex)
// this.scrollIndex = _scrollIndex > 0 ? _scrollIndex - 1 : _scrollIndex
// this.listScroller.scrollToIndex(this.scrollIndex)
this.scrollIndex = this.newspaperListBean?.list.findIndex(_item => _item?.pageNum === this.currentPageNum)
}
aboutToDisappear() {
... ... @@ -147,13 +157,13 @@ export struct ENewspaperListDialog {
.gesture(
PanGesture(this.panOption)
.onActionStart((event: GestureEvent) => {
Logger.debug('ENewspaperListDialog','Pan start')
Logger.debug('ENewspaperListDialog', 'Pan start')
})
.onActionUpdate((event: GestureEvent) => {
if (this.topFixedHeight + event.offsetY >= this.topFixedHeight) {
this.topHeight = this.topFixedHeight + event.offsetY
}
Logger.debug('ENewspaperListDialog', 'topHeight:' + this.topHeight)
Logger.debug('ENewspaperListDialog', 'topHeight:' + this.topHeight)
})
.onActionEnd(() => {
this.onCloseGestureDialog()
... ... @@ -186,8 +196,7 @@ export struct ENewspaperListDialog {
Text(positionItem.shortTitle)
.fontSize($r('app.float.font_size_13'))
.fontColor($r('app.color.color_222222'))
.fontWeight(600)
// .maxLines(2)
.fontWeight(600)// .maxLines(2)
.margin({
bottom: 8
})
... ... @@ -201,7 +210,7 @@ export struct ENewspaperListDialog {
.margin({
bottom: 8
})
// .maxLines(2)
// .maxLines(2)
}
if (positionItem.downTitle) {
... ... @@ -212,7 +221,7 @@ export struct ENewspaperListDialog {
.margin({
bottom: 8
})
// .maxLines(2)
// .maxLines(2)
}
if (positionItem.newsTxt) {
Text(positionItem.newsTxt)
... ... @@ -280,7 +289,7 @@ export struct ENewspaperListDialog {
left: 15,
right: 15,
// top: 16,
// bottom: 16
// bottom: 16
})
.margin({
bottom: 85
... ... @@ -291,30 +300,29 @@ export struct ENewspaperListDialog {
console.info('ENewspaperListDialog::first' + firstIndex)
console.info('ENewspaperListDialog::last' + lastIndex)
console.info('ENewspaperListDialog::center' + centerIndex)
// this.updateCurrentPageNum(firstIndex)
// const tempIndex = this.findClassIndex(firstIndex)
// if (firstIndex !== centerIndex) {
// return
// }
// console.info(`this.scrollOffset:` + this.scrollOffset)
// if (this.scrollOffset == 0) {
if(this.firstFlag){
this.currentPageNum = `${firstIndex < 9 ? '0' + (firstIndex + 1) : firstIndex + 1}`
// this.currentPageNum = `${firstIndex < 9 ? '0' + (firstIndex + 1) : firstIndex + 1}`
if(this.selectPageNum){
if (this.newspaperListBean != undefined) {
this.currentPageNum = this.newspaperListBean?.list[lastIndex].pageNum
}
}else {
this.firstFlag = true
this.selectPageNum = true
}
// }
})
}
.margin({ top: this.topHeight })
.width('100%')
.backgroundColor(Color.White)
}.width('100%')
}
.width('100%')
.height('100%')
.backgroundColor('#80000000')
.margin({bottom:50})
.margin({ bottom: 50 })
.onClick(() => {
if (this.closeDialog) {
this.closeDialog()
... ... @@ -323,24 +331,24 @@ export struct ENewspaperListDialog {
.gesture(
PanGesture(this.panOption)
.onActionStart((event: GestureEvent) => {
Logger.debug('ENewspaperListDialog','Pan start')
Logger.debug('ENewspaperListDialog', 'Pan start')
})
.onActionUpdate((event: GestureEvent) => {
if (event) {
if (this.topFixedHeight + event.offsetY >= this.topFixedHeight) {
if (this.topFixedHeight + event.offsetY >= this.topFixedHeight) {
this.topHeight = this.topFixedHeight + event.offsetY
}
Logger.debug('ENewspaperListDialog', 'topHeight:' + this.topHeight)
Logger.debug('ENewspaperListDialog', 'topHeight:' + this.topHeight)
}
})
.onActionEnd(() => {
this.onCloseGestureDialog()
this.onCloseGestureDialog()
})
)
}
onCloseGestureDialog() {
if (this.topHeight >= this.deviceHeight ) {
if (this.topHeight >= this.deviceHeight) {
if (this.closeDialog) {
this.closeDialog()
}
... ...
... ... @@ -383,10 +383,11 @@ export struct PlayUIComponent {
step: 1,
style: SliderStyle.OutSet
})
.blockSize({
width: 18,
height: 12
})// .blockStyle({
// .blockSize({
// width: 18,
// height: 12
// })
// .blockStyle({
// type: SliderBlockType.IMAGE,
// image: $r('app.media.ic_player_block')
// })
... ... @@ -394,8 +395,14 @@ export struct PlayUIComponent {
.trackColor('#4DFFFFFF')
.selectedColor('#FFED2800')
.height(14)
.trackThickness(1)
.trackThickness(2)
.blockStyle({
type: SliderBlockType.IMAGE,
image: $r('app.media.ic_player_block')
})
.blockSize({ width: 18, height: 12 })
.layoutWeight(1)
.height(14)
.margin({
left: 8,
right: 8
... ...
... ... @@ -123,10 +123,10 @@ export struct PlayerVideoControlComponent {
step: 1,
style: SliderStyle.OutSet
})
.blockSize({
width: 18,
height: 12
})
// .blockSize({
// width: 18,
// height: 12
// })
.trackColor('#4DFFFFFF')
.selectedColor('#FFED2800')
.trackThickness(2)
... ...