zhenghy

Merge remote-tracking branch 'origin/main'

@@ -142,14 +142,22 @@ export struct DynamicDetailComponent { @@ -142,14 +142,22 @@ export struct DynamicDetailComponent {
142 .margin({right: $r('app.float.margin_6')}) 142 .margin({right: $r('app.float.margin_6')})
143 if(!StringUtils.isEmpty(this.followStatus)){ 143 if(!StringUtils.isEmpty(this.followStatus)){
144 if (this.followStatus == '0') { 144 if (this.followStatus == '0') {
145 - Text('+关注')  
146 - .width($r('app.float.margin_54'))  
147 - .height($r('app.float.margin_24')) 145 + Row() {
  146 + Blank().layoutWeight(1)
  147 + Image($r('app.media.icon_add_attention'))
  148 + .width($r('app.float.vp_12'))
  149 + .height($r('app.float.vp_12'))
  150 + .margin({right:2})
  151 + Text('关注')
148 .textAlign(TextAlign.Center) 152 .textAlign(TextAlign.Center)
149 .fontSize($r('app.float.font_size_12')) 153 .fontSize($r('app.float.font_size_12'))
  154 + .fontColor($r('app.color.color_fff'))
  155 + Blank().layoutWeight(1)
  156 + }
  157 + .width($r('app.float.margin_54'))
  158 + .height($r('app.float.margin_24'))
150 .borderRadius($r('app.float.vp_3')) 159 .borderRadius($r('app.float.vp_3'))
151 .backgroundColor($r('app.color.color_ED2800')) 160 .backgroundColor($r('app.color.color_ED2800'))
152 - .fontColor($r('app.color.color_fff'))  
153 .onClick(() => { 161 .onClick(() => {
154 this.handleAccention() 162 this.handleAccention()
155 }) 163 })
@@ -41,7 +41,7 @@ const TAG = 'OperRowListView'; @@ -41,7 +41,7 @@ const TAG = 'OperRowListView';
41 @Preview 41 @Preview
42 @Component 42 @Component
43 export struct OperRowListView { 43 export struct OperRowListView {
44 - @Prop contentDetailData: ContentDetailDTO // 稿件详情 44 + @Prop @Watch('onDetailUpdated') contentDetailData: ContentDetailDTO // 稿件详情
45 @State operationButtonList: string[] = ['comment', 'collect', 'share'] // 组件展示条件 45 @State operationButtonList: string[] = ['comment', 'collect', 'share'] // 组件展示条件
46 @ObjectLink publishCommentModel: publishCommentModel 46 @ObjectLink publishCommentModel: publishCommentModel
47 // @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO 47 // @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
@@ -52,7 +52,9 @@ export struct OperRowListView { @@ -52,7 +52,9 @@ export struct OperRowListView {
52 @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 52 @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
53 needLike: boolean = true 53 needLike: boolean = true
54 54
55 - async aboutToAppear() { 55 + // async aboutToAppear() {
  56 + async onDetailUpdated() {
  57 + if (!this.contentDetailData) return
56 const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') 58 const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
57 if (user_id) { 59 if (user_id) {
58 this.getInteractDataStatus() 60 this.getInteractDataStatus()
@@ -99,6 +101,7 @@ export struct OperRowListView { @@ -99,6 +101,7 @@ export struct OperRowListView {
99 }) 101 })
100 .width(42) 102 .width(42)
101 103
  104 + if (this.contentDetailData) {
102 ForEach(this.operationButtonList, (item: string, index: number) => { 105 ForEach(this.operationButtonList, (item: string, index: number) => {
103 if (item == 'comment') { 106 if (item == 'comment') {
104 this.builderComment() 107 this.builderComment()
@@ -114,6 +117,7 @@ export struct OperRowListView { @@ -114,6 +117,7 @@ export struct OperRowListView {
114 } 117 }
115 }) 118 })
116 } 119 }
  120 + }
117 .width('100%') 121 .width('100%')
118 .justifyContent(FlexAlign.Start) 122 .justifyContent(FlexAlign.Start)
119 } 123 }