zhenghy

Merge remote-tracking branch 'origin/main'

@@ -142,15 +142,23 @@ export struct DynamicDetailComponent { @@ -142,15 +142,23 @@ 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'))  
148 - .textAlign(TextAlign.Center)  
149 - .fontSize($r('app.float.font_size_12'))  
150 - .borderRadius($r('app.float.vp_3'))  
151 - .backgroundColor($r('app.color.color_ED2800'))  
152 - .fontColor($r('app.color.color_fff'))  
153 - .onClick(() => { 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('关注')
  152 + .textAlign(TextAlign.Center)
  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'))
  159 + .borderRadius($r('app.float.vp_3'))
  160 + .backgroundColor($r('app.color.color_ED2800'))
  161 + .onClick(() => {
154 this.handleAccention() 162 this.handleAccention()
155 }) 163 })
156 } else { 164 } else {
@@ -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,20 +101,22 @@ export struct OperRowListView { @@ -99,20 +101,22 @@ export struct OperRowListView {
99 }) 101 })
100 .width(42) 102 .width(42)
101 103
102 - ForEach(this.operationButtonList, (item: string, index: number) => {  
103 - if (item == 'comment') {  
104 - this.builderComment()  
105 - } else if (item == 'like' && this.needLike) {  
106 - this.builderLike()  
107 - } else if (item == 'collect') {  
108 - this.builderCollect()  
109 - } else if (item == 'listen') {  
110 - this.builderListen()  
111 - } else if (item == 'share') {  
112 - this.builderShare()  
113 - } else {  
114 - }  
115 - }) 104 + if (this.contentDetailData) {
  105 + ForEach(this.operationButtonList, (item: string, index: number) => {
  106 + if (item == 'comment') {
  107 + this.builderComment()
  108 + } else if (item == 'like' && this.needLike) {
  109 + this.builderLike()
  110 + } else if (item == 'collect') {
  111 + this.builderCollect()
  112 + } else if (item == 'listen') {
  113 + this.builderListen()
  114 + } else if (item == 'share') {
  115 + this.builderShare()
  116 + } else {
  117 + }
  118 + })
  119 + }
116 } 120 }
117 .width('100%') 121 .width('100%')
118 .justifyContent(FlexAlign.Start) 122 .justifyContent(FlexAlign.Start)