王士厅
... ... @@ -53,28 +53,36 @@ export class HttpRequest {
static get<T = ResponseDTO<string>>(url: string, headers?: HashMap<string, string>): Promise<T> {
let config: AxiosRequestConfig = {
headers: HttpRequest.buildHeaderWithGlobalHeader(headers)
headers: HttpRequest.buildHeaderWithGlobalHeader(headers),
timeout:10000,
timeoutErrorMessage:"当前无网络,请重试"
}
return service.get(url, config)
}
static post<T = ResponseDTO<string>>(url: string, data?: object, headers?: HashMap<string, string>): Promise<T> {
let config: AxiosRequestConfig = {
headers: HttpRequest.buildHeaderWithGlobalHeader(headers)
headers: HttpRequest.buildHeaderWithGlobalHeader(headers),
timeout:10000,
timeoutErrorMessage:"当前无网络,请重试"
}
return service.post(url, data, config)
}
static put<T = ResponseDTO<string>>(url: string, data?: object, headers?: HashMap<string, string>): Promise<T> {
let config: AxiosRequestConfig = {
headers: HttpRequest.buildHeaderWithGlobalHeader(headers)
headers: HttpRequest.buildHeaderWithGlobalHeader(headers),
timeout:10000,
timeoutErrorMessage:"当前无网络,请重试"
}
return service.put(url, data, config)
}
static delete<T = ResponseDTO<string>>(url: string, headers?: HashMap<string, string>): Promise<T> {
let config: AxiosRequestConfig = {
headers: HttpRequest.buildHeaderWithGlobalHeader(headers)
headers: HttpRequest.buildHeaderWithGlobalHeader(headers),
timeout:10000,
timeoutErrorMessage:"当前无网络,请重试"
}
return service.delete(url, config)
}
... ...
import { Action, ContentDTO, Params, InteractDataDTO } from 'wdBean';
import { CommonConstants, ConfigConstants, ScreenType } from 'wdConstant';
import { Logger, ToastUtils, DateTimeUtils } from 'wdKit';
import { Logger, ToastUtils, DateTimeUtils, DisplayUtils } from 'wdKit';
import { CompUtils } from '../../utils/CompUtils';
import { ProcessUtils, WDRouterRule } from 'wdRouter';
import { TrackConstants,
... ... @@ -446,8 +446,11 @@ export struct PaperSingleColumn999CardView {
Image(this.loadImg?this.item?.coverUrl:'')
.borderRadius(5)
.objectFit(ImageFit.Fill)
.aspectRatio(319 / 179) ///图片设计比例
// .aspectRatio(319 / 179) ///图片设计比例
.padding({ top: 10 })
.backgroundColor('#f5f5f5')
.width('100%')
.height((DisplayUtils.getDeviceWidth() - 66)*(179 / 319))
//视频
if (this.item?.videoInfo) {
Row() {
... ... @@ -480,18 +483,14 @@ export struct PaperSingleColumn999CardView {
//直播
if (this.item?.objectType === '2') {
Row() {
Image(this.buildLiveStateImage())
.width(14)
.height(14)
.objectFit(ImageFit.Contain)
// LottieView({
// name: 'MorningPaper_live_status',
// path: "lottie/live_detail_living.json",
// lottieWidth: 14,
// lottieHeight: 14,
// autoplay: true,
// loop: true,
// })
LottieView({
name: 'MorningPaper_live_status+'+this.item.objectId,
path: "lottie/live_detail_living.json",
lottieWidth: 14,
lottieHeight: 14,
autoplay: true,
loop: true,
})
Text(this.buildLiveStateString())
.fontColor(Color.White)
... ...
... ... @@ -154,7 +154,7 @@ export class PageHelper {
}
// Logger.debug(TAG, 'getPageInfo go on')
this.parseGroup(pageModel, cacheIsSame)
}).catch(() => {
}).catch((err:Error) => {
this.refreshUIEnd(pageModel, false)
if (this.isPageLoaded(pageModel)) {
return
... ...
... ... @@ -15,7 +15,7 @@ import {
} from 'wdBean';
import { CompStyle } from 'wdConstant/Index';
import { CollectionUtils, Logger, ResourcesUtils, StringUtils } from 'wdKit';
import { CollectionUtils, Logger, ResourcesUtils, StringUtils, ToastUtils } from 'wdKit';
import { CacheData, ResponseDTO, } from 'wdNetwork';
import { PageUIReqBean } from '../components/page/bean/PageUIReqBean';
import { PageRepository } from '../repository/PageRepository';
... ... @@ -240,6 +240,9 @@ export class PageViewModel extends BaseViewModel {
}).catch((err: Error) => {
Logger.error(TAG, `getPageInfo then,error.name : ${err.name}, error.message:${err.message}`);
error(err);
if(err.message == "网络出小差了,请检查网络后重试"){
ToastUtils.shortToast(err.message)
}
});
});
}
... ...
... ... @@ -151,7 +151,7 @@ export struct DetailPlayLiveCommon {
.catch((error:Error) => {
Logger.debug(TAG + "error",error.message,error.name)
this.isHideLoading = true;
ToastUtils.shortToast('内容不存在');
ToastUtils.shortToast('网络出小差了,请检查网络后重试');
router.back();
reject();
});
... ...
... ... @@ -87,9 +87,12 @@ export struct DetailPlayLivePage {
this.getLiveDetails()
this.getLiveRoomData()
if(!await onlyWifiLoadVideo()){
this.showToastTip(this.toastText)
if (this.liveDetailPageLogic.dealOrShowToast()) {
if(!await onlyWifiLoadVideo()){
this.showToastTip(this.toastText)
}
}
this.configChatRoom()
}
... ...
... ... @@ -92,4 +92,21 @@ export class LiveDetailPageLogic {
}
return ''
}
dealOrShowToast(): boolean {
if (this.liveState == 'wait') {
if (this.contentDetailData.liveInfo
&& this.contentDetailData.liveInfo.previewUrl.length > 0
&& this.contentDetailData.liveInfo.previewType == 1) { ///预告视频
return true
}
}
if (this.liveState == 'running') {
if (this.contentDetailData.liveInfo.liveWay == 0) { ///直播视频
return true
}
}
return false
}
}
\ No newline at end of file
... ...
... ... @@ -11,17 +11,20 @@ export struct TabInfoComponent {
}
build() {
Column() {
this.showLiveTitle()
this.showLiveDetails()
LiveCountdownComponent({liveDetailsBean:this.contentDetailData})
}.margin({
top: 13,
left: 16,
right: 16
})
.height('100%')
.alignItems(HorizontalAlign.Start)
Scroll(){
Column() {
this.showLiveTitle()
this.showLiveDetails()
LiveCountdownComponent({liveDetailsBean:this.contentDetailData})
}.margin({
top: 13,
left: 16,
right: 16
})
.alignItems(HorizontalAlign.Start)
}.layoutWeight(1)
.width("100%")
.scrollBar(BarState.Off)
}
aboutToDisappear(): void {
... ...