zhenghy
... ... @@ -51,6 +51,8 @@ export { MultiPictureDetailPageComponent } from "./src/main/ets/components/Multi
export { AudioDetailComponent } from "./src/main/ets/components/AudioDetailComponent"
export { DynamicDetailComponent } from "./src/main/ets/components/DynamicDetailComponent"
export { AudioSuspensionModel } from "./src/main/ets/viewmodel/AudioSuspensionModel"
export { BroadcastPageComponent } from "./src/main/ets/components/broadcast/BroadcastPageComponent"
... ...
... ... @@ -2,12 +2,14 @@ import { AccountManagerUtils, Logger } from 'wdKit';
import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
import { ContentDetailDTO,batchLikeAndCollectResult,batchLikeAndCollectParams,postBatchAttentionStatusParams,
PhotoListBean,
ContentDTO, } from 'wdBean';
ContentDTO,
RmhInfoDTO, } from 'wdBean';
import media from '@ohos.multimedia.media';
import { OperRowListView } from './view/OperRowListView';
import { WDPlayerController } from 'wdPlayer/Index';
import { ContentConstants } from '../constants/ContentConstants';
import { ProcessUtils } from '../utils/ProcessUtils';
import { StringUtils } from 'wdKit/src/main/ets/utils/StringUtils';
const TAG = 'DynamicDetailComponent'
@Preview
... ... @@ -17,8 +19,15 @@ export struct DynamicDetailComponent {
private relId: string = ''
private contentId: string = ''
private relType: string = ''
//出参
@State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
//出参 fixme 模拟数据用json转换
@State contentDetailData: ContentDetailDTO = {
publishTime: "2023年03月14日 08:16",
rmhInfo:{rmhHeadUrl:"",rmhName:"人民号名称",rmhDesc:"人民号描述单行展示"},
newsContent:"优先展示这个内容",
newsSummary:"其次展示这个内容",
newsTitle:"上面两个都没有再展示这个内容",
newsType:15
} as ContentDetailDTO
//变量
/**
* 默认未关注 点击去关注
... ... @@ -46,7 +55,7 @@ export struct DynamicDetailComponent {
.height($r('app.float.margin_28'))
.margin({ left: $r('app.float.margin_16') })
Blank()
Text("2023年03月14日 08:16")
Text(this.contentDetailData.publishTime)
.fontColor($r('app.color.color_B0B0B0'))
.fontSize($r('app.float.font_size_12'))
.lineHeight($r('app.float.margin_28'))
... ... @@ -80,22 +89,27 @@ export struct DynamicDetailComponent {
.alignContent(Alignment.Center)
Column(){
//昵称
Text("this.contentDetailData.rmhInfo?.rmhName")
Text(this.contentDetailData.rmhInfo?.rmhName)
.fontSize($r('app.float.font_size_14'))
.fontColor($r('app.color.color_222222'))
.fontWeight(FontWeight.Medium)
.margin({ left: $r('app.float.margin_5') })
.alignSelf(ItemAlign.Start)
//简介
Text("this.contentDetailData.rmhInfo?.rmhDesc")
Text(this.contentDetailData.rmhInfo?.rmhDesc)
.fontSize($r('app.float.font_size_14'))
.fontColor($r('app.color.color_B0B0B0'))
.fontWeight(FontWeight.Medium)
.maxLines(1)
.margin({ left: $r('app.float.margin_5') })
.alignSelf(ItemAlign.Start)
}
.width('63%')
.margin({right: $r('app.float.margin_6')})
if (this.followStatus == '0') {
Text('关注')
.width(60)
.height($r('app.float.margin_48'))
.width($r('app.float.margin_54'))
.height($r('app.float.margin_24'))
.textAlign(TextAlign.Center)
.fontSize($r('app.float.font_size_12'))
.borderRadius($r('app.float.vp_3'))
... ... @@ -120,14 +134,20 @@ export struct DynamicDetailComponent {
}
}
.width('100%')
.margin({ left: $r('app.float.margin_16')})
//内容
Text("这里展示标题这里展示标题这里展示标题这里这里展示标题这里展示标题这里展示标题这里这里展示标题这里展示标题这里展示标题这里")
Text(StringUtils.isEmpty(this.contentDetailData.newsContent)
?StringUtils.isEmpty(this.contentDetailData.newsSummary)
?this.contentDetailData.newsTitle
:this.contentDetailData.newsSummary
:this.contentDetailData.newsContent)
.fontColor($r('app.color.color_222222'))
.fontSize($r('app.float.font_size_18'))
.lineHeight($r('app.float.margin_25'))
.margin({ top: $r('app.float.margin_6')
,left: $r('app.float.margin_16')
,right: $r('app.float.margin_16') })
.alignSelf(ItemAlign.Start)
if(this.contentDetailData.photoList!= null && this.contentDetailData.photoList.length>0){
//附件内容:图片/视频
if(this.contentDetailData.newsType+"" == ContentConstants.TYPE_FOURTEEN){
... ... @@ -140,17 +160,13 @@ export struct DynamicDetailComponent {
}) {
ForEach(this.contentDetailData.photoList, (item: PhotoListBean, index: number) => {
GridCol() {
this.buildItemCard(this.contentDetailData.photoList[index],this.contentDetailData.photoList.length, index);
this.buildItemCard(item.picPath,this.contentDetailData.photoList.length, index);
}
// .onClick()
})
}
}else{
//附件内容:视频,只有一个
ForEach(this.contentDetailData.photoList, (item: PhotoListBean, index: number) => {
GridCol() {
this.buildItemCard(this.contentDetailData.photoList[index],this.contentDetailData.photoList.length, index);
}
})
this.buildItemCard(this.contentDetailData.videoInfo[0].firstFrameImageUri, this.contentDetailData.photoList.length, 0);
}
}
//特别声明
... ... @@ -194,8 +210,11 @@ export struct DynamicDetailComponent {
//评论组件/底部组件
}
.alignSelf(ItemAlign.Start)
}
.backgroundColor('#FFFFFFFF')
.width('100%')
.height('100%')
}
/**
* 请求(动态)详情页数据
... ... @@ -265,7 +284,7 @@ export struct DynamicDetailComponent {
* @param programmeBean item 组件项, 上面icon,下面标题
*/
@Builder
buildItemCard(item: PhotoListBean,len: number,index: number) {
buildItemCard(item: string,len: number,index: number) {
Column() {
this.setItemImageRoundCorner(len, item, index)
Flex({ direction: FlexDirection.Row }) {
... ... @@ -307,137 +326,137 @@ export struct DynamicDetailComponent {
//设置图片圆角
@Builder
setItemImageRoundCorner(len: number, item: PhotoListBean, index: number) {
setItemImageRoundCorner(len: number, picPath: string, index: number) {
if (len == 1) {
//四角圆角
this.setItemImageStyle(item.picPath, 4, 4, 4, 4);
this.setItemImageStyle(picPath, 4, 4, 4, 4);
} else if (len == 2) {
if (index == 0) {
//左边圆角
this.setItemImageStyle(item.picPath, 4, 0, 4, 0);
this.setItemImageStyle(picPath, 4, 0, 4, 0);
} else {
//右边圆角
this.setItemImageStyle(item.picPath, 0, 4, 0, 4);
this.setItemImageStyle(picPath, 0, 4, 0, 4);
}
} else if (3 == len) {
if (index == 0) {
//左边圆角
this.setItemImageStyle(item.picPath, 4, 0, 4, 0);
this.setItemImageStyle(picPath, 4, 0, 4, 0);
} else if (index == 1) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
this.setItemImageStyle(picPath, 0, 0, 0, 0);
} else {
//右边圆角
this.setItemImageStyle(item.picPath, 0, 4, 0, 4);
this.setItemImageStyle(picPath, 0, 4, 0, 4);
}
} else if (4 == len) {
if (index == 0) {
//左边圆角
this.setItemImageStyle(item.picPath, 4, 0, 4, 0);
this.setItemImageStyle(picPath, 4, 0, 4, 0);
} else if (index == 1) {
//右边圆角
this.setItemImageStyle(item.picPath, 0, 4, 0, 4);
this.setItemImageStyle(picPath, 0, 4, 0, 4);
} else if (index = 2) {
//左边圆角
this.setItemImageStyle(item.picPath, 4, 0, 4, 0);
this.setItemImageStyle(picPath, 4, 0, 4, 0);
} else {
//右边圆角
this.setItemImageStyle(item.picPath, 0, 4, 0, 4);
this.setItemImageStyle(picPath, 0, 4, 0, 4);
}
} else if (5 == len) {
if (index == 0) {
this.setItemImageStyle(item.picPath, 4, 0, 0, 0);
this.setItemImageStyle(picPath, 4, 0, 0, 0);
} else if (index == 1) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
this.setItemImageStyle(picPath, 0, 0, 0, 0);
} else if (index = 2) {
this.setItemImageStyle(item.picPath, 4, 4, 4, 4);
this.setItemImageStyle(picPath, 4, 4, 4, 4);
} else if (index = 3) {
this.setItemImageStyle(item.picPath, 0, 0, 4, 0);
this.setItemImageStyle(picPath, 0, 0, 4, 0);
} else {
this.setItemImageStyle(item.picPath, 0, 0, 0, 4);
this.setItemImageStyle(picPath, 0, 0, 0, 4);
}
} else if (6 == len) {
if (index == 0) {
this.setItemImageStyle(item.picPath, 4, 0, 0, 0);
this.setItemImageStyle(picPath, 4, 0, 0, 0);
} else if (index == 1) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
this.setItemImageStyle(picPath, 0, 0, 0, 0);
} else if (index = 2) {
this.setItemImageStyle(item.picPath, 0, 4, 0, 0);
this.setItemImageStyle(picPath, 0, 4, 0, 0);
} else if (index = 3) {
this.setItemImageStyle(item.picPath, 0, 0, 4, 0);
this.setItemImageStyle(picPath, 0, 0, 4, 0);
} else if (index = 4) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
this.setItemImageStyle(picPath, 0, 0, 0, 0);
} else {
//右边圆角
this.setItemImageStyle(item.picPath, 0, 0, 0, 4);
this.setItemImageStyle(picPath, 0, 0, 0, 4);
}
} else if (7 == len) {
if (index == 0) {
this.setItemImageStyle(item.picPath, 4, 0, 0, 0);
this.setItemImageStyle(picPath, 4, 0, 0, 0);
} else if (index == 1) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
this.setItemImageStyle(picPath, 0, 0, 0, 0);
} else if (index = 2) {
this.setItemImageStyle(item.picPath, 0, 4, 0, 0);
this.setItemImageStyle(picPath, 0, 4, 0, 0);
} else if (index = 3) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
this.setItemImageStyle(picPath, 0, 0, 0, 0);
} else if (index = 4) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
this.setItemImageStyle(picPath, 0, 0, 0, 0);
} else if (index = 5) {
this.setItemImageStyle(item.picPath, 0, 0, 0, 4);
this.setItemImageStyle(picPath, 0, 0, 0, 4);
} else {
this.setItemImageStyle(item.picPath, 0, 0, 4, 4);
this.setItemImageStyle(picPath, 0, 0, 4, 4);
}
} else if (8 == len) {
if (index == 0) {
this.setItemImageStyle(item.picPath, 4, 0, 0, 0);
this.setItemImageStyle(picPath, 4, 0, 0, 0);
} else if (index == 1) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
this.setItemImageStyle(picPath, 0, 0, 0, 0);
} else if (index = 2) {
this.setItemImageStyle(item.picPath, 0, 4, 0, 0);
this.setItemImageStyle(picPath, 0, 4, 0, 0);
} else if (index = 3) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
this.setItemImageStyle(picPath, 0, 0, 0, 0);
} else if (index = 4) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
this.setItemImageStyle(picPath, 0, 0, 0, 0);
} else if (index = 5) {
this.setItemImageStyle(item.picPath, 0, 0, 0, 4);
this.setItemImageStyle(picPath, 0, 0, 0, 4);
} else if (index = 6) {
this.setItemImageStyle(item.picPath, 0, 0, 4, 0);
this.setItemImageStyle(picPath, 0, 0, 4, 0);
} else {
this.setItemImageStyle(item.picPath, 0, 0, 0, 4);
this.setItemImageStyle(picPath, 0, 0, 0, 4);
}
} else {
if (index == 0) {
this.setItemImageStyle(item.picPath, 4, 0, 0, 0);
this.setItemImageStyle(picPath, 4, 0, 0, 0);
} else if (index == 1) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
this.setItemImageStyle(picPath, 0, 0, 0, 0);
} else if (index == 2) {
this.setItemImageStyle(item.picPath, 0, 4, 0, 0);
this.setItemImageStyle(picPath, 0, 4, 0, 0);
} else if (index == 3) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
this.setItemImageStyle(picPath, 0, 0, 0, 0);
} else if (index == 4) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
this.setItemImageStyle(picPath, 0, 0, 0, 0);
} else if (index == 5) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
this.setItemImageStyle(picPath, 0, 0, 0, 0);
} else if (index == 6) {
this.setItemImageStyle(item.picPath, 0, 0, 4, 0);
this.setItemImageStyle(picPath, 0, 0, 4, 0);
} else if (index == 7) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
this.setItemImageStyle(picPath, 0, 0, 0, 0);
} else {
this.setItemImageStyle(item.picPath, 0, 0, 0, 4);
this.setItemImageStyle(picPath, 0, 0, 0, 4);
}
}
}
... ...
import { PhotoListBean } from 'wdBean';
import { Logger } from 'wdKit';
import router from '@ohos.router';
import display from '@ohos.display';
const TAG = 'MultiPictureDetailPageComponent';
... ... @@ -11,14 +9,10 @@ export struct MultiPictureDetailItemComponent {
//alt app.media.picture_loading 设计稿尺寸
@State imageWidth:string | number = 167
@State ratio:number = 167/60
private scroller: Scroller = new Scroller()
private displayTool = display.getDefaultDisplaySync()
@State picHeight: number = 0
async aboutToAppear() {
Logger.info(TAG, 'pictures preview')
this.picHeight = this.displayTool.width * 578 / 375
}
build() {
... ... @@ -33,16 +27,6 @@ export struct MultiPictureDetailItemComponent {
this.imageWidth = '100%'
this.ratio = this.MultiPictureDetailItem.width / this.MultiPictureDetailItem.height
})
/*.onDrop(event => {
router.back();
})
.draggable(true)*/
/*Scroll(this.scroller) {
}
.scrollable(ScrollDirection.Vertical)
.scrollBarWidth(0)
.height(px2vp(this.picHeight))*/
}
.height('100%')
.width('100%')
... ...
... ... @@ -18,6 +18,7 @@ import { HttpUrlUtils } from 'wdNetwork/Index';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { PageRepository } from '../repository/PageRepository';
import { SpConstants } from 'wdConstant/Index';
import { router } from '@kit.ArkUI';
const TAG = 'MultiPictureDetailPageComponent';
... ... @@ -34,6 +35,7 @@ export struct MultiPictureDetailPageComponent {
@State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
@Provide @Watch('onCurrentPageNumUpdated') currentPageNum: string = '01'
private swiperController: SwiperController = new SwiperController()
private swiperControllerItem: SwiperController = new SwiperController()
@State swiperIndex: number = 0;
@Provide followStatus: string = '0' // 关注状态
private scroller: Scroller = new Scroller()
... ... @@ -71,7 +73,19 @@ export struct MultiPictureDetailPageComponent {
if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length > 0) {
Swiper(this.swiperController) {
ForEach(this.contentDetailData.photoList, (item: PhotoListBean) => {
Swiper(this.swiperController) {
MultiPictureDetailItemComponent({ MultiPictureDetailItem: item })
}
.width('100%')
.height('100%')
.vertical(true)
.autoPlay(false)
.cachedCount(1)
.indicator(false)
.displayCount(1)
.onAnimationEnd(event => {
router.back()
})
})
}
.index(this.swiperIndex)
... ... @@ -82,6 +96,7 @@ export struct MultiPictureDetailPageComponent {
.cachedCount(3)
.indicator(false)
.displayCount(1)
.loop(false)
.id('e_swiper_content')
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
... ...
... ... @@ -156,22 +156,23 @@ struct EditUserInfoPage {
if (userName) {
if (userName != this.currentUserInfo.userName) {
this.currentUserInfo.userName = userName;
this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_nickname
this.updateEditModel()
// this.currentUserInfo.userName = userName;
// this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_nickname
// this.updateEditModel()
this.getAccountOwnerInfo()
}
} else if (introduction){
if (introduction != this.currentUserInfo.userExtend.introduction ) {
this.currentUserInfo.userExtend.introduction = introduction;
this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_intro
this.updateEditModel()
// this.currentUserInfo.userExtend.introduction = introduction;
// this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_intro
// this.updateEditModel()
this.getAccountOwnerInfo()
}
}
}
}
updateEditModel(){
this.listData = []
// this.listData.push(...EditInfoViewModel.getEditListInfo(this.currentUserInfo))
EditInfoViewModel.updateUserInfo(this.currentUserInfo).then(()=>{
this.getAccountOwnerInfo()
... ... @@ -179,6 +180,7 @@ struct EditUserInfoPage {
}
getAccountOwnerInfo(){
EditInfoViewModel.queryAccountOwnerInfo(1,getContext(this)).then((editModel) => {
this.listData = []
this.headerImg = editModel.userExtend.headPhotoUrl
this.currentUserInfo = editModel as editModel;
this.listData.push(...EditInfoViewModel.getEditListInfo(editModel))
... ...
import { CustomTitleUI } from '../reusable/CustomTitleUI'
import router from '@ohos.router'
import { editModelParams } from '../../model/EditInfoModel'
import { editModel, editModelParams, WDEditDataModelType } from '../../model/EditInfoModel'
import EditInfoViewModel from '../../viewmodel/EditInfoViewModel';
@Entry
@Component
struct EditUserIntroductionPage {
... ... @@ -51,6 +51,11 @@ struct EditUserIntroductionPage {
.borderRadius(5)
.margin(30)
.onClick(()=>{
let currentUserInfo:editModel = new editModel()
currentUserInfo.userExtend.introduction = this.introduction
currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_intro
this.updateEditModel(currentUserInfo)
let params: editModelParams = {
introduction: this.introduction
}
... ... @@ -61,4 +66,9 @@ struct EditUserIntroductionPage {
})
}
}
updateEditModel(Info:editModel){
EditInfoViewModel.updateUserInfo(Info)
}
}
\ No newline at end of file
... ...
import { CustomTitleUI } from '../reusable/CustomTitleUI'
import router from '@ohos.router'
import { editModelParams } from '../../model/EditInfoModel'
import { editModel, editModelParams, WDEditDataModelType } from '../../model/EditInfoModel'
import EditInfoViewModel from '../../viewmodel/EditInfoViewModel';
@Entry
@Component
struct EditUserNikeNamePage {
... ... @@ -51,6 +51,13 @@ struct EditUserNikeNamePage {
.borderRadius(5)
.margin(30)
.onClick(()=>{
///内部更新
let currentUserInfo:editModel = new editModel()
currentUserInfo.userExtend.introduction = this.nikeName
currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_nickname
this.updateEditModel(currentUserInfo)
let params: editModelParams = {
userName: this.nikeName
}
... ... @@ -61,4 +68,8 @@ struct EditUserNikeNamePage {
})
}
}
updateEditModel(Info:editModel){
EditInfoViewModel.updateUserInfo(Info)
}
}
\ No newline at end of file
... ...
... ... @@ -57,10 +57,9 @@ export class ProcessUtils {
break;
//动态详情页(动态图文)
case ContentConstants.TYPE_FOURTEEN:
break;
//动态详情页(动态视频)
case ContentConstants.TYPE_FIFTEEN:
ProcessUtils.gotoWeb(content);
ProcessUtils.gotoDynamicDetailPage(content);
break;
default:
break;
... ... @@ -75,7 +74,7 @@ export class ProcessUtils {
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
detailPageType: 14,
detailPageType: Number.parseInt(content.objectType),
contentID: content?.objectId,
extra: {
relType: content?.relType,
... ...
... ... @@ -121,6 +121,10 @@
"value": "48vp"
},
{
"name": "margin_54",
"value": "54vp"
},
{
"name": "margin_60",
"value": "60vp"
},
... ...
... ... @@ -102,12 +102,14 @@ export struct TabLiveComponent {
this.pageModel.hasMore = true;
} else {
this.pageModel.hasMore = false;
if (StringUtils.isNotEmpty(this.liveDetailsBean.oldNewsId)
if (StringUtils.isEmpty(this.liveDetailsBean.oldNewsId)
&& this.liveDetailsBean
&& this.liveDetailsBean.liveInfo.liveState != 'wait') {
let liveRoomItemBeanTemp: LiveRoomItemBean = {} as LiveRoomItemBean
liveRoomItemBeanTemp.text = this.liveDetailsBean.newIntroduction
liveRoomItemBeanTemp.senderUserName = '人民日报主持人'
liveRoomItemBeanTemp.pictureUrls=[]
liveRoomItemBeanTemp.pictureUrls.push(this.liveDetailsBean?.fullColumnImgUrls[0]?.url)
this.liveList.push(liveRoomItemBeanTemp)
}
}
... ...
import { Logger } from 'wdKit';
import { AudioDetailComponent } from 'wdComponent';
import { DynamicDetailComponent } from 'wdComponent';
import router from '@ohos.router';
import { Params, Action } from 'wdBean';
const TAG = 'DynamicDetailPage';
... ... @@ -13,7 +13,7 @@ struct DynamicDetailPage {
build() {
Column() {
AudioDetailComponent({
DynamicDetailComponent({
relId: this.relId,
contentId: this.contentId,
relType: this.relType
... ...