yangsunyue_wd
Showing 83 changed files with 1281 additions and 1034 deletions
... ... @@ -31,10 +31,11 @@ export const enum CompStyle {
Zh_Single_Column_02 = 'Zh_Single_Column-02', //10 头图卡
Zh_Single_Column_03 = 'Zh_Single_Column-03', //9 直播大图卡
Zh_Single_Column_04 = 'Zh_Single_Column-04', //17 人民号主题卡
Zh_Single_Column_05 = 'Zh_Single_Column-05', //16 人民号入驻卡
Zh_Single_Column_05 = 'Zh_Single_Column-05', //16 人民号入驻卡
Zh_Single_Column_06 = 'Zh_Single_Column-06', //12 本地问政卡
Zh_Single_Column_07 = 'Zh_Single_Column-07', //14 热门留言卡
Zh_Single_Column_08 = 'Zh_Single_Column-08', //12 问政提问卡
Zh_Single_Column_09 = 'Zh_Single_Column-09', //12 问政提问卡
Zh_Single_Column_10 = 'Zh_Single_Column-10', //18 服务组合卡
Zh_Single_Column_11 = 'Zh_Single_Column-11', //19 问政组合卡
Zh_Grid_Layout_01 = 'Zh_Grid_Layout-01', //4 信息流组合卡
... ...
import { Action } from './Action';
interface dataObject {
dataSource: number
operateType?: string
webViewHeight?: string
dataJson?: string
... ...
... ... @@ -3,15 +3,15 @@
{
"name": "shared_desc",
"value": "全局工具包"
} ,
},
{
"name": "net_core_no_network",
"value": "当前无网络,请重试"
} ,
},
{
"name": "net_core_weak_network",
"value": "当前无网络,请重试"
} ,
},
{
"name": "net_core_page_error_network",
"value": "网络出小差了,请检查下网络"
... ... @@ -47,6 +47,10 @@
{
"name": "auditing_core_error",
"value": "内容已下线"
},
{
"name": "image_request_fail",
"value": "图片加载失败,请检查网络"
}
]
}
\ No newline at end of file
... ...
... ... @@ -62,7 +62,7 @@ export class HttpBizUtil {
Logger.debug(TAG, 'post: ' + resDTO.code)
Logger.debug(TAG, 'post: ' + resDTO.message)
// 403:临时token;406:强制下线、封禁、清空登录信息还要跳转登录页面
if (resDTO.code == 0 || resDTO.code == 406) {
if (resDTO.code == 403 || resDTO.code == 406) {
HttpBizUtil.refreshToken().then((token: string) => {
if (headers) {
headers.replace('RMRB-X-TOKEN', token)
... ...
... ... @@ -397,7 +397,8 @@ export class HttpUrlUtils {
if (StringUtils.isNotEmpty(HttpUrlUtils.token)) {
return HttpUrlUtils.token
}
return 'eyJhbGciOiJIUzI1NiIsImtpZCI6ImQ4WkI2QkhxSEZrdjJ2U25BNlRwZEdKRjBHcjItVzBvS2FaYzdLOUUycmcifQ.eyJpc3MiOiJwZW9wbGVzLWRhaWx5LWZvdXJhIiwic3ViIjoicGVvcGxlcy1kYWlseS1mb3VyYSIsImV4cCI6MTcwMzY0OTYwNiwidXNlcklkIjo0NTk3NzYyOTc0NzQ5NDksInVzZXJWZXJzaW9uIjoiNDU5Nzc2Mjk3NDc0OTQ5XzIiLCJ1c2VyTmFtZSI6IkJ1bGlraWtpMTgxIiwidXNlclR5cGUiOjIsImNyZWF0b3JJZCI6NDI2NTM5MH0.jhQ9kylcm3FxWf0-lBMZuLkdtIQ6XpFnAi0AFZJNwfc';
// return 'eyJhbGciOiJIUzI1NiIsImtpZCI6ImQ4WkI2QkhxSEZrdjJ2U25BNlRwZEdKRjBHcjItVzBvS2FaYzdLOUUycmcifQ.eyJpc3MiOiJwZW9wbGVzLWRhaWx5LWZvdXJhIiwic3ViIjoicGVvcGxlcy1kYWlseS1mb3VyYSIsImV4cCI6MTcwMzY0OTYwNiwidXNlcklkIjo0NTk3NzYyOTc0NzQ5NDksInVzZXJWZXJzaW9uIjoiNDU5Nzc2Mjk3NDc0OTQ5XzIiLCJ1c2VyTmFtZSI6IkJ1bGlraWtpMTgxIiwidXNlclR5cGUiOjIsImNyZWF0b3JJZCI6NDI2NTM5MH0.jhQ9kylcm3FxWf0-lBMZuLkdtIQ6XpFnAi0AFZJNwfc';
return ''
}
static getRefreshToken() {
... ...
import { Callback, BridgeWebViewControl } from 'wdJsBridge';
import { Callback } from 'wdJsBridge';
import { Message } from 'wdJsBridge/src/main/ets/bean/Message';
import { Logger, StringUtils, } from 'wdKit';
import { Logger } from 'wdKit';
import { H5CallNativeType } from './H5CallNativeType';
import { ContentDTO } from 'wdBean';
//TODO 这里引用了 features模块,是否考虑将跳转抽到公共模块
... ... @@ -27,7 +27,10 @@ export function performJSCallNative(data: Message, call: Callback) {
case H5CallNativeType.jsCall_callAppService:
break;
case H5CallNativeType.jsCall_receiveH5Data:
handleH5Data(JSON.parse(data?.data?.dataJson || '{}'))
if(data?.data?.dataSource === 5){
handleH5Data(JSON.parse(data?.data?.dataJson || '{}'))
}
break;
case 'changeNativeMessage':
call("this is change Web Message")
... ... @@ -59,6 +62,7 @@ function getAppPublicInfo(): string {
}
function handleH5Data(content:ContentDTO) {
Logger.debug(TAG, 'handleH5Data' + ', content: ' + JSON.stringify(content))
ProcessUtils.processPage(content)
}
... ...
import router from '@ohos.router';
import { BridgeUtil, BridgeWebViewControl, Callback } from 'wdJsBridge';
import { BridgeHandler, BridgeUtil, BridgeWebViewControl, Callback } from 'wdJsBridge';
import { Logger } from 'wdKit/Index';
import { setDefaultNativeWebSettings } from './WebComponentUtil';
import { Action } from 'wdBean';
import { performJSCallNative } from './JsBridgeBiz';
import { H5CallNativeType } from './H5CallNativeType';
import { Message } from 'wdJsBridge/src/main/ets/bean/Message';
... ... @@ -10,9 +12,9 @@ const TAG = 'WdWebLocalComponent';
@Component
export struct WdWebComponent {
webviewControl: BridgeWebViewControl = new BridgeWebViewControl()
onWebPrepared: () => void = () => {}
@Prop backVisibility: boolean = false
@Prop webUrl: string = ''
@Prop @Watch('onReloadStateChanged') reload: number = 0
@Link isPageEnd: boolean
build() {
... ... @@ -34,9 +36,10 @@ export struct WdWebComponent {
.domStorageAccess(true)
.databaseAccess(true)
.javaScriptAccess(true)
.zoomAccess(false)
.horizontalScrollBarAccess(false)
.verticalScrollBarAccess(false)
.imageAccess(true)
.mixedMode(MixedMode.All)
.onlineImageAccess(true)
.enableNativeEmbedMode(true)
.onPageBegin((event) => {
this.onPageBegin(event?.url);
})
... ... @@ -66,14 +69,13 @@ export struct WdWebComponent {
// 注册h5调用js相关
for (let i = 0; i < H5CallNativeType.JsCallTypeList.length; i++) {
let handleName = H5CallNativeType.JsCallTypeList[i];
console.log('handleName:', handleName)
let handle = (data: Message, f: Callback) => {
Logger.debug('registerHandlers handlerName: ' + JSON.stringify(data))
this.defaultPerformJSCallNative(data, f)
};
this.webviewControl.registerHandler(handleName, { handle: handle });
}
}
/**
* 默认【CallNative】逻辑处理
*/
... ... @@ -83,22 +85,18 @@ export struct WdWebComponent {
onPageBegin: (url?: string) => void = () => {
Logger.debug(TAG, 'onPageBegin');
this.registerHandlers();
// setTimeout(() => {
BridgeUtil.webViewLoadLocalJs(getContext(this), this.webviewControl)
// }, 100)
}
onPageEnd: (url?: string) => void = () => {
this.isPageEnd = true
Logger.debug(TAG, 'onPageEnd');
this.onWebPrepared()
this.isPageEnd = true
}
onLoadIntercept: (url?: string) => boolean = () => {
Logger.debug(TAG, 'onLoadIntercept return false');
return false
}
onReloadStateChanged() {
Logger.info(TAG, `onReloadStateChanged:::refresh, this.reload: ${this.reload}`);
if (this.reload > 0) {
this.webviewControl.refresh()
}
}
}
... ...
... ... @@ -12,8 +12,7 @@ const TAG = 'WdWebLocalComponent';
@Component
export struct WdWebLocalComponent {
webviewControl: BridgeWebViewControl = new BridgeWebViewControl()
onWebPrepared: () => void = () => {
}
onWebPrepared: () => void = () => {}
@Prop backVisibility: boolean = false
@Prop webResource: Resource = {} as Resource
@State webHeight: string | number = '100%'
... ... @@ -73,6 +72,7 @@ export struct WdWebLocalComponent {
for (let i = 0; i < H5CallNativeType.JsCallTypeList.length; i++) {
let handleName = H5CallNativeType.JsCallTypeList[i];
let handle = (data: Message, f: Callback) => {
Logger.debug('registerHandlers handlerName: ' + JSON.stringify(data.data))
this.setCurrentPageOperate(data)
this.defaultPerformJSCallNative(data, f)
};
... ...
... ... @@ -19,7 +19,7 @@ export interface CompDTO {
name: string;
objectId: string; // 跳转页面id?
objectTitle: string; // comp标题
// objectType?: any; // 跳转类型,枚举:
// objectType?: string; // 跳转类型,枚举:
operDataList: ContentDTO[]; // 运营数据列表【正常运营配置的强运营数据,部分推荐场景的配置(自动源兜底数据)】
// pageId?: any;
posterSize: string;
... ...
... ... @@ -5,6 +5,7 @@ import { InteractDataDTO } from './InteractDataDTO';
import { slideShows } from '../morningevening/slideShows';
import { VoiceInfoDTO } from '../detail/VoiceInfoDTO';
import { RmhInfoDTO } from '../detail/RmhInfoDTO'
import {commentInfo} from './commentInfo'
export interface ContentDTO {
appStyle: string;
cityCode: string;
... ... @@ -75,4 +76,5 @@ export interface ContentDTO {
newTags: string;
titleShow?: number;
isSearch?: boolean; // 是否是搜索的结果,区分搜索和主页的数据
commentInfo?: commentInfo
}
\ No newline at end of file
... ...
... ... @@ -20,4 +20,5 @@ export interface Params {
// 17.多图(图集)详情页
detailPageType?: number; // 详情页类型
liveStyle?: number; // 直播类型:0横屏,1竖屏
creatorId?: string; //号主id
}
... ...
export interface commentInfo {
commentTitle: string,
newsTitle: string,
userName: string,
userHeaderUrl: string,
publishTime: number
}
\ No newline at end of file
... ...
... ... @@ -69,3 +69,5 @@ export { newsSkeleton } from "./src/main/ets/components/skeleton/newsSkeleton"
export { LiveCommentComponent } from "./src/main/ets/components/comment/view/LiveCommentComponent"
export { WDViewDefaultType } from "./src/main/ets/components/view/EmptyComponent"
... ...
... ... @@ -11,8 +11,11 @@ import {
} from './view/HorizontalStrokeCardThreeTwoRadioForOneComponent';
import { ZhSingleRow02 } from './compview/ZhSingleRow02';
import { ZhSingleRow04 } from './compview/ZhSingleRow04';
import { ZhSingleRow05 } from './compview/ZhSingleRow05';
import { ZhSingleRow06 } from './compview/ZhSingleRow06';
import { ZhSingleColumn04 } from './compview/ZhSingleColumn04';
import { ZhSingleColumn05 } from './compview/ZhSingleColumn05';
import { ZhSingleColumn09 } from './compview/ZhSingleColumn09';
import { ZhGridLayout03 } from './compview/ZhGridLayout03';
import { CardParser } from './CardParser';
import { LiveHorizontalReservationComponent } from './view/LiveHorizontalReservationComponent';
... ... @@ -31,60 +34,63 @@ export struct CompParser {
compIndex: number = 0;
build() {
Column(){
Column() {
this.componentBuilder(this.compDTO, this.compIndex);
Divider().strokeWidth(1).color('#f5f5f5').padding({left:16,right:16})
}
}
@Builder
componentBuilder(compDTO: CompDTO, compIndex: number) {
if (compDTO.compStyle === CompStyle.Label_03) {
LabelComponent({ compDTO: compDTO })
} else if (compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) {
BannerComponent({ compDTO: compDTO })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_01 && compDTO.imageScale === 2) {
LiveHorizontalCardComponent({ compDTO: compDTO })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_01 && compDTO.imageScale === 3) {
if (compDTO.operDataList.length > 1) {
HorizontalStrokeCardThreeTwoRadioForMoreComponent({ compDTO: compDTO })
} else {
HorizontalStrokeCardThreeTwoRadioForOneComponent({ compDTO: compDTO })
if (compDTO.operDataList[0]?.objectType !== '3' && compDTO.operDataList[0]?.objectType !== '13') { //暂时屏蔽活动和音频详情入口
if (compDTO.compStyle === CompStyle.Label_03) {
LabelComponent({ compDTO: compDTO })
} else if (compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) {
BannerComponent({ compDTO: compDTO })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_01 && compDTO.imageScale === 2) {
LiveHorizontalCardComponent({ compDTO: compDTO })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_01 && compDTO.imageScale === 3) {
if (compDTO.operDataList.length > 1) {
HorizontalStrokeCardThreeTwoRadioForMoreComponent({ compDTO: compDTO })
} else {
HorizontalStrokeCardThreeTwoRadioForOneComponent({ compDTO: compDTO })
}
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_02) {
ZhSingleRow02({ compDTO })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_03) {
LiveHorizontalReservationComponent({ compDTO: compDTO })
} else if (compDTO.compStyle === CompStyle.Zh_Grid_Layout_02) {
ZhGridLayout02({ compDTO: compDTO })
} else if (compDTO.compStyle === CompStyle.Zh_Grid_Layout_03) {
ZhGridLayout03({ compDTO: compDTO })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_04) {
ZhSingleRow04({ compDTO: compDTO })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_05) {
ZhSingleRow05({ compDTO })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_06) {
ZhSingleRow06({ compDTO })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Column_02) {
//头图卡 和comStyle 2相同,
Card5Component({ contentDTO: compDTO.operDataList[0] })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Column_04) {
ZhSingleColumn04({ compDTO: compDTO })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Column_05) {
ZhSingleColumn05({ compDTO: compDTO })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Column_09) {
ZhSingleColumn09({ compDTO })
} else if (!Number.isNaN(Number(compDTO.compStyle))) {
CardParser({ contentDTO: compDTO.operDataList[0] });
}
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_02) {
ZhSingleRow02({ compDTO })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_03) {
LiveHorizontalReservationComponent({ compDTO: compDTO })
} else if (compDTO.compStyle === CompStyle.Zh_Grid_Layout_02) {
ZhGridLayout02({ compDTO: compDTO })
} else if (compDTO.compStyle === CompStyle.Zh_Grid_Layout_03) {
ZhGridLayout03({ compDTO: compDTO })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_04) {
ZhSingleRow04({ compDTO: compDTO })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Column_02) {
//头图卡 和comStyle 2相同,
Card5Component({ contentDTO: compDTO.operDataList[0] })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Column_04) {
ZhSingleColumn04({ compDTO: compDTO })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Column_05) {
ZhSingleColumn05({ compDTO: compDTO })
} else if (!Number.isNaN(Number(compDTO.compStyle))) {
CardParser({ contentDTO: compDTO.operDataList[0] });
}
else {
// todo:组件未实现 / Component Not Implemented
Text(compDTO.compStyle)
.width(CommonConstants.FULL_PARENT)
.padding(10)
.onClick(()=>{
if (compDTO.compStyle === CompStyle.Zh_Single_Row_06) {//精选评论
WDRouterRule.jumpWithPage(WDRouterPage.QualityCommentsPage)
}
})
// Text(compDTO.compStyle)
// .width(CommonConstants.FULL_PARENT)
// .padding(10)
// .backgroundColor(Color.Brown) // 展示本页未实现的compStyle
else {
Text(compDTO.compStyle)
.width(CommonConstants.FULL_PARENT)
.padding(10)
.onClick(() => {
if (compDTO.compStyle === CompStyle.Zh_Single_Row_06) { //精选评论
WDRouterRule.jumpWithPage(WDRouterPage.QualityCommentsPage)
}
})
}
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
}
}
}
... ...
import { PhotoListBean } from 'wdBean/Index';
import { Logger } from 'wdKit/Index';
import { MultiPictureDetailItemComponent } from './MultiPictureDetailItemComponent';
import { display, router } from '@kit.ArkUI';
import { ImageDownloadComponent } from './ImageDownloadComponent';
import { ImageItemView } from './view/ImageItemView';
const TAG = 'ImageSwiperComponent';
... ... @@ -17,6 +17,9 @@ export struct ImageSwiperComponent {
private screenWidth: number = 0
private picWidth: number = 0
@State picHeight: number = 0
@State isEnableSwipe: boolean = true;
// @Provide bgc: Color = Color.White;
//watch监听页码回调
onCurrentPageNumUpdated(): void {
... ... @@ -53,7 +56,8 @@ export struct ImageSwiperComponent {
if (this.photoList && this.photoList?.length > 0) {
Swiper(this.swiperController) {
ForEach(this.photoList, (item: PhotoListBean) => {
MultiPictureDetailItemComponent({ MultiPictureDetailItem: item })
// MultiPictureDetailItemComponent({ MultiPictureDetailItem: item })
ImageItemView({ MultiPictureDetailItem: item, isEnableSwipe: this.isEnableSwipe })
})
}
.index(this.swiperIndex)
... ...
import { CommonConstants } from 'wdConstant';
import { Logger } from 'wdKit';
const TAG = 'EmptyComponent';
/**
* WDViewDefaultType 缺省页
*/
export const enum WDViewDefaultType {
///无网
WDViewDefaultType_NoNetwork,
///网络失败 请稍后重试-倒计时
WDViewDefaultType_NetworkFailed,
///内容获取失败
WDViewDefaultType_ContentFailed,
}
/**
* 空数据/无数据
*/
@Preview
@Component
export struct MultiPictureDetailEmptyComponent {
// private emptySize: SizeOptions = {};
@State emptyWidth: string | number = CommonConstants.FULL_PARENT;
@State emptyHeight: string | number = CommonConstants.FULL_PARENT;
@State emptyType: number = WDViewDefaultType.WDViewDefaultType_ContentFailed
/**
* The empty image width percentage setting.
*/
readonly EMPTY_IMAGE_WIDTH: string = '15%';
/**
* The empty image height percentage setting.
*/
readonly EMPTY_IMAGE_HEIGHT: string = '15%';
/**
* The empty data text component margin top.
*/
readonly EMPTY_TIP_TEXT_MARGIN_TOP: string = '10';
/**
* The empty data text opacity.
*/
readonly TEXT_OPACITY: number = 1;
build() {
this.noProgrammeData();
}
/**
* 无数据,空白view组件
*/
@Builder
noProgrammeData() {
Column() {
Image(this.buildNoDataTipImage())
.width('this.EMPTY_IMAGE_WIDTH')
.height(this.EMPTY_IMAGE_HEIGHT)
.objectFit(ImageFit.Contain)
// .border({ width: 1, color: Color.Red, radius: 6 })
Text(this.buildNoDataTip())
.fontSize($r('app.float.font_size_14'))
.fontColor('#999999')
.fontWeight(FontWeight.Normal)
.opacity(this.TEXT_OPACITY)
.margin({ top: this.EMPTY_TIP_TEXT_MARGIN_TOP })
.onClick((event: ClickEvent) => {
Logger.info(TAG, `noProgrammeData onClick event?.source: ${event.source}`);
})
Button('点击重试', { type: ButtonType.Normal, stateEffect: true })
.borderRadius(4)
.margin(16)
.height(28)
.fontSize(12)
.fontColor('#CCCCCC')
.fontFamily('PingFang SC-Medium')
.border({ width: 1, color: '#545454' })
.backgroundColor(Color.Black)
}
.justifyContent(FlexAlign.Center)
.width(this.emptyWidth)
.height(this.emptyHeight)
.backgroundColor(Color.Black)
}
buildNoDataTip(): string {
Logger.info(TAG, "buildNoDataTip");
let contentString: string = '获取内容失败请重试'
if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoNetwork) {
contentString = '网络出小差了,请检查网络后重试'
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_ContentFailed) {
contentString = '获取内容失败请重试'
}
return contentString
}
buildNoDataTipImage(): Resource | string {
Logger.info(TAG, "buildNoDataTip");
let imageString: Resource | string = $r('app.media.icon_no_content')
if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoNetwork) {
imageString = $r('app.media.icon_no_net')
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_ContentFailed) {
imageString = $r('app.media.icon_no_content')
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NetworkFailed) {
imageString = $r('app.media.icon_no_net')
}
return imageString
}
}
\ No newline at end of file
import { PhotoListBean } from 'wdBean';
import { Logger } from 'wdKit';
import router from '@ohos.router';
import display from '@ohos.display';
const TAG = 'MultiPictureDetailPageComponent';
@Component
export struct MultiPictureDetailItemComponent {
private MultiPictureDetailItem: PhotoListBean = {} as PhotoListBean
//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() {
Stack({ alignContent: Alignment.BottomStart }) {
Row() {
Image(this.MultiPictureDetailItem.picPath)
.alt($r('app.media.picture_loading'))
.width('100%')
.aspectRatio(this.MultiPictureDetailItem.width / this.MultiPictureDetailItem.height)
.objectFit(ImageFit.Fill)
.interpolation(ImageInterpolation.High)
}
.height('100%')
.width('100%')
Row() {
Image(this.MultiPictureDetailItem.picPath)
.alt($r('app.media.picture_loading'))
.width(this.imageWidth)
.aspectRatio(this.ratio)
.objectFit(ImageFit.Fill)
.interpolation(ImageInterpolation.High)
.onComplete(event => {
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))*/
}
.backgroundColor(Color.Black)
.height('100%')
.width('100%')
.backgroundColor(Color.Black)
.justifyContent(FlexAlign.Center)
}
}
\ No newline at end of file
... ...
import { Logger } from 'wdKit';
import { Logger, SPHelper } from 'wdKit';
import { ResponseDTO } from 'wdNetwork';
import {
ContentDetailDTO,
... ... @@ -12,11 +12,12 @@ import display from '@ohos.display';
import font from '@ohos.font';
import { OperRowListView } from './view/OperRowListView';
import { MultiPictureDetailItemComponent } from './MultiPictureDetailItemComponent';
import { MultiPictureDetailEmptyComponent } from './MultiPictureDetailEmptyComponent';
import { EmptyComponent } from './view/EmptyComponent';
import { DateTimeUtils } from 'wdKit/Index';
import { HttpUrlUtils } from 'wdNetwork/Index';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { PageRepository } from '../repository/PageRepository';
import { SpConstants } from 'wdConstant/Index';
const TAG = 'MultiPictureDetailPageComponent';
... ... @@ -36,7 +37,7 @@ export struct MultiPictureDetailPageComponent {
@State swiperIndex: number = 0;
@Provide followStatus: string = '0' // 关注状态
private scroller: Scroller = new Scroller()
@State netStatus: number = 0 // 存储网络状态用来展示缺省图
@State netStatus: number | undefined = undefined // 存储网络状态用来展示缺省图
//watch监听页码回调
onCurrentPageNumUpdated(): void {
... ... @@ -238,8 +239,8 @@ export struct MultiPictureDetailPageComponent {
.height(px2vp(this.titleHeight) + 64)
} else {
if (this.netStatus === 1) {
MultiPictureDetailEmptyComponent({ emptyType: 2})
if(this.netStatus !== undefined) {
EmptyComponent({ emptyType: this.netStatus})
.id('e_empty_content')
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
... ... @@ -289,6 +290,9 @@ export struct MultiPictureDetailPageComponent {
return
}
this.contentDetailData = resDTO.data?.[0];
if(this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length === 0) {
this.netStatus = 0
}
Logger.info(TAG, `contentDetailData:${JSON.stringify(this.contentDetailData)}`)
if (HttpUrlUtils.getUserId()) {
this.getInteractBrowsOperate()
... ... @@ -350,9 +354,10 @@ export struct MultiPictureDetailPageComponent {
/**
* 关注号主
*/
handleAccention() {
async handleAccention() {
// 未登录,跳转登录
if (!HttpUrlUtils.getUserId()) {
const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
if (!user_id) {
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
return
}
... ...
import { Action, ContentDetailDTO, } from 'wdBean';
import DetailViewModel from '../viewmodel/DetailViewModel';
import { Action, H5ReceiveDetailBean } from 'wdBean';
import { WdWebComponent } from 'wdWebComponent';
import router from '@ohos.router';
import { CommonConstants } from 'wdConstant'
import { BridgeWebViewControl } from 'wdJsBridge/Index';
import { detailedSkeleton } from './skeleton/detailSkeleton'
import { NativeCallH5Type } from 'wdWebComponent/src/main/ets/pages/NativeCallH5Type';
const TAG = 'SpacialTopicPageComponent'
@Component
... ... @@ -15,6 +14,28 @@ export struct SpacialTopicPageComponent {
action: Action = {} as Action
@State webUrl: string = '';
@State isPageEnd: boolean = false
private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean
private webPrepared = false;
private dataPrepared = false;
private trySendData2H5() {
if (!this.webPrepared || !this.dataPrepared) {
return
}
// 数据、web组件,都准备好了,开始塞详情数据
this.sendContentData2H5(this.h5ReceiveAppData)
}
private onWebPrepared() {
this.webPrepared = true
this.trySendData2H5()
}
private sendContentData2H5(h5ReceiveAppData: H5ReceiveDetailBean) {
this.webviewControl.callHandle(NativeCallH5Type.jsCall_receiveAppData,
JSON.stringify(h5ReceiveAppData), (data: string) => {
})
}
build() {
Column() {
... ... @@ -27,7 +48,8 @@ export struct SpacialTopicPageComponent {
webviewControl: this.webviewControl,
webUrl: this.webUrl,
backVisibility: false,
isPageEnd:$isPageEnd
onWebPrepared: this.onWebPrepared.bind(this),
isPageEnd: $isPageEnd
})
}
.padding({ bottom: 56 })
... ... @@ -72,7 +94,6 @@ export struct SpacialTopicPageComponent {
.justifyContent(FlexAlign.SpaceBetween)
.backgroundColor(Color.White)
}
}.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT)
.backgroundColor(Color.White)
... ... @@ -83,8 +104,10 @@ export struct SpacialTopicPageComponent {
if (action) {
this.webUrl = action.params?.url || ''
}
this.trySendData2H5()
}
aboutToDisappear() {
}
}
\ No newline at end of file
... ...
... ... @@ -11,7 +11,7 @@ export struct LiveCommentComponent {
build() {
Row() {
Image($r('app.media.back_icon'))
Image($r('app.media.iv_back_left_black'))
.width(24)
.height(24)
.margin({
... ... @@ -71,7 +71,7 @@ export struct LiveCommentComponent {
left: 6,
right: 2
})
Image(this.isLike ? $r('app.media.iv_live_comment_hert_light') : $r('app.media.comment_like_normal'))
Image(this.isLike ? $r('app.media.icon_like_selected_redheart') : $r('app.media.iv_live_heart_normal'))
.width(24)
.height(24)
.margin({
... ...
import { CompDTO, ContentDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant/Index';
import { CollectionUtils, DateTimeUtils, Logger, StringUtils, ToastUtils } from 'wdKit/Index';
import { Logger } from 'wdKit/Index';
import PageViewModel from '../../viewmodel/PageViewModel';
const TAG = 'Zh_Grid_Layout-02';
... ... @@ -31,8 +31,6 @@ export struct ZhGridLayout02 {
build() {
Column() {
Scroll() {
Column() {
Row() {
... ... @@ -46,10 +44,12 @@ export struct ZhGridLayout02 {
.fontWeight(600)
}
.justifyContent(FlexAlign.Start)
.margin({ top: 8, bottom: 8 })
.width(CommonConstants.FULL_WIDTH)
GridRow({
gutter: { x: 12, y: 22 },
columns: { sm: listSize, md: 2 },
breakpoints: { value: ['320vp', '520vp', '840vp'] }
}) {
... ... @@ -60,7 +60,6 @@ export struct ZhGridLayout02 {
})
}
}
}
.width("100%")
.height("100%")
... ... @@ -82,12 +81,9 @@ export struct ZhGridLayout02 {
.width(CommonConstants.FULL_WIDTH)
// .width("100%")
.height("100%")
.padding({ left: 16, right: 16 })
// .layoutWeight(1)
.padding({
top: 14,
left: 16,
right: 16
})
}
... ... @@ -100,9 +96,9 @@ export struct ZhGridLayout02 {
buildItemCard(item: ContentDTO) {
Column() {
Image(item.fullColumnImgUrls[0].url)
.width(170)
.width('100%')
.height(95)
.margin(16)
.borderRadius(4)
Text(item.newsTitle)
.fontSize(13)
.maxLines(2)
... ...
... ... @@ -2,18 +2,18 @@ import { CompDTO, ContentDTO, Params } from 'wdBean';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { HttpUrlUtils } from 'wdNetwork/Index';
import { postInteractAccentionOperateParams } from 'wdBean';
import { PageRepository } from '../repository/PageRepository';
import { PageRepository } from '../../repository/PageRepository';
import { CommonConstants } from 'wdConstant/Index';
/**
* 精选评论卡
* Zh_Single_Row-06
* 兴趣卡
* Zh_Single_Column-09
*/
const TAG = 'Zh_Single_Row-06'
const TAG = 'Zh_Single_Column-09'
@Entry
@Component
export struct ZhSingleRow06 {
export struct ZhSingleColumn09 {
@State compDTO: CompDTO = {} as CompDTO
@State list: Array<string> = ['社会', '三个字', '是四个字', '时事', '社会', '三个字', '是四个字', '时事']
@State activeIndexs: Array<number> = []
... ... @@ -31,14 +31,29 @@ export struct ZhSingleRow06 {
//顶部
this.CompHeader(this.compDTO)
Grid() {
ForEach(this.list, (item: string, index: number) => {
ForEach(this.compDTO.operDataList, (item: ContentDTO, index: number) => {
GridItem() {
Text(item)
.fontSize(14)
.fontColor(this.activeIndexs.includes(index) ? 0x222222 : 0x666666)
.fontWeight(this.activeIndexs.includes(index) ? 600 : 400)
.textAlign(TextAlign.Center)
Stack({alignContent: Alignment.TopEnd}) {
Image(item.coverUrl)
.width('100%')
.height('100%')
Text(item.newsTitle)
.width('100%')
.height('100%')
.fontSize(14)
.textAlign(TextAlign.Center)
.fontColor(0xffffff)
Image($r('app.media.icon_selected'))
.width(19)
.height(19)
.opacity(this.activeIndexs.includes(index) ? 1 : 0)
.objectFit(ImageFit.Contain)
}
.width('100%')
.height('100%')
.borderRadius(4)
}
.margin({right: index % 4 === 3 ? 0 : 6, bottom: 6})
.onClick(() => {
if (this.activeIndexs.includes(index)) {
const ind = this.activeIndexs.indexOf(index);
... ... @@ -49,29 +64,32 @@ export struct ZhSingleRow06 {
})
})
}
.height(70)
.height(90)
.columnsTemplate('1fr 1fr 1fr 1fr')
.rowsTemplate('1fr 1fr')
.margin({bottom: 10})
Text('选中标签,为您推荐更多您感兴趣的内容')
.fontSize(12)
.fontColor(0xB0B0B0)
.textAlign(TextAlign.Center)
.margin({bottom: 10})
Row() {
Text('选好了')
.fontSize(14)
.fontColor(0x000000)
.width('100%')
.textAlign(TextAlign.Center)
Row() {
Text('换一换')
.fontSize(14)
.fontColor(0xed2800)
.margin({right: 4})
Image($r('app.media.icon_refresh'))
.width(14)
.height(14)
}
Image($r("app.media.close_button"))
.width(14)
.height(14)
.onClick(() => {
})
}
.height(40)
.backgroundColor(0xf9f9f9)
.width('100%')
.borderRadius(3)
.justifyContent(FlexAlign.SpaceBetween)
}
.padding({
left: $r('app.float.card_comp_pagePadding_lf'),
... ... @@ -87,30 +105,34 @@ export struct ZhSingleRow06 {
@Builder
CompHeader(item: CompDTO) {
Row() {
Row() {
Image($r("app.media.icon_interest_ask"))
.width(24)
.height(24)
.margin({ right: 4 })
Column() {
Text('以下是否有您感兴趣?')
.fontSize($r("app.float.font_size_17"))
.fontSize(18)
.fontColor(0x000000)
.fontWeight(600)
.width('70%')
.margin({bottom: 4})
Text('选中标签,为您推荐更多您感兴趣的内容')
.fontSize(12)
.fontColor(0xB0B0B0)
.margin({bottom: 10})
.width('70%')
}
Row() {
Image($r("app.media.close_button"))
.width(14)
.height(14)
.onClick(() => {
})
}
.padding({
right: $r('app.float.card_comp_pagePadding_lf'),
})
Text('选好了')
.fontColor(0xed2800)
.fontSize(14)
.width(62)
.height(26)
.backgroundColor(0xfdf0ed)
.textAlign(TextAlign.Center)
// .lineHeight(26)
.borderRadius(4)
.margin({top: -10})
}
.justifyContent(FlexAlign.SpaceBetween)
.margin({ top: 8, bottom: 8 })
.width('100%')
}
}
... ... @@ -119,107 +141,4 @@ export struct ZhSingleRow06 {
function textOverflowStyle(maxLine: number) {
.maxLines(maxLine)
.textOverflow({ overflow: TextOverflow.Ellipsis })
}
@Component
struct CreatorItem {
@Prop item: ContentDTO
@State rmhIsAttention: number = 0
build() {
ListItem() {
Column() {
Flex({direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceBetween}) {
Column() {
Row() {
Image('')
.width(20)
.height(20)
.margin({right: 4})
.border({width: 1, color: 0xcccccc, radius: 10})
Text('立志之间')
.fontColor(0x212228)
.fontSize(12)
}
}
Column() {
Row() {
Image($r('app.media.icon_like_no'))
.width(16)
.height(16)
.margin({right: 4})
Text('3835')
.fontSize(14)
.fontColor(0x999999)
}
}
}
.margin({top: 10, left: 10, right: 10, bottom: 8})
Text('就业不仅是民生问题,也是发展问题,就业不仅是民生问题,也是发展问题,就业不仅是民生问题,也是发展问题,')
.maxLines(2)
.textOverflow({overflow: TextOverflow.Ellipsis})
.margin({left: 10, right: 10, bottom: 8})
.fontSize(17)
.fontColor(0x212228)
.lineHeight(25)
Row() {
Image('')
.width(66)
.height(44)
.borderRadius({topLeft: 3, topRight: 0, bottomLeft: 3, bottomRight: 0})
Text('原文|强化就业优先政策 健全就业促进机制原文|强化就业优先政策 健全就业促进机制原文|强化就业优先政策 健全就业促进机制')
.margin({left: 8})
.width(172)
.maxLines(2)
.textOverflow({overflow: TextOverflow.Ellipsis})
}
.linearGradient({
direction: GradientDirection.Right,
colors: [[0xffffff, 0.0],[0xffffff, 0.8], [0xf9f9f9, 1.0]]
})
}
.width(276)
.height(150)
.margin({ right: 10 })
.borderWidth(1)
.borderColor($r('app.color.color_EDEDED'))
.borderRadius($r('app.float.image_border_radius'))
.backgroundColor(0xf9f9f9)
}
.onClick(() => {
console.log('跳转到rmh');
})
}
/**
* 关注号主 TODO 这里后面需要抽离
*/
handleAccention(item: ContentDTO, status: number) {
this.rmhIsAttention = this.rmhIsAttention ? 0 : 1
return
// 未登录,跳转登录
if (!HttpUrlUtils.getUserId()) {
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
return
}
const params: postInteractAccentionOperateParams = {
attentionUserType: item.rmhInfo?.userType || '', //被关注用户类型(1 普通用户 2 视频号 3 矩阵号)
attentionUserId: item.rmhInfo?.userId || '', // 被关注用户号主id
attentionCreatorId: item.rmhInfo?.rmhId || '', // 被关注用户号主id
// userType: 1,
// userId: '1', // TODO 用户id需要从本地获取
status: status,
}
PageRepository.postInteractAccentionOperate(params).then(res => {
console.log(TAG, '关注号主==', JSON.stringify(res.data))
if (status === 1) {
this.rmhIsAttention = 0
} else {
this.rmhIsAttention = 1
}
})
}
}
}
\ No newline at end of file
... ...
... ... @@ -4,6 +4,7 @@ import { HttpUrlUtils } from 'wdNetwork/Index';
import { postInteractAccentionOperateParams } from 'wdBean';
import { PageRepository } from '../../repository/PageRepository';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from '../../utils/ProcessUtils';
/**
* 小视频横划卡
... ... @@ -11,59 +12,9 @@ import { CommonConstants } from 'wdConstant/Index';
*/
const TAG = 'Zh_Single_Row-02'
@Entry
@Component
export struct ZhSingleRow02 {
@State compDTO: CompDTO = {
objectTitle: '大标题',
operDataList: [
{
rmhInfo: {
rmhId: '2489729',
rmhName: '陕西青年职业学院',
rmhDesc: '陕西青年职业学院陕西青年职业学院是经陕西省人民政陕西青年职业学院是经陕西省人民政是经陕西省人民政',
rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn//upload/ueditor/image/20210113/a_533807397399949312' +
'.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg'
}
},
{
rmhInfo: {
rmhId: '2489729',
rmhName: '陕西青年职业学院',
rmhDesc: '陕西青年职业学院陕西青年职业学院是经陕西省人民政陕西青年职业学院是经陕西省人民政是经陕西省人民政',
rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn//upload/ueditor/image/20210113/a_533807397399949312' +
'.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg'
}
},
{
rmhInfo: {
rmhId: '2489729',
rmhName: '陕西青年职业学院',
rmhDesc: '陕西青年职业学院陕西青年职业学院是经陕西省人民政陕西青年职业学院是经陕西省人民政是经陕西省人民政',
rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn//upload/ueditor/image/20210113/a_533807397399949312' +
'.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg'
}
},
{
rmhInfo: {
rmhId: '2489729',
rmhName: '陕西青年职业学院',
rmhDesc: '陕西青年职业学院陕西青年职业学院是经陕西省人民政陕西青年职业学院是经陕西省人民政是经陕西省人民政',
rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn//upload/ueditor/image/20210113/a_533807397399949312' +
'.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg'
}
},
{
rmhInfo: {
rmhId: '2489729',
rmhName: '陕西青年职业学院',
rmhDesc: '陕西青年职业学院陕西青年职业学院是经陕西省人民政陕西青年职业学院是经陕西省人民政是经陕西省人民政',
rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn//upload/ueditor/image/20210113/a_533807397399949312' +
'.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg'
}
},
]
} as CompDTO
@State compDTO: CompDTO = {} as CompDTO
build() {
Column() {
... ... @@ -127,6 +78,12 @@ export struct ZhSingleRow02 {
.padding({
right: $r('app.float.card_comp_pagePadding_lf'),
})
.onClick(() => {
let params: Params = {
pageID: "1"
}
WDRouterRule.jumpWithPage(WDRouterPage.followListPage, params)
})
}
.justifyContent(FlexAlign.SpaceBetween)
.margin({ top: 8, bottom: 8 })
... ... @@ -148,7 +105,7 @@ struct CreatorItem {
ListItem() {
Column() {
Stack({ alignContent: Alignment.Bottom }) {
Image('')
Image(this.item.coverUrl)
.width(156)
.height(208)
Row()
... ... @@ -156,29 +113,25 @@ struct CreatorItem {
.height(80)
.linearGradient({
direction: GradientDirection.Bottom,
colors: [[0xffffff, 0.0], [0x000000, 1.0]]
colors: [['rgba(0, 0, 0, 0.0)', 0.0], ['rgba(0, 0, 0, 0.3)', 1.0]]
})
.opacity(0.3)
Text('这里显示卡片标题这里显示卡片标题这里显示卡片标题这里显示卡片标题这里显示卡片标题')
Text(this.item.newsTitle)
.fontColor(0xffffff)
.fontSize(14)
.maxLines(2)
.textOverflow({overflow: TextOverflow.Ellipsis})
.width(140)
.height(40)
.margin({bottom: 8})
}
}
.width(156)
.height(208)
.margin({ right: 11 })
.borderWidth(1)
.borderColor($r('app.color.color_EDEDED'))
.borderRadius($r('app.float.image_border_radius'))
}
.onClick(() => {
console.log('跳转到rmh');
.onClick((event: ClickEvent) => {
ProcessUtils.processPage(this.item)
})
}
... ...
... ... @@ -3,7 +3,9 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { HttpUrlUtils } from 'wdNetwork/Index';
import { postInteractAccentionOperateParams } from 'wdBean';
import { PageRepository } from '../../repository/PageRepository';
import { DateTimeUtils } from 'wdKit/Index';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from '../../utils/ProcessUtils';
/**
* 精选评论卡
... ... @@ -11,125 +13,124 @@ import { CommonConstants } from 'wdConstant/Index';
*/
const TAG = 'Zh_Single_Row-06'
@Entry
// interface commentInfo {
// commentTitle: string,
// newsTitle: string,
// userName: string,
// userHeaderUrl: string,
// publishTime: number
// }
// interface operDataListItem {
// commentInfo: commentInfo
// }
// interface CommentData{
// operDataList: Array<operDataListItem>
// }
@Component
export struct ZhSingleRow06 {
@State compDTO: CompDTO = {
objectTitle: '大标题',
operDataList: [
{
rmhInfo: {
rmhId: '2489729',
rmhName: '陕西青年职业学院',
rmhDesc: '陕西青年职业学院陕西青年职业学院是经陕西省人民政陕西青年职业学院是经陕西省人民政是经陕西省人民政',
rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn//upload/ueditor/image/20210113/a_533807397399949312' +
'.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg'
}
},
{
rmhInfo: {
rmhId: '2489729',
rmhName: '陕西青年职业学院',
rmhDesc: '陕西青年职业学院陕西青年职业学院是经陕西省人民政陕西青年职业学院是经陕西省人民政是经陕西省人民政',
rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn//upload/ueditor/image/20210113/a_533807397399949312' +
'.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg'
}
},
{
rmhInfo: {
rmhId: '2489729',
rmhName: '陕西青年职业学院',
rmhDesc: '陕西青年职业学院陕西青年职业学院是经陕西省人民政陕西青年职业学院是经陕西省人民政是经陕西省人民政',
rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn//upload/ueditor/image/20210113/a_533807397399949312' +
'.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg'
}
},
{
rmhInfo: {
rmhId: '2489729',
rmhName: '陕西青年职业学院',
rmhDesc: '陕西青年职业学院陕西青年职业学院是经陕西省人民政陕西青年职业学院是经陕西省人民政是经陕西省人民政',
rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn//upload/ueditor/image/20210113/a_533807397399949312' +
'.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg'
}
},
{
rmhInfo: {
rmhId: '2489729',
rmhName: '陕西青年职业学院',
rmhDesc: '陕西青年职业学院陕西青年职业学院是经陕西省人民政陕西青年职业学院是经陕西省人民政是经陕西省人民政',
rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn//upload/ueditor/image/20210113/a_533807397399949312' +
'.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg'
}
},
]
} as CompDTO
@State compDTO: CompDTO = {} as CompDTO
build() {
Column() {
//顶部
this.CompHeader(this.compDTO)
Row(){
// 列表内容
List() {
ForEach(this.compDTO.operDataList, (item: ContentDTO, index: number) => {
CreatorItem({
item
})
.margin({right: index === this.compDTO.operDataList.length - 1 ? $r('app.float.card_comp_pagePadding_lf') : 0})
})
if (this.compDTO.operDataList?.length > 0) {
this.CompHeader(this.compDTO)
}
Column(){
Text(this.compDTO.operDataList[0]?.commentInfo?.commentTitle)
.maxLines(4)
.textOverflow({overflow: TextOverflow.Ellipsis})
.lineHeight(23)
.fontSize(16)
.margin({bottom: 19})
.textAlign(TextAlign.Start)
.width('100%')
Row() {
Image($r('app.media.icon_clip'))
.width(16)
.height(16)
.margin({right: 5})
Text(this.compDTO.operDataList[0]?.commentInfo?.newsTitle)
.maxLines(1)
.textOverflow({overflow: TextOverflow.Ellipsis})
.fontSize(14)
.fontColor(0x666666)
}
.listDirection(Axis.Horizontal)
.justifyContent(FlexAlign.Start)
.width('100%')
}
.width(CommonConstants.FULL_WIDTH)
.height(208)
.width("100%")
.padding({top: 12, bottom: 12, left: 10, right: 10})
.backgroundColor(0xf9f9f9)
.borderRadius(4)
.margin({bottom: 12})
Row() {
Text(DateTimeUtils.getCommentTime(this.compDTO.operDataList[0]?.commentInfo?.publishTime))
.fontSize(14)
.fontColor(0x999999)
Row(){
Image($r('app.media.icon_like_no'))
.width(16)
.height(16)
.margin({right: 3})
Text('点赞')
.fontSize(14)
.fontColor(0x999999)
}
}
.justifyContent(FlexAlign.SpaceBetween)
.width('100%')
}
.padding({
left: $r('app.float.card_comp_pagePadding_lf'),
// right: $r('app.float.card_comp_pagePadding_lf'),
right: $r('app.float.card_comp_pagePadding_lf'),
top: $r('app.float.card_comp_pagePadding_tb'),
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.backgroundColor($r('app.color.white'))
.margin({ bottom: 8 })
.height(251)
.onClick(() => {
WDRouterRule.jumpWithPage(WDRouterPage.QualityCommentsPage)
})
}
@Builder
CompHeader(item: CompDTO) {
Row() {
Row() {
Image($r("app.media.icon_elite_comment"))
.width(24)
.height(24)
.margin({ right: 4 })
Text('精选评论')
.fontSize($r("app.float.font_size_17"))
.fontColor($r("app.color.color_222222"))
.fontWeight(600)
Image(item.operDataList[0]?.commentInfo?.userHeaderUrl ? item.operDataList[0].commentInfo.userHeaderUrl : $r('app.media.default_head'))
.width(32)
.height(32)
.borderRadius(16)
.margin({right: 8})
Text(item.operDataList[0]?.commentInfo?.userName)
.lineHeight(32)
.fontSize(14)
.fontColor(0x222222)
.maxLines(1)
.textOverflow({overflow: TextOverflow.Ellipsis})
}
Row() {
Text("更多")
.fontSize($r("app.float.font_size_14"))
.fontColor($r("app.color.color_999999"))
Image($r("app.media.icon_elite_comment"))
.width(45)
.height(22)
.margin({ right: 1 })
Image($r("app.media.more"))
.width(14)
.height(14)
.onClick(() => {
// TODO 跳转的页面,定义的入参可能不合理。推荐id: 41
let params: Params = {
pageID: "1"
}
WDRouterRule.jumpWithPage(WDRouterPage.followListPage, params)
})
}
.padding({
right: $r('app.float.card_comp_pagePadding_lf'),
})
}
.margin({bottom: 10})
.justifyContent(FlexAlign.SpaceBetween)
.margin({ top: 8, bottom: 8 })
.width('100%')
}
}
... ...
... ... @@ -19,7 +19,6 @@ export default struct MinePagePersonFunctionUI {
.interpolation(ImageInterpolation.High)
Text(`${item.msg}`)
.margin({top:'8lpx'})
.width('50lpx')
.height('23lpx')
.fontColor($r('app.color.color_222222'))
.fontSize('23lpx')
... ...
import { Params } from 'wdBean';
import { DateTimeUtils, LazyDataSource, StringUtils, UserDataLocal } from 'wdKit';
import { HttpUrlUtils } from 'wdNetwork';
import { DateTimeUtils, LazyDataSource,UserDataLocal } from 'wdKit';
import { WDRouterPage, WDRouterRule } from 'wdRouter';
import MinePageDatasModel from '../../../model/MinePageDatasModel';
import { CommentListItem } from '../../../viewmodel/CommentListItem';
import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem';
import { FollowListDetailRequestItem } from '../../../viewmodel/FollowListDetailRequestItem';
import { FollowOperationRequestItem } from '../../../viewmodel/FollowOperationRequestItem';
import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI';
import { FollowChildComponent } from '../follow/FollowChildComponent';
... ... @@ -22,6 +20,7 @@ export struct HomePageBottomComponent{
@State count:number = 0;
@State isMineAccount:boolean = true;
@State userId:string = "";
@Link commentNum:number
aboutToAppear(){
this.getNewPageData()
... ... @@ -36,30 +35,33 @@ export struct HomePageBottomComponent{
if(this.count === 0){
if(this.style === 1){
Row(){
Text("关注更多人民号")
.fontWeight('400lpx')
.fontColor($r('app.color.color_222222'))
.lineHeight('38lpx')
.fontSize('27lpx')
.textAlign(TextAlign.Center)
.margin({right:'4lpx'})
Image($r('app.media.arrow_icon_right'))
.objectFit(ImageFit.Auto)
.width('27lpx')
.height('27lpx')
}.height('69lpx')
.width('659lpx')
.alignItems(VerticalAlign.Center)
.justifyContent(FlexAlign.Center)
.backgroundColor($r('app.color.color_F5F5F5'))
.margin({top:'31lpx',bottom:'4lpx'})
.onClick(()=>{
let params: Params = {
pageID: "1"
}
WDRouterRule.jumpWithPage(WDRouterPage.followListPage,params)
})
Column(){
Row(){
Text("关注更多人民号")
.fontWeight('400lpx')
.fontColor($r('app.color.color_222222'))
.lineHeight('38lpx')
.fontSize('27lpx')
.textAlign(TextAlign.Center)
.margin({right:'4lpx'})
Image($r('app.media.arrow_icon_right'))
.objectFit(ImageFit.Auto)
.width('27lpx')
.height('27lpx')
}.height('69lpx')
.width('659lpx')
.alignItems(VerticalAlign.Center)
.justifyContent(FlexAlign.Center)
.backgroundColor($r('app.color.color_F5F5F5'))
.margin({top:'31lpx',bottom:'4lpx'})
.onClick(()=>{
let params: Params = {
pageID: "1"
}
WDRouterRule.jumpWithPage(WDRouterPage.followListPage,params)
})
}.layoutWeight(1)
.justifyContent(FlexAlign.Start)
}else{
ListHasNoMoreDataUI({style:2})
.layoutWeight(1)
... ... @@ -211,7 +213,8 @@ export struct HomePageBottomComponent{
this.hasMore = false
}else{
value.list.forEach((value)=>{
this.data_comment.push(new CommentListItem(value.fromUserHeader,value.fromUserName,value.targetTitle,value.createTime,value.commentContent,value.likeNum,0,value.id,value.targetId,value.targetType))
let publishTime = DateTimeUtils.getCommentTime(DateTimeUtils.parseDate(value.createTime,DateTimeUtils.PATTERN_DATE_TIME_HYPHEN))
this.data_comment.push(new CommentListItem(value.fromUserHeader,value.fromUserName,value.targetTitle,publishTime,value.commentContent,value.likeNum,0,value.id,value.targetId,value.targetType))
})
this.data_comment.notifyDataReload()
this.count = this.data_comment.totalCount()
... ... @@ -222,6 +225,7 @@ export struct HomePageBottomComponent{
}
}
this.isLoading = false
this.commentNum = value.totalCount
}).catch((err:Error)=>{
console.log(TAG,"请求失败")
this.isLoading = false
... ...
... ... @@ -18,12 +18,15 @@ export struct BottomNavigationComponent {
@Provide bottomRectHeight: number = 0
@Provide topRectHeight: number = 0
@Provide isLayoutFullScreen: boolean = false
@Provide isImmersive: boolean = false // 是否开启沉浸式模式 http://192.168.1.3:3300/project/3802/interface/api/189229
@Provide isNight: boolean = false // 是否开启夜间模式
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
@State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
// 底导/顶导全部数据
@State @Watch('onBottomNavigationDataUpdated') bottomNavList: BottomNavDTO[] = []
// 底导当前选中/焦点下标
@State currentNavIndex: number = BottomNavi.NEWS;
// @State currentTopNavSelectedIndex: number = 0; //
@State barBackgroundColor: Color = Color.Transparent
// 底导TabsController
private navController: TabsController = new TabsController();
... ... @@ -63,7 +66,7 @@ export struct BottomNavigationComponent {
} else {
TopNavigationComponent({
groupId: navItem.id,
topNavList: navItem.topNavChannelList,
topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073),
_currentNavIndex: this.currentNavIndex,
changeBarBackgroundColor: (color: Color) => {
this.barBackgroundColor = color
... ...
... ... @@ -2,7 +2,7 @@ import { CustomTitleAndEditUI } from '../reusable/CustomTitleAndEditUI'
import MyCollectionViewModel from '../../viewmodel/MyCollectionViewModel';
import PageModel from '../../viewmodel/PageModel';
import { CommonConstants, ViewType } from 'wdConstant'
import { EmptyComponent } from '../view/EmptyComponent'
import { EmptyComponent,WDViewDefaultType } from '../view/EmptyComponent'
import { ErrorComponent } from '../view/ErrorComponent'
import RefreshLayout from './RefreshLayout'
import { RefreshLayoutBean } from './RefreshLayoutBean';
... ... @@ -41,31 +41,28 @@ struct BrowsingHistoryPage {
this.deleteNum = 0
}})
CustomPullToRefresh({
alldata:this.allDatas,
scroller:this.scroller,
customList:()=>{
this.ListLayout()
},
onRefresh:(resolve)=>{
this.browSingModel.currentPage = 0
this.getData(resolve)
},
onLoadMore:(resolve)=> {
this.browSingModel.currentPage++
this.getData()
}
})
// if (this.browSingModel.viewType == ViewType.LOADING){
// this.LoadingLayout()
// }else if(this.browSingModel.viewType == ViewType.ERROR){
// ErrorComponent()
// }else if(this.browSingModel.viewType == ViewType.EMPTY){
// EmptyComponent()
EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NoHistory})
// }else {
// this.ListLayout()
// CustomPullToRefresh({
// alldata:this.allDatas,
// scroller:this.scroller,
// customList:()=>{
// this.ListLayout()
// },
// onRefresh:(resolve)=>{
// this.browSingModel.currentPage = 0
// this.getData(resolve)
// },
// onLoadMore:(resolve)=> {
// this.browSingModel.currentPage++
// this.getData()
// }
// })
// }
if (this.isEditState){
... ...
... ... @@ -127,7 +127,8 @@ struct EditUserInfoPage {
lunar:false,
onAccept:(value:DatePickerResult) => {
let mon = value.month as number + 1
this.currentUserInfo.userExtend.birthday = value.year+'-'+mon.toString()+'-'+value.day;
let monStr = mon < 10? '0'+mon.toString():mon.toString();
this.currentUserInfo.userExtend.birthday = value.year+'-'+monStr+'-'+value.day;
this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_birthday
this.updateEditModel()
}
... ... @@ -171,8 +172,10 @@ struct EditUserInfoPage {
updateEditModel(){
this.listData = []
this.listData.push(...EditInfoViewModel.getEditListInfo(this.currentUserInfo))
EditInfoViewModel.updateUserInfo(this.currentUserInfo)
// this.listData.push(...EditInfoViewModel.getEditListInfo(this.currentUserInfo))
EditInfoViewModel.updateUserInfo(this.currentUserInfo).then(()=>{
this.getAccountOwnerInfo()
})
}
getAccountOwnerInfo(){
EditInfoViewModel.queryAccountOwnerInfo(1,getContext(this)).then((editModel) => {
... ...
... ... @@ -19,7 +19,6 @@ import {
struct PeopleShipHomePage {
// Todo 传入数据 后续在修改
creatorId: string = (router.getParams() as Record<string, string>)['creatorId'];
@State arr: number[] = []
// 页面详情数据
@Provide detailModel: PeopleShipUserDetailData = {} as PeopleShipUserDetailData
// 每个分类数量
... ... @@ -108,9 +107,12 @@ struct PeopleShipHomePage {
Logger.debug('PeopleShipHomePage', '获取页面信息', `${JSON.stringify(this.detailModel)}`)
// 获取关注
let followList: QueryListIsFollowedItem[] = await PeopleShipHomePageDataModel.getHomePageFollowListStatusData(this.creatorId)
Logger.debug('PeopleShipHomePage', '获取关注信息', `${JSON.stringify(followList)}`)
this.findFollowStata(followList)
// 登录后获取,是否关注
if (HttpUrlUtils.getUserId()) {
let followList: QueryListIsFollowedItem[] = await PeopleShipHomePageDataModel.getHomePageFollowListStatusData(this.creatorId)
Logger.debug('PeopleShipHomePage', '获取关注信息', `${JSON.stringify(followList)}`)
this.findFollowStata(followList)
}
} catch (exception) {
... ... @@ -128,14 +130,17 @@ struct PeopleShipHomePage {
}
handleChangeAttentionStata() {
if (!this.isLoadingAttention) {
return
}
// 未登录,跳转登录
if (!HttpUrlUtils.getUserId()) {
this.isLoadingAttention = false
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
return
}
let status = 0
if (this.isAttention == '0') {
status = 1
... ...
... ... @@ -151,36 +151,25 @@ export struct TopNavigationComponent {
}
indexChange() {
if (this._currentNavIndex === 2 && this.currentTopNavSelectedIndex === 0 && this.changeBarBackgroundColor) {
this.barBackgroundColor = Color.Black
this.changeBarBackgroundColor(this.barBackgroundColor)
} else {
this.barBackgroundColor = Color.Transparent
this.changeBarBackgroundColor(this.barBackgroundColor)
}
// 判断视频频道待处理
if (this._currentNavIndex === 2 && this.currentTopNavSelectedIndex == 0) {
if (!this.isLayoutFullScreen) {
const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage
const windowClass: window.Window = windowStage.getMainWindowSync(); // 获取应用主窗口
windowClass.setWindowLayoutFullScreen(true).then(() => {
this.isLayoutFullScreen = true
this.bottomRectHeight = this.bottomSafeHeight
this.topRectHeight = this.topSafeHeight
})
}
this.barBackgroundColor = Color.Black
this.changeBarBackgroundColor && this.changeBarBackgroundColor(this.barBackgroundColor)
WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff', })
WindowModel.shared.setWindowLayoutFullScreen(true)
this.isLayoutFullScreen = true
this.bottomRectHeight = this.bottomSafeHeight
this.topRectHeight = this.topSafeHeight
} else {
if (this.isLayoutFullScreen) {
const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage
const windowClass: window.Window = windowStage.getMainWindowSync(); // 获取应用主窗口
windowClass.setWindowLayoutFullScreen(false).then(() => {
this.isLayoutFullScreen = false
this.bottomRectHeight = 0
this.topRectHeight = 0
console.error(' this.isLayoutFullScreen ', this.isLayoutFullScreen)
})
}
this.barBackgroundColor = Color.Transparent
this.changeBarBackgroundColor && this.changeBarBackgroundColor(this.barBackgroundColor)
WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', })
WindowModel.shared.setWindowLayoutFullScreen(false)
this.isLayoutFullScreen = false
this.bottomRectHeight = 0
this.topRectHeight = 0
}
}
... ...
... ... @@ -20,24 +20,26 @@ import { RefreshLayoutBean } from '../page/RefreshLayoutBean'
import CustomRefreshLoadLayout from '../page/CustomRefreshLoadLayout'
import { ErrorComponent } from '../view/ErrorComponent';
import NoMoreLayout from '../page/NoMoreLayout';
import { LazyDataSource } from 'wdKit';
// import { LazyDataSource } from 'wdKit';
import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh'
const TAG = 'PeopleShipHomeArticleListComponent';
@Component
export struct PeopleShipHomeArticleListComponent {
// @State arr: ContentDTO[] = []
@State arr: LazyDataSource<ContentDTO> = new LazyDataSource();
@State arr: ContentDTO[] = []
// @State arr: LazyDataSource<ContentDTO> = new LazyDataSource();
@State typeModel: ArticleTypeData = new ArticleTypeData()
@State creatorId: string = ''
@Consume detailModel: PeopleShipUserDetailData
@State private viewType: number = 1;
currentIndex: number = 0
@State private viewType: number = 1
currentIndex: number = 1
@Link @Watch('onChange') currentTopSelectedIndex: number
@State private hasMore: boolean = true
@State currentPage: number = 1
@State private currentPage: number = 1
@State private isLoading: boolean = false
@Consume topHeight: number
private scroller: Scroller = new Scroller()
build() {
if (this.viewType == 1) {
... ... @@ -46,7 +48,35 @@ export struct PeopleShipHomeArticleListComponent {
} else if (this.viewType == 2) {
ErrorComponent()
} else {
this.ListLayout()
CustomPullToRefresh({
alldata:this.arr,
scroller:this.scroller,
hasMore: this.hasMore,
customList:()=>{
this.ListLayout()
},
onRefresh:(resolve)=>{
this.currentPage = 1
this.getPeopleShipPageArticleList(resolve)
},
onLoadMore:(resolve)=> {
if (this.hasMore === false) {
if(resolve) {
resolve('')
}
return
}
if(!this.isLoading && this.hasMore){
//加载分页数据
this.currentPage++;
this.getPeopleShipPageArticleList(resolve)
}else {
if(resolve) {
resolve('')
}
}
},
})
}
}
... ... @@ -62,10 +92,10 @@ export struct PeopleShipHomeArticleListComponent {
@Builder
ListLayout() {
List() {
List({scroller: this.scroller}) {
// 下拉刷新
LazyForEach(this.arr, (item: ContentDTO) => {
ForEach(this.arr, (item: ContentDTO) => {
ListItem() {
CardParser({ contentDTO: item })
}.width("100%")
... ... @@ -74,25 +104,25 @@ export struct PeopleShipHomeArticleListComponent {
// 加载更多
ListItem() {
if (!this.hasMore) {
if (!this.hasMore && !this.isLoading) {
NoMoreLayout()
}
}
}
.width("100%")
.height("100%")
.edgeEffect(EdgeEffect.Spring)
.edgeEffect(EdgeEffect.None)
.nestedScroll({
scrollForward: NestedScrollMode.PARENT_FIRST,
scrollBackward: NestedScrollMode.SELF_FIRST
})
.onReachEnd(() => {
if(!this.isLoading && this.hasMore){
//加载分页数据
this.getPeopleShipPageArticleList()
}
})
// .onReachEnd(() => {
// if(!this.isLoading && this.hasMore){
// //加载分页数据
// this.getPeopleShipPageArticleList()
// }
// })
}
aboutToAppear() {
... ... @@ -103,26 +133,37 @@ export struct PeopleShipHomeArticleListComponent {
}
onChange() {
if (this.currentIndex == this.currentTopSelectedIndex) {
if (this.currentIndex == this.currentTopSelectedIndex && this.arr.length == 0) {
this.currentPage = 1
this.getPeopleShipPageArticleList()
}
}
private async getPeopleShipPageArticleList() {
private async getPeopleShipPageArticleList(resolve?: (value: string | PromiseLike<string>) => void) {
Logger.info(`获取页面信息PeopleShipHomeArticleListComponent${this.typeModel.type}`)
if (this.isLoading) {
if (resolve) {
resolve('')
}
return
}
try {
this.isLoading = true
let listData: ArticleListData = await PeopleShipHomePageDataModel.getPeopleShipHomePageArticleListData(this.creatorId, this.currentPage, 20, this.typeModel.type)
Logger.debug(TAG, `获取页面信息, ${listData.list.length}`);
Logger.debug(TAG, `已更新值最新, ${this.currentPage}`);
if (resolve ) {
if (this.currentPage == 1) {
resolve('已更新至最新')
}else {
resolve('')
}
}
if (listData && listData.list && listData.list.length > 0) {
this.viewType = 3;
if (listData.list.length === 20) {
this.currentPage++;
this.hasMore = true;
} else {
this.hasMore = false;
... ... @@ -130,15 +171,18 @@ export struct PeopleShipHomeArticleListComponent {
} else {
this.viewType = 1;
}
this.isLoading = false
this.queryArticleContentInteractCount(listData)
Logger.debug(TAG, '展示的总数', `${this.arr.totalCount()}`)
Logger.debug(TAG, '展示的总数', `${this.arr.length}`)
}catch (exception) {
if (resolve) {
resolve('')
}
this.isLoading = false
if (this.arr.totalCount() == 0) {
if (this.arr.length == 0) {
this.viewType = 2
}
}
}
/**
... ... @@ -167,6 +211,9 @@ export struct PeopleShipHomeArticleListComponent {
private articleListDTOChangeContentDTO(listData: ArticleListData, listCom: InteractDataDTO[]) {
this.isLoading = false
if (listData.list.length) {
if (this.currentPage == 1) {
this.arr = []
}
for (const element of listData.list) {
let contentDTO = {} as ContentDTO
contentDTO.appStyle = this.changeCommon(element.appStyle)
... ...
... ... @@ -15,13 +15,13 @@ export struct PeopleShipHomePageHeadComponent {
.borderWidth('1vp')
.borderStyle(BorderStyle.Solid)
.borderColor(Color.White)
.objectFit(ImageFit.Auto)
.objectFit(ImageFit.Cover)
if(this.authIcon.length > 0 ) {
Image( this.authIcon )
.width(this.iconDiameter)
.height(this.iconDiameter)
.borderRadius(this.iconDiameter/2)
.objectFit(ImageFit.Auto)
.objectFit(ImageFit.Cover)
.margin({
right: '-3vp'
})
... ...
... ... @@ -10,7 +10,7 @@ export struct CustomPullToRefresh {
onLoadMore: (resolve?: (value: string | PromiseLike<string>) => void) => void = () => {
}
///是否存在上拉更多
@State hasMore: boolean = true
@Prop @Watch('hasMoreChange') hasMore: boolean = true
refreshConfigurator: PullToRefreshConfigurator = new PullToRefreshConfigurator().setHasLoadMore(this.hasMore);
build() {
Column(){
... ... @@ -36,4 +36,8 @@ export struct CustomPullToRefresh {
})
}
}
hasMoreChange() {
this.refreshConfigurator.setHasLoadMore(this.hasMore)
}
}
\ No newline at end of file
... ...
... ... @@ -18,6 +18,7 @@ import promptAction from '@ohos.promptAction';
import { LogoutViewModel } from '../../viewmodel/LogoutViewModel';
import { CustomLogoutDialog } from './CustomLogoutDialog';
import { emitter } from '@kit.BasicServicesKit';
import { ConfirmLogoutDialog } from './ConfirmLogoutDialog';
export { SettingPasswordParams } from "wdLogin"
... ... @@ -42,6 +43,19 @@ export struct AccountAndSecurityLayout {
alignment: DialogAlignment.Center
})
confirmDialogController: CustomDialogController = new CustomDialogController({
builder: ConfirmLogoutDialog({
cancel: () => {
},
confirm: () => {
this.logout()
}
}),
customStyle: true,
alignment: DialogAlignment.Center
})
aboutToAppear() {
// 获取设置页面数据
... ... @@ -172,11 +186,8 @@ export struct AccountAndSecurityLayout {
Column() {
Button('退出登录',{ stateEffect: true ,type: ButtonType.Normal}).width('90%').height('80lpx').backgroundColor('#da3e22').fontColor('#fff').margin('20lpx').borderRadius('8lpx').onClick(()=>{
let login = new LoginViewModel;
promptAction.showToast({ message: '退出登录' })
login.logOut();
router.back();
router.back();
this.confirmDialogController.open()
// AlertDialog.show({
// title: '🥟id : ' + "button",
// message: '标题:' + '退出登录',
... ... @@ -415,6 +426,16 @@ export struct AccountAndSecurityLayout {
.height('54lpx')
}
logout(){
let login = new LoginViewModel;
login.logOut().then(()=>{
promptAction.showToast({ message: '退出登录' })
router.back();
router.back();
}).catch((error:string)=>{
promptAction.showToast({ message: error })
});
}
//注销账号
requestLogout() {
... ...
/**退出登录确认弹框*/
@CustomDialog
export struct ConfirmLogoutDialog {
controller: CustomDialogController
cancel: () => void = () => {
}
confirm: () => void = () => {
}
build() {
Column() {
Text("确认退出登录吗?")
.fontColor("#222222")
.fontSize(18)
.width("100%")
.fontWeight(FontWeight.Bold)
.textAlign(TextAlign.Center)
.margin({ top: 20 })
Divider().color("#999999").width("100%").margin({ top: 20 }).height('1vp')
Row() {
Text('确认')
.fontSize(16)
.fontColor("#648DF2")
.layoutWeight(1)
.fontWeight(FontWeight.Medium)
.textAlign(TextAlign.Center)
.onClick(() => {
this.controller.close()
if (this.confirm) {
this.confirm()
}
})
.height('100%')
// Divider().color("#999999").height('100%').width('0.5vp')
Text('取消')
.fontSize(16)
.fontColor("#648DF2")
.layoutWeight(1)
.fontWeight(FontWeight.Medium)
.textAlign(TextAlign.Center)
.border({
width: { left: 1 },
color: "#999999",
style: { left: BorderStyle.Solid }
})
.onClick(() => {
this.controller.close()
if (this.cancel) {
this.cancel()
}
})
.height('100%')
}.layoutWeight(1).justifyContent(FlexAlign.Center)
}.height(110).backgroundColor(Color.White).borderRadius(6).width('74%')
}
}
\ No newline at end of file
... ...
... ... @@ -108,7 +108,9 @@ export struct EmptyComponent {
let contentString: string = '暂无内容'
if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoCollection) {
contentString = '暂无收藏'
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoMessage) {
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoHistory) {
contentString = '暂无浏览历史'
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoMessage) {
contentString = '暂无消息'
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoComment) {
contentString = '暂无评论'
... ... @@ -140,7 +142,7 @@ export struct EmptyComponent {
buildNoDataTipImage(): Resource | string {
Logger.info(TAG, "buildNoDataTip");
let imageString: Resource | string = $r('app.media.icon_no_content')
if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoCollection) {
if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoCollection||this.emptyType === WDViewDefaultType.WDViewDefaultType_NoHistory) {
imageString = $r('app.media.icon_no_collection')
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoMessage) {
imageString = $r('app.media.icon_no_message')
... ...
import { image } from '@kit.ImageKit';
import { matrix4, promptAction, window } from '@kit.ArkUI';
import { BusinessError } from '@kit.BasicServicesKit';
import { ScaleModel } from '../../model/ScaleModel';
import { OffsetModel } from '../../model/OffsetModel';
import { windowSizeManager } from '../../utils/Managers';
import { runWithAnimation } from '../../utils/FuncUtils';
import { PhotoListBean } from 'wdBean/Index';
import { http } from '@kit.NetworkKit';
// TODO:知识点:组件复用
@Reusable
@Component
export struct ImageItemView {
@Consume private bgc: Color;
@Link isEnableSwipe: boolean; // TODO:需求:多图切换
@State isEnableOffset: boolean = false;
@State imageScaleInfo: ScaleModel = new ScaleModel(1.0, 1.0, 1.5, 0.3);
@State imageOffsetInfo: OffsetModel = new OffsetModel(0, 0);
@State matrix: matrix4.Matrix4Transit = matrix4.identity().copy();
@State imagePixelMap: image.PixelMap | null = null; // 当前图片pixelMap,用于Image组件显示
@State fitWH: "width" | "height" | undefined = undefined; // 表示当前图片是根据宽度适配还是高度适配
@State imageDefaultSize: image.Size = { width: 0, height: 0 }; // 图片默认大小,即,与屏幕大小最适配的显示大小
imageUri: string = ""; // 当前图片uri
imageWHRatio: number = 0; // 图片原始宽高比
private MultiPictureDetailItem: PhotoListBean = {} as PhotoListBean
@State imageBuffer: ArrayBuffer | undefined = undefined; // 图片ArrayBuffer
aboutToAppear(): void {
this.imageUri = this.MultiPictureDetailItem.picPath
this.getPicture()
}
/**
* 通过http的request方法从网络下载图片资源
*/
async getPicture() {
console.info(`cj2024 getPicture`)
http.createHttp()
.request(this.imageUri,
(error: BusinessError, data: http.HttpResponse) => {
if (error) {
// 下载失败时弹窗提示检查网络,不执行后续逻辑
promptAction.showToast({
message: $r('app.string.image_request_fail'),
duration: 2000
})
return;
}
this.transcodePixelMap(data);
// 判断网络获取到的资源是否为ArrayBuffer类型
console.info(`cj2024 getPicture ${data.result}`)
if (data.result instanceof ArrayBuffer) {
console.info(`cj2024 getPicture 222`)
this.imageBuffer = data.result as ArrayBuffer;
}
}
)
}
/**
* 使用createPixelMap将ArrayBuffer类型的图片装换为PixelMap类型
* @param data:网络获取到的资源
*/
transcodePixelMap(data: http.HttpResponse) {
console.info(`cj2024 transcodePixelMap ${data.responseCode}`)
if (http.ResponseCode.OK === data.responseCode) {
const imageData: ArrayBuffer = data.result as ArrayBuffer;
// 通过ArrayBuffer创建图片源实例。
const imageSource: image.ImageSource = image.createImageSource(imageData);
this.initCurrentImageInfo(imageSource);
}
}
/**
* 根据图片宽高比及窗口大小计算图片的默认宽高,即,图片最适配屏幕的大小
* @param imageWHRatio:图片原始宽高比
* @param size:窗口大小{with:number,height:number}
* @returns image.Size
*/
calcImageDefaultSize(imageWHRatio: number, size: window.Size): image.Size {
let width = 0
let height = 0;
if (imageWHRatio > size.width / size.height) {
// 图片宽高比大于屏幕宽高比,图片默认以屏幕宽度进行显示
width = size.width;
height = size.width / imageWHRatio;
} else {
height = size.height;
width = size.height * imageWHRatio;
}
return { width: width, height: height };
}
/**
* TODO:知识点:根据图片大小(宽高<=屏幕宽高)和屏幕大小计算图片放大适配屏幕进行显示的缩放倍率
* @param imageSize:图片当前大小
* @param windowSize:窗口大小
* @returns:缩放倍率
*/
calcFitScaleRatio(imageSize: image.Size, windowSize: window.Size): number {
let ratio: number = 1.0;
if (windowSize.width > imageSize.width) {
ratio = windowSize.width / imageSize.width;
} else {
ratio = windowSize.height / imageSize.height;
}
return ratio;
}
/**
* 设置当前图片的相关信息:uri、whRatio、pixelMap、fitWH、defaultSize、maxScaleValue
* TODO:知识点:提前获取图片的信息,以进行Image组件的尺寸设置及后续的相关计算
*/
initCurrentImageInfo(imageSource: image.ImageSource): void {
this.matrix = matrix4.identity().copy();
// const imageSource: image.ImageSource = image.createImageSource(this.imageUri);
imageSource.getImageInfo(0).then((data: image.ImageInfo) => {
this.imageWHRatio = data.size.width / data.size.height;
this.imageDefaultSize = this.calcImageDefaultSize(this.imageWHRatio, windowSizeManager.get());
if (this.imageDefaultSize.width === windowSizeManager.get().width) {
this.fitWH = "width";
} else {
this.fitWH = "height";
}
this.imageScaleInfo.maxScaleValue += this.fitWH === "width" ?
(windowSizeManager.get().height / this.imageDefaultSize.height) :
(windowSizeManager.get().width / this.imageDefaultSize.width);
}).catch((err: BusinessError) => {
console.error(`[error][getImageInfo]${err.message}`);
});
imageSource.createPixelMap().then((data: image.PixelMap) => {
this.imagePixelMap = data;
}).catch((err: BusinessError) => {
console.error(`[error][createPixelMap]${err.message}`);
});
this.isEnableOffset = false;
this.imageScaleInfo.reset();
this.imageOffsetInfo.reset();
}
/**
* 在图片消失时,将当前图片的信息设置为默认值
*/
resetCurrentImageInfo(): void {
this.imageScaleInfo.reset();
this.imageOffsetInfo.reset();
this.matrix = matrix4.identity().copy();
}
/**
* TODO:需求:在偏移时评估是否到达边界,以便进行位移限制与图片的切换
* @returns:长度为4的boolean数组,表示上下左右是否到达边界
*/
evaluateBound(): boolean[] {
return [false, false, false, false];
}
build() {
Stack() {
Image(this.imagePixelMap)// TODO:知识点:宽高只根据其尺寸设置一个,通过保持宽高比来设置另一个属性
.width(this.fitWH === "width" ? "100%" : undefined)
.height(this.fitWH === "height" ? "100%" : undefined)
.aspectRatio(this.imageWHRatio)
.objectFit(ImageFit.Cover)// TODO:知识点:保持宽高比进行缩放,可以超出父组件,以便实现多图切换的增强功能
.autoResize(false)
.transform(this.matrix)// TODO:知识点:通过matrix控制图片的缩放
.defaultFocus(true)
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
.offset({
// TODO:知识点:通过offset控制图片的偏移
x: this.imageOffsetInfo.currentX,
y: this.imageOffsetInfo.currentY
})
}
.onBlur(() => {
this.resetCurrentImageInfo();
})
// .backgroundColor(this.bgc)
.alignContent(Alignment.Center)
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
.width("100%")
.height("100%")
.gesture(
GestureGroup(
GestureMode.Exclusive,
// TODO:知识点:双击切换图片大小
TapGesture({ count: 2 })
.onAction(() => {
let fn: Function;
// 已经是放大状态下,双击缩小
if (this.imageScaleInfo.scaleValue > this.imageScaleInfo.defaultScaleValue) {
fn = () => {
this.isEnableSwipe = true;
this.imageScaleInfo.reset();
this.imageOffsetInfo.reset();
this.matrix = matrix4.identity().copy();
};
} else {
// 已经是缩小状态,双击放大
fn = () => {
this.isEnableSwipe = false;
const ratio: number = this.calcFitScaleRatio(this.imageDefaultSize, windowSizeManager.get());
this.imageScaleInfo.scaleValue = ratio;
this.imageOffsetInfo.reset();
this.matrix = matrix4.identity().scale({
x: ratio,
y: ratio,
}).copy();
this.imageScaleInfo.stash();
}
}
runWithAnimation(fn);
}),
// 单击切换背景色
// TapGesture({ count: 1 }).onAction(() => {
// runWithAnimation(() => {
// this.bgc = this.bgc === Color.White ? Color.Black : Color.White;
// });
// }),
// TODO:知识点:双指捏合缩放图片
PinchGesture({ fingers: 2, distance: 1 })
.onActionUpdate((event: GestureEvent) => {
this.imageScaleInfo.scaleValue = this.imageScaleInfo.lastValue * event.scale;
// TODO:知识点:缩放时不允许大于最大缩放因子+额外缩放因子,不允许小于默认大小-额外缩放因子,额外缩放因子用于提升用户体验
if (this.imageScaleInfo.scaleValue > this.imageScaleInfo.maxScaleValue *
(1 + this.imageScaleInfo.extraScaleValue)
) {
this.imageScaleInfo.scaleValue = this.imageScaleInfo.maxScaleValue *
(1 + this.imageScaleInfo.extraScaleValue);
}
if (this.imageScaleInfo.scaleValue < this.imageScaleInfo.defaultScaleValue *
(1 - this.imageScaleInfo.extraScaleValue)) {
this.imageScaleInfo.scaleValue = this.imageScaleInfo.defaultScaleValue *
(1 - this.imageScaleInfo.extraScaleValue);
}
// TODO:知识点:matrix默认缩放中心为组件中心
this.matrix = matrix4.identity().scale({
x: this.imageScaleInfo.scaleValue,
y: this.imageScaleInfo.scaleValue,
}).copy();
console.debug(this.imageScaleInfo.toString());
})
.onActionEnd((event: GestureEvent) => {
/**
* TODO:知识点:当小于默认大小时,恢复为默认大小
*/
if (this.imageScaleInfo.scaleValue < this.imageScaleInfo.defaultScaleValue) {
runWithAnimation(() => {
this.imageScaleInfo.reset();
this.imageOffsetInfo.reset();
this.matrix = matrix4.identity().copy();
})
}
// TODO:知识点:当大于最大缩放因子时,恢复到最大
if (this.imageScaleInfo.scaleValue > this.imageScaleInfo.maxScaleValue) {
runWithAnimation(() => {
this.imageScaleInfo.scaleValue = this.imageScaleInfo.maxScaleValue;
this.matrix = matrix4.identity()
.scale({
x: this.imageScaleInfo.maxScaleValue,
y: this.imageScaleInfo.maxScaleValue
});
})
}
this.imageScaleInfo.stash();
}),
// // TODO:知识点:滑动图片
// PanGesture({ fingers: 1 })// TODO:需求:默认大小下左右滑动应当是切换图片
// .onActionUpdate((event: GestureEvent) => {
// if (this.imageScaleInfo.scaleValue === this.imageScaleInfo.defaultScaleValue) {
// // 默认大小下不允许移动
// return;
// }
// this.imageOffsetInfo.currentX = this.imageOffsetInfo.lastX + event.offsetX;
// this.imageOffsetInfo.currentY = this.imageOffsetInfo.lastY + event.offsetY;
// })
// .onActionEnd((event: GestureEvent) => {
// this.imageOffsetInfo.stash();
// })
),
)
}
}
\ No newline at end of file
... ...
import { ToastUtils, Logger, NumberFormatterUtils } from 'wdKit';
import { ToastUtils, Logger, NumberFormatterUtils, SPHelper } from 'wdKit';
import {
InputMethodProperty,
batchLikeAndCollectResult,
... ... @@ -15,6 +15,7 @@ import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailV
import { HttpUrlUtils } from 'wdNetwork/Index';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { PageRepository } from '../../repository/PageRepository';
import { SpConstants } from 'wdConstant/Index';
export interface OperationItem {
icon: Resource;
... ... @@ -53,8 +54,9 @@ export struct OperRowListView {
}
]
aboutToAppear() {
if (HttpUrlUtils.getUserId()) {
async aboutToAppear() {
const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
if (user_id) {
this.getInteractDataStatus()
}
this.queryContentInteractCount()
... ... @@ -338,9 +340,10 @@ export struct OperRowListView {
/**
* 点赞、取消点赞
*/
toggleLikeStatus() {
async toggleLikeStatus() {
// 未登录,跳转登录
if (!HttpUrlUtils.getUserId()) {
const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
if (!user_id) {
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
return
}
... ... @@ -361,9 +364,10 @@ export struct OperRowListView {
/**
* 收藏、取消收藏
*/
toggleCollectStatus() {
async toggleCollectStatus() {
// 未登录,跳转登录
if (!HttpUrlUtils.getUserId()) {
const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
if (!user_id) {
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
return
}
... ...
... ... @@ -33,6 +33,7 @@ export struct SecondLevelComponent {
}
onFirstChange(){
this.select = 0
if (!this.currentFirst) {
this.mTip = '暂无数据';
} else {
... ...
... ... @@ -34,10 +34,11 @@ export struct ThirdLevelComponent {
}
onFirstChange(){
this.select = 0
}
onSecondChange(){
this.select = 0
if (!this.currentSecondBean) {
this.mTip = '暂无数据';
} else {
... ...
export class ImageViewerConstants {
// 缩放动画的持续时间
static readonly ANIMATE_DURATION: number = 300;
// swiper中缓存图片的数量
static readonly SWIPER_CACHE_COUNT: number = 2;
}
... ...
... ... @@ -40,7 +40,7 @@ export class EditInfoModel{
//生日
birthday:string = ''
//性别
sex:number = 0
sex:number = 10
airec:number = 0
... ...
... ... @@ -60,7 +60,7 @@ class MinePageDatasModel{
return this.personalData
}
this.personalData.push(new MinePagePersonalFunctionsItem("评论",$r('app.media.mine_comment_icon')))
this.personalData.push(new MinePagePersonalFunctionsItem("关注",$r('app.media.mine_order_icon')))
this.personalData.push(new MinePagePersonalFunctionsItem("关注",$r('app.media.mine_follow_icon')))
this.personalData.push(new MinePagePersonalFunctionsItem("收藏",$r('app.media.mine_collect_icon')))
this.personalData.push(new MinePagePersonalFunctionsItem("历史",$r('app.media.mine_history_icon')))
this.personalData.push(new MinePagePersonalFunctionsItem("消息",$r('app.media.mine_msg_icon')))
... ...
@Observed
export class OffsetModel {
public currentX: number;
public currentY: number;
public lastX: number = 0;
public lastY: number = 0;
constructor(currentX: number = 0, currentY: number = 0) {
this.currentX = currentX;
this.currentY = currentY;
}
reset(): void {
this.currentX = 0;
this.currentY = 0;
this.lastX = 0;
this.lastY = 0;
}
stash(): void {
this.lastX = this.currentX;
this.lastY = this.currentY;
}
toString(): string {
return `[currentX: ${this.currentX} currentY: ${this.currentY} lastX: ${this.lastX} lastY: ${this.lastY}]`;
}
}
\ No newline at end of file
... ...
@Observed
export class ScaleModel {
/**
* scaleValue: 本次缩放因子,用于控制图片的大小显示
* lastValue:记录上次缩放完后的缩放因子
* defaultMaxScaleValue:默认的最大放大值
* defaultScaleValue:默认缩放值,1
*/
public scaleValue: number;
public lastValue: number;
public maxScaleValue: number;
public extraScaleValue: number;
public readonly defaultScaleValue: number = 1;
constructor(scaleValue: number = 1.0, lastValue: number = 1.0,
maxScaleValue: number = 1.5, extraScaleValue: number = 0.2) {
this.scaleValue = scaleValue;
this.lastValue = lastValue;
this.maxScaleValue = maxScaleValue;
this.extraScaleValue = extraScaleValue;
}
reset(): void {
this.scaleValue = this.defaultScaleValue;
this.lastValue = this.scaleValue;
}
stash(): void {
this.lastValue = this.scaleValue;
}
toString(): string {
return `[scaleValue: ${this.scaleValue} lastValue: ${this.lastValue}]`;
}
}
\ No newline at end of file
... ...
... ... @@ -185,10 +185,10 @@ struct MineHomePage {
//tab 页面
Tabs({controller: this.controller}) {
TabContent() {
HomePageBottomComponent({style:0})
HomePageBottomComponent({style:0,commentNum:$commentNum})
}.tabBar(this.TabBuilder(0,"评论"))
TabContent() {
HomePageBottomComponent({style:1})
HomePageBottomComponent({style:1,commentNum:$commentNum})
}.tabBar(this.TabBuilder(1,"关注"))
}
.backgroundColor($r('app.color.white'))
... ...
/**
* 给函数的执行加上动画
* @param fn:要在动画内执行的回调函数,通常fn里面会改变状态变量
* @param duration:动画持续时长
* @param curve:动画区线
*/
import { ImageViewerConstants } from '../constants/ImageViewerConstants';
export function runWithAnimation(
fn: Function,
duration: number = ImageViewerConstants.ANIMATE_DURATION,
curve: Curve = Curve.Smooth): void {
animateTo({ duration: duration, curve: curve }, () => {
fn();
})
}
\ No newline at end of file
... ...
import { window } from '@kit.ArkUI';
class WindowSizeManager {
private size: window.Size = { width: 0, height: 0 };
constructor() {
window.getLastWindow(getContext()).then((value: window.Window) => {
const rect: window.Rect = value.getWindowProperties().windowRect;
this.size.width = px2vp(rect.width);
this.size.height = px2vp(rect.height);
console.log(`[windowWidth]${this.size.width} [windowHeight]${this.size.height}`);
})
}
get(): window.Size {
return this.size;
}
}
export const windowSizeManager: WindowSizeManager = new WindowSizeManager();
\ No newline at end of file
... ...
... ... @@ -25,6 +25,7 @@ export class ProcessUtils {
return;
}
let type = content.objectType;
console.log(TAG,'objectType',`${JSON.stringify(content)}`);
switch (type) {
case ContentConstants.TYPE_NONE:
Logger.debug(TAG, "processPage, do nothing");
... ... @@ -59,7 +60,7 @@ export class ProcessUtils {
break;
//动态详情页(动态视频)
case ContentConstants.TYPE_FIFTEEN:
ProcessUtils.gotoDynamicDetailPage(content);
ProcessUtils.gotoWeb(content);
break;
default:
break;
... ...
... ... @@ -44,7 +44,7 @@ class EditInfoViewModel {
new EditListInfo('简介',item&&item.userExtend.introduction?item.userExtend.introduction:'待完善'),
new EditListInfo('地区',item&&item.userExtend.address?item.userExtend.address:'待完善'),
new EditListInfo('生日',item&&item.userExtend.birthday?item.userExtend.birthday:'待完善'),
new EditListInfo('性别',item?(item.userExtend.sex === 1?'男':'女'):'待完善'),]
new EditListInfo('性别',item?(item.userExtend.sex === 10?'待完善':(item.userExtend.sex === 1?'男':'女')):'待完善'),]
return this.editListData
}
... ... @@ -129,6 +129,7 @@ class EditInfoViewModel {
.then((navResDTO: ResponseDTO) => {
if (navResDTO.code == 0) {
promptAction.showToast({ message: '修改成功' })
success(navResDTO)
}else {
promptAction.showToast({ message: navResDTO.message })
}
... ...
import { PageDTO, CompDTO, PageInfoDTO } from 'wdBean';
import { PageDTO, CompDTO, PageInfoDTO, ContentDTO } from 'wdBean';
import { CompStyle, ViewType } from 'wdConstant/Index';
import { CollectionUtils, DateTimeUtils, Logger } from 'wdKit';
import { closeRefresh } from '../utils/PullDownRefresh';
... ... @@ -58,7 +58,6 @@ export class PageHelper {
if (pageDto && pageDto.compList && pageDto.compList.length > 0) {
pageModel.viewType = ViewType.LOADED;
let sizeBefore: number = pageModel.compList.size();
pageModel.compList.push(...pageDto.compList)
if (pageDto.compList.length === pageModel.pageSize) {
pageModel.currentPage++;
pageModel.hasMore = true;
... ... @@ -66,6 +65,11 @@ export class PageHelper {
pageModel.hasMore = false;
}
//移除音频 和 活动
this.removeComp(pageModel,pageDto)
// pageModel.compList.push(...pageDto.compList)
// TODO 暂时去掉互动数据,待优化。(主要是互动数据返回,如何渲染到ui上)
// TODO updateItems(sizeBefore, data),这里可能有时序问题,导致覆盖别的group数据,需要优化,考虑精准替换
// 二次请求,批查互动数据
... ... @@ -108,7 +112,11 @@ export class PageHelper {
pageModel.hasMore = false;
}
let sizeBefore: number = pageModel.compList.size();
pageModel.compList.push(...data.compList)
//移除音频 和 活动
this.removeComp(pageModel,data)
//
// pageModel.compList.push(...data.compList)
PageViewModel.getInteractData(data.compList).then((data: CompDTO[]) => {
// 刷新,替换所有数据
pageModel.compList.updateItems(sizeBefore, data)
... ... @@ -119,6 +127,23 @@ export class PageHelper {
promptAction.showToast({ message: err });
})
}
/**
* 移除comp
*/
private removeComp(pageModel: PageModel, pageDto: PageDTO) {
let datas = pageDto.compList
for (let index = 0; index < datas.length; index++) {
const element = datas[index];
let contentInfo: ContentDTO = CollectionUtils.getElement(element.operDataList, 0);
//移除音频 和 活动
if (contentInfo && (contentInfo.objectType === '13' || contentInfo.objectType === '3')) {
Logger.debug(TAG, 'getGroupData 移除音频 和 活动');
}else {
pageModel.compList.push(element)
}
}
}
}
... ...
... ... @@ -39,6 +39,14 @@
{
"name": "image_request_fail",
"value": "图片加载失败,请检查网络"
},
{
"name": "EntryAbility_desc",
"value": "$string:app_desc"
},
{
"name": "reason_read_write_media",
"value": "user_grant"
}
]
}
\ No newline at end of file
... ...
import { LiveDetailsBean, LiveRoomItemBean } from 'wdBean/Index'
import { EmptyComponent, ErrorComponent, ListHasNoMoreDataUI } from 'wdComponent/Index'
import { EmptyComponent, ErrorComponent, ListHasNoMoreDataUI,WDViewDefaultType } from 'wdComponent/Index'
import CustomRefreshLoadLayout from 'wdComponent/src/main/ets/components/page/CustomRefreshLoadLayout'
import LoadMoreLayout from 'wdComponent/src/main/ets/components/page/LoadMoreLayout'
import RefreshLayout from 'wdComponent/src/main/ets/components/page/RefreshLayout'
... ... @@ -79,7 +79,7 @@ export struct TabChatComponent {
getLiveChatList() {
this.pageModel.currentPage = 1
this.liveViewModel.getLiveChatList(
1,
this.pageModel.currentPage,
this.liveDetailsBean?.liveInfo?.mlive?.mliveId,
this.liveDetailsBean?.newsId,
20,)
... ...
import { LiveDetailsBean, LiveRoomItemBean } from 'wdBean/Index'
import { ListHasNoMoreDataUI } from 'wdComponent/Index'
import { EmptyComponent, ErrorComponent, ListHasNoMoreDataUI } from 'wdComponent/Index'
import { StringUtils } from 'wdKit/Index'
import { LiveViewModel } from '../../viewModel/LiveViewModel'
import { TabLiveItemComponent } from './TabLiveItemComponent'
import CustomRefreshLoadLayout from 'wdComponent/src/main/ets/components/page/CustomRefreshLoadLayout'
import { RefreshLayoutBean } from 'wdComponent/src/main/ets/components/page/RefreshLayoutBean'
import PageModel from 'wdComponent/src/main/ets/viewmodel/PageModel'
import { ViewType } from 'wdConstant/Index'
import LoadMoreLayout from 'wdComponent/src/main/ets/components/page/LoadMoreLayout'
import RefreshLayout from 'wdComponent/src/main/ets/components/page/RefreshLayout'
@Component
export struct TabLiveComponent {
liveViewModel: LiveViewModel = new LiveViewModel()
@State liveList: Array<LiveRoomItemBean> = []
@Consume @Watch('updateDate') liveDetailsBean: LiveDetailsBean
@State private pageModel: PageModel = new PageModel()
updateDate() {
this.getLiveList()
... ... @@ -20,51 +27,98 @@ export struct TabLiveComponent {
build() {
Stack() {
if (this.liveList.length == 0) {
ListHasNoMoreDataUI({ style: 2 })
if (this.pageModel.viewType == ViewType.LOADING) {
this.LoadingLayout()
} else if (this.pageModel.viewType == ViewType.ERROR) {
ErrorComponent()
} else if (this.pageModel.viewType == ViewType.EMPTY) {
EmptyComponent()
} else {
List() {
ForEach(this.liveList, (item: LiveRoomItemBean) => {
ListItem() {
TabLiveItemComponent({ item: item })
}
})
ListItem() {
ListHasNoMoreDataUI()
}
}
this.ListLayout()
}
}
.alignContent(Alignment.Top)
.backgroundColor('#F5F5F5')
.height('100%')
.width('100%')
}
@Builder
ListLayout() {
List() {
ListItem() {
// 下拉刷新
RefreshLayout({
refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullDown, this.pageModel.pullDownRefreshImage,
this.pageModel.pullDownRefreshText, this.pageModel.pullDownRefreshHeight)
})
}
ForEach(this.liveList, (item: LiveRoomItemBean) => {
ListItem() {
TabLiveItemComponent({ item: item })
}
})
// 加载更多
ListItem() {
if (this.pageModel.hasMore) {
LoadMoreLayout({
refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullUpLoad, this.pageModel.pullUpLoadImage,
this.pageModel.pullUpLoadText, this.pageModel.pullUpLoadHeight)
})
} else {
ListHasNoMoreDataUI()
}
}
}
}
@Builder
LoadingLayout() {
CustomRefreshLoadLayout({
refreshBean: new RefreshLayoutBean(true,
$r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), this.pageModel.pullDownRefreshHeight)
})
}
getLiveList() {
this.pageModel.currentPage = 1
this.liveViewModel.getLiveList(
1,
this.pageModel.currentPage,
this.liveDetailsBean?.liveInfo?.mlive?.mliveId,
this.liveDetailsBean?.newsId,
20)
.then(
(data) => {
/**
* 在直播聊天添加一条新内容逻辑:
判断 oldNewsId:迁移id非空 且 直播状态不是预约:"wait"
消息内容:
1.头像固定:APP默认头像
2.名称固定:人民日报主持人
3.内容:详情接口的简介,newIntroduction
*/
if (StringUtils.isNotEmpty(this.liveDetailsBean.oldNewsId) && this.liveDetailsBean && this.liveDetailsBean.liveInfo.liveState != 'wait') {
let liveRoomItemBeanTemp: LiveRoomItemBean = {} as LiveRoomItemBean
liveRoomItemBeanTemp.text = this.liveDetailsBean.newIntroduction
liveRoomItemBeanTemp.senderUserName = '人民日报主持人'
data.barrageResponses.push(liveRoomItemBeanTemp)
if (data.barrageResponses && data.barrageResponses.length > 0) {
/**
* 在直播聊天添加一条新内容逻辑:
判断 oldNewsId:迁移id非空 且 直播状态不是预约:"wait"
消息内容:
1.头像固定:APP默认头像
2.名称固定:人民日报主持人
3.内容:详情接口的简介,newIntroduction
*/
if (StringUtils.isNotEmpty(this.liveDetailsBean.oldNewsId)
&& this.liveDetailsBean
&& this.liveDetailsBean.liveInfo.liveState != 'wait'
&& this.pageModel.currentPage == 1) {
let liveRoomItemBeanTemp: LiveRoomItemBean = {} as LiveRoomItemBean
liveRoomItemBeanTemp.text = this.liveDetailsBean.newIntroduction
liveRoomItemBeanTemp.senderUserName = '人民日报主持人'
data.barrageResponses.push(liveRoomItemBeanTemp)
}
this.pageModel.viewType = ViewType.LOADED;
this.liveList.push(...data.barrageResponses)
if (data.barrageResponses.length === this.pageModel.pageSize) {
this.pageModel.currentPage++;
this.pageModel.hasMore = true;
} else {
this.pageModel.hasMore = false;
}
} else {
this.pageModel.viewType = ViewType.EMPTY;
}
this.liveList = data.barrageResponses
},
() => {
... ...
import { LiveRoomItemBean } from 'wdBean/Index'
import { LiveRoomItemBean, PhotoListBean } from 'wdBean/Index'
import { DateTimeUtils, StringUtils } from 'wdKit/Index'
@Component
export struct TabLiveItemComponent {
item: LiveRoomItemBean = {} as LiveRoomItemBean
photoList: PhotoListBean[] = []
aboutToAppear(): void {
... ... @@ -86,7 +87,16 @@ export struct TabLiveItemComponent {
.aspectRatio(310 / 174)
.objectFit(ImageFit.Auto)
.borderRadius(4)
}
}.onClick(() => {
for (let item of this.item.pictureUrls) {
this.photoList.push({
width: 0,
height: 0,
picPath: item,
picDesc: ''
})
}
})
})
}.margin({
left: 32,
... ...
... ... @@ -200,18 +200,21 @@ export struct PlayUIComponent {
} else {
Blank()
}
Image($r('app.media.icon_live_player_full_screen'))
.width(24)
.height(24)
.onClick(() => {
this.displayDirection = this.displayDirection == DisplayDirection.VERTICAL ? DisplayDirection.VIDEO_HORIZONTAL : DisplayDirection.VERTICAL
WindowModel.shared.setPreferredOrientation(this.displayDirection == DisplayDirection.VERTICAL ?
window.Orientation.PORTRAIT :
window.Orientation.LANDSCAPE)
devicePLSensorManager.devicePLSensorOn(this.displayDirection == DisplayDirection.VERTICAL ?
window.Orientation.PORTRAIT :
window.Orientation.LANDSCAPE);
})
if (this.liveDetailsBean?.liveInfo?.liveState == 'running'
|| this.liveDetailsBean?.liveInfo?.liveState == 'end') {
Image($r('app.media.icon_live_player_full_screen'))
.width(24)
.height(24)
.onClick(() => {
this.displayDirection = this.displayDirection == DisplayDirection.VERTICAL ? DisplayDirection.VIDEO_HORIZONTAL : DisplayDirection.VERTICAL
WindowModel.shared.setPreferredOrientation(this.displayDirection == DisplayDirection.VERTICAL ?
window.Orientation.PORTRAIT :
window.Orientation.LANDSCAPE)
devicePLSensorManager.devicePLSensorOn(this.displayDirection == DisplayDirection.VERTICAL ?
window.Orientation.PORTRAIT :
window.Orientation.LANDSCAPE);
})
}
}
.alignItems(VerticalAlign.Center)
.linearGradient({ angle: 0, colors: [['#99000000', 0], ['#00000000', 1]] })
... ...
import { window } from '@kit.ArkUI'
import { NumberFormatterUtils, WindowModel } from 'wdKit/Index'
import { devicePLSensorManager } from 'wdDetailPlayApi/Index'
import { DateFormatUtil, WDPlayerController } from 'wdPlayer/Index'
import { LiveDetailsBean, LiveRoomDataBean } from 'wdBean/Index'
@Entry
@Component
export struct PlayVUIComponent {
playerController: WDPlayerController = new WDPlayerController();
//菜单键是否可见
@State isMenuVisible: boolean = true
@State isFullScreen: boolean = false
@Consume liveDetailsBean: LiveDetailsBean
@Consume liveRoomDataBean: LiveRoomDataBean
@State currentTime: string = ''
@State totalTime: string = ''
@State progressVal: number = 0;
//是否处于播放状态中
@State isPlayStatus: boolean = true
aboutToAppear(): void {
//播放进度监听
this.playerController.onTimeUpdate = (position: number, duration: number) => {
this.currentTime = DateFormatUtil.secondToTime(Math.floor(position / 1000));
this.totalTime = DateFormatUtil.secondToTime(Math.floor(duration / 1000));
this.progressVal = Math.floor(position * 100 / duration);
}
}
build() {
Column() {
this.getTopUIComponent()
this.getMiddleUIComponent()
this.getBottomUIComponent()
}
.width('100%')
.height('100%')
.alignItems(HorizontalAlign.Start)
}
@Builder
getTopUIComponent() {
Column() {
Row() {
Image($r('app.media.icon_arrow_left_white'))
.width(24)
.aspectRatio(1)
.visibility(Visibility.None)
.margin({
right: 10
})
if (this.liveDetailsBean.liveInfo?.liveState != 'wait') {
Text(this.liveDetailsBean.newsTitle)
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.fontSize('16fp')
.fontWeight(500)
.fontColor(Color.White)
.textAlign(TextAlign.Start)
.layoutWeight(1)
} else {
Blank()
}
Image($r('app.media.icon_share'))
.width(24)
.aspectRatio(1)
.visibility(Visibility.None)
}
.width('100%')
.alignItems(VerticalAlign.Center)
.margin({
bottom: 10
})
this.getLiveStatusView()
}.width('100%')
.padding({
top: 20,
bottom: 6,
left: 10,
right: 10
})
.alignItems(HorizontalAlign.Start)
.visibility(this.isMenuVisible ? Visibility.Visible : Visibility.None)
}
@Builder
getLiveStatusView() {
// 直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停
// 预约
if (this.liveDetailsBean.liveInfo?.liveState == 'wait') {
Row() {
Image($r('app.media.icon_live_status_wait'))
.width(22)
.height(18)
Text('预约')
.fontSize('11fp')
.fontWeight(400)
.fontColor(Color.White)
}
.backgroundColor('#4D000000')
.padding({
top: 1,
right: 4,
bottom: 1
})
}
// 直播中
else if (this.liveDetailsBean.liveInfo?.liveState == 'running') {
Row() {
Image($r('app.media.icon_live_status_running'))
.width(22)
.height(18)
Text('直播中')
.fontSize('11fp')
.fontWeight(400)
.fontColor(Color.White)
Image($r('app.media.icon_live_player_status_end'))
.width(12)
.height(12)
Text(`${NumberFormatterUtils.formatNumberWithWan(this.liveRoomDataBean.pv)}人参与`)
.fontSize('11fp')
.fontWeight(400)
.fontColor(Color.White)
}
.backgroundColor('#4D000000')
.padding({
top: 1,
right: 4,
bottom: 1
})
}
//回看
else if (this.liveDetailsBean.liveInfo?.liveState == 'end') {
Row() {
Text('回看')
.fontSize('11fp')
.fontWeight(400)
.fontColor(Color.White)
Image($r('app.media.icon_live_player_status_end'))
.width(12)
.height(12)
Text(`${NumberFormatterUtils.formatNumberWithWan(this.liveRoomDataBean.pv)}人参与`)
.fontSize('11fp')
.fontWeight(400)
.fontColor(Color.White)
}
.backgroundColor('#4D000000')
.padding({
left: 4,
top: 1,
right: 4,
bottom: 1
})
}
}
@Builder
getMiddleUIComponent() {
Stack()
.layoutWeight(1)
.width('100%')
.onClick(() => {
this.isMenuVisible = !this.isMenuVisible
})
}
@Builder
getBottomUIComponent() {
Row() {
if (this.liveDetailsBean?.liveInfo?.liveState == 'end') {
this.playOrPauseBtn()
Text(this.currentTime)
.fontColor(Color.White)
.fontWeight(600)
.fontSize('12fp')
.margin({
left: 16
})
this.playProgressView()
Text(this.totalTime)
.fontColor(Color.White)
.fontWeight(600)
.fontSize('12fp')
.margin({
right: 16
})
} else {
Blank()
}
Image($r('app.media.icon_live_player_full_screen'))
.width(24)
.height(24)
.onClick(() => {
this.isFullScreen = !this.isFullScreen
WindowModel.shared.setPreferredOrientation(this.isFullScreen ? window.Orientation.LANDSCAPE : window.Orientation.PORTRAIT);
devicePLSensorManager.devicePLSensorOn(this.isFullScreen ? window.Orientation.LANDSCAPE : window.Orientation.PORTRAIT);
})
}
.alignItems(VerticalAlign.Center)
.linearGradient({ angle: 0, colors: [['#99000000', 0], ['#00000000', 1]] })
.width('100%')
.padding({
left: 10,
right: 10,
top: 15,
bottom: 15
})
.visibility(this.isMenuVisible ? Visibility.Visible : Visibility.None)
}
@Builder
playOrPauseBtn() {
//暂停、播放
Image(this.isPlayStatus ? $r('app.media.icon_live_player_pause') : $r('app.media.player_play_ic'))
.width(24)
.height(24)
.onClick(() => {
if (this.isPlayStatus) {
this.isPlayStatus = false
this.playerController.pause()
} else {
this.isPlayStatus = true
this.playerController.play()
}
})
}
@Builder
playProgressView() {
Slider({
value: this.progressVal,
step: 1,
style: SliderStyle.OutSet
})
.blockSize({
width: 18,
height: 12
})// .blockStyle({
// type: SliderBlockType.IMAGE,
// image: $r('app.media.ic_player_block')
// })
.blockColor(Color.White)
.trackColor('#4DFFFFFF')
.selectedColor('#FFED2800')
.height(14)
.trackThickness(1)
.layoutWeight(1)
.margin({
left: 8,
right: 8
})
.onChange((value: number, mode: SliderChangeMode) => {
this.playerController?.setSeekTime(value, mode);
})
}
}
\ No newline at end of file
... ... @@ -15,14 +15,19 @@ export struct PlayerUIComponent {
// // 全屏按钮
// }.layoutWeight(1)
Row() {
PlayerCommentComponent()
PlayerVideoControlComponent({ playerController: this.playerController })
.visibility(this.isShowControl ? Visibility.Visible : Visibility.Hidden)
.animation({ duration: 500 })
}
.position({ y: '100%' })
.markAnchor({ y: '100%' })
PlayerCommentComponent()
.visibility(this.isShowControl ? Visibility.Hidden : Visibility.Visible)
.animation({ duration: 500 })
.position({ y: '100%' })
.markAnchor({ y: '100%' })
PlayerVideoControlComponent({ playerController: this.playerController })
.visibility(this.isShowControl ? Visibility.Visible : Visibility.Hidden)
.animation({ duration: 500 })
.position({ y: '100%' })
.markAnchor({ y: '100%' })
}
.height('100%')
.width('100%')
... ...
... ... @@ -31,6 +31,10 @@
{
"name": "refresh_fail_text",
"value": "刷新失败"
},
{
"name": "reason_read_write_media",
"value": "user_grant"
}
]
}
\ No newline at end of file
... ...
... ... @@ -13,6 +13,7 @@
"wdBean": "file:../../features/wdBean",
"wdRouter": "file:../../commons/wdRouter",
"wdNetwork": "file:../../commons/wdNetwork",
"wdConstant": "file:../../commons/wdConstant",
"wdDetailPlayApi": "file:../../features/wdDetailPlayApi",
// "wdComponent": "file:../../features/wdComponent"
}
... ...
... ... @@ -4,7 +4,6 @@ import { ResponseDTO } from 'wdNetwork/Index';
import { DetailPlayShortVideoPage } from './DetailPlayShortVideoPage'
import router from '@ohos.router';
import { contentListParams } from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest';
import window from '@ohos.window';
import { WindowModel } from 'wdKit';
const storage = LocalStorage.getShared();
... ... @@ -31,16 +30,16 @@ export struct DetailVideoListPage {
/**
* 开启沉浸式并设置状态栏颜色
*/
const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage
const windowClass: window.Window = windowStage.getMainWindowSync();
windowClass.setWindowLayoutFullScreen(true)
this.isFullScreen = true
windowClass.setWindowSystemBarProperties({
statusBarContentColor: '#ffffff',
})
// const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage
// const windowClass: window.Window = windowStage.getMainWindowSync();
// windowClass.setWindowLayoutFullScreen(true)
// this.isFullScreen = true
// windowClass.setWindowSystemBarProperties({
// statusBarContentColor: '#ffffff',
// })
let data: ContentDetailDTO[] = []
// let data: ContentDetailDTO[] = []
let action: Action = router.getParams() as Action
if (action) {
this.contentId = action.params?.contentID || ''
... ... @@ -63,17 +62,6 @@ export struct DetailVideoListPage {
await this.queryVideoList()
// await ContentDetailRequest.postRecommendVideoList({
// pageSize: 5,
// refreshCnt: 1
// }).then(res => {
// if (res.data) {
// data = data.concat(res.data)
// }
// console.log('res1===', JSON.stringify(res))
// console.log('res==' + this.data)
// })
if (this.data.length > 0) {
const params: contentListParams = {
... ... @@ -103,37 +91,18 @@ export struct DetailVideoListPage {
}
aboutToDisappear(): void {
const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage
const windowClass: window.Window = windowStage.getMainWindowSync(); // 获取应用主窗口
windowClass.setWindowLayoutFullScreen(false)
this.isFullScreen = false
windowClass.setWindowSystemBarProperties({ statusBarContentColor: '#000000' })
WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', })
WindowModel.shared.setWindowLayoutFullScreen(false)
}
onPageShow(): void {
if (!this.isFullScreen) {
const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage
const windowClass: window.Window = windowStage.getMainWindowSync();
windowClass.setWindowLayoutFullScreen(true)
this.isFullScreen = true
windowClass.setWindowSystemBarProperties({
statusBarContentColor: '#ffffff',
})
}
WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff', })
WindowModel.shared.setWindowLayoutFullScreen(true)
}
onPageHide(): void {
if (this.isFullScreen) {
const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage
const windowClass: window.Window = windowStage.getMainWindowSync(); // 获取应用主窗口
windowClass.setWindowLayoutFullScreen(false)
this.isFullScreen = false
windowClass.setWindowSystemBarProperties({ statusBarContentColor: '#000000' })
}
WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', })
WindowModel.shared.setWindowLayoutFullScreen(false)
}
/**
... ... @@ -166,7 +135,7 @@ export struct DetailVideoListPage {
})
}.width('100%')
.height('100%')
}, (item: ContentDetailDTO) => item.newsId + '')
}
.clip(false)
... ...
import { ContentDetailDTO, InteractDataDTO, RmhInfoDTO, UserInfoDTO } from 'wdBean/Index';
import { ContentDetailDTO, InteractDataDTO, Params, RmhInfoDTO, UserInfoDTO } from 'wdBean/Index';
import {
batchLikeAndCollectParams,
batchLikeAndCollectResult,
... ... @@ -8,10 +8,11 @@ import {
postExecuteLikeParams,
postInteractAccentionOperateParams
} from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest';
import { ToastUtils } from 'wdKit';
import { SPHelper, ToastUtils } from 'wdKit';
import { HttpUrlUtils } from 'wdNetwork/Index';
import { WDPlayerController } from 'wdPlayer/Index';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { SpConstants } from 'wdConstant/Index'
export interface OperationItem {
icon: Resource;
... ... @@ -64,9 +65,10 @@ export struct OperationListView {
/**
* 点赞、取消点赞
*/
toggleLikeStatus() {
async toggleLikeStatus() {
// 未登录,跳转登录
if (!HttpUrlUtils.getUserId()) {
const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
if (!user_id) {
this.playerController?.pause()
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
return
... ... @@ -77,10 +79,16 @@ export struct OperationListView {
contentType: this.contentDetailData?.newsType + '',
}
ContentDetailRequest.postExecuteLike(params).then(res => {
console.log('toggleLikeStatus==',)
if (this.newsStatusOfUser) {
this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus === '1' ? '0' : '1'
this.queryContentInteractCount()
if (this.newsStatusOfUser.likeStatus === '1') {
this.interactData.likeNum = Number(this.interactData.likeNum) + 1
} else {
this.interactData.likeNum = Number(this.interactData.likeNum) - 1
}
console.log('点赞、取消点赞==', this.newsStatusOfUser?.likeStatus, this.interactData?.likeNum)
// this.queryContentInteractCount()
}
})
... ... @@ -89,9 +97,10 @@ export struct OperationListView {
/**
* 收藏、取消收藏
*/
toggleCollectStatus() {
async toggleCollectStatus() {
// 未登录,跳转登录
if (!HttpUrlUtils.getUserId()) {
const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
if (!user_id) {
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
return
}
... ... @@ -104,10 +113,15 @@ export struct OperationListView {
}
ContentDetailRequest.postExecuteCollectRecord(params).then(res => {
console.log('toggleLikeStatus==',)
if (this.newsStatusOfUser) {
this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1
this.queryContentInteractCount()
// this.queryContentInteractCount()
if (this.newsStatusOfUser.collectStatus === 1) {
this.interactData.collectNum = Number(this.interactData.collectNum) + 1
} else {
this.interactData.collectNum = Number(this.interactData.collectNum) - 1
}
console.log('收藏、取消收藏==', this.newsStatusOfUser?.collectStatus, this.interactData?.collectNum)
}
})
... ... @@ -140,9 +154,10 @@ export struct OperationListView {
/**
* 关注号主
*/
handleAccention() {
async handleAccention() {
// 未登录,跳转登录
if (!HttpUrlUtils.getUserId()) {
const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
if (!user_id) {
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
return
}
... ... @@ -181,7 +196,15 @@ export struct OperationListView {
})
.id("row1")
.onClick(() => {
// 号主页
if (this.contentDetailData.rmhInfo?.cnMainControl === 1) {
// 号主页
const params: Params = {
creatorId: this.contentDetailData.rmhInfo.rmhId,
pageID: ''
}
WDRouterRule.jumpWithPage(WDRouterPage.peopleShipHomePage, params)
}
})
if (this.followStatus == '0') {
Image($r('app.media.ic_add'))
... ...
... ... @@ -4,9 +4,9 @@ import { WDRouterPage } from 'wdRouter';
@Entry
@Component
struct GuidePages {
guideImage = [$r('app.media.guide_static1'), $r('app.media.guide_static2'), $r('app.media.guide_static3'), $r('app.media.guide_static4')]
guideTitle = [$r('app.media.guide_title1'), $r('app.media.guide_title2'), $r('app.media.guide_title3'), $r('app.media.guide_title4')]
guideIndex = [$r('app.media.guide_index1'), $r('app.media.guide_index2'), $r('app.media.guide_index3'), $r('app.media.guide_button')]
guideImage = [$r('app.media.guide_static1'), $r('app.media.guide_static2'), $r('app.media.guide_static3'), $r('app.media.guide_static4'),$r('app.media.guide_static5')]
guideTitle = [$r('app.media.guide_title1'), $r('app.media.guide_title2'), $r('app.media.guide_title3'), $r('app.media.guide_title4'),$r('app.media.guide_title5')]
guideIndex = [$r('app.media.guide_index1'), $r('app.media.guide_index2'), $r('app.media.guide_index3'),$r('app.media.guide_index4'), $r('app.media.guide_button')]
build() {
Column() {
... ... @@ -57,7 +57,7 @@ struct GuidePages {
.margin({ bottom: 85 })
.height(40)
.onClick(() => {
if (index == 3) {
if (index == 4) {
// 跳转到首页
//WDRouterRule.jumpWithReplacePage(WDRouterPage.mainPage)
//跳转到兴趣偏好选择页
... ...
import HashMap from '@ohos.util.HashMap';
import { HttpUrlUtils, ResponseDTO } from 'wdNetwork';
import { HttpBizUtil, HttpUrlUtils, ResponseDTO } from 'wdNetwork';
import { Logger, SPHelper, StringUtils } from 'wdKit';
import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest';
import { LoginBean } from './LoginBean';
... ... @@ -224,7 +224,7 @@ export class LoginModel {
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return new Promise<string>((success, fail) => {
HttpRequest.post<ResponseDTO<string>>(HttpUrlUtils.getLogoutUrl(), bean, headers).then((data: ResponseDTO<string>) => {
HttpBizUtil.post<string>(HttpUrlUtils.getLogoutUrl(), bean, headers).then((data: ResponseDTO<string>)=>{
if (!data) {
fail("数据为空")
return
... ... @@ -234,10 +234,24 @@ export class LoginModel {
return
}
success('')
}, (error: Error) => {
}).catch((error:Error)=>{
fail(error.message)
Logger.debug("LoginViewModel:error ", error.toString())
Logger.debug("LoginViewModel:error ", error.toString())
})
// HttpRequest.post<ResponseDTO<string>>(HttpUrlUtils.getLogoutUrl(), bean, headers).then((data: ResponseDTO<string>) => {
// if (!data) {
// fail("数据为空")
// return
// }
// if (data.code != 0) {
// fail(data.message)
// return
// }
// success('')
// }, (error: Error) => {
// fail(error.message)
// Logger.debug("LoginViewModel:error ", error.toString())
// })
})
}
... ...
... ... @@ -185,7 +185,7 @@ struct LoginPage {
.height(48)
.backgroundColor("#F5F5F5")
.borderRadius(4)
.type(InputType.PhoneNumber)
.type(InputType.Normal)
.onChange((content) => {
this.accountContent = content
this.isSubmit = (this.accountContent.length >= 11 && this.passwordContent.length >= 6)
... ...
... ... @@ -85,7 +85,7 @@ export struct WDPlayerRenderLiveView {
console.log('insId===', this.insId)
this.xComponentController.setXComponentSurfaceSize({
surfaceWidth: 1920,
surfaceHeight: 1080
surfaceHeight: 720
});
this.playerController?.setXComponentController(this.xComponentController)
if (this.onLoad) {
... ...
... ... @@ -3,6 +3,7 @@ import { WDRouterRule } from 'wdRouter';
import { WDRouterPage } from 'wdRouter';
import { SPHelper } from 'wdKit/Index';
import { SpConstants } from 'wdConstant/Index';
import { ButtonOptions, promptAction } from '@kit.ArkUI';
@Entry
@Component
... ... @@ -79,6 +80,11 @@ struct LaunchInterestsHobbiesPage {
.margin({top:'2lpx',left:'19lpx'})
.width('100%')
.height('31lpx')
Image(item.choose ? $r('app.media.interestsSelected') : $r('app.media.interestsSelectNot'))
.height('32lpx')
.width('32lpx')
.margin({top:'80lpx',left:'110lpx'})
}.justifyContent(FlexAlign.Start)
}
... ... @@ -87,7 +93,7 @@ struct LaunchInterestsHobbiesPage {
.width('100%')
.height('100%')
.backgroundColor(Color.White)
.opacity(item.choose?0:0.7)
.opacity(item.choose?0:0.6)
.borderRadius(5)
}
}
... ... @@ -122,7 +128,21 @@ struct LaunchInterestsHobbiesPage {
.borderRadius('10lpx')
.width('662lpx')
.height('84lpx')
Image('')
.width('662lpx')
.height('84lpx')
.backgroundColor(Color.White)
.opacity(this.selectCount == 0 ? 0.6 : 0)
.borderRadius('10lpx')
.onClick(()=>{
if (this.selectCount == 0) {
promptAction.showToast({
message : '请先选择您感兴趣的内容哦',
duration: 2000,
bottom: 50
})
return
}
this.saveTagIds()
//跳转首页
WDRouterRule.jumpWithReplacePage(WDRouterPage.mainPage)
... ...
... ... @@ -32,7 +32,7 @@ struct DefaultWebPage {
WdWebComponent({
webUrl: this.url,
backVisibility: false,
reload: this.reload,
// reload: this.reload,
isPageEnd:$isPageEnd
})
}
... ...
... ... @@ -43,7 +43,10 @@
{
"name": "privacy_text_title_protocol",
"value": "《用户协议》"
},
{
"name": "reason_read_write_media",
"value": "user_grant"
}
]
}
\ No newline at end of file
... ...