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
zhenghy
2024-05-08 15:13:30 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
2a6bc0d25859a657c609252d68b20608a298f093
2a6bc0d2
2 parents
6a848c21
9706473b
Merge remote-tracking branch 'origin/main'
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
140 additions
and
64 deletions
sight_harmony/features/wdComponent/src/main/ets/components/MultiPictureDetailPageComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/compview/ZhSingleRow03.ets
sight_harmony/features/wdComponent/src/main/ets/components/page/BottomNavigationComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/page/ReserveMorePage.ets
sight_harmony/features/wdComponent/src/main/ets/viewmodel/LiveModel.ets
sight_harmony/products/phone/src/main/ets/pages/MainPage.ets
sight_harmony/features/wdComponent/src/main/ets/components/MultiPictureDetailPageComponent.ets
View file @
2a6bc0d
...
...
@@ -47,8 +47,10 @@ export struct MultiPictureDetailPageComponent {
@State publishCommentModel: publishCommentModel = new publishCommentModel()
@State operationButtonList: string[] = ['comment', 'like', 'collect', 'share']
@State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') as number;
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') as number;
@State windowHeight: number = AppStorage.get<number>('windowHeight') as number;
@State currentOffset:number = 0
@State duration:number = 0
//watch监听页码回调
onCurrentPageNumUpdated(): void {
...
...
@@ -81,6 +83,7 @@ export struct MultiPictureDetailPageComponent {
}
}
aboutToDisappear() {
}
...
...
@@ -98,6 +101,7 @@ export struct MultiPictureDetailPageComponent {
@Builder
init() {
if (this.contentDetailData.rmhPlatform == 1) {
if(!this.showDownload) {
Row() {
Row({ space: 8 }) {
if (this.getImgUrl()){
...
...
@@ -221,7 +225,11 @@ export struct MultiPictureDetailPageComponent {
middle: { anchor: "__container__", align: HorizontalAlign.Center }
})
.id('e_attention')
.visibility(!this.showDownload ? Visibility.Visible : Visibility.None)
.transition(TransitionEffect.OPACITY.animation({ duration: this.duration, curve: Curve.Ease }).combine(
TransitionEffect.translate({ x: 0, y: `-${this.topSafeHeight + 12}px` })
))
}
}
if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length > 0) {
Swiper(this.swiperController) {
...
...
@@ -241,6 +249,9 @@ export struct MultiPictureDetailPageComponent {
this.currentOffset = Math.abs(extraInfo.currentOffset)
})
.onTouch((event: TouchEvent) => {
if(this.duration === 0) {
this.duration = 500
}
if(event.type === 1) {
// if(this.currentOffset > px2vp((this.windowHeight - item.height)/2 - 100)) {
if(this.currentOffset > 160) {
...
...
@@ -285,6 +296,7 @@ export struct MultiPictureDetailPageComponent {
})
}
Column(){
if(!this.showDownload) {
Column(){
Row() {
Scroll(this.scroller) {
...
...
@@ -354,7 +366,11 @@ export struct MultiPictureDetailPageComponent {
operationButtonList: this.operationButtonList,
})
}
.visibility(!this.showDownload ? Visibility.Visible : Visibility.None)
.transition(TransitionEffect.OPACITY.animation({ duration: this.duration, curve: Curve.Ease }).combine(
TransitionEffect.translate({ x: 0, y: `-${this.bottomSafeHeight}px` })
))
}
if(this.showDownload) {
Column(){
Row() {
Flex({
...
...
@@ -391,7 +407,10 @@ export struct MultiPictureDetailPageComponent {
}
.width('100%')
}
.visibility(this.showDownload ? Visibility.Visible : Visibility.None)
.transition(TransitionEffect.OPACITY.animation({ duration: this.duration, curve: Curve.Ease }).combine(
TransitionEffect.translate({ x: 0, y: `${this.bottomSafeHeight}px` })
))
}
}
.zIndex(10)
.id('e_swiper_bottom')
...
...
sight_harmony/features/wdComponent/src/main/ets/components/compview/ZhSingleRow03.ets
View file @
2a6bc0d
...
...
@@ -5,6 +5,8 @@ import { PageRepository } from '../../repository/PageRepository';
import { ProcessUtils } from 'wdRouter';
import { HttpUtils } from 'wdNetwork/Index';
import { DateTimeUtils } from 'wdKit';
import { LiveModel } from '../../viewmodel/LiveModel'
import { Logger, ToastUtils } from 'wdKit';
/**
* 直播预约卡
...
...
@@ -12,13 +14,62 @@ import { DateTimeUtils } from 'wdKit';
*/
const TAG = 'Zh_Single_Row-03'
interface reserveItem {
liveId: number,
relationId: string,
subscribe: boolean
}
interface reserveReqItem {
liveId: string,
relationId: string,
}
@Entry
@Component
export struct ZhSingleRow03 {
@State compDTO: CompDTO = {} as CompDTO
@State isEndEdge: boolean = false;
// @State reserveStatus: reserveItem[] = []
@State reservedIds: number[] = [];
scroller: Scroller = new Scroller()
aboutToAppear(): void {
this.getReserveState();
}
// 请求所有预约状态
async getReserveState() {
const reserveBean: reserveReqItem[] = this.compDTO.operDataList.map((item: ContentDTO) => {
const reqItem: reserveReqItem = {
liveId: item.objectId,
relationId: item.relId
}
return reqItem;
})
const res = await LiveModel.getAppointmentStatus(reserveBean);
// this.reserveStatus = res;
res.map((item: reserveItem) => {
if (item.subscribe) {
this.reservedIds.push(item.liveId)
}
})
}
// 判断是否预约
isReserved(liveId: number) {
return this.reservedIds.includes(liveId)
}
// 预约/取消预约
async bookAndCancel(relationId: string, liveId: string, isSubscribe: boolean) {
const res = await LiveModel.liveAppointment(relationId, liveId, isSubscribe);
if (res.code == 0) {
ToastUtils.shortToast(isSubscribe ? '预约成功' : '取消预约成功')
this.getReserveState();
}
}
format(timeNum: number) {
const todayDate = new Date().setHours(0,0,0,0)
const parseDate = new Date(timeNum).setHours(0,0,0,0);
...
...
@@ -44,6 +95,37 @@ export struct ZhSingleRow03 {
Scroll(this.scroller){
Row() {
ForEach(this.compDTO.operDataList, (item: ContentDTO) => {
this.ItemCard(item)
})
}
}
.scrollable(ScrollDirection.Horizontal)
.scrollBar(BarState.Off)
.onScrollEdge((side: Edge) => {
if (side === Edge.End) {
this.isEndEdge = true;
}
})
.onScrollStop(() => {
if (this.isEndEdge) {
this.jumpToMore();
}
})
.onScroll((xOffset: number, yOffset: number) => {
this.isEndEdge = false;
})
}
.padding({
left: $r('app.float.card_comp_pagePadding_lf'),
right: $r('app.float.card_comp_pagePadding_lf'),
top: $r('app.float.card_comp_pagePadding_tb'),
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.backgroundColor($r('app.color.white'))
}
@Builder
ItemCard(item: ContentDTO) {
Column() {
Row() {
Image(item.coverUrl)
...
...
@@ -80,14 +162,18 @@ export struct ZhSingleRow03 {
}
Row() {
Text(
'预约')
Text(this.isReserved(Number(item.objectId)) ? '已预约' :
'预约')
.width(48)
.height(24)
.backgroundColor(0xED2800)
.fontColor(0xffffff)
.backgroundColor(this.isReserved(Number(item.objectId)) ? 0xffffff : 0xED2800)
.fontColor(this.isReserved(Number(item.objectId)) ? 0xC8C8C8 : 0xffffff)
.fontSize(12)
.textAlign(TextAlign.Center)
.borderRadius(3)
.onClick(() => {
this.bookAndCancel(item.relId, item.objectId, !this.isReserved(Number(item.objectId)))
})
}
.margin({top: -5})
}
...
...
@@ -102,34 +188,9 @@ export struct ZhSingleRow03 {
.onClick(() => {
ProcessUtils.processPage(item)
})
})
}
}
.scrollable(ScrollDirection.Horizontal)
.scrollBar(BarState.Off)
.onScrollEdge((side: Edge) => {
if (side === Edge.End) {
this.isEndEdge = true;
}
})
.onScrollStop(() => {
if (this.isEndEdge) {
this.jumpToMore();
}
})
.onScroll((xOffset: number, yOffset: number) => {
this.isEndEdge = false;
})
}
.padding({
left: $r('app.float.card_comp_pagePadding_lf'),
right: $r('app.float.card_comp_pagePadding_lf'),
top: $r('app.float.card_comp_pagePadding_tb'),
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.backgroundColor($r('app.color.white'))
}
@Builder
CompHeader(item: CompDTO) {
Row() {
...
...
sight_harmony/features/wdComponent/src/main/ets/components/page/BottomNavigationComponent.ets
View file @
2a6bc0d
...
...
@@ -115,15 +115,6 @@ export struct BottomNavigationComponent {
.height(CommonConstants.FULL_PARENT)
.padding({ bottom: 15, left: 10, right: 10, top: 2 })
.aspectRatio(this.ASPECT_RATIO_1_1)
.gesture(
TapGesture({ count: 2 })
.onAction((event: GestureEvent) => {
if (this.currentNavIndex === index) {
// 当前tab,双击事件
this.autoRefresh++
}
})
)
Text(navItem.name)
.margin({ bottom: $r('app.float.bottom_navigation_margin_bottom') })
...
...
@@ -140,8 +131,14 @@ export struct BottomNavigationComponent {
this.barBackgroundColor = Color.White
this.currentBottomNavInfo = {} as BottomNavDTO
} else {
if (this.currentNavIndex === index) {
// 当前tab,单击事件
this.autoRefresh++
} else {
// 切换tab
this.currentBottomNavInfo = navItem
}
}
this.currentNavIndex = index;
Logger.info(TAG, `onChange, index: ${index}`);
...
...
@@ -186,21 +183,4 @@ export struct BottomNavigationComponent {
this.assignChannel.bottomNavId = assignChannel.bottomNavId
}, 20)
}
/**
* 双击实现
*/
// doubleClickTime: number = 0
/**
* 双击实现
*/
// private doubleClick(fun: () => void) {
// let now = DateTimeUtils.getTimeStamp()
// if (now - this.doubleClickTime < 200) {
// fun()
// } else {
// this.doubleClickTime = now
// }
// }
}
\ No newline at end of file
...
...
sight_harmony/features/wdComponent/src/main/ets/components/page/ReserveMorePage.ets
View file @
2a6bc0d
...
...
@@ -83,7 +83,7 @@ struct ReserveMorePage {
this.reserveBean = this.transformToLiveDetailsBeans(liveReviewDTO.list)
const apointMentStatus = await LiveModel.getAppointmentStatus(this.reserveBean)
console.info(`cj2024 ${apointMentStatus.code}`)
//
console.info(`cj2024 ${apointMentStatus.code}`)
})
...
...
sight_harmony/features/wdComponent/src/main/ets/viewmodel/LiveModel.ets
View file @
2a6bc0d
...
...
@@ -5,6 +5,17 @@ import { LiveDetailsBean, ReserveBean } from 'wdBean/Index';
const TAG = 'LiveModel'
interface ReserveRes {
code: string | number,
data: ReserveItem[]
}
interface ReserveItem {
liveId: number,
relationId: string,
subscribe: boolean
}
export class LiveModel {
/**
* 直播内容详情
...
...
@@ -74,17 +85,21 @@ export class LiveModel {
static getAppointmentStatus(reserveBean: ReserveBean[]) {
// let params: Record<string, ArrayList<ReserveBean>> = {};
// params = reserveBean
return new Promise<ResponseDTO<string>>((success, fail) => {
HttpRequest.post<ResponseDTO<string>>(
return new Promise<Array<ReserveItem>>((success, fail) => {
HttpRequest.post<ResponseDTO<Array<ReserveItem>>>(
HttpUrlUtils.getAppointmentStatusUrl(),
reserveBean,
).then((data: ResponseDTO<string>) => {
).then((data: ResponseDTO<Array<ReserveItem>>) => {
if (!data || !data.data) {
fail("数据为空")
return
}
if (data.code != 0) {
fail(data.message)
ToastUtils.shortToast(data.message)
return
}
success(data)
success(data
.data
)
}, (error: Error) => {
fail(error.message)
Logger.debug(TAG + ":error ", error.toString())
...
...
sight_harmony/products/phone/src/main/ets/pages/MainPage.ets
View file @
2a6bc0d
...
...
@@ -21,7 +21,7 @@ struct MainPage {
}
aboutToAppear() {
HWLocationUtils.startLocationService()
this.breakpointSystem.register()
let context = getContext(this) as common.UIAbilityContext
...
...
@@ -31,6 +31,7 @@ struct MainPage {
// WDPushNotificationManager.getInstance().sendLocalNotification()
}
HWLocationUtils.startLocationService()
})
Logger.info(TAG, `aboutToAppear `);
...
...
Please
register
or
login
to post a comment