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
chenjun1_wd
2024-08-22 00:34:26 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
9061c0c08e28bc65a19773bec7840f4e7451d4fd
9061c0c0
1 parent
60f5c48d
标题更换,换一换如果全部试过后置灰
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
23 deletions
sight_harmony/features/wdComponent/src/main/ets/components/compview/ZhSingleColumn09.ets
sight_harmony/features/wdComponent/src/main/ets/components/compview/ZhSingleColumn09.ets
View file @
9061c0c
import { CompDTO, ContentDTO, Params } from 'wdBean';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { HttpUrlUtils } from 'wdNetwork/Index';
import { postInteractAccentionOperateParams } from 'wdBean';
import { PageRepository } from '../../repository/PageRepository';
import { CommonConstants } from 'wdConstant/Index';
import { CompDTO, ContentDTO } from 'wdBean';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { Tracking, TrackingContent, TrackConstants, ParamType } from 'wdTracking';
import { TrackingUtils } from 'wdTracking/src/main/ets/common/TrackingUtils'
import { ParamType, Tracking } from 'wdTracking';
import { TrackingUtils } from 'wdTracking/src/main/ets/common/TrackingUtils';
import { ToastUtils } from 'wdKit';
import PageModel from '../../viewmodel/PageModel';
...
...
@@ -28,10 +23,12 @@ export struct ZhSingleColumn09 {
@StorageLink('selfClosed') selfClosed: boolean = false
@State loadImg: boolean = false;
@State compIndex: number = 0;
@State currentOperDataListIndex: number = 0; //记录换一换点击次数
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
this.operDataList = this.shuffleArray(this.compDTO?.operDataList)
this.currentOperDataListIndex = this.compDTO?.operDataList.length
}
trackClick(type: 'close_interest_card_click' | 'interest_card_selecting_click') {
...
...
@@ -80,7 +77,7 @@ export struct ZhSingleColumn09 {
}
shuffleArray(array: ContentDTO[]) {
for(let i = array.length - 1; i > 0; i--) {
for
(let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
const tempArray = array[i];
array[i] = array[j];
...
...
@@ -94,17 +91,17 @@ export struct ZhSingleColumn09 {
//顶部
Row() {
Column() {
Text('以下是否有您感兴趣?')
Text('以下是否有您感兴趣
的分类
?')
.fontSize(18)
.fontColor(0x000000)
.fontWeight(600)
.width('70%')
.padding({
bottom: 4
})
.padding({
bottom: 4
})
Text('选中标签,为您推荐更多您感兴趣的内容')
.fontSize(12)
.fontColor(0xB0B0B0)
.padding({
bottom: 10
})
.padding({
bottom: 10
})
.width('70%')
}
...
...
@@ -113,11 +110,15 @@ export struct ZhSingleColumn09 {
.fontSize(14)
.width(62)
.height(26)
.backgroundColor(this.activeIndexs.length > 0 ? 0xfdf0ed : 0xf5f5f5)
// .lineHeight(26)
.backgroundColor(this.activeIndexs.length > 0 ? 0xfdf0ed : 0xf5f5f5)// .lineHeight(26)
.borderRadius(4)
.margin({top: -10})
.padding({top: 0, bottom: 0, left: 0, right: 0})
.margin({ top: -10 })
.padding({
top: 0,
bottom: 0,
left: 0,
right: 0
})
.onClick(() => {
this.trackClick('interest_card_selecting_click')
if (this.activeIndexs.length > 0) {
...
...
@@ -133,18 +134,20 @@ export struct ZhSingleColumn09 {
Grid() {
ForEach(this.operDataList, (item: ContentDTO, index: number) => {
GridItem() {
Stack({
alignContent: Alignment.TopEnd
}) {
Stack({
alignContent: Alignment.TopEnd
}) {
Image(this.loadImg ? item.coverUrl : '')
.backgroundColor(0xf5f5f5)
.width('100%')
.height('100%')
.borderRadius(3)
Row(){}
Row() {
}
.width('100%')
.height('100%')
.backgroundColor('rgba(0, 0, 0, 1)')
.opacity(0.4)
.borderRadius(3)
Text(item.newsTitle)
.width('100%')
.height('100%')
...
...
@@ -160,7 +163,7 @@ export struct ZhSingleColumn09 {
.width('100%')
.height('100%')
}
.margin({
right: index % 4 === 3 ? 0 : 6, bottom: 6
})
.margin({
right: index % 4 === 3 ? 0 : 6, bottom: 6
})
.onClick(() => {
if (this.activeIndexs.includes(index)) {
const ind = this.activeIndexs.indexOf(index);
...
...
@@ -174,26 +177,30 @@ export struct ZhSingleColumn09 {
.height(90)
.columnsTemplate('1fr 1fr 1fr 1fr')
.rowsTemplate('1fr 1fr')
.margin({
bottom: 5
})
.margin({
bottom: 5
})
Row() {
Row() {
Text('换一换')
.fontSize(14)
.fontColor(this.compDTO?.operDataList.length > 8 ? 0xed2800 : 0xB0B0B0)
.margin({right: 4})
.fontColor(this.compDTO?.operDataList.length > 8 && this.currentOperDataListIndex > 0 ? 0xed2800 : 0xB0B0B0)
.margin({ right: 4 })
Image(this.compDTO?.operDataList.length > 8 ? $r('app.media.icon_refresh') : $r('app.media.ic_refresh'))
.width(14)
.height(14)
}
.onClick(() => {
if (this.currentOperDataListIndex > 0) {
this.currentOperDataListIndex--
}
if (this.compDTO?.operDataList.length > 8) {
if (this.pageModel){
if (this.pageModel)
{
this.pageModel.compList.deleteItem(this.compIndex)
}
this.activeIndexs = [];
}
})
Row() {
Image($r("app.media.close_button_new"))
.width(9)
...
...
Please
register
or
login
to post a comment