xugenyuan

ref |> 使用web控件提前预加载H5专题

Signed-off-by: xugenyuan <xugenyuan@wondertek.com.cn>
import { CompDTO, ContentDTO, InteractDataDTO, LiveReviewDTO, LiveRoomDataBean, PageDTO, PageInfoDTO } from 'wdBean';
import { CompStyle, ViewType } from 'wdConstant/Index';
import { CompStyle, ContentConstants, ViewType } from 'wdConstant/Index';
import { CollectionUtils, DateTimeUtils, LazyDataSource, Logger, NetworkUtil, StringUtils, ToastUtils } from 'wdKit';
import { closeRefresh } from '../utils/PullDownRefresh';
import PageModel from './PageModel';
... ... @@ -15,6 +15,7 @@ import { viewBlogInsightIntentShare, ActionMode } from '../utils/InsightIntentSh
import { common } from '@kit.AbilityKit';
import { CacheData } from 'wdNetwork/Index';
import { closeLoadMore } from '../utils/PullUpLoadMore';
import { webview } from '@kit.ArkWeb';
const TAG = 'PageHelper';
... ... @@ -258,6 +259,8 @@ export class PageHelper {
// 批查互动数据
this.allCompBatchRequest(pageInfo.oneRequestPageGroupCompList.convertToArray(), pageModel)
// 提前预加载H5专题
this.preloadH5Topic(pageInfo.oneRequestPageGroupCompList.convertToArray())
// 记录第一页数量
this.saveFirstPageEndIndex(pageModel)
if (!isCache) {
... ... @@ -349,6 +352,8 @@ export class PageHelper {
this.loadMorePageComp(pageModel, data)
// 参与批查
this.allCompBatchRequest(data.compList, pageModel)
// 提前预加载H5专题
this.preloadH5Topic(data.compList)
}
}).catch((err: string | Resource) => {
promptAction.showToast({ message: err });
... ... @@ -489,6 +494,28 @@ export class PageHelper {
}
/**
* 预加载H5专题
* @param compList
*/
private preloadH5Topic(compList: CompDTO[]) {
compList.forEach((comp) => {
comp.operDataList.forEach((program) => {
if (program.objectType != ContentConstants.TYPE_SPECIAL_TOPIC) {
return
}
if (program.objectLevel == "22" || program.objectLevel == "25") { // 音频专题 和 早晚报专题
return
}
if (program.linkUrl.length > 0) {
Logger.debug(TAG, "预加载H5专题link: " + program.linkUrl)
webview.WebviewController.prepareForPageLoad(program.linkUrl, true, 2)
}
})
})
}
/**
* 直播回看的批查数据
* @param list
* @param compList
... ...