张善主

Merge remote-tracking branch 'origin/main'

Showing 19 changed files with 276 additions and 106 deletions
// import { FrontLinkObject, MorningEveningPaperDTO, PageInfoBean } from 'wdBean';
import { CompList, PageInfoBean } from 'wdBean';
import { DateTimeUtils, Logger, SPHelper } from 'wdKit/Index';
import { DateTimeUtils, Logger, SPHelper, WindowModel } from 'wdKit/Index';
import { PaperReaderSimpleDialog } from '../../dialog/PaperReaderDialog';
import { MorningEveningViewModel } from '../../viewmodel/MorningEveningViewModel';
// import { AudioBarView } from './AudioBarView';
... ... @@ -102,6 +102,7 @@ export struct MorningEveningPaperComponent {
async aboutToAppear() {
let windowHight: window.Window = await window.getLastWindow(getContext(this));
await windowHight.setWindowLayoutFullScreen(true);
WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff', })
this.topSafeHeight = px2vp(windowHight.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).topRect.height)
let dailyPaperTopicPageId = await SPHelper.default.getSync('dailyPaperTopicPageId', "") as String
... ... @@ -173,6 +174,7 @@ export struct MorningEveningPaperComponent {
async aboutToDisappear() {
let windowHight: window.Window = await window.getLastWindow(getContext(this));
await windowHight.setWindowLayoutFullScreen(false);
WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', })
}
onPageHide() {
... ...
... ... @@ -34,7 +34,7 @@ export struct PaperTitleComponent {
Text(this.subTitle ?? '')// Text('2024年\n1月16日')
// .width(50)
.margin({ left: 5 })
.fontSize(12)
.fontSize(8)
.fontColor($r('app.color.white'))
.maxLines(2)
... ... @@ -47,7 +47,8 @@ export struct PaperTitleComponent {
.alignItems(VerticalAlign.Center)
.alignRules({
left: { anchor: "img_logo1", align: HorizontalAlign.End },
center: { anchor: "__container__", align: VerticalAlign.Center } })
center: { anchor: "__container__", align: VerticalAlign.Center }
})
.id('row_paper_date')
Image($r('app.media.icon_close'))
... ... @@ -55,7 +56,8 @@ export struct PaperTitleComponent {
.width($r('app.float.top_arrow_size'))
.alignRules({
right: { anchor: "__container__", align: HorizontalAlign.End },
center: { anchor: "__container__", align: VerticalAlign.Center } })
center: { anchor: "__container__", align: VerticalAlign.Center }
})
.id('img_close')
.onClick((event: ClickEvent) => {
// console.info(TAG, "img_close")
... ... @@ -68,11 +70,12 @@ export struct PaperTitleComponent {
.width($r('app.float.top_arrow_size'))
.alignRules({
right: { anchor: "img_close", align: HorizontalAlign.Start },
center: { anchor: "__container__", align: VerticalAlign.Center } })
center: { anchor: "__container__", align: VerticalAlign.Center }
})
.id('img_share')
.margin({ right: 13 })
}
// .margin({ left: 14, right: 14 })
.margin({ left: 14, right: 14 })
.height($r('app.float.top_bar_height'))
// .backgroundColor(Color.Black)
... ...
... ... @@ -5,7 +5,8 @@ import {
PhotoListBean,
postInteractBrowsOperateParams,
postBatchAttentionStatusParams,
postInteractAccentionOperateParams
postInteractAccentionOperateParams,
Params
} from 'wdBean';
import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
import display from '@ohos.display';
... ... @@ -44,6 +45,7 @@ export struct MultiPictureDetailPageComponent {
@State netStatus: number | undefined = undefined // 存储网络状态用来展示缺省图
@State showDownload: Boolean = false // 控制是否显示下载默认隐藏
@State publishCommentModel: publishCommentModel = new publishCommentModel()
@State operationButtonList: string[] = ['comment', 'like', 'collect', 'share']
//watch监听页码回调
onCurrentPageNumUpdated(): void {
... ... @@ -98,19 +100,31 @@ export struct MultiPictureDetailPageComponent {
if (this.contentDetailData.rmhPlatform == 1) {
Row() {
Row({ space: 8 }) {
if (this.getImgUrl()){
Row() {
Image(this.contentDetailData?.rmhInfo?.rmhHeadUrl)
Image(this.getImgUrl())
.borderRadius(24)
.aspectRatio(1)
.border({ width: 1, color: Color.White, style: BorderStyle.Solid })
.alt($r('app.media.picture_loading'))
.width(36)
.height(36)
.objectFit(ImageFit.Fill)
.interpolation(ImageInterpolation.High)
.onClick(() => {
if (this.contentDetailData.rmhInfo?.cnMainControl === 1) {
// 号主页
const params: Params = {
creatorId: this.contentDetailData.rmhInfo.rmhId,
pageID: ''
}
WDRouterRule.jumpWithPage(WDRouterPage.peopleShipHomePage, params)
}
})
}
.width('13%')
.height('100%')
}
Row() {
Flex({
... ... @@ -190,6 +204,7 @@ export struct MultiPictureDetailPageComponent {
middle: { anchor: "__container__", align: HorizontalAlign.Center }
})
.id('e_attention')
.visibility(!this.showDownload ? Visibility.Visible : Visibility.None)
}
if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length > 0) {
Swiper(this.swiperController) {
... ... @@ -305,10 +320,8 @@ export struct MultiPictureDetailPageComponent {
OperRowListView({
contentDetailData: this.contentDetailData,
publishCommentModel: this.publishCommentModel,
operationButtonList: this.operationButtonList,
})
.width('100%')
.height(56)
.border({ width: { top: 0.5 }, color: '#FFFFFF' })
}
.visibility(!this.showDownload ? Visibility.Visible : Visibility.None)
Column(){
... ... @@ -385,6 +398,7 @@ export struct MultiPictureDetailPageComponent {
if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length === 0) {
// 暂无内容
this.netStatus = 0
this.operationButtonList = []
Logger.info(TAG, `this.netStatus:${JSON.stringify(this.netStatus)}`)
}
Logger.info(TAG, `contentDetailData:${JSON.stringify(this.contentDetailData)}`)
... ... @@ -399,12 +413,17 @@ export struct MultiPictureDetailPageComponent {
Logger.info(TAG, `fetchDetailData then,err: ${JSON.stringify(err)}`);
// 内容获取失败
this.netStatus = 9
this.operationButtonList = []
})
} catch (exception) {
}
}
getImgUrl() {
return this.contentDetailData?.rmhInfo?.rmhHeadUrl || this.contentDetailData?.userInfo?.userHeadUrl
}
// 记录浏览历史
private getInteractBrowsOperate() {
try {
... ...
... ... @@ -31,6 +31,7 @@ export struct RmhTitle {
.fontColor($r('app.color.color_222222'))
.fontWeight(600)
.alignSelf(ItemAlign.Start)
Flex({alignContent: FlexAlign.Start, wrap: FlexWrap.NoWrap}) {
Row() {
if (this.publishTime) {
Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.publishTime)))
... ... @@ -46,6 +47,9 @@ export struct RmhTitle {
.maxLines(1)
.alignSelf(ItemAlign.Start)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.textAlign(TextAlign.Start)
}
.width('75%')
}
}
... ...
... ... @@ -4,6 +4,7 @@ import { postInteractAccentionOperateParams } from 'wdBean';
import { PageRepository } from '../../repository/PageRepository';
import { ProcessUtils } from 'wdRouter';
import { HttpUtils } from 'wdNetwork/Index';
import { DateTimeUtils } from 'wdKit';
/**
* 直播预约卡
... ... @@ -17,6 +18,22 @@ export struct ZhSingleRow03 {
@State compDTO: CompDTO = {} as CompDTO
scroller: Scroller = new Scroller()
format(timeNum: number) {
const todayDate = new Date().setHours(0,0,0,0)
const parseDate = new Date(timeNum).setHours(0,0,0,0);
if (todayDate === parseDate) {
return '今天'
} else { const str = DateTimeUtils.formatDate(timeNum, 'MM月dd日')
const month: string = str.split('月')[0];
if (month[0] === "0") {
return str.slice(1)
} else {
return str.slice(0)
}
}
}
build() {
Column() {
//顶部
... ... @@ -42,7 +59,8 @@ export struct ZhSingleRow03 {
Row() {
Flex({justifyContent: FlexAlign.SpaceBetween}){
Row() {
Text(item.liveInfo.liveStartTime.split(' ')[0].slice(5).split('-').join('月')+'日')
Text(this.format(new Date(item.liveInfo.liveStartTime).getTime()))
// Text(item.liveInfo.liveStartTime.split(' ')[0].slice(5).split('-').join('月')+'日')
.margin({right: 6})
.fontColor(0x000000)
.fontSize(13)
... ... @@ -106,7 +124,7 @@ export struct ZhSingleRow03 {
.width(3)
.height(16)
.margin({ right: 4 })
Text('直播预')
Text('直播预')
.fontSize($r("app.float.font_size_17"))
.fontColor($r("app.color.color_222222"))
.fontWeight(600)
... ...
... ... @@ -324,6 +324,27 @@ export struct HomePageBottomComponent{
data.push(new CommentListItem(item.fromUserHeader,item.fromUserName,item.targetTitle,item.createTime,commentContent,item.likeNum,0,item.id,item.targetId,item.targetType,item.targetRelId,item.targetRelObjectId,item.targetRelType,item.targetStatus,item.checkStatus,parentCommentContent,parentCommentUserName))
})
if(status.commentIdList.length === 0){
data.forEach((item)=>{
let publishTime = DateTimeUtils.getCommentTime(DateTimeUtils.parseDate(item.createTime,DateTimeUtils.PATTERN_DATE_TIME_HYPHEN))
this.data_comment.push(new CommentListItem(item.fromUserHeader,item.fromUserName,item.targetTitle,publishTime,item.commentContent,item.likeNum,item.like_status,item.id,item.targetId,item.targetType,item.targetRelId,item.targetRelObjectId,item.targetRelType,item.targetStatus,item.checkStatus,item.parentCommentContent,item.parentCommentUserName))
})
this.data_comment.notifyDataReload()
this.count = this.data_comment.totalCount()
this.commentNum = value.totalCount
if (this.data_comment.totalCount() < value.totalCount) {
this.curPageNum++
}else {
this.hasMore = false
}
this.isLoading = false
this.isGetRequest = true
return
}
MinePageDatasModel.getOtherUserCommentLikeStatusData(status,getContext(this)).then((newValue)=>{
newValue.forEach((item)=>{
data.forEach((list)=>{
... ...
... ... @@ -139,6 +139,27 @@ export struct OtherHomePageBottomCommentComponent {
data.push(new CommentListItem(item.fromUserHeader, item.fromUserName, item.targetTitle, item.createTime, commentContent, item.likeNum, 0, item.id, item.targetId, item.targetType, item.targetRelId, item.targetRelObjectId, item.targetRelType, item.targetStatus, item.checkStatus, parentCommentContent, parentCommentUserName))
})
if(status.commentIdList.length === 0){
data.forEach((item) => {
this.data_comment.push(new CommentListItem(item.fromUserHeader, item.fromUserName, item.targetTitle, item.createTime, item.commentContent, item.likeNum, item.like_status, item.id, item.targetId, item.targetType, item.targetRelId, item.targetRelObjectId, item.targetRelType, item.targetStatus, item.checkStatus, item.parentCommentContent, item.parentCommentUserName))
})
this.data_comment.notifyDataReload()
this.count = this.data_comment.totalCount()
this.commentNum = value.totalCount
if (this.data_comment.totalCount() < value.totalCount) {
this.curPageNum++
} else {
this.hasMore = false
}
this.isLoading = false
this.isGetRequest = true
return
}
MinePageDatasModel.getOtherUserCommentLikeStatusData(status, getContext(this)).then((newValue) => {
newValue.forEach((item) => {
data.forEach((list) => {
... ...
... ... @@ -3,31 +3,29 @@ import { FollowListDetailItem } from '../../viewmodel/FollowListDetailItem';
@Component
export struct PeopleShipAttentionContentListHeadComponent {
@State index: number = 0
@ObjectLink item: FollowListDetailItem
build() {
Column(){
Column() {
// 头像
PeopleShipHomePageHeadComponent({
diameter: 48,
iconDiameter: 16,
headPhotoUrl: this.index == 0 ? $r('app.media.attention_mine') :
((this.item.attentionHeadPhotoUrl && this.item.attentionHeadPhotoUrl.length > 0) ?
this.item.attentionHeadPhotoUrl : $r('app.media.WDAccountOwnerHedaerDefaultIcon')),
authIcon: this.index == 0 ? '' : this.item.authIcon
headPhotoUrl: (this.item.attentionHeadPhotoUrl && this.item.attentionHeadPhotoUrl.length > 0) ?
this.item.attentionHeadPhotoUrl : $r('app.media.WDAccountOwnerHedaerDefaultIcon'),
authIcon: this.item.authIcon
}).margin({
bottom: '8vp'
})
Text(this.index == 0 ? '我的关注' : this.item.attentionUserName)
Text(this.item.attentionUserName)
.fontColor($r('app.color.color_666666'))
.fontSize($r('app.float.vp_13'))
.fontWeight(400)
.height('18vp')
.lineHeight('18vp')
.maxLines(1)
.textOverflow({overflow: TextOverflow.Ellipsis})
.textOverflow({ overflow: TextOverflow.Ellipsis })
.padding({
left: '2vp',
right: '2vp'
... ... @@ -36,7 +34,7 @@ export struct PeopleShipAttentionContentListHeadComponent {
.alignItems(HorizontalAlign.Center)
.width('78vp')
.margin({
left: this.index == 0 ? '8vp' : '4vp',
left: '4vp',
top: '14vp',
bottom: '14vp'
})
... ...
... ... @@ -6,37 +6,72 @@ import { PeopleShipAttentionContentListHeadComponent } from './PeopleShipAttenti
@Component
export struct PeopleShipAttentionContentListTopComponent {
@Prop followList: FollowListDetailItem[]
build() {
Column() {
List(){
List() {
ListItem() {
PeopleShipAttentionContentListHeadComponent({
index: 0,
item: this.followList[0]
})
this.PeopleShipFollowTop()
}.onClick(() => {
// 跳转到关注列表-我的
WDRouterRule.jumpWithPage(WDRouterPage.followListPage)
})
ForEach(this.followList, (item: FollowListDetailItem, index: number) => {
ForEach(this.followList, (item: FollowListDetailItem) => {
ListItem() {
PeopleShipAttentionContentListHeadComponent({
index: index + 1,
item: item
})
}.onClick(() => {
let creatorId = item.attentionCreatorId || ''
ProcessUtils.gotoPeopleShipHomePage(creatorId)
})
}, (item: FollowListDetailItem) => item.attentionCreatorId)
}, (item: FollowListDetailItem, index: number) => item.attentionCreatorId + index)
}
.listDirection(Axis.Horizontal)
.scrollBar(BarState.Off)
.width('100%')
.height('102vp')
Divider().strokeWidth(1).color($r('app.color.color_F5F5F5'))
}
}
@Builder
PeopleShipFollowTop() {
Column() {
// 头像
Image($r('app.media.attention_mine'))
.alt($r('app.media.attention_mine'))
.width(48)
.height(48)
.borderRadius(24)
.objectFit(ImageFit.ScaleDown)
.backgroundColor($r('app.color.color_F5F5F5'))
.margin({
bottom: '8vp'
})
Text('我的关注')
.fontColor($r('app.color.color_666666'))
.fontSize($r('app.float.vp_13'))
.fontWeight(400)
.height('18vp')
.lineHeight('18vp')
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.padding({
left: '2vp',
right: '2vp'
})
}
.alignItems(HorizontalAlign.Center)
.width('78vp')
.margin({
left: '8vp',
top: '14vp',
bottom: '14vp'
})
}
}
... ...
import { ToastUtils } from 'wdKit';
@Component
export struct PeopleShipHomeAttentionComponent {
@Consume isAttention: string
... ... @@ -18,7 +20,14 @@ export struct PeopleShipHomeAttentionComponent {
.height(20)
.color($r('app.color.color_fff'))
}else {
Text('+ 关注')
Image($r('app.media.people_ship_top_add'))
.objectFit(ImageFit.Auto)
.width('16vp')
.height('16pv')
.margin({
right: '4vp'
})
Text('关注')
.fontColor(Color.White)
.fontSize($r('app.float.vp_14'))
.fontWeight(500)
... ... @@ -104,7 +113,7 @@ export struct PeopleShipHomeAttentionComponent {
left: '-5vp'
})
.onClick(() => {
ToastUtils.showToast('分享为公共方法,待开发', 1000);
})
}
... ...
... ... @@ -38,14 +38,17 @@ export struct PeopleShipHomeListComponent {
}
.justifyContent(FlexAlign.Start)
}
.backgroundColor(Color.White)
.align(Alignment.Start)
.scrollable(ScrollDirection.Horizontal)
.scrollBar(BarState.Off)
.width('100%')
}
.backgroundColor(Color.White)
.alignItems(VerticalAlign.Bottom)
.width('100%')
}
.justifyContent(FlexAlign.Start)
.height('44vp')
.alignItems(HorizontalAlign.Start)
.width('100%')
... ...
... ... @@ -2,6 +2,7 @@ import router from '@ohos.router'
import { PeopleShipUserDetailData } from 'wdBean'
import { PeopleShipHomePageHeadComponent } from './PeopleShipHomePageHeadComponent'
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'
import { ToastUtils } from 'wdKit';
@Component
export struct PeopleShipHomePageNavComponent {
... ... @@ -62,7 +63,25 @@ export struct PeopleShipHomePageNavComponent {
if (this.isAttention == '0') {
// 关注
Button('+ 关注', { type: ButtonType.Normal, stateEffect: true })
Button({ type: ButtonType.Normal, stateEffect: true }) {
Row(){
Image($r('app.media.people_ship_top_add'))
.objectFit(ImageFit.Auto)
.width('12vp')
.height('12pv')
.margin({
right: '2vp'
})
Text('关注')
.fontSize($r('app.float.vp_12'))
.fontColor(Color.White)
}
.alignSelf(ItemAlign.Center)
.justifyContent(FlexAlign.Center)
.width('100%')
.height('100%')
}
.borderRadius(4)
.backgroundColor($r('app.color.color_ED2800'))
.width('54vp')
... ... @@ -77,8 +96,6 @@ export struct PeopleShipHomePageNavComponent {
left: '12vp',
})
.padding(0)
.fontSize($r('app.float.vp_12'))
.fontColor(Color.White)
.visibility((this.attentionOpacity ? Visibility.Visible : Visibility.Hidden))
} else {
Button('已关注', { type: ButtonType.Normal, stateEffect: true })
... ... @@ -110,7 +127,7 @@ export struct PeopleShipHomePageNavComponent {
.objectFit(ImageFit.Auto)
.margin({ right: '10vp' })
.onClick(() => {
ToastUtils.showToast('分享为公共方法,待开发', 1000);
})
}
.width('100%')
... ...
... ... @@ -5,7 +5,7 @@ export struct PeopleShipHomePageAttestationComponent {
build() {
Row() {
Text(this.name)
.lineHeight('16vp')
.lineHeight('18vp')
.fontColor($r('app.color.color_ED2800'))
.fontSize($r('app.float.vp_11'))
.backgroundColor($r('app.color.color_1AED2800'))
... ... @@ -16,21 +16,27 @@ export struct PeopleShipHomePageAttestationComponent {
left: '16vp',
})
.padding({
top: '3vp',
bottom: '3vp',
right: '6vp',
left: '6vp'
top: '1vp',
bottom: '1vp',
right: '4vp',
left: '4vp'
})
Text(this.content)
.lineHeight('22vp')
.lineHeight('18vp')
.fontSize($r('app.float.vp_12'))
.layoutWeight(1)
.fontColor($r('app.color.color_222222'))
.textAlign(TextAlign.Start)
.align(Alignment.Center)
.padding(0)
.margin({
right: '16vp'
})
.padding({
top: '1vp',
bottom: '1vp',
})
}
.width('100%')
.alignItems(VerticalAlign.Top)
... ...
... ... @@ -28,36 +28,37 @@ export struct PeopleShipHomePageTopComponent {
@State collapseTxt: string = '…展开';
private subTxt: string = '';
@State content: string = ''
@State topFixedHeight: number = 320
@State topFixedHeight: number = 286
@State lineInNum: number = 1
@Link topHeight: number
@State provinceName: string = ''
build() {
Column() {
Stack({ alignContent: Alignment.TopStart}) {
Stack({ alignContent: Alignment.TopStart }) {
// 顶部图片
Image($r('app.media.home_page_bg'))
.width('100%')
.height('120vp')
.objectFit(ImageFit.Fill)
.backgroundColor(Color.Black)
.backgroundColor(Color.White)
// 头像和名称
Row() {
// 头像
PeopleShipHomePageHeadComponent({
diameter: 80,
iconDiameter: 20,
headPhotoUrl:(this.detailModel.headPhotoUrl && this.detailModel.headPhotoUrl.length > 0) ? this.detailModel.headPhotoUrl : $r('app.media.WDAccountOwnerHedaerDefaultIcon') ,
headPhotoUrl: (this.detailModel.headPhotoUrl && this.detailModel.headPhotoUrl.length > 0) ? this.detailModel.headPhotoUrl : $r('app.media.WDAccountOwnerHedaerDefaultIcon'),
authIcon: this.detailModel.authIcon
}).margin({
left: '10vp',
bottom: '20vp'
}).onClick(()=>{
}).onClick(() => {
let params = {
'headPhotoUrl': this.detailModel.headPhotoUrl,
'headType': '1'
} as Record<string, string>;
WDRouterRule.jumpWithPage(WDRouterPage.showUserHeaderPage,params)
WDRouterRule.jumpWithPage(WDRouterPage.showUserHeaderPage, params)
})
... ... @@ -68,7 +69,7 @@ export struct PeopleShipHomePageTopComponent {
.fontColor($r('app.color.color_222222'))
.fontWeight(500)
.textAlign(TextAlign.Start)
.textOverflow({overflow: TextOverflow.Ellipsis})
.textOverflow({ overflow: TextOverflow.Ellipsis })
.maxLines(2)
.layoutWeight(1)
.margin({
... ... @@ -85,49 +86,50 @@ export struct PeopleShipHomePageTopComponent {
.width('100%')
.height('180vp')
.backgroundColor(Color.Transparent)
// 认证id:1蓝2黄,蓝v 只有官方认证,黄v有领域和身份认证
// 官方认证
if(this.detailModel.authId == 1 && this.detailModel.categoryAuth.length > 0) {
PeopleShipHomePageAttestationComponent({name: '官方认证', content: this.detailModel.categoryAuth})
if (this.detailModel.authId == 1 && this.detailModel.categoryAuth.length > 0) {
PeopleShipHomePageAttestationComponent({ name: '官方认证', content: this.detailModel.categoryAuth})
.margin({
top: '10vp',
top: '0vp',
bottom: '10vp'
})
}
if(this.detailModel.authId == 2) {
if (this.detailModel.authTitle && this.detailModel.authTitle.length > 0 ){
PeopleShipHomePageAttestationComponent({name: '领域认证', content: this.detailModel.authTitle})
if (this.detailModel.authId == 2) {
if (this.detailModel.authTitle && this.detailModel.authTitle.length > 0) {
PeopleShipHomePageAttestationComponent({ name: '领域认证', content: this.detailModel.authTitle })
.margin({
top: '10vp',
bottom: '10vp'
top: '0vp',
bottom: (this.detailModel.authPersonal && this.detailModel.authPersonal.length > 0) ? '6vp' : '10vp'
})
}
if (this.detailModel.authPersonal && this.detailModel.authPersonal.length > 0 ){
PeopleShipHomePageAttestationComponent({name: '身份认证', content: this.detailModel.authPersonal})
if (this.detailModel.authPersonal && this.detailModel.authPersonal.length > 0) {
PeopleShipHomePageAttestationComponent({ name: '身份认证', content: this.detailModel.authPersonal })
.margin({
top: '10vp',
top: '0vp',
bottom: '10vp'
})
}
}
// 简介
if(this.lineInNum > 3) {
if (this.lineInNum > 3) {
Row() {
Text() {
Span(this.content)
.fontColor($r('app.color.color_222222'))
Span(this.collapseTxt)
.onClick(()=>{
if(this.isCollapse){
.onClick(() => {
if (this.isCollapse) {
this.maxLines = Infinity;
this.content = `简介:${this.detailModel.introduction}`
this.isCollapse = false;
this.collapseTxt = '收起';
this.topHeight = this.topFixedHeight + 21 * this.lineInNum
}else{
} else {
this.isCollapse = true;
this.collapseTxt = '…展开';
this.content = this.subTxt;
... ... @@ -137,30 +139,36 @@ export struct PeopleShipHomePageTopComponent {
.fontColor($r('app.color.color_B0B0B0'))
}
.backgroundColor(Color.Transparent)
.lineHeight('21vp')
.width('100%')
.maxLines(this.maxLines)
.textOverflow({overflow: TextOverflow.Ellipsis})
.textOverflow({ overflow: TextOverflow.Ellipsis })
.fontSize($r('app.float.vp_14'))
.key('home_page_introduction')
.margin({
.padding({
left: '16vp',
right: '16vp',
})
}.width('100%')
.backgroundColor(Color.Transparent)
.alignItems(VerticalAlign.Top)
}else {
} else {
Row() {
Text(`简介:${this.detailModel.introduction}`)
.fontSize($r('app.float.vp_14'))
.fontColor($r('app.color.color_222222'))
.lineHeight('21vp')
.width('100%')
.maxLines(3)
.textOverflow({overflow: TextOverflow.Ellipsis})
.margin({
.textOverflow({ overflow: TextOverflow.Ellipsis })
.padding({
left: '16vp',
right: '16vp',
})
.backgroundColor(Color.Transparent)
}.width('100%')
.backgroundColor(Color.Transparent)
.alignItems(VerticalAlign.Top)
}
... ... @@ -171,7 +179,6 @@ export struct PeopleShipHomePageTopComponent {
.fontSize($r('app.float.vp_12'))
.fontColor($r('app.color.color_999999'))
.textAlign(TextAlign.Start)
.width('100%')
.alignSelf(ItemAlign.Start)
.margin({
right: '16vp',
... ... @@ -254,7 +261,8 @@ export struct PeopleShipHomePageTopComponent {
.height('6vp')
}
.width('100%')
.height('100%')
// .height('100%')
}
async aboutToAppear() {
... ... @@ -272,17 +280,15 @@ export struct PeopleShipHomePageTopComponent {
}
// 不听减去2个字-一直到时3行
private compIntroductionTextHeights() {
let introduction = `简介:${this.detailModel.introduction}`
let lineInNum1 = this.getTextLineNum(introduction, DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14'))
while (lineInNum1 > 3 ) {
while (lineInNum1 > 3) {
introduction = introduction.substring(0, introduction.length - 2);
lineInNum1 = this.getTextLineNum(introduction, DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14'))
lineInNum1 = this.getTextLineNum(introduction + this.collapseTxt, DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14'))
}
introduction = introduction.substring(0, introduction.length - 3);
// introduction = introduction.substring(0, introduction.length - 3);
Logger.debug('PeopleShipHomePageTopComponent', '3行简介:', `${introduction}`)
this.subTxt = introduction;
... ... @@ -292,7 +298,7 @@ export struct PeopleShipHomePageTopComponent {
private getTextLineNum(text: string, constraintWidth: number, lineHeight: number, fontSize: number | string | Resource) {
let size = this.topMeasureText(text, constraintWidth, lineHeight, fontSize)
let height: number = Number(size.height)
return Math.ceil(px2vp(height)/lineHeight)
return Math.ceil(px2vp(height) / lineHeight)
}
private topMeasureText(text: string, constraintWidth: number, lineHeight: number, fontSize: number | string | Resource) {
... ... @@ -306,7 +312,7 @@ export struct PeopleShipHomePageTopComponent {
async onIntroductionUpdated() {
if (this.content.length == 0 && this.detailModel.introduction ) {
if (this.content.length == 0 && this.detailModel.introduction) {
this.lineInNum = this.getTextLineNum(`简介:${this.detailModel.introduction}`, DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14'))
if (this.lineInNum > 3) {
this.compIntroductionTextHeights()
... ... @@ -314,43 +320,48 @@ export struct PeopleShipHomePageTopComponent {
}
}
if (this.detailModel) {
this.topFixedHeight = 308
this.topFixedHeight = 286
if (this.detailModel.region && this.detailModel.region.length > 0) {
this.provinceName = this.detailModel.region
}else {
} else {
this.provinceName = await this.computeIPRegion(this.detailModel.province)
}
if(this.detailModel.authId == 1 && this.detailModel.categoryAuth.length > 0) {
this.topFixedHeight += this.getTextLineNum(this.detailModel.categoryAuth, DisplayUtils.getDeviceWidth() - 90, 22, $r('app.float.vp_12'))*22
if (this.detailModel.authId == 1 && this.detailModel.categoryAuth.length > 0) {
this.topFixedHeight += this.getTextLineNum(this.detailModel.categoryAuth, DisplayUtils.getDeviceWidth() - 90, 22, $r('app.float.vp_12')) * 18
this.topFixedHeight += 12
}
else if(this.detailModel.authId == 2) {
if (this.detailModel.authTitle && this.detailModel.authTitle.length > 0 ){
this.topFixedHeight += this.getTextLineNum(this.detailModel.authTitle, DisplayUtils.getDeviceWidth() - 90, 22, $r('app.float.vp_12'))*22
else if (this.detailModel.authId == 2) {
if (this.detailModel.authTitle && this.detailModel.authTitle.length > 0) {
this.topFixedHeight += this.getTextLineNum(this.detailModel.authTitle, DisplayUtils.getDeviceWidth() - 90, 22, $r('app.float.vp_12')) * 18
if (this.detailModel.authPersonal && this.detailModel.authPersonal.length > 0){
this.topFixedHeight += 8
}else{
this.topFixedHeight += 12
}
if (this.detailModel.authPersonal && this.detailModel.authPersonal.length > 0 ){
if (this.detailModel.authTitle && this.detailModel.authTitle.length > 0 ){
this.topFixedHeight += 10
}
this.topFixedHeight += this.getTextLineNum(this.detailModel.authPersonal, DisplayUtils.getDeviceWidth() - 90, 22, $r('app.float.vp_12'))*22
if (this.detailModel.authPersonal && this.detailModel.authPersonal.length > 0) {
this.topFixedHeight += this.getTextLineNum(this.detailModel.authPersonal, DisplayUtils.getDeviceWidth() - 90, 22, $r('app.float.vp_12')) * 18
this.topFixedHeight += 12
}
}
this.lineInNum = this.getTextLineNum(`简介:${this.detailModel.introduction}`, DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14'))
if (this.lineInNum <= 3) {
this.topFixedHeight += (21 * this.lineInNum)
this.topHeight = this.topFixedHeight
}else {
this.topHeight = this.topFixedHeight + (this.isCollapse ? 21*3 : 21 * this.lineInNum )
this.topHeight = this.topFixedHeight + (21 * this.lineInNum)
} else {
this.lineInNum = this.getTextLineNum(`简介:${this.detailModel.introduction}` + '收起', DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14'))
this.topHeight = this.topFixedHeight + (this.isCollapse ? 21 * 3 : 21 * this.lineInNum)
}
// IP归属地
if (this.provinceName && this.provinceName.length > 0) {
this.topFixedHeight += 28
this.topHeight += 28
}
}
}
private computeShowNum(count: number) {
if(count >= 10000) {
return `${(count/10000).toFixed(1)}万`
if (count >= 10000) {
return `${(count / 10000).toFixed(1)}万`
}
return `${count}`
}
... ... @@ -359,7 +370,7 @@ export struct PeopleShipHomePageTopComponent {
private async computeIPRegion(province: string) {
if (province && province.length) {
try {
let provinceName = await HWLocationUtils.getProvinceName(province) ;
let provinceName = await HWLocationUtils.getProvinceName(province);
return provinceName
} catch (e) {
return ''
... ... @@ -367,5 +378,4 @@ export struct PeopleShipHomePageTopComponent {
}
return ''
}
}
\ No newline at end of file
... ...
... ... @@ -11,7 +11,7 @@ export struct SearchCreatorComponent{
Stack({alignContent: Alignment.Bottom}){
Image(this.item.headerPhotoUrl)
.width('92lpx')
.alt($r('app.media.default_head'))
.alt($r('app.media.icon_default_head_mater'))
.height('92lpx')
.margin({bottom:'15lpx'})
.borderRadius(50)
... ...
... ... @@ -81,9 +81,9 @@ export struct AccountAndSecurityLayout {
// 收到eventId为1的事件后执行该回调
let callback = (eventData: emitter.EventData): void => {
promptAction.showToast({
message: JSON.stringify(eventData)
});
// promptAction.showToast({
// message: JSON.stringify(eventData)
// });
if(eventData&&eventData.data){
this.listData[0].subTitle = eventData.data['content']
}
... ...
... ... @@ -184,6 +184,10 @@ struct ForgetPasswordPage {
this.loginViewModel.changeBindPhone(this.phoneContent,this.codeContent).then(()=>{
ToastUtils.shortToast('绑定成功')
this.querySecurity()
}).catch((message: string) => {
if (message != '') {
ToastUtils.shortToast(message)
}
})
}
... ...
... ... @@ -171,8 +171,8 @@ export class LoginViewModel {
return new Promise<object>((success, fail) => {
this.loginModel.changeBindPhone(phone, verificationCode).then((data: object) => {
success(data)
}).catch(() => {
fail()
}).catch((message: string) => {
fail(message)
})
})
}
... ...