yangchenggong1_wd

fix:bug[16815] 人民号-推荐--搜索下鸿蒙缺少松开查看功能

@@ -11,7 +11,6 @@ import { @@ -11,7 +11,6 @@ import {
11 import { LiveInfoDTO } from 'wdBean/src/main/ets/bean/detail/LiveInfoDTO' 11 import { LiveInfoDTO } from 'wdBean/src/main/ets/bean/detail/LiveInfoDTO'
12 import { VoiceInfoDTO } from 'wdBean/src/main/ets/bean/detail/VoiceInfoDTO' 12 import { VoiceInfoDTO } from 'wdBean/src/main/ets/bean/detail/VoiceInfoDTO'
13 import { LazyDataSource, StringUtils, UserDataLocal } from 'wdKit/Index' 13 import { LazyDataSource, StringUtils, UserDataLocal } from 'wdKit/Index'
14 -import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'  
15 import MinePageDatasModel from '../../model/MinePageDatasModel' 14 import MinePageDatasModel from '../../model/MinePageDatasModel'
16 import SearcherAboutDataModel from '../../model/SearcherAboutDataModel' 15 import SearcherAboutDataModel from '../../model/SearcherAboutDataModel'
17 import { CreatorDetailRequestItem } from '../../viewmodel/CreatorDetailRequestItem' 16 import { CreatorDetailRequestItem } from '../../viewmodel/CreatorDetailRequestItem'
@@ -30,6 +29,7 @@ import { SearchCreatorComponent } from './SearchCreatorComponent' @@ -30,6 +29,7 @@ import { SearchCreatorComponent } from './SearchCreatorComponent'
30 import { JSON } from '@kit.ArkTS' 29 import { JSON } from '@kit.ArkTS'
31 import { MoreComponent } from '../cardview/MoreComponent' 30 import { MoreComponent } from '../cardview/MoreComponent'
32 import { Card9Component } from '../cardview/Card9Component' 31 import { Card9Component } from '../cardview/Card9Component'
  32 +import { WDRouterRule, WDRouterPage } from 'wdRouter/Index'
33 33
34 const TAG = "SearchResultContentComponent" 34 const TAG = "SearchResultContentComponent"
35 35
@@ -46,6 +46,12 @@ export struct SearchResultContentComponent { @@ -46,6 +46,12 @@ export struct SearchResultContentComponent {
46 curPageNum: number = 1; 46 curPageNum: number = 1;
47 @State bean: FollowListDetailItem = new FollowListDetailItem("", "", "", "", "", "", "", "", "", -1, -1, "") 47 @State bean: FollowListDetailItem = new FollowListDetailItem("", "", "", "", "", "", "", "", "", -1, -1, "")
48 scroller: Scroller = new Scroller() 48 scroller: Scroller = new Scroller()
  49 + private scroller2: Scroller = new Scroller()
  50 + @State ellipseW: number = 0
  51 + @State moreWidth:number = 20
  52 + @State listLeft: number = 0
  53 + @State isEnd: boolean = false
  54 +
49 55
50 aboutToAppear(): void { 56 aboutToAppear(): void {
51 if (this.searchType == "全部") { 57 if (this.searchType == "全部") {
@@ -243,7 +249,7 @@ export struct SearchResultContentComponent { @@ -243,7 +249,7 @@ export struct SearchResultContentComponent {
243 if (this.count == 0) { 249 if (this.count == 0) {
244 ListHasNoMoreDataUI({ style: 2 }) 250 ListHasNoMoreDataUI({ style: 2 })
245 } else { 251 } else {
246 - List() { 252 + List({scroller:this.scroller2}) {
247 if (this.data_rmh != null && this.data_rmh.length > 0){ 253 if (this.data_rmh != null && this.data_rmh.length > 0){
248 if (this.data_rmh.length === 1){ 254 if (this.data_rmh.length === 1){
249 ListItem(){ 255 ListItem(){
@@ -306,44 +312,70 @@ export struct SearchResultContentComponent { @@ -306,44 +312,70 @@ export struct SearchResultContentComponent {
306 312
307 @Builder 313 @Builder
308 SearchListUI() { 314 SearchListUI() {
309 - List({space:'8lpx'}) {  
310 - ForEach(this.data_rmh, (item: SearchRmhDescription, index: number) => {  
311 - ListItem() {  
312 - SearchCreatorComponent({item:item})  
313 - }  
314 - .width('150lpx')  
315 - .height('100%')  
316 - }) 315 + List({initialIndex: 0,space:'8lpx',scroller: this.scroller}) {
  316 + ListItemGroup(){
  317 + ForEach(this.data_rmh, (item: SearchRmhDescription, index: number) => {
  318 + ListItem() {
  319 + SearchCreatorComponent({item:item})
  320 + }
  321 + .width('150lpx')
  322 + .height('100%')
  323 + })
  324 + }.offset({ left: this.listLeft })
317 325
318 ListItem(){ 326 ListItem(){
319 - Column(){  
320 - Text("查看更多")  
321 - .width('19lpx')  
322 - .fontSize('19lpx')  
323 - .fontWeight('400lpx')  
324 - .lineHeight('27lpx')  
325 - .fontColor($r('app.color.color_9E9E9E'))  
326 - }.borderRadius({topLeft:'4lpx',bottomLeft:'4lpx'})  
327 - .height('180lpx')  
328 - .width('77lpx')  
329 - .backgroundColor($r('app.color.color_EDEDED'))  
330 - .justifyContent(FlexAlign.Center)  
331 - 327 + this.itemEnd()
332 }.height('100%') 328 }.height('100%')
333 .margin({left:'23lpx'}) 329 .margin({left:'23lpx'})
334 - .onClick(()=>{  
335 - let params: Params = {  
336 - pageID: this.keywords  
337 - }  
338 - WDRouterRule.jumpWithPage(WDRouterPage.searchCreatorPage,params)  
339 - })  
340 } 330 }
341 - .cachedCount(6)  
342 .edgeEffect(EdgeEffect.None) 331 .edgeEffect(EdgeEffect.None)
343 .scrollBar(BarState.Off) 332 .scrollBar(BarState.Off)
344 .listDirection(Axis.Horizontal) 333 .listDirection(Axis.Horizontal)
345 .width('100%') 334 .width('100%')
346 .height('219lpx') 335 .height('219lpx')
  336 + .onReachEnd(() => {
  337 + this.isEnd = true
  338 + console.log(TAG,'is end')
  339 + })
  340 + .onScrollFrameBegin((offset: number, state: ScrollState) => {
  341 + console.log(TAG,'offset', offset)
  342 + if (!this.scroller.isAtEnd()) {
  343 + this.isEnd = false
  344 + }
  345 + if (this.ellipseW > 0) {
  346 + return { offsetRemain: 0 }
  347 + }
  348 + return { offsetRemain: offset }
  349 + })
  350 + .parallelGesture(
  351 + PanGesture({ direction: PanDirection.Horizontal, distance: 1 })
  352 + .onActionStart((event: GestureEvent) => {
  353 + console.info(TAG,'Pan start')
  354 + })
  355 + .onActionUpdate((event: GestureEvent) => {
  356 + if (event && this.isEnd) {
  357 + // console.log('event.offsetX',event.offsetX)
  358 + this.listLeft = event.offsetX < -60 ? -60 : event.offsetX > 0 ? 0 : event.offsetX
  359 + this.ellipseW = (-this.listLeft) / 1.5
  360 +
  361 + console.log(TAG,"this.ellipseW==>" + this.ellipseW)
  362 + }
  363 + })
  364 + .onActionEnd((event: GestureEvent) => {
  365 + console.info(TAG,'Pan end')
  366 + this.listLeft = 0
  367 + // this.moreWidth = 20
  368 +
  369 + if (event.offsetX < 0 && this.ellipseW >=20) {
  370 + console.log(TAG,'跳转')
  371 + let params: Params = {
  372 + pageID: this.keywords
  373 + }
  374 + WDRouterRule.jumpWithPage(WDRouterPage.searchCreatorPage,params)
  375 + }
  376 + this.ellipseW = 0
  377 + })
  378 + )
347 379
348 Divider() 380 Divider()
349 .width('100%') 381 .width('100%')
@@ -352,6 +384,32 @@ export struct SearchResultContentComponent { @@ -352,6 +384,32 @@ export struct SearchResultContentComponent {
352 .strokeWidth('12lpx') 384 .strokeWidth('12lpx')
353 } 385 }
354 386
  387 +
  388 + @Builder
  389 + itemEnd() {
  390 + Row() {
  391 + Ellipse()
  392 + .width(2* this.ellipseW)
  393 + .height('100%')
  394 + .fill('rgb(240,235,238)')
  395 + .position({ left: -this.ellipseW, top: 0 })
  396 +
  397 + Column(){
  398 + Text(this.ellipseW === 0 ? '' : this.ellipseW < 20? '查看更多' : '松手查看')
  399 + .width('19lpx')
  400 + .fontSize('19lpx')
  401 + .fontWeight('400lpx')
  402 + .lineHeight('27lpx')
  403 + .fontColor("#9E9E9E")
  404 + }
  405 + .height('100%')
  406 + .width(this.moreWidth)
  407 + .backgroundColor("#EDEDED")
  408 + .justifyContent(FlexAlign.Center)
  409 + }
  410 + .height('100%')
  411 + }
  412 +
355 private dataTransform(rem:CreatorDetailResponseItem[],value: SearchResultContentItem, photos: FullColumnImgUrlDTO[]): ContentDTO { 413 private dataTransform(rem:CreatorDetailResponseItem[],value: SearchResultContentItem, photos: FullColumnImgUrlDTO[]): ContentDTO {
356 let rmhInfo = this.getRmhInfo(rem,value) 414 let rmhInfo = this.getRmhInfo(rem,value)
357 console.log('获取photos',JSON.stringify(photos)) 415 console.log('获取photos',JSON.stringify(photos))