Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
yanlu
2024-05-08 09:46:22 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
3fd59f36f3f723dc8899b6d63b661da7d859df66
3fd59f36
1 parent
98c03a1d
fix:早晚报的背景图
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
12 deletions
sight_harmony/features/wdComponent/src/main/ets/components/MorningEveningPaper/MorningEveningPaperComponent.ets
sight_harmony/features/wdComponent/src/main/ets/utils/ImageUtils.ets
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/details/video/TopPlayComponet.ets
sight_harmony/features/wdComponent/src/main/ets/components/MorningEveningPaper/MorningEveningPaperComponent.ets
View file @
3fd59f3
...
...
@@ -13,12 +13,9 @@ import { image } from '@kit.ImageKit';
import { getPicture, imageNet2PixelMap } from '../../utils/ImageUtils';
import { effectKit } from '@kit.ArkGraphics2D';
import { window } from '@kit.ArkUI';
import DailyPaperTopicModel from '../../model/DailyPaperTopicModel'
const TAG = 'MorningEveningPaperComponent';
const PATTERN_DATE_CN_RN: string = 'yyyy年\nMM月dd日'; // 日期中包含包含中文年月日
@Entry
@Component
export struct MorningEveningPaperComponent {
...
...
@@ -106,17 +103,12 @@ export struct MorningEveningPaperComponent {
WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff', })
this.topSafeHeight = px2vp(windowHight.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).topRect.height)
le
t dailyPaperTopicPageId = await SPHelper.default.getSync('dailyPaperTopicPageId', "") as String
cons
t dailyPaperTopicPageId = await SPHelper.default.getSync('dailyPaperTopicPageId', "") as String
console.info(TAG, `aboutToAppear = ` + dailyPaperTopicPageId)
const currentTime = new Date().getTime()
Logger.info(TAG, "currentTime = " + currentTime)
Logger.info(TAG, `currentTime = ${currentTime}`)
try {
let dailyPaperTopicBean = await DailyPaperTopicModel.getDailyPaperTopic()
if (dailyPaperTopicBean) {
dailyPaperTopicPageId = '' + dailyPaperTopicBean.id
Logger.info(TAG, "pageID = " + dailyPaperTopicPageId)
}
// let pageInfoBean = await MorningEveningViewModel.getMorningEveningPageInfo("" + this.dailyPaperTopicPageId)
let pageInfoBean = await MorningEveningViewModel.getMorningEveningPageInfo("" + dailyPaperTopicPageId) //"25091"
...
...
@@ -157,7 +149,10 @@ export struct MorningEveningPaperComponent {
async setComponentBgColor(imageUrl: string) {
// 图片转换为PixelMap对象
// const pixelMap: image.PixelMap = await image2PixelMap(item.icon);
const imageSource: image.ImageSource | undefined = await getPicture(imageUrl);
Logger.debug(TAG, "compInfoBean compStyle = " + imageUrl)
const imageSource: image.ImageSource | undefined = await getPicture(imageUrl)
if (imageSource) {
this.pickColor(imageSource)
...
...
@@ -172,6 +167,8 @@ export struct MorningEveningPaperComponent {
const pixelMap: image.PixelMap = await imageNet2PixelMap(imageSource);
effectKit.createColorPicker(pixelMap, (err, colorPicker) => {
let color = colorPicker.getMainColorSync();
Logger.debug(TAG, "compInfoBean compStyle = " + color)
// 将取色器选取的color示例转换为十六进制颜色代码
this.mixedBgColor = "#" + color.alpha.toString(16) + color.red.toString(16) + color.green.toString(16) + color.blue.toString(16);
Logger.debug(TAG, "compInfoBean compStyle = " + this.mixedBgColor)
...
...
@@ -212,7 +209,7 @@ export struct MorningEveningPaperComponent {
})
}
}
// .backgroundColor('#
FFF1F3F5
')
// .backgroundColor('#
fff7b348
')
// .backgroundColor(Color.Blue)
.height('100%')
...
...
sight_harmony/features/wdComponent/src/main/ets/utils/ImageUtils.ets
View file @
3fd59f3
...
...
@@ -90,7 +90,7 @@ export async function image2PixelMap(icon: string): Promise<image.PixelMap> {
// 假设http和image是之前正确导入或定义的模块
export async function getPicture(imageUrl: string): Promise<image.ImageSource | undefined> {
// const url: string = 'https://rmrbcmsonline.peopleapp.com/upload/image/202312/rmrb_86691703594454.png';
const url: string =
'https://rmrbcmsonline.peopleapp.com/upload/image/201912/rmrb_24141576767688.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg'
;
const url: string =
imageUrl
;
return new Promise((resolve, reject) => {
http.createHttp().request(url, (error: BusinessError, data: http.HttpResponse) => {
...
...
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/details/video/TopPlayComponet.ets
View file @
3fd59f3
...
...
@@ -2,6 +2,7 @@ import { LiveDetailsBean } from 'wdBean/Index';
import { StringUtils } from 'wdKit/Index';
import { WDPlayerController, WDPlayerRenderLiveView } from 'wdPlayer/Index';
import { PlayUIComponent } from './PlayUIComponent';
import { Logger } from 'wdKit/Index';
@Component
export struct TopPlayComponent {
...
...
@@ -39,6 +40,7 @@ export struct TopPlayComponent {
}
// this.playerController?.firstPlay('https://rmrbcmsonline.peopleapp.com/upload/rmh/video/mp4/202404/1713752415708fb81d0b8f137b.mp4');
if (StringUtils.isNotEmpty(playUrl)) {
Logger.debug('TopPlayComponent', `${playUrl}`)
this.playerController?.firstPlay(playUrl);
}
}
...
...
Please
register
or
login
to post a comment