提交 b48a03b9 作者: 吴佳伟

fix: 农技农知列表点击播放视频时增加播放次数

上级 a8c8a9f4
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { getList } from '@/api/model/knowledgeVideo' import * as videoApi from '@/api/model/knowledgeVideo'
import dayjs from 'dayjs' import dayjs from 'dayjs'
const model = reactive({ const model = reactive({
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
const getVideoList = (params) => { const getVideoList = (params) => {
if (model.loading) return if (model.loading) return
model.loading = true model.loading = true
getList(params).then((res) => { videoApi.getList(params).then((res) => {
if (res.records.length > 0) { if (res.records.length > 0) {
const { records } = res const { records } = res
if (model.params.pageNo === 1) { if (model.params.pageNo === 1) {
...@@ -122,6 +122,13 @@ ...@@ -122,6 +122,13 @@
const videoContext = uni.createVideoContext(`video${id}`) const videoContext = uni.createVideoContext(`video${id}`)
videoContext.requestFullScreen() videoContext.requestFullScreen()
videoContext.play() videoContext.play()
// 增加播放次数
addViewCount(id)
}
const addViewCount = async (id: string) => {
videoApi.addViewCount({ id })
} }
onReachBottom(() => { onReachBottom(() => {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论