Showing
2 changed files
with
12 additions
and
10 deletions
| @@ -25,7 +25,7 @@ export struct RmhTitle { | @@ -25,7 +25,7 @@ export struct RmhTitle { | ||
| 25 | /** | 25 | /** |
| 26 | * 默认未关注 点击去关注 | 26 | * 默认未关注 点击去关注 |
| 27 | */ | 27 | */ |
| 28 | - @State followStatus: String = '0'; | 28 | + @State followStatus: string = '0'; |
| 29 | 29 | ||
| 30 | /** | 30 | /** |
| 31 | * 关注号主 | 31 | * 关注号主 |
| @@ -45,7 +45,7 @@ export struct RmhTitle { | @@ -45,7 +45,7 @@ export struct RmhTitle { | ||
| 45 | status: this.followStatus == '0' ? 1 : 0, | 45 | status: this.followStatus == '0' ? 1 : 0, |
| 46 | } | 46 | } |
| 47 | ContentDetailRequest.postInteractAccentionOperate(params2).then(res => { | 47 | ContentDetailRequest.postInteractAccentionOperate(params2).then(res => { |
| 48 | - console.log('关注号主==', JSON.stringify(res.data)) | 48 | + console.log('rmhTitle-data', JSON.stringify(res.data)) |
| 49 | if (this.followStatus == '1') { | 49 | if (this.followStatus == '1') { |
| 50 | this.followStatus = '0' | 50 | this.followStatus = '0' |
| 51 | } else { | 51 | } else { |
| @@ -63,7 +63,7 @@ export struct RmhTitle { | @@ -63,7 +63,7 @@ export struct RmhTitle { | ||
| 63 | /** | 63 | /** |
| 64 | * 查询当前登录用户是否关注作品号主 | 64 | * 查询当前登录用户是否关注作品号主 |
| 65 | * */ | 65 | * */ |
| 66 | - private async getBatchAttentionStatus() { | 66 | + async getBatchAttentionStatus() { |
| 67 | try { | 67 | try { |
| 68 | const params: postBatchAttentionStatusParams = { | 68 | const params: postBatchAttentionStatusParams = { |
| 69 | creatorIds: [{ creatorId: this.rmhInfo?.rmhId ?? '' }] | 69 | creatorIds: [{ creatorId: this.rmhInfo?.rmhId ?? '' }] |
| @@ -72,17 +72,17 @@ export struct RmhTitle { | @@ -72,17 +72,17 @@ export struct RmhTitle { | ||
| 72 | this.followStatus = data[0]?.status; | 72 | this.followStatus = data[0]?.status; |
| 73 | Logger.info(`rmhTitle-followStatus:${JSON.stringify(this.followStatus)}`) | 73 | Logger.info(`rmhTitle-followStatus:${JSON.stringify(this.followStatus)}`) |
| 74 | } catch (exception) { | 74 | } catch (exception) { |
| 75 | - | 75 | + Logger.info(`rmhTitle-followStatus:${JSON.stringify(exception)}`) |
| 76 | } | 76 | } |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | aboutToAppear(): void { | 79 | aboutToAppear(): void { |
| 80 | + this.getBatchAttentionStatus() | ||
| 81 | + | ||
| 80 | let page = router.getState(); | 82 | let page = router.getState(); |
| 81 | if (page.path.includes('/page/PeopleShipHomePage') || page.path.includes('/pages/MainPage')) { | 83 | if (page.path.includes('/page/PeopleShipHomePage') || page.path.includes('/pages/MainPage')) { |
| 82 | this.hideTime = true; | 84 | this.hideTime = true; |
| 83 | } | 85 | } |
| 84 | - | ||
| 85 | - this.getBatchAttentionStatus() | ||
| 86 | } | 86 | } |
| 87 | 87 | ||
| 88 | getDaysBetweenDates(date: number) { | 88 | getDaysBetweenDates(date: number) { |
| @@ -143,13 +143,13 @@ export struct RmhTitle { | @@ -143,13 +143,13 @@ export struct RmhTitle { | ||
| 143 | Blank() | 143 | Blank() |
| 144 | if (this.rmhInfo.cnIsAttention) { | 144 | if (this.rmhInfo.cnIsAttention) { |
| 145 | Row() { | 145 | Row() { |
| 146 | - if (this.followStatus === '0') { | 146 | + if (Number(this.followStatus) === 0) { |
| 147 | Image($r('app.media.rmh_follow')) | 147 | Image($r('app.media.rmh_follow')) |
| 148 | .width(16) | 148 | .width(16) |
| 149 | .height(16) | 149 | .height(16) |
| 150 | } | 150 | } |
| 151 | 151 | ||
| 152 | - Text(this.followStatus === '0' ? '关注' : '已关注') | 152 | + Text(Number(this.followStatus) === 0 ? '关注' : '已关注') |
| 153 | .fontSize($r('app.float.font_size_13')) | 153 | .fontSize($r('app.float.font_size_13')) |
| 154 | .fontColor($r('app.color.color_ED2800')) | 154 | .fontColor($r('app.color.color_ED2800')) |
| 155 | } | 155 | } |
| @@ -22,7 +22,9 @@ const TAG = 'Zh_Single_Row-06' | @@ -22,7 +22,9 @@ const TAG = 'Zh_Single_Row-06' | ||
| 22 | @Component | 22 | @Component |
| 23 | export struct ZhSingleRow06 { | 23 | export struct ZhSingleRow06 { |
| 24 | @State compDTO: CompDTO = {} as CompDTO | 24 | @State compDTO: CompDTO = {} as CompDTO |
| 25 | - @State newsStatusOfUser: batchLikeAndCollectResult = {} as batchLikeAndCollectResult // 点赞、收藏状态 | 25 | + @State newsStatusOfUser: batchLikeAndCollectResult = { |
| 26 | + likeStatus: '0' | ||
| 27 | + } as batchLikeAndCollectResult // 点赞、收藏状态 | ||
| 26 | 28 | ||
| 27 | aboutToAppear(): void { | 29 | aboutToAppear(): void { |
| 28 | this.getInteractDataStatus() | 30 | this.getInteractDataStatus() |
| @@ -49,7 +51,7 @@ export struct ZhSingleRow06 { | @@ -49,7 +51,7 @@ export struct ZhSingleRow06 { | ||
| 49 | } | 51 | } |
| 50 | 52 | ||
| 51 | // 已登录->查询用户对作品点赞、收藏状态 | 53 | // 已登录->查询用户对作品点赞、收藏状态 |
| 52 | - private async getInteractDataStatus() { | 54 | + async getInteractDataStatus() { |
| 53 | // 未登录,跳转登录 | 55 | // 未登录,跳转登录 |
| 54 | const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') | 56 | const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') |
| 55 | if (!user_id) { | 57 | if (!user_id) { |
-
Please register or login to post a comment