yangchenggong1_wd

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

@@ -129,6 +129,12 @@ export class HttpUrlUtils { @@ -129,6 +129,12 @@ export class HttpUrlUtils {
129 * 个人中心 我的关注列表 129 * 个人中心 我的关注列表
130 */ 130 */
131 static readonly OTHER_USER_FOLLOW_LIST_DATA_PATH: string = "/api/rmrb-interact/interact/zh/c/userAttention/list"; 131 static readonly OTHER_USER_FOLLOW_LIST_DATA_PATH: string = "/api/rmrb-interact/interact/zh/c/userAttention/list";
  132 +
  133 + /**
  134 + * 预约操作
  135 + */
  136 + static readonly APPOINTMENT_OPERATION_STATUS_PATH: string = "/api/live-center-message/zh/c/live/subscribe";
  137 +
132 /** 138 /**
133 * 早晚报列表 139 * 早晚报列表
134 * 根据页面id获取页面楼层列表 140 * 根据页面id获取页面楼层列表
@@ -432,6 +438,10 @@ export class HttpUrlUtils { @@ -432,6 +438,10 @@ export class HttpUrlUtils {
432 return url 438 return url
433 } 439 }
434 440
  441 + static getAppointmentOperationUrl() {
  442 + let url = HttpUrlUtils.HOST_SIT + HttpUrlUtils.APPOINTMENT_OPERATION_STATUS_PATH
  443 + return url
  444 + }
435 445
436 446
437 static getYcgCommonHeaders(): HashMap<string, string> { 447 static getYcgCommonHeaders(): HashMap<string, string> {
@@ -42,7 +42,7 @@ export default struct MinePageUserSimpleInfoUI { @@ -42,7 +42,7 @@ export default struct MinePageUserSimpleInfoUI {
42 build(){ 42 build(){
43 Row(){ 43 Row(){
44 //头像 44 //头像
45 - Stack(){ 45 + Stack({alignContent: Alignment.Center}){
46 Image(this.headPhotoUrl) 46 Image(this.headPhotoUrl)
47 .alt($r('app.media.default_head')) 47 .alt($r('app.media.default_head'))
48 .width('108lpx') 48 .width('108lpx')
  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
  9 + dialogController: CustomDialogController = new CustomDialogController({
  10 + builder: MyCustomDialog({
  11 + cancel: this.onCancel,
  12 + confirm: () => {
  13 + this.onAccept()
  14 + },
  15 + title: "提示",
  16 + tipValue: '是否确认取消预约'
  17 + }),
  18 + autoCancel: true,
  19 + alignment: DialogAlignment.Center,
  20 + offset: { dx: 0, dy: -20 },
  21 + gridCount: 4,
  22 + customStyle: false
  23 + })
  24 +
6 25
7 build() { 26 build() {
8 Column(){ 27 Column(){
@@ -102,8 +121,7 @@ export struct AppointmentListChildComponent{ @@ -102,8 +121,7 @@ export struct AppointmentListChildComponent{
102 .height('46lpx') 121 .height('46lpx')
103 .borderRadius('6lpx') 122 .borderRadius('6lpx')
104 .onClick(()=>{ 123 .onClick(()=>{
105 - this.item.isAppointment = !this.item.isAppointment  
106 - //TODO 预约动作 124 + this.dialogController.open()
107 }) 125 })
108 }else { 126 }else {
109 Text(this.item.relType === 2?"去观看":"看回放") 127 Text(this.item.relType === 2?"去观看":"看回放")
@@ -124,4 +142,25 @@ export struct AppointmentListChildComponent{ @@ -124,4 +142,25 @@ export struct AppointmentListChildComponent{
124 .backgroundColor($r('app.color.white')) 142 .backgroundColor($r('app.color.white'))
125 .borderRadius('8lpx') 143 .borderRadius('8lpx')
126 } 144 }
  145 +
  146 + onCancel() {
  147 + console.info('Callback when the first button is clicked')
  148 + }
  149 +
  150 + onAccept(){
  151 + console.info('Callback when the second button is clicked')
  152 + this.appointmentOperation()
  153 + }
  154 +
  155 + appointmentOperation(){
  156 + let item = new AppointmentOperationRequestItem(this.item.relId,this.item.liveId+"",!this.item.isAppointment)
  157 + MinePageDatasModel.getAppointmentOperation(item,getContext(this)).then((value)=>{
  158 + if(value!=null){
  159 + if (value.code === 0 || value.code.toString() === "0") {
  160 + this.item.isAppointment = !this.item.isAppointment
  161 + }
  162 + }
  163 + })
  164 + }
  165 +
127 } 166 }
@@ -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()
@@ -233,10 +233,11 @@ struct ChildComponent { @@ -233,10 +233,11 @@ struct ChildComponent {
233 }.height('146lpx') 233 }.height('146lpx')
234 .justifyContent(FlexAlign.Center) 234 .justifyContent(FlexAlign.Center)
235 .onClick(()=>{ 235 .onClick(()=>{
236 - let params: Params = {  
237 - pageID: this.data.attentionUserId  
238 - }  
239 - WDRouterRule.jumpWithPage(WDRouterPage.otherNormalUserHomePagePage,params) 236 + //跳转 人民号的 主页
  237 + // let params: Params = {
  238 + // pageID: this.data.attentionUserId
  239 + // }
  240 + // WDRouterRule.jumpWithPage(WDRouterPage.otherNormalUserHomePagePage,params)
240 }) 241 })
241 } 242 }
242 } 243 }
@@ -19,6 +19,7 @@ export struct HomePageBottomComponent{ @@ -19,6 +19,7 @@ export struct HomePageBottomComponent{
19 @State count:number = 0; 19 @State count:number = 0;
20 @State isMineAccount:boolean = true; 20 @State isMineAccount:boolean = true;
21 @State userId:string = ""; 21 @State userId:string = "";
  22 + @Prop levelHead:string
22 23
23 aboutToAppear(){ 24 aboutToAppear(){
24 this.getNewPageData() 25 this.getNewPageData()
@@ -99,7 +100,7 @@ export struct HomePageBottomComponent{ @@ -99,7 +100,7 @@ export struct HomePageBottomComponent{
99 List({ space: 3 }) { 100 List({ space: 3 }) {
100 LazyForEach(this.data_comment, (item: CommentListItem, index: number = 0) => { 101 LazyForEach(this.data_comment, (item: CommentListItem, index: number = 0) => {
101 ListItem() { 102 ListItem() {
102 - ChildCommentComponent({data: item}) 103 + ChildCommentComponent({data: item,levelHead:this.levelHead})
103 } 104 }
104 .onClick(() => { 105 .onClick(() => {
105 }) 106 })
@@ -289,15 +290,26 @@ struct ChildFollowComponent { @@ -289,15 +290,26 @@ struct ChildFollowComponent {
289 @Component 290 @Component
290 struct ChildCommentComponent { 291 struct ChildCommentComponent {
291 @ObjectLink data: CommentListItem 292 @ObjectLink data: CommentListItem
  293 + @Prop levelHead:string
292 294
293 build() { 295 build() {
294 Column(){ 296 Column(){
295 Row() { 297 Row() {
296 - Image(StringUtils.isEmpty(this.data.fromUserHeader)?$r('app.media.default_head'):this.data.fromUserHeader)  
297 - .objectFit(ImageFit.Auto)  
298 - .width('69lpx')  
299 - .height('69lpx')  
300 - .margin({right:'15lpx'}) 298 + Stack({alignContent: Alignment.Center}){
  299 + Image(this.data.fromUserHeader)
  300 + .alt($r('app.media.default_head'))
  301 + .objectFit(ImageFit.Auto)
  302 + .width('69lpx')
  303 + .height('69lpx')
  304 + .borderRadius(50)
  305 + Image(this.levelHead)
  306 + .width('89lpx')
  307 + .height('89lpx')
  308 + .objectFit(ImageFit.Cover)
  309 + .borderRadius(50)
  310 + }.width('89lpx')
  311 + .height('89lpx')
  312 + .margin({right:'15lpx'})
301 313
302 Column(){ 314 Column(){
303 Text(this.data.fromUserName) 315 Text(this.data.fromUserName)
@@ -144,20 +144,21 @@ struct ChildCommentComponent { @@ -144,20 +144,21 @@ struct ChildCommentComponent {
144 build() { 144 build() {
145 Column(){ 145 Column(){
146 Row() { 146 Row() {
147 - Stack(){ 147 + Stack({alignContent: Alignment.Center}){
148 Image(this.data.fromUserHeader) 148 Image(this.data.fromUserHeader)
149 .alt($r('app.media.default_head')) 149 .alt($r('app.media.default_head'))
150 .objectFit(ImageFit.Auto) 150 .objectFit(ImageFit.Auto)
151 .width('69lpx') 151 .width('69lpx')
152 .height('69lpx') 152 .height('69lpx')
153 - .margin({right:'15lpx'})  
154 .borderRadius(50) 153 .borderRadius(50)
155 Image(this.levelHead) 154 Image(this.levelHead)
156 .width('89lpx') 155 .width('89lpx')
157 .height('89lpx') 156 .height('89lpx')
158 .objectFit(ImageFit.Cover) 157 .objectFit(ImageFit.Cover)
159 .borderRadius(50) 158 .borderRadius(50)
160 - } 159 + }.width('89lpx')
  160 + .height('89lpx')
  161 + .margin({right:'15lpx'})
161 162
162 Column(){ 163 Column(){
163 Text(this.data.fromUserName) 164 Text(this.data.fromUserName)
  1 +import { MineAppointmentItem } from '../../viewmodel/MineAppointmentItem'
  2 +
  3 +@CustomDialog
  4 +export struct MyCustomDialog {
  5 + @State title: string = "标题"
  6 + @State tipValue: string ="提示文字"
  7 +
  8 + @State leftText: string = "取消"
  9 + @State rightText: string = "确认"
  10 +
  11 + controller: CustomDialogController
  12 + cancel: () => void = () => {
  13 + }
  14 + confirm: () => void = () => {
  15 + }
  16 +
  17 + build() {
  18 + Column() {
  19 + Text(this.title)
  20 + .fontSize("32lpx")
  21 + .margin({ top: "40lpx", bottom: "15lpx" })
  22 + .fontColor($r('app.color.color_333333'))
  23 + .fontSize('35lpx')
  24 + .fontWeight('600lpx')
  25 + Text(this.tipValue)
  26 + .margin({ bottom: "30lpx" })
  27 + .fontSize("27lpx")
  28 + .fontColor($r('app.color.color_B0B0B0'))
  29 +
  30 + Divider()
  31 + .width("100%")
  32 + .strokeWidth('1lpx')
  33 + .height('1lpx')
  34 + .color($r('app.color.color_EEEEEE'))
  35 +
  36 + Row(){
  37 + Text(this.leftText)
  38 + .fontSize('35lpx')
  39 + .fontWeight('400lpx')
  40 + .fontColor($r('app.color.color_333333'))
  41 + .onClick(() => {
  42 + this.controller.close()
  43 + this.cancel()
  44 + }).layoutWeight(1)
  45 + .textAlign(TextAlign.Center)
  46 + Divider()
  47 + .width("1lpx")
  48 + .strokeWidth('1lpx')
  49 + .vertical(true)
  50 + .height('92lpx')
  51 + .color($r('app.color.color_EEEEEE'))
  52 +
  53 + Text(this.rightText)
  54 + .fontSize('35lpx')
  55 + .textAlign(TextAlign.Center)
  56 + .fontWeight('400lpx')
  57 + .fontColor($r('app.color.color_648DF2'))
  58 + .onClick(() => {
  59 + if (this.controller != undefined) {
  60 + this.controller.close()
  61 + this.confirm()
  62 + }
  63 + }).layoutWeight(1)
  64 + }
  65 + .alignItems(VerticalAlign.Center)
  66 + .height('96lpx')
  67 + }.borderRadius(10)
  68 + }
  69 +}
@@ -20,6 +20,7 @@ import { OtherUserCommentListRequestItem } from '../viewmodel/OtherUserCommentLi @@ -20,6 +20,7 @@ import { OtherUserCommentListRequestItem } from '../viewmodel/OtherUserCommentLi
20 import { OtherUserCommentLikeStatusRequestItem } from '../viewmodel/OtherUserCommentLikeStatusRequestItem'; 20 import { OtherUserCommentLikeStatusRequestItem } from '../viewmodel/OtherUserCommentLikeStatusRequestItem';
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 { AppointmentOperationRequestItem } from '../viewmodel/AppointmentOperationRequestItem';
23 24
24 const TAG = "MinePageDatasModel" 25 const TAG = "MinePageDatasModel"
25 26
@@ -622,6 +623,47 @@ class MinePageDatasModel{ @@ -622,6 +623,47 @@ class MinePageDatasModel{
622 return compRes.data 623 return compRes.data
623 } 624 }
624 625
  626 + /**
  627 + * 预约 和取消预约操作
  628 + * @param params
  629 + * @param context
  630 + * @returns
  631 + */
  632 + getAppointmentOperation(params:AppointmentOperationRequestItem,context: Context): Promise<ResponseDTO> {
  633 + return new Promise((success, error) => {
  634 + Logger.info(TAG, `getAppointmentList start`);
  635 + this.fetchAppointmentOperation(params).then((navResDTO: ResponseDTO) => {
  636 + if (!navResDTO || navResDTO.code != 0) {
  637 + success(this.getAppointmentOperationLocal(context))
  638 + return
  639 + }
  640 + Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp);
  641 + success(navResDTO);
  642 + }).catch((err: Error) => {
  643 + Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`);
  644 + success(this.getAppointmentOperationLocal(context))
  645 + })
  646 + })
  647 + }
  648 +
  649 + fetchAppointmentOperation(object:AppointmentOperationRequestItem) {
  650 + let url = HttpUrlUtils.getAppointmentOperationUrl()
  651 + let headers: HashMap<string, string> = HttpUrlUtils.getYcgCommonHeaders();
  652 + return WDHttp.post<ResponseDTO>(url,object, headers)
  653 + };
  654 +
  655 + async getAppointmentOperationLocal(context: Context): Promise<ResponseDTO> {
  656 + Logger.info(TAG, `getMineFollowListDataLocal start`);
  657 + let compRes: ResponseDTO | null = await ResourcesUtils.getResourcesJson<ResponseDTO>(context,'appointment_operation_data.json');
  658 + if (!compRes ) {
  659 + Logger.info(TAG, `getMineFollowListDataLocal compRes is empty`);
  660 + return compRes
  661 + }
  662 + Logger.info(TAG, `getMineFollowListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`);
  663 + return compRes
  664 + }
  665 +
  666 +
625 667
626 } 668 }
627 669
@@ -185,10 +185,10 @@ struct MineHomePage { @@ -185,10 +185,10 @@ struct MineHomePage {
185 //tab 页面 185 //tab 页面
186 Tabs({controller: this.controller}) { 186 Tabs({controller: this.controller}) {
187 TabContent() { 187 TabContent() {
188 - HomePageBottomComponent({style:0}) 188 + HomePageBottomComponent({style:0,levelHead:this.levelHead})
189 }.tabBar(this.TabBuilder(0,"评论")) 189 }.tabBar(this.TabBuilder(0,"评论"))
190 TabContent() { 190 TabContent() {
191 - HomePageBottomComponent({style:1}) 191 + HomePageBottomComponent({style:1,levelHead:this.levelHead})
192 }.tabBar(this.TabBuilder(1,"关注")) 192 }.tabBar(this.TabBuilder(1,"关注"))
193 } 193 }
194 .backgroundColor($r('app.color.white')) 194 .backgroundColor($r('app.color.white'))
@@ -148,25 +148,25 @@ struct OtherNormalUserHomePage { @@ -148,25 +148,25 @@ struct OtherNormalUserHomePage {
148 .padding({ left: '35lpx' }) 148 .padding({ left: '35lpx' })
149 149
150 //用户简介区域 150 //用户简介区域
151 - Column() {  
152 - Row() {  
153 - Text(this.desc)  
154 - .fontSize('27lpx')  
155 - .maxLines(3)  
156 - .textOverflow({ overflow: TextOverflow.Ellipsis })  
157 - .lineHeight('40lpx')  
158 - .fontWeight('400lpx')  
159 - .fontColor($r('app.color.color_222222'))  
160 - .textAlign(TextAlign.Start)  
161 -  
162 - }  
163 - }.padding({ left: '31lpx',right:'31lpx',top:'19lpx',bottom:'31lpx'})  
164 - .alignItems(HorizontalAlign.Start)  
165 - .justifyContent(FlexAlign.Center)  
166 - .width('100%')  
167 - .backgroundColor($r('app.color.white'))  
168 - .visibility(StringUtils.isEmpty(this.desc)?Visibility.Hidden:Visibility.Visible) 151 + if(StringUtils.isNotEmpty(this.desc)){
  152 + Column() {
  153 + Row() {
  154 + Text(this.desc)
  155 + .fontSize('27lpx')
  156 + .maxLines(3)
  157 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  158 + .lineHeight('40lpx')
  159 + .fontWeight('400lpx')
  160 + .fontColor($r('app.color.color_222222'))
  161 + .textAlign(TextAlign.Start)
169 162
  163 + }
  164 + }.padding({ left: '31lpx',right:'31lpx',top:'19lpx',bottom:'31lpx'})
  165 + .alignItems(HorizontalAlign.Start)
  166 + .justifyContent(FlexAlign.Center)
  167 + .width('100%')
  168 + .backgroundColor($r('app.color.white'))
  169 + }
170 //间隔符 170 //间隔符
171 Divider().width('100%').height('12lpx').color($r('app.color.color_F5F5F5')).strokeWidth('12lpx') 171 Divider().width('100%').height('12lpx').color($r('app.color.color_F5F5F5')).strokeWidth('12lpx')
172 172
  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,8 +18,8 @@ export class MineAppointmentItem{ @@ -18,8 +18,8 @@ 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,appStyle?:string,liveId?:number,planStartTime?:string,  
22 - relId?:string,startTime?:string) { 21 + constructor(imageUrl:string[],status:string,title:string,isAppointment:boolean,timePre:string,timeBack:string,relType:number,liveId:number,
  22 + relId:string) {
23 this.imageUrl=imageUrl 23 this.imageUrl=imageUrl
24 this.status=status 24 this.status=status
25 this.title=title 25 this.title=title
@@ -27,5 +27,7 @@ export class MineAppointmentItem{ @@ -27,5 +27,7 @@ export class MineAppointmentItem{
27 this.timePre = timePre 27 this.timePre = timePre
28 this.timeBack = timeBack 28 this.timeBack = timeBack
29 this.relType = relType 29 this.relType = relType
  30 + this.liveId = liveId
  31 + this.relId = relId
30 } 32 }
31 } 33 }
@@ -119,6 +119,14 @@ @@ -119,6 +119,14 @@
119 { 119 {
120 "name": "color_99636363", 120 "name": "color_99636363",
121 "value": "#99636363" 121 "value": "#99636363"
  122 + },
  123 + {
  124 + "name":"color_648DF2",
  125 + "value": "#648DF2"
  126 + },
  127 + {
  128 + "name":"color_EEEEEE",
  129 + "value": "#EEEEEE"
122 } 130 }
123 ] 131 ]
124 } 132 }
  1 +{
  2 + "code": "0",
  3 + "message": "Success",
  4 + "requestId": "9a63f8f9e61d442880a7537763fd1769",
  5 + "success": true,
  6 + "timestamp": 1711589284588
  7 +}