点击tabbar
This commit is contained in:
parent
ca5ab146b7
commit
efcb4be65a
@ -2,6 +2,7 @@ import { BasicConstant } from '../constants/BasicConstant'
|
|||||||
|
|
||||||
export class HdListController {
|
export class HdListController {
|
||||||
loaded: () => void = () => {
|
loaded: () => void = () => {
|
||||||
|
|
||||||
}
|
}
|
||||||
finished: () => void = () => {
|
finished: () => void = () => {
|
||||||
}
|
}
|
||||||
@ -96,6 +97,7 @@ export struct HdList {
|
|||||||
}
|
}
|
||||||
this.loading = true
|
this.loading = true
|
||||||
this.onLoad()
|
this.onLoad()
|
||||||
|
|
||||||
})
|
})
|
||||||
.scrollBar(BarState.Off)
|
.scrollBar(BarState.Off)
|
||||||
.nestedScroll({
|
.nestedScroll({
|
||||||
|
|||||||
BIN
commons/basic/src/main/resources/base/media/default_video.png
Normal file
BIN
commons/basic/src/main/resources/base/media/default_video.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.6 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.3 KiB |
@ -43,7 +43,7 @@ export struct ItemComp {
|
|||||||
{
|
{
|
||||||
Stack()
|
Stack()
|
||||||
{
|
{
|
||||||
Image(BasicConstant.urlHtml+this.item.liveimg).width('100%').height(162)
|
Image(BasicConstant.urlHtml+this.item.liveimg).width('100%').height(162).alt($r('app.media.home_scroll_default1'))
|
||||||
.objectFit(ImageFit.Fill)
|
.objectFit(ImageFit.Fill)
|
||||||
if(this.status!=''&&(this.status!='已结束'&&this.status!='回访中'))
|
if(this.status!=''&&(this.status!='已结束'&&this.status!='回访中'))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -41,7 +41,7 @@ export struct ItemCompBack {
|
|||||||
{
|
{
|
||||||
Stack()
|
Stack()
|
||||||
{
|
{
|
||||||
Image(BasicConstant.urlHtml+this.item.liveimg).width('100%').height(162)
|
Image(BasicConstant.urlHtml+this.item.liveimg).width('100%').height(162).alt($r('app.media.home_scroll_default1'))
|
||||||
.objectFit(ImageFit.Fill)
|
.objectFit(ImageFit.Fill)
|
||||||
Image($r('app.media.bofang')).width(40).height(40)
|
Image($r('app.media.bofang')).width(40).height(40)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,7 +18,7 @@ export struct ItemCompVideo {
|
|||||||
build() {
|
build() {
|
||||||
Column() {
|
Column() {
|
||||||
|
|
||||||
Image(BasicConstant.urlHtml+this.item.imgpath).width('100%').height(102)
|
Image(BasicConstant.urlHtml+this.item.imgpath).alt($r('app.media.default_video')).width('100%').height(102)
|
||||||
.objectFit(ImageFit.Fill)
|
.objectFit(ImageFit.Fill)
|
||||||
|
|
||||||
Text(this.item.name).maxLines(2).fontSize(15).fontColor('app.color.666666').textAlign(TextAlign.Start).height(36)
|
Text(this.item.name).maxLines(2).fontSize(15).fontColor('app.color.666666').textAlign(TextAlign.Start).height(36)
|
||||||
|
|||||||
@ -13,6 +13,9 @@ export struct ListComp {
|
|||||||
@State
|
@State
|
||||||
list: ItemModel[] = []
|
list: ItemModel[] = []
|
||||||
controller = new HdListController()
|
controller = new HdListController()
|
||||||
|
scroller: Scroller = new Scroller()
|
||||||
|
@Consume@Watch('gotoTop')
|
||||||
|
toTop:boolean;
|
||||||
@State
|
@State
|
||||||
page: number = 1
|
page: number = 1
|
||||||
@State
|
@State
|
||||||
@ -128,6 +131,7 @@ export struct ListComp {
|
|||||||
HdList({
|
HdList({
|
||||||
lw: 1,
|
lw: 1,
|
||||||
controller: this.controller,
|
controller: this.controller,
|
||||||
|
scroller:this.scroller,
|
||||||
onRefresh: () => {
|
onRefresh: () => {
|
||||||
this.onRefresh()
|
this.onRefresh()
|
||||||
},
|
},
|
||||||
@ -145,5 +149,10 @@ export struct ListComp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
gotoTop()
|
||||||
|
{
|
||||||
|
this.scroller.scrollToIndex(0);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -11,12 +11,16 @@ import HashMap from '@ohos.util.HashMap';
|
|||||||
export struct ListCompGandan {
|
export struct ListCompGandan {
|
||||||
@State isEmptyViewVisible: boolean = false; // 控制显隐的状态变量
|
@State isEmptyViewVisible: boolean = false; // 控制显隐的状态变量
|
||||||
@Prop@Watch('onUpdate') sort:string='2'
|
@Prop@Watch('onUpdate') sort:string='2'
|
||||||
|
|
||||||
|
@Consume@Watch('gotoTop')
|
||||||
|
toTop:boolean;
|
||||||
@Prop@Watch('onUpdate')
|
@Prop@Watch('onUpdate')
|
||||||
type_uuid:string=''
|
type_uuid:string=''
|
||||||
@Prop@Watch('onUpdate') keywords:string=''
|
@Prop@Watch('onUpdate') keywords:string=''
|
||||||
@State
|
@State
|
||||||
list: VideoMore[] = []
|
list: VideoMore[] = []
|
||||||
controller = new HdListController()
|
controller = new HdListController()
|
||||||
|
scroller: Scroller = new Scroller()
|
||||||
@State
|
@State
|
||||||
page: number = 1
|
page: number = 1
|
||||||
|
|
||||||
@ -92,6 +96,7 @@ export struct ListCompGandan {
|
|||||||
}
|
}
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
|
|
||||||
if (this.isEmptyViewVisible){
|
if (this.isEmptyViewVisible){
|
||||||
EmptyViewComp({promptText:'暂无数据',isVisibility:this.isEmptyViewVisible})
|
EmptyViewComp({promptText:'暂无数据',isVisibility:this.isEmptyViewVisible})
|
||||||
.width('100%')
|
.width('100%')
|
||||||
@ -100,6 +105,7 @@ export struct ListCompGandan {
|
|||||||
HdGrid({
|
HdGrid({
|
||||||
lw: 1,
|
lw: 1,
|
||||||
controller: this.controller,
|
controller: this.controller,
|
||||||
|
scroller:this.scroller,
|
||||||
onRefresh: () => {
|
onRefresh: () => {
|
||||||
this.onRefresh()
|
this.onRefresh()
|
||||||
},
|
},
|
||||||
@ -115,4 +121,9 @@ export struct ListCompGandan {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
gotoTop()
|
||||||
|
{
|
||||||
|
this.scroller.scrollToIndex(0);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -75,7 +75,7 @@ export struct FourSection {
|
|||||||
abilityName: 'com.huawei.hmos.settings.MainAbility',
|
abilityName: 'com.huawei.hmos.settings.MainAbility',
|
||||||
uri: 'application_info_entry',
|
uri: 'application_info_entry',
|
||||||
parameters: {
|
parameters: {
|
||||||
pushParams: 'com.example.expert'
|
pushParams: 'cn.shangyu.gdxzExprt'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const context = getContext(this) as common.UIAbilityContext;
|
const context = getContext(this) as common.UIAbilityContext;
|
||||||
|
|||||||
@ -36,7 +36,8 @@ export struct HeaderView {
|
|||||||
@State myPageData:object = new Object;
|
@State myPageData:object = new Object;
|
||||||
@State heroArray:Array<object> = [];
|
@State heroArray:Array<object> = [];
|
||||||
@State clickHeroId:string = '';
|
@State clickHeroId:string = '';
|
||||||
|
@Consume@Watch('gotoTop')
|
||||||
|
toTop:boolean;
|
||||||
private scrollerForList: Scroller = new Scroller()
|
private scrollerForList: Scroller = new Scroller()
|
||||||
|
|
||||||
dialogController: CustomDialogController = new CustomDialogController({
|
dialogController: CustomDialogController = new CustomDialogController({
|
||||||
@ -162,4 +163,10 @@ export struct HeaderView {
|
|||||||
.backgroundImage(this.myPageData["myInfoBackGround"]).backgroundImageSize(ImageSize.Cover)
|
.backgroundImage(this.myPageData["myInfoBackGround"]).backgroundImageSize(ImageSize.Cover)
|
||||||
}
|
}
|
||||||
// }
|
// }
|
||||||
|
gotoTop()
|
||||||
|
{
|
||||||
|
this.photoPath = BasicConstant.urlImage+authStore.getUser().photo;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,7 +14,8 @@ export struct TabBarComp {
|
|||||||
@State
|
@State
|
||||||
isLandscape: boolean = false
|
isLandscape: boolean = false
|
||||||
listenerScreen = mediaquery.matchMediaSync('(orientation: landscape) and (device-type: tablet)')
|
listenerScreen = mediaquery.matchMediaSync('(orientation: landscape) and (device-type: tablet)')
|
||||||
|
@Provide
|
||||||
|
toTop:boolean=false;
|
||||||
aboutToAppear() {
|
aboutToAppear() {
|
||||||
this.listenerScreen.on('change', (mediaQueryResult) => {
|
this.listenerScreen.on('change', (mediaQueryResult) => {
|
||||||
this.isLandscape = mediaQueryResult.matches
|
this.isLandscape = mediaQueryResult.matches
|
||||||
@ -53,6 +54,7 @@ export struct TabBarComp {
|
|||||||
.barPosition(this.isLandscape ? BarPosition.Start : BarPosition.End)
|
.barPosition(this.isLandscape ? BarPosition.Start : BarPosition.End)
|
||||||
.onTabBarClick((index) => {
|
.onTabBarClick((index) => {
|
||||||
this.activeIndex = index
|
this.activeIndex = index
|
||||||
|
this.toTop=!this.toTop
|
||||||
})
|
})
|
||||||
.barHeight(this.isLandscape ? $r('app.float.tab_bar_item_height_lg') : $r('app.float.tab_bar_item_height_sm'))
|
.barHeight(this.isLandscape ? $r('app.float.tab_bar_item_height_lg') : $r('app.float.tab_bar_item_height_sm'))
|
||||||
.scrollable(false)
|
.scrollable(false)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user