Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool into main
* 'main' of http://192.168.1.42/developOne/harmonyPool: fix |> 20568 【依赖华为】我的评论列表中,上方展示的昵称,换行比安卓早,并且等级的位置展示不正确 fix |> 频道页已加载的稿件,断网后,切换至其他频道再返回不能展示数据 ref |> 更新App版本号
Showing
7 changed files
with
165 additions
and
45 deletions
| @@ -2,8 +2,8 @@ | @@ -2,8 +2,8 @@ | ||
| 2 | "app": { | 2 | "app": { |
| 3 | "bundleName": "com.peopledailychina.hosactivity", | 3 | "bundleName": "com.peopledailychina.hosactivity", |
| 4 | "vendor": "$string:app_vendor", | 4 | "vendor": "$string:app_vendor", |
| 5 | - "versionCode": 7399, | ||
| 6 | - "versionName": "7.3.9.9", | 5 | + "versionCode": 7401, |
| 6 | + "versionName": "7.4.0.1", | ||
| 7 | "icon": "$media:app_icon", | 7 | "icon": "$media:app_icon", |
| 8 | "label": "$string:app_name" | 8 | "label": "$string:app_name" |
| 9 | } | 9 | } |
| 1 | -import { CommonConstants, ViewType } from 'wdConstant'; | 1 | +import { BottomNavi, CommonConstants, ViewType } from 'wdConstant'; |
| 2 | import { EmitterEventId, EmitterUtils, Logger, NetworkUtil } from 'wdKit'; | 2 | import { EmitterEventId, EmitterUtils, Logger, NetworkUtil } from 'wdKit'; |
| 3 | import { EmptyComponent } from '../view/EmptyComponent'; | 3 | import { EmptyComponent } from '../view/EmptyComponent'; |
| 4 | import PageModel from '../../viewmodel/PageModel'; | 4 | import PageModel from '../../viewmodel/PageModel'; |
| @@ -43,7 +43,7 @@ export struct PageComponent { | @@ -43,7 +43,7 @@ export struct PageComponent { | ||
| 43 | // 国殇灰度管理 | 43 | // 国殇灰度管理 |
| 44 | GrayManage: SubscribedAbstractProperty<GrayManageModel> = AppStorage.link<GrayManageModel>('GrayManage') | 44 | GrayManage: SubscribedAbstractProperty<GrayManageModel> = AppStorage.link<GrayManageModel>('GrayManage') |
| 45 | @State netStatus: number | undefined = undefined // 存储网络状态 | 45 | @State netStatus: number | undefined = undefined // 存储网络状态 |
| 46 | - isRMH:boolean = false | 46 | + bottomNavi:BottomNavi = BottomNavi.NEWS |
| 47 | 47 | ||
| 48 | build() { | 48 | build() { |
| 49 | Column() { | 49 | Column() { |
| @@ -286,7 +286,7 @@ export struct PageComponent { | @@ -286,7 +286,7 @@ export struct PageComponent { | ||
| 286 | 286 | ||
| 287 | //人民号推荐 监听登录事件(刷新页面) | 287 | //人民号推荐 监听登录事件(刷新页面) |
| 288 | EmitterUtils.receiveEvent(EmitterEventId.LOGIN_SUCCESS, () => { | 288 | EmitterUtils.receiveEvent(EmitterEventId.LOGIN_SUCCESS, () => { |
| 289 | - if(this.navIndex === this.currentTopNavSelectedIndex && this.isRMH){ | 289 | + if(this.navIndex === this.currentTopNavSelectedIndex && this.bottomNavi == BottomNavi.PEOPLE){ |
| 290 | this.listScroller.scrollEdge(Edge.Top) | 290 | this.listScroller.scrollEdge(Edge.Top) |
| 291 | this.pageModel.viewType = ViewType.LOADING; | 291 | this.pageModel.viewType = ViewType.LOADING; |
| 292 | this.getData() | 292 | this.getData() |
| @@ -298,9 +298,21 @@ export struct PageComponent { | @@ -298,9 +298,21 @@ export struct PageComponent { | ||
| 298 | onChange() { | 298 | onChange() { |
| 299 | // console.log(TAG, `onChangezz id: ${this.pageId} , ${this.channelId} , ${this.navIndex} , navIndex: ${this.currentTopNavSelectedIndex}`); | 299 | // console.log(TAG, `onChangezz id: ${this.pageId} , ${this.channelId} , ${this.navIndex} , navIndex: ${this.currentTopNavSelectedIndex}`); |
| 300 | // 注册监听网络连接 | 300 | // 注册监听网络连接 |
| 301 | - this.netStatus = undefined | ||
| 302 | - let netStatus = NetworkUtil.isNetConnected() | ||
| 303 | - if (netStatus) { | 301 | + if(this.bottomNavi == BottomNavi.VIDEO){ |
| 302 | + this.netStatus = undefined | ||
| 303 | + let netStatus = NetworkUtil.isNetConnected() | ||
| 304 | + if (netStatus) { | ||
| 305 | + if (this.navIndex === this.currentTopNavSelectedIndex) { | ||
| 306 | + // console.log(TAG, 'page onAutoRefresh111 ' + this.needload) | ||
| 307 | + if (this.needload) { | ||
| 308 | + this.getData(); | ||
| 309 | + } | ||
| 310 | + this.needload = false; | ||
| 311 | + } | ||
| 312 | + } else { | ||
| 313 | + this.pageModel.viewType = ViewType.NoNetwork; | ||
| 314 | + } | ||
| 315 | + }else{ | ||
| 304 | if (this.navIndex === this.currentTopNavSelectedIndex) { | 316 | if (this.navIndex === this.currentTopNavSelectedIndex) { |
| 305 | // console.log(TAG, 'page onAutoRefresh111 ' + this.needload) | 317 | // console.log(TAG, 'page onAutoRefresh111 ' + this.needload) |
| 306 | if (this.needload) { | 318 | if (this.needload) { |
| @@ -308,9 +320,8 @@ export struct PageComponent { | @@ -308,9 +320,8 @@ export struct PageComponent { | ||
| 308 | } | 320 | } |
| 309 | this.needload = false; | 321 | this.needload = false; |
| 310 | } | 322 | } |
| 311 | - } else { | ||
| 312 | - this.pageModel.viewType = ViewType.NoNetwork; | ||
| 313 | } | 323 | } |
| 324 | + | ||
| 314 | } | 325 | } |
| 315 | 326 | ||
| 316 | async onAutoRefresh() { | 327 | async onAutoRefresh() { |
| @@ -15,6 +15,7 @@ import { GrayManageModel } from '../../viewmodel/GrayManageModel'; | @@ -15,6 +15,7 @@ import { GrayManageModel } from '../../viewmodel/GrayManageModel'; | ||
| 15 | import { ColorUtils } from '../../utils/ColorUtils'; | 15 | import { ColorUtils } from '../../utils/ColorUtils'; |
| 16 | import { ImageKnifeComponent } from '@ohos/imageknife'; | 16 | import { ImageKnifeComponent } from '@ohos/imageknife'; |
| 17 | import { CommonUtils } from '../../utils/CommonUtils'; | 17 | import { CommonUtils } from '../../utils/CommonUtils'; |
| 18 | +import { BottomNavi } from 'wdConstant'; | ||
| 18 | 19 | ||
| 19 | const TAG = 'TopNavigationComponent'; | 20 | const TAG = 'TopNavigationComponent'; |
| 20 | 21 | ||
| @@ -97,10 +98,10 @@ export struct TopNavigationComponentNew { | @@ -97,10 +98,10 @@ export struct TopNavigationComponentNew { | ||
| 97 | if (!this.isBroadcast(navItem) && !this.isLayout(navItem)) { | 98 | if (!this.isBroadcast(navItem) && !this.isLayout(navItem)) { |
| 98 | if (CompUtils.isNews(this.navItem)) { | 99 | if (CompUtils.isNews(this.navItem)) { |
| 99 | this.createPageComponent(navItem, index, | 100 | this.createPageComponent(navItem, index, |
| 100 | - (channelId) => this.GrayManage.get().isNewsMourning(channelId),false); | 101 | + (channelId) => this.GrayManage.get().isNewsMourning(channelId),BottomNavi.NEWS); |
| 101 | } else if (CompUtils.isRMH(this.navItem)) { | 102 | } else if (CompUtils.isRMH(this.navItem)) { |
| 102 | this.createPageComponent(navItem, index, | 103 | this.createPageComponent(navItem, index, |
| 103 | - (channelId) => this.GrayManage.get().isRmhMourning(channelId),true); | 104 | + (channelId) => this.GrayManage.get().isRmhMourning(channelId),BottomNavi.PEOPLE); |
| 104 | } | 105 | } |
| 105 | 106 | ||
| 106 | } else { | 107 | } else { |
| @@ -165,7 +166,7 @@ export struct TopNavigationComponentNew { | @@ -165,7 +166,7 @@ export struct TopNavigationComponentNew { | ||
| 165 | 166 | ||
| 166 | } | 167 | } |
| 167 | @Builder | 168 | @Builder |
| 168 | - createPageComponent(navItem: TopNavDTO, index: number, mourningCheckFn: (channelId: string) => boolean,isRMH:boolean = false) { | 169 | + createPageComponent(navItem: TopNavDTO, index: number, mourningCheckFn: (channelId: string) => boolean,bottomNavi:BottomNavi = BottomNavi.NEWS) { |
| 169 | PageComponent({ | 170 | PageComponent({ |
| 170 | currentTopNavSelectedIndex: this.currentTopNavSelectedIndex, | 171 | currentTopNavSelectedIndex: this.currentTopNavSelectedIndex, |
| 171 | navIndex: index, | 172 | navIndex: index, |
| @@ -173,7 +174,7 @@ export struct TopNavigationComponentNew { | @@ -173,7 +174,7 @@ export struct TopNavigationComponentNew { | ||
| 173 | channelId: navItem?.channelId + '', | 174 | channelId: navItem?.channelId + '', |
| 174 | autoRefresh: this.autoRefresh2Page, | 175 | autoRefresh: this.autoRefresh2Page, |
| 175 | isMourning: mourningCheckFn(`${navItem.channelId}`), | 176 | isMourning: mourningCheckFn(`${navItem.channelId}`), |
| 176 | - isRMH:isRMH | 177 | + bottomNavi:bottomNavi |
| 177 | }) | 178 | }) |
| 178 | // .margin({ | 179 | // .margin({ |
| 179 | // left: 6, | 180 | // left: 6, |
| 1 | +import { GradeSpan } from './span/GradeSpan'; | ||
| 2 | +import { image } from '@kit.ImageKit'; | ||
| 3 | +import { LengthMetrics } from '@kit.ArkUI'; | ||
| 4 | +import { StringUtils } from 'wdKit'; | ||
| 5 | + | ||
| 6 | +@Component | ||
| 7 | +export struct UserGradeTextSpan{ | ||
| 8 | + @Watch('contentChange') @Prop nameContent:string = "" | ||
| 9 | + @Watch('contentChange') @Prop gradeContent:string = "" | ||
| 10 | + @Watch('contentChange') @Prop gradeWidth:number = 50 | ||
| 11 | + | ||
| 12 | + taskId:number = -1 | ||
| 13 | + | ||
| 14 | + customSpan3: GradeSpan | undefined = undefined; | ||
| 15 | + style1: MutableStyledString | undefined = undefined; | ||
| 16 | + | ||
| 17 | + imagePixelMap: image.PixelMap | undefined = undefined; | ||
| 18 | + | ||
| 19 | + textController: TextController = new TextController(); | ||
| 20 | + | ||
| 21 | + private async getPixmapFromMedia(resource: Resource) { | ||
| 22 | + let unit8Array = await getContext(this)?.resourceManager?.getMediaContent({ | ||
| 23 | + bundleName: resource.bundleName, | ||
| 24 | + moduleName: resource.moduleName, | ||
| 25 | + id: resource.id | ||
| 26 | + }); | ||
| 27 | + let imageSource = image.createImageSource(unit8Array.buffer.slice(0, unit8Array.buffer.byteLength)); | ||
| 28 | + let createPixelMap: image.PixelMap = await imageSource.createPixelMap({ | ||
| 29 | + desiredPixelFormat: image.PixelMapFormat.RGBA_8888, | ||
| 30 | + desiredSize: { width: vp2px(this.gradeWidth), height: vp2px(18) } | ||
| 31 | + }); | ||
| 32 | + await imageSource.release(); | ||
| 33 | + return createPixelMap; | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + contentChange(){ | ||
| 37 | + if(this.taskId != -1){ | ||
| 38 | + clearTimeout(this.taskId) | ||
| 39 | + } | ||
| 40 | + this.taskId = setTimeout(() => { | ||
| 41 | + this.createSpan() | ||
| 42 | + }, 100); | ||
| 43 | + | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + async createSpan(){ | ||
| 47 | + if(StringUtils.isEmpty(this.nameContent)){ | ||
| 48 | + return | ||
| 49 | + } | ||
| 50 | + this.imagePixelMap = await this.getPixmapFromMedia($r('app.media.my_grade_bg')) | ||
| 51 | + this.customSpan3 = new GradeSpan(this.gradeContent, this.gradeWidth, 18,this.imagePixelMap); | ||
| 52 | + this.style1 = new MutableStyledString(this.customSpan3); | ||
| 53 | + | ||
| 54 | + let name:MutableStyledString = new MutableStyledString(this.nameContent, [ | ||
| 55 | + { | ||
| 56 | + start: 0, | ||
| 57 | + length: 100, | ||
| 58 | + styledKey: StyledStringKey.FONT, | ||
| 59 | + styledValue: new TextStyle({ fontColor: Color.White,fontWeight: 500,fontSize: LengthMetrics.px(vp2px(20)) }) | ||
| 60 | + }]) | ||
| 61 | + | ||
| 62 | + name.appendStyledString(new StyledString(this.customSpan3)) | ||
| 63 | + this.textController.setStyledString(name) | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + | ||
| 67 | + aboutToAppear() { | ||
| 68 | + this.createSpan() | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + build() { | ||
| 72 | + Text(undefined, { controller: this.textController }) | ||
| 73 | + .copyOption(CopyOptions.InApp) | ||
| 74 | + .maxLines(2) | ||
| 75 | + } | ||
| 76 | +} |
| 1 | +import { drawing } from '@kit.ArkGraphics2D'; | ||
| 2 | +import { image } from '@kit.ImageKit'; | ||
| 3 | + | ||
| 4 | +export class GradeSpan extends CustomSpan { | ||
| 5 | + width: number = 160; | ||
| 6 | + word: string = ""; | ||
| 7 | + height: number = 10; | ||
| 8 | + imagePixelMap: image.PixelMap | undefined = undefined; | ||
| 9 | + | ||
| 10 | + | ||
| 11 | + constructor(word: string, width: number, height: number,imagePixelMap: image.PixelMap) { | ||
| 12 | + super(); | ||
| 13 | + this.word = word; | ||
| 14 | + this.width = width; | ||
| 15 | + this.height = height; | ||
| 16 | + this.imagePixelMap = imagePixelMap; | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + onMeasure(measureInfo: CustomSpanMeasureInfo): CustomSpanMetrics { | ||
| 20 | + return { width: this.width, height: this.height }; | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + onDraw(context: DrawContext, options: CustomSpanDrawInfo) { | ||
| 24 | + let canvas = context.canvas; | ||
| 25 | + | ||
| 26 | + const brush = new drawing.Brush(); | ||
| 27 | + | ||
| 28 | + canvas.attachBrush(brush); | ||
| 29 | + let options2 = new drawing.SamplingOptions(drawing.FilterMode.FILTER_MODE_NEAREST); | ||
| 30 | + if (this.imagePixelMap) { | ||
| 31 | + canvas.drawImage(this.imagePixelMap, options.x , options.lineBottom - vp2px(this.height) - 10, options2); | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + brush.setColor({ alpha: 255, red: 237, green: 40, blue: 0 }); | ||
| 35 | + canvas.attachBrush(brush); | ||
| 36 | + | ||
| 37 | + const font = new drawing.Font(); | ||
| 38 | + font.setSize(vp2px(12)); | ||
| 39 | + const textBlob = drawing.TextBlob.makeFromString(this.word, font, drawing.TextEncoding.TEXT_ENCODING_UTF8); | ||
| 40 | + // canvas.drawTextBlob(textBlob, options.x + 20, options.lineBottom - 15); | ||
| 41 | + canvas.drawTextBlob(textBlob, options.x + vp2px(9), options.lineBottom - vp2px(7.5)); | ||
| 42 | + | ||
| 43 | + canvas.detachBrush(); | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + setWord(word: string) { | ||
| 47 | + this.word = word; | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | +} |
| @@ -8,6 +8,7 @@ import MinePageDatasModel from '../model/MinePageDatasModel'; | @@ -8,6 +8,7 @@ import MinePageDatasModel from '../model/MinePageDatasModel'; | ||
| 8 | import { EmptyComponent } from '../components/view/EmptyComponent'; | 8 | import { EmptyComponent } from '../components/view/EmptyComponent'; |
| 9 | import { CustomTitleUI } from '../components/reusable/CustomTitleUI'; | 9 | import { CustomTitleUI } from '../components/reusable/CustomTitleUI'; |
| 10 | import { TrackingPageBrowse, TrackConstants, TrackingButton, ParamType, Tracking } from 'wdTracking/Index'; | 10 | import { TrackingPageBrowse, TrackConstants, TrackingButton, ParamType, Tracking } from 'wdTracking/Index'; |
| 11 | +import { UserGradeTextSpan } from '../components/view/UserGradeTextSpan'; | ||
| 11 | 12 | ||
| 12 | const TAG = "MineHomePage" | 13 | const TAG = "MineHomePage" |
| 13 | 14 | ||
| @@ -121,37 +122,17 @@ struct MineHomePage { | @@ -121,37 +122,17 @@ struct MineHomePage { | ||
| 121 | 122 | ||
| 122 | Column() { | 123 | Column() { |
| 123 | Row() { | 124 | Row() { |
| 124 | - Text(`${this.userName}`) | ||
| 125 | - .fontColor($r('app.color.white')) | ||
| 126 | - .maxLines(2) | ||
| 127 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 128 | - .fontSize(20) | ||
| 129 | - .lineHeight(26) | ||
| 130 | - .fontWeight(500) | ||
| 131 | - .constraintSize({maxWidth:180}) | ||
| 132 | - .onClick(()=>{ | ||
| 133 | - let params: editModelParams = { | ||
| 134 | - editContent: this.userName | ||
| 135 | - } | ||
| 136 | - WDRouterRule.jumpWithPage(WDRouterPage.editUserNikeNamePage,params) | ||
| 137 | - }) | ||
| 138 | - | ||
| 139 | - if(this.levelId>0){ | ||
| 140 | - Text(`等级${this.levelId}`) | ||
| 141 | - .fontColor($r('app.color.color_ED2800')) | ||
| 142 | - .fontSize(12) | ||
| 143 | - .lineHeight(18) | ||
| 144 | - .fontWeight(500) | ||
| 145 | - .margin({ left: 6 }) | ||
| 146 | - .backgroundImage($r("app.media.my_grade_bg")) | ||
| 147 | - .backgroundImageSize(ImageSize.Cover) | ||
| 148 | - .padding({left: 6,right: 6}) | ||
| 149 | - .height(18) | ||
| 150 | - .borderRadius({topRight:2,bottomRight:2}) | ||
| 151 | - } | ||
| 152 | 125 | ||
| 153 | - Blank() | ||
| 154 | - } | 126 | + UserGradeTextSpan({nameContent:`${this.userName}`,gradeContent:`等级${this.levelId}`,gradeWidth:this.levelId >9 ? 50 : 45}) |
| 127 | + | ||
| 128 | + }.constraintSize({maxWidth:`calc(100% - 16vp - 90vp)`}) | ||
| 129 | + .padding({top:8}) | ||
| 130 | + .onClick(()=>{ | ||
| 131 | + let params: editModelParams = { | ||
| 132 | + editContent: this.userName | ||
| 133 | + } | ||
| 134 | + WDRouterRule.jumpWithPage(WDRouterPage.editUserNikeNamePage,params) | ||
| 135 | + }) | ||
| 155 | 136 | ||
| 156 | Row() { | 137 | Row() { |
| 157 | Row() { | 138 | Row() { |
| @@ -5,7 +5,7 @@ | @@ -5,7 +5,7 @@ | ||
| 5 | import { BottomNavDTO, TopNavDTO } from 'wdBean/Index'; | 5 | import { BottomNavDTO, TopNavDTO } from 'wdBean/Index'; |
| 6 | import { VideoChannelDetail } from 'wdDetailPlayShortVideo/Index'; | 6 | import { VideoChannelDetail } from 'wdDetailPlayShortVideo/Index'; |
| 7 | import { WDRouterPage, WDRouterRule } from 'wdRouter'; | 7 | import { WDRouterPage, WDRouterRule } from 'wdRouter'; |
| 8 | -import { DisplayDirection } from 'wdConstant/Index'; | 8 | +import { DisplayDirection ,BottomNavi} from 'wdConstant/Index'; |
| 9 | import { CompUtils, GrayManageModel, PageComponent } from 'wdComponent/Index'; | 9 | import { CompUtils, GrayManageModel, PageComponent } from 'wdComponent/Index'; |
| 10 | import { TrackingButton, TrackConstants } from 'wdTracking/Index'; | 10 | import { TrackingButton, TrackConstants } from 'wdTracking/Index'; |
| 11 | import { ParamType, Tracking } from 'wdTracking/Index'; | 11 | import { ParamType, Tracking } from 'wdTracking/Index'; |
| @@ -335,6 +335,7 @@ export struct VideoChannelPage { | @@ -335,6 +335,7 @@ export struct VideoChannelPage { | ||
| 335 | channelId: item.channelId + '', | 335 | channelId: item.channelId + '', |
| 336 | autoRefresh: this.autoRefresh, | 336 | autoRefresh: this.autoRefresh, |
| 337 | isMourning: this.GrayManage.get().isVideoMourning(`${item.channelId}`), | 337 | isMourning: this.GrayManage.get().isVideoMourning(`${item.channelId}`), |
| 338 | + bottomNavi:BottomNavi.VIDEO | ||
| 338 | }).backgroundColor(Color.White) | 339 | }).backgroundColor(Color.White) |
| 339 | } | 340 | } |
| 340 | 341 |
-
Please register or login to post a comment