yangchenggong1_wd

desc:同步 3.0 预约操作,客态,ui

... ... @@ -129,6 +129,12 @@ export class HttpUrlUtils {
* 个人中心 我的关注列表
*/
static readonly OTHER_USER_FOLLOW_LIST_DATA_PATH: string = "/api/rmrb-interact/interact/zh/c/userAttention/list";
/**
* 预约操作
*/
static readonly APPOINTMENT_OPERATION_STATUS_PATH: string = "/api/live-center-message/zh/c/live/subscribe";
/**
* 早晚报列表
* 根据页面id获取页面楼层列表
... ... @@ -432,6 +438,10 @@ export class HttpUrlUtils {
return url
}
static getAppointmentOperationUrl() {
let url = HttpUrlUtils.HOST_SIT + HttpUrlUtils.APPOINTMENT_OPERATION_STATUS_PATH
return url
}
static getYcgCommonHeaders(): HashMap<string, string> {
... ...
... ... @@ -42,7 +42,7 @@ export default struct MinePageUserSimpleInfoUI {
build(){
Row(){
//头像
Stack(){
Stack({alignContent: Alignment.Center}){
Image(this.headPhotoUrl)
.alt($r('app.media.default_head'))
.width('108lpx')
... ...
import MinePageDatasModel from '../../../model/MinePageDatasModel'
import { AppointmentOperationRequestItem } from '../../../viewmodel/AppointmentOperationRequestItem'
import { MineAppointmentItem } from '../../../viewmodel/MineAppointmentItem'
import { MyCustomDialog } from '../../reusable/MyCustomDialog'
@Component
export struct AppointmentListChildComponent{
@ObjectLink item: MineAppointmentItem
dialogController: CustomDialogController = new CustomDialogController({
builder: MyCustomDialog({
cancel: this.onCancel,
confirm: () => {
this.onAccept()
},
title: "提示",
tipValue: '是否确认取消预约'
}),
autoCancel: true,
alignment: DialogAlignment.Center,
offset: { dx: 0, dy: -20 },
gridCount: 4,
customStyle: false
})
build() {
Column(){
... ... @@ -102,8 +121,7 @@ export struct AppointmentListChildComponent{
.height('46lpx')
.borderRadius('6lpx')
.onClick(()=>{
this.item.isAppointment = !this.item.isAppointment
//TODO 预约动作
this.dialogController.open()
})
}else {
Text(this.item.relType === 2?"去观看":"看回放")
... ... @@ -124,4 +142,25 @@ export struct AppointmentListChildComponent{
.backgroundColor($r('app.color.white'))
.borderRadius('8lpx')
}
onCancel() {
console.info('Callback when the first button is clicked')
}
onAccept(){
console.info('Callback when the second button is clicked')
this.appointmentOperation()
}
appointmentOperation(){
let item = new AppointmentOperationRequestItem(this.item.relId,this.item.liveId+"",!this.item.isAppointment)
MinePageDatasModel.getAppointmentOperation(item,getContext(this)).then((value)=>{
if(value!=null){
if (value.code === 0 || value.code.toString() === "0") {
this.item.isAppointment = !this.item.isAppointment
}
}
})
}
}
\ No newline at end of file
... ...
... ... @@ -71,9 +71,9 @@ export struct AppointmentListUI{
value.list.forEach((value)=>{
let dealTime = this.DealStartTime(value.planStartTime)
if(dealTime!=null && dealTime.length === 2){
this.data.push(new MineAppointmentItem(value.imageUrl,value.status,value.title,true,dealTime[0],dealTime[1],value.relType))
this.data.push(new MineAppointmentItem(value.imageUrl,value.status,value.title,true,dealTime[0],dealTime[1],value.relType,value.liveId,value.relId))
}else {
this.data.push(new MineAppointmentItem(value.imageUrl,value.status,value.title,true,"","",value.relType))
this.data.push(new MineAppointmentItem(value.imageUrl,value.status,value.title,true,"","",value.relType,value.liveId,value.relId))
}
})
this.data.notifyDataReload()
... ...
... ... @@ -233,10 +233,11 @@ struct ChildComponent {
}.height('146lpx')
.justifyContent(FlexAlign.Center)
.onClick(()=>{
let params: Params = {
pageID: this.data.attentionUserId
}
WDRouterRule.jumpWithPage(WDRouterPage.otherNormalUserHomePagePage,params)
//跳转 人民号的 主页
// let params: Params = {
// pageID: this.data.attentionUserId
// }
// WDRouterRule.jumpWithPage(WDRouterPage.otherNormalUserHomePagePage,params)
})
}
}
\ No newline at end of file
... ...
... ... @@ -19,6 +19,7 @@ export struct HomePageBottomComponent{
@State count:number = 0;
@State isMineAccount:boolean = true;
@State userId:string = "";
@Prop levelHead:string
aboutToAppear(){
this.getNewPageData()
... ... @@ -99,7 +100,7 @@ export struct HomePageBottomComponent{
List({ space: 3 }) {
LazyForEach(this.data_comment, (item: CommentListItem, index: number = 0) => {
ListItem() {
ChildCommentComponent({data: item})
ChildCommentComponent({data: item,levelHead:this.levelHead})
}
.onClick(() => {
})
... ... @@ -289,14 +290,25 @@ struct ChildFollowComponent {
@Component
struct ChildCommentComponent {
@ObjectLink data: CommentListItem
@Prop levelHead:string
build() {
Column(){
Row() {
Image(StringUtils.isEmpty(this.data.fromUserHeader)?$r('app.media.default_head'):this.data.fromUserHeader)
Stack({alignContent: Alignment.Center}){
Image(this.data.fromUserHeader)
.alt($r('app.media.default_head'))
.objectFit(ImageFit.Auto)
.width('69lpx')
.height('69lpx')
.borderRadius(50)
Image(this.levelHead)
.width('89lpx')
.height('89lpx')
.objectFit(ImageFit.Cover)
.borderRadius(50)
}.width('89lpx')
.height('89lpx')
.margin({right:'15lpx'})
Column(){
... ...
... ... @@ -144,20 +144,21 @@ struct ChildCommentComponent {
build() {
Column(){
Row() {
Stack(){
Stack({alignContent: Alignment.Center}){
Image(this.data.fromUserHeader)
.alt($r('app.media.default_head'))
.objectFit(ImageFit.Auto)
.width('69lpx')
.height('69lpx')
.margin({right:'15lpx'})
.borderRadius(50)
Image(this.levelHead)
.width('89lpx')
.height('89lpx')
.objectFit(ImageFit.Cover)
.borderRadius(50)
}
}.width('89lpx')
.height('89lpx')
.margin({right:'15lpx'})
Column(){
Text(this.data.fromUserName)
... ...
import { MineAppointmentItem } from '../../viewmodel/MineAppointmentItem'
@CustomDialog
export struct MyCustomDialog {
@State title: string = "标题"
@State tipValue: string ="提示文字"
@State leftText: string = "取消"
@State rightText: string = "确认"
controller: CustomDialogController
cancel: () => void = () => {
}
confirm: () => void = () => {
}
build() {
Column() {
Text(this.title)
.fontSize("32lpx")
.margin({ top: "40lpx", bottom: "15lpx" })
.fontColor($r('app.color.color_333333'))
.fontSize('35lpx')
.fontWeight('600lpx')
Text(this.tipValue)
.margin({ bottom: "30lpx" })
.fontSize("27lpx")
.fontColor($r('app.color.color_B0B0B0'))
Divider()
.width("100%")
.strokeWidth('1lpx')
.height('1lpx')
.color($r('app.color.color_EEEEEE'))
Row(){
Text(this.leftText)
.fontSize('35lpx')
.fontWeight('400lpx')
.fontColor($r('app.color.color_333333'))
.onClick(() => {
this.controller.close()
this.cancel()
}).layoutWeight(1)
.textAlign(TextAlign.Center)
Divider()
.width("1lpx")
.strokeWidth('1lpx')
.vertical(true)
.height('92lpx')
.color($r('app.color.color_EEEEEE'))
Text(this.rightText)
.fontSize('35lpx')
.textAlign(TextAlign.Center)
.fontWeight('400lpx')
.fontColor($r('app.color.color_648DF2'))
.onClick(() => {
if (this.controller != undefined) {
this.controller.close()
this.confirm()
}
}).layoutWeight(1)
}
.alignItems(VerticalAlign.Center)
.height('96lpx')
}.borderRadius(10)
}
}
\ No newline at end of file
... ...
... ... @@ -20,6 +20,7 @@ import { OtherUserCommentListRequestItem } from '../viewmodel/OtherUserCommentLi
import { OtherUserCommentLikeStatusRequestItem } from '../viewmodel/OtherUserCommentLikeStatusRequestItem';
import { QueryCommentListIsLikedItem } from '../viewmodel/QueryCommentListIsLikedItem';
import { UserFollowListRequestItem } from '../viewmodel/UserFollowListRequestItem';
import { AppointmentOperationRequestItem } from '../viewmodel/AppointmentOperationRequestItem';
const TAG = "MinePageDatasModel"
... ... @@ -622,6 +623,47 @@ class MinePageDatasModel{
return compRes.data
}
/**
* 预约 和取消预约操作
* @param params
* @param context
* @returns
*/
getAppointmentOperation(params:AppointmentOperationRequestItem,context: Context): Promise<ResponseDTO> {
return new Promise((success, error) => {
Logger.info(TAG, `getAppointmentList start`);
this.fetchAppointmentOperation(params).then((navResDTO: ResponseDTO) => {
if (!navResDTO || navResDTO.code != 0) {
success(this.getAppointmentOperationLocal(context))
return
}
Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp);
success(navResDTO);
}).catch((err: Error) => {
Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`);
success(this.getAppointmentOperationLocal(context))
})
})
}
fetchAppointmentOperation(object:AppointmentOperationRequestItem) {
let url = HttpUrlUtils.getAppointmentOperationUrl()
let headers: HashMap<string, string> = HttpUrlUtils.getYcgCommonHeaders();
return WDHttp.post<ResponseDTO>(url,object, headers)
};
async getAppointmentOperationLocal(context: Context): Promise<ResponseDTO> {
Logger.info(TAG, `getMineFollowListDataLocal start`);
let compRes: ResponseDTO | null = await ResourcesUtils.getResourcesJson<ResponseDTO>(context,'appointment_operation_data.json');
if (!compRes ) {
Logger.info(TAG, `getMineFollowListDataLocal compRes is empty`);
return compRes
}
Logger.info(TAG, `getMineFollowListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`);
return compRes
}
}
... ...
... ... @@ -185,10 +185,10 @@ struct MineHomePage {
//tab 页面
Tabs({controller: this.controller}) {
TabContent() {
HomePageBottomComponent({style:0})
HomePageBottomComponent({style:0,levelHead:this.levelHead})
}.tabBar(this.TabBuilder(0,"评论"))
TabContent() {
HomePageBottomComponent({style:1})
HomePageBottomComponent({style:1,levelHead:this.levelHead})
}.tabBar(this.TabBuilder(1,"关注"))
}
.backgroundColor($r('app.color.white'))
... ...
... ... @@ -148,6 +148,7 @@ struct OtherNormalUserHomePage {
.padding({ left: '35lpx' })
//用户简介区域
if(StringUtils.isNotEmpty(this.desc)){
Column() {
Row() {
Text(this.desc)
... ... @@ -165,8 +166,7 @@ struct OtherNormalUserHomePage {
.justifyContent(FlexAlign.Center)
.width('100%')
.backgroundColor($r('app.color.white'))
.visibility(StringUtils.isEmpty(this.desc)?Visibility.Hidden:Visibility.Visible)
}
//间隔符
Divider().width('100%').height('12lpx').color($r('app.color.color_F5F5F5')).strokeWidth('12lpx')
... ...
// {"relationId":"500000017021","liveId":"20000007348","isSubscribe":false}
export class AppointmentOperationRequestItem{
relationId:string = ""
liveId:string = ""
isSubscribe:boolean = false
constructor(relationId: string ,liveId: string ,isSubscribe: boolean ) {
this.relationId = relationId
this.liveId = liveId
this.isSubscribe = isSubscribe
}
}
... ...
... ... @@ -18,8 +18,8 @@ export class MineAppointmentItem{
isAppointment:boolean
constructor(imageUrl:string[],status:string,title:string,isAppointment:boolean,timePre:string,timeBack:string,relType:number,appStyle?:string,liveId?:number,planStartTime?:string,
relId?:string,startTime?:string) {
constructor(imageUrl:string[],status:string,title:string,isAppointment:boolean,timePre:string,timeBack:string,relType:number,liveId:number,
relId:string) {
this.imageUrl=imageUrl
this.status=status
this.title=title
... ... @@ -27,5 +27,7 @@ export class MineAppointmentItem{
this.timePre = timePre
this.timeBack = timeBack
this.relType = relType
this.liveId = liveId
this.relId = relId
}
}
\ No newline at end of file
... ...
... ... @@ -119,6 +119,14 @@
{
"name": "color_99636363",
"value": "#99636363"
},
{
"name":"color_648DF2",
"value": "#648DF2"
},
{
"name":"color_EEEEEE",
"value": "#EEEEEE"
}
]
}
\ No newline at end of file
... ...
{
"code": "0",
"message": "Success",
"requestId": "9a63f8f9e61d442880a7537763fd1769",
"success": true,
"timestamp": 1711589284588
}
\ No newline at end of file
... ...