yumaochao
Showing 42 changed files with 242 additions and 100 deletions
... ... @@ -34,6 +34,7 @@
{
"name": "default",
"signingConfig": "default",
"compileSdkVersion": "5.0.0(12)",
"compatibleSdkVersion": "5.0.0(12)",
"runtimeOS": "HarmonyOS",
}
... ...
... ... @@ -93,10 +93,8 @@ export class HttpBizUtil {
*/
static refreshToken(): Promise<string> {
let url = HttpUrlUtils.getRefreshTokenUrl();
let params: HashMap<string, string> = new HashMap<string, string>()
params.set('refreshToken', HttpUtils.getRefreshToken())
params.set('deviceId', HttpUtils.getDeviceId())
// Logger.debug(TAG, 'refreshToken getRefreshToken: ' + HttpUrlUtils.getRefreshToken())
let params: RefreshTokenParam =
new RefreshTokenParam(HttpUtils.getRefreshToken(), HttpUtils.getDeviceId())
// 请求刷新token接口
return new Promise<string>((success, error) => {
WDHttp.post<ResponseDTO<RefreshTokenRes>>(url, params).then((resDTO: ResponseDTO<RefreshTokenRes>) => {
... ... @@ -123,4 +121,14 @@ export class HttpBizUtil {
});
})
}
}
export class RefreshTokenParam {
refreshToken: string = ''
deviceId: string = ''
constructor(refreshToken: string, deviceId: string) {
this.refreshToken = refreshToken
this.deviceId = deviceId
}
}
\ No newline at end of file
... ...
... ... @@ -90,7 +90,7 @@ export struct WdWebComponent {
}
onReloadStateChanged() {
Logger.info(TAG, `onReloadStateChanged:::refresh, this.reload: ${this.reload}`);
if (this.reload > 0) {
if (this.reload > 0 && this.isPageEnd) {
this.webviewControl.refresh()
}
}
... ...
... ... @@ -121,15 +121,15 @@ export struct CompParser {
CardParser({ contentDTO: this.compDTO.operDataList[0], compDTO: this.compDTO });
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else {
Text(this.compDTO.compStyle)
.width(CommonConstants.FULL_PARENT)
.padding(10)
.onClick(() => {
if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_06) { //精选评论
WDRouterRule.jumpWithPage(WDRouterPage.QualityCommentsPage)
}
})
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
// Text(this.compDTO.compStyle)
// .width(CommonConstants.FULL_PARENT)
// .padding(10)
// .onClick(() => {
// if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_06) { //精选评论
// WDRouterRule.jumpWithPage(WDRouterPage.QualityCommentsPage)
// }
// })
// Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
}
}
... ...
... ... @@ -5,7 +5,6 @@ import {
EmitterUtils,
EmitterEventId,
NetworkUtil,
DisplayUtils
} from 'wdKit';
import {
Action,
... ... @@ -33,6 +32,7 @@ import { CommentComponent } from '../components/comment/view/CommentComponent'
import { HttpUtils } from 'wdNetwork/Index';
import { viewBlogItemInsightIntentShare } from '../utils/InsightIntentShare'
import { common } from '@kit.AbilityKit';
import { componentUtils, window } from '@kit.ArkUI';
const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm';
... ... @@ -58,6 +58,9 @@ export struct ImageAndTextPageComponent {
@State likeNum: number = 0
@State reachEndIncreament: number = 0
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
@State isScrollTop: boolean = true
@State offsetY: number = 0
build() {
Stack({ alignContent: Alignment.Top }) {
Stack({ alignContent: Alignment.Bottom }) {
... ... @@ -125,16 +128,19 @@ export struct ImageAndTextPageComponent {
fixedHeightMode: false,
reachEndIncreament: this.reachEndIncreament,
reachEndLoadMoreFinish: () => {
}
}).onAreaChange((oldValue: Area, newValue: Area) => {
this.info = newValue
})
}).id('comment')
.onAreaChange((oldValue: Area, newValue: Area) => {
this.info = newValue
})
// .onMeasureSize()
}
}
}
.id('imgTextContainer')
}
.width(CommonConstants.FULL_WIDTH)
.height(CommonConstants.FULL_HEIGHT)
... ... @@ -163,8 +169,27 @@ export struct ImageAndTextPageComponent {
publishCommentModel: this.publishCommentModel,
operationButtonList: this.operationButtonList,
styleType: 1,
onCommentIconClick: () => {
const info = componentUtils.getRectangleById('comment');
console.log(JSON.stringify(info))
if (!this.offsetY) {
this.offsetY = componentUtils.getRectangleById('comment').windowOffset.y
}
// 定位到评论区域
if (this.isScrollTop) {
this.scroller.scrollTo({
xOffset: 0,
yOffset: this.offsetY,
animation: true
})
} else {
this.scroller.scrollEdge(Edge.Top)
}
this.isScrollTop = !this.isScrollTop
}
})
.position({y: '100%'})
.position({ y: '100%' })
}
.width(CommonConstants.FULL_WIDTH)
.height(CommonConstants.FULL_HEIGHT)
... ... @@ -174,7 +199,7 @@ export struct ImageAndTextPageComponent {
// 发布时间
Column() {
Row() {
if(this.isNetConnected && !this.detailContentEmpty) {
if (this.isNetConnected && !this.detailContentEmpty) {
Image(this.contentDetailData?.rmhInfo ? $r('app.media.logo_rmh') : $r('app.media.logo_rmrb'))
.width(80)
.height(28)
... ... @@ -207,7 +232,7 @@ export struct ImageAndTextPageComponent {
private async getDetail() {
this.isNetConnected = NetworkUtil.isNetConnected()
if(!this.isNetConnected) {
if (!this.isNetConnected) {
this.emptyType = 1
}
let contentId: string = ''
... ... @@ -229,7 +254,7 @@ export struct ImageAndTextPageComponent {
let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType)
// 判断内容是否已下线,空数组表示下线
this.detailContentEmpty = detailBeans.length === 0 ? true : false
if(this.detailContentEmpty) {
if (this.detailContentEmpty) {
this.emptyType = 18
}
console.log(TAG, JSON.stringify(detailBeans))
... ... @@ -270,12 +295,11 @@ export struct ImageAndTextPageComponent {
}
//意图上报
private viewBlogInsightIntentShare(){
private viewBlogInsightIntentShare() {
let context = getContext(this) as common.UIAbilityContext;
viewBlogItemInsightIntentShare(context,this.contentDetailData, this.interactData)
viewBlogItemInsightIntentShare(context, this.contentDetailData, this.interactData)
}
private async getRecommend() {
let params: postRecommendListParams = {
imei: HttpUtils.getImei(),
... ... @@ -289,7 +313,7 @@ export struct ImageAndTextPageComponent {
let recommendList = await DetailViewModel.postRecommendList(params)
if (recommendList.length > 0) {
//推荐列表过滤音频和活动入口
this.recommendList = recommendList.filter(item => item.objectType !== '3' && item.objectType !== '13');
this.recommendList = recommendList.filter(item => item.objectType !== '3' && item.objectType !== '13');
}
}
... ...
... ... @@ -90,6 +90,9 @@ export struct SpacialTopicPageComponent {
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType || '')
this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment || '')
// }
if (this.contentDetailData[0]?.openComment) {
this.operationButtonList = ['collect', 'share']
}
this.trySendData2H5()
}
}
... ...
... ... @@ -22,6 +22,8 @@ export struct AdvCardParser {
@State compDTO: CompDTO = {} as CompDTO;
pageModel: PageModel = new PageModel();
build() {
this.contentBuilder(this.pageModel, this.compDTO);
}
... ...
import { CompDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import PageModel from '../../viewmodel/PageModel';
import { CardAdvBottom } from './CardAdvBottom';
... ... @@ -17,8 +18,11 @@ const TAG: string = 'Card2Component';
@Component
export struct CardAdvBigImageComponent {
@State compDTO: CompDTO = {} as CompDTO
@State loadImg: boolean = false;
pageModel: PageModel = new PageModel();
aboutToAppear(): void {
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
}
... ... @@ -33,7 +37,8 @@ export struct CardAdvBigImageComponent {
//新闻标题
Text(this.compDTO.matInfo.advTitle).bottomTextStyle().margin({ bottom: 8, })
//大图
Image(this.compDTO.matInfo.matImageUrl[0])
Image(this.loadImg ? this.compDTO.matInfo.matImageUrl[0] : '')
.backgroundColor(this.loadImg ? $r('app.color.color_B0B0B0') : 0xf5f5f5)
.width(CommonConstants.FULL_WIDTH)
.aspectRatio(16 / 9)
.borderRadius(4)
... ...
... ... @@ -4,6 +4,7 @@ import { AdvExtraData, AdvExtraItemData } from 'wdBean/src/main/ets/bean/adv/Adv
import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import PageModel from '../../viewmodel/PageModel';
import { CardAdvTop } from './CardAdvTop';
... ... @@ -23,14 +24,14 @@ export struct CardAdvGanMiComponent {
@State advExtraData: AdvExtraData = {} as AdvExtraData
@State advLength: number = 0;
pageModel: PageModel = new PageModel();
@State loadImg: boolean = false;
aboutToAppear(): void {
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
let extraData = this.compDTO.matInfo.extraData
let labelDTO = JSON.parse(extraData) as AdvExtraData
this.advExtraData = labelDTO
//this.advExtraData.item = [this.advExtraData.item[0]]
// this.advExtraData.item[2].title ="我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国"
this.advLength = this.advExtraData.item.length
}
... ... @@ -46,8 +47,9 @@ export struct CardAdvGanMiComponent {
Row() {
Stack() {
//长图
Image(this.advExtraData.itemTopImage)
Image(this.loadImg ? this.advExtraData.itemTopImage : '')
.width(CommonConstants.FULL_WIDTH)
.backgroundColor(this.loadImg ? $r('app.color.color_B0B0B0') : 0xf5f5f5)
.aspectRatio(343 / 40)
.borderRadius(4)
.borderWidth(0.5)
... ... @@ -73,8 +75,9 @@ export struct CardAdvGanMiComponent {
// 广告列表信息
Column() {
Image(content.image)
Image(this.loadImg ? content.image : '')
.width('100%')
.backgroundColor(this.loadImg ? $r('app.color.color_B0B0B0') : 0xf5f5f5)
.aspectRatio(150 / 84)
.borderWidth(0.5)
.borderColor($r('app.color.color_0D000000'))
... ... @@ -84,7 +87,7 @@ export struct CardAdvGanMiComponent {
.fontSize('16fp')
.fontColor($r('app.color.color_222222'))
.fontSize('15fp')
.maxLines(3)
.maxLines(2)
.lineHeight(20)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.width('100%')
... ... @@ -143,7 +146,9 @@ function commonButton(advExtraData: AdvExtraData) {
Row() {
Row() {
Blank()
Text('查看更多').fontColor('#222222').fontSize('14fp')
Text(advExtraData.itemMore.title == null ? $r('app.string.look_more') : advExtraData.itemMore.title)
.fontColor('#222222')
.fontSize('14fp')
Image($r('app.media.icon_comp_more_right_red')).width(16).height(16)
Blank()
... ...
... ... @@ -2,6 +2,7 @@
import { CompDTO } from 'wdBean';
import { CommonConstants, CompStyle } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import PageModel from '../../viewmodel/PageModel';
import { CardAdvBottom } from './CardAdvBottom';
... ... @@ -20,8 +21,10 @@ export struct CardAdvLongImageComponent {
@State compDTO: CompDTO = {} as CompDTO
@State haveTitle: boolean = true
pageModel: PageModel = new PageModel();
@State loadImg: boolean = false;
aboutToAppear(): void {
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
this.haveTitle = this.compDTO.matInfo.advSubType === CompStyle.Card_Adv_7;
}
... ... @@ -37,7 +40,8 @@ export struct CardAdvLongImageComponent {
Text(this.compDTO.matInfo.advTitle).width('100%').bottomTextStyle().margin({ bottom: 8, })
}
//长图
Image(this.compDTO.matInfo.matImageUrl[0])
Image(this.loadImg ? this.compDTO.matInfo.matImageUrl[0] : '')
.backgroundColor(this.loadImg ? $r('app.color.color_B0B0B0') : 0xf5f5f5)
.width(CommonConstants.FULL_WIDTH)
.aspectRatio(343 / 96)
.borderRadius(4)
... ...
... ... @@ -6,6 +6,7 @@ import measure from '@ohos.measure';
import { DisplayUtils } from 'wdKit/Index';
import { CardAdvBottom } from './CardAdvBottom';
import PageModel from '../../viewmodel/PageModel';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
const TAG: string = 'CardAdvSmallImageComponent';
... ... @@ -22,7 +23,10 @@ export struct CardAdvSmallImageComponent {
@State compDTO: CompDTO = {} as CompDTO
@State isBigThreeLine: boolean = false // 标题的行数大于等于3行 是true
pageModel: PageModel = new PageModel();
aboutToAppear(): void {
@State loadImg: boolean = false;
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
// 计算标题文本行数
let screenWith = DisplayUtils.getDeviceWidth();
... ... @@ -54,14 +58,14 @@ export struct CardAdvSmallImageComponent {
.id("title_name")
// 广告图
Image(this.compDTO.matInfo.matImageUrl[0])
Image(this.loadImg ? this.compDTO.matInfo.matImageUrl[0] : '')
.width('34%')
.aspectRatio(3 / 2)
.id('adv_imag')
.backgroundColor(this.loadImg ? $r('app.color.color_B0B0B0') : 0xf5f5f5)
.borderWidth(0.5)
.borderColor($r('app.color.color_0D000000'))
.borderRadius(4)
//.alt('wwww.baidu.com')
.borderRadius(4)//.alt('wwww.baidu.com')
.alignRules({
top: { anchor: 'title_name', align: VerticalAlign.Top },
left: { anchor: 'title_name', align: HorizontalAlign.End },
... ... @@ -69,7 +73,7 @@ export struct CardAdvSmallImageComponent {
.margin({ left: 12 })
CardAdvBottom({pageModel:this.pageModel,compDTO:this.compDTO}).width('62%').id('bottom_adv').alignRules({
CardAdvBottom({ pageModel: this.pageModel, compDTO: this.compDTO }).width('62%').id('bottom_adv').alignRules({
bottom: { anchor: this.isBigThreeLine ? '' : 'adv_imag', align: VerticalAlign.Bottom },
right: { anchor: this.isBigThreeLine ? '' : 'adv_imag', align: HorizontalAlign.Start },
top: { anchor: this.isBigThreeLine ? 'title_name' : '', align: VerticalAlign.Bottom },
... ... @@ -94,13 +98,15 @@ export struct CardAdvSmallImageComponent {
}
// 获取文本几行
private getTextLineNum(text: string, constraintWidth: number, lineHeight: number, fontSize: number | string | Resource) {
private getTextLineNum(text: string, constraintWidth: number, lineHeight: number,
fontSize: number | string | Resource) {
let size = this.topMeasureText(text, constraintWidth, lineHeight, fontSize)
let height: number = Number(size.height)
return Math.ceil(px2vp(height) / lineHeight)
}
private topMeasureText(text: string, constraintWidth: number, lineHeight: number, fontSize: number | string | Resource) {
private topMeasureText(text: string, constraintWidth: number, lineHeight: number,
fontSize: number | string | Resource) {
return measure.measureTextSize({
textContent: text,
fontSize: fontSize,
... ...
... ... @@ -2,6 +2,7 @@
import { CompDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import PageModel from '../../viewmodel/PageModel';
import { CardAdvBottom } from './CardAdvBottom';
... ... @@ -18,9 +19,11 @@ const TAG: string = 'Card2Component';
@Component
export struct CardAdvThreeImageComponent {
@State compDTO: CompDTO = {} as CompDTO
@State loadImg: boolean = false;
pageModel: PageModel = new PageModel();
aboutToAppear(): void {
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
}
aboutToDisappear(): void {
... ... @@ -43,7 +46,8 @@ export struct CardAdvThreeImageComponent {
ForEach(this.compDTO.matInfo.matImageUrl, (url: string, index: number) => {
if (index < 3) {
GridCol({ span: { xs: 4 } }) {
Image(url)
Image(this.loadImg ? url : '')
.backgroundColor(this.loadImg ? $r('app.color.color_B0B0B0') : 0xf5f5f5)
.width('100%')
.aspectRatio(113 / 75)
.borderRadius({
... ... @@ -62,7 +66,7 @@ export struct CardAdvThreeImageComponent {
.margin({ top: 8 })
// 广告工具组件
CardAdvBottom({pageModel:this.pageModel,compDTO:this.compDTO}).width('100%').margin({ top: 8 })
CardAdvBottom({ pageModel: this.pageModel, compDTO: this.compDTO }).width('100%').margin({ top: 8 })
}
.width('100%')
.justifyContent(FlexAlign.Start)
... ...
... ... @@ -2,6 +2,7 @@
import { CompDTO, ContentDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import PageModel from '../../viewmodel/PageModel';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo';
import { CardAdvBottom } from './CardAdvBottom';
... ... @@ -20,11 +21,11 @@ const TAG: string = 'Card2Component';
export struct CardAdvVideoComponent {
@State compDTO: CompDTO = {} as CompDTO
@State contentDTO: ContentDTO = new ContentDTO()
@State loadImg: boolean = false;
pageModel: PageModel = new PageModel();
aboutToAppear(): void {
// this.contentDTO.objectType = '1'
// this.contentDTO.videoInfo = { videoDuration: 1000 } as VideoInfoDTO
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
}
aboutToDisappear(): void {
... ... @@ -39,7 +40,8 @@ export struct CardAdvVideoComponent {
Text(this.compDTO.matInfo.advTitle).bottomTextStyle()
//大图
Stack() {
Image(this.compDTO.matInfo.matImageUrl[0])
Image(this.loadImg ? this.compDTO.matInfo.matImageUrl[0] : '')
.backgroundColor(this.loadImg ? $r('app.color.color_B0B0B0') : 0xf5f5f5)
.width(CommonConstants.FULL_WIDTH)
.aspectRatio(16 / 9)
.borderRadius(4)
... ... @@ -54,7 +56,7 @@ export struct CardAdvVideoComponent {
.width(CommonConstants.FULL_WIDTH)
.margin({ top: 8 })
CardAdvBottom({pageModel:this.pageModel,compDTO:this.compDTO}).margin({
CardAdvBottom({ pageModel: this.pageModel, compDTO: this.compDTO }).margin({
top: 8,
})
}
... ...
... ... @@ -3,6 +3,7 @@ import { AdvExtraData, AdvExtraItemData } from 'wdBean/src/main/ets/bean/adv/Adv
import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import PageModel from '../../viewmodel/PageModel';
import { CardAdvTop } from './CardAdvTop';
... ... @@ -21,9 +22,10 @@ export struct CardAdvVideoExComponent {
@State compDTO: CompDTO = {} as CompDTO
@State advExtraData: AdvExtraData = {} as AdvExtraData
pageModel: PageModel = new PageModel();
@State loadImg: boolean = false;
aboutToAppear(): void {
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
let extraData = this.compDTO.matInfo.extraData
let labelDTO = JSON.parse(extraData) as AdvExtraData
... ... @@ -40,14 +42,14 @@ export struct CardAdvVideoExComponent {
Stack() {
//长图
Image(this.advExtraData.itemTopImage)
Image(this.loadImg ? this.advExtraData.itemTopImage : '')
.width(CommonConstants.FULL_WIDTH)
.backgroundColor(this.loadImg ? $r('app.color.color_B0B0B0') : 0xf5f5f5)
.aspectRatio(343 / 80)
.borderRadius(4)
.borderWidth(0.5)
.borderColor($r('app.color.color_0D000000'))
CardAdvTop({ pageModel: this.pageModel, compDTO: this.compDTO })
}
.alignContent(Alignment.Top)
... ...
... ... @@ -5,6 +5,7 @@ import { CommonConstants } from 'wdConstant';
import { ProcessUtils } from 'wdRouter';
import { CardSourceInfo } from '../cardCommon/CardSourceInfo';
import { Notes } from './notes';
import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
const TAG = 'Card11Component';
... ... @@ -23,6 +24,7 @@ export struct Card11Component {
async aboutToAppear(): Promise<void> {
this.titleInit();
this.clicked = hasClicked(this.contentDTO.objectId)
}
titleInit() {
... ... @@ -76,8 +78,8 @@ export struct Card11Component {
})
.backgroundColor($r("app.color.white"))
.onClick((event: ClickEvent) => {
this.clicked = true;
persistentStorage(this.contentDTO.objectId);
ProcessUtils.processPage(this.contentDTO)
})
}
... ...
... ... @@ -4,6 +4,7 @@ import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import {CarderInteraction} from '../CarderInteraction'
import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
const TAG = 'Card12Component';
... ... @@ -21,6 +22,7 @@ export struct Card12Component {
aboutToAppear(): void {
this.titleInit();
this.clicked = hasClicked(this.contentDTO.objectId)
}
titleInit() {
... ... @@ -69,6 +71,7 @@ export struct Card12Component {
})
.onClick((event: ClickEvent) => {
this.clicked = true;
persistentStorage(this.contentDTO.objectId);
ProcessUtils.processPage(this.contentDTO)
})
}
... ...
... ... @@ -5,6 +5,7 @@ import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import {CarderInteraction} from '../CarderInteraction'
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
const TAG = 'Card14Component';
... ... @@ -23,6 +24,7 @@ export struct Card14Component {
async aboutToAppear(): Promise<void> {
this.titleInit();
this.clicked = hasClicked(this.contentDTO.objectId)
this.loadImg = await onlyWifiLoadImg();
}
... ... @@ -88,6 +90,7 @@ export struct Card14Component {
})
.onClick((event: ClickEvent) => {
this.clicked = true;
persistentStorage(this.contentDTO.objectId);
ProcessUtils.processPage(this.contentDTO)
})
}
... ...
... ... @@ -5,6 +5,7 @@ import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CommonConstants } from 'wdConstant/Index';
import {CarderInteraction} from '../CarderInteraction'
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
const TAG: string = 'Card15Component';
... ... @@ -27,6 +28,7 @@ export struct Card15Component {
async aboutToAppear(): Promise<void> {
this.titleInit();
this.clicked = hasClicked(this.contentDTO.objectId)
this.loadImg = await onlyWifiLoadImg();
}
... ... @@ -85,6 +87,7 @@ export struct Card15Component {
})
.onClick((event: ClickEvent) => {
this.clicked = true;
persistentStorage(this.contentDTO.objectId);
ProcessUtils.processPage(this.contentDTO)
})
}
... ...
... ... @@ -5,6 +5,7 @@ import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import {CarderInteraction} from '../CarderInteraction'
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
const TAG = 'Card16Component';
... ... @@ -28,6 +29,7 @@ export struct Card16Component {
async aboutToAppear(): Promise<void> {
this.titleInit();
this.clicked = hasClicked(this.contentDTO.objectId)
this.loadImg = await onlyWifiLoadImg();
}
... ... @@ -87,6 +89,7 @@ export struct Card16Component {
})
.onClick((event: ClickEvent) => {
this.clicked = true;
persistentStorage(this.contentDTO.objectId);
ProcessUtils.processPage(this.contentDTO)
})
}
... ...
... ... @@ -5,6 +5,7 @@ import { WDRouterRule } from 'wdRouter';
import { CardSourceInfo } from '../cardCommon/CardSourceInfo';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo';
import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
const TAG = 'Card17Component';
... ... @@ -24,6 +25,7 @@ export struct Card17Component {
async aboutToAppear(): Promise<void> {
this.titleInit();
this.clicked = hasClicked(this.contentDTO.objectId)
this.loadImg = await onlyWifiLoadImg();
}
... ... @@ -105,6 +107,7 @@ export struct Card17Component {
.width(CommonConstants.FULL_WIDTH)
.onClick((event: ClickEvent) => {
this.clicked = true;
persistentStorage(this.contentDTO.objectId);
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
... ...
... ... @@ -4,6 +4,7 @@ import { ProcessUtils } from 'wdRouter';
import { CommonConstants } from 'wdConstant/Index';
import { CarderInteraction } from '../CarderInteraction'
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
const TAG = 'Card19Component';
... ... @@ -21,6 +22,7 @@ export struct Card19Component {
async aboutToAppear(): Promise<void> {
this.titleInit();
this.clicked = hasClicked(this.contentDTO.objectId)
console.log('card19',JSON.stringify(this.contentDTO))
}
... ... @@ -74,6 +76,7 @@ export struct Card19Component {
})
.onClick((event: ClickEvent) => {
this.clicked = true;
persistentStorage(this.contentDTO.objectId);
ProcessUtils.processPage(this.contentDTO)
})
}
... ...
... ... @@ -5,6 +5,7 @@ import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import {CarderInteraction} from '../CarderInteraction'
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
const TAG = 'Card20Component';
... ... @@ -22,6 +23,7 @@ export struct Card20Component {
aboutToAppear(): void {
this.titleInit();
this.clicked = hasClicked(this.contentDTO.objectId)
}
titleInit() {
... ... @@ -71,6 +73,7 @@ export struct Card20Component {
})
.onClick((event: ClickEvent) => {
this.clicked = true;
persistentStorage(this.contentDTO.objectId);
ProcessUtils.processPage(this.contentDTO)
})
}
... ...
... ... @@ -5,6 +5,7 @@ import { RmhTitle } from '../cardCommon/RmhTitle'
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import {CarderInteraction} from '../CarderInteraction'
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
const TAG: string = 'Card6Component-Card13Component';
... ... @@ -23,6 +24,7 @@ export struct Card21Component {
async aboutToAppear(): Promise<void> {
this.titleInit();
this.clicked = hasClicked(this.contentDTO.objectId)
this.loadImg = await onlyWifiLoadImg();
}
... ... @@ -79,6 +81,7 @@ export struct Card21Component {
}
.onClick((event: ClickEvent) => {
this.clicked = true;
persistentStorage(this.contentDTO.objectId);
ProcessUtils.processPage(this.contentDTO)
})
.padding({
... ...
... ... @@ -7,7 +7,7 @@ import { CardSourceInfo } from '../cardCommon/CardSourceInfo';
import { Notes } from './notes';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
// import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
const TAG: string = 'Card2Component';
/**
... ... @@ -29,9 +29,9 @@ export struct Card2Component {
@State str03: string = '';
async aboutToAppear(): Promise<void> {
this.clicked = hasClicked(this.contentDTO.objectId)
this.titleInit();
this.loadImg = await onlyWifiLoadImg();
// this.clicked = hasClicked(this.contentDTO.objectId)
}
titleInit() {
... ... @@ -109,7 +109,7 @@ export struct Card2Component {
})
.onClick((event: ClickEvent) => {
this.clicked = true;
// persistentStorage(this.contentDTO.objectId);
persistentStorage(this.contentDTO.objectId);
ProcessUtils.processPage(this.contentDTO)
})
}
... ...
... ... @@ -3,6 +3,7 @@ import { CompDTO, ContentDTO } from 'wdBean';
import { ProcessUtils } from 'wdRouter';
import { CardSourceInfo } from '../cardCommon/CardSourceInfo';
import { Notes } from './notes';
import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
/**
* 卡片样式:"appStyle":"3"
... ... @@ -20,7 +21,7 @@ export struct Card3Component {
async aboutToAppear(): Promise<void> {
this.titleInit();
// this.clicked = hasClicked(this.contentDTO.objectId)
this.clicked = hasClicked(this.contentDTO.objectId)
}
titleInit() {
... ... @@ -71,6 +72,7 @@ export struct Card3Component {
})
.onClick((event: ClickEvent) => {
this.clicked = true;
persistentStorage(this.contentDTO.objectId);
ProcessUtils.processPage(this.contentDTO)
})
}
... ...
... ... @@ -5,6 +5,7 @@ import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { Notes } from './notes';
import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
const TAG: string = 'Card4Component';
/**
... ... @@ -26,6 +27,7 @@ export struct Card4Component {
@ObjectLink compDTO: CompDTO
async aboutToAppear(): Promise<void> {
this.clicked = hasClicked(this.contentDTO.objectId)
this.titleInit();
this.loadImg = await onlyWifiLoadImg();
}
... ... @@ -102,6 +104,7 @@ export struct Card4Component {
.alignItems(HorizontalAlign.Start)
.onClick((event: ClickEvent) => {
this.clicked = true;
persistentStorage(this.contentDTO.objectId);
ProcessUtils.processPage(this.contentDTO)
})
//bottom 评论等信息
... ...
... ... @@ -3,6 +3,7 @@ import { CommonConstants } from 'wdConstant';
import { ProcessUtils } from 'wdRouter';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { Notes } from './notes';
import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
const TAG: string = 'Card5Component';
... ... @@ -21,6 +22,7 @@ export struct Card5Component {
@State str03: string = '';
async aboutToAppear(): Promise<void> {
this.clicked = hasClicked(this.contentDTO.objectId)
this.loadImg = await onlyWifiLoadImg();
this.titleInit();
... ... @@ -95,6 +97,7 @@ export struct Card5Component {
})
.onClick((event: ClickEvent) => {
this.clicked = true;
persistentStorage(this.contentDTO.objectId);
ProcessUtils.processPage(this.contentDTO)
})
... ...
... ... @@ -6,6 +6,7 @@ import { CardMediaInfo } from '../cardCommon/CardMediaInfo';
import { Notes } from './notes';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { Logger } from 'wdKit/Index';
import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
const TAG: string = 'Card6Component-Card13Component';
... ... @@ -26,7 +27,7 @@ export struct Card6Component {
async aboutToAppear(): Promise<void> {
this.titleInit();
this.loadImg = await onlyWifiLoadImg();
// this.clicked = hasClicked(this.contentDTO.objectId)
this.clicked = hasClicked(this.contentDTO.objectId)
}
titleInit() {
... ... @@ -104,7 +105,7 @@ export struct Card6Component {
}
.onClick((event: ClickEvent) => {
this.clicked = true;
// persistentStorage(this.contentDTO.objectId);
persistentStorage(this.contentDTO.objectId);
ProcessUtils.processPage(this.contentDTO)
})
.padding({
... ...
... ... @@ -4,6 +4,7 @@ import { DateTimeUtils } from 'wdKit';
import { ProcessUtils } from 'wdRouter';
import { Notes } from './notes';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
/**
* 时间链卡--CompStyle: 09
... ... @@ -23,6 +24,7 @@ export struct Card9Component {
async aboutToAppear(): Promise<void> {
this.titleInit();
// this.loadImg = await onlyWifiLoadImg();
this.clicked = hasClicked(this.contentDTO.objectId)
}
titleInit() {
... ... @@ -111,6 +113,7 @@ export struct Card9Component {
.margin({ bottom: 8 })
.onClick((event: ClickEvent) => {
this.clicked = true;
persistentStorage(this.contentDTO.objectId);
ProcessUtils.processPage(this.contentDTO)
})
}
... ... @@ -163,6 +166,7 @@ export struct Card9Component {
.textOverflow({ overflow: TextOverflow.Ellipsis })
.alignSelf(ItemAlign.Center)
.margin({ left: 12 })
// .padding({bottom: 20})
// if (item.fullColumnImgUrls[0] && item.fullColumnImgUrls[0].url) {
// Image(this.loadImg? item.fullColumnImgUrls[0].url : '')
// .backgroundColor(0xf5f5f5)
... ... @@ -175,7 +179,7 @@ export struct Card9Component {
}
.alignContent(Alignment.TopStart)
}
.height(item.fullColumnImgUrls[0] && item.fullColumnImgUrls[0].url ? 100 : 78)
.height(item.fullColumnImgUrls[0] && item.fullColumnImgUrls[0].url ? 100 : 50)
.alignItems(HorizontalAlign.Start)
}
}
\ No newline at end of file
... ...
... ... @@ -9,7 +9,7 @@ import { ContentDetailDTO } from 'wdBean/Index'
export struct CommentTabComponent {
private onCommentFocus: () => void = () => {
}
private onLoad: (dialogController: CustomDialogController) => void = () => {
private onLoad: (dialogController: CustomDialogController | null) => void = () => {
}
@ObjectLink publishCommentModel: publishCommentModel
@Prop contentDetail: ContentDetailDTO
... ... @@ -42,7 +42,7 @@ export struct CommentTabComponent {
},
backgroundColor: "#50000000",
})
this.onLoad(this.dialogController)
}
... ...
... ... @@ -139,7 +139,7 @@ export struct ZhSingleRow06 {
.height(16)
.margin({right: 3})
Text('点赞')
Text(Number(this.newsStatusOfUser?.likeStatus) == 1 ? '已赞' : '点赞')
.fontSize(15)
.fontColor(0x999999)
.onClick(() => {
... ...
... ... @@ -98,6 +98,7 @@ export struct BottomNavigationComponent {
});
}
.zIndex(10)
.scrollable(false)
.animationDuration(0)
.barHeight($r('app.float.bottom_navigation_barHeight'))
... ... @@ -132,6 +133,7 @@ export struct BottomNavigationComponent {
.fontColor(this.currentNavIndex === index ? navItem.nameCColor : navItem.nameColor)
.opacity(this.currentNavIndex === index ? this.FULL_OPACITY : this.SIXTY_OPACITY)
}
.zIndex(10)
.height($r('app.float.bottom_navigation_barHeight'))
.hoverEffect(HoverEffect.Highlight)
.onClick(() => {
... ...
... ... @@ -78,9 +78,12 @@ export struct PeopleShipHomeArticleListComponent {
List({scroller: this.scroller}) {
// 下拉刷新
ForEach(this.arr, (item: ContentDTO) => {
ForEach(this.arr, (item: ContentDTO, index: number) => {
ListItem() {
CardParser({compDTO:new CompDTO, contentDTO: item })
Column() {
CardParser({compDTO:new CompDTO, contentDTO: item })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
}
}.width("100%")
.backgroundColor(Color.Transparent)
}, (item: ContentDTO, index: number) => item.objectId + index.toString())
... ...
... ... @@ -64,6 +64,7 @@ export struct OperRowListView {
/**
* 用于区分页面类型,在哪个页面嵌套就传相应的值
* 1:视频详情页 2:竖屏直播页 3:图集 4:横屏直播页
* 8: 评论弹框内
*/
@Prop pageComponentType?: number = -1
@Prop showBackIcon?: boolean = true
... ... @@ -208,7 +209,7 @@ export struct OperRowListView {
contentDetail: this.contentDetailData,
onCommentFocus: this.onCommentFocus,
pageComponentType: this.pageComponentType,
onLoad: (dialogController: CustomDialogController) => {
onLoad: (dialogController: CustomDialogController | null) => {
this.dialogController = dialogController
}
})
... ...
... ... @@ -29,7 +29,7 @@ export function touchUpLoadMore(model: PageModel) {
if ((self.isCanLoadMore === true) && (self.hasMore === true) && (self.isLoading === false)) {
self.isLoading = true;
setTimeout(() => {
closeLoadMore(model);
// closeLoadMore(model);
PageHelper.loadMore(self)
}, Const.DELAY_TIME);
} else {
... ...
... ... @@ -13,7 +13,7 @@ export class RefreshConstants {
/**
* The delay time.
*/
static readonly DELAY_TIME: number = 200;
static readonly DELAY_TIME: number = 50;
/**
* The animation duration.
... ...
// PersistentStorage.persistProp('clickedIds', []);
//
// function persistentStorage(id: string | number, type: 'add' | 'remove' | undefined = 'add') {
// let clickedIds = AppStorage.get<string>('clickedIds')?.split(',') || [];
// let index = clickedIds.indexOf(id.toString())
// if (type === 'add') {
// if (index >= 0) return;
// clickedIds.push(id.toString());
// } else if (type === 'remove') {
// clickedIds.splice(index, 1);
// }
// AppStorage.set('clickedIds', clickedIds.join(','));
// }
//
// function hasClicked(id: string | number) {
// let clickedIds = AppStorage.get<string>('clickedIds')?.split(',') || [];
// let index = clickedIds.indexOf(id.toString())
// if (index >= 0) return true;
// return false;
// }
//
// export { persistentStorage, hasClicked }
\ No newline at end of file
PersistentStorage.persistProp('clickedIds', []);
function persistentStorage(id: string | number, type: 'add' | 'remove' | undefined = 'add') {
let _clickedIds = AppStorage.get<string[]>('clickedIds');
let clickedIds = _clickedIds?.toString()?.split(',') || [];
let index = clickedIds.indexOf(id.toString())
if (type === 'add') {
if (index >= 0) return;
clickedIds.push(id.toString());
} else if (type === 'remove') {
clickedIds.splice(index, 1);
}
AppStorage.set('clickedIds', clickedIds.join(','));
}
function hasClicked(id: string | number) {
let clickedIds = AppStorage.get<string>('clickedIds')?.split(',') || [];
let index = clickedIds.indexOf(id.toString())
if (index >= 0) return true;
return false;
}
export { persistentStorage, hasClicked }
\ No newline at end of file
... ...
... ... @@ -14,6 +14,7 @@ import { BaseDTO } from 'wdBean/src/main/ets/bean/component/BaseDTO';
import { viewBlogInsightIntentShare, ActionMode } from '../utils/InsightIntentShare'
import { common } from '@kit.AbilityKit';
import { CacheData } from 'wdNetwork/Index';
import { closeLoadMore } from '../utils/PullUpLoadMore';
const TAG = 'PageHelper';
... ... @@ -37,7 +38,7 @@ export class PageHelper {
if (!netStatus) {
ToastUtils.showToast('网络出小差了,请检查网络后重试', 1000)
setTimeout(() => {
closeRefresh(pageModel, false)
this.refreshUIEnd(pageModel, false)
}, 500)
return
}
... ... @@ -46,6 +47,10 @@ export class PageHelper {
this.getPageInfo(pageModel, pageAdvModel)
}
private refreshUIEnd(pageModel: PageModel, isRefreshSuccess: boolean) {
closeRefresh(pageModel, isRefreshSuccess)
}
/**
* 分页加载
*/
... ... @@ -60,6 +65,10 @@ export class PageHelper {
this.compLoadMore(pageModel)
}
private loadMoreEnd(pageModel: PageModel) {
closeLoadMore(pageModel)
}
/**
* 进页面请求数据
*/
... ... @@ -105,7 +114,7 @@ export class PageHelper {
} else {
//更新数据
pageModel.compList.addItems(liveReviewDTO.list);
closeRefresh(pageModel, true);
this.refreshUIEnd(pageModel, true);
}
}).catch((err: string | Resource) => {
promptAction.showToast({ message: err });
... ... @@ -233,7 +242,7 @@ export class PageHelper {
//
pageModel.currentPage++
pageModel.viewType = ViewType.LOADED
closeRefresh(pageModel, true)
this.refreshUIEnd(pageModel, true)
if (pageModel.compList.isEmpty()) {
// 没数据,展示空页面
... ... @@ -277,6 +286,7 @@ export class PageHelper {
//聚合页
if (pageModel.pageType == 1) {
PageViewModel.postThemeList(pageModel.currentPage, pageModel.pageSize, pageModel.extra).then((liveReviewDTO) => {
this.loadMoreEnd(pageModel)
if (liveReviewDTO == null || liveReviewDTO.list == null || liveReviewDTO.list.length == 0) {
pageModel.hasMore = false;
return;
... ... @@ -290,6 +300,7 @@ export class PageHelper {
}
}).catch((err: string | Resource) => {
promptAction.showToast({ message: err });
this.loadMoreEnd(pageModel)
})
} else {
... ... @@ -301,7 +312,7 @@ export class PageHelper {
// 默认加载更多走 楼层接口
PageViewModel.getPageGroupCompData(pageModel.bizCopy())
.then((data: PageDTO) => {
this.loadMoreEnd(pageModel)
if (data == null || data.compList == null || data.compList.length == 0) {
pageModel.hasMore = false;
} else {
... ... @@ -316,6 +327,7 @@ export class PageHelper {
}
}).catch((err: string | Resource) => {
promptAction.showToast({ message: err });
this.loadMoreEnd(pageModel)
})
}
}
... ... @@ -651,6 +663,7 @@ export class PageHelper {
let pageSize = Normal_Page_Size
PageViewModel.getLiveReviewUrl(currentPage, pageSize).then((liveReviewDTO) => {
this.loadMoreEnd(pageModel)
if (liveReviewDTO == null || liveReviewDTO.list == null || liveReviewDTO.list.length == 0) {
pageModel.hasMore = false;
} else {
... ... @@ -696,9 +709,9 @@ export class PageHelper {
this.getLiveRoomDataInfo(pageInfo.oneRequestPageGroupCompList.convertToArray())
}
}).catch((err: string | Resource) => {
promptAction.showToast({ message: err });
this.loadMoreEnd(pageModel)
})
}
... ...
... ... @@ -102,5 +102,10 @@
"name": "feedback_hideemail",
"value": "请输入电话或者邮箱"
}
,
{
"name": "look_more",
"value": "查看更多"
}
]
}
\ No newline at end of file
... ...
... ... @@ -17,6 +17,7 @@ import { PlayerBottomView } from '../view/PlayerBottomView';
import { PlayerRightView } from '../view/PlayerRightView';
import { DisplayDirection } from 'wdConstant/Index';
import { CommentDialogView } from '../view/CommentDialogView';
import { window } from '@kit.ArkUI';
const TAG = 'DetailPlayShortVideoPage';
... ... @@ -294,6 +295,15 @@ export struct DetailPlayShortVideoPage {
.margin({ top: 280 })
.onClick(() => {
// 全屏方案待定
// this.displayDirection = DisplayDirection.VERTICAL
this.displayDirection = this.displayDirection == DisplayDirection.VERTICAL ?
DisplayDirection.VIDEO_HORIZONTAL :
DisplayDirection.VERTICAL
WindowModel.shared.setPreferredOrientation(this.displayDirection == DisplayDirection.VERTICAL ?
window.Orientation.PORTRAIT :
window.Orientation.LANDSCAPE_INVERTED)
})
}
... ...
... ... @@ -91,6 +91,7 @@ export struct DetailDialog {
OperRowListView({
componentType: 1,
pageComponentType: 8,
showBackIcon: false,
operationButtonList: ['comment', 'like', 'collect', 'share'],
contentDetailData: this.contentDetailData,
... ...
... ... @@ -96,6 +96,7 @@ export struct WDPlayerRenderView {
this.onLoad(event)
}
})
.zIndex(1000)
.width(this.selfSize.width)
.height(this.selfSize.height)
}
... ...