diff --git a/jiuyi2/api/index.js b/jiuyi2/api/index.js index ed995f5e..f5a04fef 100644 --- a/jiuyi2/api/index.js +++ b/jiuyi2/api/index.js @@ -12,6 +12,8 @@ import news from '@/api/news.js' import team from '@/api/team.js' // 消息 import intergral from '@/api/intergral.js' +// 榴莲区 +import durian from '@/api/durian.js' // 商城 import shop from '@/api/shop.js' diff --git a/jiuyi2/api/intergral.js b/jiuyi2/api/intergral.js index 0a9f2c5d..03e64f3f 100644 --- a/jiuyi2/api/intergral.js +++ b/jiuyi2/api/intergral.js @@ -83,8 +83,8 @@ const intergral = { */ viewingTasks(param) { return util.request({ - url: `/home/viewingTasks`, - method: 'post', + url: `/video/Effective/return`, + method: 'GET', query: param.query, }) }, @@ -96,7 +96,7 @@ const intergral = { buyScroll(param) { return util.request({ url: `/coreplay/app/scrollinfo/buyScroll`, - method: 'post', + method: 'G', data: param.data, }) }, diff --git a/jiuyi2/api/video.js b/jiuyi2/api/video.js index bf243a21..e1b9637b 100644 --- a/jiuyi2/api/video.js +++ b/jiuyi2/api/video.js @@ -284,8 +284,8 @@ const video = { */ browseLog(param) { return util.request({ - url: `/home/browseLog`, - query: param.query, + url: `/video/Effective/second`, + data: param.data, method: 'POST', }) }, diff --git a/jiuyi2/common/js/config.js b/jiuyi2/common/js/config.js index 801223e2..150c01ee 100644 --- a/jiuyi2/common/js/config.js +++ b/jiuyi2/common/js/config.js @@ -5,7 +5,8 @@ const config = { host: 'http://localhost:5173', // #endif // #ifndef H5 - host: 'http://192.168.1.236:8080', + host: 'http://192.168.1.235:8080', + // host: 'http://192.168.1.236:8080', // #endif // 上传文件二级路径 uploadFilePath: "/homecommon/file/preview?fileName=", diff --git a/jiuyi2/components/footerMenu/footerMenu.vue b/jiuyi2/components/footerMenu/footerMenu.vue index 4bf73c86..3a9e2c2a 100644 --- a/jiuyi2/components/footerMenu/footerMenu.vue +++ b/jiuyi2/components/footerMenu/footerMenu.vue @@ -74,8 +74,6 @@ switch (mode.value) { case 'default': - // 发布视频 - // arr[2].pagePath = 'pages/release/video' arr.push({ page: 'homepage', type: 'option', @@ -85,7 +83,6 @@ }) break; case 'shop': - // arr[2].pagePath = 'pages/merchant/commodity-release/index' arr.push({ page: 'mine', type: 'option', diff --git a/jiuyi2/components/index/indexVideo.vue b/jiuyi2/components/index/indexVideo.vue index 9ce3405b..edf24f4b 100644 --- a/jiuyi2/components/index/indexVideo.vue +++ b/jiuyi2/components/index/indexVideo.vue @@ -141,21 +141,25 @@ // 手指离开视频容器 function onTouchEnd() { - // 取消视频倍速播放的状态 - if (isLong.value) { - isLong.value = false - videoCtx.value.playbackRate(1) - } - // 如果不是重复点击的状态 - if (!isTap.value) { + if (isTap.value) { isTap.value = false let time = new Date().getTime() let diff = time - tapList[tapList.length - 1] // 判断长按 - if (diff > 350) return + if (diff > 350) { + // 取消视频倍速播放的状态 + if (isLong.value) { + isLong.value = false + videoCtx.value.playbackRate(1) + } + // 清空计数 + tapList.length = 0 + return + } + // tapTimer.value = setTimeout(() => { // 是否点赞 @@ -165,11 +169,12 @@ tapList.length = 0 switch (a) { - case 0: + case 1: changeVideoPlay() break; case 2: console.log('公开赞') + return emit('like', { index: props.index, isLike: isLike == 0 ? 0 : 1 @@ -177,6 +182,7 @@ break; case 3: console.log('隐私赞') + return emit('like', { index: props.index, isLike: isLike == 0 ? 3 : 1 @@ -187,6 +193,13 @@ } } + // 手指中断视频容器 + function onTouchCancel() { + isTap.value = false + tapList.length = 0 + clearTimeout(tapTimer.value) + } + // 切换视频播放 function changeVideoPlay() { // 根据播放状态切换播放暂停 @@ -427,6 +440,7 @@ // 长按 function longtap(ev) { if (isLong.value) return + play() isLong.value = true videoCtx.value.playbackRate(2) } @@ -447,7 +461,7 @@ + @touchcancel="onTouchCancel" @longpress="longtap"> + + + + 2倍速播放中... + + + @@ -480,7 +501,7 @@ - + @@ -576,7 +597,7 @@ - @{{ item.userName }} + @{{ item.userNickname }} @@ -608,6 +629,22 @@ } } + // 倍速播放 + .speedBox { + position: absolute; + top: 200rpx; + left: 0; + right: 0; + align-items: center; + + // 倍速 + .speed { + background-color: rgba(0, 0, 0, .8); + border-radius: 5rpx; + opacity: .6; + } + } + // 暂停蒙层 .pausePanel { background-color: rgba(0, 0, 0, .5); diff --git a/jiuyi2/components/index/task.vue b/jiuyi2/components/index/task.vue index d26f1fe5..b7932ad7 100644 --- a/jiuyi2/components/index/task.vue +++ b/jiuyi2/components/index/task.vue @@ -12,23 +12,17 @@ import { useStore, } from 'vuex' - import intergralApi from '@/api/intergral.js'; - // vuex + // + import api from '@/api/index.js' const store = useStore() //读秒记录 const viewData = ref({ // 有效读秒任务 seconds: 0, - // 卷轴任务 - scrollFlag: false, - // 榴莲果树任务 - treeFlag: false, }) - // 类型 - const type = computed(() => { - let result = viewData.value.scrollFlag || viewData.value.treeFlag - if (result && Number(viewData.value.seconds) > 300) result = false - return result + // 当前任务 + const task = computed(() => { + return store.state.task }) // 进度条 const progress = computed(() => { @@ -45,8 +39,8 @@ // 今日任务读秒记录 function getTasks() { - intergralApi.viewingTasks({}).then(rs => { - if (rs.code == 200 && rs.data) { + api.intergral.viewingTasks({}).then(rs => { + if (rs.code == 200) { viewData.value = rs.data return } @@ -56,14 +50,14 @@ diff --git a/jiuyi2/pages/index/durian.vue b/jiuyi2/pages/index/durian.vue index 195ccc85..5ab3921d 100644 --- a/jiuyi2/pages/index/durian.vue +++ b/jiuyi2/pages/index/durian.vue @@ -70,15 +70,6 @@ util.getPurse() }) - // 今日任务读秒记录 - function viewingTasks() { - intergralApi.viewingTasks({}).then(rs => { - if (rs.code == 200 && rs.data) { - viewData.value = rs.data - } - }) - } - // 榴莲果交易 function transfer() { durianlApi.transfer({ diff --git a/jiuyi2/pages/index/index.nvue b/jiuyi2/pages/index/index.nvue index 41ca8a56..3f4a18f5 100644 --- a/jiuyi2/pages/index/index.nvue +++ b/jiuyi2/pages/index/index.nvue @@ -205,11 +205,12 @@ // console.log('footerMenuRef', option) // // footerMenuHeight.value = option.size.height // }) - - // 获取视频容器节点信息 - dom.getComponentRect(proxy.$refs.containerRef[0], (option) => { - viewSize.height = option.size.height - viewSize.width = option.size.width + nextTick(() => { + // 获取视频容器节点信息 + dom.getComponentRect(proxy.$refs.containerRef[0], (option) => { + viewSize.height = option.size.height + viewSize.width = option.size.width + }) }) }) @@ -320,6 +321,7 @@ // 获取更多推荐视频 function getMoreRecList() { + console.log('recList', recList) if (recList.total <= recList.data.length) return recList.pageNum++ getRecList() @@ -334,6 +336,7 @@ pageSize: recList.pageSize, } }).then(rs => { + console.log('getRecList then rs', recList, rs) if (rs.code == 200) { // 总数 recList.total = rs.total @@ -526,21 +529,40 @@ // 视频暂停 function handleVideoOnPause() { if (proxy.$refs.discRef) proxy.$refs.discRef.pause() - readSecondPause() + // readSecondPause() } - // 观看视频记录 + /** + * 观看视频记录 + * @param {Object} element 记录的视频元素对象 + */ function browseLog(element) { - return util.isLogin().then(rs => { - if (readSecond.count == 0) return + // if (readSecond.count == 0) return + console.log('data', { + // 视频id + videoId: element.item.id, + // 有效读秒时间统计 + viewingDuration: Math.floor(readSecond.count), + // 视频秒数 + videoDescription: Math.floor(element.videoTime.currentTime), + // + task: 0, + }) // api.video.browseLog({ - query: { - videoId: element.item.videoId, - seconds: readSecond.count, + data: { + // 视频id + videoId: element.item.id, + // 有效读秒时间统计 + viewingDuration: Math.floor(readSecond.count), + // 视频秒数 + videoDescription: Math.floor(element.videoTime.currentTime), + // + task: 0, } }).then(rs => { + console.log('browseLog', rs) if (rs.code != 200) { console.log('browseLog err', rs) } diff --git a/jiuyi2/pages/release/video.vue b/jiuyi2/pages/release/video.vue index 30eab895..c10a1d68 100644 --- a/jiuyi2/pages/release/video.vue +++ b/jiuyi2/pages/release/video.vue @@ -373,6 +373,12 @@ } + +