Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool
Showing
8 changed files
with
67 additions
and
34 deletions
| @@ -53,28 +53,36 @@ export class HttpRequest { | @@ -53,28 +53,36 @@ export class HttpRequest { | ||
| 53 | 53 | ||
| 54 | static get<T = ResponseDTO<string>>(url: string, headers?: HashMap<string, string>): Promise<T> { | 54 | static get<T = ResponseDTO<string>>(url: string, headers?: HashMap<string, string>): Promise<T> { |
| 55 | let config: AxiosRequestConfig = { | 55 | let config: AxiosRequestConfig = { |
| 56 | - headers: HttpRequest.buildHeaderWithGlobalHeader(headers) | 56 | + headers: HttpRequest.buildHeaderWithGlobalHeader(headers), |
| 57 | + timeout:10000, | ||
| 58 | + timeoutErrorMessage:"当前无网络,请重试" | ||
| 57 | } | 59 | } |
| 58 | return service.get(url, config) | 60 | return service.get(url, config) |
| 59 | } | 61 | } |
| 60 | 62 | ||
| 61 | static post<T = ResponseDTO<string>>(url: string, data?: object, headers?: HashMap<string, string>): Promise<T> { | 63 | static post<T = ResponseDTO<string>>(url: string, data?: object, headers?: HashMap<string, string>): Promise<T> { |
| 62 | let config: AxiosRequestConfig = { | 64 | let config: AxiosRequestConfig = { |
| 63 | - headers: HttpRequest.buildHeaderWithGlobalHeader(headers) | 65 | + headers: HttpRequest.buildHeaderWithGlobalHeader(headers), |
| 66 | + timeout:10000, | ||
| 67 | + timeoutErrorMessage:"当前无网络,请重试" | ||
| 64 | } | 68 | } |
| 65 | return service.post(url, data, config) | 69 | return service.post(url, data, config) |
| 66 | } | 70 | } |
| 67 | 71 | ||
| 68 | static put<T = ResponseDTO<string>>(url: string, data?: object, headers?: HashMap<string, string>): Promise<T> { | 72 | static put<T = ResponseDTO<string>>(url: string, data?: object, headers?: HashMap<string, string>): Promise<T> { |
| 69 | let config: AxiosRequestConfig = { | 73 | let config: AxiosRequestConfig = { |
| 70 | - headers: HttpRequest.buildHeaderWithGlobalHeader(headers) | 74 | + headers: HttpRequest.buildHeaderWithGlobalHeader(headers), |
| 75 | + timeout:10000, | ||
| 76 | + timeoutErrorMessage:"当前无网络,请重试" | ||
| 71 | } | 77 | } |
| 72 | return service.put(url, data, config) | 78 | return service.put(url, data, config) |
| 73 | } | 79 | } |
| 74 | 80 | ||
| 75 | static delete<T = ResponseDTO<string>>(url: string, headers?: HashMap<string, string>): Promise<T> { | 81 | static delete<T = ResponseDTO<string>>(url: string, headers?: HashMap<string, string>): Promise<T> { |
| 76 | let config: AxiosRequestConfig = { | 82 | let config: AxiosRequestConfig = { |
| 77 | - headers: HttpRequest.buildHeaderWithGlobalHeader(headers) | 83 | + headers: HttpRequest.buildHeaderWithGlobalHeader(headers), |
| 84 | + timeout:10000, | ||
| 85 | + timeoutErrorMessage:"当前无网络,请重试" | ||
| 78 | } | 86 | } |
| 79 | return service.delete(url, config) | 87 | return service.delete(url, config) |
| 80 | } | 88 | } |
| 1 | import { Action, ContentDTO, Params, InteractDataDTO } from 'wdBean'; | 1 | import { Action, ContentDTO, Params, InteractDataDTO } from 'wdBean'; |
| 2 | import { CommonConstants, ConfigConstants, ScreenType } from 'wdConstant'; | 2 | import { CommonConstants, ConfigConstants, ScreenType } from 'wdConstant'; |
| 3 | -import { Logger, ToastUtils, DateTimeUtils } from 'wdKit'; | 3 | +import { Logger, ToastUtils, DateTimeUtils, DisplayUtils } from 'wdKit'; |
| 4 | import { CompUtils } from '../../utils/CompUtils'; | 4 | import { CompUtils } from '../../utils/CompUtils'; |
| 5 | import { ProcessUtils, WDRouterRule } from 'wdRouter'; | 5 | import { ProcessUtils, WDRouterRule } from 'wdRouter'; |
| 6 | import { TrackConstants, | 6 | import { TrackConstants, |
| @@ -446,8 +446,11 @@ export struct PaperSingleColumn999CardView { | @@ -446,8 +446,11 @@ export struct PaperSingleColumn999CardView { | ||
| 446 | Image(this.loadImg?this.item?.coverUrl:'') | 446 | Image(this.loadImg?this.item?.coverUrl:'') |
| 447 | .borderRadius(5) | 447 | .borderRadius(5) |
| 448 | .objectFit(ImageFit.Fill) | 448 | .objectFit(ImageFit.Fill) |
| 449 | - .aspectRatio(319 / 179) ///图片设计比例 | 449 | + // .aspectRatio(319 / 179) ///图片设计比例 |
| 450 | .padding({ top: 10 }) | 450 | .padding({ top: 10 }) |
| 451 | + .backgroundColor('#f5f5f5') | ||
| 452 | + .width('100%') | ||
| 453 | + .height((DisplayUtils.getDeviceWidth() - 66)*(179 / 319)) | ||
| 451 | //视频 | 454 | //视频 |
| 452 | if (this.item?.videoInfo) { | 455 | if (this.item?.videoInfo) { |
| 453 | Row() { | 456 | Row() { |
| @@ -480,18 +483,14 @@ export struct PaperSingleColumn999CardView { | @@ -480,18 +483,14 @@ export struct PaperSingleColumn999CardView { | ||
| 480 | //直播 | 483 | //直播 |
| 481 | if (this.item?.objectType === '2') { | 484 | if (this.item?.objectType === '2') { |
| 482 | Row() { | 485 | Row() { |
| 483 | - Image(this.buildLiveStateImage()) | ||
| 484 | - .width(14) | ||
| 485 | - .height(14) | ||
| 486 | - .objectFit(ImageFit.Contain) | ||
| 487 | - // LottieView({ | ||
| 488 | - // name: 'MorningPaper_live_status', | ||
| 489 | - // path: "lottie/live_detail_living.json", | ||
| 490 | - // lottieWidth: 14, | ||
| 491 | - // lottieHeight: 14, | ||
| 492 | - // autoplay: true, | ||
| 493 | - // loop: true, | ||
| 494 | - // }) | 486 | + LottieView({ |
| 487 | + name: 'MorningPaper_live_status+'+this.item.objectId, | ||
| 488 | + path: "lottie/live_detail_living.json", | ||
| 489 | + lottieWidth: 14, | ||
| 490 | + lottieHeight: 14, | ||
| 491 | + autoplay: true, | ||
| 492 | + loop: true, | ||
| 493 | + }) | ||
| 495 | 494 | ||
| 496 | Text(this.buildLiveStateString()) | 495 | Text(this.buildLiveStateString()) |
| 497 | .fontColor(Color.White) | 496 | .fontColor(Color.White) |
| @@ -154,7 +154,7 @@ export class PageHelper { | @@ -154,7 +154,7 @@ export class PageHelper { | ||
| 154 | } | 154 | } |
| 155 | // Logger.debug(TAG, 'getPageInfo go on') | 155 | // Logger.debug(TAG, 'getPageInfo go on') |
| 156 | this.parseGroup(pageModel, cacheIsSame) | 156 | this.parseGroup(pageModel, cacheIsSame) |
| 157 | - }).catch(() => { | 157 | + }).catch((err:Error) => { |
| 158 | this.refreshUIEnd(pageModel, false) | 158 | this.refreshUIEnd(pageModel, false) |
| 159 | if (this.isPageLoaded(pageModel)) { | 159 | if (this.isPageLoaded(pageModel)) { |
| 160 | return | 160 | return |
| @@ -15,7 +15,7 @@ import { | @@ -15,7 +15,7 @@ import { | ||
| 15 | } from 'wdBean'; | 15 | } from 'wdBean'; |
| 16 | import { CompStyle } from 'wdConstant/Index'; | 16 | import { CompStyle } from 'wdConstant/Index'; |
| 17 | 17 | ||
| 18 | -import { CollectionUtils, Logger, ResourcesUtils, StringUtils } from 'wdKit'; | 18 | +import { CollectionUtils, Logger, ResourcesUtils, StringUtils, ToastUtils } from 'wdKit'; |
| 19 | import { CacheData, ResponseDTO, } from 'wdNetwork'; | 19 | import { CacheData, ResponseDTO, } from 'wdNetwork'; |
| 20 | import { PageUIReqBean } from '../components/page/bean/PageUIReqBean'; | 20 | import { PageUIReqBean } from '../components/page/bean/PageUIReqBean'; |
| 21 | import { PageRepository } from '../repository/PageRepository'; | 21 | import { PageRepository } from '../repository/PageRepository'; |
| @@ -240,6 +240,9 @@ export class PageViewModel extends BaseViewModel { | @@ -240,6 +240,9 @@ export class PageViewModel extends BaseViewModel { | ||
| 240 | }).catch((err: Error) => { | 240 | }).catch((err: Error) => { |
| 241 | Logger.error(TAG, `getPageInfo then,error.name : ${err.name}, error.message:${err.message}`); | 241 | Logger.error(TAG, `getPageInfo then,error.name : ${err.name}, error.message:${err.message}`); |
| 242 | error(err); | 242 | error(err); |
| 243 | + if(err.message == "网络出小差了,请检查网络后重试"){ | ||
| 244 | + ToastUtils.shortToast(err.message) | ||
| 245 | + } | ||
| 243 | }); | 246 | }); |
| 244 | }); | 247 | }); |
| 245 | } | 248 | } |
| @@ -151,7 +151,7 @@ export struct DetailPlayLiveCommon { | @@ -151,7 +151,7 @@ export struct DetailPlayLiveCommon { | ||
| 151 | .catch((error:Error) => { | 151 | .catch((error:Error) => { |
| 152 | Logger.debug(TAG + "error",error.message,error.name) | 152 | Logger.debug(TAG + "error",error.message,error.name) |
| 153 | this.isHideLoading = true; | 153 | this.isHideLoading = true; |
| 154 | - ToastUtils.shortToast('内容不存在'); | 154 | + ToastUtils.shortToast('网络出小差了,请检查网络后重试'); |
| 155 | router.back(); | 155 | router.back(); |
| 156 | reject(); | 156 | reject(); |
| 157 | }); | 157 | }); |
| @@ -87,9 +87,12 @@ export struct DetailPlayLivePage { | @@ -87,9 +87,12 @@ export struct DetailPlayLivePage { | ||
| 87 | this.getLiveDetails() | 87 | this.getLiveDetails() |
| 88 | this.getLiveRoomData() | 88 | this.getLiveRoomData() |
| 89 | 89 | ||
| 90 | - if(!await onlyWifiLoadVideo()){ | ||
| 91 | - this.showToastTip(this.toastText) | 90 | + if (this.liveDetailPageLogic.dealOrShowToast()) { |
| 91 | + if(!await onlyWifiLoadVideo()){ | ||
| 92 | + this.showToastTip(this.toastText) | ||
| 93 | + } | ||
| 92 | } | 94 | } |
| 95 | + | ||
| 93 | this.configChatRoom() | 96 | this.configChatRoom() |
| 94 | } | 97 | } |
| 95 | 98 |
| @@ -92,4 +92,21 @@ export class LiveDetailPageLogic { | @@ -92,4 +92,21 @@ export class LiveDetailPageLogic { | ||
| 92 | } | 92 | } |
| 93 | return '' | 93 | return '' |
| 94 | } | 94 | } |
| 95 | + | ||
| 96 | + dealOrShowToast(): boolean { | ||
| 97 | + if (this.liveState == 'wait') { | ||
| 98 | + if (this.contentDetailData.liveInfo | ||
| 99 | + && this.contentDetailData.liveInfo.previewUrl.length > 0 | ||
| 100 | + && this.contentDetailData.liveInfo.previewType == 1) { ///预告视频 | ||
| 101 | + return true | ||
| 102 | + } | ||
| 103 | + } | ||
| 104 | + if (this.liveState == 'running') { | ||
| 105 | + if (this.contentDetailData.liveInfo.liveWay == 0) { ///直播视频 | ||
| 106 | + return true | ||
| 107 | + } | ||
| 108 | + } | ||
| 109 | + return false | ||
| 110 | + } | ||
| 111 | + | ||
| 95 | } | 112 | } |
| @@ -11,17 +11,20 @@ export struct TabInfoComponent { | @@ -11,17 +11,20 @@ export struct TabInfoComponent { | ||
| 11 | } | 11 | } |
| 12 | 12 | ||
| 13 | build() { | 13 | build() { |
| 14 | - Column() { | ||
| 15 | - this.showLiveTitle() | ||
| 16 | - this.showLiveDetails() | ||
| 17 | - LiveCountdownComponent({liveDetailsBean:this.contentDetailData}) | ||
| 18 | - }.margin({ | ||
| 19 | - top: 13, | ||
| 20 | - left: 16, | ||
| 21 | - right: 16 | ||
| 22 | - }) | ||
| 23 | - .height('100%') | ||
| 24 | - .alignItems(HorizontalAlign.Start) | 14 | + Scroll(){ |
| 15 | + Column() { | ||
| 16 | + this.showLiveTitle() | ||
| 17 | + this.showLiveDetails() | ||
| 18 | + LiveCountdownComponent({liveDetailsBean:this.contentDetailData}) | ||
| 19 | + }.margin({ | ||
| 20 | + top: 13, | ||
| 21 | + left: 16, | ||
| 22 | + right: 16 | ||
| 23 | + }) | ||
| 24 | + .alignItems(HorizontalAlign.Start) | ||
| 25 | + }.layoutWeight(1) | ||
| 26 | + .width("100%") | ||
| 27 | + .scrollBar(BarState.Off) | ||
| 25 | } | 28 | } |
| 26 | 29 | ||
| 27 | aboutToDisappear(): void { | 30 | aboutToDisappear(): void { |
-
Please register or login to post a comment