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
chenjun3_wd
2024-04-22 18:50:23 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
51fa36a9d1912ee4e2a91cd0bceee902c28b8562
51fa36a9
1 parent
c76c7abd
预约功能 TODO
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
2 deletions
sight_harmony/features/wdComponent/src/main/ets/components/page/ReserveMorePage.ets
sight_harmony/features/wdComponent/src/main/ets/viewmodel/LiveModel.ets
sight_harmony/features/wdComponent/src/main/ets/components/page/ReserveMorePage.ets
View file @
51fa36a
...
...
@@ -7,6 +7,7 @@ import { RefreshLayoutBean } from '../page/RefreshLayoutBean';
import PageModel from '../../viewmodel/PageModel';
import { LazyDataSource } from 'wdKit/Index';
import { router } from '@kit.ArkUI';
import { LiveModel } from '../../viewmodel/LiveModel';
const TAG: string = 'ReserveMorePage';
...
...
@@ -29,6 +30,8 @@ struct ReserveMorePage {
pageSize: number = 20;
operDataList: ContentDTO[] = [];
title: string = '预约列表'
//是否预约过直播
@State isAppointmentLive: boolean = false
@State contentDTO: ContentDTO = {
// appStyle: '15',
// coverType: 1,
...
...
@@ -199,7 +202,7 @@ struct ReserveMorePage {
.margin(12)
Flex({ justifyContent: FlexAlign.Center }) {
Text('预约')
Text(
this.isAppointmentLive ? '已预约' :
'预约')
.fontSize(12)
.fontWeight(400)
.fontFamily('PingFang SC-Regular')
...
...
@@ -207,6 +210,9 @@ struct ReserveMorePage {
.height(24)
.fontColor(Color.White)
.textAlign(TextAlign.Center)
.onClick(() => {
this.liveAppointment(item)
})
}
.width(52)
.backgroundColor('#ED2800')
...
...
@@ -254,6 +260,22 @@ struct ReserveMorePage {
}
}
async liveAppointment(item: ContentDTO) {
// this.liveViewModel.liveAppointment(
// this.liveDetailsBean.reLInfo ? this.liveDetailsBean.reLInfo.relId : '',
// this.liveDetailsBean.newsId,
// !this.isAppointmentLive).then(
// (data) => {
// if (data.success) {
// this.isAppointmentLive = !this.isAppointmentLive
// }
// },
// () => {
//
// })
const liveDetail = await LiveModel.liveAppointment(item?.relId || '', item?.objectId || '', this.isAppointmentLive || false)
}
/*导航栏*/
@Builder
TabbarNormal() {
...
...
sight_harmony/features/wdComponent/src/main/ets/viewmodel/LiveModel.ets
View file @
51fa36a
import HashMap from '@ohos.util.HashMap';
import { HttpUrlUtils, ResponseDTO } from 'wdNetwork';
import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest';
import { Logger } from 'wdKit';
import { Logger
, ToastUtils
} from 'wdKit';
import { LiveDetailsBean } from 'wdBean/Index';
const TAG = 'LiveModel'
...
...
@@ -35,5 +35,36 @@ export class LiveModel {
})
})
}
/**
* 直播预约/取消预约
* @param relationId
* @param mLiveId
* @param isSubscribe
* @returns
*/
static liveAppointment(relationId: string, liveId: string, isSubscribe: boolean) {
let params: Record<string, string> = {};
params['relationId'] = relationId
params['liveId'] = liveId
params['isSubscribe'] = `${isSubscribe}`
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return new Promise<ResponseDTO<string>>((success, fail) => {
HttpRequest.post<ResponseDTO<string>>(
HttpUrlUtils.getLiveAppointmentUrl(),
params,
headers).then((data: ResponseDTO<string>) => {
if (data.code != 0) {
fail(data.message)
ToastUtils.shortToast(data.message)
return
}
success(data)
}, (error: Error) => {
fail(error.message)
Logger.debug(TAG + ":error ", error.toString())
})
})
}
}
...
...
Please
register
or
login
to post a comment