Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
张善主
2024-06-06 16:09:39 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
45d89ed992cf3b1119dba9175f3efb68584f220b
45d89ed9
1 parent
56bc3732
fix(直播详情页):非Wifi提示
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
69 additions
and
7 deletions
sight_harmony/commons/wdKit/src/main/ets/reusable/CustomToast.ets
sight_harmony/features/wdComponent/src/main/ets/utils/lazyloadImg.ets
sight_harmony/features/wdDetailPlayLive/src/main/ets/pages/DetailPlayLivePage.ets
sight_harmony/features/wdDetailPlayLive/src/main/ets/pages/DetailPlayVLivePage.ets
sight_harmony/commons/wdKit/src/main/ets/reusable/CustomToast.ets
View file @
45d89ed
...
...
@@ -11,6 +11,7 @@ export struct CustomToast {
fontSizeValue :number | string | Resource = "27lpx"
lineHeightValue :number | string | Resource = "38lpx"
controller: CustomDialogController
marginTop :number | string | Resource = 0
dismiss: () => void = () => {
}
...
...
@@ -38,5 +39,6 @@ export struct CustomToast {
.padding({top:"23lpx",bottom:'23lpx',left:"35lpx",right:"35lpx"})
.backgroundColor(this.bgColor)
.opacity(this.opacityValue)
.margin({top:this.marginTop})
}
}
...
...
sight_harmony/features/wdComponent/src/main/ets/utils/lazyloadImg.ets
View file @
45d89ed
...
...
@@ -15,4 +15,18 @@ async function onlyWifiLoadImg(): Promise<boolean> {
return false
}
export { onlyWifiLoadImg }
\ No newline at end of file
async function onlyWifiLoadVideo(): Promise<boolean> {
let loadImageOnlyWifiSwitch = await SPHelper.default.get(SpConstants.SETTING_WIFI_VIDEO_SWITCH, '') || false;
if (!loadImageOnlyWifiSwitch) {
// 开关没开,直接让加载视频
return true
}
let netWorkStatus = NetworkUtil.getNetworkType();
// 开关打开,wifi下才加载视频
if (netWorkStatus === NetworkUtil.TYPE_WIFI) {
return true
}
return false
}
export { onlyWifiLoadImg,onlyWifiLoadVideo }
\ No newline at end of file
...
...
sight_harmony/features/wdDetailPlayLive/src/main/ets/pages/DetailPlayLivePage.ets
View file @
45d89ed
...
...
@@ -4,12 +4,13 @@ import { TabComponent } from '../widgets/details/TabComponent';
import { TopPlayComponent } from '../widgets/details/video/TopPlayComponet';
import { DisplayDirection } from 'wdConstant/Index';
import mediaquery from '@ohos.mediaquery';
import { Logger, WindowModel } from 'wdKit/Index';
import {
CustomToast,
Logger, WindowModel } from 'wdKit/Index';
import { router, window } from '@kit.ArkUI';
import { WDAliPlayerController } from 'wdPlayer/Index';
import { LiveOperRowListView } from 'wdComponent';
import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment/model/PublishCommentModel';
import { TrackConstants, TrackingContent, TrackParamConvert } from 'wdTracking/Index';
import { onlyWifiLoadVideo } from 'wdComponent/src/main/ets/utils/lazyloadImg';
let TAG: string = 'DetailPlayLivePage';
...
...
@@ -41,7 +42,28 @@ export struct DetailPlayLivePage {
// 顶部状态栏高度
@Consume topSafeHeight: number
aboutToAppear(): void {
@State toastText: ResourceStr = "这是一个非Wi-Fi环境。请注意流量消耗"
dialogToast: CustomDialogController = new CustomDialogController({
builder: CustomToast({
bgColor: 0xB3000000,
opacityValue: 1,
fontSizeValue: "25lpx",
lineHeightValue: "36lpx",
msg: this.toastText,
marginTop:211/2+px2vp(this.topSafeHeight)-px2vp(84/2)
}),
autoCancel: false,
alignment: DialogAlignment.Top,
customStyle: true,
maskColor: "#00000000"
})
showToastTip(msg: ResourceStr) {
this.toastText = msg
this.dialogToast.open()
}
async aboutToAppear(): Promise<void> {
Logger.info(TAG, `wyj-aboutToAppear`)
this.listener?.on("change", (mediaQueryResult) => {
...
...
@@ -56,6 +78,9 @@ export struct DetailPlayLivePage {
this.getLiveDetails()
this.getLiveRoomData()
if(!await onlyWifiLoadVideo()){
this.showToastTip(this.toastText)
}
}
async aboutToDisappear() {
...
...
@@ -115,7 +140,6 @@ export struct DetailPlayLivePage {
}
.height('100%')
.width('100%')
}
onPageShowCus(): void {
...
...
sight_harmony/features/wdDetailPlayLive/src/main/ets/pages/DetailPlayVLivePage.ets
View file @
45d89ed
import { ContentDetailDTO, LiveRoomDataBean } from 'wdBean/Index';
import { LiveViewModel } from '../viewModel/LiveViewModel';
import { WindowModel } from 'wdKit/Index';
import {
CustomToast,
WindowModel } from 'wdKit/Index';
import { PlayerComponent } from '../widgets/vertical/PlayerComponent';
import { PlayerInfoComponent } from '../widgets/vertical/PlayerInfoComponent';
import { WDAliPlayerController } from 'wdPlayer/Index';
...
...
@@ -9,6 +9,7 @@ import { LiveEmptyComponent, WDLiveViewDefaultType } from 'wdComponent/Index';
import { PlayerEndView } from '../widgets/vertical/PlayerEndView';
import { TrackConstants, TrackingButton } from 'wdTracking/Index';
import { LiveDetailPageLogic } from '../viewModel/LiveDetailPageLogic';
import { onlyWifiLoadVideo } from 'wdComponent/src/main/ets/utils/lazyloadImg';
const storage = LocalStorage.getShared();
const TAG = 'DetailPlayVLivePage'
...
...
@@ -40,11 +41,32 @@ export struct DetailPlayVLivePage {
//播放错误
@State isPlayerError: boolean = false
@State isCanplay: boolean = false
@State toastText: ResourceStr = "这是一个非Wi-Fi环境。请注意流量消耗"
dialogToast: CustomDialogController = new CustomDialogController({
builder: CustomToast({
bgColor: 0xB3000000,
opacityValue: 1,
fontSizeValue: "25lpx",
lineHeightValue: "36lpx",
msg: this.toastText,
}),
autoCancel: false,
alignment: DialogAlignment.Center,
customStyle: true,
maskColor: "#00000000"
})
showToastTip(msg: ResourceStr) {
this.toastText = msg
this.dialogToast.open()
}
a
boutToAppear(): void
{
a
sync aboutToAppear(): Promise<void>
{
this.openFullScreen()
this.getLiveRoomData()
if(!await onlyWifiLoadVideo()){
this.showToastTip(this.toastText)
}
}
aboutToDisappear(): void {
...
...
Please
register
or
login
to post a comment