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-18 17:02:14 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c258e8b4ed681739d1dee8f17cc3f14d737c47e5
c258e8b4
1 parent
51a45a78
fix:17067 功能缺陷-【生产环境】直播列表,点击记录,返回,标题已读,未置灰,看图
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
84 additions
and
17 deletions
sight_harmony/features/wdComponent/src/main/ets/components/page/LiveMorePage.ets
sight_harmony/features/wdComponent/src/main/resources/base/element/color.json
sight_harmony/features/wdComponent/src/main/ets/components/page/LiveMorePage.ets
View file @
c258e8b
...
...
@@ -8,11 +8,16 @@ import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh';
import { PeopleShipNoMoreData } from '../reusable/PeopleShipNoMoreData';
import { EmptyComponent } from '../view/EmptyComponent';
import { ErrorComponent } from '../view/ErrorComponent';
import LoadMoreLayout from '../page/LoadMoreLayout'
import { LottieView } from '../../components/lottie/LottieView'
import LoadMoreLayout from '../page/LoadMoreLayout';
import { LottieView } from '../../components/lottie/LottieView';
import dataPreferences from '@ohos.data.preferences';
import { BusinessError } from '@ohos.base';
const TAG: string = 'LiveMorePage';
const PREFERENCES_NAME = 'rmrLiveMorePage.db'
let preferenceTheme: dataPreferences.Preferences | null = null
/**
* 直播更多:
* type=1 直播
...
...
@@ -37,7 +42,13 @@ struct LiveMorePage {
@State viewType: ViewType = ViewType.LOADING
private scroller: Scroller = new Scroller()
@State liveRoomList: LiveRoomDataBean[] = []
aboutToAppear(): void {
// 点击过的数据
@State clickDatas: Array<string> = []
async aboutToAppear() {
await this.getPreferencesFromStorage()
this.getLivMoreClickPreference()
Logger.debug(TAG, '数据:' + JSON.stringify(this.clickDatas))
this.currentPage = 1
this.getData()
}
...
...
@@ -93,10 +104,9 @@ struct LiveMorePage {
LoadingLayout() {
}
@Builder
ListLayout() {
List({
scroller: this.scroller
}) {
List({
scroller: this.scroller
}) {
// 下拉刷新
LazyForEach(this.data, (contentDTO: ContentDTO) => {
ListItem() {
...
...
@@ -120,7 +130,7 @@ struct LiveMorePage {
.height('calc(100% - 44vp)')
.onReachEnd(() => {
Logger.debug(TAG, "触底了");
if
(!this.isLoading && this.hasMore)
{
if
(!this.isLoading && this.hasMore)
{
//加载分页数据
this.currentPage++;
this.getData()
...
...
@@ -137,11 +147,12 @@ struct LiveMorePage {
buildItem(item: ContentDTO) {
Column() {
Text(item.newsTitle)
.fontSize(1
7
)
.fontSize(1
8
)
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.margin({ top: 16, bottom: 8 })
.alignSelf(ItemAlign.Start)
.fontColor(this.isClicked(item.objectId) ? $r('app.color.color_848484') : $r('app.color.color_222222'))
Stack() {
if (item.fullColumnImgUrls && item.fullColumnImgUrls.length > 0) {
Image(item.fullColumnImgUrls[0].url)
...
...
@@ -191,6 +202,7 @@ struct LiveMorePage {
}
.width('100%')
.onClick(() => {
this.clickRowBuildItem(item)
ProcessUtils.processPage(item)
})
}
...
...
@@ -292,14 +304,14 @@ struct LiveMorePage {
}
this.data.push(...liveReviewDTO.list)
this.getLiveRoomDataInfo(liveReviewDTO.list)
} else
{
} else {
this.hasMore = false;
}
this.resolveEnd(true, resolve)
if (liveReviewDTO.list.length == 0 && this.currentPage == 1) {
this.viewType = ViewType.EMPTY
}
}catch (exception) {
}
catch (exception) {
this.resolveEnd(false, resolve)
}
// PageViewModel.getLiveMoreUrl(this.type, this.currentPage, this.pageSize).then(async (liveReviewDTO) => {
...
...
@@ -315,7 +327,7 @@ struct LiveMorePage {
if (resolve) {
if (this.currentPage == 1 && isTop) {
resolve('已更新至最新')
}
else
{
}
else
{
resolve('')
}
}
...
...
@@ -334,23 +346,24 @@ struct LiveMorePage {
});
return idList.join(',')
}
// 获取评论数
async getLiveRoomDataInfo(list: ContentDTO[]) {
const reserveIds = this.getLiveDetailIds(list)
Logger.debug(TAG,
'是否预约数据:' +
` ${reserveIds}`)
Logger.debug(TAG,
'是否预约数据:' +
` ${reserveIds}`)
PageViewModel.getLiveRoomBatchInfo(reserveIds).then((result) => {
Logger.debug(TAG,
'是否预约数据:' +
` ${JSON.stringify(result)}`)
Logger.debug(TAG,
'是否预约数据:' +
` ${JSON.stringify(result)}`)
if (result && result.length > 0) {
this.liveRoomList.push(...result)
this.data.reloadData()
}
}).catch(() =>{
}).catch(() =>
{
// this.data.push(...list)
})
}
// 判断是否预约
getLiveRoomNumber(item: ContentDTO): string
{
getLiveRoomNumber(item: ContentDTO): string {
const objc = this.liveRoomList.find((element: LiveRoomDataBean) => {
return element.liveId.toString() == item.objectId
})
...
...
@@ -362,14 +375,64 @@ struct LiveMorePage {
private computeShowNum(count: number): string {
if (count >= 10000) {
let num = ( count / 10000).toFixed(1)
if (Number(num.substring(num.length-1)) == 0) {
num = num.substring(0, num.length-2)
let num = (count / 10000).toFixed(1)
if (Number(num.substring(num.length - 1)) == 0) {
num = num.substring(0, num.length - 2)
}
return num + '万人参加'
}
return `${count}人参加`
}
isClicked(objectId: string) {
return this.clickDatas.includes(objectId)
}
clickRowBuildItem(item: ContentDTO) {
if (item.objectId && !this.clickDatas.includes(item.objectId)) {
Logger.debug(TAG, '数据:' + JSON.stringify(this.clickDatas))
this.clickDatas.push(item.objectId.toString())
this.putLiveMoreClickPreference()
}
}
async getPreferencesFromStorage() {
let context = getContext(this) as Context
preferenceTheme = await dataPreferences.getPreferences(context, PREFERENCES_NAME)
}
putLiveMoreClickPreference() {
Logger.info(TAG, `Put begin` + JSON.stringify(this.clickDatas))
if (preferenceTheme !== null && this.clickDatas.length > 0) {
// await
const arr: Array<string> = []
arr.push(...this.clickDatas)
preferenceTheme.put('liveMorePage', arr).then(() => {
Logger.debug(TAG,"Succeeded in putting value of 'startup'.");
}).catch((err: BusinessError) => {
Logger.debug(TAG, "Failed to put value of 'startup'. code =" + err.code + ", message =" + err.message);
})
// await preferenceTheme.flush()
preferenceTheme.flush((err: BusinessError) => {
if (err) {
Logger.debug(TAG, "Failed to flush. code =" + err.code + ", message =" + err.message);
return;
}
})
}
}
getLivMoreClickPreference() {
Logger.info(TAG, `Get begin`)
if (preferenceTheme !== null) {
preferenceTheme.get('liveMorePage', []).then((data: dataPreferences.ValueType) => {
if (data instanceof Array) {
this.clickDatas = data as Array<string>
}
}).catch((err: BusinessError) => {
console.error("Failed to get value of 'startup'. code =" + err.code + ", message =" + err.message);
})
}
}
}
\ No newline at end of file
...
...
sight_harmony/features/wdComponent/src/main/resources/base/element/color.json
View file @
c258e8b
...
...
@@ -173,6 +173,10 @@
{
"name"
:
"color_white_30"
,
"value"
:
"#4D000000"
},
{
"name"
:
"color_848484"
,
"value"
:
"#848484"
}
]
}
\ No newline at end of file
...
...
Please
register
or
login
to post a comment