Showing
10 changed files
with
190 additions
and
7 deletions
| 1 | +import MinePageDatasModel from '../../../../model/MinePageDatasModel' | ||
| 2 | +import { AppointmentOperationRequestItem } from '../../../../viewmodel/AppointmentOperationRequestItem' | ||
| 1 | import { MineAppointmentItem } from '../../../../viewmodel/MineAppointmentItem' | 3 | import { MineAppointmentItem } from '../../../../viewmodel/MineAppointmentItem' |
| 4 | +import { MyCustomDialog } from '../../../reusable/MyCustomDialog' | ||
| 2 | 5 | ||
| 3 | @Component | 6 | @Component |
| 4 | export struct AppointmentListChildComponent{ | 7 | export struct AppointmentListChildComponent{ |
| 5 | @ObjectLink item: MineAppointmentItem | 8 | @ObjectLink item: MineAppointmentItem |
| 6 | 9 | ||
| 10 | + dialogController: CustomDialogController = new CustomDialogController({ | ||
| 11 | + builder: MyCustomDialog({ | ||
| 12 | + cancel: this.onCancel, | ||
| 13 | + confirm: this.onAccept.bind(this),//如果后期回调方法里 要使用this,一定要bind | ||
| 14 | + title: "提示", | ||
| 15 | + tipValue: '是否确认取消预约', | ||
| 16 | + }), | ||
| 17 | + autoCancel: true, | ||
| 18 | + alignment: DialogAlignment.Center, | ||
| 19 | + offset: { dx: 0, dy: -20 }, | ||
| 20 | + gridCount: 4, | ||
| 21 | + customStyle: false | ||
| 22 | + }) | ||
| 23 | + | ||
| 7 | build() { | 24 | build() { |
| 8 | Column(){ | 25 | Column(){ |
| 9 | Stack(){ | 26 | Stack(){ |
| @@ -95,8 +112,7 @@ export struct AppointmentListChildComponent{ | @@ -95,8 +112,7 @@ export struct AppointmentListChildComponent{ | ||
| 95 | .height('46lpx') | 112 | .height('46lpx') |
| 96 | .borderRadius('6lpx') | 113 | .borderRadius('6lpx') |
| 97 | .onClick(()=>{ | 114 | .onClick(()=>{ |
| 98 | - this.item.isAppointment = !this.item.isAppointment | ||
| 99 | - //TODO 预约动作 | 115 | + this.dialogController.open() |
| 100 | }) | 116 | }) |
| 101 | }else { | 117 | }else { |
| 102 | Text(this.item.relType === 2?"去观看":"看回放") | 118 | Text(this.item.relType === 2?"去观看":"看回放") |
| @@ -117,4 +133,25 @@ export struct AppointmentListChildComponent{ | @@ -117,4 +133,25 @@ export struct AppointmentListChildComponent{ | ||
| 117 | .backgroundColor($r('app.color.white')) | 133 | .backgroundColor($r('app.color.white')) |
| 118 | .borderRadius('8lpx') | 134 | .borderRadius('8lpx') |
| 119 | } | 135 | } |
| 136 | + | ||
| 137 | + onCancel() { | ||
| 138 | + console.info('Callback when the first button is clicked') | ||
| 139 | + } | ||
| 140 | + | ||
| 141 | + onAccept() { | ||
| 142 | + console.info('Callback when the second button is clicked') | ||
| 143 | + this.appointmentOperation() | ||
| 144 | + } | ||
| 145 | + | ||
| 146 | + appointmentOperation(){ | ||
| 147 | + let item = new AppointmentOperationRequestItem(this.item.relId,this.item.liveId+"",!this.item.isAppointment) | ||
| 148 | + MinePageDatasModel.getAppointmentOperation(item,getContext(this)).then((value)=>{ | ||
| 149 | + if(value!=null){ | ||
| 150 | + if (value.code === 0 || value.code.toString() === "0") { | ||
| 151 | + this.item.isAppointment = !this.item.isAppointment | ||
| 152 | + } | ||
| 153 | + } | ||
| 154 | + }) | ||
| 155 | + } | ||
| 156 | + | ||
| 120 | } | 157 | } |
| @@ -71,9 +71,9 @@ export struct AppointmentListUI{ | @@ -71,9 +71,9 @@ export struct AppointmentListUI{ | ||
| 71 | value.list.forEach((value)=>{ | 71 | value.list.forEach((value)=>{ |
| 72 | let dealTime = this.DealStartTime(value.planStartTime) | 72 | let dealTime = this.DealStartTime(value.planStartTime) |
| 73 | if(dealTime!=null && dealTime.length === 2){ | 73 | if(dealTime!=null && dealTime.length === 2){ |
| 74 | - this.data.push(new MineAppointmentItem(value.imageUrl,value.status,value.title,true,dealTime[0],dealTime[1],value.relType)) | 74 | + this.data.push(new MineAppointmentItem(value.imageUrl,value.status,value.title,true,dealTime[0],dealTime[1],value.relType,value.liveId,value.relId)) |
| 75 | }else { | 75 | }else { |
| 76 | - this.data.push(new MineAppointmentItem(value.imageUrl,value.status,value.title,true,"","",value.relType)) | 76 | + this.data.push(new MineAppointmentItem(value.imageUrl,value.status,value.title,true,"","",value.relType,value.liveId,value.relId)) |
| 77 | } | 77 | } |
| 78 | }) | 78 | }) |
| 79 | this.data.notifyDataReload() | 79 | this.data.notifyDataReload() |
| @@ -234,7 +234,8 @@ struct ChildComponent { | @@ -234,7 +234,8 @@ struct ChildComponent { | ||
| 234 | }.height('146lpx') | 234 | }.height('146lpx') |
| 235 | .justifyContent(FlexAlign.Center) | 235 | .justifyContent(FlexAlign.Center) |
| 236 | .onClick(()=>{ | 236 | .onClick(()=>{ |
| 237 | - RouteManager.jumpNewPage("pages/OtherNormalUserHomePage",new RouterObject(this.data.attentionUserId,0)) | 237 | + //跳转 人民号的 主页 |
| 238 | + // RouteManager.jumpNewPage("pages/OtherNormalUserHomePage",new RouterObject(this.data.attentionUserId,0)) | ||
| 238 | }) | 239 | }) |
| 239 | } | 240 | } |
| 240 | } | 241 | } |
| 1 | +@CustomDialog | ||
| 2 | +export struct MyCustomDialog { | ||
| 3 | + @State title: string = "标题" | ||
| 4 | + @State tipValue: string ="提示文字" | ||
| 5 | + | ||
| 6 | + @State leftText: string = "取消" | ||
| 7 | + @State rightText: string = "确认" | ||
| 8 | + | ||
| 9 | + controller?: CustomDialogController | ||
| 10 | + cancel: () => void = () => { | ||
| 11 | + } | ||
| 12 | + confirm: () => void = () => { | ||
| 13 | + } | ||
| 14 | + | ||
| 15 | + build() { | ||
| 16 | + Column() { | ||
| 17 | + Text(this.title) | ||
| 18 | + .fontSize("32lpx") | ||
| 19 | + .margin({ top: "40lpx", bottom: "15lpx" }) | ||
| 20 | + .fontColor($r('app.color.color_333333')) | ||
| 21 | + .fontSize('35lpx') | ||
| 22 | + .fontWeight('600lpx') | ||
| 23 | + Text(this.tipValue) | ||
| 24 | + .margin({ bottom: "30lpx" }) | ||
| 25 | + .fontSize("27lpx") | ||
| 26 | + .fontColor($r('app.color.color_B0B0B0')) | ||
| 27 | + | ||
| 28 | + Divider() | ||
| 29 | + .width("100%") | ||
| 30 | + .strokeWidth('1lpx') | ||
| 31 | + .height('1lpx') | ||
| 32 | + .color($r('app.color.color_EEEEEE')) | ||
| 33 | + | ||
| 34 | + Row(){ | ||
| 35 | + Text(this.leftText) | ||
| 36 | + .fontSize('35lpx') | ||
| 37 | + .fontWeight('400lpx') | ||
| 38 | + .fontColor($r('app.color.color_333333')) | ||
| 39 | + .onClick(() => { | ||
| 40 | + this.controller.close() | ||
| 41 | + this.cancel() | ||
| 42 | + }).layoutWeight(1) | ||
| 43 | + .textAlign(TextAlign.Center) | ||
| 44 | + Divider() | ||
| 45 | + .width("1lpx") | ||
| 46 | + .strokeWidth('1lpx') | ||
| 47 | + .vertical(true) | ||
| 48 | + .height('92lpx') | ||
| 49 | + .color($r('app.color.color_EEEEEE')) | ||
| 50 | + | ||
| 51 | + Text(this.rightText) | ||
| 52 | + .fontSize('35lpx') | ||
| 53 | + .textAlign(TextAlign.Center) | ||
| 54 | + .fontWeight('400lpx') | ||
| 55 | + .fontColor($r('app.color.color_648DF2')) | ||
| 56 | + .onClick(() => { | ||
| 57 | + if (this.controller != undefined) { | ||
| 58 | + this.controller.close() | ||
| 59 | + this.confirm() | ||
| 60 | + } | ||
| 61 | + }).layoutWeight(1) | ||
| 62 | + } | ||
| 63 | + .alignItems(VerticalAlign.Center) | ||
| 64 | + .height('96lpx') | ||
| 65 | + }.borderRadius(10) | ||
| 66 | + } | ||
| 67 | +} |
| @@ -21,6 +21,7 @@ import { OtherUserCommentListRequestItem } from '../viewmodel/OtherUserCommentLi | @@ -21,6 +21,7 @@ import { OtherUserCommentListRequestItem } from '../viewmodel/OtherUserCommentLi | ||
| 21 | import { QueryCommentListIsLikedItem } from '../viewmodel/QueryCommentListIsLikedItem'; | 21 | import { QueryCommentListIsLikedItem } from '../viewmodel/QueryCommentListIsLikedItem'; |
| 22 | import { UserFollowListRequestItem } from '../viewmodel/UserFollowListRequestItem'; | 22 | import { UserFollowListRequestItem } from '../viewmodel/UserFollowListRequestItem'; |
| 23 | import { OtherUserDetailRequestItem } from '../viewmodel/OtherUserDetailRequestItem'; | 23 | import { OtherUserDetailRequestItem } from '../viewmodel/OtherUserDetailRequestItem'; |
| 24 | +import { AppointmentOperationRequestItem } from '../viewmodel/AppointmentOperationRequestItem'; | ||
| 24 | const TAG = "MinePageDatasModel" | 25 | const TAG = "MinePageDatasModel" |
| 25 | 26 | ||
| 26 | /** | 27 | /** |
| @@ -635,6 +636,46 @@ class MinePageDatasModel{ | @@ -635,6 +636,46 @@ class MinePageDatasModel{ | ||
| 635 | return compRes.data | 636 | return compRes.data |
| 636 | } | 637 | } |
| 637 | 638 | ||
| 639 | + /** | ||
| 640 | + * 预约 和取消预约操作 | ||
| 641 | + * @param params | ||
| 642 | + * @param context | ||
| 643 | + * @returns | ||
| 644 | + */ | ||
| 645 | + getAppointmentOperation(params:AppointmentOperationRequestItem,context: Context): Promise<ResponseDTO> { | ||
| 646 | + return new Promise((success, error) => { | ||
| 647 | + Logger.info(TAG, `getAppointmentList start`); | ||
| 648 | + this.fetchAppointmentOperation(params).then((navResDTO: ResponseDTO) => { | ||
| 649 | + if (!navResDTO || navResDTO.code != 0) { | ||
| 650 | + success(this.getAppointmentOperationLocal(context)) | ||
| 651 | + return | ||
| 652 | + } | ||
| 653 | + Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp); | ||
| 654 | + success(navResDTO); | ||
| 655 | + }).catch((err: Error) => { | ||
| 656 | + Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`); | ||
| 657 | + success(this.getAppointmentOperationLocal(context)) | ||
| 658 | + }) | ||
| 659 | + }) | ||
| 660 | + } | ||
| 661 | + | ||
| 662 | + fetchAppointmentOperation(object:AppointmentOperationRequestItem) { | ||
| 663 | + let url = HttpUrlUtils.getAppointmentOperationUrl() | ||
| 664 | + let headers: HashMap<string, string> = HttpUrlUtils.getYcgCommonHeaders(); | ||
| 665 | + return WDHttp.post<ResponseDTO>(url,object, headers) | ||
| 666 | + }; | ||
| 667 | + | ||
| 668 | + async getAppointmentOperationLocal(context: Context): Promise<ResponseDTO> { | ||
| 669 | + Logger.info(TAG, `getMineFollowListDataLocal start`); | ||
| 670 | + let compRes: ResponseDTO | null = await ResourcesUtils.getResourcesJson<ResponseDTO>('appointment_operation_data.json',context ); | ||
| 671 | + if (!compRes ) { | ||
| 672 | + Logger.info(TAG, `getMineFollowListDataLocal compRes is empty`); | ||
| 673 | + return null | ||
| 674 | + } | ||
| 675 | + Logger.info(TAG, `getMineFollowListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`); | ||
| 676 | + return compRes | ||
| 677 | + } | ||
| 678 | + | ||
| 638 | } | 679 | } |
| 639 | 680 | ||
| 640 | const minePageDatasModel = MinePageDatasModel.getInstance() | 681 | const minePageDatasModel = MinePageDatasModel.getInstance() |
| @@ -98,6 +98,11 @@ export class HttpUrlUtils { | @@ -98,6 +98,11 @@ export class HttpUrlUtils { | ||
| 98 | */ | 98 | */ |
| 99 | static readonly OTHER_USER_FOLLOW_LIST_DATA_PATH: string = "/api/rmrb-interact/interact/zh/c/userAttention/list"; | 99 | static readonly OTHER_USER_FOLLOW_LIST_DATA_PATH: string = "/api/rmrb-interact/interact/zh/c/userAttention/list"; |
| 100 | 100 | ||
| 101 | + /** | ||
| 102 | + * 预约操作 | ||
| 103 | + */ | ||
| 104 | + static readonly APPOINTMENT_OPERATION_STATUS_PATH: string = "/api/live-center-message/zh/c/live/subscribe"; | ||
| 105 | + | ||
| 101 | private static hostUrl: string = HttpUrlUtils.HOST_UAT; | 106 | private static hostUrl: string = HttpUrlUtils.HOST_UAT; |
| 102 | 107 | ||
| 103 | static getCommonHeaders(): HashMap<string, string> { | 108 | static getCommonHeaders(): HashMap<string, string> { |
| @@ -238,7 +243,10 @@ export class HttpUrlUtils { | @@ -238,7 +243,10 @@ export class HttpUrlUtils { | ||
| 238 | return url | 243 | return url |
| 239 | } | 244 | } |
| 240 | 245 | ||
| 241 | - | 246 | + static getAppointmentOperationUrl() { |
| 247 | + let url = HttpUrlUtils.HOST_SIT + HttpUrlUtils.APPOINTMENT_OPERATION_STATUS_PATH | ||
| 248 | + return url | ||
| 249 | + } | ||
| 242 | 250 | ||
| 243 | static getYcgCommonHeaders(): HashMap<string, string> { | 251 | static getYcgCommonHeaders(): HashMap<string, string> { |
| 244 | let headers: HashMap<string, string> = new HashMap<string, string>() | 252 | let headers: HashMap<string, string> = new HashMap<string, string>() |
PeopleDaily_Harmony/wdComponent/src/main/ets/viewmodel/AppointmentOperationRequestItem.ets
0 → 100644
| 1 | +// {"relationId":"500000017021","liveId":"20000007348","isSubscribe":false} | ||
| 2 | +export class AppointmentOperationRequestItem{ | ||
| 3 | + relationId:string = "" | ||
| 4 | + liveId:string = "" | ||
| 5 | + isSubscribe:boolean = false | ||
| 6 | + | ||
| 7 | + constructor(relationId: string ,liveId: string ,isSubscribe: boolean ) { | ||
| 8 | + this.relationId = relationId | ||
| 9 | + this.liveId = liveId | ||
| 10 | + this.isSubscribe = isSubscribe | ||
| 11 | + } | ||
| 12 | +} |
| @@ -18,7 +18,7 @@ export class MineAppointmentItem{ | @@ -18,7 +18,7 @@ export class MineAppointmentItem{ | ||
| 18 | isAppointment:boolean | 18 | isAppointment:boolean |
| 19 | 19 | ||
| 20 | 20 | ||
| 21 | - constructor(imageUrl:string[],status:string,title:string,isAppointment:boolean,timePre:string,timeBack:string,relType:number ) { | 21 | + constructor(imageUrl:string[],status:string,title:string,isAppointment:boolean,timePre:string,timeBack:string,relType:number,liveId:number,relId:string ) { |
| 22 | this.imageUrl=imageUrl | 22 | this.imageUrl=imageUrl |
| 23 | this.status=status | 23 | this.status=status |
| 24 | this.title=title | 24 | this.title=title |
| @@ -26,5 +26,7 @@ export class MineAppointmentItem{ | @@ -26,5 +26,7 @@ export class MineAppointmentItem{ | ||
| 26 | this.timePre = timePre | 26 | this.timePre = timePre |
| 27 | this.timeBack = timeBack | 27 | this.timeBack = timeBack |
| 28 | this.relType = relType | 28 | this.relType = relType |
| 29 | + this.liveId = liveId | ||
| 30 | + this.relId = relId | ||
| 29 | } | 31 | } |
| 30 | } | 32 | } |
| @@ -102,6 +102,14 @@ | @@ -102,6 +102,14 @@ | ||
| 102 | { | 102 | { |
| 103 | "name":"color_transparent", | 103 | "name":"color_transparent", |
| 104 | "value": "#00000000" | 104 | "value": "#00000000" |
| 105 | + }, | ||
| 106 | + { | ||
| 107 | + "name":"color_648DF2", | ||
| 108 | + "value": "#648DF2" | ||
| 109 | + }, | ||
| 110 | + { | ||
| 111 | + "name":"color_EEEEEE", | ||
| 112 | + "value": "#EEEEEE" | ||
| 105 | } | 113 | } |
| 106 | ] | 114 | ] |
| 107 | } | 115 | } |
-
Please register or login to post a comment