wangliang_wd

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版本号
... ... @@ -2,8 +2,8 @@
"app": {
"bundleName": "com.peopledailychina.hosactivity",
"vendor": "$string:app_vendor",
"versionCode": 7399,
"versionName": "7.3.9.9",
"versionCode": 7401,
"versionName": "7.4.0.1",
"icon": "$media:app_icon",
"label": "$string:app_name"
}
... ...
import { CommonConstants, ViewType } from 'wdConstant';
import { BottomNavi, CommonConstants, ViewType } from 'wdConstant';
import { EmitterEventId, EmitterUtils, Logger, NetworkUtil } from 'wdKit';
import { EmptyComponent } from '../view/EmptyComponent';
import PageModel from '../../viewmodel/PageModel';
... ... @@ -43,7 +43,7 @@ export struct PageComponent {
// 国殇灰度管理
GrayManage: SubscribedAbstractProperty<GrayManageModel> = AppStorage.link<GrayManageModel>('GrayManage')
@State netStatus: number | undefined = undefined // 存储网络状态
isRMH:boolean = false
bottomNavi:BottomNavi = BottomNavi.NEWS
build() {
Column() {
... ... @@ -286,7 +286,7 @@ export struct PageComponent {
//人民号推荐 监听登录事件(刷新页面)
EmitterUtils.receiveEvent(EmitterEventId.LOGIN_SUCCESS, () => {
if(this.navIndex === this.currentTopNavSelectedIndex && this.isRMH){
if(this.navIndex === this.currentTopNavSelectedIndex && this.bottomNavi == BottomNavi.PEOPLE){
this.listScroller.scrollEdge(Edge.Top)
this.pageModel.viewType = ViewType.LOADING;
this.getData()
... ... @@ -298,6 +298,7 @@ export struct PageComponent {
onChange() {
// console.log(TAG, `onChangezz id: ${this.pageId} , ${this.channelId} , ${this.navIndex} , navIndex: ${this.currentTopNavSelectedIndex}`);
// 注册监听网络连接
if(this.bottomNavi == BottomNavi.VIDEO){
this.netStatus = undefined
let netStatus = NetworkUtil.isNetConnected()
if (netStatus) {
... ... @@ -311,6 +312,16 @@ export struct PageComponent {
} else {
this.pageModel.viewType = ViewType.NoNetwork;
}
}else{
if (this.navIndex === this.currentTopNavSelectedIndex) {
// console.log(TAG, 'page onAutoRefresh111 ' + this.needload)
if (this.needload) {
this.getData();
}
this.needload = false;
}
}
}
async onAutoRefresh() {
... ...
... ... @@ -15,6 +15,7 @@ import { GrayManageModel } from '../../viewmodel/GrayManageModel';
import { ColorUtils } from '../../utils/ColorUtils';
import { ImageKnifeComponent } from '@ohos/imageknife';
import { CommonUtils } from '../../utils/CommonUtils';
import { BottomNavi } from 'wdConstant';
const TAG = 'TopNavigationComponent';
... ... @@ -97,10 +98,10 @@ export struct TopNavigationComponentNew {
if (!this.isBroadcast(navItem) && !this.isLayout(navItem)) {
if (CompUtils.isNews(this.navItem)) {
this.createPageComponent(navItem, index,
(channelId) => this.GrayManage.get().isNewsMourning(channelId),false);
(channelId) => this.GrayManage.get().isNewsMourning(channelId),BottomNavi.NEWS);
} else if (CompUtils.isRMH(this.navItem)) {
this.createPageComponent(navItem, index,
(channelId) => this.GrayManage.get().isRmhMourning(channelId),true);
(channelId) => this.GrayManage.get().isRmhMourning(channelId),BottomNavi.PEOPLE);
}
} else {
... ... @@ -165,7 +166,7 @@ export struct TopNavigationComponentNew {
}
@Builder
createPageComponent(navItem: TopNavDTO, index: number, mourningCheckFn: (channelId: string) => boolean,isRMH:boolean = false) {
createPageComponent(navItem: TopNavDTO, index: number, mourningCheckFn: (channelId: string) => boolean,bottomNavi:BottomNavi = BottomNavi.NEWS) {
PageComponent({
currentTopNavSelectedIndex: this.currentTopNavSelectedIndex,
navIndex: index,
... ... @@ -173,7 +174,7 @@ export struct TopNavigationComponentNew {
channelId: navItem?.channelId + '',
autoRefresh: this.autoRefresh2Page,
isMourning: mourningCheckFn(`${navItem.channelId}`),
isRMH:isRMH
bottomNavi:bottomNavi
})
// .margin({
// left: 6,
... ...
import { GradeSpan } from './span/GradeSpan';
import { image } from '@kit.ImageKit';
import { LengthMetrics } from '@kit.ArkUI';
import { StringUtils } from 'wdKit';
@Component
export struct UserGradeTextSpan{
@Watch('contentChange') @Prop nameContent:string = ""
@Watch('contentChange') @Prop gradeContent:string = ""
@Watch('contentChange') @Prop gradeWidth:number = 50
taskId:number = -1
customSpan3: GradeSpan | undefined = undefined;
style1: MutableStyledString | undefined = undefined;
imagePixelMap: image.PixelMap | undefined = undefined;
textController: TextController = new TextController();
private async getPixmapFromMedia(resource: Resource) {
let unit8Array = await getContext(this)?.resourceManager?.getMediaContent({
bundleName: resource.bundleName,
moduleName: resource.moduleName,
id: resource.id
});
let imageSource = image.createImageSource(unit8Array.buffer.slice(0, unit8Array.buffer.byteLength));
let createPixelMap: image.PixelMap = await imageSource.createPixelMap({
desiredPixelFormat: image.PixelMapFormat.RGBA_8888,
desiredSize: { width: vp2px(this.gradeWidth), height: vp2px(18) }
});
await imageSource.release();
return createPixelMap;
}
contentChange(){
if(this.taskId != -1){
clearTimeout(this.taskId)
}
this.taskId = setTimeout(() => {
this.createSpan()
}, 100);
}
async createSpan(){
if(StringUtils.isEmpty(this.nameContent)){
return
}
this.imagePixelMap = await this.getPixmapFromMedia($r('app.media.my_grade_bg'))
this.customSpan3 = new GradeSpan(this.gradeContent, this.gradeWidth, 18,this.imagePixelMap);
this.style1 = new MutableStyledString(this.customSpan3);
let name:MutableStyledString = new MutableStyledString(this.nameContent, [
{
start: 0,
length: 100,
styledKey: StyledStringKey.FONT,
styledValue: new TextStyle({ fontColor: Color.White,fontWeight: 500,fontSize: LengthMetrics.px(vp2px(20)) })
}])
name.appendStyledString(new StyledString(this.customSpan3))
this.textController.setStyledString(name)
}
aboutToAppear() {
this.createSpan()
}
build() {
Text(undefined, { controller: this.textController })
.copyOption(CopyOptions.InApp)
.maxLines(2)
}
}
\ No newline at end of file
... ...
import { drawing } from '@kit.ArkGraphics2D';
import { image } from '@kit.ImageKit';
export class GradeSpan extends CustomSpan {
width: number = 160;
word: string = "";
height: number = 10;
imagePixelMap: image.PixelMap | undefined = undefined;
constructor(word: string, width: number, height: number,imagePixelMap: image.PixelMap) {
super();
this.word = word;
this.width = width;
this.height = height;
this.imagePixelMap = imagePixelMap;
}
onMeasure(measureInfo: CustomSpanMeasureInfo): CustomSpanMetrics {
return { width: this.width, height: this.height };
}
onDraw(context: DrawContext, options: CustomSpanDrawInfo) {
let canvas = context.canvas;
const brush = new drawing.Brush();
canvas.attachBrush(brush);
let options2 = new drawing.SamplingOptions(drawing.FilterMode.FILTER_MODE_NEAREST);
if (this.imagePixelMap) {
canvas.drawImage(this.imagePixelMap, options.x , options.lineBottom - vp2px(this.height) - 10, options2);
}
brush.setColor({ alpha: 255, red: 237, green: 40, blue: 0 });
canvas.attachBrush(brush);
const font = new drawing.Font();
font.setSize(vp2px(12));
const textBlob = drawing.TextBlob.makeFromString(this.word, font, drawing.TextEncoding.TEXT_ENCODING_UTF8);
// canvas.drawTextBlob(textBlob, options.x + 20, options.lineBottom - 15);
canvas.drawTextBlob(textBlob, options.x + vp2px(9), options.lineBottom - vp2px(7.5));
canvas.detachBrush();
}
setWord(word: string) {
this.word = word;
}
}
\ No newline at end of file
... ...
... ... @@ -8,6 +8,7 @@ import MinePageDatasModel from '../model/MinePageDatasModel';
import { EmptyComponent } from '../components/view/EmptyComponent';
import { CustomTitleUI } from '../components/reusable/CustomTitleUI';
import { TrackingPageBrowse, TrackConstants, TrackingButton, ParamType, Tracking } from 'wdTracking/Index';
import { UserGradeTextSpan } from '../components/view/UserGradeTextSpan';
const TAG = "MineHomePage"
... ... @@ -121,14 +122,11 @@ struct MineHomePage {
Column() {
Row() {
Text(`${this.userName}`)
.fontColor($r('app.color.white'))
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.fontSize(20)
.lineHeight(26)
.fontWeight(500)
.constraintSize({maxWidth:180})
UserGradeTextSpan({nameContent:`${this.userName}`,gradeContent:`等级${this.levelId}`,gradeWidth:this.levelId >9 ? 50 : 45})
}.constraintSize({maxWidth:`calc(100% - 16vp - 90vp)`})
.padding({top:8})
.onClick(()=>{
let params: editModelParams = {
editContent: this.userName
... ... @@ -136,23 +134,6 @@ struct MineHomePage {
WDRouterRule.jumpWithPage(WDRouterPage.editUserNikeNamePage,params)
})
if(this.levelId>0){
Text(`等级${this.levelId}`)
.fontColor($r('app.color.color_ED2800'))
.fontSize(12)
.lineHeight(18)
.fontWeight(500)
.margin({ left: 6 })
.backgroundImage($r("app.media.my_grade_bg"))
.backgroundImageSize(ImageSize.Cover)
.padding({left: 6,right: 6})
.height(18)
.borderRadius({topRight:2,bottomRight:2})
}
Blank()
}
Row() {
Row() {
Text(`${NumberFormatterUtils.formatNumberWithWan(this.browseNum)}`)
... ...
... ... @@ -5,7 +5,7 @@
import { BottomNavDTO, TopNavDTO } from 'wdBean/Index';
import { VideoChannelDetail } from 'wdDetailPlayShortVideo/Index';
import { WDRouterPage, WDRouterRule } from 'wdRouter';
import { DisplayDirection } from 'wdConstant/Index';
import { DisplayDirection ,BottomNavi} from 'wdConstant/Index';
import { CompUtils, GrayManageModel, PageComponent } from 'wdComponent/Index';
import { TrackingButton, TrackConstants } from 'wdTracking/Index';
import { ParamType, Tracking } from 'wdTracking/Index';
... ... @@ -335,6 +335,7 @@ export struct VideoChannelPage {
channelId: item.channelId + '',
autoRefresh: this.autoRefresh,
isMourning: this.GrayManage.get().isVideoMourning(`${item.channelId}`),
bottomNavi:BottomNavi.VIDEO
}).backgroundColor(Color.White)
}
... ...