Showing
3 changed files
with
42 additions
and
17 deletions
| @@ -279,6 +279,7 @@ export struct CommentComponent { | @@ -279,6 +279,7 @@ export struct CommentComponent { | ||
| 279 | 279 | ||
| 280 | if (commentListModel && commentListModel.list && commentListModel.list.length > 0) { | 280 | if (commentListModel && commentListModel.list && commentListModel.list.length > 0) { |
| 281 | 281 | ||
| 282 | + this.allDatas.clearAllData() // 防止数据重复问题 | ||
| 282 | commentListModel.list.forEach(element => { | 283 | commentListModel.list.forEach(element => { |
| 283 | element.hasMore = Number.parseInt(element.childCommentNum) ? true : false | 284 | element.hasMore = Number.parseInt(element.childCommentNum) ? true : false |
| 284 | let newModel = commentViewModel.deepCopyCommentItemModel(element) | 285 | let newModel = commentViewModel.deepCopyCommentItemModel(element) |
| 1 | -import { DisplayUtils, EmitterEventId, EmitterUtils } from 'wdKit/Index' | 1 | +import { DisplayUtils, EmitterEventId, EmitterUtils, ToastUtils } from 'wdKit/Index' |
| 2 | import { publishCommentModel } from '../model/PublishCommentModel' | 2 | import { publishCommentModel } from '../model/PublishCommentModel' |
| 3 | import { CommentCustomDialog } from './CommentCustomDialog' | 3 | import { CommentCustomDialog } from './CommentCustomDialog' |
| 4 | import measure from '@ohos.measure' | 4 | import measure from '@ohos.measure' |
| 5 | import { ContentDetailDTO } from 'wdBean/Index' | 5 | import { ContentDetailDTO } from 'wdBean/Index' |
| 6 | +import { HttpUtils } from 'wdNetwork/Index' | ||
| 7 | +import { WDRouterPage, WDRouterRule } from 'wdRouter/Index' | ||
| 6 | 8 | ||
| 7 | @Preview | 9 | @Preview |
| 8 | @Component | 10 | @Component |
| @@ -120,6 +122,21 @@ export struct CommentTabComponent { | @@ -120,6 +122,21 @@ export struct CommentTabComponent { | ||
| 120 | if(this.contentDetail.appstyle === 9) return | 122 | if(this.contentDetail.appstyle === 9) return |
| 121 | this.onCommentFocus && this.onCommentFocus() | 123 | this.onCommentFocus && this.onCommentFocus() |
| 122 | 124 | ||
| 125 | + // 未登录,游客评论未打开 则先登录 | ||
| 126 | + if (!HttpUtils.isLogin()) { | ||
| 127 | + if (this.contentDetail.visitorComment != 1) { | ||
| 128 | + WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | ||
| 129 | + return | ||
| 130 | + } | ||
| 131 | + } | ||
| 132 | + | ||
| 133 | + if (this.contentDetail.openComment != 1 && this.contentDetail.commentDisplay != 1) { | ||
| 134 | + ToastUtils.showToast("暂时无法评论", 3000) | ||
| 135 | + return | ||
| 136 | + } | ||
| 137 | + | ||
| 138 | + //TODO: 用户被禁言 也不能评论 | ||
| 139 | + | ||
| 123 | this.publishCommentModel.rootCommentId = '-1'; | 140 | this.publishCommentModel.rootCommentId = '-1'; |
| 124 | this.publishCommentModel.parentId = '-1'; | 141 | this.publishCommentModel.parentId = '-1'; |
| 125 | this.publishCommentModel.placeHolderText = "说两句..." | 142 | this.publishCommentModel.placeHolderText = "说两句..." |
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/QualityCommentsComponent.ets
| 1 | import { ViewType } from 'wdConstant/Index' | 1 | import { ViewType } from 'wdConstant/Index' |
| 2 | -import { DateTimeUtils, LazyDataSource, ToastUtils, WindowModel } from 'wdKit/Index' | 2 | +import { DateTimeUtils, LazyDataSource, Logger, ToastUtils, WindowModel } from 'wdKit/Index' |
| 3 | import { commentItemModel } from '../model/CommentModel' | 3 | import { commentItemModel } from '../model/CommentModel' |
| 4 | import commentViewModel from '../viewmodel/CommentViewModel' | 4 | import commentViewModel from '../viewmodel/CommentViewModel' |
| 5 | import { router, window } from '@kit.ArkUI' | 5 | import { router, window } from '@kit.ArkUI' |
| @@ -106,8 +106,13 @@ export struct QualityCommentsComponent { | @@ -106,8 +106,13 @@ export struct QualityCommentsComponent { | ||
| 106 | // .aspectRatio(375 / 283); | 106 | // .aspectRatio(375 / 283); |
| 107 | } | 107 | } |
| 108 | .onAreaChange((oldValue: Area, newValue: Area) => { | 108 | .onAreaChange((oldValue: Area, newValue: Area) => { |
| 109 | - | ||
| 110 | - let persent = Math.abs(Number(newValue.globalPosition.y)) / 150 | 109 | + if (Number(oldValue.globalPosition.y) == 0 && Number(newValue.globalPosition.y) > 30) { |
| 110 | + this.firstPositionY = Number(newValue.globalPosition.y) | ||
| 111 | + return | ||
| 112 | + } | ||
| 113 | + Logger.debug(TAG, "oldValue.globalPosition.y : " + oldValue.globalPosition.y) | ||
| 114 | + Logger.debug(TAG, "newValue.globalPosition.y : " + newValue.globalPosition.y + `,this.topSafeHeight : ` + this.topSafeHeight) | ||
| 115 | + let persent = Math.abs(Number(newValue.globalPosition.y) - this.firstPositionY ) / 150 //- this.topSafeHeight) / 283 | ||
| 111 | if (persent > 1) { | 116 | if (persent > 1) { |
| 112 | persent = 1 | 117 | persent = 1 |
| 113 | } | 118 | } |
| @@ -130,16 +135,17 @@ export struct QualityCommentsComponent { | @@ -130,16 +135,17 @@ export struct QualityCommentsComponent { | ||
| 130 | center: { anchor: "__container__", align: VerticalAlign.Center }, | 135 | center: { anchor: "__container__", align: VerticalAlign.Center }, |
| 131 | left: { anchor: "__container__", align: HorizontalAlign.Start } | 136 | left: { anchor: "__container__", align: HorizontalAlign.Start } |
| 132 | }) | 137 | }) |
| 133 | - .offset({ | ||
| 134 | - y: (this.topSafeHeight / 2) + 'px' | ||
| 135 | - }) | 138 | + // .offset({ |
| 139 | + // y: (this.topSafeHeight / 2) + 'px' | ||
| 140 | + // }) | ||
| 136 | .margin({ left: 16 }) | 141 | .margin({ left: 16 }) |
| 137 | .onClick(() => { | 142 | .onClick(() => { |
| 138 | router.back() | 143 | router.back() |
| 139 | }) | 144 | }) |
| 140 | } | 145 | } |
| 141 | .visibility(this.tileOpacity > 0 ? 1 : 0) | 146 | .visibility(this.tileOpacity > 0 ? 1 : 0) |
| 142 | - .height(this.topSafeHeight + vp2px(44) + 'px') | 147 | + // .height(this.topSafeHeight + vp2px(44) + 'px') |
| 148 | + .height(44) | ||
| 143 | .width('100%') | 149 | .width('100%') |
| 144 | .backgroundColor($r('app.color.color_transparent')) | 150 | .backgroundColor($r('app.color.color_transparent')) |
| 145 | .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP]) | 151 | .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP]) |
| @@ -159,9 +165,9 @@ export struct QualityCommentsComponent { | @@ -159,9 +165,9 @@ export struct QualityCommentsComponent { | ||
| 159 | center: { anchor: "__container__", align: VerticalAlign.Center }, | 165 | center: { anchor: "__container__", align: VerticalAlign.Center }, |
| 160 | left: { anchor: "__container__", align: HorizontalAlign.Start } | 166 | left: { anchor: "__container__", align: HorizontalAlign.Start } |
| 161 | }) | 167 | }) |
| 162 | - .offset({ | ||
| 163 | - y: (this.topSafeHeight / 2) + 'px' | ||
| 164 | - }) | 168 | + // .offset({ |
| 169 | + // y: (this.topSafeHeight / 2) + 'px' | ||
| 170 | + // }) | ||
| 165 | .margin({ left: 16 }) | 171 | .margin({ left: 16 }) |
| 166 | .onClick(() => { | 172 | .onClick(() => { |
| 167 | router.back() | 173 | router.back() |
| @@ -178,16 +184,17 @@ export struct QualityCommentsComponent { | @@ -178,16 +184,17 @@ export struct QualityCommentsComponent { | ||
| 178 | center: { anchor: "__container__", align: VerticalAlign.Center }, | 184 | center: { anchor: "__container__", align: VerticalAlign.Center }, |
| 179 | middle: { anchor: "__container__", align: HorizontalAlign.Center } | 185 | middle: { anchor: "__container__", align: HorizontalAlign.Center } |
| 180 | }) | 186 | }) |
| 181 | - .offset({ | ||
| 182 | - y: (this.topSafeHeight / 2) + 'px' | ||
| 183 | - }) | 187 | + // .offset({ |
| 188 | + // y: (this.topSafeHeight / 2) + 'px' | ||
| 189 | + // }) | ||
| 184 | } | 190 | } |
| 185 | .visibility(this.tileOpacity > 0 ? 0 : 1) | 191 | .visibility(this.tileOpacity > 0 ? 0 : 1) |
| 186 | .opacity(this.tileOpacity) | 192 | .opacity(this.tileOpacity) |
| 187 | - .height(this.topSafeHeight + vp2px(44) + 'px') | 193 | + // .height(this.topSafeHeight + vp2px(44) + 'px') |
| 194 | + .height(44) | ||
| 188 | .width('100%') | 195 | .width('100%') |
| 189 | .backgroundColor($r('app.color.white')) | 196 | .backgroundColor($r('app.color.white')) |
| 190 | - .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP]) | 197 | + // .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP]) |
| 191 | } | 198 | } |
| 192 | 199 | ||
| 193 | build() { | 200 | build() { |
| @@ -212,7 +219,7 @@ export struct QualityCommentsComponent { | @@ -212,7 +219,7 @@ export struct QualityCommentsComponent { | ||
| 212 | .friction(0.6) | 219 | .friction(0.6) |
| 213 | .scrollBar(BarState.Off) | 220 | .scrollBar(BarState.Off) |
| 214 | .edgeEffect(EdgeEffect.None) | 221 | .edgeEffect(EdgeEffect.None) |
| 215 | - .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) | 222 | + // .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) |
| 216 | 223 | ||
| 217 | this.TabbarTransparent() | 224 | this.TabbarTransparent() |
| 218 | this.TabbarNormal() | 225 | this.TabbarNormal() |
-
Please register or login to post a comment