From f402dbfd8a7be72906e72c03284414d7725ada1b Mon Sep 17 00:00:00 2001 From: lipenggao Date: Thu, 7 Mar 2024 13:31:42 +0800 Subject: [PATCH] xiuga --- pages/binge/binge.js | 200 +++++++++++++-------------- pages/history/history.js | 74 +++++----- pages/index/index.js | 4 +- pages/videoAndroid/videoAndroid.acss | 57 +++++++- pages/videoAndroid/videoAndroid.axml | 47 ++++++- pages/videoAndroid/videoAndroid.js | 129 ++++++++++++++++- 6 files changed, 354 insertions(+), 157 deletions(-) diff --git a/pages/binge/binge.js b/pages/binge/binge.js index bd1b3c4..1595fb7 100644 --- a/pages/binge/binge.js +++ b/pages/binge/binge.js @@ -2,113 +2,113 @@ import { imageBasUrl } from '../../utils/config'; const { httpRequest } = getApp(); Page({ - data: { - imageBasUrl, - likelist: [], - bookcase: [], - signin: 0, - isEdit: false, - likelistFlag: false, - }, - onShow() { - this.setData({ + data: { + imageBasUrl, + likelist: [], + bookcase: [], + signin: 0, + isEdit: false, + likelistFlag: false, + }, + onShow() { + this.setData({ systemInfo: getApp().globalData.systemInfo }) - this.isGetList(); - }, - isGetList() { - const paramenter = { - path: '/chasingdrama', - method: 'GET', - // body: { - // uid: 24 - // } - } - httpRequest(paramenter).then(res => { - if (res.status == 1) { - const { data } = res; - this.setData({ - likelist: data.likelist, - bookcase: data.bookcase, - signin: data.signin, - likelistFlag: true - }) - } - }) - }, + this.isGetList(); + }, + isGetList() { + const paramenter = { + path: '/chasingdrama', + method: 'GET', + // body: { + // uid: 24 + // } + } + httpRequest(paramenter).then(res => { + if (res.status == 1) { + const { data } = res; + this.setData({ + likelist: data.likelist, + bookcase: data.bookcase, + signin: data.signin, + likelistFlag: true + }) + } + }) + }, - setSignIn() { - const paramenter = { - path: '/signin', - method: 'GET', - } - httpRequest(paramenter).then(res => { - if (res.status == 1) { - const { data } = res; - my.showToast({ - content: `${res.msg},获得${data.money}看币`, - duration: 3000, - }); - } - }) - }, + setSignIn() { + const paramenter = { + path: '/signin', + method: 'GET', + } + httpRequest(paramenter).then(res => { + if (res.status == 1) { + const { data } = res; + my.showToast({ + content: `${res.msg},获得${data.money}看币`, + duration: 3000, + }); + } + }) + }, - editPursue() { - // this.isEdit = !this.isEdit; - const isEdit = this.data.isEdit; - this.setData({ - isEdit: !isEdit - }) - }, + editPursue() { + // this.isEdit = !this.isEdit; + const isEdit = this.data.isEdit; + this.setData({ + isEdit: !isEdit + }) + }, - onDelItem(data) { - const bookcase = this.data.bookcase; - const paramenter = { - path: '/chasingdramadel', - method: 'POST', - body: { - sid: data.articleid - } - } - httpRequest(paramenter).then(res => { - const temp = bookcase.filter(r => r.id !== data.id); - if (res.status == 1) { - this.setData({ - bookcase: temp, - }) - my.showToast({ - content: '删除成功!', - duration: 1000, - }); - } - }) - }, + onDelItem(data) { + const bookcase = this.data.bookcase; + const paramenter = { + path: '/chasingdramadel', + method: 'POST', + body: { + sid: data.articleid + } + } + httpRequest(paramenter).then(res => { + const temp = bookcase.filter(r => r.id !== data.id); + if (res.status == 1) { + this.setData({ + bookcase: temp, + }) + my.showToast({ + content: '删除成功!', + duration: 1000, + }); + } + }) + }, - toPathVideo(event) { - const data = event.target.dataset.item; - const isEdit = this.data.isEdit; - const systemInfo = this.data.systemInfo; - if (isEdit) { - this.onDelItem(data); - } else { - if (systemInfo.platform == 'android') { - my.navigateTo({ - url: `/pages/videoAndroid/videoAndroid?sid=${data.id}`, - }); - } else { - my.navigateTo({ - url: `/pages/video/video?sid=${data.id}` - }); - } - - } + toPathVideo(event) { + const data = event.target.dataset.item; + const isEdit = this.data.isEdit; + const systemInfo = this.data.systemInfo; + if (isEdit) { + this.onDelItem(data); + } else { + if (systemInfo.platform == 'android' || systemInfo.platform == 'Android') { + my.navigateTo({ + url: `/pages/videoAndroid/videoAndroid?sid=${data.id}`, + }); + } else { + my.navigateTo({ + url: `/pages/video/video?sid=${data.id}` + }); + } - }, + } - onHide() { - this.setData({ - isEdit: false - }) - } + }, + + onHide() { + this.setData({ + isEdit: false + }) + } }) \ No newline at end of file diff --git a/pages/history/history.js b/pages/history/history.js index 7367d19..17a99f0 100644 --- a/pages/history/history.js +++ b/pages/history/history.js @@ -1,43 +1,43 @@ const { httpRequest } = getApp(); Page({ - data: { - historyList: [], - listFlag: false, - systemInfo: {} - }, - onShow() { - my.showLoading({ - content: '加载中...', - }); - const paramenter = { - path: '/history', - method: 'GET', - } - httpRequest(paramenter).then(res => { - my.hideLoading() - if (res.status == 1 && Array.isArray(res.data)) { - this.setData({ - historyList: res.data, - listFlag: true, - systemInfo: getApp().globalData.systemInfo - }) - } - }) + data: { + historyList: [], + listFlag: false, + systemInfo: {} + }, + onShow() { + my.showLoading({ + content: '加载中...', + }); + const paramenter = { + path: '/history', + method: 'GET', + } + httpRequest(paramenter).then(res => { + my.hideLoading() + if (res.status == 1 && Array.isArray(res.data)) { + this.setData({ + historyList: res.data, + listFlag: true, + systemInfo: getApp().globalData.systemInfo + }) + } + }) - }, - toGetVideo(event) { - const data = event.target.dataset.item; - const systemInfo = this.data.systemInfo; - if (systemInfo.platform == 'android') { - my.navigateTo({ - url: `/pages/videoAndroid/videoAndroid?sid=${data.sid}&id=${data.chapterid || ""}`, - }); - } else { - my.navigateTo({ - url: `/pages/video/video?sid=${data.sid}&id=${data.chapterid || ""}`, - }); - } + }, + toGetVideo(event) { + const data = event.target.dataset.item; + const systemInfo = this.data.systemInfo; + if (systemInfo.platform == 'android' || systemInfo.platform == 'Android') { + my.navigateTo({ + url: `/pages/videoAndroid/videoAndroid?sid=${data.sid}&id=${data.chapterid || ""}`, + }); + } else { + my.navigateTo({ + url: `/pages/video/video?sid=${data.sid}&id=${data.chapterid || ""}`, + }); + } - } + } }) \ No newline at end of file diff --git a/pages/index/index.js b/pages/index/index.js index d6bc105..acf960d 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -74,7 +74,7 @@ Page({ navgetHistory() { const systemInfo = this.data.systemInfo; - if (systemInfo.platform == 'android') { + if (systemInfo.platform == 'android' || systemInfo.platform == 'Android') { my.navigateTo({ url: `/pages/videoAndroid/videoAndroid?sid=${this.history.sid}&id=${this.history.id || "" }`, @@ -98,7 +98,7 @@ Page({ const data = event.target.dataset.item; const systemInfo = this.data.systemInfo; - if (systemInfo.platform == 'android') { + if (systemInfo.platform == 'android' || systemInfo.platform == 'Android') { my.navigateTo({ url: `/pages/videoAndroid/videoAndroid?sid=${data.id}`, }); diff --git a/pages/videoAndroid/videoAndroid.acss b/pages/videoAndroid/videoAndroid.acss index 8d6af90..318e37b 100644 --- a/pages/videoAndroid/videoAndroid.acss +++ b/pages/videoAndroid/videoAndroid.acss @@ -47,17 +47,62 @@ page { position: relative; } -.swiper_video_box{ +._video_controls_warp { position: absolute; - top: 0; left: 0; - right: 0; bottom: 0; + display: flex; + align-items: center; + width: 100%; + height: 100rpx; + padding: 0 40rpx; + /* background-color: rgba(0, 0, 0, 0.3); */ + background: linear-gradient(to top, rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0)); + z-index: 3; +} + +._video_controls_currentTime { + color: #fff; + font-size: 36rpx; +} + +._video_controls_videoDuration { + color: #fff; + font-size: 36rpx; +} + +._video_controls_slider { + flex: 1; + flex-shrink: 0; + padding: 0 20rpx; + margin-top: -8rpx; +} + +.video_status_warp { + position: absolute; + top: 50%; + left: 50%; + display: flex; + justify-content: center; + align-items: center; + width: 120rpx; + height: 120rpx; + border-radius: 50%; + border: 2rpx solid #fff; + background-color: rgba(0, 0, 0, 0.3); + transform: translate(-50%,-50%); + z-index: 3; +} + +.video_status_icon { + width: 40rpx; + height: 40rpx; +} + +.v_s_img { + display: block; width: 100%; height: 100%; - z-index: 1; - /* pointer-events:none; */ - will-change: transform; } .swiper_video_box_android { diff --git a/pages/videoAndroid/videoAndroid.axml b/pages/videoAndroid/videoAndroid.axml index 30845c2..7b370eb 100644 --- a/pages/videoAndroid/videoAndroid.axml +++ b/pages/videoAndroid/videoAndroid.axml @@ -5,18 +5,53 @@ - - + + - - + + + + diff --git a/pages/videoAndroid/videoAndroid.js b/pages/videoAndroid/videoAndroid.js index c467057..40ed9f4 100644 --- a/pages/videoAndroid/videoAndroid.js +++ b/pages/videoAndroid/videoAndroid.js @@ -26,7 +26,13 @@ Page({ batchAllOrder: 0, batchAllList: [], isThrottle: null, - pageHideFlag: true + pageHideFlag: true, + videoStatus: 1, + videoControlTimer: null, + videoDuration: '0.00', + currentTime: '0.00', + sliderMax: 100, + sliderValue: 0 }, // 获取其它信息 isOtherFn() { @@ -141,7 +147,6 @@ Page({ } const isBatchlist = await httpRequest(paramenter); const selectOrderInfo = this.handelOrder(isBatchlist); - console.log(selectOrderInfo, "selectOrderInfo") this.setData({ swiperOrder: videoInfoObj.order, @@ -225,6 +230,8 @@ Page({ const sid = this.data.sid; // const swiperList = this.data.swiperList; const id = videoInfoObj.nextid; + const videoControlTimer = this.data.videoControlTimer; + clearTimeout(videoControlTimer); // const current = videoInfoObj.order; const paramVideo = { path: '/videoread', @@ -246,13 +253,112 @@ Page({ changeCuurent: resData.order - 1, videoInfoObj: resData, orderList: ols, + videoStatus: 1 // swiperOrder: resData.order }) }) }, - onTimeUpdate(ed) { - console.log(ed, "=========") + onTimeUpdate(ev) { + // console.log(ev, "=========") + const videoDuration = ev.detail.videoDuration; + const currentTime = ev.detail.currentTime; + const videoDuration_m = parseInt(videoDuration / 60 % 60); + const videoDuration_s = parseInt(videoDuration % 60); + const currentTime_m = parseInt(currentTime / 60 % 60); + const currentTime_s = parseInt(currentTime % 60); + const vtime_m = videoDuration_m < 10 ? `0${videoDuration_m}` : videoDuration_m; + const vtime_s = videoDuration_s < 10 ? `0${videoDuration_s}` : videoDuration_s; + const ctime_m = currentTime_m < 10 ? `0${currentTime_m}` : currentTime_m; + const ctime_s = currentTime_s < 10 ? `0${currentTime_s}` : currentTime_s; + if (videoDuration != undefined && currentTime != undefined) { + this.setData({ + videoDuration: `${vtime_m}:${vtime_s}`, + currentTime: `${ctime_m}:${ctime_s}`, + sliderMax: parseInt(videoDuration), + sliderValue: parseInt(currentTime) + }) + } + + }, + + videoPlayControl() { + + const videoControlTimer = setTimeout(() => { + const videoStatus = this.data.videoStatus; + if (videoStatus == 2) { + this.setData({ + videoStatus: 1 + }) + } + }, 3000) + + this.setData({ + videoStatus: 2, + videoControlTimer + }) + }, + + onTouchEndControls() { + const videoControlTimer = setTimeout(() => { + const videoStatus = this.data.videoStatus; + if (videoStatus == 2) { + this.setData({ + videoStatus: 1 + }) + } + }, 3000); + + this.setData({ + videoControlTimer + }) + }, + + onTouchStartControls() { + const videoControlTimer = this.data.videoControlTimer; + clearTimeout(videoControlTimer); + }, + + videoSliderChange(ev) { + const sliderValue = ev.detail.value; + const item = ev.currentTarget.dataset.item; + const videoContext = my.createVideoContext(`myVideo_${item.order}`); + videoContext.seek(sliderValue); + this.setData({ + sliderValue + }) + }, + + videoPlayPause(ev) { + const item = ev.currentTarget.dataset.item; + const videoControlTimer = this.data.videoControlTimer; + const videoContext = my.createVideoContext(`myVideo_${item.order}`); + videoContext.pause(); + clearTimeout(videoControlTimer); + this.setData({ + videoStatus: 3 + }) + }, + + videoPlayPlay(ev) { + const item = ev.currentTarget.dataset.item; + const videoContext = my.createVideoContext(`myVideo_${item.order}`); + videoContext.play(); + + const videoControlTimer = setTimeout(() => { + const videoStatus = this.data.videoStatus; + if (videoStatus == 2) { + this.setData({ + videoStatus: 1 + }) + } + }, 3000); + + this.setData({ + videoStatus: 2, + videoControlTimer + }) + }, //显示 选择集数 @@ -280,9 +386,13 @@ Page({ handleOrderCurrent(ev) { const item = ev.target.dataset.item; + // const videoInfoObj = this.data.videoInfoObj; // const orderList = this.data.orderList; // const batchAllOrder = this.data.batchAllOrder; const batchAllList = this.data.batchAllList; + // if(videoInfoObj.order == item.order) { + + // } if (item.order != 1) { const nextVideoObj = batchAllList[item.order - 2]; if (nextVideoObj.isvip == 1) { @@ -295,6 +405,8 @@ Page({ } // const current = item.order - 1; const sid = this.data.sid; + const videoControlTimer = this.data.videoControlTimer; + clearTimeout(videoControlTimer); // const swiperList = this.data.swiperList; const paramVideo = { path: '/videoread', @@ -318,6 +430,7 @@ Page({ orderList: ols, swiperCurrent: resData.order - 1, changeCuurent: resData.order - 1, + videoStatus: 1 }) }) }, @@ -344,6 +457,7 @@ Page({ } else { id = videoInfoObj.lastid; } + const paramVideo = { path: '/videoread', method: 'POST', @@ -352,7 +466,8 @@ Page({ id: id } } - + const videoControlTimer = this.data.videoControlTimer; + clearTimeout(videoControlTimer); httpRequest(paramVideo).then(res => { // swiperList.map() const resData = res.data[0] @@ -364,10 +479,12 @@ Page({ changeCuurent: current, videoInfoObj: resData, orderList: ols, - swiperOrder: resData.order + swiperOrder: resData.order, + videoStatus: 1 }) }) }, 300, { trailing: false }); + this.setData({ isThrottle: isThrottle, pageHideFlag: true